@agentproto/adapter-codex 0.2.1 → 1.0.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/dist/index.mjs CHANGED
@@ -45,7 +45,14 @@ var codex = defineAgentCli({
45
45
  models: {
46
46
  default: "gpt-5-codex",
47
47
  allowed: ["gpt-5-codex", "gpt-5", "gpt-5-mini", "gpt-5-pro"],
48
- env: { openai: "OPENAI_API_KEY", codex: "CODEX_API_KEY" }
48
+ env: { openai: "OPENAI_API_KEY", codex: "CODEX_API_KEY" },
49
+ // codex-acp takes its model as a CLI config override, not an ACP
50
+ // session config — `codex-acp --help` documents `-c model="o3"`.
51
+ // There is no `session/set_config_option` capability to fire at all
52
+ // (confirmed against v0.16.0's `initialize` response); the model must
53
+ // be composed into argv at spawn time instead.
54
+ apply: "arg",
55
+ bin_args_template: ["-c", 'model="{model}"']
49
56
  },
50
57
  capabilities: {
51
58
  streaming: true,
@@ -61,29 +68,24 @@ var codex = defineAgentCli({
61
68
  resumable: true,
62
69
  bidirectional: true
63
70
  },
64
- modes: [
65
- {
66
- id: "default",
67
- description: "Auto mode (default) \u2014 Codex executes file edits and shell commands with per-tool prompts."
68
- },
69
- {
70
- id: "read-only",
71
- description: "Read-only mode \u2014 Codex inspects but does not edit or run commands.",
72
- bin_args_append: ["--mode", "read-only"]
73
- },
74
- {
75
- id: "full-access",
76
- description: "Full-access mode \u2014 auto-approve all file/shell operations. Use only in trusted sandboxes.",
77
- bin_args_append: ["--mode", "full-access"]
78
- }
79
- ],
71
+ // No manifest `modes[]`: codex's operation profiles (default / read-only /
72
+ // full-access) are POSTURE, which no longer lives in the manifest (SPEC
73
+ // §3.4a) — it is sourced from the harness's own ACP mode registry
74
+ // (`SessionModeState.availableModes`) plus the daemon's canonical-posture
75
+ // layer. codex has no context (`kind:"context"`) mode to declare, and route
76
+ // comes from the model catalog, so the array would be empty — omit it.
80
77
  options: [
81
78
  {
82
79
  id: "model",
83
80
  type: "enum",
84
81
  enum: ["gpt-5-codex", "gpt-5", "gpt-5-mini", "gpt-5-pro"],
85
- description: "Override the default model for this operator binding.",
86
- bin_args_template: ["--model", "{value}"]
82
+ description: "Override the default model for this operator binding."
83
+ // No bin_args_template here — codex-acp doesn't accept a bare
84
+ // `--model` flag (`error: unexpected argument '--model' found`,
85
+ // confirmed against v0.16.0; it crashes the process before the ACP
86
+ // handshake even starts). This option exists only so
87
+ // `config.options.model` validates; the real composition happens
88
+ // via `models.apply: "arg"` above.
87
89
  }
88
90
  ],
89
91
  continuation: {
@@ -1 +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;AAAA;AAAA;AAAA;AAAA,EAKA,QAAA,EAAU,QAAA;AAAA,EACV,OAAA,EAAS,cAAA;AAAA,EACT,QAAA,EAAU,KAAA;AAAA,EACV,GAAA,EAAK,oBAAA;AAAA,EACL,OAAA,EAAS;AAAA,IAC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,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 // Billing-auth (opt-in — no authEnforce, so unconfigured spawns stay\n // ambient). Single-provider adapter: api-key mode SETS providerEnvVar\n // (\"openai\") = OPENAI_API_KEY, derived from the catalog. No authSubscription\n // ⇒ a `subscription` request fails loud with `unsupported_auth_mode`.\n provider: \"openai\",\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 modeCodex 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"]}
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;AAAA;AAAA;AAAA;AAAA,EAKA,QAAA,EAAU,QAAA;AAAA,EACV,OAAA,EAAS,cAAA;AAAA,EACT,QAAA,EAAU,KAAA;AAAA,EACV,GAAA,EAAK,oBAAA;AAAA,EACL,OAAA,EAAS;AAAA,IACP,IAAA,EAAM,YAAA;AAAA,IACN,eAAA,EAAiB,IAAA;AAAA,IACjB,iBAAA,EAAmB;AAAA,GACrB;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AgC;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 // Billing-auth (opt-in — no authEnforce, so unconfigured spawns stay\n // ambient). Single-provider adapter: api-key mode SETS providerEnvVar\n // (\"openai\") = OPENAI_API_KEY, derived from the catalog. No authSubscription\n // ⇒ a `subscription` request fails loud with `unsupported_auth_mode`.\n provider: \"openai\",\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 // codex-acp takes its model as a CLI config override, not an ACP\n // session config — `codex-acp --help` documents `-c model=\"o3\"`.\n // There is no `session/set_config_option` capability to fire at all\n // (confirmed against v0.16.0's `initialize` response); the model must\n // be composed into argv at spawn time instead.\n apply: \"arg\",\n bin_args_template: [\"-c\", 'model=\"{model}\"'],\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 // No manifest `modes[]`: codex's operation profiles (default / read-only /\n // full-access) are POSTURE, which no longer lives in the manifest (SPEC\n // §3.4a)it is sourced from the harness's own ACP mode registry\n // (`SessionModeState.availableModes`) plus the daemon's canonical-posture\n // layer. codex has no context (`kind:\"context\"`) mode to declare, and route\n // comes from the model catalog, so the array would be empty — omit it.\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 // No bin_args_template here — codex-acp doesn't accept a bare\n // `--model` flag (`error: unexpected argument '--model' found`,\n // confirmed against v0.16.0; it crashes the process before the ACP\n // handshake even starts). This option exists only so\n // `config.options.model` validates; the real composition happens\n // via `models.apply: \"arg\"` above.\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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentproto/adapter-codex",
3
- "version": "0.2.1",
3
+ "version": "1.0.0",
4
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
5
  "keywords": [
6
6
  "agentproto",
@@ -41,7 +41,7 @@
41
41
  "access": "public"
42
42
  },
43
43
  "dependencies": {
44
- "@agentproto/driver-agent-cli": "1.1.0"
44
+ "@agentproto/driver-agent-cli": "2.0.0"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/node": "^25.6.2",