116- **Start (or resume) a thread**: Call `thread/start` for a new conversation, `thread/resume` to continue an existing one, or `thread/fork` to branch history into a new thread id.116- **Start (or resume) a thread**: Call `thread/start` for a new conversation, `thread/resume` to continue an existing one, or `thread/fork` to branch history into a new thread id.
117- **Begin a turn**: Call `turn/start` with the target `threadId` and user input. Optional fields override model, personality, `cwd`, sandbox policy, and more.117- **Begin a turn**: Call `turn/start` with the target `threadId` and user input. Optional fields override model, personality, `cwd`, sandbox policy, and more.
118- **Steer an active turn**: Call `turn/steer` to append user input to the currently in-flight turn without creating a new turn.118- **Steer an active turn**: Call `turn/steer` to append user input to the currently in-flight turn without creating a new turn.
119- **Stream events**: After `turn/start`, keep reading notifications on stdout: `item/started`, `item/completed`, `item/agentMessage/delta`, tool progress, and other updates.119- **Stream events**: After `turn/start`, keep reading notifications on stdout: `thread/archived`, `thread/unarchived`, `item/started`, `item/completed`, `item/agentMessage/delta`, tool progress, and other updates.
120- **Finish the turn**: The server emits `turn/completed` with final status when the model finishes or after a `turn/interrupt` cancellation.120- **Finish the turn**: The server emits `turn/completed` with final status when the model finishes or after a `turn/interrupt` cancellation.
121 121
122## Initialization122## Initialization
201- `thread/start` - create a new thread; emits `thread/started` and automatically subscribes you to turn/item events for that thread.201- `thread/start` - create a new thread; emits `thread/started` and automatically subscribes you to turn/item events for that thread.
202- `thread/resume` - reopen an existing thread by id so later `turn/start` calls append to it.202- `thread/resume` - reopen an existing thread by id so later `turn/start` calls append to it.
203- `thread/fork` - fork a thread into a new thread id by copying stored history; emits `thread/started` for the new thread.203- `thread/fork` - fork a thread into a new thread id by copying stored history; emits `thread/started` for the new thread.
204- `thread/read` - read a stored thread by id without resuming it; set `includeTurns` to return full turn history.204- `thread/read` - read a stored thread by id without resuming it; set `includeTurns` to return full turn history. Returned `thread` objects include runtime `status`.
205- `thread/list` - page through stored thread logs; supports cursor-based pagination plus `modelProviders`, `sourceKinds`, `archived`, and `cwd` filters.205- `thread/list` - page through stored thread logs; supports cursor-based pagination plus `modelProviders`, `sourceKinds`, `archived`, and `cwd` filters. Returned `thread` objects include runtime `status`.
206- `thread/loaded/list` - list the thread ids currently loaded in memory.206- `thread/loaded/list` - list the thread ids currently loaded in memory.
207- `thread/archive` - move a thread’s log file into the archived directory; returns `{}` on success.207- `thread/archive` - move a thread's log file into the archived directory; returns `{}` on success and emits `thread/archived`.
208- `thread/unarchive` - restore an archived thread rollout back into the active sessions directory; returns the restored `thread`.208- `thread/unsubscribe` - unsubscribe this connection from thread turn/item events. If this was the last subscriber, the server unloads the thread and emits `thread/closed`.
209- `thread/unarchive` - restore an archived thread rollout back into the active sessions directory; returns the restored `thread` and emits `thread/unarchived`.
210- `thread/status/changed` - notification emitted when a loaded thread's runtime `status` changes.
209- `thread/compact/start` - trigger conversation history compaction for a thread; returns `{}` immediately while progress streams via `turn/*` and `item/*` notifications.211- `thread/compact/start` - trigger conversation history compaction for a thread; returns `{}` immediately while progress streams via `turn/*` and `item/*` notifications.
210- `thread/rollback` - drop the last N turns from the in-memory context and persist a rollback marker; returns the updated `thread`.212- `thread/rollback` - drop the last N turns from the in-memory context and persist a rollback marker; returns the updated `thread`.
211- `turn/start` - add user input to a thread and begin Codex generation; responds with the initial `turn` and streams events. For `collaborationMode`, `settings.developer_instructions: null` means "use built-in instructions for the selected mode."213- `turn/start` - add user input to a thread and begin Codex generation; responds with the initial `turn` and streams events. For `collaborationMode`, `settings.developer_instructions: null` means "use built-in instructions for the selected mode."
223- `tool/requestUserInput` - prompt the user with 1-3 short questions for a tool call (experimental); questions can set `isOther` for a free-form option.225- `tool/requestUserInput` - prompt the user with 1-3 short questions for a tool call (experimental); questions can set `isOther` for a free-form option.
224- `config/mcpServer/reload` - reload MCP server configuration from disk and queue a refresh for loaded threads.226- `config/mcpServer/reload` - reload MCP server configuration from disk and queue a refresh for loaded threads.
225- `mcpServerStatus/list` - list MCP servers, tools, resources, and auth status (cursor + limit pagination).227- `mcpServerStatus/list` - list MCP servers, tools, resources, and auth status (cursor + limit pagination).
226- `feedback/upload` - submit a feedback report (classification + optional reason/logs + conversation id).228- `windowsSandbox/setupStart` - start Windows sandbox setup for `elevated` or `unelevated` mode; returns quickly and later emits `windowsSandbox/setupCompleted`.
229- `feedback/upload` - submit a feedback report (classification + optional reason/logs + conversation id, plus optional `extraLogFiles` attachments).
227- `config/read` - fetch the effective configuration on disk after resolving configuration layering.230- `config/read` - fetch the effective configuration on disk after resolving configuration layering.
231- `externalAgentConfig/detect` - detect migratable external-agent artifacts with `includeHome` and optional `cwds`; each detected item includes `cwd` (`null` for home).
232- `externalAgentConfig/import` - apply selected external-agent migration items by passing explicit `migrationItems` with `cwd` (`null` for home).
228- `config/value/write` - write a single configuration key/value to the user's `config.toml` on disk.233- `config/value/write` - write a single configuration key/value to the user's `config.toml` on disk.
229- `config/batchWrite` - apply configuration edits atomically to the user's `config.toml` on disk.234- `config/batchWrite` - apply configuration edits atomically to the user's `config.toml` on disk.
230- `configRequirements/read` - fetch requirements from `requirements.toml` and/or MDM, including allow-lists and residency requirements (or `null` if you haven’t set any up).235- `configRequirements/read` - fetch requirements from `requirements.toml` and/or MDM, including allow-lists, pinned `featureRequirements`, and residency/network requirements (or `null` if you haven't set any up).
231 236
232## Models237## Models
233 238
239{ "method": "model/list", "id": 6, "params": { "limit": 20, "includeHidden": false } }244{ "method": "model/list", "id": 6, "params": { "limit": 20, "includeHidden": false } }
240{ "id": 6, "result": {245{ "id": 6, "result": {
241 "data": [{246 "data": [{
242 "id": "gpt-5.2-codex",247 "id": "gpt-5.4",
243 "model": "gpt-5.2-codex",248 "model": "gpt-5.4",
244 "upgrade": "gpt-5.3-codex",249 "displayName": "GPT-5.4",
245 "displayName": "GPT-5.2 Codex",
246 "hidden": false,250 "hidden": false,
247 "defaultReasoningEffort": "medium",251 "defaultReasoningEffort": "medium",
248 "reasoningEffort": [{252 "supportedReasoningEfforts": [{
249 "effort": "low",253 "reasoningEffort": "low",
250 "description": "Lower latency"254 "description": "Lower latency"
251 }],255 }],
252 "inputModalities": ["text", "image"],256 "inputModalities": ["text", "image"],
259 263
260Each model entry can include:264Each model entry can include:
261 265
262- `reasoningEffort` - supported effort options for the model.266- `supportedReasoningEfforts` - supported effort options for the model.
263- `defaultReasoningEffort` - suggested default effort for clients.267- `defaultReasoningEffort` - suggested default effort for clients.
264- `upgrade` - optional recommended upgrade model id for migration prompts in clients.268- `upgrade` - optional recommended upgrade model id for migration prompts in clients.
269- `upgradeInfo` - optional upgrade metadata for migration prompts in clients.
265- `hidden` - whether the model is hidden from the default picker list.270- `hidden` - whether the model is hidden from the default picker list.
266- `inputModalities` - supported input types for the model (for example `text`, `image`).271- `inputModalities` - supported input types for the model (for example `text`, `image`).
267- `supportsPersonality` - whether the model supports personality-specific instructions such as `/personality`.272- `supportsPersonality` - whether the model supports personality-specific instructions such as `/personality`.
299- `thread/list` supports cursor pagination plus `modelProviders`, `sourceKinds`, `archived`, and `cwd` filtering.304- `thread/list` supports cursor pagination plus `modelProviders`, `sourceKinds`, `archived`, and `cwd` filtering.
300- `thread/loaded/list` returns the thread IDs currently in memory.305- `thread/loaded/list` returns the thread IDs currently in memory.
301- `thread/archive` moves the thread's persisted JSONL log into the archived directory.306- `thread/archive` moves the thread's persisted JSONL log into the archived directory.
307- `thread/unsubscribe` unsubscribes the current connection from a loaded thread and can trigger `thread/closed`.
302- `thread/unarchive` restores an archived thread rollout back into the active sessions directory.308- `thread/unarchive` restores an archived thread rollout back into the active sessions directory.
303- `thread/compact/start` triggers compaction and returns `{}` immediately.309- `thread/compact/start` triggers compaction and returns `{}` immediately.
304- `thread/rollback` drops the last N turns from the in-memory context and records a rollback marker in the thread's persisted JSONL log.310- `thread/rollback` drops the last N turns from the in-memory context and records a rollback marker in the thread's persisted JSONL log.
313 "cwd": "/Users/me/project",319 "cwd": "/Users/me/project",
314 "approvalPolicy": "never",320 "approvalPolicy": "never",
315 "sandbox": "workspaceWrite",321 "sandbox": "workspaceWrite",
316 "personality": "friendly"322 "personality": "friendly",
323 "serviceName": "my_app_server_client"
317} }324} }
318{ "id": 10, "result": {325{ "id": 10, "result": {
319 "thread": {326 "thread": {
320 "id": "thr_123",327 "id": "thr_123",
321 "preview": "",328 "preview": "",
329 "ephemeral": false,
322 "modelProvider": "openai",330 "modelProvider": "openai",
323 "createdAt": 1730910000331 "createdAt": 1730910000
324 }332 }
326{ "method": "thread/started", "params": { "thread": { "id": "thr_123" } } }334{ "method": "thread/started", "params": { "thread": { "id": "thr_123" } } }
327```335```
328 336
337`serviceName` is optional. Set it when you want app-server to tag thread-level metrics with your integration's service name.
338
329To continue a stored session, call `thread/resume` with the `thread.id` you recorded earlier. The response shape matches `thread/start`. You can also pass the same configuration overrides supported by `thread/start`, such as `personality`:339To continue a stored session, call `thread/resume` with the `thread.id` you recorded earlier. The response shape matches `thread/start`. You can also pass the same configuration overrides supported by `thread/start`, such as `personality`:
330 340
331```json341```json
333 "threadId": "thr_123",343 "threadId": "thr_123",
334 "personality": "friendly"344 "personality": "friendly"
335} }345} }
336{ "id": 11, "result": { "thread": { "id": "thr_123" } } }346{ "id": 11, "result": { "thread": { "id": "thr_123", "name": "Bug bash notes", "ephemeral": false } } }
337```347```
338 348
339Resuming a thread doesn't update `thread.updatedAt` (or the rollout file's modified time) by itself. The timestamp updates when you start a turn.349Resuming a thread doesn't update `thread.updatedAt` (or the rollout file's modified time) by itself. The timestamp updates when you start a turn.
352{ "method": "thread/started", "params": { "thread": { "id": "thr_456" } } }362{ "method": "thread/started", "params": { "thread": { "id": "thr_456" } } }
353```363```
354 364
365When a user-facing thread title has been set, app-server hydrates `thread.name` on `thread/list`, `thread/read`, `thread/resume`, `thread/unarchive`, and `thread/rollback` responses. `thread/start` and `thread/fork` may omit `name` (or return `null`) until a title is set later.
366
355### Read a stored thread (without resuming)367### Read a stored thread (without resuming)
356 368
357Use `thread/read` when you want stored thread data but don't want to resume the thread or subscribe to its events.369Use `thread/read` when you want stored thread data but don't want to resume the thread or subscribe to its events.
358 370
359- `includeTurns` - when `true`, the response includes the thread's turns; when `false` or omitted, you get the thread summary only.371- `includeTurns` - when `true`, the response includes the thread's turns; when `false` or omitted, you get the thread summary only.
372- Returned `thread` objects include runtime `status` (`notLoaded`, `idle`, `systemError`, or `active` with `activeFlags`).
360 373
361```json374```json
362{ "method": "thread/read", "id": 19, "params": { "threadId": "thr_123", "includeTurns": true } }375{ "method": "thread/read", "id": 19, "params": { "threadId": "thr_123", "includeTurns": true } }
363{ "id": 19, "result": { "thread": { "id": "thr_123", "turns": [] } } }376{ "id": 19, "result": { "thread": { "id": "thr_123", "name": "Bug bash notes", "ephemeral": false, "status": { "type": "notLoaded" }, "turns": [] } } }
364```377```
365 378
366Unlike `thread/resume`, `thread/read` doesn't load the thread into memory or emit `thread/started`.379Unlike `thread/resume`, `thread/read` doesn't load the thread into memory or emit `thread/started`.
400} }413} }
401{ "id": 20, "result": {414{ "id": 20, "result": {
402 "data": [415 "data": [
403 { "id": "thr_a", "preview": "Create a TUI", "modelProvider": "openai", "createdAt": 1730831111, "updatedAt": 1730831111 },416 { "id": "thr_a", "preview": "Create a TUI", "ephemeral": false, "modelProvider": "openai", "createdAt": 1730831111, "updatedAt": 1730831111, "name": "TUI prototype", "status": { "type": "notLoaded" } },
404 { "id": "thr_b", "preview": "Fix tests", "modelProvider": "openai", "createdAt": 1730750000, "updatedAt": 1730750000 }417 { "id": "thr_b", "preview": "Fix tests", "ephemeral": true, "modelProvider": "openai", "createdAt": 1730750000, "updatedAt": 1730750000, "status": { "type": "notLoaded" } }
405 ],418 ],
406 "nextCursor": "opaque-token-or-null"419 "nextCursor": "opaque-token-or-null"
407} }420} }
409 422
410When `nextCursor` is `null`, you have reached the final page.423When `nextCursor` is `null`, you have reached the final page.
411 424
425### Track thread status changes
426
427`thread/status/changed` is emitted whenever a loaded thread's runtime status changes. The payload includes `threadId` and the new `status`.
428
429```json
430{
431 "method": "thread/status/changed",
432 "params": {
433 "threadId": "thr_123",
434 "status": { "type": "active", "activeFlags": ["waitingOnApproval"] }
435 }
436}
437```
438
412### List loaded threads439### List loaded threads
413 440
414`thread/loaded/list` returns thread IDs currently loaded in memory.441`thread/loaded/list` returns thread IDs currently loaded in memory.
418{ "id": 21, "result": { "data": ["thr_123", "thr_456"] } }445{ "id": 21, "result": { "data": ["thr_123", "thr_456"] } }
419```446```
420 447
448### Unsubscribe from a loaded thread
449
450`thread/unsubscribe` removes the current connection's subscription to a thread. The response status is one of:
451
452- `unsubscribed` when the connection was subscribed and is now removed.
453- `notSubscribed` when the connection was not subscribed to that thread.
454- `notLoaded` when the thread is not loaded.
455
456If this was the last subscriber, the server unloads the thread and emits a `thread/status/changed` transition to `notLoaded` plus `thread/closed`.
457
458```json
459{ "method": "thread/unsubscribe", "id": 22, "params": { "threadId": "thr_123" } }
460{ "id": 22, "result": { "status": "unsubscribed" } }
461{ "method": "thread/status/changed", "params": {
462 "threadId": "thr_123",
463 "status": { "type": "notLoaded" }
464} }
465{ "method": "thread/closed", "params": { "threadId": "thr_123" } }
466```
467
421### Archive a thread468### Archive a thread
422 469
423Use `thread/archive` to move the persisted thread log (stored as a JSONL file on disk) into the archived sessions directory.470Use `thread/archive` to move the persisted thread log (stored as a JSONL file on disk) into the archived sessions directory.
425```json472```json
426{ "method": "thread/archive", "id": 22, "params": { "threadId": "thr_b" } }473{ "method": "thread/archive", "id": 22, "params": { "threadId": "thr_b" } }
427{ "id": 22, "result": {} }474{ "id": 22, "result": {} }
475{ "method": "thread/archived", "params": { "threadId": "thr_b" } }
428```476```
429 477
430Archived threads won't appear in future calls to `thread/list` unless you pass `archived: true`.478Archived threads won't appear in future calls to `thread/list` unless you pass `archived: true`.
435 483
436```json484```json
437{ "method": "thread/unarchive", "id": 24, "params": { "threadId": "thr_b" } }485{ "method": "thread/unarchive", "id": 24, "params": { "threadId": "thr_b" } }
438{ "id": 24, "result": { "thread": { "id": "thr_b" } } }486{ "id": 24, "result": { "thread": { "id": "thr_b", "name": "Bug bash notes" } } }
487{ "method": "thread/unarchived", "params": { "threadId": "thr_b" } }
439```488```
440 489
441### Trigger thread compaction490### Trigger thread compaction
449{ "id": 25, "result": {} }498{ "id": 25, "result": {} }
450```499```
451 500
501### Roll back recent turns
502
503Use `thread/rollback` to remove the last `numTurns` entries from the in-memory context and persist a rollback marker in the rollout log. The returned `thread` includes `turns` populated after the rollback.
504
505```json
506{ "method": "thread/rollback", "id": 26, "params": { "threadId": "thr_b", "numTurns": 1 } }
507{ "id": 26, "result": { "thread": { "id": "thr_b", "name": "Bug bash notes", "ephemeral": false } } }
508```
509
452## Turns510## Turns
453 511
454The `input` field accepts a list of items:512The `input` field accepts a list of items:
478}536}
479```537```
480 538
539On macOS, `includePlatformDefaults: true` appends a curated platform-default Seatbelt policy for restricted-read sessions. This improves tool compatibility without broadly allowing all of `/System`.
540
481Examples:541Examples:
482 542
483```json543```json
654- `sandboxPolicy` accepts the same shape used by `turn/start` (for example, `dangerFullAccess`, `readOnly`, `workspaceWrite`, `externalSandbox`).714- `sandboxPolicy` accepts the same shape used by `turn/start` (for example, `dangerFullAccess`, `readOnly`, `workspaceWrite`, `externalSandbox`).
655- When omitted, `timeoutMs` falls back to the server default.715- When omitted, `timeoutMs` falls back to the server default.
656 716
717### Read admin requirements (`configRequirements/read`)
718
719Use `configRequirements/read` to inspect the effective admin requirements loaded from `requirements.toml` and/or MDM.
720
721```json
722{ "method": "configRequirements/read", "id": 52, "params": {} }
723{ "id": 52, "result": {
724 "requirements": {
725 "allowedApprovalPolicies": ["onRequest", "unlessTrusted"],
726 "allowedSandboxModes": ["readOnly", "workspaceWrite"],
727 "featureRequirements": {
728 "personality": true,
729 "unified_exec": false
730 },
731 "network": {
732 "enabled": true,
733 "allowedDomains": ["api.openai.com"],
734 "allowUnixSockets": ["/tmp/example.sock"],
735 "dangerouslyAllowAllUnixSockets": false
736 }
737 }
738} }
739```
740
741`result.requirements` is `null` when no requirements are configured. See the docs on [`requirements.toml`](https://developers.openai.com/codex/config-reference#requirementstoml) for details on supported keys and values.
742
743### Windows sandbox setup (`windowsSandbox/setupStart`)
744
745Custom Windows clients can trigger sandbox setup asynchronously instead of blocking on startup checks.
746
747```json
748{ "method": "windowsSandbox/setupStart", "id": 53, "params": { "mode": "elevated" } }
749{ "id": 53, "result": { "started": true } }
750```
751
752App-server starts setup in the background and later emits a completion notification:
753
754```json
755{
756 "method": "windowsSandbox/setupCompleted",
757 "params": { "mode": "elevated", "success": true, "error": null }
758}
759```
760
761Modes:
762
763- `elevated` - run the elevated Windows sandbox setup path.
764- `unelevated` - run the legacy setup/preflight path.
765
657## Events766## Events
658 767
659Event notifications are the server-initiated stream for thread lifecycles, turn lifecycles, and the items within them. After you start or resume a thread, keep reading the active transport stream for `thread/started`, `turn/*`, and `item/*` notifications.768Event notifications are the server-initiated stream for thread lifecycles, turn lifecycles, and the items within them. After you start or resume a thread, keep reading the active transport stream for `thread/started`, `thread/archived`, `thread/unarchived`, `thread/closed`, `thread/status/changed`, `turn/*`, `item/*`, and `serverRequest/resolved` notifications.
660 769
661### Notification opt-out770### Notification opt-out
662 771
674- `fuzzyFileSearch/sessionUpdated` - `{ sessionId, query, files }` with the current matches for the active query.783- `fuzzyFileSearch/sessionUpdated` - `{ sessionId, query, files }` with the current matches for the active query.
675- `fuzzyFileSearch/sessionCompleted` - `{ sessionId }` once indexing and matching for that query completes.784- `fuzzyFileSearch/sessionCompleted` - `{ sessionId }` once indexing and matching for that query completes.
676 785
786### Windows sandbox setup events
787
788- `windowsSandbox/setupCompleted` - `{ mode, success, error }` emitted after a `windowsSandbox/setupStart` request finishes.
789
677### Turn events790### Turn events
678 791
679- `turn/started` - `{ turn }` with the turn id, empty `items`, and `status: "inProgress"`.792- `turn/started` - `{ turn }` with the turn id, empty `items`, and `status: "inProgress"`.
689`ThreadItem` is the tagged union carried in turn responses and `item/*` notifications. Common item types include:802`ThreadItem` is the tagged union carried in turn responses and `item/*` notifications. Common item types include:
690 803
691- `userMessage` - `{id, content}` where `content` is a list of user inputs (`text`, `image`, or `localImage`).804- `userMessage` - `{id, content}` where `content` is a list of user inputs (`text`, `image`, or `localImage`).
692- `agentMessage` - `{id, text}` containing the accumulated agent reply.805- `agentMessage` - `{id, text, phase?}` containing the accumulated agent reply. When present, `phase` uses Responses API wire values (`commentary`, `final_answer`).
693- `plan` - `{id, text}` containing proposed plan text in plan mode. Treat the final `plan` item from `item/completed` as authoritative.806- `plan` - `{id, text}` containing proposed plan text in plan mode. Treat the final `plan` item from `item/completed` as authoritative.
694- `reasoning` - `{id, summary, content}` where `summary` holds streamed reasoning summaries and `content` holds raw reasoning blocks.807- `reasoning` - `{id, summary, content}` where `summary` holds streamed reasoning summaries and `content` holds raw reasoning blocks.
695- `commandExecution` - `{id, command, cwd, status, commandActions, aggregatedOutput?, exitCode?, durationMs?}`.808- `commandExecution` - `{id, command, cwd, status, commandActions, aggregatedOutput?, exitCode?, durationMs?}`.
696- `fileChange` - `{id, changes, status}` describing proposed edits; `changes` list `{path, kind, diff}`.809- `fileChange` - `{id, changes, status}` describing proposed edits; `changes` list `{path, kind, diff}`.
697- `mcpToolCall` - `{id, server, tool, status, arguments, result?, error?}`.810- `mcpToolCall` - `{id, server, tool, status, arguments, result?, error?}`.
811- `dynamicToolCall` - `{id, tool, arguments, status, contentItems?, success?, durationMs?}` for client-executed dynamic tool invocations.
698- `collabToolCall` - `{id, tool, status, senderThreadId, receiverThreadId?, newThreadId?, prompt?, agentStatus?}`.812- `collabToolCall` - `{id, tool, status, senderThreadId, receiverThreadId?, newThreadId?, prompt?, agentStatus?}`.
699- `webSearch` - `{id, query, action?}` for web search requests issued by the agent.813- `webSearch` - `{id, query, action?}` for web search requests issued by the agent.
700- `imageView` - `{id, path}` emitted when the agent invokes the image viewer tool.814- `imageView` - `{id, path}` emitted when the agent invokes the image viewer tool.
751Order of messages:865Order of messages:
752 866
7531. `item/started` shows the pending `commandExecution` item with `command`, `cwd`, and other fields.8671. `item/started` shows the pending `commandExecution` item with `command`, `cwd`, and other fields.
7542. `item/commandExecution/requestApproval` includes `itemId`, `threadId`, `turnId`, optional `reason`, optional `command`, optional `cwd`, optional `commandActions`, and optional `proposedExecpolicyAmendment`.8682. `item/commandExecution/requestApproval` includes `itemId`, `threadId`, `turnId`, optional `reason`, optional `command`, optional `cwd`, optional `commandActions`, optional `proposedExecpolicyAmendment`, optional `networkApprovalContext`, and optional `availableDecisions`. When `initialize.params.capabilities.experimentalApi = true`, the payload can also include experimental `additionalPermissions` describing requested per-command sandbox access. Any filesystem paths inside `additionalPermissions` are absolute on the wire.
7553. Client responds with one of the command execution approval decisions above.8693. Client responds with one of the command execution approval decisions above.
7564. `item/completed` returns the final `commandExecution` item with `status: completed | failed | declined`.8704. `serverRequest/resolved` confirms that the pending request has been answered or cleared.
8715. `item/completed` returns the final `commandExecution` item with `status: completed | failed | declined`.
872
873When `networkApprovalContext` is present, the prompt is for managed network access (not a general shell-command approval). The current v2 schema exposes the target `host` and `protocol`; clients should render a network-specific prompt and not rely on `command` being a user-meaningful shell command preview.
874
875Codex groups concurrent network approval prompts by destination (`host`, protocol, and port). The app-server may therefore send one prompt that unblocks multiple queued requests to the same destination, while different ports on the same host are treated separately.
757 876
758### File change approvals877### File change approvals
759 878
7621. `item/started` emits a `fileChange` item with proposed `changes` and `status: "inProgress"`.8811. `item/started` emits a `fileChange` item with proposed `changes` and `status: "inProgress"`.
7632. `item/fileChange/requestApproval` includes `itemId`, `threadId`, `turnId`, optional `reason`, and optional `grantRoot`.8822. `item/fileChange/requestApproval` includes `itemId`, `threadId`, `turnId`, optional `reason`, and optional `grantRoot`.
7643. Client responds with one of the file change approval decisions above.8833. Client responds with one of the file change approval decisions above.
7654. `item/completed` returns the final `fileChange` item with `status: completed | failed | declined`.8844. `serverRequest/resolved` confirms that the pending request has been answered or cleared.
8855. `item/completed` returns the final `fileChange` item with `status: completed | failed | declined`.
886
887### `tool/requestUserInput`
888
889When the client responds to `item/tool/requestUserInput`, app-server emits `serverRequest/resolved` with `{ threadId, requestId }`. If the pending request is cleared by turn start, turn completion, or turn interruption before the client answers, the server emits the same notification for that cleanup.
890
891### Dynamic tool calls (experimental)
892
893`dynamicTools` on `thread/start` and the corresponding `item/tool/call` request or response flow are experimental APIs.
894
895When a dynamic tool is invoked during a turn, app-server emits:
896
8971. `item/started` with `item.type = "dynamicToolCall"`, `status = "inProgress"`, plus `tool` and `arguments`.
8982. `item/tool/call` as a server request to the client.
8993. The client response payload with returned content items.
9004. `item/completed` with `item.type = "dynamicToolCall"`, the final `status`, and any returned `contentItems` or `success` value.
766 901
767### MCP tool-call approvals (apps)902### MCP tool-call approvals (apps)
768 903
769App (connector) tool calls can also require approval. When an app tool call has side effects, the server may elicit approval with `tool/requestUserInput` and options such as **Accept**, **Decline**, and **Cancel**. If the user declines or cancels, the related `mcpToolCall` item completes with an error instead of running the tool.904App (connector) tool calls can also require approval. When an app tool call has side effects, the server may elicit approval with `tool/requestUserInput` and options such as **Accept**, **Decline**, and **Cancel**. Destructive tool annotations always trigger approval even when the tool also advertises less-privileged hints. If the user declines or cancels, the related `mcpToolCall` item completes with an error instead of running the tool.
770 905
771## Skills906## Skills
772 907
863 998
864## Apps (connectors)999## Apps (connectors)
865 1000
866Use `app/list` to fetch available apps. In the CLI/TUI, `/apps` is the user-facing picker; in custom clients, call `app/list` directly. Each entry includes both `isAccessible` (available to the user) and `isEnabled` (enabled in `config.toml`) so clients can distinguish install/access from local enabled state.1001Use `app/list` to fetch available apps. In the CLI/TUI, `/apps` is the user-facing picker; in custom clients, call `app/list` directly. Each entry includes both `isAccessible` (available to the user) and `isEnabled` (enabled in `config.toml`) so clients can distinguish install/access from local enabled state. App entries can also include optional `branding`, `appMetadata`, and `labels` fields.
867 1002
868```json1003```json
869{ "method": "app/list", "id": 50, "params": {1004{ "method": "app/list", "id": 50, "params": {
879 "name": "Demo App",1014 "name": "Demo App",
880 "description": "Example connector for documentation.",1015 "description": "Example connector for documentation.",
881 "logoUrl": "https://example.com/demo-app.png",1016 "logoUrl": "https://example.com/demo-app.png",
1017 "logoUrlDark": null,
1018 "distributionChannel": null,
1019 "branding": null,
1020 "appMetadata": null,
1021 "labels": null,
882 "installUrl": "https://chatgpt.com/apps/demo-app/demo-app",1022 "installUrl": "https://chatgpt.com/apps/demo-app/demo-app",
883 "isAccessible": true,1023 "isAccessible": true,
884 "isEnabled": true1024 "isEnabled": true
904 "name": "Demo App",1044 "name": "Demo App",
905 "description": "Example connector for documentation.",1045 "description": "Example connector for documentation.",
906 "logoUrl": "https://example.com/demo-app.png",1046 "logoUrl": "https://example.com/demo-app.png",
1047 "logoUrlDark": null,
1048 "distributionChannel": null,
1049 "branding": null,
1050 "appMetadata": null,
1051 "labels": null,
907 "installUrl": "https://chatgpt.com/apps/demo-app/demo-app",1052 "installUrl": "https://chatgpt.com/apps/demo-app/demo-app",
908 "isAccessible": true,1053 "isAccessible": true,
909 "isEnabled": true1054 "isEnabled": true
936}1081}
937```1082```
938 1083
1084### Config RPC examples for app settings
1085
1086Use `config/read`, `config/value/write`, and `config/batchWrite` to inspect or update app controls in `config.toml`.
1087
1088Read the effective app config shape (including `_default` and per-tool overrides):
1089
1090```json
1091{ "method": "config/read", "id": 60, "params": { "includeLayers": false } }
1092{ "id": 60, "result": {
1093 "config": {
1094 "apps": {
1095 "_default": {
1096 "enabled": true,
1097 "destructive_enabled": true,
1098 "open_world_enabled": true
1099 },
1100 "google_drive": {
1101 "enabled": true,
1102 "destructive_enabled": false,
1103 "default_tools_approval_mode": "prompt",
1104 "tools": {
1105 "files/delete": { "enabled": false, "approval_mode": "approve" }
1106 }
1107 }
1108 }
1109 }
1110} }
1111```
1112
1113Update a single app setting:
1114
1115```json
1116{
1117 "method": "config/value/write",
1118 "id": 61,
1119 "params": {
1120 "keyPath": "apps.google_drive.default_tools_approval_mode",
1121 "value": "prompt",
1122 "mergeStrategy": "replace"
1123 }
1124}
1125```
1126
1127Apply multiple app edits atomically:
1128
1129```json
1130{
1131 "method": "config/batchWrite",
1132 "id": 62,
1133 "params": {
1134 "edits": [
1135 {
1136 "keyPath": "apps._default.destructive_enabled",
1137 "value": false,
1138 "mergeStrategy": "upsert"
1139 },
1140 {
1141 "keyPath": "apps.google_drive.tools.files/delete.approval_mode",
1142 "value": "approve",
1143 "mergeStrategy": "upsert"
1144 }
1145 ]
1146 }
1147}
1148```
1149
1150### Detect and import external agent config
1151
1152Use `externalAgentConfig/detect` to discover migratable external-agent artifacts, then pass the selected entries to `externalAgentConfig/import`.
1153
1154Detection example:
1155
1156```json
1157{ "method": "externalAgentConfig/detect", "id": 63, "params": {
1158 "includeHome": true,
1159 "cwds": ["/Users/me/project"]
1160} }
1161{ "id": 63, "result": {
1162 "items": [
1163 {
1164 "itemType": "AGENTS_MD",
1165 "description": "Import /Users/me/project/CLAUDE.md to /Users/me/project/AGENTS.md.",
1166 "cwd": "/Users/me/project"
1167 },
1168 {
1169 "itemType": "SKILLS",
1170 "description": "Copy skill folders from /Users/me/.claude/skills to /Users/me/.agents/skills.",
1171 "cwd": null
1172 }
1173 ]
1174} }
1175```
1176
1177Import example:
1178
1179```json
1180{ "method": "externalAgentConfig/import", "id": 64, "params": {
1181 "migrationItems": [
1182 {
1183 "itemType": "AGENTS_MD",
1184 "description": "Import /Users/me/project/CLAUDE.md to /Users/me/project/AGENTS.md.",
1185 "cwd": "/Users/me/project"
1186 }
1187 ]
1188} }
1189{ "id": 64, "result": {} }
1190```
1191
1192Supported `itemType` values are `AGENTS_MD`, `CONFIG`, `SKILLS`, and `MCP_SERVER_CONFIG`. Detection returns only items that still have work to do. For example, AGENTS migration is skipped when `AGENTS.md` already exists and is non-empty, and skill imports do not overwrite existing skill directories.
1193
939## Auth endpoints1194## Auth endpoints
940 1195
941The JSON-RPC auth/account surface exposes request/response methods plus server-initiated notifications (no `id`). Use these to determine auth state, start or cancel logins, logout, and inspect ChatGPT rate limits.1196The JSON-RPC auth/account surface exposes request/response methods plus server-initiated notifications (no `id`). Use these to determine auth state, start or cancel logins, logout, and inspect ChatGPT rate limits.