@agentproto/adapter-codex 0.1.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CODEX.md ADDED
@@ -0,0 +1,87 @@
1
+ ---
2
+ name: codex
3
+ id: codex
4
+ description: OpenAI's Codex coding agent wrapped as an ACP server by Zed's @zed-industries/codex-acp. Spawned via `npx -y @zed-industries/codex-acp` and driven over stdio JSON-RPC. The wrapper bundles its own Codex runtime — no separate @openai/codex install required.
5
+ version: 0.1.0
6
+ bin: npx
7
+ bin_args: ["-y", "@zed-industries/codex-acp"]
8
+ install:
9
+ - method: npm
10
+ package: "@zed-industries/codex-acp"
11
+ global: true
12
+ version_check:
13
+ cmd: npm view @zed-industries/codex-acp version
14
+ parse: "(\\d+\\.\\d+\\.\\d+)"
15
+ range: ">=0.14.0"
16
+ timeout_ms: 15000
17
+ auth:
18
+ ref: ./SECRETS.md
19
+ state:
20
+ env: [OPENAI_API_KEY, CODEX_API_KEY]
21
+ sandbox: ./SANDBOX.md
22
+ protocol: acp
23
+ acp: ./codex-acp.ACP.md
24
+ session:
25
+ mode: persistent
26
+ idle_timeout_ms: 1800000
27
+ context_carryover: true
28
+ models:
29
+ default: gpt-5-codex
30
+ allowed:
31
+ - gpt-5-codex
32
+ - gpt-5
33
+ - gpt-5-mini
34
+ - gpt-5-pro
35
+ env:
36
+ openai: OPENAI_API_KEY
37
+ codex: CODEX_API_KEY
38
+ capabilities:
39
+ streaming: true
40
+ tool_calls: true
41
+ sub_agents: false
42
+ file_io: true
43
+ multimodal: true
44
+ resumable: true
45
+ bidirectional: true
46
+ tags: ["codex", "openai", "acp", "agent-runtime", "coding"]
47
+ ---
48
+
49
+ # Codex adapter
50
+
51
+ `@agentproto/adapter-codex` wraps OpenAI's Codex coding agent as an
52
+ AIP-45 agent CLI by spawning **`@zed-industries/codex-acp`** — a
53
+ Rust-based ACP wrapper published by Zed Industries that bundles its
54
+ own Codex runtime.
55
+
56
+ ## Why the Zed wrapper
57
+
58
+ OpenAI's `@openai/codex` CLI does not expose an ACP mode. The Zed
59
+ wrapper provides a stable stdio JSON-RPC bridge with full ACP session
60
+ lifecycle support (newSession / loadSession / resumeSession), slash
61
+ commands, ACP `AvailableCommands` updates, and read-only / auto /
62
+ full-access session modes.
63
+
64
+ ## Install
65
+
66
+ ```bash
67
+ # npm (global) — recommended for fast spawn
68
+ npm install -g @zed-industries/codex-acp
69
+
70
+ # or rely on the npx form (no manual install)
71
+ npx -y @zed-industries/codex-acp
72
+ ```
73
+
74
+ The wrapper ships platform-specific native binaries via npm optional
75
+ dependencies — no separate `@openai/codex` install is required.
76
+
77
+ ## Auth
78
+
79
+ Codex authenticates one of three ways:
80
+
81
+ | Mechanism | How |
82
+ |----------------|-----------------------------------------------------------|
83
+ | ChatGPT login | Use the existing paid ChatGPT subscription via OAuth |
84
+ | API key | `CODEX_API_KEY=sk-…` |
85
+ | Fallback | `OPENAI_API_KEY=sk-…` |
86
+
87
+ For headless / sandboxed spawns, prefer `OPENAI_API_KEY`.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 agentproto contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,25 @@
1
+ import { AgentCliHandle, AgentCliRuntime } from '@agentproto/driver-agent-cli';
2
+ export { AgentCliHandle, AgentCliRuntime } from '@agentproto/driver-agent-cli';
3
+
4
+ /**
5
+ * @agentproto/adapter-codex — AIP-45 adapter for OpenAI Codex via the
6
+ * Zed-published ACP wrapper @zed-industries/codex-acp.
7
+ *
8
+ * The wrapper bundles its own Codex runtime (Rust binary delivered via
9
+ * npm optional deps) so a single `npx -y @zed-industries/codex-acp`
10
+ * invocation is enough — no separate @openai/codex install needed.
11
+ *
12
+ * import { codex, codexRuntime } from "@agentproto/adapter-codex"
13
+ * const session = await codexRuntime().start({
14
+ * env: { OPENAI_API_KEY: "sk-..." },
15
+ * })
16
+ * for await (const evt of session.send({ role: "user", content: "..." })) {
17
+ * console.log(evt)
18
+ * }
19
+ * await session.close()
20
+ */
21
+
22
+ declare const codex: AgentCliHandle;
23
+ declare function codexRuntime(): AgentCliRuntime;
24
+
25
+ export { codex, codexRuntime };
package/dist/index.mjs ADDED
@@ -0,0 +1,100 @@
1
+ import { defineAgentCli, createAgentCliRuntime } from '@agentproto/driver-agent-cli';
2
+
3
+ /**
4
+ * @agentproto/adapter-codex v0.1.0-alpha
5
+ * AIP-45 adapter for OpenAI Codex via @zed-industries/codex-acp.
6
+ */
7
+
8
+ var codex = defineAgentCli({
9
+ name: "codex",
10
+ id: "codex",
11
+ description: "OpenAI's Codex coding agent wrapped as an ACP server by Zed's @zed-industries/codex-acp. Spawned via `npx -y @zed-industries/codex-acp` and driven over stdio JSON-RPC. The wrapper bundles its own Codex runtime \u2014 no separate @openai/codex install required.",
12
+ version: "0.1.0",
13
+ bin: "npx",
14
+ bin_args: ["-y", "@zed-industries/codex-acp"],
15
+ install: [
16
+ {
17
+ method: "npm",
18
+ package: "@zed-industries/codex-acp",
19
+ global: true
20
+ }
21
+ ],
22
+ version_check: {
23
+ cmd: "npm view @zed-industries/codex-acp version",
24
+ parse: "(\\d+\\.\\d+\\.\\d+)",
25
+ range: ">=0.14.0",
26
+ timeout_ms: 15e3
27
+ },
28
+ auth: {
29
+ ref: "./SECRETS.md",
30
+ state: { env: ["OPENAI_API_KEY", "CODEX_API_KEY"] }
31
+ },
32
+ sandbox: "./SANDBOX.md",
33
+ protocol: "acp",
34
+ acp: "./codex-acp.ACP.md",
35
+ session: {
36
+ mode: "persistent",
37
+ idle_timeout_ms: 18e5,
38
+ context_carryover: true
39
+ },
40
+ models: {
41
+ default: "gpt-5-codex",
42
+ allowed: ["gpt-5-codex", "gpt-5", "gpt-5-mini", "gpt-5-pro"],
43
+ env: { openai: "OPENAI_API_KEY", codex: "CODEX_API_KEY" }
44
+ },
45
+ capabilities: {
46
+ streaming: true,
47
+ tool_calls: true,
48
+ sub_agents: false,
49
+ file_io: true,
50
+ // The Zed wrapper forwards ACP image content blocks to Codex which
51
+ // runs them through the underlying GPT-5 vision pipeline.
52
+ multimodal: true,
53
+ // codex-acp implements full ACP session lifecycle (newSession /
54
+ // loadSession / resumeSession). Pair with the `native-resume`
55
+ // continuation strategy for cold-start reattach.
56
+ resumable: true,
57
+ bidirectional: true
58
+ },
59
+ modes: [
60
+ {
61
+ id: "default",
62
+ description: "Auto mode (default) \u2014 Codex executes file edits and shell commands with per-tool prompts."
63
+ },
64
+ {
65
+ id: "read-only",
66
+ description: "Read-only mode \u2014 Codex inspects but does not edit or run commands.",
67
+ bin_args_append: ["--mode", "read-only"]
68
+ },
69
+ {
70
+ id: "full-access",
71
+ description: "Full-access mode \u2014 auto-approve all file/shell operations. Use only in trusted sandboxes.",
72
+ bin_args_append: ["--mode", "full-access"]
73
+ }
74
+ ],
75
+ options: [
76
+ {
77
+ id: "model",
78
+ type: "enum",
79
+ enum: ["gpt-5-codex", "gpt-5", "gpt-5-mini", "gpt-5-pro"],
80
+ description: "Override the default model for this operator binding.",
81
+ bin_args_template: ["--model", "{value}"]
82
+ }
83
+ ],
84
+ continuation: {
85
+ default: "native-resume",
86
+ supported: ["native-resume", "pinned-session", "transcript", "none"],
87
+ pinned_session: {
88
+ idle_timeout_ms: 18e5,
89
+ key_scope: ["conversation", "operator"]
90
+ }
91
+ },
92
+ tags: ["codex", "openai", "acp", "agent-runtime", "coding"]
93
+ });
94
+ function codexRuntime() {
95
+ return createAgentCliRuntime(codex);
96
+ }
97
+
98
+ export { codex, codexRuntime };
99
+ //# sourceMappingURL=index.mjs.map
100
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;AAyBO,IAAM,QAAwB,cAAA,CAAe;AAAA,EAClD,IAAA,EAAM,OAAA;AAAA,EACN,EAAA,EAAI,OAAA;AAAA,EACJ,WAAA,EACE,sQAAA;AAAA,EACF,OAAA,EAAS,OAAA;AAAA,EACT,GAAA,EAAK,KAAA;AAAA,EACL,QAAA,EAAU,CAAC,IAAA,EAAM,2BAA2B,CAAA;AAAA,EAC5C,OAAA,EAAS;AAAA,IACP;AAAA,MACE,MAAA,EAAQ,KAAA;AAAA,MACR,OAAA,EAAS,2BAAA;AAAA,MACT,MAAA,EAAQ;AAAA;AACV,GACF;AAAA,EACA,aAAA,EAAe;AAAA,IACb,GAAA,EAAK,4CAAA;AAAA,IACL,KAAA,EAAO,sBAAA;AAAA,IACP,KAAA,EAAO,UAAA;AAAA,IACP,UAAA,EAAY;AAAA,GACd;AAAA,EACA,IAAA,EAAM;AAAA,IACJ,GAAA,EAAK,cAAA;AAAA,IACL,OAAO,EAAE,GAAA,EAAK,CAAC,gBAAA,EAAkB,eAAe,CAAA;AAAE,GACpD;AAAA,EACA,OAAA,EAAS,cAAA;AAAA,EACT,QAAA,EAAU,KAAA;AAAA,EACV,GAAA,EAAK,oBAAA;AA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YAAA,EAAc;AAAA,IACZ,OAAA,EAAS,eAAA;AAAA,IACT,SAAA,EAAW,CAAC,eAAA,EAAiB,gBAAA,EAAkB,cAAc,MAAM,CAAA;AAAA,IACnE,cAAA,EAAgB;AAAA,MACd,eAAA,EAAiB,IAAA;AAAA,MACjB,SAAA,EAAW,CAAC,cAAA,EAAgB,UAAU;AAAA;AACxC,GACF;AAAA,EACA,MAAM,CAAC,OAAA,EAAS,QAAA,EAAU,KAAA,EAAO,iBAAiB,QAAQ;AAC5D,CAAC;AAEM,SAAS,YAAA,GAAgC;AAC9C,EAAA,OAAO,sBAAsB,KAAK,CAAA;AACpC","file":"index.mjs","sourcesContent":["/**\n * @agentproto/adapter-codex — AIP-45 adapter for OpenAI Codex via the\n * Zed-published ACP wrapper @zed-industries/codex-acp.\n *\n * The wrapper bundles its own Codex runtime (Rust binary delivered via\n * npm optional deps) so a single `npx -y @zed-industries/codex-acp`\n * invocation is enough — no separate @openai/codex install needed.\n *\n * import { codex, codexRuntime } from \"@agentproto/adapter-codex\"\n * const session = await codexRuntime().start({\n * env: { OPENAI_API_KEY: \"sk-...\" },\n * })\n * for await (const evt of session.send({ role: \"user\", content: \"...\" })) {\n * console.log(evt)\n * }\n * await session.close()\n */\n\nimport {\n createAgentCliRuntime,\n defineAgentCli,\n type AgentCliHandle,\n type AgentCliRuntime,\n} from \"@agentproto/driver-agent-cli\"\n\nexport const codex: AgentCliHandle = defineAgentCli({\n name: \"codex\",\n id: \"codex\",\n description:\n \"OpenAI's Codex coding agent wrapped as an ACP server by Zed's @zed-industries/codex-acp. Spawned via `npx -y @zed-industries/codex-acp` and driven over stdio JSON-RPC. The wrapper bundles its own Codex runtime — no separate @openai/codex install required.\",\n version: \"0.1.0\",\n bin: \"npx\",\n bin_args: [\"-y\", \"@zed-industries/codex-acp\"],\n install: [\n {\n method: \"npm\",\n package: \"@zed-industries/codex-acp\",\n global: true,\n },\n ],\n version_check: {\n cmd: \"npm view @zed-industries/codex-acp version\",\n parse: \"(\\\\d+\\\\.\\\\d+\\\\.\\\\d+)\",\n range: \">=0.14.0\",\n timeout_ms: 15_000,\n },\n auth: {\n ref: \"./SECRETS.md\",\n state: { env: [\"OPENAI_API_KEY\", \"CODEX_API_KEY\"] },\n },\n sandbox: \"./SANDBOX.md\",\n protocol: \"acp\",\n acp: \"./codex-acp.ACP.md\",\n session: {\n mode: \"persistent\",\n idle_timeout_ms: 1_800_000,\n context_carryover: true,\n },\n models: {\n default: \"gpt-5-codex\",\n allowed: [\"gpt-5-codex\", \"gpt-5\", \"gpt-5-mini\", \"gpt-5-pro\"],\n env: { openai: \"OPENAI_API_KEY\", codex: \"CODEX_API_KEY\" },\n },\n capabilities: {\n streaming: true,\n tool_calls: true,\n sub_agents: false,\n file_io: true,\n // The Zed wrapper forwards ACP image content blocks to Codex which\n // runs them through the underlying GPT-5 vision pipeline.\n multimodal: true,\n // codex-acp implements full ACP session lifecycle (newSession /\n // loadSession / resumeSession). Pair with the `native-resume`\n // continuation strategy for cold-start reattach.\n resumable: true,\n bidirectional: true,\n },\n modes: [\n {\n id: \"default\",\n description:\n \"Auto mode (default) — Codex executes file edits and shell commands with per-tool prompts.\",\n },\n {\n id: \"read-only\",\n description:\n \"Read-only mode — Codex inspects but does not edit or run commands.\",\n bin_args_append: [\"--mode\", \"read-only\"],\n },\n {\n id: \"full-access\",\n description:\n \"Full-access mode — auto-approve all file/shell operations. Use only in trusted sandboxes.\",\n bin_args_append: [\"--mode\", \"full-access\"],\n },\n ],\n options: [\n {\n id: \"model\",\n type: \"enum\",\n enum: [\"gpt-5-codex\", \"gpt-5\", \"gpt-5-mini\", \"gpt-5-pro\"],\n description: \"Override the default model for this operator binding.\",\n bin_args_template: [\"--model\", \"{value}\"],\n },\n ],\n continuation: {\n default: \"native-resume\",\n supported: [\"native-resume\", \"pinned-session\", \"transcript\", \"none\"],\n pinned_session: {\n idle_timeout_ms: 1_800_000,\n key_scope: [\"conversation\", \"operator\"],\n },\n },\n tags: [\"codex\", \"openai\", \"acp\", \"agent-runtime\", \"coding\"],\n})\n\nexport function codexRuntime(): AgentCliRuntime {\n return createAgentCliRuntime(codex)\n}\n\nexport type { AgentCliHandle, AgentCliRuntime }\n"]}
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@agentproto/adapter-codex",
3
+ "version": "0.1.0-alpha.0",
4
+ "description": "@agentproto/adapter-codex — AIP-45 AGENT-CLI adapter for OpenAI's Codex CLI via @zed-industries/codex-acp. Spawns the ACP wrapper over stdio JSON-RPC.",
5
+ "keywords": [
6
+ "agentproto",
7
+ "aip-45",
8
+ "codex",
9
+ "openai",
10
+ "acp",
11
+ "agent-cli",
12
+ "adapter"
13
+ ],
14
+ "homepage": "https://agentproto.sh/docs/aip-45",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/agentproto/ts",
18
+ "directory": "adapters/codex"
19
+ },
20
+ "license": "MIT",
21
+ "type": "module",
22
+ "main": "dist/index.mjs",
23
+ "module": "dist/index.mjs",
24
+ "types": "dist/index.d.ts",
25
+ "exports": {
26
+ ".": {
27
+ "types": "./dist/index.d.ts",
28
+ "import": "./dist/index.mjs",
29
+ "default": "./dist/index.mjs"
30
+ },
31
+ "./CODEX.md": "./CODEX.md",
32
+ "./package.json": "./package.json"
33
+ },
34
+ "files": [
35
+ "dist",
36
+ "CODEX.md",
37
+ "README.md",
38
+ "LICENSE"
39
+ ],
40
+ "publishConfig": {
41
+ "access": "public"
42
+ },
43
+ "dependencies": {
44
+ "@agentproto/driver-agent-cli": "0.1.1"
45
+ },
46
+ "devDependencies": {
47
+ "@types/node": "^25.6.2",
48
+ "tsup": "^8.5.1",
49
+ "typescript": "^5.9.3",
50
+ "vitest": "^3.2.4",
51
+ "@agentproto/tooling": "0.1.0-alpha.0"
52
+ },
53
+ "scripts": {
54
+ "dev": "tsup --watch",
55
+ "build": "tsup",
56
+ "clean": "rm -rf dist",
57
+ "check-types": "tsc --noEmit",
58
+ "test": "vitest run --passWithNoTests",
59
+ "test:watch": "vitest"
60
+ }
61
+ }