@finalai/acp-adapter-codex 0.4.0 → 0.4.2

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/HOSTING.md CHANGED
@@ -54,7 +54,7 @@ Routes, under `/api/v1/projects/:projectId/agents`:
54
54
 
55
55
  | Route | Body / query | Response |
56
56
  | ---------------- | ----------------------------------- | -------------------------------------- |
57
- | `PUT /documents` | `{ document, hash? }` | `{ hash }`; refuse a hash that differs |
57
+ | `PUT /documents` | `{ document \| source, hash? }` | `{ hash }`; refuse a hash that differs |
58
58
  | `POST /publish` | `{ name, hash }` | `{ id, name, hash, publishedAt }` |
59
59
  | `GET /lookup` | exactly one of `name`, `id`, `hash` | `agentInfoSchema` |
60
60
  | `GET /history` | `name`, `cursor?`, `limit?` | `agentHistorySchema` |
@@ -62,6 +62,19 @@ Routes, under `/api/v1/projects/:projectId/agents`:
62
62
  An agent is always passed as an object, `{ hash, document? }`, never a name. A
63
63
  request whose document is absent names a hash the host already stores.
64
64
 
65
+ A store sends either the document or its `source` (`agentSourceSchema`): the
66
+ files the document is made from, by path. A host given `source` makes the
67
+ document from those files itself and keeps them with it. It refuses a source
68
+ that does not make a document (`agent_source_invalid`, with
69
+ `details.diagnostics`) and, when `hash` is sent, one whose document hashes
70
+ differently (`hash_mismatch`). `GET /lookup` returns the kept files as `source`
71
+ (null when there are none).
72
+
73
+ Every publication keeps its source: `POST /publish` refuses a hash stored without one. A host
74
+ that keeps drafts makes a publication made elsewhere the next draft, and refuses one that lacks
75
+ what was published from drafts since its publisher last published (`draft_conflict`), keeping
76
+ the merge as the newest draft.
77
+
65
78
  ## Provide documents
66
79
 
67
80
  ```json
@@ -353,7 +366,8 @@ These packages define contracts and client behaviour, not a platform. A host
353
366
  implementing them must:
354
367
 
355
368
  1. Store documents by `agentDocumentHash`, re-check self-contained serverless
356
- source, and point names at hashes only when someone publishes.
369
+ source, make documents from agent `source` without giving that code network
370
+ or host access, and point names at hashes only when someone publishes.
357
371
  2. Run `unmetRequirements` on every call that starts work and at every session
358
372
  open, and create nothing when it fails.
359
373
  3. Store each `provide` as given; never fill a requirement on a caller's behalf.
@@ -3,7 +3,7 @@ import { type SpawnAppServer } from "./app-server.mjs";
3
3
  import { CodexApprovalPolicy } from "./config.mjs";
4
4
  import type { CodexCredentialsIface } from "./credentials.mjs";
5
5
  export declare const ADAPTER_NAME = "acp-adapter-codex";
6
- export declare const ADAPTER_VERSION = "0.2.1";
6
+ export declare const ADAPTER_VERSION = "0.4.1";
7
7
  export interface CodexProgramOptionsIface {
8
8
  command?: {
9
9
  command: string;
@@ -9,7 +9,7 @@ import {
9
9
  } from "./config.mjs";
10
10
  import { assertDistinctMcpNames, forkCodexThread, openCodexSession } from "./session.mjs";
11
11
  const ADAPTER_NAME = "acp-adapter-codex";
12
- const ADAPTER_VERSION = "0.2.1";
12
+ const ADAPTER_VERSION = "0.4.1";
13
13
  const bundledCodex = () => {
14
14
  const manifest = createRequire(import.meta.url).resolve("@openai/codex/package.json");
15
15
  return {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/program.ts"],
4
- "sourcesContent": ["import { createRequire } from 'node:module';\nimport { dirname, join } from 'node:path';\n\nimport type { AdapterProgramIface } from '@finalai/acp-session/agent';\n\nimport { spawnCodexAppServer, type SpawnAppServer } from \"./app-server.mjs\";\nimport {\n CodexApprovalPolicy,\n codexConfigOptions,\n codexConfigValue,\n defaultCodexConfig,\n} from \"./config.mjs\";\nimport type { CodexCredentialsIface } from \"./credentials.mjs\";\nimport { assertDistinctMcpNames, forkCodexThread, openCodexSession } from \"./session.mjs\";\n\nexport const ADAPTER_NAME = 'acp-adapter-codex';\nexport const ADAPTER_VERSION = '0.2.1';\n\nexport interface CodexProgramOptionsIface {\n // The app-server's command line (`codex app-server ...`); by default the Codex the\n // `@openai/codex` dependency installs.\n command?: { command: string; args: string[] } | null;\n // The approval policy a new session starts with.\n approvalPolicy?: CodexApprovalPolicy;\n // Environment of the app-server, inference credentials included (OPENAI_API_KEY and\n // OPENAI_BASE_URL, or CODEX_HOME for Codex's own login).\n env?: Record<string, string | undefined>;\n // A brokered model credential (codexCredentialsFrom), applied over `env` for the app-server.\n credentials?: CodexCredentialsIface | null;\n spawnAppServer?: SpawnAppServer;\n closeGraceMs?: number;\n}\n\n// The Codex CLI the dependency installs, run with this Node.\nconst bundledCodex = (): { command: string; args: string[] } => {\n const manifest = createRequire(import.meta.url).resolve('@openai/codex/package.json');\n return {\n command: process.execPath,\n args: [join(dirname(manifest), 'bin', 'codex.js'), 'app-server'],\n };\n};\n\n// The Codex app-server as the native program of an ACP adapter.\nexport const createCodexProgram = (options: CodexProgramOptionsIface = {}): AdapterProgramIface => {\n const command = options.command ?? bundledCodex();\n const deps = {\n spawnAppServer: options.spawnAppServer ?? spawnCodexAppServer,\n command: command.command,\n args: command.args,\n env: options.env ?? process.env,\n credentials: options.credentials ?? null,\n version: ADAPTER_VERSION,\n closeGraceMs: options.closeGraceMs ?? 10_000,\n };\n return {\n info: { name: ADAPTER_NAME, version: ADAPTER_VERSION },\n program: 'codex',\n runtime: { name: ADAPTER_NAME, version: ADAPTER_VERSION },\n fork: true,\n mcp: { http: true, stdio: true, acp: true },\n images: true,\n defaultConfig: () => defaultCodexConfig(options.approvalPolicy),\n configOptions: codexConfigOptions,\n configValue: codexConfigValue,\n checkMcpServers: (servers) =>\n assertDistinctMcpNames(servers.map((server) => String(server.name))),\n forkNative: (args) => forkCodexThread(args, deps),\n open: (args) => openCodexSession(args, deps),\n };\n};\n"],
4
+ "sourcesContent": ["import { createRequire } from 'node:module';\nimport { dirname, join } from 'node:path';\n\nimport type { AdapterProgramIface } from '@finalai/acp-session/agent';\n\nimport { spawnCodexAppServer, type SpawnAppServer } from \"./app-server.mjs\";\nimport {\n CodexApprovalPolicy,\n codexConfigOptions,\n codexConfigValue,\n defaultCodexConfig,\n} from \"./config.mjs\";\nimport type { CodexCredentialsIface } from \"./credentials.mjs\";\nimport { assertDistinctMcpNames, forkCodexThread, openCodexSession } from \"./session.mjs\";\n\nexport const ADAPTER_NAME = 'acp-adapter-codex';\nexport const ADAPTER_VERSION = '0.4.1';\n\nexport interface CodexProgramOptionsIface {\n // The app-server's command line (`codex app-server ...`); by default the Codex the\n // `@openai/codex` dependency installs.\n command?: { command: string; args: string[] } | null;\n // The approval policy a new session starts with.\n approvalPolicy?: CodexApprovalPolicy;\n // Environment of the app-server, inference credentials included (OPENAI_API_KEY and\n // OPENAI_BASE_URL, or CODEX_HOME for Codex's own login).\n env?: Record<string, string | undefined>;\n // A brokered model credential (codexCredentialsFrom), applied over `env` for the app-server.\n credentials?: CodexCredentialsIface | null;\n spawnAppServer?: SpawnAppServer;\n closeGraceMs?: number;\n}\n\n// The Codex CLI the dependency installs, run with this Node.\nconst bundledCodex = (): { command: string; args: string[] } => {\n const manifest = createRequire(import.meta.url).resolve('@openai/codex/package.json');\n return {\n command: process.execPath,\n args: [join(dirname(manifest), 'bin', 'codex.js'), 'app-server'],\n };\n};\n\n// The Codex app-server as the native program of an ACP adapter.\nexport const createCodexProgram = (options: CodexProgramOptionsIface = {}): AdapterProgramIface => {\n const command = options.command ?? bundledCodex();\n const deps = {\n spawnAppServer: options.spawnAppServer ?? spawnCodexAppServer,\n command: command.command,\n args: command.args,\n env: options.env ?? process.env,\n credentials: options.credentials ?? null,\n version: ADAPTER_VERSION,\n closeGraceMs: options.closeGraceMs ?? 10_000,\n };\n return {\n info: { name: ADAPTER_NAME, version: ADAPTER_VERSION },\n program: 'codex',\n runtime: { name: ADAPTER_NAME, version: ADAPTER_VERSION },\n fork: true,\n mcp: { http: true, stdio: true, acp: true },\n images: true,\n defaultConfig: () => defaultCodexConfig(options.approvalPolicy),\n configOptions: codexConfigOptions,\n configValue: codexConfigValue,\n checkMcpServers: (servers) =>\n assertDistinctMcpNames(servers.map((server) => String(server.name))),\n forkNative: (args) => forkCodexThread(args, deps),\n open: (args) => openCodexSession(args, deps),\n };\n};\n"],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AS,iBAAiB,MAAM,IAAI;AAAA,EAC7C;AACF;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finalai/acp-adapter-codex",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "private": false,
5
5
  "description": "Codex as an ACP v2 agent with Final's ACP extensions, over stdio, on the Codex app-server.",
6
6
  "license": "Apache-2.0",
@@ -32,8 +32,8 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@agentclientprotocol/sdk": "1.8.0",
35
- "@finalai/acp-session": "0.8.0",
36
- "@finalai/agent-provider": "0.16.0",
35
+ "@finalai/acp-session": "0.8.4",
36
+ "@finalai/agent-provider": "0.17.0",
37
37
  "@openai/codex": "0.167.0",
38
38
  "zod": "4.6.6"
39
39
  },