feat(chat): broker Codex approvals and complete typed tool interactions

This commit is contained in:
2026-10-20 17:41:35 +01:00
parent f31806cfcb
commit 35329e4022
21 changed files with 879 additions and 84 deletions
+31 -8
View File
@@ -478,6 +478,7 @@ type ChatForm struct {
Resolved bool `json:"resolved,omitempty"`
Cancelled bool `json:"cancelled,omitempty"`
Answers map[string]any `json:"answers,omitempty"`
Actions []string `json:"actions,omitempty"`
}
// ChatFormField is one question/input in a form. Type is OpenCode's field type
@@ -491,6 +492,26 @@ type ChatFormField struct {
Options []ChatFormOption `json:"options,omitempty"`
Custom bool `json:"custom,omitempty"`
Required bool `json:"required,omitempty"`
Secret bool `json:"secret,omitempty"`
URL string `json:"url,omitempty"`
Default any `json:"default,omitempty"`
Minimum any `json:"minimum,omitempty"`
Maximum any `json:"maximum,omitempty"`
MinLength *int `json:"min_length,omitempty"`
MaxLength *int `json:"max_length,omitempty"`
MinItems *int `json:"min_items,omitempty"`
MaxItems *int `json:"max_items,omitempty"`
Format string `json:"format,omitempty"`
Pattern string `json:"pattern,omitempty"`
Placeholder string `json:"placeholder,omitempty"`
Hidden bool `json:"hidden,omitempty"`
When []ChatFormWhen `json:"when,omitempty"`
}
type ChatFormWhen struct {
Key string `json:"key"`
Op string `json:"op"`
Value any `json:"value"`
}
// ChatFormOption is one selectable choice in a ChatFormField.
@@ -511,6 +532,7 @@ type ChatRenameRequest struct {
// answer object. It is deliberately separate from ChatQuery because its payload
// is structured answers, not a session-scoped read.
type ChatAnswerRequest struct {
Action string `json:"action,omitempty"`
SessionID string `json:"session_id"`
FormID string `json:"form_id"`
Answers map[string]any `json:"answers"`
@@ -553,14 +575,15 @@ type ChatShellOutputPage struct {
// The wire shape is spec-verified; a live pending request has not been observed.
// Every optional field is omitempty so older peers ignore it.
type ChatPermissionFrame struct {
SessionID string `json:"session_id"`
RequestID string `json:"request_id"`
Action string `json:"action,omitempty"`
Resources []string `json:"resources,omitempty"`
Save []string `json:"save,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
Source *ChatPermissionSource `json:"source,omitempty"`
Message string `json:"message,omitempty"`
SessionID string `json:"session_id"`
RequestID string `json:"request_id"`
Action string `json:"action,omitempty"`
Resources []string `json:"resources,omitempty"`
Save []string `json:"save,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
Source *ChatPermissionSource `json:"source,omitempty"`
Message string `json:"message,omitempty"`
AlwaysLabel string `json:"always_label,omitempty"`
// Resolved, Decision and ResolvedBy report the shared, exactly-once outcome
// of a request any client may answer: once the first answer is recorded the
// server pushes the same frame back to every watching client with Resolved