@agentproto/adapter-codex 2.0.21 → 2.0.23

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 CHANGED
@@ -19,6 +19,12 @@ auth:
19
19
  state:
20
20
  env: [OPENAI_API_KEY, CODEX_API_KEY]
21
21
  sandbox: ./SANDBOX.md
22
+ stateHome:
23
+ env: CODEX_HOME
24
+ defaultDir: .codex
25
+ share: [auth.json]
26
+ seed:
27
+ config.toml: "project_root_markers = []\n"
22
28
  protocol: acp
23
29
  acp: ./codex-acp.ACP.md
24
30
  session:
package/dist/index.mjs CHANGED
@@ -64,6 +64,17 @@ var codex = defineAgentCli({
64
64
  conflictEnv: ["CODEX_API_KEY"]
65
65
  },
66
66
  sandbox: "./SANDBOX.md",
67
+ // Codex keeps a sqlite state db, PATH aliases and rollouts under CODEX_HOME
68
+ // and fails to start when it can't write there. An OS-confined spawn (app
69
+ // boundary) gets a per-session CODEX_HOME with only the login linked back.
70
+ stateHome: {
71
+ env: "CODEX_HOME",
72
+ defaultDir: ".codex",
73
+ share: ["auth.json"],
74
+ // Cwd = project root: codex never reads `.codex/` layers above it, which
75
+ // an app boundary hides (the host git root) and codex aborts on.
76
+ seed: { "config.toml": "project_root_markers = []\n" }
77
+ },
67
78
  protocol: "acp",
68
79
  acp: "./codex-acp.ACP.md",
69
80
  session: {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;AA0BO,IAAM,QAAwB,cAAA,CAAe;AAAA,EAClD,IAAA,EAAM,OAAA;AAAA,EACN,EAAA,EAAI,OAAA;AAAA,EACJ,WAAA,EACE,oQAAA;AAAA,EACF,OAAA,EAAS,OAAA;AAAA,EACT,GAAA,EAAK,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASL,QAAA,EAAU,CAAC,IAAA,EAAM,uCAAuC,CAAA;AAAA,EACxD,OAAA,EAAS;AAA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,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 * maintained ACP wrapper @agentclientprotocol/codex-acp.\n *\n * The wrapper bundles its own Codex runtime (Rust binary delivered via\n * npm dependency) so a single\n * `npx -y @agentclientprotocol/codex-acp@1.13.1`\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 @agentclientprotocol/codex-acp. Spawned via a version-pinned npx package and driven over stdio JSON-RPC. The wrapper bundles a compatible Codex runtime — no separate @openai/codex install required.\",\n version: \"0.1.0\",\n bin: \"npx\",\n // Keep spawn deterministic. An unversioned npx target performs registry\n // resolution at session startup and can silently replace both the bridge\n // and its bundled Codex runtime exactly when either publishes an update.\n // 1.13.1 bundles @openai/codex 0.156.1 (1.10.0 shipped 0.153.3). Nothing\n // between 1.10.0 and 1.13.1 is flagged breaking: ACP protocolVersion stays\n // 1, `session/new` and `session/set_config_option` are unchanged, and the\n // additions (recommended model/effort, tool names on tool calls,\n // experimental compaction updates and session notices) are opt-in extras.\n bin_args: [\"-y\", \"@agentclientprotocol/codex-acp@1.13.1\"],\n install: [\n {\n method: \"npm\",\n package: \"@agentclientprotocol/codex-acp@1.13.1\",\n global: true,\n },\n ],\n version_check: {\n // PRESENCE probe — local (global npm tree), not a registry query. See\n // claude-code's version_check note for the npm-view trap this replaces.\n cmd: \"npm ls -g @agentclientprotocol/codex-acp --depth=0\",\n parse: \"(\\\\d+\\\\.\\\\d+\\\\.\\\\d+)\",\n range: \"=1.13.1\",\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.\n provider: \"openai\",\n // \"Use my existing Codex login\" — a FILE-BASED (external) subscription. The\n // Codex CLI's ChatGPT/subscription login lives in `~/.codex/auth.json`\n // (`tokens.access_token`), which the bundled codex runtime reads ITSELF; it\n // has no env-bearer channel like claude-code's CLAUDE_CODE_OAUTH_TOKEN. So\n // `external: true`: subscription mode injects NOTHING (no setEnv) — the host\n // verifies the login is present (fail-loud, via the `codex` provision recipe)\n // and the driver only SCRUBS the api-key vars so a leftover OPENAI_API_KEY /\n // CODEX_API_KEY can't silently flip the spawn to per-token API billing under\n // a \"subscription\" label. OPENAI_API_KEY is scrubbed automatically (it's the\n // provider's api-key var); CODEX_API_KEY is the sibling the codex runtime\n // also honors, so it's listed as a conflictEnv. Money-safe by construction:\n // no OAuth bearer is ever written into an api-key env var, because no bearer\n // is injected at all. An unconfigured codex spawn stays ambient — codex uses\n // its own auth.json precedence (a ChatGPT login already outranks an ambient\n // OPENAI_API_KEY), so this only ADDS an explicit, verified, billing-guaranteed\n // opt-in on top of that.\n authSubscription: {\n external: true,\n conflictEnv: [\"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 // Do not declare a fixed default: a ChatGPT subscription exposes valid\n // models dynamically, and forcing a historic ID can make a session fail.\n // Keep this curated menu for catalog consumers and compatibility with the\n // existing CLI discovery contract. It is not a default or an allow-list:\n // explicit model IDs are still validated dynamically by Codex.\n allowed: [\n // Codex-specialized (coding) models.\n \"gpt-5-codex\",\n \"gpt-5.1-codex\",\n \"gpt-5.1-codex-mini\",\n \"gpt-5.1-codex-max\",\n \"gpt-5.2-codex\",\n // GPT-5 generalist family.\n \"gpt-5\",\n \"gpt-5-mini\",\n \"gpt-5-nano\",\n \"gpt-5-pro\",\n \"gpt-5.1\",\n \"gpt-5.2\",\n \"gpt-5.4\",\n \"gpt-5.4-mini\",\n \"gpt-5.4-nano\",\n \"gpt-5.4-pro\",\n \"gpt-5.5\",\n \"gpt-5.5-pro\",\n // GPT-5.6 family.\n \"gpt-5.6-luna\",\n \"gpt-5.6-luna-pro\",\n \"gpt-5.6-sol\",\n \"gpt-5.6-sol-pro\",\n \"gpt-5.6-terra\",\n \"gpt-5.6-terra-pro\",\n // GPT-6 family. Exactly the six ids that exist upstream — taken from\n // the catalog's own synced OpenAI list (`openai-pricing.generated.ts`,\n // OpenRouter passthrough) and cross-checked against the opencode-zen\n // snapshot, which carries gpt-6-astra/luna/sol. Deliberately NOT a\n // symmetric fill of the 5.6 shape: there is no `gpt-6-terra`, and no\n // `gpt-6-codex` — inventing either would put an id in the menu that\n // the bridge would reject on selection. The `:batch` variants the\n // catalog also carries are omitted on purpose; batch is an offline\n // job surface, not something an interactive ACP session selects.\n \"gpt-6-luna\",\n \"gpt-6-luna-pro\",\n \"gpt-6-sol\",\n \"gpt-6-sol-pro\",\n \"gpt-6-astra\",\n \"gpt-6-astra-pro\",\n // GPT-4.1 / 4o generation.\n \"gpt-4.1\",\n \"gpt-4.1-mini\",\n \"gpt-4.1-nano\",\n \"gpt-4o\",\n \"gpt-4o-mini\",\n // o-series reasoning models.\n \"o3\",\n \"o3-pro\",\n \"o3-mini\",\n \"o3-deep-research\",\n \"o4-mini\",\n \"o4-mini-high\",\n \"o4-mini-deep-research\",\n \"o1\",\n \"o1-mini\",\n \"o1-pro\",\n ],\n env: { openai: \"OPENAI_API_KEY\", codex: \"CODEX_API_KEY\" },\n // The maintained ACP bridge exposes `session/set_config_option`, so the\n // model is selected after session creation rather than through argv.\n apply: \"config\",\n },\n capabilities: {\n streaming: true,\n tool_calls: true,\n sub_agents: false,\n file_io: true,\n // The maintained 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: \"string\",\n description:\n \"Optional Codex model ID. Omit it to use the model selected by the current ChatGPT or API-key account; the ACP bridge validates explicit IDs against that account.\",\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":";;;;;;;AA0BO,IAAM,QAA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,IAAA;AAAA,IACX,UAAA,EAAY,IAAA;AAAA,IACZ,UAAA,EAAY,KAAA;AAAA,IACZ,OAAA,EAAS,IAAA;AAAA;AAAA;AAAA,IAGT,UAAA,EAAY,IAAA;AAAA;AAAA;AAAA;AAAA,IAIZ,SAAA,EAAW,IAAA;AAAA,IACX,aAAA,EAAe;AAAA,GACjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAA,EAAS;AAAA,IACP;AAAA,MACE,EAAA,EAAI,OAAA;AAAA,MACJ,IAAA,EAAM,QAAA;AAAA,MACN,WAAA,EACE;AAAA;AACJ,GACF;AAAA,EACA,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 * maintained ACP wrapper @agentclientprotocol/codex-acp.\n *\n * The wrapper bundles its own Codex runtime (Rust binary delivered via\n * npm dependency) so a single\n * `npx -y @agentclientprotocol/codex-acp@1.13.1`\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 @agentclientprotocol/codex-acp. Spawned via a version-pinned npx package and driven over stdio JSON-RPC. The wrapper bundles a compatible Codex runtime — no separate @openai/codex install required.\",\n version: \"0.1.0\",\n bin: \"npx\",\n // Keep spawn deterministic. An unversioned npx target performs registry\n // resolution at session startup and can silently replace both the bridge\n // and its bundled Codex runtime exactly when either publishes an update.\n // 1.13.1 bundles @openai/codex 0.156.1 (1.10.0 shipped 0.153.3). Nothing\n // between 1.10.0 and 1.13.1 is flagged breaking: ACP protocolVersion stays\n // 1, `session/new` and `session/set_config_option` are unchanged, and the\n // additions (recommended model/effort, tool names on tool calls,\n // experimental compaction updates and session notices) are opt-in extras.\n bin_args: [\"-y\", \"@agentclientprotocol/codex-acp@1.13.1\"],\n install: [\n {\n method: \"npm\",\n package: \"@agentclientprotocol/codex-acp@1.13.1\",\n global: true,\n },\n ],\n version_check: {\n // PRESENCE probe — local (global npm tree), not a registry query. See\n // claude-code's version_check note for the npm-view trap this replaces.\n cmd: \"npm ls -g @agentclientprotocol/codex-acp --depth=0\",\n parse: \"(\\\\d+\\\\.\\\\d+\\\\.\\\\d+)\",\n range: \"=1.13.1\",\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.\n provider: \"openai\",\n // \"Use my existing Codex login\" — a FILE-BASED (external) subscription. The\n // Codex CLI's ChatGPT/subscription login lives in `~/.codex/auth.json`\n // (`tokens.access_token`), which the bundled codex runtime reads ITSELF; it\n // has no env-bearer channel like claude-code's CLAUDE_CODE_OAUTH_TOKEN. So\n // `external: true`: subscription mode injects NOTHING (no setEnv) — the host\n // verifies the login is present (fail-loud, via the `codex` provision recipe)\n // and the driver only SCRUBS the api-key vars so a leftover OPENAI_API_KEY /\n // CODEX_API_KEY can't silently flip the spawn to per-token API billing under\n // a \"subscription\" label. OPENAI_API_KEY is scrubbed automatically (it's the\n // provider's api-key var); CODEX_API_KEY is the sibling the codex runtime\n // also honors, so it's listed as a conflictEnv. Money-safe by construction:\n // no OAuth bearer is ever written into an api-key env var, because no bearer\n // is injected at all. An unconfigured codex spawn stays ambient — codex uses\n // its own auth.json precedence (a ChatGPT login already outranks an ambient\n // OPENAI_API_KEY), so this only ADDS an explicit, verified, billing-guaranteed\n // opt-in on top of that.\n authSubscription: {\n external: true,\n conflictEnv: [\"CODEX_API_KEY\"],\n },\n sandbox: \"./SANDBOX.md\",\n // Codex keeps a sqlite state db, PATH aliases and rollouts under CODEX_HOME\n // and fails to start when it can't write there. An OS-confined spawn (app\n // boundary) gets a per-session CODEX_HOME with only the login linked back.\n stateHome: {\n env: \"CODEX_HOME\",\n defaultDir: \".codex\",\n share: [\"auth.json\"],\n // Cwd = project root: codex never reads `.codex/` layers above it, which\n // an app boundary hides (the host git root) and codex aborts on.\n seed: { \"config.toml\": \"project_root_markers = []\\n\" },\n },\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 // Do not declare a fixed default: a ChatGPT subscription exposes valid\n // models dynamically, and forcing a historic ID can make a session fail.\n // Keep this curated menu for catalog consumers and compatibility with the\n // existing CLI discovery contract. It is not a default or an allow-list:\n // explicit model IDs are still validated dynamically by Codex.\n allowed: [\n // Codex-specialized (coding) models.\n \"gpt-5-codex\",\n \"gpt-5.1-codex\",\n \"gpt-5.1-codex-mini\",\n \"gpt-5.1-codex-max\",\n \"gpt-5.2-codex\",\n // GPT-5 generalist family.\n \"gpt-5\",\n \"gpt-5-mini\",\n \"gpt-5-nano\",\n \"gpt-5-pro\",\n \"gpt-5.1\",\n \"gpt-5.2\",\n \"gpt-5.4\",\n \"gpt-5.4-mini\",\n \"gpt-5.4-nano\",\n \"gpt-5.4-pro\",\n \"gpt-5.5\",\n \"gpt-5.5-pro\",\n // GPT-5.6 family.\n \"gpt-5.6-luna\",\n \"gpt-5.6-luna-pro\",\n \"gpt-5.6-sol\",\n \"gpt-5.6-sol-pro\",\n \"gpt-5.6-terra\",\n \"gpt-5.6-terra-pro\",\n // GPT-6 family. Exactly the six ids that exist upstream — taken from\n // the catalog's own synced OpenAI list (`openai-pricing.generated.ts`,\n // OpenRouter passthrough) and cross-checked against the opencode-zen\n // snapshot, which carries gpt-6-astra/luna/sol. Deliberately NOT a\n // symmetric fill of the 5.6 shape: there is no `gpt-6-terra`, and no\n // `gpt-6-codex` — inventing either would put an id in the menu that\n // the bridge would reject on selection. The `:batch` variants the\n // catalog also carries are omitted on purpose; batch is an offline\n // job surface, not something an interactive ACP session selects.\n \"gpt-6-luna\",\n \"gpt-6-luna-pro\",\n \"gpt-6-sol\",\n \"gpt-6-sol-pro\",\n \"gpt-6-astra\",\n \"gpt-6-astra-pro\",\n // GPT-4.1 / 4o generation.\n \"gpt-4.1\",\n \"gpt-4.1-mini\",\n \"gpt-4.1-nano\",\n \"gpt-4o\",\n \"gpt-4o-mini\",\n // o-series reasoning models.\n \"o3\",\n \"o3-pro\",\n \"o3-mini\",\n \"o3-deep-research\",\n \"o4-mini\",\n \"o4-mini-high\",\n \"o4-mini-deep-research\",\n \"o1\",\n \"o1-mini\",\n \"o1-pro\",\n ],\n env: { openai: \"OPENAI_API_KEY\", codex: \"CODEX_API_KEY\" },\n // The maintained ACP bridge exposes `session/set_config_option`, so the\n // model is selected after session creation rather than through argv.\n apply: \"config\",\n },\n capabilities: {\n streaming: true,\n tool_calls: true,\n sub_agents: false,\n file_io: true,\n // The maintained 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: \"string\",\n description:\n \"Optional Codex model ID. Omit it to use the model selected by the current ChatGPT or API-key account; the ACP bridge validates explicit IDs against that account.\",\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": "2.0.21",
3
+ "version": "2.0.23",
4
4
  "description": "@agentproto/adapter-codex — AIP-45 AGENT-CLI adapter for OpenAI's Codex CLI via @agentclientprotocol/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": "2.8.0"
44
+ "@agentproto/driver-agent-cli": "2.10.0"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/node": "^25.9.5",