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
+17 -4
View File
@@ -15,7 +15,20 @@ chat issues `thread/start`; a prompt issues `turn/start`; history comes from
question card and `chat_answer` returns the JSON-RPC response. Threads created
this way are ordinary Codex threads and remain visible to the Codex app.
The adapter creates threads with `approvalPolicy: never` and
`sandbox: workspace-write`; Codex approvals are not brokered through the chat
permission card yet. Claude is not advertised as a backend until its sidecar and
login flow are wired.
New threads retain the `workspace-write` sandbox and inherit Codex's configured
approval policy (Pipelines no longer forces `never`). Command, file-change,
network and explicit permission requests appear in the web approval cards. Each
JSON-RPC callback has its own identity, including Code Mode subcommands sharing
one item. Allow once maps to `accept`, session grants to `acceptForSession`, and
Reject to `decline`; explicit permission profiles grant only requested fields.
The web labels session scope explicitly, never as a permanent policy change.
Pending questions and approvals survive browser reconnects while the App Server
connection lives. Standard MCP form/URL elicitation supports typed answers,
Accept/Decline/Cancel and safe external links. Extended OpenAI elicitation is not
advertised; unknown request formats return an explicit unsupported RPC error,
not a fake empty success or silent auto-approval. App Server socket loss does
not provide durable callback recovery; a disconnected transport is reported as
an error rather than claiming old requests are still actionable.
Claude is not advertised as a backend until its sidecar and login flow are wired.
+9
View File
@@ -322,6 +322,15 @@ transient client logs are presentation, not separate server capabilities.
## Chat sessions
Structured tools use `chat_answer` with
`chat_answer: {session_id, form_id, answers, action?}`. Optional `action` is
`accept`, `decline` or `cancel` only when advertised by the pending form's
`actions`; ordinary question replies can omit it. Answers retain JSON types.
OpenCode cancellation calls the existing form DELETE API. Codex MCP elicitation
returns the corresponding action/content; other Codex questions accept answers
only. Permission frames may provide `always_label: "Allow for session"` to avoid
misrepresenting a session-scoped grant as a permanent policy change.
The brokered OpenCode chat exposes the operator's own sessions, separate from the
sessions pipeline runs create. The protocol types are:
+14
View File
@@ -16,3 +16,17 @@ answers survive streaming updates. Full approval resource text is expandable.
The controlled browser regression reloads with two pending approvals and two
questions, then checks that all four replies reach Go. It does not execute real
commands, alter permission configuration, or approve a production request.
## Typed interaction controls
Web form fields now preserve booleans and numbers (`false`/`0` are answers),
integer/range and length constraints, defaults, conditional visibility,
multiselect/custom values, masked secret inputs and HTTP(S)-only external links.
Hidden conditional answers are omitted. OpenCode forms offer cancellation through
their documented DELETE endpoint, without answering or rerunning the tool.
Codex command/file/network/permission approvals and standard MCP elicitation are
brokered over their original JSON-RPC callbacks. Session grants are labelled as
such. Responses are acknowledged only after the transport write succeeds;
foreign-session answers are refused. Schemas were checked against generated
protocol source tagged `rust-v0.163.0`, matching the installed package manifest.