Commit 4ee5230
docs(sdk): codex examples, compatibility matrix, and module docs (#137)
Third and final PR of the codex-native stack (PLAN Step 3), stacked on
#135 (`feat/codex-connection`), which is stacked on #134. See
`sdk/src/codex/PLAN.md`.
## Examples
- **`feature-examples/src/agents.ts`**: adds a native `codex` agent
(`broker_mount: { protocol: "codex", agent_binary: "codex" }`,
`OPENAI_API_KEY` secret). `codex-acp` is kept — downstream consumers
still use it.
- **New use cases** demonstrating codex-native behavior that differs
from Claude:
- `approval-codex` — server-initiated command approval round-trip via
`onApprovalRequest` (thread started with `sandbox: "read-only"` +
`approvalPolicy: "on-request"` to force an approval; both the current
and legacy approval methods are handled).
- `thread-resume-codex` — client-driven `resumeThread()`: establish
context on thread A, switch to a fresh thread B, resume A, and verify
the codeword is still in context.
- **Framework plumbing**: `types.ts`/`scaffold.ts`/`main.ts` extended
with the `codex` protocol (connection setup with no initialize step,
`--protocol codex` filter, Codex column in the generated matrix).
- **Blueprint**: `examples/blueprint/Dockerfile` now installs
`@openai/codex@0.144.1` (matches the SDK's vendored-protocol pin).
## Compatibility matrix
`compatibility.md` (and the `llms.txt` use-case index) were **updated by
hand, not machine-regenerated** — running `feature-compat` requires live
`RUNLOOP_API_KEY`/`OPENAI_API_KEY` credentials plus broker-side codex
support, none of which are available in this environment. The hand-edit
matches the generator's output format exactly: codex cells show
`pending` (the generator's no-results status), and the
template/generator were updated so the next full run produces the Codex
column automatically. `bun run feature-compat --validate` passes against
the hand-edited files.
## Docs
- **`sdk/README.md`**: Codex row in the module table, broker `protocol`
option table (`acp` / `claude_json` / `codex`), Codex quickstart
mirroring the Claude one, a full "Codex Module" section (connection
options, methods, approval requests incl. the `approval_policy=never`
launch-args alternative, timeline guards, transport), Codex timeline
events, architecture comparison, and updated known limitations.
- **`sdk/AGENTS.md`**: module table, codex quick start + key-methods
table, `codex_protocol` timeline kind, constraints (auto-approve
default, no initialize step, no extra dependency).
## Validation
- `bun run check` / `bun run typecheck` / `bun run build` / `bun run
test` (529 tests) — pass
- `feature-examples`: `bun run typecheck` and `bun run feature-compat
--validate` — pass
- The new use cases could **not** be executed end-to-end here (no live
credentials); they typecheck against the vendored protocol types.
## Notes for reviewers
- The `codex` agent entry assumes a `codex` agent exists in the Runloop
agent catalog (mirroring `codex-acp`); adjust `agentName` if the catalog
entry differs.
- `scaffold.ts` casts the broker-mount `protocol` because the published
`@runloop/api-client` (≤1.25.0) doesn't include `"codex"` in its mount
types yet — drop the cast once the client catches up.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
## Combined app (added in follow-up)
`examples/combined-app` now supports Codex as a third agent type
end-to-end:
- **Server**: `codex-manager.ts` (provisions a `protocol: "codex"`
broker mount pointing at `/home/user/.local/bin/codex`, injects
`OPENAI_API_KEY`, starts a thread, maps
`workingDir`/`model`/`systemPrompt` onto `threadStartParams`),
`routes/codex.ts` (`POST /api/approval-response`), plus codex branches
in lifecycle/prompt/cancel routes and the agent registry. With
"Auto-approve approvals" off, the thread starts with `approvalPolicy:
"on-request"` and command/file approvals are forwarded to the browser;
with it on, the SDK's default auto-approve handlers answer.
- **Client**: `useCodexAgent` hook renders app-server frames as turn
blocks (agent-message deltas → text, reasoning deltas → thinking,
commandExecution/fileChange/mcpToolCall/webSearch items → tool calls
with streamed output), an `ApprovalPrompt` dialog for interactive
approvals, a Codex button + fields in the setup card, timeline sidebar
CODEX badges, and thread-id display.
- Attachments: images are sent as data-URL `UserInput` image items; file
attachments are flattened into text.
- Validation: `tsc --noEmit` and `vite build` pass; the Express server
boots with the new routes. Not exercised against a live devbox (no
credentials here).
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Reflex <reflex@runloop.ai>
Co-authored-by: OpenAI Codex <noreply@openai.com>
Co-authored-by: OpenAI Codex <codex@openai.com>1 parent 201da90 commit 4ee5230
40 files changed
Lines changed: 1867 additions & 495 deletions
File tree
- examples
- blueprint
- combined-app
- src
- client
- components
- turn-blocks
- hooks
- server
- routes
- feature-examples
- src
- use-cases
- templates
- sdk
- src/claude
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
295 | 295 | | |
296 | 296 | | |
297 | 297 | | |
298 | | - | |
| 298 | + | |
299 | 299 | | |
300 | 300 | | |
301 | 301 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| 31 | + | |
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
34 | | - | |
| 36 | + | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
| |||
55 | 57 | | |
56 | 58 | | |
57 | 59 | | |
58 | | - | |
59 | | - | |
| 60 | + | |
| 61 | + | |
60 | 62 | | |
61 | 63 | | |
62 | 64 | | |
| |||
72 | 74 | | |
73 | 75 | | |
74 | 76 | | |
| 77 | + | |
75 | 78 | | |
76 | 79 | | |
77 | 80 | | |
| |||
81 | 84 | | |
82 | 85 | | |
83 | 86 | | |
| 87 | + | |
84 | 88 | | |
85 | 89 | | |
86 | 90 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1874 | 1874 | | |
1875 | 1875 | | |
1876 | 1876 | | |
| 1877 | + | |
1877 | 1878 | | |
1878 | 1879 | | |
1879 | 1880 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
234 | 235 | | |
235 | 236 | | |
236 | 237 | | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
243 | 251 | | |
244 | 252 | | |
245 | 253 | | |
| |||
255 | 263 | | |
256 | 264 | | |
257 | 265 | | |
258 | | - | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
259 | 269 | | |
260 | 270 | | |
261 | 271 | | |
| |||
415 | 425 | | |
416 | 426 | | |
417 | 427 | | |
418 | | - | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
419 | 433 | | |
420 | 434 | | |
421 | 435 | | |
| |||
495 | 509 | | |
496 | 510 | | |
497 | 511 | | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
498 | 518 | | |
499 | 519 | | |
500 | 520 | | |
| |||
542 | 562 | | |
543 | 563 | | |
544 | 564 | | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
545 | 572 | | |
546 | 573 | | |
547 | 574 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| |||
Lines changed: 34 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
Lines changed: 23 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
82 | 89 | | |
83 | 90 | | |
84 | 91 | | |
| |||
104 | 111 | | |
105 | 112 | | |
106 | 113 | | |
107 | | - | |
| 114 | + | |
108 | 115 | | |
109 | 116 | | |
110 | 117 | | |
| |||
113 | 120 | | |
114 | 121 | | |
115 | 122 | | |
116 | | - | |
117 | | - | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
118 | 132 | | |
119 | 133 | | |
120 | 134 | | |
| |||
142 | 156 | | |
143 | 157 | | |
144 | 158 | | |
145 | | - | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
146 | 164 | | |
147 | 165 | | |
148 | 166 | | |
| |||
0 commit comments