@openclaw/codex 2026.10.1 → 2026.10.5-beta.1

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.
Files changed (161) hide show
  1. package/dist/.setup/{account-usage-runtime-B7Vg4rmy.mjs → account-usage-runtime-QBZsvZS8.mjs} +8 -7
  2. package/dist/.setup/{app-server-policy-Bg4FZw1f.mjs → app-server-policy-D_zv8J7V.mjs} +3 -4
  3. package/dist/.setup/{apply-BzlIkqSz.mjs → apply-CBMV8LN0.mjs} +40 -51
  4. package/dist/.setup/{attempt-client-cleanup-HXQxfMc1.mjs → attempt-client-cleanup-t-kd_1ys.mjs} +6 -6
  5. package/dist/.setup/attempt-terminal-jO5IMj9K.mjs +2 -0
  6. package/dist/.setup/{attempt-workspace-context-BmCutoyg.mjs → attempt-workspace-context-CcwP3DA3.mjs} +21 -18
  7. package/dist/.setup/{auth-binding-BoMwpuPN.mjs → auth-binding-BaxlhaNx.mjs} +2 -2
  8. package/dist/.setup/{auth-cache-key-BCCQHWdc.mjs → auth-cache-key-DyfUvsSa.mjs} +30 -41
  9. package/dist/.setup/{binding-connection-C-08ez1w.mjs → binding-connection-B7HAAZSI.mjs} +2 -2
  10. package/dist/.setup/{binding-connection.runtime-Dn2p-fdy.mjs → binding-connection.runtime-DAXn7iFl.mjs} +6 -5
  11. package/dist/.setup/{bounded-turn-Cv4uIEzz.mjs → bounded-turn-CyQVQwGe.mjs} +21 -17
  12. package/dist/.setup/{bounded-turn-isolation-DklXNk3k.mjs → bounded-turn-isolation-BfDAo-qZ.mjs} +4 -4
  13. package/dist/.setup/{build-state-BwxNfFEB.mjs → build-state-CzLMy1S9.mjs} +1 -1
  14. package/dist/.setup/{capabilities-kQntafj_.mjs → capabilities-DbOzOglY.mjs} +1 -1
  15. package/dist/.setup/{client-catalog-response-BNFDYAKh.mjs → client-catalog-response-DsbEAtpd.mjs} +25 -32
  16. package/dist/.setup/{client-BIRVBXXb.mjs → client-y7nO6X9c.mjs} +198 -247
  17. package/dist/.setup/{command-dispatch-D3_ypl-R.mjs → command-dispatch-uA9lz2Kf.mjs} +3 -4
  18. package/dist/.setup/{command-formatters-DV3DHhdr.mjs → command-formatters-xW9KpoSZ.mjs} +16 -26
  19. package/dist/.setup/{command-handlers-KPit4G0p.mjs → command-handlers-VBaJnpZo.mjs} +270 -360
  20. package/dist/.setup/{command-rpc-CmQDOxY9.mjs → command-rpc-C9VxOLuG.mjs} +19 -18
  21. package/dist/.setup/{compact-CLLteFIY.mjs → compact-CD8xJxXS.mjs} +41 -61
  22. package/dist/.setup/{computer-use-BVxocZZc.mjs → computer-use-CiToXF5C.mjs} +109 -147
  23. package/dist/.setup/{config-0Gxk3_eq.mjs → config-C1YVVLEA.mjs} +32 -59
  24. package/dist/.setup/config-contracts.shared-D85SGEuq.mjs +4 -0
  25. package/dist/.setup/{config-options-HG_Rr3W_.mjs → config-options-DDzeNQ8m.mjs} +52 -90
  26. package/dist/.setup/{config-parsing-BQq-CHTF.mjs → config-parsing-DsWSCPHO.mjs} +19 -55
  27. package/dist/.setup/{config-runtime-cUYrqu_a.mjs → config-runtime-DWzK-k0n.mjs} +2 -2
  28. package/dist/.setup/{config-security-KAPScztc.mjs → config-security-clxAZYWX.mjs} +35 -39
  29. package/dist/.setup/config-utils-DN_YT7dE.mjs +47 -0
  30. package/dist/.setup/{context-engine-projection-CsgYSQhW.mjs → context-engine-projection-ps-yn_ci.mjs} +10 -22
  31. package/dist/.setup/{conversation-binding-DJ_288rC.mjs → conversation-binding-CTSLDM9S.mjs} +85 -119
  32. package/dist/.setup/{conversation-binding-data-DJ4ix-W5.mjs → conversation-binding-data-UgLuTSQT.mjs} +9 -8
  33. package/dist/.setup/{conversation-control-CuiZ_pDL.mjs → conversation-control-GXM3unE4.mjs} +7 -10
  34. package/dist/.setup/{cyber-failover-Bb1J6hS1.mjs → cyber-failover-D4dgNfFf.mjs} +2 -5
  35. package/dist/.setup/{cyber-failover-notice-XR03ef31.mjs → cyber-failover-notice-ljgGGL0s.mjs} +1 -1
  36. package/dist/.setup/{doctor-start-options-DPW9JxIE.mjs → doctor-start-options-JjTAl-q_.mjs} +5 -5
  37. package/dist/.setup/{dynamic-tool-build-DgWZMfAQ.mjs → dynamic-tool-build-D731PCdv.mjs} +57 -69
  38. package/dist/.setup/{dynamic-tools-Ct6GKAFr.mjs → dynamic-tools-D0pYbxHH.mjs} +689 -710
  39. package/dist/.setup/{effective-mcp-catalog-DmCSc8TS.mjs → effective-mcp-catalog-1hWFKghy.mjs} +11 -20
  40. package/dist/.setup/{elicitation-input-r9axtppm.mjs → elicitation-input-DXG_qaXr.mjs} +14 -20
  41. package/dist/.setup/{ephemeral-turn-_cBMKCFb.mjs → ephemeral-turn-Cphy5Qr_.mjs} +3 -3
  42. package/dist/.setup/{event-projector-assistant-message-C3Tpt370.mjs → event-projector-assistant-message-CLMKN4x-.mjs} +2 -2
  43. package/dist/.setup/{event-projector-usage-03R0I2dM.mjs → event-projector-usage-BpKfdoTm.mjs} +20 -33
  44. package/dist/.setup/{event-projector-values-DTqZHizf.mjs → event-projector-values-CLvG1Hil.mjs} +4 -5
  45. package/dist/.setup/history-rejection-B4nOXNXF.mjs +13 -0
  46. package/dist/.setup/{inference-context-D-9gWlTR.mjs → inference-context-DNlGwzwy.mjs} +10 -11
  47. package/dist/.setup/{inference-dispatch-B5UKEUyC.mjs → inference-dispatch-CO6tTs4q.mjs} +5 -4
  48. package/dist/.setup/{inference-metadata-CgIf7sOx.mjs → inference-metadata-DCvcG_N_.mjs} +36 -41
  49. package/dist/.setup/{inference-proxy-DUO5E2QQ.mjs → inference-proxy-BDWV0djM.mjs} +10 -14
  50. package/dist/.setup/{isolated-completion-CjrQEeke.mjs → isolated-completion-Bhqd2yBq.mjs} +8 -8
  51. package/dist/.setup/local-runtime-attribution-CZz2DJ4q.mjs +15 -0
  52. package/dist/.setup/{managed-binary-C1VFoVPf.mjs → managed-binary-BtIjV7yN.mjs} +16 -36
  53. package/dist/.setup/{mcp-app-session-preparation-D0yRoreX.mjs → mcp-app-session-preparation-DqSvxFqc.mjs} +24 -25
  54. package/dist/.setup/{mcp-tool-metadata-j10HhfTC.mjs → mcp-tool-metadata-DW41snf3.mjs} +1 -1
  55. package/dist/.setup/{model-catalog--G4arndd.mjs → model-catalog-B227ST3D.mjs} +6 -6
  56. package/dist/.setup/{models-BYbLQPnj.mjs → models-DdRyi93L.mjs} +6 -10
  57. package/dist/.setup/{native-auth-Cjb9y7IZ.mjs → native-auth-esN5MdIv.mjs} +5 -5
  58. package/dist/.setup/{native-execution-policy-ClzpdG3D.mjs → native-execution-policy-MXEe7PB3.mjs} +11 -28
  59. package/dist/.setup/native-hook-relay-BUWIOrSr.mjs +561 -0
  60. package/dist/.setup/{native-mcp-app-5i5eRCwO.mjs → native-mcp-app-CjxJQ4F7.mjs} +6 -6
  61. package/dist/.setup/native-skill-isolation-UMVoNjZz.mjs +391 -0
  62. package/dist/.setup/{native-subagent-monitor-B2C8D_N0.mjs → native-subagent-monitor-iHc8oLg5.mjs} +505 -639
  63. package/dist/.setup/{native-subagent-pending-assignments-BDqhOdJp.mjs → native-subagent-pending-assignments-DmVhedNs.mjs} +11 -23
  64. package/dist/.setup/{native-task-assignments-C6KVqiN1.mjs → native-task-assignments-DimsQ9Qa.mjs} +73 -27
  65. package/dist/.setup/{node-cli-sessions-B5oNDkUS.mjs → node-cli-sessions-CzKg2nGq.mjs} +18 -26
  66. package/dist/.setup/{node-exec-server.runtime-0xSEjKYt.mjs → node-exec-server.runtime-BWkULhBM.mjs} +5 -8
  67. package/dist/.setup/{plan-B5bDIEuQ.mjs → plan-C_F3aio0.mjs} +40 -50
  68. package/dist/.setup/{plugin-activation-BcyBv8PG.mjs → plugin-activation-D7WkJMvU.mjs} +4 -5
  69. package/dist/.setup/{plugin-app-cache-key-BW8rd98k.mjs → plugin-app-cache-key-Bg9DbDI6.mjs} +18 -23
  70. package/dist/.setup/{plugin-approval-roundtrip-C_SGp5YW.mjs → plugin-approval-roundtrip-BSV-51ig.mjs} +4 -6
  71. package/dist/.setup/{plugin-inventory-Bf0_piTw.mjs → plugin-inventory-CYgdo14P.mjs} +28 -43
  72. package/dist/.setup/{plugin-marketplace-discovery-SQPhSuic.mjs → plugin-marketplace-discovery-BblHM3DU.mjs} +7 -10
  73. package/dist/.setup/{plugin-metadata-cache-DWnB7VMj.mjs → plugin-metadata-cache-Bi8TAPwX.mjs} +5 -10
  74. package/dist/.setup/project-doc-thread-config-BVcvnps8.mjs +490 -0
  75. package/dist/.setup/{provider-BoIby-eX.mjs → provider-BJ4xhaGX.mjs} +4 -4
  76. package/dist/.setup/{provider-capabilities-B4yq6UgQ.mjs → provider-capabilities-CjRaV3bx.mjs} +1 -1
  77. package/dist/.setup/{rate-limits-CMPy24F5.mjs → rate-limits-CI8pTPqL.mjs} +15 -32
  78. package/dist/.setup/reasoning-effort-CS9kKWB9.mjs +37 -0
  79. package/dist/.setup/{request-DD3u22uv.mjs → request-Y8dmbqZ3.mjs} +28 -48
  80. package/dist/.setup/{rpc-error-hmWM21RB.mjs → rpc-error-C98SHchT.mjs} +3 -6
  81. package/dist/.setup/{run-attempt-DOVF5OON.mjs → run-attempt-Dx7a4Mfm.mjs} +927 -859
  82. package/dist/.setup/{run-attempt-lifecycle-BuZgVbDA.mjs → run-attempt-lifecycle-KN4oh-7O.mjs} +13 -4
  83. package/dist/.setup/{runtime-artifact-CUTOOnKw.mjs → runtime-artifact-C13pR7tD.mjs} +18 -22
  84. package/dist/.setup/{runtime-artifact-connection-CADz3_BY.mjs → runtime-artifact-connection-jS5DeCok.mjs} +3 -3
  85. package/dist/.setup/{sandbox-guard-WqE8yPge.mjs → sandbox-guard-DIImwCy1.mjs} +4 -6
  86. package/dist/.setup/service-tier-normalization-BPgw2Wdt.mjs +9 -0
  87. package/dist/.setup/{session-binding-Ce7BqiPN.mjs → session-binding-JEHNMPsr.mjs} +13 -40
  88. package/dist/.setup/{session-binding-record-BZB8RgcF.mjs → session-binding-record-DU_0biMD.mjs} +4 -4
  89. package/dist/.setup/{session-binding-record-codec-z4ZpDn6E.mjs → session-binding-record-codec-BpH8u_G9.mjs} +16 -39
  90. package/dist/.setup/{session-binding-sidecars-BrdV95Fg.mjs → session-binding-sidecars-DD-enC8w.mjs} +49 -54
  91. package/dist/.setup/{session-catalog-adoption-CPIP4S_y.mjs → session-catalog-adoption-Ca3OYGYM.mjs} +23 -27
  92. package/dist/.setup/{session-catalog-archive-DcgwvSbF.mjs → session-catalog-archive-Bv6gV7x9.mjs} +6 -6
  93. package/dist/.setup/{session-catalog-events-DRaivXvC.mjs → session-catalog-events-DzFlXNUe.mjs} +6 -5
  94. package/dist/.setup/{session-catalog-index-qwmgqC4t.mjs → session-catalog-index-DozvkUPd.mjs} +111 -105
  95. package/dist/.setup/{session-catalog-index-order-nhyO0wdW.mjs → session-catalog-index-order-CTfoefow.mjs} +28 -5
  96. package/dist/.setup/{session-catalog-limits-DEU36Qlo.mjs → session-catalog-limits-BynIoOYm.mjs} +1 -1
  97. package/dist/.setup/{session-catalog-list-request-tXephOB4.mjs → session-catalog-list-request-D4MYNgDB.mjs} +11 -8
  98. package/dist/.setup/{session-catalog-native-projection-z9Q608QW.mjs → session-catalog-native-projection-rCKnZud1.mjs} +5 -61
  99. package/dist/.setup/{session-catalog-node-adoption-7-WEQTB1.mjs → session-catalog-node-adoption-BdP9Zjqo.mjs} +2 -2
  100. package/dist/.setup/{session-catalog-node-continue-DLWBwAAO.mjs → session-catalog-node-continue-CNJibO4_.mjs} +27 -49
  101. package/dist/.setup/{session-catalog-node-lookup-Uufckwcm.mjs → session-catalog-node-lookup-BH_DBGa9.mjs} +3 -3
  102. package/dist/.setup/{session-catalog-parsing-B-qWJh2x.mjs → session-catalog-parsing-DkeoVn60.mjs} +9 -19
  103. package/dist/.setup/{session-catalog-projection-Cl0Nc7c6.mjs → session-catalog-projection-DDVmALHj.mjs} +8 -22
  104. package/dist/.setup/session-catalog-source-CygTGmrb.mjs +58 -0
  105. package/dist/.setup/{session-cli-kH4vuGod.mjs → session-cli-GwU0izn-.mjs} +20 -41
  106. package/dist/.setup/{session-history-BogBHKLk.mjs → session-history-BO6i_pfk.mjs} +1 -1
  107. package/dist/.setup/{session-history-import-NWKPa4ZO.mjs → session-history-import-CaO8s6ta.mjs} +4 -4
  108. package/dist/.setup/{session-history-read-CNN8zwbD.mjs → session-history-read-BI_2jRED.mjs} +4 -15
  109. package/dist/.setup/{session-history.worker-Cq_4DYgN.mjs → session-history.worker-DJQfek5p.mjs} +147 -159
  110. package/dist/.setup/{session-initialization-D6dtFQkE.mjs → session-initialization-Bi_2DKhc.mjs} +3 -5
  111. package/dist/.setup/{session-permission-policy-BxIUJ0Zd.mjs → session-permission-policy-CD2MAWU8.mjs} +12 -20
  112. package/dist/.setup/{session-retirement-Bt3b0fpe.mjs → session-retirement-IoS3zr17.mjs} +7 -7
  113. package/dist/.setup/{settled-turn-context-BZsMjkIO.mjs → settled-turn-context-BPL6D3RO.mjs} +1 -1
  114. package/dist/.setup/{settled-turn-finalizer-e_24O6HA.mjs → settled-turn-finalizer-X-Fylp-u.mjs} +12 -11
  115. package/dist/.setup/{shared-client-DeenOD8U.mjs → shared-client-ByIwuAC-.mjs} +172 -229
  116. package/dist/.setup/{side-question-BZHn_1Jm.mjs → side-question-BDUdozFy.mjs} +116 -137
  117. package/dist/.setup/{source-0ClinBHI.mjs → source-Bxbqf3S1.mjs} +37 -56
  118. package/dist/.setup/thread-archive-guard-LKdwQKyr.mjs +56 -0
  119. package/dist/.setup/{thread-lifecycle-CoqYpbpk.mjs → thread-lifecycle-run-CfP4PnEf.mjs} +348 -484
  120. package/dist/.setup/thread-model-selection-DcVebr8N.mjs +61 -0
  121. package/dist/.setup/{thread-ownership-CSDZ6mHd.mjs → thread-ownership-Be53aiaG.mjs} +5 -5
  122. package/dist/.setup/{thread-ownership-queue-Dp24d7-F.mjs → thread-ownership-queue-CeyYScUC.mjs} +5 -6
  123. package/dist/.setup/{thread-policy-DCC9lQjC.mjs → thread-policy-CHgY-KNl.mjs} +4 -4
  124. package/dist/.setup/thread-requests-BgzJwJtS.mjs +745 -0
  125. package/dist/.setup/{thread-resume--WOKWxZd.mjs → thread-resume-B2EmMcgE.mjs} +5 -5
  126. package/dist/.setup/{timeout-CXOfNoaX.mjs → timeout-D0mEWSGG.mjs} +6 -12
  127. package/dist/.setup/{transcript-history-projection-B9a7HwUV.mjs → transcript-history-projection-DfKcoZCB.mjs} +3 -4
  128. package/dist/.setup/{transcript-mirror-BfLRARNL.mjs → transcript-mirror-Bee2o6jj.mjs} +68 -68
  129. package/dist/.setup/{transcript-mirror-attestation-YSegaktH.mjs → transcript-mirror-attestation-BzUXnrvv.mjs} +5 -2
  130. package/dist/.setup/{transport-stdio-a0HDa2Mj.mjs → transport-stdio-CRWTkKOn.mjs} +67 -77
  131. package/dist/.setup/{transport-websocket-zqJ0Cmtn.mjs → transport-websocket-DIyPfkHo.mjs} +8 -16
  132. package/dist/.setup/{turn-router-BWhX_SBh.mjs → turn-router-DKDAziUW.mjs} +30 -31
  133. package/dist/.setup/upstream-prompt-provenance-Ccd9MFRJ.mjs +44 -0
  134. package/dist/.setup/{upstream-session-fork-BQvofnk7.mjs → upstream-session-fork-Djp_yssT.mjs} +50 -43
  135. package/dist/.setup/{usage-BEHcVwcZ.mjs → usage-DQA-peQC.mjs} +4 -4
  136. package/dist/.setup/{usage-limit-error-D1p3nE6n.mjs → usage-limit-error-2t3KBqiX.mjs} +12 -21
  137. package/dist/.setup/web-search-item-CvokaZOo.mjs +20 -0
  138. package/dist/.setup/{web-search-provider.runtime-CV9oiB-v.mjs → web-search-provider.runtime-BsuCMNix.mjs} +3 -3
  139. package/dist/.setup/{workspace-write-sandbox-probe-DmUHLrrl.mjs → workspace-write-sandbox-probe-BDWO2Qkh.mjs} +4 -4
  140. package/dist/api.js +15 -15
  141. package/dist/catalog-page.worker.js +1 -1
  142. package/dist/cli-metadata.js +1 -1
  143. package/dist/doctor-contract-api.js +5 -6
  144. package/dist/harness.js +32 -61
  145. package/dist/index.js +302 -416
  146. package/dist/media-understanding-provider.js +32 -43
  147. package/dist/migration-provider-api.js +1 -1
  148. package/dist/native-session-binding-api.js +1 -1
  149. package/dist/native-tool-policy.js +23 -1
  150. package/dist/provider-discovery.js +1 -1
  151. package/dist/session-history-worker-runtime.js +52 -31
  152. package/dist/session-history.worker.js +1 -1
  153. package/openclaw.plugin.json +20 -3
  154. package/package.json +7 -7
  155. package/dist/.setup/attempt-terminal-gZrxQ35N.mjs +0 -5
  156. package/dist/.setup/plugin-thread-config-deadline-CsScGgrk.mjs +0 -124
  157. package/dist/.setup/service-tier-normalization-Cei89SW6.mjs +0 -15
  158. package/dist/.setup/shell-dynamic-tools-BqGszXcq.mjs +0 -85
  159. package/dist/.setup/thread-archive-guard-C9frICzX.mjs +0 -60
  160. package/dist/.setup/thread-requests-Dwg2b4Xl.mjs +0 -2111
  161. package/dist/.setup/upstream-prompt-provenance-fXkKbPVC.mjs +0 -37
@@ -0,0 +1,391 @@
1
+ import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
2
+ import { n as resolveCodexAppServerLocalHomeDir } from "./auth-start-options-BPIPeEX8.mjs";
3
+ import { t as buildCodexAppServerConnectionFingerprint } from "./plugin-app-cache-key-Bg9DbDI6.mjs";
4
+ import { W as readCodexClientSessionMeta } from "./shared-client-ByIwuAC-.mjs";
5
+ import { f as unsubscribeCodexThreadBestEffort, n as CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS } from "./attempt-client-cleanup-t-kd_1ys.mjs";
6
+ import { b as codexDynamicToolsFingerprint, p as attestCodexRestrictedToolSurfaceMcpServersDisabled } from "./thread-requests-BgzJwJtS.mjs";
7
+ import path from "node:path";
8
+ import os from "node:os";
9
+ import fs from "node:fs/promises";
10
+ import { isPathInside } from "openclaw/plugin-sdk/file-access-runtime";
11
+ import { resolveRequiredHomeDir, resolveStateDir } from "openclaw/plugin-sdk/state-paths";
12
+ import { embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
13
+ //#region extensions/codex/src/app-server/native-tool-catalog.ts
14
+ function hasCodexNativeToolCatalog(binding) {
15
+ return binding?.connectionScope === "supervision" && !binding.pendingSupervisionBranch;
16
+ }
17
+ /** Pinned serde omits empty catalogs and false deferLoading; declarations remain native-owned. */
18
+ function parseCodexNativeToolCatalog(metadata, threadId, fingerprint) {
19
+ const fail = () => /* @__PURE__ */ new Error("The canonical Codex native tool catalog is missing, corrupt, or changed; the thread is preserved. Reconnect and inspect its native metadata before retrying.");
20
+ if (!isJsonObject(metadata) || metadata.id !== threadId) throw fail();
21
+ const catalog = metadata.dynamic_tools ?? [];
22
+ if (!Array.isArray(catalog) || Buffer.byteLength(JSON.stringify(catalog)) > 1048576) throw fail();
23
+ const names = /* @__PURE__ */ new Set();
24
+ const namespaces = /* @__PURE__ */ new Set();
25
+ const validName = (name) => typeof name === "string" && /^[a-zA-Z0-9_-]{1,128}$/u.test(name);
26
+ const readFunction = (value) => {
27
+ if (!isJsonObject(value) || value.type !== "function" || !validName(value.name) || typeof value.description !== "string" || !isJsonObject(value.inputSchema) || value.deferLoading !== void 0 && typeof value.deferLoading !== "boolean" || Object.keys(value).some((key) => ![
28
+ "type",
29
+ "name",
30
+ "description",
31
+ "inputSchema",
32
+ "deferLoading"
33
+ ].includes(key)) || names.has(value.name) || names.size >= 2e3) throw fail();
34
+ names.add(value.name);
35
+ return {
36
+ type: "function",
37
+ name: value.name,
38
+ description: value.description,
39
+ inputSchema: structuredClone(value.inputSchema),
40
+ ...value.deferLoading === true ? { deferLoading: true } : {}
41
+ };
42
+ };
43
+ const tools = catalog.map((value) => {
44
+ if (!isJsonObject(value) || value.type !== "namespace") return readFunction(value);
45
+ if (!validName(value.name) || namespaces.has(value.name) || typeof value.description !== "string" || !Array.isArray(value.tools) || !value.tools.length || Object.keys(value).some((key) => ![
46
+ "type",
47
+ "name",
48
+ "description",
49
+ "tools"
50
+ ].includes(key))) throw fail();
51
+ namespaces.add(value.name);
52
+ return {
53
+ type: "namespace",
54
+ name: value.name,
55
+ description: value.description,
56
+ tools: value.tools.map(readFunction)
57
+ };
58
+ });
59
+ if (fingerprint !== void 0 && codexDynamicToolsFingerprint(tools) !== fingerprint) throw fail();
60
+ return tools;
61
+ }
62
+ /** Existing supervised bindings identify data, never authorize an executor or a new adoption. */
63
+ async function loadCodexNativeToolCatalog(params) {
64
+ const { binding, client, appServer, agentDir, assertCurrent } = params;
65
+ assertCurrent();
66
+ const home = resolveCodexAppServerLocalHomeDir(appServer.start, agentDir);
67
+ const actualHome = client.getRuntimeIdentity()?.codexHome;
68
+ if (!hasCodexNativeToolCatalog(binding) || !binding.dynamicToolsFingerprint || appServer.start.transport !== "stdio" && appServer.start.transport !== "unix" || appServer.remoteWorkspaceRoot || !actualHome || path.resolve(actualHome) !== path.resolve(home) || binding.appServerRuntimeFingerprint !== buildCodexAppServerConnectionFingerprint(appServer, agentDir)) throw new Error("Canonical Codex declarations require the original verified local binding and selected native connection; the thread is preserved.");
69
+ const metadata = await readCodexClientSessionMeta(client, path.join(home, "sessions"), binding.rolloutPath, binding.threadId);
70
+ const consume = () => {
71
+ assertCurrent();
72
+ return parseCodexNativeToolCatalog(metadata, binding.threadId, binding.dynamicToolsFingerprint);
73
+ };
74
+ return params.authority ? await params.authority.withCurrent(consume) : consume();
75
+ }
76
+ //#endregion
77
+ //#region extensions/codex/src/app-server/plugin-thread-attestation.ts
78
+ /**
79
+ * Checks app availability and enforces restricted MCP surfaces before a turn.
80
+ */
81
+ /** Every admission path checks the same surface; its lifecycle owner keeps the claim fenced. */
82
+ async function attestCodexThreadToolSurface(params) {
83
+ if (params.appIds.length === 0 && !params.restrictedToolSurface) {
84
+ params.signal?.throwIfAborted();
85
+ params.assertCurrent();
86
+ return;
87
+ }
88
+ if (params.withCurrent) await params.withCurrent(params.assertCurrent);
89
+ else params.assertCurrent();
90
+ if (params.appIds.length > 0) {
91
+ await params.lifecycleTiming.measure("plugin-app-attestation", () => checkCodexThreadAppAvailability(params));
92
+ if (params.withCurrent) await params.withCurrent(params.assertCurrent);
93
+ else params.assertCurrent();
94
+ }
95
+ if (params.restrictedToolSurface) {
96
+ await params.lifecycleTiming.measure("restricted-tool-surface-mcp-attestation", () => attestCodexRestrictedToolSurfaceMcpServersDisabled(params.client, params.threadId, params.threadConfig, params.signal, params.appIds.length > 0 ? ["codex_apps"] : []));
97
+ if (params.withCurrent) await params.withCurrent(params.assertCurrent);
98
+ else params.assertCurrent();
99
+ }
100
+ }
101
+ var CodexPluginThreadAppAttestationError = class extends Error {
102
+ constructor(message, options) {
103
+ super(message, options);
104
+ this.name = "CodexPluginThreadAppAttestationError";
105
+ }
106
+ };
107
+ /** Reads the existing runtime snapshot with the started thread's effective app policy. */
108
+ async function checkCodexThreadAppAvailability(params) {
109
+ const appIds = Array.from(new Set(params.appIds.filter(Boolean))).toSorted();
110
+ if (appIds.length === 0) return;
111
+ let response;
112
+ try {
113
+ response = await params.client.request("app/installed", {
114
+ threadId: params.threadId,
115
+ forceRefresh: false
116
+ }, {
117
+ signal: params.signal,
118
+ withCurrent: params.withCurrent
119
+ });
120
+ } catch (error) {
121
+ params.signal?.throwIfAborted();
122
+ throw new CodexPluginThreadAppAttestationError(`Codex could not confirm admitted apps for thread ${params.threadId}`, { cause: error });
123
+ }
124
+ params.signal?.throwIfAborted();
125
+ const installedById = new Map(response.apps.map((app) => [app.id, app]));
126
+ const failures = appIds.flatMap((appId) => {
127
+ const app = installedById.get(appId);
128
+ if (!app) return [`${appId}:missing`];
129
+ if (!app.enabled) return [`${appId}:disabled`];
130
+ return app.callable ? [] : [`${appId}:not-callable`];
131
+ });
132
+ if (failures.length > 0) embeddedAgentLog.warn("codex apps unavailable; continuing with remaining tools", {
133
+ threadId: params.threadId,
134
+ failures
135
+ });
136
+ }
137
+ /** Deletes a persistent pre-turn thread; ephemeral threads can only be unsubscribed. */
138
+ async function discardUnattestedCodexPluginThread(params) {
139
+ const { ephemeral } = params;
140
+ if (!ephemeral) try {
141
+ await params.client.request("thread/delete", { threadId: params.threadId }, { timeoutMs: CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS });
142
+ return true;
143
+ } catch (error) {
144
+ embeddedAgentLog.debug("codex plugin app attestation thread deletion failed", {
145
+ threadId: params.threadId,
146
+ error
147
+ });
148
+ }
149
+ const unsubscribed = await unsubscribeCodexThreadBestEffort(params.client, {
150
+ threadId: params.threadId,
151
+ timeoutMs: CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS
152
+ });
153
+ return ephemeral && unsubscribed;
154
+ }
155
+ //#endregion
156
+ //#region extensions/codex/src/app-server/native-skill-isolation.ts
157
+ const MAX_PERSONAL_SKILL_DIRECTORIES = 2e3;
158
+ const MAX_PERSONAL_SKILL_DEPTH = 6;
159
+ const MAX_PERSONAL_SKILL_ENTRIES = 1e4;
160
+ const CODEX_VISUALIZE_PLUGIN_ID = "visualize@openai-bundled";
161
+ const CODEX_VISUALIZE_LEGACY_PATH = "/plugins/cache/openai-bundled/visualize/";
162
+ const DEFAULT_STATE_SKILL_DISCOVERY_UNAVAILABLE = Symbol("default-state-skill-discovery-unavailable");
163
+ const nativeSkillIsolationByClient = /* @__PURE__ */ new WeakMap();
164
+ function isMissingPathError(error) {
165
+ return error.code === "ENOENT";
166
+ }
167
+ function isUnsupportedCodexVisualizeSkill(skill) {
168
+ if (skill.pluginId) return skill.pluginId === CODEX_VISUALIZE_PLUGIN_ID;
169
+ return (skill.name === "visualize" || skill.name === "visualize:visualize") && skill.path.replaceAll("\\", "/").includes(CODEX_VISUALIZE_LEGACY_PATH);
170
+ }
171
+ async function canonicalizeExistingPath(candidate) {
172
+ try {
173
+ return await fs.realpath(candidate);
174
+ } catch {
175
+ return path.resolve(candidate);
176
+ }
177
+ }
178
+ async function usesDefaultStateDir() {
179
+ if (!process.env.OPENCLAW_STATE_DIR?.trim()) return true;
180
+ const home = resolveRequiredHomeDir();
181
+ const [stateDir, defaultStateDir] = await Promise.all([canonicalizeExistingPath(resolveStateDir()), canonicalizeExistingPath(path.join(home, ".openclaw"))]);
182
+ return stateDir === defaultStateDir;
183
+ }
184
+ async function collectPersonalSkillRealPaths(homes, codexHome) {
185
+ const realStateDir = await canonicalizeExistingPath(resolveStateDir());
186
+ const roots = [];
187
+ for (const home of homes) {
188
+ for (const dir of [".agents", ".claude"]) roots.push({
189
+ dir: path.join(home, dir, "skills"),
190
+ onlyEscapedStateTargets: false
191
+ });
192
+ const defaultCodexHome = path.join(home, ".codex");
193
+ const realDefaultCodexHome = await canonicalizeExistingPath(defaultCodexHome);
194
+ roots.push({
195
+ dir: path.join(defaultCodexHome, "skills"),
196
+ onlyEscapedStateTargets: isPathInside(realStateDir, realDefaultCodexHome)
197
+ });
198
+ }
199
+ const configuredCodexHome = codexHome?.trim() || process.env.CODEX_HOME?.trim();
200
+ if (configuredCodexHome) {
201
+ const realCodexHome = await canonicalizeExistingPath(configuredCodexHome);
202
+ const stateOwned = isPathInside(realStateDir, realCodexHome);
203
+ roots.push({
204
+ dir: path.join(configuredCodexHome, "skills"),
205
+ onlyEscapedStateTargets: stateOwned
206
+ });
207
+ }
208
+ const skillPaths = /* @__PURE__ */ new Set();
209
+ let complete = true;
210
+ const seenDirectories = /* @__PURE__ */ new Set();
211
+ const queue = roots.map((root) => ({
212
+ dir: root.dir,
213
+ onlyEscapedStateTargets: root.onlyEscapedStateTargets,
214
+ depth: 0
215
+ }));
216
+ let entryCount = 0;
217
+ const recordScanError = (error) => {
218
+ if (!isMissingPathError(error)) complete = false;
219
+ };
220
+ const recordSkillFile = async (filePath, onlyEscapedStateTargets) => {
221
+ try {
222
+ const skillRealPath = await fs.realpath(filePath);
223
+ if (!onlyEscapedStateTargets || !isPathInside(realStateDir, skillRealPath)) skillPaths.add(skillRealPath);
224
+ } catch (error) {
225
+ recordScanError(error);
226
+ }
227
+ };
228
+ for (const current of queue) {
229
+ let realDir;
230
+ try {
231
+ realDir = await fs.realpath(current.dir);
232
+ } catch (error) {
233
+ recordScanError(error);
234
+ continue;
235
+ }
236
+ if (seenDirectories.has(realDir)) continue;
237
+ seenDirectories.add(realDir);
238
+ if (seenDirectories.size > MAX_PERSONAL_SKILL_DIRECTORIES) {
239
+ complete = false;
240
+ break;
241
+ }
242
+ let directory;
243
+ try {
244
+ directory = await fs.opendir(current.dir);
245
+ } catch (error) {
246
+ recordScanError(error);
247
+ continue;
248
+ }
249
+ try {
250
+ for await (const entry of directory) {
251
+ entryCount += 1;
252
+ if (entryCount > MAX_PERSONAL_SKILL_ENTRIES) {
253
+ complete = false;
254
+ queue.length = 0;
255
+ break;
256
+ }
257
+ if (entry.name.startsWith(".")) continue;
258
+ const entryPath = path.join(current.dir, entry.name);
259
+ let isFile = entry.isFile();
260
+ let isDirectory = entry.isDirectory();
261
+ if (entry.isSymbolicLink()) try {
262
+ const stat = await fs.stat(entryPath);
263
+ isFile = stat.isFile();
264
+ isDirectory = stat.isDirectory();
265
+ } catch (error) {
266
+ recordScanError(error);
267
+ continue;
268
+ }
269
+ if (entry.name === "SKILL.md" && isFile) {
270
+ await recordSkillFile(entryPath, current.onlyEscapedStateTargets);
271
+ continue;
272
+ }
273
+ if (isDirectory) {
274
+ if (current.depth >= MAX_PERSONAL_SKILL_DEPTH) complete = false;
275
+ else queue.push({
276
+ dir: entryPath,
277
+ depth: current.depth + 1,
278
+ onlyEscapedStateTargets: current.onlyEscapedStateTargets
279
+ });
280
+ }
281
+ }
282
+ } catch (error) {
283
+ recordScanError(error);
284
+ }
285
+ }
286
+ return {
287
+ complete,
288
+ skillPaths
289
+ };
290
+ }
291
+ /** Resolves native skill rules required by the OpenClaw thread boundary. */
292
+ async function resolveCodexNativeSkillIsolation(params) {
293
+ params.signal?.throwIfAborted();
294
+ const key = JSON.stringify([
295
+ path.resolve(resolveStateDir()),
296
+ path.resolve(params.cwd),
297
+ params.codexHome?.trim() || process.env.CODEX_HOME?.trim() || "",
298
+ params.home?.trim() || process.env.HOME?.trim() || "",
299
+ params.userProfile?.trim() || process.env.USERPROFILE?.trim() || ""
300
+ ]);
301
+ let cache = nativeSkillIsolationByClient.get(params.client);
302
+ if (!cache) {
303
+ cache = { revision: 0 };
304
+ nativeSkillIsolationByClient.set(params.client, cache);
305
+ const clientCache = cache;
306
+ params.client.addNotificationHandler((notification) => {
307
+ if (notification.method === "skills/changed") {
308
+ clientCache.revision += 1;
309
+ clientCache.snapshot = void 0;
310
+ }
311
+ });
312
+ }
313
+ for (;;) {
314
+ params.signal?.throwIfAborted();
315
+ let snapshot = cache.snapshot;
316
+ if (snapshot?.key !== key || !snapshot.settled && snapshot.signal !== params.signal) {
317
+ snapshot = {
318
+ key,
319
+ revision: cache.revision,
320
+ result: resolveUncachedCodexNativeSkillIsolation(params),
321
+ settled: false,
322
+ signal: params.signal
323
+ };
324
+ cache.snapshot = snapshot;
325
+ }
326
+ try {
327
+ const isolation = await snapshot.result;
328
+ snapshot.settled = true;
329
+ params.signal?.throwIfAborted();
330
+ if (snapshot.revision === cache.revision) {
331
+ if (isolation === DEFAULT_STATE_SKILL_DISCOVERY_UNAVAILABLE) {
332
+ cache.snapshot = void 0;
333
+ return;
334
+ }
335
+ return isolation;
336
+ }
337
+ } catch (error) {
338
+ if (cache.snapshot === snapshot) cache.snapshot = void 0;
339
+ throw error;
340
+ }
341
+ }
342
+ }
343
+ async function resolveUncachedCodexNativeSkillIsolation(params) {
344
+ const defaultStateDir = await usesDefaultStateDir();
345
+ let response;
346
+ let skillPaths;
347
+ try {
348
+ response = await params.client.request("skills/list", {
349
+ cwds: [params.cwd],
350
+ forceReload: true
351
+ }, { signal: params.signal });
352
+ if (response.data.some((entry) => entry.errors.length > 0)) throw new Error("Codex native skill discovery returned errors");
353
+ skillPaths = /* @__PURE__ */ new Set();
354
+ for (const entry of response.data) for (const skill of entry.skills) if (isUnsupportedCodexVisualizeSkill(skill)) skillPaths.add(skill.path);
355
+ } catch (error) {
356
+ params.signal?.throwIfAborted();
357
+ if (!defaultStateDir) throw error;
358
+ return DEFAULT_STATE_SKILL_DISCOVERY_UNAVAILABLE;
359
+ }
360
+ if (defaultStateDir && skillPaths.size === 0) return;
361
+ if (!defaultStateDir) {
362
+ const homes = [params.home?.trim() || process.env.HOME?.trim() || process.env.USERPROFILE?.trim() || os.homedir()];
363
+ if (process.platform === "win32") homes.push(params.userProfile?.trim() || os.homedir());
364
+ const personalSkills = await collectPersonalSkillRealPaths([...new Set(homes.map((home) => path.resolve(home)))], params.codexHome);
365
+ for (const skillPath of personalSkills.skillPaths) skillPaths.add(skillPath);
366
+ if (!personalSkills.complete) {
367
+ for (const entry of response.data) for (const skill of entry.skills) if (skill.scope === "user") skillPaths.add(skill.path);
368
+ }
369
+ }
370
+ return {
371
+ disabledUserSkillPaths: [...skillPaths].toSorted((left, right) => left.localeCompare(right)),
372
+ suppressNativeSkillInstructions: !defaultStateDir
373
+ };
374
+ }
375
+ /** Applies path-exact rules and non-default-state catalog isolation after caller config. */
376
+ function applyCodexNativeSkillIsolation(config, isolation) {
377
+ if (!isolation) return config;
378
+ const existingRules = config?.["skills.config"];
379
+ if (existingRules !== void 0 && !Array.isArray(existingRules)) throw new Error("Codex thread skills.config must be an array");
380
+ const disabledRules = isolation.disabledUserSkillPaths.map((skillPath) => ({
381
+ path: skillPath,
382
+ enabled: false
383
+ }));
384
+ return {
385
+ ...config,
386
+ ...isolation.suppressNativeSkillInstructions ? { "skills.include_instructions": false } : {},
387
+ "skills.config": [...existingRules ?? [], ...disabledRules]
388
+ };
389
+ }
390
+ //#endregion
391
+ export { discardUnattestedCodexPluginThread as a, parseCodexNativeToolCatalog as c, checkCodexThreadAppAvailability as i, resolveCodexNativeSkillIsolation as n, hasCodexNativeToolCatalog as o, attestCodexThreadToolSurface as r, loadCodexNativeToolCatalog as s, applyCodexNativeSkillIsolation as t };