@openclaw/codex 2026.9.8 → 2026.10.1-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.
- package/README.md +8 -0
- package/dist/.setup/{account-usage-runtime-G348lY1q.mjs → account-usage-runtime-C4GFoef_.mjs} +5 -5
- package/dist/.setup/app-server-policy-Bg4FZw1f.mjs +23 -0
- package/dist/.setup/{apply-Cqb-YoCS.mjs → apply-D02fLpgN.mjs} +48 -39
- package/dist/.setup/attempt-client-cleanup-yLjGwbwT.mjs +155 -0
- package/dist/.setup/{attempt-workspace-context-BJ5Z_olH.mjs → attempt-workspace-context-CbSzT6V2.mjs} +11 -15
- package/dist/.setup/{auth-binding-BLWz7stm.mjs → auth-binding-BoMwpuPN.mjs} +17 -25
- package/dist/.setup/{auth-cache-key-Dnps4W4_.mjs → auth-cache-key-CEd9QlIs.mjs} +244 -82
- package/dist/.setup/{auth-profile-B0okYl2D.mjs → auth-profile-CgHQ8Vot.mjs} +2 -1
- package/dist/.setup/{auth-profile-selection-DFu9e167.mjs → auth-profile-selection-hr8ocLtz.mjs} +5 -7
- package/dist/.setup/{binding-connection-DTtN1KrX.mjs → binding-connection-C-08ez1w.mjs} +2 -2
- package/dist/.setup/{binding-connection.runtime-6TpgD1M6.mjs → binding-connection.runtime-Dn2p-fdy.mjs} +3 -3
- package/dist/.setup/{bounded-turn-BNunZPtz.mjs → bounded-turn-DlHlNTyS.mjs} +14 -13
- package/dist/.setup/{bounded-turn-isolation-B8K_ylqk.mjs → bounded-turn-isolation-DklXNk3k.mjs} +4 -4
- package/dist/.setup/{build-state-DIQ5O_-S.mjs → build-state-CIi3Ckqu.mjs} +1 -1
- package/dist/.setup/{capabilities-B3WEZl4e.mjs → capabilities-kQntafj_.mjs} +1 -1
- package/dist/.setup/{client-qyUBJlGZ.mjs → client-CBzEVDyb.mjs} +438 -160
- package/dist/.setup/{client-catalog-response-DRvx_wCC.mjs → client-catalog-response-CmvIiDdj.mjs} +57 -25
- package/dist/.setup/command-authorization-AikPDtcc.mjs +15 -0
- package/dist/.setup/{command-dispatch-Btrs1D6f.mjs → command-dispatch-BE_RdMou.mjs} +3 -3
- package/dist/.setup/{command-formatters-R3ckE3Co.mjs → command-formatters-DV3DHhdr.mjs} +7 -5
- package/dist/.setup/{command-handlers-DvlCHJch.mjs → command-handlers-DNoRq5Ps.mjs} +82 -144
- package/dist/.setup/{command-rpc-skzRq4wD.mjs → command-rpc-B6xsq2dB.mjs} +23 -31
- package/dist/.setup/{compact-8ttks5U5.mjs → compact-BLSAd-ru.mjs} +117 -65
- package/dist/.setup/{plugin-metadata-cache-BRwtRct9.mjs → computer-use-DpolvQHw.mjs} +65 -202
- package/dist/.setup/{config-DKhXquav.mjs → config-0Gxk3_eq.mjs} +5 -6
- package/dist/.setup/{config-options-CzyWLTJt.mjs → config-options-HG_Rr3W_.mjs} +13 -23
- package/dist/.setup/{config-parsing-b088LyhT.mjs → config-parsing-BQq-CHTF.mjs} +41 -4
- package/dist/.setup/{config-runtime-C0NbLms1.mjs → config-runtime-cUYrqu_a.mjs} +2 -2
- package/dist/.setup/{config-security-CE-FcGw9.mjs → config-security-KAPScztc.mjs} +20 -36
- package/dist/.setup/{context-engine-projection-PezSESth.mjs → context-engine-projection-CsgYSQhW.mjs} +11 -14
- package/dist/.setup/{conversation-binding-74LaGGH-.mjs → conversation-binding-CgSSD1Qz.mjs} +36 -48
- package/dist/.setup/{conversation-binding-data-C746z5Pn.mjs → conversation-binding-data-DJ4ix-W5.mjs} +1 -1
- package/dist/.setup/{conversation-control-OrN6zuaY.mjs → conversation-control-tCg763cI.mjs} +19 -21
- package/dist/.setup/{cyber-failover-XV0nNRZu.mjs → cyber-failover-Bb1J6hS1.mjs} +1 -1
- package/dist/.setup/{cyber-failover-notice-RNpGpTyP.mjs → cyber-failover-notice-XR03ef31.mjs} +1 -1
- package/dist/.setup/doctor-start-options-DPW9JxIE.mjs +63 -0
- package/dist/.setup/dynamic-tool-build-CVrx02cH.mjs +463 -0
- package/dist/.setup/{dynamic-tools-Db2sY5cZ.mjs → dynamic-tools-DdsymYGQ.mjs} +238 -878
- package/dist/.setup/{effective-mcp-catalog-Bi6-SQ7i.mjs → effective-mcp-catalog-BysTBZCW.mjs} +83 -11
- package/dist/.setup/{elicitation-input-DPoK8F7w.mjs → elicitation-input-r9axtppm.mjs} +4 -2
- package/dist/.setup/{ephemeral-turn-DiCS1ijR.mjs → ephemeral-turn-oPKxs3ia.mjs} +2 -2
- package/dist/.setup/{event-projector-assistant-message-MV_1dj-3.mjs → event-projector-assistant-message-YCL2wspu.mjs} +2 -2
- package/dist/.setup/{event-projector-values-DJSz8BTk.mjs → event-projector-values-DTqZHizf.mjs} +2 -12
- package/dist/.setup/{inference-dispatch-CMZtjQyz.mjs → inference-dispatch-B5UKEUyC.mjs} +12 -21
- package/dist/.setup/{inference-proxy-DhcXOgUE.mjs → inference-proxy-DUO5E2QQ.mjs} +6 -5
- package/dist/.setup/{isolated-completion-D80IXfQF.mjs → isolated-completion-D5gbKm6k.mjs} +8 -8
- package/dist/.setup/{managed-binary-kiWRhNRE.mjs → managed-binary-C1VFoVPf.mjs} +31 -38
- package/dist/.setup/mcp-app-session-preparation-CdqsXwZX.mjs +223 -0
- package/dist/.setup/mcp-tool-metadata-j10HhfTC.mjs +43 -0
- package/dist/.setup/{model-catalog-DiC0Tkha.mjs → model-catalog-Dj_uvusa.mjs} +7 -7
- package/dist/.setup/{models-DfLmPV0k.mjs → models-Du_i5G_t.mjs} +10 -7
- package/dist/.setup/{native-auth-CuG53tu4.mjs → native-auth-Cjb9y7IZ.mjs} +5 -6
- package/dist/.setup/{native-execution-policy-BxZJy5mP.mjs → native-execution-policy-ClzpdG3D.mjs} +1 -12
- package/dist/.setup/native-mcp-app-DV7VbfzF.mjs +310 -0
- package/dist/.setup/{native-subagent-monitor-BwkQXf9e.mjs → native-subagent-monitor-CCEFO6qK.mjs} +235 -318
- package/dist/.setup/{native-subagent-pending-assignments-DwkCzLvD.mjs → native-subagent-pending-assignments-BDqhOdJp.mjs} +0 -4
- package/dist/.setup/{native-task-assignments-DMQ0g3hu.mjs → native-task-assignments-C6KVqiN1.mjs} +9 -8
- package/dist/.setup/{node-cli-sessions-HC4W6FLI.mjs → node-cli-sessions-B5oNDkUS.mjs} +11 -17
- package/dist/.setup/{node-exec-server.runtime-BgBfWQqo.mjs → node-exec-server.runtime-0xSEjKYt.mjs} +2 -2
- package/dist/.setup/{plan-DPdMk1Oy.mjs → plan-CUHSIOep.mjs} +67 -89
- package/dist/.setup/{plugin-activation-cNHRfaxU.mjs → plugin-activation-BcyBv8PG.mjs} +4 -4
- package/dist/.setup/{plugin-app-cache-key-BL9B5H0L.mjs → plugin-app-cache-key-BW8rd98k.mjs} +11 -15
- package/dist/.setup/plugin-approval-roundtrip-uAR-oQfr.mjs +109 -0
- package/dist/.setup/{plugin-inventory-Cky2XJUw.mjs → plugin-inventory-Bf0_piTw.mjs} +29 -51
- package/dist/.setup/{plugin-marketplace-discovery-D_dV9FXa.mjs → plugin-marketplace-discovery-SQPhSuic.mjs} +2 -16
- package/dist/.setup/plugin-metadata-cache-DWnB7VMj.mjs +84 -0
- package/dist/.setup/plugin-thread-config-deadline-CdRzGJt4.mjs +124 -0
- package/dist/.setup/{provider-D6F_7p1I.mjs → provider-BP8ZaZqn.mjs} +4 -4
- package/dist/.setup/provider-capabilities-Z5ZbBxqP.mjs +50 -0
- package/dist/.setup/{rate-limits-B7-X2TgG.mjs → rate-limits-CMPy24F5.mjs} +1 -5
- package/dist/.setup/{request-BZOfsSXW.mjs → request-BH3FvYUE.mjs} +189 -49
- package/dist/.setup/rpc-error-hmWM21RB.mjs +57 -0
- package/dist/.setup/{run-attempt-dYJhjZrp.mjs → run-attempt-CgvFoW7R.mjs} +553 -727
- package/dist/.setup/{run-attempt-lifecycle-C-6O3Exn.mjs → run-attempt-lifecycle-BuZgVbDA.mjs} +19 -3
- package/dist/.setup/{runtime-artifact-DDQ-HGXf.mjs → runtime-artifact-CUTOOnKw.mjs} +5 -6
- package/dist/.setup/{runtime-artifact-connection-D68qQn1m.mjs → runtime-artifact-connection-CADz3_BY.mjs} +5 -4
- package/dist/.setup/{sandbox-guard-DjCz2eOw.mjs → sandbox-guard-WqE8yPge.mjs} +3 -3
- package/dist/.setup/service-tier-normalization-Cei89SW6.mjs +15 -0
- package/dist/.setup/{session-binding-DGCYAfvD.mjs → session-binding-Ce7BqiPN.mjs} +92 -102
- package/dist/.setup/session-binding-meta-Lkm5Lpf4.mjs +15 -0
- package/dist/.setup/session-binding-record-BZB8RgcF.mjs +179 -0
- package/dist/.setup/session-binding-record-codec-z4ZpDn6E.mjs +216 -0
- package/dist/.setup/{session-binding-sidecars-jo6H8dFr.mjs → session-binding-sidecars-BrdV95Fg.mjs} +8 -2
- package/dist/.setup/{session-catalog-adoption-BU_pHWG7.mjs → session-catalog-adoption-CPIP4S_y.mjs} +34 -18
- package/dist/.setup/{session-catalog-archive-spHfihri.mjs → session-catalog-archive-DcgwvSbF.mjs} +24 -29
- package/dist/.setup/{session-catalog-events-BMCFMZw-.mjs → session-catalog-events-KIXOoSnQ.mjs} +5 -5
- package/dist/.setup/{session-catalog-index-DwJjnF5k.mjs → session-catalog-index-DPICGlxr.mjs} +361 -72
- package/dist/.setup/{session-catalog-index-order-BcQpHks3.mjs → session-catalog-index-order-nhyO0wdW.mjs} +1 -1
- package/dist/.setup/{session-catalog-limits-DDxOsQeC.mjs → session-catalog-limits-DEU36Qlo.mjs} +1 -1
- package/dist/.setup/{session-catalog-index-state-TeO7EyO-.mjs → session-catalog-list-request-tXephOB4.mjs} +180 -6
- package/dist/.setup/{session-catalog-native-projection-CuaFZuQE.mjs → session-catalog-native-projection-CTBd4EUm.mjs} +7 -6
- package/dist/.setup/{session-catalog-node-adoption-DgXvSGu0.mjs → session-catalog-node-adoption-7-WEQTB1.mjs} +12 -2
- package/dist/.setup/{session-catalog-node-continue-DjKXHBbi.mjs → session-catalog-node-continue-DLWBwAAO.mjs} +11 -15
- package/dist/.setup/{session-catalog-node-lookup-CtAXI5W5.mjs → session-catalog-node-lookup-Uufckwcm.mjs} +2 -2
- package/dist/.setup/{session-catalog-parsing-CPGaPYr-.mjs → session-catalog-parsing-B-qWJh2x.mjs} +70 -28
- package/dist/.setup/{session-catalog-projection-CGfzfP93.mjs → session-catalog-projection-CE0_Hffi.mjs} +6 -122
- package/dist/.setup/{session-catalog-provenance-DoAvktcj.mjs → session-catalog-provenance-CmsOE5mh.mjs} +6 -1
- package/dist/.setup/{session-cli-DlmBHYIe.mjs → session-cli-kH4vuGod.mjs} +1 -2
- package/dist/.setup/{session-history-D83lJWHG.mjs → session-history-BogBHKLk.mjs} +1 -1
- package/dist/.setup/{session-history-import-WhX-X33a.mjs → session-history-import-NWKPa4ZO.mjs} +4 -4
- package/dist/.setup/{session-history-read-Ov3StuL4.mjs → session-history-read-CNN8zwbD.mjs} +8 -19
- package/dist/.setup/{session-history.worker-MnPKncqP.mjs → session-history.worker-Cq_4DYgN.mjs} +3 -3
- package/dist/.setup/{session-initialization-6aveB9qb.mjs → session-initialization-D6dtFQkE.mjs} +2 -2
- package/dist/.setup/{session-permission-policy-Ci_fVX6y.mjs → session-permission-policy-BxIUJ0Zd.mjs} +8 -37
- package/dist/.setup/{session-retirement-LlYWBKTJ.mjs → session-retirement-aC60o6P3.mjs} +14 -15
- package/dist/.setup/{settled-turn-context-D4yj4rxf.mjs → settled-turn-context-BZsMjkIO.mjs} +13 -6
- package/dist/.setup/{settled-turn-finalizer-DW9W3gza.mjs → settled-turn-finalizer-CDxCejjC.mjs} +8 -8
- package/dist/.setup/{shared-client-CJCTeFpQ.mjs → shared-client-DJJ3ljH2.mjs} +291 -272
- package/dist/.setup/{provider-capabilities-DG5qbsUZ.mjs → shell-dynamic-tools-Do9lIAT1.mjs} +16 -55
- package/dist/.setup/{side-question-BLeGj7TQ.mjs → side-question-B7T0_GEC.mjs} +99 -91
- package/dist/.setup/{source-CJis_1EF.mjs → source-DH70LqN0.mjs} +24 -40
- package/dist/.setup/{thread-lifecycle-_bAbjedG.mjs → thread-lifecycle-DkcoX9q-.mjs} +262 -305
- package/dist/.setup/{thread-ownership-B6pPt21M.mjs → thread-ownership-0aRHD9iK.mjs} +10 -8
- package/dist/.setup/{thread-policy-gNPzzpVp.mjs → thread-policy-CXZV97TS.mjs} +22 -21
- package/dist/.setup/{thread-requests-OWGOiDaV.mjs → thread-requests-COrRJcZb.mjs} +107 -98
- package/dist/.setup/{thread-resume-GOry0AYh.mjs → thread-resume-rx7J68Rx.mjs} +10 -18
- package/dist/.setup/{transcript-history-projection-DRSifI-1.mjs → transcript-history-projection-B9a7HwUV.mjs} +11 -16
- package/dist/.setup/{transcript-mirror-kxmCYsuF.mjs → transcript-mirror-BfLRARNL.mjs} +64 -67
- package/dist/.setup/{transport-stdio-Bdegpn2V.mjs → transport-stdio-a0HDa2Mj.mjs} +27 -8
- package/dist/.setup/{transport-websocket-BTBE-LD9.mjs → transport-websocket-zqJ0Cmtn.mjs} +3 -8
- package/dist/.setup/{attempt-client-cleanup-B-S7ngS_.mjs → turn-router-CX1-EoCp.mjs} +75 -170
- package/dist/.setup/{upstream-session-fork-gkdRj2yH.mjs → upstream-session-fork-LYlaQnbt.mjs} +35 -46
- package/dist/.setup/{usage-CApUvLOV.mjs → usage-Dmx7B0W2.mjs} +4 -4
- package/dist/.setup/{usage-limit-error-wSMQkbpV.mjs → usage-limit-error-M8jVnITZ.mjs} +4 -4
- package/dist/.setup/{web-search-provider.runtime-UKgeiBUG.mjs → web-search-provider.runtime-CsVmqbFm.mjs} +4 -20
- package/dist/.setup/websocket-data-XlRvt8Ys.mjs +6 -0
- package/dist/.setup/workspace-write-sandbox-probe-DmUHLrrl.mjs +118 -0
- package/dist/api.js +34 -54
- package/dist/catalog-page.worker.js +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/doctor-contract-api.js +15 -27
- package/dist/harness.js +37 -22
- package/dist/index.js +2880 -276
- package/dist/media-understanding-provider.js +2 -2
- package/dist/migration-provider-api.js +1 -1
- package/dist/native-session-binding-api.js +2 -0
- package/dist/provider-discovery.js +1 -1
- package/dist/session-history-worker-runtime.js +33 -4
- package/dist/session-history.worker.js +1 -1
- package/openclaw.plugin.json +3 -3
- package/package.json +6 -6
- package/dist/.setup/config-utils-D0CXecki.mjs +0 -57
- package/dist/.setup/incognito-session-DWYapfwf.mjs +0 -2
- package/dist/.setup/managed-thread-store-BMqgThVL.mjs +0 -100
- package/dist/.setup/rpc-error-BlD2vuzn.mjs +0 -31
- package/dist/.setup/session-binding-meta-B7aEMU7g.mjs +0 -6
- package/dist/.setup/session-binding-record-Oe9L-CNY.mjs +0 -375
- package/dist/.setup/session-catalog-BFafIiF6.mjs +0 -2599
- package/dist/.setup/session-catalog-list-request-CvtxrYSe.mjs +0 -170
- package/dist/.setup/shared-client-lifecycle-7xgtlo15.mjs +0 -153
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { S as retainSharedCodexAppServerClientByInstanceId } from "./auth-cache-key-CEd9QlIs.mjs";
|
|
2
2
|
import { t as withCodexAppServerThreadMutation } from "./thread-ownership-queue-Dp24d7-F.mjs";
|
|
3
|
-
import { G as releaseCodexAppServerLiveThread, K as retainCodexAppServerLiveThread, V as isCodexAppServerLiveThreadClaimed } from "./shared-client-
|
|
4
|
-
import {
|
|
5
|
-
import { t as __exportAll } from "./session-binding-sidecars-
|
|
3
|
+
import { G as releaseCodexAppServerLiveThread, K as retainCodexAppServerLiveThread, V as isCodexAppServerLiveThreadClaimed } from "./shared-client-DJJ3ljH2.mjs";
|
|
4
|
+
import { f as unsubscribeCodexThreadBestEffort, o as closeCodexStartupClientBestEffort, r as CodexAppServerUnsafeSubscriptionError } from "./attempt-client-cleanup-yLjGwbwT.mjs";
|
|
5
|
+
import { t as __exportAll } from "./session-binding-sidecars-BrdV95Fg.mjs";
|
|
6
6
|
import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
|
|
7
7
|
import { runWithAsyncWorkResources } from "openclaw/plugin-sdk/agent-harness-tool-runtime";
|
|
8
8
|
//#region extensions/codex/src/app-server/thread-ownership.ts
|
|
@@ -55,11 +55,12 @@ async function withExclusiveCodexAppServerThread(params) {
|
|
|
55
55
|
}
|
|
56
56
|
/** Publishes one owned subscription with its persistent or ephemeral retention lifetime. */
|
|
57
57
|
async function retainCodexAppServerBindingSubscription(client, threadId, ownership) {
|
|
58
|
-
return await retainCodexAppServerLiveThread(client, threadId, ownership?.release ?? (async (releasedThreadId, assertCurrent) => {
|
|
58
|
+
return await retainCodexAppServerLiveThread(client, threadId, ownership?.release ?? (async (releasedThreadId, assertCurrent, withCurrent) => {
|
|
59
59
|
if (!await unsubscribeCodexThreadBestEffort(client, {
|
|
60
60
|
threadId: releasedThreadId,
|
|
61
61
|
timeoutMs: 5e3,
|
|
62
|
-
assertCurrent
|
|
62
|
+
assertCurrent,
|
|
63
|
+
withCurrent
|
|
63
64
|
})) {
|
|
64
65
|
assertCurrent?.();
|
|
65
66
|
await closeCodexStartupClientBestEffort(client);
|
|
@@ -82,14 +83,15 @@ async function releaseCodexAppServerBindingSubscription(binding, options = {}) {
|
|
|
82
83
|
const clientLease = await retainSharedCodexAppServerClientByInstanceId(binding.clientId);
|
|
83
84
|
if (!clientLease) return;
|
|
84
85
|
try {
|
|
85
|
-
if (await releaseCodexAppServerLiveThread(clientLease.client, binding.threadId, options.assertCurrent)) return;
|
|
86
|
+
if (await releaseCodexAppServerLiveThread(clientLease.client, binding.threadId, options.assertCurrent, options.withCurrent)) return;
|
|
86
87
|
options.assertCurrent?.();
|
|
87
88
|
if (isCodexAppServerLiveThreadClaimed(clientLease.client, binding.threadId)) throw new Error(`Codex thread ${binding.threadId} has an active run; stop it before changing its owner.`);
|
|
88
89
|
if (!options.allowUntracked) return;
|
|
89
90
|
if (!await unsubscribeCodexThreadBestEffort(clientLease.client, {
|
|
90
91
|
threadId: binding.threadId,
|
|
91
92
|
timeoutMs: 5e3,
|
|
92
|
-
assertCurrent: options.assertCurrent
|
|
93
|
+
assertCurrent: options.assertCurrent,
|
|
94
|
+
withCurrent: options.withCurrent
|
|
93
95
|
})) {
|
|
94
96
|
await closeCodexStartupClientBestEffort(clientLease.client);
|
|
95
97
|
throw new CodexAppServerUnsafeSubscriptionError(`Codex retired thread subscription could not be released: ${binding.threadId}`);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { i as CodexAppServerScopedRequestRejectedError, o as isCodexAppServerOverloadError } from "./rpc-error-hmWM21RB.mjs";
|
|
2
|
+
import { n as requestCodexAppServerClientJson } from "./request-BH3FvYUE.mjs";
|
|
3
|
+
import { S as CodexAdoptedThreadActiveError } from "./shared-client-DJJ3ljH2.mjs";
|
|
4
|
+
import { p as assertCodexThreadAcceptsDirectInput, s as isCodexAppServerPrewriteRequestCancellationError } from "./client-CBzEVDyb.mjs";
|
|
4
5
|
import { AgentHarnessPreflightError, embeddedAgentLog, formatErrorMessage } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
5
6
|
//#region extensions/codex/src/app-server/thread-policy.ts
|
|
6
7
|
/** A refusal, not a failed native write: the ephemeral conversation must stay alive. */
|
|
@@ -23,39 +24,37 @@ async function refreshCodexThreadPolicy(params) {
|
|
|
23
24
|
await injectCodexThreadDeveloperHandoff(params, "The following is the complete current OpenClaw-supplied generic instruction policy. It replaces earlier OpenClaw-supplied generic policy, including sections removed from that generic policy. Parent-local instructions supplied for the current inference request are outside this policy replacement. Independently supplied native managed, guardian, security, collaboration, and project instructions retain their authority. User requests retain their own authority.\n\n" + (params.developerInstructions === "" ? "The current OpenClaw generic policy is empty; earlier OpenClaw generic policy is withdrawn." : params.developerInstructions));
|
|
24
25
|
}
|
|
25
26
|
/**
|
|
26
|
-
* Refreshes
|
|
27
|
+
* Refreshes skills, persona, and memory instructions on a live thread whose generic policy cannot
|
|
27
28
|
* change (ephemeral threads have no resume source). The refresh is a client-authored
|
|
28
29
|
* developer message, so it must be re-delivered after every compaction.
|
|
29
30
|
*/
|
|
30
|
-
async function
|
|
31
|
-
await injectCodexThreadDeveloperHandoff(params, "The following is the complete current OpenClaw
|
|
31
|
+
async function refreshCodexThreadInstructions(params) {
|
|
32
|
+
await injectCodexThreadDeveloperHandoff(params, "The following is the complete current OpenClaw refreshable thread instructions. It replaces earlier OpenClaw-supplied skills, persona, and memory instructions in this conversation.\n\n" + (params.refreshableInstructions ?? "The current OpenClaw refreshable thread instructions are empty; earlier OpenClaw-supplied skills, persona, and memory instructions are withdrawn."));
|
|
32
33
|
}
|
|
33
34
|
/**
|
|
34
35
|
* Compaction rebuilds initial context from the thread's creation-time developer
|
|
35
|
-
* instructions and
|
|
36
|
-
* `retain_client_developer_messages`
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* value as delivered and skips reinjection on later turns. Re-deliver the current
|
|
40
|
-
* catalog after every compaction, including compaction inside an active turn.
|
|
36
|
+
* instructions and can drop client-authored developer messages (including local
|
|
37
|
+
* compaction regardless of `retain_client_developer_messages`). Restore the current
|
|
38
|
+
* section for subsequent requests. The immediate native continuation can still
|
|
39
|
+
* precede this handoff and see creation-time instructions.
|
|
41
40
|
*/
|
|
42
|
-
async function
|
|
41
|
+
async function restoreCodexThreadInstructionsAfterCompaction(params) {
|
|
43
42
|
const policy = params.ephemeralPolicy;
|
|
44
|
-
if (!policy || policy.
|
|
43
|
+
if (!policy || policy.refreshableInstructions === policy.nativeRefreshableInstructions) return policy;
|
|
45
44
|
try {
|
|
46
|
-
await
|
|
45
|
+
await refreshCodexThreadInstructions({
|
|
47
46
|
...params,
|
|
48
|
-
|
|
47
|
+
refreshableInstructions: policy.refreshableInstructions
|
|
49
48
|
});
|
|
50
49
|
return policy;
|
|
51
50
|
} catch (error) {
|
|
52
|
-
embeddedAgentLog.warn("failed to restore Codex
|
|
51
|
+
embeddedAgentLog.warn("failed to restore Codex thread instructions after compaction", {
|
|
53
52
|
threadId: params.threadId,
|
|
54
53
|
error: formatErrorMessage(error)
|
|
55
54
|
});
|
|
56
55
|
return {
|
|
57
56
|
...policy,
|
|
58
|
-
|
|
57
|
+
refreshableInstructions: policy.nativeRefreshableInstructions
|
|
59
58
|
};
|
|
60
59
|
}
|
|
61
60
|
}
|
|
@@ -78,7 +77,8 @@ async function injectCodexThreadDeveloperHandoff(params, text) {
|
|
|
78
77
|
}
|
|
79
78
|
});
|
|
80
79
|
outcome = "acknowledged";
|
|
81
|
-
params.assertCurrent?.();
|
|
80
|
+
if (params.withCurrent) await params.withCurrent(() => params.assertCurrent?.());
|
|
81
|
+
else params.assertCurrent?.();
|
|
82
82
|
params.signal?.throwIfAborted();
|
|
83
83
|
} catch (cause) {
|
|
84
84
|
if (outcome !== "acknowledged" && (cause instanceof CodexAppServerScopedRequestRejectedError || isCodexAppServerPrewriteRequestCancellationError(cause) || isCodexAppServerOverloadError(cause))) outcome = "not-written";
|
|
@@ -97,7 +97,8 @@ async function assertAdoptedCodexThreadResumeAllowed(params, threadId, context,
|
|
|
97
97
|
includeTurns: false
|
|
98
98
|
}, {
|
|
99
99
|
signal: params.signal,
|
|
100
|
-
assertCurrent
|
|
100
|
+
assertCurrent,
|
|
101
|
+
withCurrent: params.authority?.withCurrent
|
|
101
102
|
}));
|
|
102
103
|
context.throwIfAborted();
|
|
103
104
|
if (thread.id !== threadId) throw new Error("Codex returned another thread during adoption status read");
|
|
@@ -106,4 +107,4 @@ async function assertAdoptedCodexThreadResumeAllowed(params, threadId, context,
|
|
|
106
107
|
return thread;
|
|
107
108
|
}
|
|
108
109
|
//#endregion
|
|
109
|
-
export {
|
|
110
|
+
export { refreshCodexThreadInstructions as a, assertCodexSupervisionThreadLineage as i, CodexThreadPolicyHandoffError as n, refreshCodexThreadPolicy as o, assertAdoptedCodexThreadResumeAllowed as r, restoreCodexThreadInstructionsAfterCompaction as s, CodexIncognitoPolicyChangeError as t };
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import { l as toCodexPluginOwnedAccountApp, s as readCodexPluginInventory } from "./plugin-inventory-Cky2XJUw.mjs";
|
|
2
1
|
import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
|
|
3
|
-
import { u as
|
|
4
|
-
import { f as resolveCodexPluginsPolicy } from "./config-parsing-
|
|
2
|
+
import { u as fingerprintCodexPolicy } from "./config-security-KAPScztc.mjs";
|
|
3
|
+
import { f as resolveCodexPluginsPolicy } from "./config-parsing-BQq-CHTF.mjs";
|
|
5
4
|
import { n as resolveCodexAppServerLocalHomeDir } from "./auth-start-options-BPIPeEX8.mjs";
|
|
6
|
-
import { d as readCodexEffectiveConfig, u as CODEX_SESSION_OVERRIDABLE_LAYER_TYPES } from "./config-options-
|
|
7
|
-
import { t as
|
|
8
|
-
import {
|
|
9
|
-
import "./config-
|
|
10
|
-
import { t as isCodexAppServerNativeAuthProfile } from "./auth-profile-
|
|
11
|
-
import { D as nativeHookRelayUnregisterQueue, W as readCodexClientSessionMeta } from "./shared-client-
|
|
5
|
+
import { d as readCodexEffectiveConfig, u as CODEX_SESSION_OVERRIDABLE_LAYER_TYPES } from "./config-options-HG_Rr3W_.mjs";
|
|
6
|
+
import { a as defaultCodexAppInventoryCache, i as CodexAppInventoryCache, o as serializeCodexAppInventoryError, s as codexAppIdentityKey, t as buildCodexAppServerConnectionFingerprint } from "./plugin-app-cache-key-BW8rd98k.mjs";
|
|
7
|
+
import { c as toCodexPluginOwnedAccountApp, o as readCodexPluginInventory } from "./plugin-inventory-Bf0_piTw.mjs";
|
|
8
|
+
import "./config-0Gxk3_eq.mjs";
|
|
9
|
+
import { t as isCodexAppServerNativeAuthProfile } from "./auth-profile-CgHQ8Vot.mjs";
|
|
10
|
+
import { D as nativeHookRelayUnregisterQueue, W as readCodexClientSessionMeta } from "./shared-client-DJJ3ljH2.mjs";
|
|
12
11
|
import { a as isCodexResponsesOAuthRun, i as isCodexResponsesOAuthCredential, t as CODEX_RESPONSES_OAUTH_PROVIDER } from "./responses-oauth-twnuTaAa.mjs";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { t as ensureCodexPluginActivation } from "./plugin-activation-
|
|
16
|
-
import {
|
|
17
|
-
import { t as codexNativeSubagentMonitorRuntime } from "./native-subagent-monitor-
|
|
12
|
+
import { P as resolveCodexToolAbortTerminalReason } from "./client-CBzEVDyb.mjs";
|
|
13
|
+
import { f as unsubscribeCodexThreadBestEffort, n as CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS } from "./attempt-client-cleanup-yLjGwbwT.mjs";
|
|
14
|
+
import { t as ensureCodexPluginActivation } from "./plugin-activation-BcyBv8PG.mjs";
|
|
15
|
+
import { a as hashCodexAppServerBindingFingerprint } from "./session-binding-Ce7BqiPN.mjs";
|
|
16
|
+
import { t as codexNativeSubagentMonitorRuntime } from "./native-subagent-monitor-CCEFO6qK.mjs";
|
|
18
17
|
import { normalizeOptionalString, normalizeUniqueStringEntries, normalizeUniqueTrimmedStringList } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
19
18
|
import * as crypto$1 from "node:crypto";
|
|
20
19
|
import crypto, { createHash } from "node:crypto";
|
|
@@ -24,8 +23,10 @@ import os from "node:os";
|
|
|
24
23
|
import fs from "node:fs/promises";
|
|
25
24
|
import { toErrorObject } from "openclaw/plugin-sdk/error-runtime";
|
|
26
25
|
import { isPathInside } from "openclaw/plugin-sdk/file-access-runtime";
|
|
27
|
-
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
28
26
|
import { resolveRequiredHomeDir, resolveStateDir } from "openclaw/plugin-sdk/state-paths";
|
|
27
|
+
import { isIncognitoSessionKey } from "openclaw/plugin-sdk/session-key-runtime";
|
|
28
|
+
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
29
|
+
import { escapeRegExp } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
29
30
|
import { emitTrustedDiagnosticEvent } from "openclaw/plugin-sdk/diagnostic-runtime";
|
|
30
31
|
import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
|
|
31
32
|
import { SKILL_WORKSHOP_TOOL_NAME, buildCredentialSafetyPrompt, buildDelegationGuidanceSection, buildSkillWorkshopPromptSection, buildUiPresentationPrompt, embeddedAgentLog, isHostScopedAgentToolActive, resolveMainSessionDelegationMode } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
@@ -130,19 +131,17 @@ async function readCodexThreadAdmissibleAccountApps(params, appCache) {
|
|
|
130
131
|
};
|
|
131
132
|
const installedAppsById = new Map(snapshot.installedApps.map((app) => [app.id, app]));
|
|
132
133
|
return {
|
|
133
|
-
apps: snapshot.apps.filter((app) =>
|
|
134
|
+
apps: snapshot.apps.filter((app) => isCodexInstalledAppThreadAdmissible(installedAppsById.get(app.id))).toSorted((left, right) => left.id.localeCompare(right.id)),
|
|
134
135
|
installedApps: snapshot.installedApps
|
|
135
136
|
};
|
|
136
137
|
}
|
|
137
|
-
function
|
|
138
|
+
function isCodexPluginAppThreadAdmissible(app, inventory) {
|
|
138
139
|
const snapshot = inventory.appInventory?.snapshot;
|
|
139
|
-
if (!snapshot) return
|
|
140
|
-
return
|
|
140
|
+
if (!app.accessible || app.needsAuth || !snapshot) return false;
|
|
141
|
+
return isCodexInstalledAppThreadAdmissible(snapshot.installedApps.find((candidate) => candidate.id === app.id));
|
|
141
142
|
}
|
|
142
|
-
function
|
|
143
|
-
|
|
144
|
-
if (installed.enabled && installed.callable) return "ready";
|
|
145
|
-
return !installed.enabled && !installed.callable ? "provisional" : "blocked";
|
|
143
|
+
function isCodexInstalledAppThreadAdmissible(installed) {
|
|
144
|
+
return Boolean(installed && (installed.enabled && installed.callable || !installed.enabled && !installed.callable));
|
|
146
145
|
}
|
|
147
146
|
async function readCodexConfigForAppAdmission(params) {
|
|
148
147
|
try {
|
|
@@ -192,7 +191,7 @@ function shouldBuildCodexPluginThreadConfig(pluginConfig) {
|
|
|
192
191
|
/** Fingerprints policy and app-cache identity before runtime inventory is read. */
|
|
193
192
|
function buildCodexPluginThreadConfigInputFingerprint(params) {
|
|
194
193
|
const policy = resolveCodexPluginsPolicy(params.pluginConfig);
|
|
195
|
-
return
|
|
194
|
+
return fingerprintCodexPolicy({
|
|
196
195
|
version: CODEX_PLUGIN_THREAD_CONFIG_INPUT_FINGERPRINT_VERSION,
|
|
197
196
|
policy: policyFingerprint(policy),
|
|
198
197
|
appCacheKey: params.appCacheKey ?? null
|
|
@@ -334,7 +333,7 @@ async function buildCodexPluginThreadConfig(params) {
|
|
|
334
333
|
if (record.appOwnership !== "proven") continue;
|
|
335
334
|
pluginAppIds[record.policy.configKey] = [...record.ownedAppIds].toSorted();
|
|
336
335
|
for (const app of inventory.appInventory?.state === "missing" ? [] : record.apps) {
|
|
337
|
-
const admissionConfig =
|
|
336
|
+
const admissionConfig = isCodexPluginAppThreadAdmissible(app, inventory) ? await getAdmissionConfig() : void 0;
|
|
338
337
|
if (!admissionConfig || resolveCodexExplicitAppEnablement(admissionConfig.layers, app.id) === false) {
|
|
339
338
|
diagnostics.push({
|
|
340
339
|
code: "app_not_ready",
|
|
@@ -378,7 +377,7 @@ async function buildCodexPluginThreadConfig(params) {
|
|
|
378
377
|
enabled: true,
|
|
379
378
|
configPatch,
|
|
380
379
|
...provisionalAppIds.size > 0 ? { provisionalAppIds: Array.from(provisionalAppIds).toSorted() } : {},
|
|
381
|
-
fingerprint:
|
|
380
|
+
fingerprint: fingerprintCodexPolicy({
|
|
382
381
|
version: CODEX_PLUGIN_THREAD_CONFIG_FINGERPRINT_VERSION,
|
|
383
382
|
inputFingerprint,
|
|
384
383
|
configPatch,
|
|
@@ -408,7 +407,7 @@ function emptyPluginThreadConfig(params) {
|
|
|
408
407
|
const policyContext = buildPluginAppPolicyContext({}, {});
|
|
409
408
|
return {
|
|
410
409
|
enabled: params.enabled,
|
|
411
|
-
fingerprint:
|
|
410
|
+
fingerprint: fingerprintCodexPolicy({
|
|
412
411
|
version: CODEX_PLUGIN_THREAD_CONFIG_FINGERPRINT_VERSION,
|
|
413
412
|
inputFingerprint: params.inputFingerprint,
|
|
414
413
|
configPatch: params.configPatch ?? null,
|
|
@@ -496,7 +495,7 @@ async function refreshCodexPluginAppApprovalPolicy(params) {
|
|
|
496
495
|
}
|
|
497
496
|
function buildPluginAppPolicyContext(apps, pluginAppIds) {
|
|
498
497
|
return {
|
|
499
|
-
fingerprint:
|
|
498
|
+
fingerprint: fingerprintCodexPolicy({
|
|
500
499
|
version: 2,
|
|
501
500
|
apps,
|
|
502
501
|
pluginAppIds
|
|
@@ -546,9 +545,6 @@ function mergeJsonObjects(left, right) {
|
|
|
546
545
|
}
|
|
547
546
|
return merged;
|
|
548
547
|
}
|
|
549
|
-
function fingerprintJson(value) {
|
|
550
|
-
return crypto.createHash("sha256").update(stringifyCodexPolicy(value)).digest("hex");
|
|
551
|
-
}
|
|
552
548
|
//#endregion
|
|
553
549
|
//#region extensions/codex/src/app-server/dynamic-tool-profile.ts
|
|
554
550
|
/** Tool names owned by Codex app-server and normally excluded from OpenClaw dynamic tools. */
|
|
@@ -740,12 +736,8 @@ function stabilizeJsonValue(value) {
|
|
|
740
736
|
if (!isJsonObject(value)) return value;
|
|
741
737
|
return Object.fromEntries(Object.entries(value).toSorted(([left], [right]) => left.localeCompare(right)).map(([key, child]) => [key, stabilizeJsonValue(child)]));
|
|
742
738
|
}
|
|
743
|
-
function readActiveCodexTurnIds(thread) {
|
|
744
|
-
return (thread.turns ?? []).filter((turn) => turn.status === "inProgress").map((turn) => typeof turn.id === "string" ? turn.id : "").filter((turnId) => turnId.trim().length > 0);
|
|
745
|
-
}
|
|
746
739
|
function readActiveCodexTurnIdsFromResume(response) {
|
|
747
|
-
|
|
748
|
-
return readActiveCodexTurnIds(Array.isArray(pagedTurns) ? { turns: pagedTurns } : response.thread);
|
|
740
|
+
return (response.initialTurnsPage?.data ?? response.thread.turns ?? []).filter((turn) => turn.status === "inProgress" && turn.id.trim().length > 0).map((turn) => turn.id);
|
|
749
741
|
}
|
|
750
742
|
const LEGACY_EMPTY_DYNAMIC_TOOLS_FINGERPRINT = codexLegacyDynamicToolsFingerprint([]);
|
|
751
743
|
const EMPTY_DYNAMIC_TOOLS_FINGERPRINT = hashCodexAppServerBindingFingerprint(LEGACY_EMPTY_DYNAMIC_TOOLS_FINGERPRINT);
|
|
@@ -943,8 +935,11 @@ async function resolveUncachedCodexNativeSkillIsolation(params) {
|
|
|
943
935
|
}, { signal: params.signal });
|
|
944
936
|
const homes = [params.home?.trim() || process.env.HOME?.trim() || process.env.USERPROFILE?.trim() || os.homedir()];
|
|
945
937
|
if (process.platform === "win32") homes.push(params.userProfile?.trim() || os.homedir());
|
|
946
|
-
const
|
|
947
|
-
|
|
938
|
+
const { complete, skillPaths } = await collectPersonalSkillRealPaths([...new Set(homes.map((home) => path.resolve(home)))], params.codexHome);
|
|
939
|
+
if (!complete) {
|
|
940
|
+
for (const entry of response.data) for (const skill of entry.skills) if (skill.scope === "user") skillPaths.add(skill.path);
|
|
941
|
+
}
|
|
942
|
+
return { disabledUserSkillPaths: [...skillPaths].toSorted((left, right) => left.localeCompare(right)) };
|
|
948
943
|
}
|
|
949
944
|
/** Applies path-exact session rules after caller config so isolated user skills stay disabled. */
|
|
950
945
|
function applyCodexNativeSkillIsolation(config, isolation) {
|
|
@@ -1019,8 +1014,11 @@ async function loadCodexNativeToolCatalog(params) {
|
|
|
1019
1014
|
const actualHome = client.getRuntimeIdentity()?.codexHome;
|
|
1020
1015
|
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.");
|
|
1021
1016
|
const metadata = await readCodexClientSessionMeta(client, path.join(home, "sessions"), binding.rolloutPath, binding.threadId);
|
|
1022
|
-
|
|
1023
|
-
|
|
1017
|
+
const consume = () => {
|
|
1018
|
+
assertCurrent();
|
|
1019
|
+
return parseCodexNativeToolCatalog(metadata, binding.threadId, binding.dynamicToolsFingerprint);
|
|
1020
|
+
};
|
|
1021
|
+
return params.authority ? await params.authority.withCurrent(consume) : consume();
|
|
1024
1022
|
}
|
|
1025
1023
|
//#endregion
|
|
1026
1024
|
//#region extensions/codex/src/app-server/thread-mcp-attestation.ts
|
|
@@ -1065,14 +1063,22 @@ async function attestCodexRestrictedToolSurfaceMcpServersDisabled(client, thread
|
|
|
1065
1063
|
*/
|
|
1066
1064
|
/** Every admission path checks the same surface; its lifecycle owner keeps the claim fenced. */
|
|
1067
1065
|
async function attestCodexThreadToolSurface(params) {
|
|
1068
|
-
params.
|
|
1066
|
+
if (params.appIds.length === 0 && !params.restrictedToolSurface) {
|
|
1067
|
+
params.signal?.throwIfAborted();
|
|
1068
|
+
params.assertCurrent();
|
|
1069
|
+
return;
|
|
1070
|
+
}
|
|
1071
|
+
if (params.withCurrent) await params.withCurrent(params.assertCurrent);
|
|
1072
|
+
else params.assertCurrent();
|
|
1069
1073
|
if (params.appIds.length > 0) {
|
|
1070
1074
|
await params.lifecycleTiming.measure("plugin-app-attestation", () => checkCodexThreadAppAvailability(params));
|
|
1071
|
-
params.assertCurrent
|
|
1075
|
+
if (params.withCurrent) await params.withCurrent(params.assertCurrent);
|
|
1076
|
+
else params.assertCurrent();
|
|
1072
1077
|
}
|
|
1073
1078
|
if (params.restrictedToolSurface) {
|
|
1074
1079
|
await params.lifecycleTiming.measure("restricted-tool-surface-mcp-attestation", () => attestCodexRestrictedToolSurfaceMcpServersDisabled(params.client, params.threadId, params.threadConfig, params.signal, params.appIds.length > 0 ? ["codex_apps"] : []));
|
|
1075
|
-
params.assertCurrent
|
|
1080
|
+
if (params.withCurrent) await params.withCurrent(params.assertCurrent);
|
|
1081
|
+
else params.assertCurrent();
|
|
1076
1082
|
}
|
|
1077
1083
|
}
|
|
1078
1084
|
var CodexPluginThreadAppAttestationError = class extends Error {
|
|
@@ -1090,7 +1096,10 @@ async function checkCodexThreadAppAvailability(params) {
|
|
|
1090
1096
|
response = await params.client.request("app/installed", {
|
|
1091
1097
|
threadId: params.threadId,
|
|
1092
1098
|
forceRefresh: false
|
|
1093
|
-
}, {
|
|
1099
|
+
}, {
|
|
1100
|
+
signal: params.signal,
|
|
1101
|
+
withCurrent: params.withCurrent
|
|
1102
|
+
});
|
|
1094
1103
|
} catch (error) {
|
|
1095
1104
|
params.signal?.throwIfAborted();
|
|
1096
1105
|
throw new CodexPluginThreadAppAttestationError(`Codex could not confirm admitted apps for thread ${params.threadId}`, { cause: error });
|
|
@@ -1147,6 +1156,7 @@ const CODEX_NATIVE_HOOK_RELAY_DEFAULT_TIMEOUT_SEC = 10;
|
|
|
1147
1156
|
const CODEX_NATIVE_HOOK_RELAY_UNREGISTER_GRACE_MS = 1e4;
|
|
1148
1157
|
const CODEX_NATIVE_HOOK_RELAY_UNREGISTER_EXTRA_GRACE_MS = 5e3;
|
|
1149
1158
|
const MAX_PENDING_DIRECT_CHILD_ADMISSIONS = 32;
|
|
1159
|
+
const CODEX_NATIVE_SPAWN_HOOK_NAMES = ["spawn_agent", "Agent"];
|
|
1150
1160
|
const CODEX_HOOK_MATCHER_NAMES_BY_TOOL_ID = {
|
|
1151
1161
|
exec: [
|
|
1152
1162
|
"Bash",
|
|
@@ -1158,7 +1168,7 @@ const CODEX_HOOK_MATCHER_NAMES_BY_TOOL_ID = {
|
|
|
1158
1168
|
"Write",
|
|
1159
1169
|
"Edit"
|
|
1160
1170
|
],
|
|
1161
|
-
spawn_agent:
|
|
1171
|
+
spawn_agent: CODEX_NATIVE_SPAWN_HOOK_NAMES
|
|
1162
1172
|
};
|
|
1163
1173
|
var CodexManagedHooksOnlyError = class extends Error {
|
|
1164
1174
|
constructor() {
|
|
@@ -1182,22 +1192,7 @@ async function assertCodexNativeHookRelayAllowed(client, signal, timeoutMs) {
|
|
|
1182
1192
|
}
|
|
1183
1193
|
/** Defers relay unregister so late native hook subprocesses can still resolve. */
|
|
1184
1194
|
function scheduleCodexNativeHookRelayUnregister(params) {
|
|
1185
|
-
|
|
1186
|
-
const unregister = () => {
|
|
1187
|
-
if (!pending) return;
|
|
1188
|
-
const current = pending;
|
|
1189
|
-
pending = void 0;
|
|
1190
|
-
if (!nativeHookRelayUnregisterQueue.delete(current)) return;
|
|
1191
|
-
params.relay.unregister();
|
|
1192
|
-
nativeHookRelayUnregisterQueue.track(params.relay.drain());
|
|
1193
|
-
};
|
|
1194
|
-
const timeout = setTimeout(unregister, resolveCodexNativeHookRelayUnregisterGraceMs(params.hookTimeoutSec));
|
|
1195
|
-
pending = {
|
|
1196
|
-
timeout,
|
|
1197
|
-
unregister
|
|
1198
|
-
};
|
|
1199
|
-
nativeHookRelayUnregisterQueue.add(pending);
|
|
1200
|
-
timeout.unref();
|
|
1195
|
+
nativeHookRelayUnregisterQueue.schedule(params.relay, resolveCodexNativeHookRelayUnregisterGraceMs(params.hookTimeoutSec));
|
|
1201
1196
|
}
|
|
1202
1197
|
function resolveCodexNativeHookRelayUnregisterGraceMs(hookTimeoutSec) {
|
|
1203
1198
|
const hookTimeoutMs = finiteSecondsToTimerSafeMilliseconds(normalizeHookTimeoutSec(hookTimeoutSec)) ?? 0;
|
|
@@ -1266,8 +1261,20 @@ function createCodexNativeHookRelay(params) {
|
|
|
1266
1261
|
toolNames: [...params.nativeProcessAuthority ? ["exec"] : [], ...params.nativeModelAdmission ? modelInputTools : []],
|
|
1267
1262
|
admit: async (invocation, assertAdmissionCurrent, preparation) => {
|
|
1268
1263
|
const payload = invocation.rawPayload;
|
|
1269
|
-
|
|
1264
|
+
const toolName = CODEX_NATIVE_SPAWN_HOOK_NAMES.includes(invocation.toolName ?? "") ? "spawn_agent" : invocation.toolName;
|
|
1265
|
+
if (params.nativeModelAdmission && toolName && modelInputTools.includes(toolName)) {
|
|
1270
1266
|
const admission = params.nativeModelAdmission;
|
|
1267
|
+
if (toolName.endsWith("spawn_agent")) {
|
|
1268
|
+
const assertSpawnAllowed = () => {
|
|
1269
|
+
assertAdmissionCurrent();
|
|
1270
|
+
if (!readCodexNativeChildThreadId(payload)) try {
|
|
1271
|
+
params.hostCapabilities.assertNativeSubagentSpawnAllowed?.();
|
|
1272
|
+
} catch (error) {
|
|
1273
|
+
return `${toErrorObject(error, "Native spawn participant selection failed").message} Use sessions_spawn with the requester's requester_profile.id as user.`;
|
|
1274
|
+
}
|
|
1275
|
+
};
|
|
1276
|
+
return assertSpawnAllowed;
|
|
1277
|
+
}
|
|
1271
1278
|
const input = isJsonObject(payload) ? payload.tool_input : void 0;
|
|
1272
1279
|
const targetThreadId = isJsonObject(input) && typeof input.target === "string" ? input.target.trim() : void 0;
|
|
1273
1280
|
const threadId = readCodexNativeChildThreadId(payload) ?? admission.threadId();
|
|
@@ -1419,17 +1426,23 @@ function buildCodexNativeHookRelayId(params) {
|
|
|
1419
1426
|
hash.update(params.sessionKey?.trim() || params.sessionId);
|
|
1420
1427
|
return `codex-${hash.digest("hex").slice(0, 40)}`;
|
|
1421
1428
|
}
|
|
1422
|
-
const
|
|
1423
|
-
pre_tool_use:
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
permission_request:
|
|
1432
|
-
|
|
1429
|
+
const CODEX_HOOK_EVENTS = {
|
|
1430
|
+
pre_tool_use: {
|
|
1431
|
+
name: "PreToolUse",
|
|
1432
|
+
keyLabel: "pre_tool_use"
|
|
1433
|
+
},
|
|
1434
|
+
post_tool_use: {
|
|
1435
|
+
name: "PostToolUse",
|
|
1436
|
+
keyLabel: "post_tool_use"
|
|
1437
|
+
},
|
|
1438
|
+
permission_request: {
|
|
1439
|
+
name: "PermissionRequest",
|
|
1440
|
+
keyLabel: "permission_request"
|
|
1441
|
+
},
|
|
1442
|
+
before_agent_finalize: {
|
|
1443
|
+
name: "Stop",
|
|
1444
|
+
keyLabel: "stop"
|
|
1445
|
+
}
|
|
1433
1446
|
};
|
|
1434
1447
|
const CODEX_SESSION_FLAGS_HOOK_SOURCE_PATHS = ["/<session-flags>/config.toml", "<session-flags>/config.toml"];
|
|
1435
1448
|
function buildCodexNativeHookRelayConfig(params) {
|
|
@@ -1438,12 +1451,12 @@ function buildCodexNativeHookRelayConfig(params) {
|
|
|
1438
1451
|
const config = { "features.hooks": true };
|
|
1439
1452
|
const hookState = {};
|
|
1440
1453
|
for (const event of CODEX_NATIVE_HOOK_RELAY_EVENTS) {
|
|
1441
|
-
const
|
|
1454
|
+
const { name, keyLabel } = CODEX_HOOK_EVENTS[event];
|
|
1442
1455
|
const selected = selectedEvents.has(event);
|
|
1443
1456
|
const shouldRelay = params.relay.shouldRelayEvent(event);
|
|
1444
1457
|
if (!selected || !shouldRelay) {
|
|
1445
|
-
if (selected || params.clearOmittedEvents) config[`hooks.${
|
|
1446
|
-
if (params.clearOmittedEvents) for (const sourcePath of CODEX_SESSION_FLAGS_HOOK_SOURCE_PATHS) hookState[`${sourcePath}:${
|
|
1458
|
+
if (selected || params.clearOmittedEvents) config[`hooks.${name}`] = [];
|
|
1459
|
+
if (params.clearOmittedEvents) for (const sourcePath of CODEX_SESSION_FLAGS_HOOK_SOURCE_PATHS) hookState[`${sourcePath}:${keyLabel}:0:0`] = { enabled: false };
|
|
1447
1460
|
continue;
|
|
1448
1461
|
}
|
|
1449
1462
|
const timeout = normalizeHookTimeoutSec(params.hookTimeoutSec);
|
|
@@ -1459,15 +1472,15 @@ function buildCodexNativeHookRelayConfig(params) {
|
|
|
1459
1472
|
statusMessage: "OpenClaw native hook relay"
|
|
1460
1473
|
}]
|
|
1461
1474
|
};
|
|
1462
|
-
config[`hooks.${
|
|
1475
|
+
config[`hooks.${name}`] = [group];
|
|
1463
1476
|
const state = {
|
|
1464
1477
|
enabled: true,
|
|
1465
|
-
trusted_hash: `sha256:${
|
|
1466
|
-
event_name:
|
|
1478
|
+
trusted_hash: `sha256:${fingerprintCodexPolicy({
|
|
1479
|
+
event_name: keyLabel,
|
|
1467
1480
|
...group
|
|
1468
|
-
})
|
|
1481
|
+
})}`
|
|
1469
1482
|
};
|
|
1470
|
-
for (const sourcePath of CODEX_SESSION_FLAGS_HOOK_SOURCE_PATHS) hookState[`${sourcePath}:${
|
|
1483
|
+
for (const sourcePath of CODEX_SESSION_FLAGS_HOOK_SOURCE_PATHS) hookState[`${sourcePath}:${keyLabel}:0:0`] = state;
|
|
1471
1484
|
}
|
|
1472
1485
|
config["hooks.state"] = hookState;
|
|
1473
1486
|
return config;
|
|
@@ -1503,7 +1516,7 @@ function buildCodexNativeToolMatcher(toolNames) {
|
|
|
1503
1516
|
}
|
|
1504
1517
|
const sortedNames = Array.from(nativeNames).toSorted();
|
|
1505
1518
|
if (!hasCustomToolName && sortedNames.every((toolName) => /^[A-Za-z0-9_]+$/.test(toolName))) return sortedNames.join("|");
|
|
1506
|
-
return `(?i)^(?:${sortedNames.map(
|
|
1519
|
+
return `(?i)^(?:${sortedNames.map(escapeRegExp).join("|")})$`;
|
|
1507
1520
|
}
|
|
1508
1521
|
//#endregion
|
|
1509
1522
|
//#region extensions/codex/src/app-server/project-doc-thread-config.ts
|
|
@@ -1723,12 +1736,6 @@ const CODEX_NATIVE_WEB_SEARCH_DISABLED_CONFIG = {
|
|
|
1723
1736
|
"features.standalone_web_search": false,
|
|
1724
1737
|
web_search: "disabled"
|
|
1725
1738
|
};
|
|
1726
|
-
function hasManagedSearchProvider(config) {
|
|
1727
|
-
return normalizeOptionalString(config?.tools?.web?.search?.provider) !== void 0;
|
|
1728
|
-
}
|
|
1729
|
-
function hasNativeDomainRestrictions(config) {
|
|
1730
|
-
return normalizeUniqueTrimmedStringList(config?.tools?.web?.search?.openaiCodex?.allowedDomains).length > 0;
|
|
1731
|
-
}
|
|
1732
1739
|
function buildCodexNativeWebSearchThreadConfig(config) {
|
|
1733
1740
|
const nativeConfig = config?.tools?.web?.search?.openaiCodex;
|
|
1734
1741
|
const threadConfig = {
|
|
@@ -1756,10 +1763,10 @@ function resolveCodexWebSearchPlan(params) {
|
|
|
1756
1763
|
threadConfig: CODEX_NATIVE_WEB_SEARCH_DISABLED_CONFIG
|
|
1757
1764
|
};
|
|
1758
1765
|
const nativeConfig = params.config?.tools?.web?.search?.openaiCodex;
|
|
1759
|
-
const managedSearchExplicit =
|
|
1766
|
+
const managedSearchExplicit = normalizeOptionalString(params.config?.tools?.web?.search?.provider) !== void 0 || nativeConfig?.enabled === false;
|
|
1760
1767
|
const nativeProviderSupportsSearch = params.nativeProviderWebSearchSupport === void 0 || params.nativeProviderWebSearchSupport === "supported";
|
|
1761
|
-
if (!(params.nativeToolSurfaceEnabled !== false && nativeProviderSupportsSearch &&
|
|
1762
|
-
if (!managedSearchExplicit &&
|
|
1768
|
+
if (!(params.nativeToolSurfaceEnabled !== false && nativeProviderSupportsSearch && !managedSearchExplicit)) {
|
|
1769
|
+
if (!managedSearchExplicit && normalizeUniqueTrimmedStringList(nativeConfig?.allowedDomains).length > 0) return {
|
|
1763
1770
|
kind: "disabled",
|
|
1764
1771
|
suppressManagedWebSearch: true,
|
|
1765
1772
|
threadConfig: CODEX_NATIVE_WEB_SEARCH_DISABLED_CONFIG
|
|
@@ -1873,7 +1880,7 @@ function buildCodexThreadConfiguration(params, options) {
|
|
|
1873
1880
|
...options,
|
|
1874
1881
|
directOnlyToolNamespaces: resolveDirectOnlyToolNamespaces(options.dynamicTools)
|
|
1875
1882
|
}),
|
|
1876
|
-
developerInstructions: joinPresentSections(options.developerInstructions ?? buildDeveloperInstructions(params, { dynamicTools: options.dynamicTools }), options.
|
|
1883
|
+
developerInstructions: joinPresentSections(options.developerInstructions ?? buildDeveloperInstructions(params, { dynamicTools: options.dynamicTools }), options.refreshableInstructions)
|
|
1877
1884
|
};
|
|
1878
1885
|
}
|
|
1879
1886
|
function buildThreadStartParams(params, options) {
|
|
@@ -1895,7 +1902,7 @@ function buildThreadStartParams(params, options) {
|
|
|
1895
1902
|
personality: CODEX_NATIVE_PERSONALITY_NONE,
|
|
1896
1903
|
serviceName: "OpenClaw",
|
|
1897
1904
|
threadSource: "openclaw",
|
|
1898
|
-
...resolveCodexThreadEnvironmentSelection(options),
|
|
1905
|
+
...resolveCodexThreadEnvironmentSelection(params.requireWorkspaceOnly === true ? { nativeCodeModeEnabled: false } : options),
|
|
1899
1906
|
dynamicTools: [...options.dynamicTools],
|
|
1900
1907
|
experimentalRawEvents: true,
|
|
1901
1908
|
...isIncognitoSessionKey(params.sessionKey) ? { ephemeral: true } : {}
|
|
@@ -1958,10 +1965,13 @@ function ensureDirectOnlyToolNamespaces(config, requiredNamespaces) {
|
|
|
1958
1965
|
function resolveDirectOnlyToolNamespaces(dynamicTools) {
|
|
1959
1966
|
return (dynamicTools ?? []).filter((tool) => tool.type === "namespace" && tool.name === "openclaw_direct").map((tool) => tool.name);
|
|
1960
1967
|
}
|
|
1968
|
+
function isCodexNativeDelegationDisabledForRun(params, hostSystemAgentActive = isHostScopedAgentToolActive("openclaw")) {
|
|
1969
|
+
return isCodexResponsesOAuthRun(params) || params.delegationCapability === "report_only" || params.requireWorkspaceOnly === true || params.pluginHarnessToolPolicyRestricted === true || isMessageOnlyCodexSourceReply(params) || hostSystemAgentActive && isSystemAgentOnlyCodexDynamicToolAllowlist(params.toolsAllow);
|
|
1970
|
+
}
|
|
1961
1971
|
function buildCodexRuntimeThreadConfigForRun(params, config, options = {}) {
|
|
1962
1972
|
const ringZeroActive = (options.hostSystemAgentActive ?? isHostScopedAgentToolActive("openclaw")) && isSystemAgentOnlyCodexDynamicToolAllowlist(params.toolsAllow);
|
|
1963
1973
|
const messageOnlySourceReply = isMessageOnlyCodexSourceReply(params);
|
|
1964
|
-
const restrictedToolSurface = ringZeroActive || messageOnlySourceReply || params.pluginHarnessToolPolicyRestricted === true;
|
|
1974
|
+
const restrictedToolSurface = ringZeroActive || messageOnlySourceReply || params.pluginHarnessToolPolicyRestricted === true || params.requireWorkspaceOnly === true;
|
|
1965
1975
|
const restrictedTurnDisablesProjectDocs = ringZeroActive || messageOnlySourceReply || params.pluginHarnessToolPolicyRestricted && params.disableTools;
|
|
1966
1976
|
const configMcpServers = config?.mcp_servers;
|
|
1967
1977
|
if (restrictedToolSurface && configMcpServers !== void 0 && !isJsonObject(configMcpServers)) throw new Error("Codex restricted tool surface received invalid thread mcp_servers config");
|
|
@@ -1975,8 +1985,7 @@ function buildCodexRuntimeThreadConfigForRun(params, config, options = {}) {
|
|
|
1975
1985
|
}).threadConfig;
|
|
1976
1986
|
const baseConfig = buildCodexRuntimeThreadConfig(mergeCodexThreadConfigs(config, webSearchConfig), options);
|
|
1977
1987
|
return applyCodexManagedShellEnvironment({
|
|
1978
|
-
...mergeCodexThreadConfigs(baseConfig, options.appServer?.networkProxy?.configPatch, isCodexResponsesOAuthRun(params) ? {
|
|
1979
|
-
...CODEX_DELEGATION_DISABLED_THREAD_CONFIG,
|
|
1988
|
+
...mergeCodexThreadConfigs(baseConfig, options.appServer?.networkProxy?.configPatch, isCodexNativeDelegationDisabledForRun(params, options.hostSystemAgentActive) ? CODEX_DELEGATION_DISABLED_THREAD_CONFIG : void 0, isCodexResponsesOAuthRun(params) ? {
|
|
1980
1989
|
"features.apps": false,
|
|
1981
1990
|
"features.plugins": false,
|
|
1982
1991
|
"features.image_generation": false,
|
|
@@ -1985,7 +1994,7 @@ function buildCodexRuntimeThreadConfigForRun(params, config, options = {}) {
|
|
|
1985
1994
|
"orchestrator.skills.enabled": false,
|
|
1986
1995
|
"orchestrator.mcp.enabled": false,
|
|
1987
1996
|
"skills.bundled.enabled": false
|
|
1988
|
-
} : void 0, params.pluginHarnessToolPolicySafeDeniedTools?.includes("image_generate") ? { "features.image_generation": false } : void 0, shouldDisableCodexToolSearchForModel(params.modelId) ? CODEX_TOOL_SEARCH_UNSUPPORTED_THREAD_CONFIG : void 0, params.
|
|
1997
|
+
} : void 0, params.pluginHarnessToolPolicySafeDeniedTools?.includes("image_generate") ? { "features.image_generation": false } : void 0, shouldDisableCodexToolSearchForModel(params.modelId) ? CODEX_TOOL_SEARCH_UNSUPPORTED_THREAD_CONFIG : void 0, messageOnlySourceReply || params.pluginHarnessToolPolicyRestricted === true || params.requireWorkspaceOnly === true ? buildRestrictedToolConfigPatch(restrictedToolSurfaceMcpServerNames, Boolean(params.scheduledRuntimeAuthority) && !isCodexResponsesOAuthRun(params) && params.requireWorkspaceOnly !== true) : buildCodexRingZeroThreadConfigPatch(params, options.hostSystemAgentActive, restrictedToolSurfaceMcpServerNames), restrictedTurnDisablesProjectDocs ? CODEX_NO_PROJECT_DOCS_CONFIG : void 0, params.authoredContextTokenCap === void 0 ? void 0 : { model_context_window: params.authoredContextTokenCap }) ?? baseConfig,
|
|
1989
1998
|
...params.bootstrapContextMode === "lightweight" ? CODEX_NO_PROJECT_DOCS_CONFIG : {}
|
|
1990
1999
|
}, options.shellEnvironment, options.disableLoginShell, options.shellPathPrepend);
|
|
1991
2000
|
}
|
|
@@ -2099,4 +2108,4 @@ function resolveCodexThreadEnvironmentSelection(options) {
|
|
|
2099
2108
|
return {};
|
|
2100
2109
|
}
|
|
2101
2110
|
//#endregion
|
|
2102
|
-
export {
|
|
2111
|
+
export { legacyFingerprintUserMcpServersConfigPatch as $, buildCodexNativeHookRelayId as A, hasCodexNativeToolCatalog as B, buildCodexProjectDocThreadConfig as C, mergeCodexThreadConfigs as Ct, assertCodexNativeHookRelayAllowed as D, CodexManagedHooksOnlyError as E, buildCodexAppApprovalOverrides as Et, scheduleCodexNativeHookRelayUnregister as F, areCodexDynamicToolFingerprintsCompatible as G, parseCodexNativeToolCatalog as H, attestCodexThreadToolSurface as I, codexLegacyDynamicToolsFingerprint as J, areUserMcpServersFingerprintsCompatible as K, checkCodexThreadAppAvailability as L, emitCodexNativePreToolUseFailureDiagnostic as M, resolveCodexNativeHookRelayEvents as N, buildCodexNativeHookRelayConfig as O, resolveCodexNativeHookRelayTtlMs as P, fingerprintUserMcpServersConfigPatch as Q, discardUnattestedCodexPluginThread as R, joinPresentSections as S, isCodexPluginThreadBindingStale as St, CODEX_NATIVE_HOOK_RELAY_TTL_GRACE_MS as T, shouldBuildCodexPluginThreadConfig as Tt, applyCodexNativeSkillIsolation as U, loadCodexNativeToolCatalog as V, resolveCodexNativeSkillIsolation as W, fingerprintEnvironmentSelection as X, fingerprintCodexThreadConfig as Y, fingerprintJsonObject as Z, CODEX_NATIVE_PERSONALITY_NONE as _, buildCodexPluginThreadConfigInputFingerprint as _t, buildCodexThreadConfiguration as a, shouldRotateCodexAppServerBindingForRuntime as at, resolveCodexAppServerThreadModelSelection as b, buildPluginAppPolicyContext as bt, codexThreadSandboxOrPermissions as c, filterCodexDynamicToolsForDisabledNativeSurface as ct, readCodexManagedRequirementsFingerprint as d, isSystemAgentOnlyCodexDynamicToolAllowlist as dt, readActiveCodexTurnIdsFromResume as et, resolveCodexThreadApprovalsReviewer as f, normalizeCodexDynamicToolName as ft, buildDeveloperInstructions as g, buildCodexPluginThreadConfig as gt, mergeCodexNativeShellEnvironment as h, buildCodexPluginAppsConfigPatchFromPolicyContext as ht, buildCodexRuntimeThreadConfigForRun as i, shouldRecheckRecoverablePluginBinding as it, createCodexNativeHookRelay as j, buildCodexNativeHookRelayDisabledConfig as k, isCodexNativeDelegationDisabledForRun as l, isForcedPrivateQaCodexRuntime as lt, resolveCodexWebSearchPlan as m, resolveCodexDynamicToolsLoadingForRuntime as mt, buildCodexRingZeroThreadConfigPatch as n, stabilizeJsonValue as nt, buildThreadResumeParams as o, shouldRotateCodexGpt56MultiAgentBinding as ot, buildCodexNativeWebSearchThreadConfig as p, resolveCodexDynamicToolsLoading as pt, codexDynamicToolsFingerprint as q, buildCodexRuntimeThreadConfig as r, isTransientWebSearchRestriction as rt, buildThreadStartParams as s, filterCodexDynamicTools as st, assertCodexManagedRequirementsDoNotOverrideToolPolicy as t, shouldStartTransientNoToolThread as tt, readCodexInheritedMcpServerNames as u, isMessageOnlyCodexSourceReply as ut, resolveCodexAppServerModelProvider as v, buildCodexPluginThreadConfigTimeoutFallback as vt, mergeCodexNativeProjectDocThreadConfig as w, refreshCodexPluginAppApprovalPolicy as wt, resolveCodexBindingModelProviderFallback as x, disableUnlistedCodexApps as xt, resolveCodexAppServerRequestModelSelection as y, buildDisabledAppsConfigPatch as yt, attestCodexRestrictedToolSurfaceMcpServersDisabled as z };
|