@openclaw/codex 2026.10.5-beta.4 → 2026.10.10-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -3
- package/dist/.setup/{account-usage-runtime-CoVpNIlD.mjs → account-usage-runtime-BVO-lpvn.mjs} +15 -9
- package/dist/.setup/{app-server-policy-D_zv8J7V.mjs → app-server-policy-Cog6mm2i.mjs} +1 -1
- package/dist/.setup/{apply-BXDMd05l.mjs → apply-tJl5mopa.mjs} +11 -11
- package/dist/.setup/{attempt-client-cleanup-zNuNTKVr.mjs → attempt-client-cleanup-DMJWXGxM.mjs} +14 -8
- package/dist/.setup/attempt-terminal-sZutF0WY.mjs +1 -0
- package/dist/.setup/{attempt-workspace-context-CcwP3DA3.mjs → attempt-workspace-context-GYPLawX6.mjs} +2 -2
- package/dist/.setup/{auth-binding-BaxlhaNx.mjs → auth-binding-830RLAJW.mjs} +2 -2
- package/dist/.setup/{auth-cache-key-f8ODJ_OX.mjs → auth-cache-key-BW1YeaIk.mjs} +92 -80
- package/dist/.setup/{auth-profile-CgHQ8Vot.mjs → auth-profile-auwzSwwy.mjs} +14 -8
- package/dist/.setup/{auth-profile-health-oHizqgye.mjs → auth-profile-health-BVPZU9I8.mjs} +15 -8
- package/dist/.setup/{auth-profile-selection-hr8ocLtz.mjs → auth-profile-selection-Bp5PDk3W.mjs} +24 -7
- package/dist/.setup/{binding-connection-B7HAAZSI.mjs → binding-connection-GTgUj9pi.mjs} +2 -2
- package/dist/.setup/{binding-connection.runtime-DAXn7iFl.mjs → binding-connection.runtime-RcWR3vQu.mjs} +4 -3
- package/dist/.setup/{bounded-turn-DfIJtRlv.mjs → bounded-turn-BQkmyyjB.mjs} +18 -22
- package/dist/.setup/{bounded-turn-isolation-BfDAo-qZ.mjs → bounded-turn-isolation-D8CDrAVX.mjs} +3 -3
- package/dist/.setup/{build-state-Ds14X10-.mjs → build-state-CjLCC0wm.mjs} +1 -1
- package/dist/.setup/{capabilities-DbOzOglY.mjs → capabilities-DAS-JX1z.mjs} +1 -1
- package/dist/.setup/{client-D93nbdB8.mjs → client--P8jwXvA.mjs} +47 -317
- package/dist/.setup/{client-catalog-response-CuVLp4I0.mjs → client-catalog-response-CsDxVVOZ.mjs} +2 -2
- package/dist/.setup/client-initialize-CjgZcX61.mjs +165 -0
- package/dist/.setup/{command-dispatch-DxdH5a9-.mjs → command-dispatch-DqaVBeR3.mjs} +3 -3
- package/dist/.setup/{command-formatters-xW9KpoSZ.mjs → command-formatters-B_7-QZ1c.mjs} +2 -2
- package/dist/.setup/{command-handlers-fiYvYYq0.mjs → command-handlers-i6mEjvfo.mjs} +539 -406
- package/dist/.setup/command-rpc-B65jEc0r.mjs +296 -0
- package/dist/.setup/compact-AO2H4RJe.mjs +823 -0
- package/dist/.setup/{computer-use-DL2v3Kxq.mjs → computer-use-YUnu0JVx.mjs} +21 -68
- package/dist/.setup/{config-C1YVVLEA.mjs → config-BfrAlTMT.mjs} +3 -3
- package/dist/.setup/{config-options-DDzeNQ8m.mjs → config-options-DMFZkd3X.mjs} +1 -1
- package/dist/.setup/{config-runtime-DWzK-k0n.mjs → config-runtime-BZRizyuG.mjs} +2 -2
- package/dist/.setup/{context-engine-projection-ps-yn_ci.mjs → context-engine-projection-PIeLSnR-.mjs} +16 -30
- package/dist/.setup/{conversation-binding-BieJZRRV.mjs → conversation-binding-CfnUR-IM.mjs} +228 -116
- package/dist/.setup/{conversation-binding-data-UgLuTSQT.mjs → conversation-binding-data-khgW0n-o.mjs} +4 -2
- package/dist/.setup/{conversation-control-GXM3unE4.mjs → conversation-control-B2EpVZEb.mjs} +53 -23
- package/dist/.setup/{cyber-failover-D4dgNfFf.mjs → cyber-failover-CqEZoQsj.mjs} +1 -1
- package/dist/.setup/{cyber-failover-notice-ljgGGL0s.mjs → cyber-failover-notice-poL3Advd.mjs} +1 -1
- package/dist/.setup/{doctor-start-options-JjTAl-q_.mjs → doctor-start-options-8uIBXIzR.mjs} +8 -5
- package/dist/.setup/{dynamic-tool-build-DcaPmBlE.mjs → dynamic-tool-build-DOub3CB5.mjs} +208 -218
- package/dist/.setup/{dynamic-tools-CnQFnNKH.mjs → dynamic-tools-Us5mvq_N.mjs} +344 -118
- package/dist/.setup/{effective-mcp-catalog-B5HKFZNK.mjs → effective-mcp-catalog-DfUUoeeM.mjs} +11 -9
- package/dist/.setup/{ephemeral-turn-De3qb8EQ.mjs → ephemeral-turn-B2z0RIeF.mjs} +5 -4
- package/dist/.setup/{event-projector-assistant-message-CLMKN4x-.mjs → event-projector-assistant-message-ChOAY7rW.mjs} +16 -11
- package/dist/.setup/{event-projector-usage-BpKfdoTm.mjs → event-projector-usage-CBY0Hkga.mjs} +2 -2
- package/dist/.setup/{event-projector-values-CLvG1Hil.mjs → event-projector-values-yf4us9Pf.mjs} +1 -1
- package/dist/.setup/experimental-features-uGnVDtp-.mjs +19 -0
- package/dist/.setup/inference-context-HRw3PDwn.mjs +209 -0
- package/dist/.setup/{inference-dispatch-CO6tTs4q.mjs → inference-dispatch-C2zVSnrr.mjs} +2 -2
- package/dist/.setup/{inference-metadata-DCvcG_N_.mjs → inference-metadata-CYFWLHVk.mjs} +3 -1
- package/dist/.setup/{inference-proxy-BDWV0djM.mjs → inference-proxy-CiLbHMLf.mjs} +8 -8
- package/dist/.setup/installed-probe-lVC1X5ve.mjs +185 -0
- package/dist/.setup/{isolated-completion-BPJdvk5F.mjs → isolated-completion-CybgD6uU.mjs} +7 -7
- package/dist/.setup/managed-binary-DbKvGXKl.mjs +395 -0
- package/dist/.setup/{mcp-app-session-preparation-Dz2GOwyE.mjs → mcp-app-session-preparation-zUgpDLWR.mjs} +18 -14
- package/dist/.setup/{model-catalog-ZNwltCKl.mjs → model-catalog-CWY3wo0B.mjs} +28 -17
- package/dist/.setup/{models-BHpbAuz8.mjs → models-CmOBxsKF.mjs} +3 -3
- package/dist/.setup/{native-auth-esN5MdIv.mjs → native-auth-DpZIaY8N.mjs} +7 -4
- package/dist/.setup/native-execution-policy-D09tLP-u.mjs +152 -0
- package/dist/.setup/{native-hook-relay-wq7jrNLk.mjs → native-hook-relay-CocOW9YS.mjs} +45 -10
- package/dist/.setup/{native-mcp-app-DX3nyTtc.mjs → native-mcp-app-DrQeLxXj.mjs} +5 -5
- package/dist/.setup/{native-skill-isolation-DSBeF-Yy.mjs → native-skill-isolation-DL4-PQa4.mjs} +7 -7
- package/dist/.setup/{native-subagent-monitor-DOLEIf9r.mjs → native-subagent-monitor-C3CIIaZG.mjs} +485 -239
- package/dist/.setup/{native-subagent-pending-assignments-DmVhedNs.mjs → native-subagent-pending-assignments-CTinVtjo.mjs} +1 -1
- package/dist/.setup/{native-task-assignments-DimsQ9Qa.mjs → native-task-assignments-YJopbaVO.mjs} +9 -5
- package/dist/.setup/{node-cli-sessions-CzKg2nGq.mjs → node-cli-sessions-BuJnBnEq.mjs} +7 -4
- package/dist/.setup/{node-exec-server.runtime-BWkULhBM.mjs → node-exec-server.runtime-CP7RC1Nd.mjs} +3 -3
- package/dist/.setup/{plan-41-YOBMq.mjs → plan-Bqj6VQvQ.mjs} +7 -20
- package/dist/.setup/{plugin-activation-D7WkJMvU.mjs → plugin-activation-CXPWe-hl.mjs} +4 -4
- package/dist/.setup/{plugin-app-cache-key-Bg9DbDI6.mjs → plugin-app-cache-key-DRb-niJc.mjs} +17 -55
- package/dist/.setup/{plugin-approval-roundtrip-CD88q3yx.mjs → plugin-approval-roundtrip-CGEiG7hG.mjs} +1 -1
- package/dist/.setup/{plugin-inventory-CYgdo14P.mjs → plugin-inventory-DE9wcaeH.mjs} +2 -2
- package/dist/.setup/{plugin-metadata-cache-Bi8TAPwX.mjs → plugin-metadata-cache-BqC-a6Fb.mjs} +2 -15
- package/dist/.setup/{project-doc-thread-config-BVcvnps8.mjs → project-doc-thread-config-B0UI3f1D.mjs} +6 -6
- package/dist/.setup/protocol-CaPAVwe9.mjs +12 -0
- package/dist/.setup/{provider-LWKll6dV.mjs → provider-C_1fMsyD.mjs} +4 -4
- package/dist/.setup/{provider-capabilities-Dn2WwH4P.mjs → provider-capabilities-C7pYYpvh.mjs} +1 -1
- package/dist/.setup/{rate-limits-CI8pTPqL.mjs → rate-limits-BpfURnuy.mjs} +1 -1
- package/dist/.setup/{request-Bo0kKABI.mjs → request-C6U8q2uz.mjs} +132 -136
- package/dist/.setup/{responses-oauth-twnuTaAa.mjs → responses-oauth-CCV7aVYF.mjs} +6 -6
- package/dist/.setup/{rpc-error-C98SHchT.mjs → rpc-error-DemqqaxE.mjs} +7 -3
- package/dist/.setup/{run-attempt-ClU8MxhZ.mjs → run-attempt-BhuXanLv.mjs} +595 -426
- package/dist/.setup/{run-attempt-lifecycle-KN4oh-7O.mjs → run-attempt-lifecycle-DN-ATDp9.mjs} +1 -1
- package/dist/.setup/{runtime-artifact-C13pR7tD.mjs → runtime-artifact-CmLWeyJB.mjs} +3 -3
- package/dist/.setup/{runtime-artifact-connection-jS5DeCok.mjs → runtime-artifact-connection-DpWlZ02e.mjs} +3 -3
- package/dist/.setup/{sandbox-guard-DIImwCy1.mjs → sandbox-guard-DneAfNye.mjs} +70 -30
- package/dist/.setup/{session-binding-JEHNMPsr.mjs → session-binding-BgsWcbdY.mjs} +25 -23
- package/dist/.setup/{session-binding-record-DU_0biMD.mjs → session-binding-record-C_THntMe.mjs} +27 -12
- package/dist/.setup/{session-binding-record-codec-BpH8u_G9.mjs → session-binding-record-codec-DvmOI7g_.mjs} +1 -0
- package/dist/.setup/{session-binding-sidecars-DD-enC8w.mjs → session-binding-sidecars-BNSS6WL4.mjs} +55 -63
- package/dist/.setup/session-cancellation-DCN1FcBZ.mjs +43 -0
- package/dist/.setup/{session-catalog-adoption-Ca3OYGYM.mjs → session-catalog-adoption-ppsLlVLB.mjs} +24 -38
- package/dist/.setup/{session-catalog-archive-Bv6gV7x9.mjs → session-catalog-archive-CqLRHJ6z.mjs} +11 -13
- package/dist/.setup/{session-catalog-events-kR2Ot6nX.mjs → session-catalog-events-CEi6SuLQ.mjs} +5 -5
- package/dist/.setup/{session-catalog-index-order-CTfoefow.mjs → session-catalog-index-order-0Zqng2u8.mjs} +1 -1
- package/dist/.setup/{session-catalog-index-CrnfVEnT.mjs → session-catalog-index-qt4UWBua.mjs} +96 -271
- package/dist/.setup/{session-catalog-limits-BynIoOYm.mjs → session-catalog-limits-Dc6E0BZz.mjs} +1 -1
- package/dist/.setup/{session-catalog-list-request-D4MYNgDB.mjs → session-catalog-list-request-CAjoWjaH.mjs} +3 -4
- package/dist/.setup/{session-catalog-native-projection-CWqCU1I_.mjs → session-catalog-native-projection-BqBYi6kV.mjs} +5 -5
- package/dist/.setup/{session-catalog-node-adoption-BdP9Zjqo.mjs → session-catalog-node-adoption-e9v8mGgx.mjs} +5 -5
- package/dist/.setup/{session-catalog-node-continue-CNJibO4_.mjs → session-catalog-node-continue-H7nrzcUD.mjs} +5 -5
- package/dist/.setup/{session-catalog-node-lookup-BH_DBGa9.mjs → session-catalog-node-lookup-BrZfDkA8.mjs} +2 -2
- package/dist/.setup/{session-catalog-parsing-DkeoVn60.mjs → session-catalog-parsing-V6jyFg9g.mjs} +2 -2
- package/dist/.setup/{session-catalog-projection-BzHiV818.mjs → session-catalog-projection-CNyhjZze.mjs} +8 -7
- package/dist/.setup/{session-catalog-provenance-CmsOE5mh.mjs → session-catalog-provenance-Dg9s12z-.mjs} +50 -30
- package/dist/.setup/{session-catalog-source-DGuRdGvM.mjs → session-catalog-source-z_mNyQdX.mjs} +2 -6
- package/dist/.setup/{session-cli-GwU0izn-.mjs → session-cli-CBGKiqdv.mjs} +1 -1
- package/dist/.setup/{session-history-BO6i_pfk.mjs → session-history-7W0cgTXF.mjs} +11 -9
- package/dist/.setup/{session-history-import-CaO8s6ta.mjs → session-history-import-BwPKwcNi.mjs} +4 -4
- package/dist/.setup/{session-initialization-Bi_2DKhc.mjs → session-initialization-Dn3vveGv.mjs} +2 -2
- package/dist/.setup/{session-retirement-B3U5hpGJ.mjs → session-retirement-RZStisKb.mjs} +8 -8
- package/dist/.setup/{session-history.worker-DJQfek5p.mjs → settled-turn-evidence--tRW6fSm.mjs} +2 -18
- package/dist/.setup/{settled-turn-finalizer-CYCVpTv2.mjs → settled-turn-finalizer-gioXygEX.mjs} +8 -8
- package/dist/.setup/{shared-client-BCx1wbyA.mjs → shared-client-CkyTrNB8.mjs} +380 -557
- package/dist/.setup/side-question-DHPWKgO3.mjs +998 -0
- package/dist/.setup/{source-DipMO9hL.mjs → source-63MLSmLJ.mjs} +5 -5
- package/dist/.setup/{thread-archive-guard-LKdwQKyr.mjs → thread-archive-guard-BWjSsA92.mjs} +1 -1
- package/dist/.setup/{thread-lifecycle-run-C_aYiYqk.mjs → thread-lifecycle-run-zCXYFW8W.mjs} +172 -75
- package/dist/.setup/{thread-model-selection-DcVebr8N.mjs → thread-model-selection-DxposL4X.mjs} +9 -9
- package/dist/.setup/{thread-ownership-BoUd0i6L.mjs → thread-ownership-Bmk5a2Gu.mjs} +7 -7
- package/dist/.setup/{thread-policy-B3wBRNph.mjs → thread-policy-DYtvZ5Ay.mjs} +6 -6
- package/dist/.setup/{thread-requests-BgzJwJtS.mjs → thread-requests-BjawdIVV.mjs} +14 -14
- package/dist/.setup/{thread-resume-D-3bsr1j.mjs → thread-resume-vBShG3-o.mjs} +6 -6
- package/dist/.setup/{transcript-history-projection-DfKcoZCB.mjs → transcript-history-projection-i-FVpyha.mjs} +1 -1
- package/dist/.setup/{transcript-mirror-Bee2o6jj.mjs → transcript-mirror-CEQJZlF3.mjs} +6 -9
- package/dist/.setup/{transport-stdio-CRWTkKOn.mjs → transport-stdio-Bq160Dhv.mjs} +63 -64
- package/dist/.setup/{transport-websocket-DIyPfkHo.mjs → transport-websocket-0YqiI_MH.mjs} +1 -1
- package/dist/.setup/{turn-router-DBVMToGo.mjs → turn-router-BGj67FMK.mjs} +2 -2
- package/dist/.setup/{upstream-session-fork-p5fwKi7w.mjs → upstream-session-fork-CWKjpdtW.mjs} +46 -219
- package/dist/.setup/{usage-C2Kq7oej.mjs → usage-AhrLFxZP.mjs} +4 -4
- package/dist/.setup/{usage-limit-error-BQX8RHAd.mjs → usage-limit-error-BdNbGJC3.mjs} +4 -4
- package/dist/.setup/{web-search-item-CvokaZOo.mjs → web-search-item-DHVuNSqk.mjs} +1 -1
- package/dist/.setup/{web-search-provider.runtime-D89djc7e.mjs → web-search-provider.runtime-Yk6lnJBG.mjs} +3 -3
- package/dist/.setup/{workspace-write-sandbox-probe-BDWO2Qkh.mjs → workspace-write-sandbox-probe-DJxOXcF3.mjs} +2 -2
- package/dist/api.js +7 -28
- package/dist/catalog-page.worker.js +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/client-version-api.js +25 -0
- package/dist/doctor-contract-api.js +5 -5
- package/dist/harness.js +59 -36
- package/dist/index.js +259 -295
- package/dist/media-understanding-provider.js +2 -2
- package/dist/migration-provider-api.js +1 -2
- package/dist/native-session-binding-api.js +1 -2
- package/dist/provider-discovery.js +1 -1
- package/dist/session-history-worker-entrypoint.js +12 -0
- package/dist/session-history-worker-runtime.js +7 -18
- package/dist/session-history.worker.js +18 -2
- package/openclaw.plugin.json +1 -1
- package/package.json +6 -6
- package/dist/.setup/attempt-terminal-jO5IMj9K.mjs +0 -2
- package/dist/.setup/command-rpc-HIvsy3wS.mjs +0 -247
- package/dist/.setup/compact-ClZ7Ar7L.mjs +0 -808
- package/dist/.setup/inference-context-DNlGwzwy.mjs +0 -91
- package/dist/.setup/managed-binary-BtIjV7yN.mjs +0 -175
- package/dist/.setup/native-execution-policy-MXEe7PB3.mjs +0 -75
- package/dist/.setup/protocol-CANUwXJ3.mjs +0 -17
- package/dist/.setup/side-question-Bz2UQW0l.mjs +0 -826
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as codexSandboxPolicyForTurn } from "./config-options-
|
|
3
|
-
import { o as formatCodexDisplayText } from "./command-formatters-
|
|
4
|
-
import { o as readItem } from "./event-projector-values-
|
|
5
|
-
import { s as codexAppIdentityKey } from "./plugin-app-cache-key-
|
|
6
|
-
import "./config-
|
|
1
|
+
import { n as flattenCodexDynamicToolFunctions, r as isJsonObject, t as CODEX_OPENCLAW_DIRECT_DYNAMIC_TOOL_NAMESPACE } from "./protocol-CaPAVwe9.mjs";
|
|
2
|
+
import { n as codexSandboxPolicyForTurn } from "./config-options-DMFZkd3X.mjs";
|
|
3
|
+
import { o as formatCodexDisplayText } from "./command-formatters-B_7-QZ1c.mjs";
|
|
4
|
+
import { o as readItem } from "./event-projector-values-yf4us9Pf.mjs";
|
|
5
|
+
import { s as codexAppIdentityKey } from "./plugin-app-cache-key-DRb-niJc.mjs";
|
|
6
|
+
import "./config-BfrAlTMT.mjs";
|
|
7
7
|
import { r as invalidInlineImageText } from "./session-history-read-BI_2jRED.mjs";
|
|
8
|
-
import { o as neutralizeCodexExplicitMentionSigils } from "./context-engine-projection-
|
|
9
|
-
import {
|
|
10
|
-
import { A as
|
|
8
|
+
import { o as neutralizeCodexExplicitMentionSigils } from "./context-engine-projection-PIeLSnR-.mjs";
|
|
9
|
+
import { I as protectCodexAppServerLiveThread, p as retainSharedCodexAppServerClientIfCurrent } from "./shared-client-CkyTrNB8.mjs";
|
|
10
|
+
import { A as failedToolResult, C as createCodexElicitationResponse, O as resolveCodexToolAbortTerminalReason, b as readCodexTurnCompletedNotification, c as CodexServerRequestResolvedError, k as createFailedDynamicToolResponse } from "./client--P8jwXvA.mjs";
|
|
11
11
|
import { t as codexWebSocketDataToBuffer } from "./websocket-data-XlRvt8Ys.mjs";
|
|
12
|
-
import { S as shouldClearTerminalPresentationForNativeItem, _ as itemName, a as isCodexNotificationForTurn, c as readCodexNotificationTurnId, d as auditNativeToolUnfinishedStatus, l as auditNativeToolName, s as readCodexNotificationThreadId, u as auditNativeToolTerminalStatus, v as itemStatus } from "./turn-router-
|
|
12
|
+
import { S as shouldClearTerminalPresentationForNativeItem, _ as itemName, a as isCodexNotificationForTurn, c as readCodexNotificationTurnId, d as auditNativeToolUnfinishedStatus, l as auditNativeToolName, s as readCodexNotificationThreadId, u as auditNativeToolTerminalStatus, v as itemStatus } from "./turn-router-BGj67FMK.mjs";
|
|
13
13
|
import { n as resolveCodexAppServerReasoningEffort, t as readCodexSupportedReasoningEfforts } from "./reasoning-effort-CS9kKWB9.mjs";
|
|
14
|
-
import { V as joinPresentSections } from "./thread-requests-
|
|
15
|
-
import { r as resolveCodexAppServerRequestModelSelection, t as CODEX_NATIVE_PERSONALITY_NONE } from "./thread-model-selection-
|
|
16
|
-
import { a as requestPluginApprovalOutcome, c as truncateCodexApprovalDisplayText, i as requestPluginApproval, l as waitForPluginApprovalDecision, n as codexApprovalTimeoutText, o as sanitizeCodexApprovalVisibleText, r as mapExecDecisionToOutcome, s as stripDanglingCodexApprovalTerminalSequence, t as approvalRequestExplicitlyUnavailable } from "./plugin-approval-roundtrip-
|
|
17
|
-
import { d as isCodexPassThroughMediaSource, f as mapCodexAppServerLocalWorkspacePath, p as mapCodexAppServerRemoteWorkspacePath } from "./dynamic-tool-build-
|
|
18
|
-
import { c as emitCodexNativePreToolUseFailureDiagnostic } from "./native-hook-relay-
|
|
14
|
+
import { V as joinPresentSections } from "./thread-requests-BjawdIVV.mjs";
|
|
15
|
+
import { r as resolveCodexAppServerRequestModelSelection, t as CODEX_NATIVE_PERSONALITY_NONE } from "./thread-model-selection-DxposL4X.mjs";
|
|
16
|
+
import { a as requestPluginApprovalOutcome, c as truncateCodexApprovalDisplayText, i as requestPluginApproval, l as waitForPluginApprovalDecision, n as codexApprovalTimeoutText, o as sanitizeCodexApprovalVisibleText, r as mapExecDecisionToOutcome, s as stripDanglingCodexApprovalTerminalSequence, t as approvalRequestExplicitlyUnavailable } from "./plugin-approval-roundtrip-CGEiG7hG.mjs";
|
|
17
|
+
import { d as isCodexPassThroughMediaSource, f as mapCodexAppServerLocalWorkspacePath, p as mapCodexAppServerRemoteWorkspacePath } from "./dynamic-tool-build-DOub3CB5.mjs";
|
|
18
|
+
import { c as emitCodexNativePreToolUseFailureDiagnostic } from "./native-hook-relay-CocOW9YS.mjs";
|
|
19
19
|
import { createRequire } from "node:module";
|
|
20
20
|
import { asNonArrayRecord, asOptionalRecord, filterStringEntries, isRecord, normalizeOptionalString, normalizeTrimmedStringList, readNonBlankString, readStringField } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
21
21
|
import { createHash, randomUUID } from "node:crypto";
|
|
@@ -26,19 +26,19 @@ import { DEFAULT_MAX_LIVE_TOOL_RESULT_CHARS, estimateToolResultTextChars, resolv
|
|
|
26
26
|
import path, { posix } from "node:path";
|
|
27
27
|
import { coerceErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
28
28
|
import { createBoundedRemoteFileReader, isPathStrictlyInside, root } from "openclaw/plugin-sdk/file-access-runtime";
|
|
29
|
+
import { raceWithTimeout } from "openclaw/plugin-sdk/time-runtime";
|
|
29
30
|
import { once } from "node:events";
|
|
30
31
|
import { spawn } from "node:child_process";
|
|
31
32
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
32
33
|
import { emitTrustedDiagnosticEvent, hasPendingInternalDiagnosticEvent } from "openclaw/plugin-sdk/diagnostic-runtime";
|
|
33
34
|
import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
|
|
34
|
-
import { raceWithTimeout } from "openclaw/plugin-sdk/time-runtime";
|
|
35
35
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
36
36
|
import { buildHarnessVisibleReplyGuidance, buildTemporalContextText, captureToolAuthoredSourceReply, createAgentToolResultMiddlewareRunner, createCodexAppServerToolResultExtensionRunner, embeddedAgentLog, extractMessagingToolSend, extractMessagingToolSendResult, finalizeAgentToolAvailability, finalizeToolTerminalPresentation, formatApprovalDisplayPath, formatToolExecutionErrorMessage, getBeforeToolCallFailureDisposition, getChannelAgentToolMeta, getPluginToolMeta, getPluginToolSideEffectOwnerKey, hasNativeHookRelayInvocation, invokeNativeHookRelay, isDeliveredMessageToolOnlySourceReplyResult, isDeliveredMessagingToolResult, isDeliveredMessagingToolSendToCurrentSource, isMessagingTool, isReplaySafeToolCall, isToolResultError, isToolWrappedWithBeforeToolCallHook, projectPluginMessageDeliveryFact, projectRuntimeToolInputSchema, readEmbeddedMessageDeliveryFact, readToolOperatorHint, resolveNativeHookRelayDeferredToolApproval, resolveToolExecutionErrorKind, runAgentHarnessAfterToolCallHook, sanitizeToolResult, setBeforeToolCallDiagnosticsEnabled, wrapToolWithBeforeToolCallHook } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
37
37
|
import { sanitizeInlineImageDataUrl } from "openclaw/plugin-sdk/inline-image-data-url-runtime";
|
|
38
|
-
import {
|
|
39
|
-
import { formatErrorMessage as formatErrorMessage$2, redactSensitiveText as redactSensitiveText$1 } from "openclaw/plugin-sdk/security-runtime";
|
|
38
|
+
import { formatErrorMessage as formatErrorMessage$2, redactSensitiveText } from "openclaw/plugin-sdk/security-runtime";
|
|
40
39
|
import { collectAgentHarnessMessagingMediaUrls, copyInternalToolResultState, createAgentHarnessToolExecutionBoundaryRegistry, extractMessagingToolSourceReplyPayload, getCoreTtsToolResultMediaUrls, mapAgentHarnessMessagingMediaValues, normalizeAcceptedSessionSpawnResult, recordAgentHarnessToolResultTelemetry, runAgentHarnessToolInvocation } from "openclaw/plugin-sdk/agent-harness-tool-runtime";
|
|
41
40
|
import { isIP } from "node:net";
|
|
41
|
+
import { redactToolPayloadText } from "openclaw/plugin-sdk/logging-core";
|
|
42
42
|
import { SANDBOX_COMMAND_MAX_BUFFER_BYTES, buildRemoteCommand, prepareSandboxProcessCleanup, sanitizeEnvVars } from "openclaw/plugin-sdk/sandbox";
|
|
43
43
|
import { formatMcpCodexApprovalRemedy, requiresMcpCodexToolApproval, resolveProjectedMcpCodexToolApprovalMode } from "openclaw/plugin-sdk/codex-mcp-projection";
|
|
44
44
|
import { SsrFBlockedError, isBlockedHostnameOrIp } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
@@ -423,6 +423,13 @@ function invalidateCodexComputerFrame(contextEpoch) {
|
|
|
423
423
|
delete contextEpoch.frameToolCallId;
|
|
424
424
|
delete contextEpoch.frameImageIdentity;
|
|
425
425
|
}
|
|
426
|
+
function computerFrameImageIdentity(content) {
|
|
427
|
+
if (!Array.isArray(content)) return;
|
|
428
|
+
const images = content.filter((block) => block.type === "image");
|
|
429
|
+
if (images.length !== 1) return;
|
|
430
|
+
const image = expectDefined(images[0], "single Codex computer frame image");
|
|
431
|
+
return createHash("sha256").update(JSON.stringify([image.mimeType, image.data])).digest("hex");
|
|
432
|
+
}
|
|
426
433
|
//#endregion
|
|
427
434
|
//#region extensions/codex/src/app-server/user-input.ts
|
|
428
435
|
/** Builds ordered Codex user input for both new turns and same-turn steering. */
|
|
@@ -765,8 +772,8 @@ function buildCodexHistoryProvenancePrefix(params) {
|
|
|
765
772
|
const sender = readCodexCurrentSender(params);
|
|
766
773
|
return sender?.id ? neutralizeCodexExplicitMentionSigils(`[OpenClaw conversation info: sender=${JSON.stringify(sender)}]\n`) : void 0;
|
|
767
774
|
}
|
|
768
|
-
function buildTurnStartParams(params, options) {
|
|
769
|
-
const modelSelection = options.preserveNativeTurnSettings ? void 0 : resolveCodexAppServerRequestModelSelection({
|
|
775
|
+
async function buildTurnStartParams(params, options) {
|
|
776
|
+
const modelSelection = options.preserveNativeTurnSettings ? void 0 : await resolveCodexAppServerRequestModelSelection({
|
|
770
777
|
homeScope: options.appServer.start.homeScope,
|
|
771
778
|
model: options.model ?? params.modelId,
|
|
772
779
|
modelProvider: options.modelProvider,
|
|
@@ -926,7 +933,7 @@ var CodexNodeExecServerDisconnectedError = class extends Error {
|
|
|
926
933
|
};
|
|
927
934
|
/** Produces the bounded, redacted terminal failure shared by pending and claimed node leases. */
|
|
928
935
|
function createCodexNodeExecServerDisconnectError(reason, cause) {
|
|
929
|
-
return new CodexNodeExecServerDisconnectedError(`Codex execution node disconnected; start a fresh attempt. (${reason}${cause === void 0 ? "" : `: ${truncateUtf16Safe(redactSensitiveText
|
|
936
|
+
return new CodexNodeExecServerDisconnectedError(`Codex execution node disconnected; start a fresh attempt. (${reason}${cause === void 0 ? "" : `: ${truncateUtf16Safe(redactSensitiveText(formatErrorMessage$2(cause), { mode: "tools" }), CODEX_NODE_EXEC_SERVER_MAX_FAILURE_DETAIL_CHARS)}`})`);
|
|
930
937
|
}
|
|
931
938
|
/** Relays one authorized, single-use Codex exec-server channel without interpreting its protocol. */
|
|
932
939
|
async function startCodexNodeExecServerRelay(params) {
|
|
@@ -1193,6 +1200,9 @@ const sandboxExecServerRegistry = {
|
|
|
1193
1200
|
lease.channel.close();
|
|
1194
1201
|
}
|
|
1195
1202
|
server.node.leases.clear();
|
|
1203
|
+
} else {
|
|
1204
|
+
for (const { unsubscribe } of server.processAuthorities?.values() ?? []) unsubscribe();
|
|
1205
|
+
server.processAuthorities?.clear();
|
|
1196
1206
|
}
|
|
1197
1207
|
for (const client of server.server.clients) client.close(1001, "shutdown");
|
|
1198
1208
|
await new Promise((resolve) => {
|
|
@@ -1352,7 +1362,7 @@ function resolveFsSandboxEntry(entry, cwd) {
|
|
|
1352
1362
|
return {
|
|
1353
1363
|
kind: "glob",
|
|
1354
1364
|
pattern: absolutePattern,
|
|
1355
|
-
matcher:
|
|
1365
|
+
matcher: compileSandboxGlobMatcher(absolutePattern),
|
|
1356
1366
|
literalPrefix: sandboxGlobLiteralPrefix(absolutePattern),
|
|
1357
1367
|
access
|
|
1358
1368
|
};
|
|
@@ -1386,7 +1396,7 @@ function resolveFsAccess(policy, rawPath) {
|
|
|
1386
1396
|
const target = normalizeSandboxAbsolutePath(rawPath, "fs path");
|
|
1387
1397
|
let selected;
|
|
1388
1398
|
for (const entry of policy.entries) {
|
|
1389
|
-
if (!(entry.kind === "path" ? pathContains(entry.path, target) : entry.matcher
|
|
1399
|
+
if (!(entry.kind === "path" ? pathContains(entry.path, target) : entry.matcher(target))) continue;
|
|
1390
1400
|
const candidate = {
|
|
1391
1401
|
specificity: (entry.kind === "path" ? entry.path : entry.literalPrefix).split("/").filter(Boolean).length,
|
|
1392
1402
|
rank: FS_ACCESS_RANK[entry.access],
|
|
@@ -1423,27 +1433,285 @@ function normalizeSandboxGlobPattern(pattern) {
|
|
|
1423
1433
|
if (!pattern || pattern.includes("\0") || !pattern.startsWith("/")) throw new Error("fs sandbox glob pattern must be absolute.");
|
|
1424
1434
|
return pattern.replace(/\/{2,}/gu, "/");
|
|
1425
1435
|
}
|
|
1426
|
-
function
|
|
1427
|
-
|
|
1436
|
+
function compileSandboxGlobLiteral(text) {
|
|
1437
|
+
const points = Array.from(text);
|
|
1438
|
+
const fallback = Array.from({ length: points.length }, () => 0);
|
|
1439
|
+
let matched = 0;
|
|
1440
|
+
for (let index = 1; index < points.length; index += 1) {
|
|
1441
|
+
while (matched > 0 && points[index] !== points[matched]) matched = fallback[matched - 1] ?? 0;
|
|
1442
|
+
if (points[index] === points[matched]) matched += 1;
|
|
1443
|
+
fallback[index] = matched;
|
|
1444
|
+
}
|
|
1445
|
+
return {
|
|
1446
|
+
kind: "literal",
|
|
1447
|
+
points,
|
|
1448
|
+
fallback
|
|
1449
|
+
};
|
|
1450
|
+
}
|
|
1451
|
+
function tokenizeSandboxGlobPattern(pattern) {
|
|
1452
|
+
const tokens = [];
|
|
1453
|
+
let literal = "";
|
|
1454
|
+
const flushLiteral = () => {
|
|
1455
|
+
if (literal) {
|
|
1456
|
+
tokens.push(compileSandboxGlobLiteral(literal));
|
|
1457
|
+
literal = "";
|
|
1458
|
+
}
|
|
1459
|
+
};
|
|
1428
1460
|
for (let index = 0; index < pattern.length; index += 1) {
|
|
1429
1461
|
const char = pattern[index];
|
|
1430
1462
|
const next = pattern[index + 1];
|
|
1431
1463
|
if (char === "*" && next === "*" && pattern[index + 2] === "/") {
|
|
1432
|
-
|
|
1464
|
+
flushLiteral();
|
|
1465
|
+
tokens.push({ kind: "globstarSlash" });
|
|
1433
1466
|
index += 2;
|
|
1434
1467
|
} else if (char === "*" && next === "*") {
|
|
1435
|
-
|
|
1468
|
+
flushLiteral();
|
|
1469
|
+
tokens.push({ kind: "globstar" });
|
|
1436
1470
|
index += 1;
|
|
1437
|
-
} else if (char === "*")
|
|
1438
|
-
|
|
1439
|
-
|
|
1471
|
+
} else if (char === "*") {
|
|
1472
|
+
flushLiteral();
|
|
1473
|
+
tokens.push({ kind: "star" });
|
|
1474
|
+
} else if (char === "?") {
|
|
1475
|
+
flushLiteral();
|
|
1476
|
+
tokens.push({
|
|
1477
|
+
kind: "single",
|
|
1478
|
+
matches: (targetChar) => targetChar !== "/"
|
|
1479
|
+
});
|
|
1480
|
+
} else if (char === "[") {
|
|
1481
|
+
flushLiteral();
|
|
1440
1482
|
const compiledClass = compileSandboxGlobCharacterClass(pattern, index);
|
|
1441
|
-
|
|
1483
|
+
const classPattern = new RegExp(compiledClass.source, "u");
|
|
1484
|
+
tokens.push({
|
|
1485
|
+
kind: "single",
|
|
1486
|
+
matches: (targetChar) => classPattern.test(targetChar)
|
|
1487
|
+
});
|
|
1442
1488
|
index = compiledClass.endIndex;
|
|
1443
|
-
} else
|
|
1489
|
+
} else literal += char ?? "";
|
|
1490
|
+
}
|
|
1491
|
+
flushLiteral();
|
|
1492
|
+
return tokens;
|
|
1493
|
+
}
|
|
1494
|
+
function isSandboxGlobLineTerminator(point) {
|
|
1495
|
+
return point === "\n" || point === "\r" || point === "\u2028" || point === "\u2029";
|
|
1496
|
+
}
|
|
1497
|
+
function firstLineTerminatorAtOrAfter(target, index) {
|
|
1498
|
+
let low = 0;
|
|
1499
|
+
let high = target.lineTerminators.length;
|
|
1500
|
+
while (low < high) {
|
|
1501
|
+
const mid = low + high >> 1;
|
|
1502
|
+
if ((target.lineTerminators[mid] ?? 0) < index) low = mid + 1;
|
|
1503
|
+
else high = mid;
|
|
1504
|
+
}
|
|
1505
|
+
return low < target.lineTerminators.length ? target.lineTerminators[low] ?? 0 : target.points.length;
|
|
1506
|
+
}
|
|
1507
|
+
function createSandboxGlobTarget(url) {
|
|
1508
|
+
const points = Array.from(url);
|
|
1509
|
+
const slashFollows = [];
|
|
1510
|
+
const lineTerminators = [];
|
|
1511
|
+
for (let index = 0; index < points.length; index += 1) {
|
|
1512
|
+
const point = points[index] ?? "";
|
|
1513
|
+
if (point === "/") slashFollows.push(index + 1);
|
|
1514
|
+
else if (isSandboxGlobLineTerminator(point)) lineTerminators.push(index);
|
|
1515
|
+
}
|
|
1516
|
+
const slashFollowRanges = [];
|
|
1517
|
+
for (const follow of slashFollows) {
|
|
1518
|
+
const last = slashFollowRanges.at(-1);
|
|
1519
|
+
if (last !== void 0 && follow === last.end + 1) last.end = follow;
|
|
1520
|
+
else slashFollowRanges.push({
|
|
1521
|
+
start: follow,
|
|
1522
|
+
end: follow
|
|
1523
|
+
});
|
|
1444
1524
|
}
|
|
1445
|
-
|
|
1446
|
-
|
|
1525
|
+
return {
|
|
1526
|
+
points,
|
|
1527
|
+
slashFollowRanges,
|
|
1528
|
+
lineTerminators
|
|
1529
|
+
};
|
|
1530
|
+
}
|
|
1531
|
+
function mergeSortedSandboxGlobRanges(left, right) {
|
|
1532
|
+
const merged = [];
|
|
1533
|
+
let leftIndex = 0;
|
|
1534
|
+
let rightIndex = 0;
|
|
1535
|
+
while (leftIndex < left.length || rightIndex < right.length) {
|
|
1536
|
+
const leftRange = left[leftIndex];
|
|
1537
|
+
const rightRange = right[rightIndex];
|
|
1538
|
+
const range = rightRange === void 0 || leftRange !== void 0 && (leftRange.start < rightRange.start || leftRange.start === rightRange.start && leftRange.end <= rightRange.end) ? leftRange : rightRange;
|
|
1539
|
+
if (range === void 0) break;
|
|
1540
|
+
if (range === leftRange) leftIndex += 1;
|
|
1541
|
+
else rightIndex += 1;
|
|
1542
|
+
const last = merged.at(-1);
|
|
1543
|
+
if (last !== void 0 && range.start <= last.end + 1) {
|
|
1544
|
+
if (range.end > last.end) last.end = range.end;
|
|
1545
|
+
} else merged.push({
|
|
1546
|
+
start: range.start,
|
|
1547
|
+
end: range.end
|
|
1548
|
+
});
|
|
1549
|
+
}
|
|
1550
|
+
return merged;
|
|
1551
|
+
}
|
|
1552
|
+
function mergeSandboxGlobRanges(ranges) {
|
|
1553
|
+
if (ranges.length === 0) return [];
|
|
1554
|
+
const sorted = ranges.toSorted((left, right) => left.start - right.start || left.end - right.end);
|
|
1555
|
+
const merged = [];
|
|
1556
|
+
for (const range of sorted) {
|
|
1557
|
+
const last = merged.at(-1);
|
|
1558
|
+
if (last !== void 0 && range.start <= last.end + 1) {
|
|
1559
|
+
if (range.end > last.end) last.end = range.end;
|
|
1560
|
+
continue;
|
|
1561
|
+
}
|
|
1562
|
+
merged.push({
|
|
1563
|
+
start: range.start,
|
|
1564
|
+
end: range.end
|
|
1565
|
+
});
|
|
1566
|
+
}
|
|
1567
|
+
return merged;
|
|
1568
|
+
}
|
|
1569
|
+
function literalSandboxGlobRanges(target, literal, ranges) {
|
|
1570
|
+
const next = [];
|
|
1571
|
+
const first = ranges[0];
|
|
1572
|
+
const last = ranges.at(-1);
|
|
1573
|
+
if (!first || !last) return next;
|
|
1574
|
+
const limit = Math.min(target.points.length, last.end + literal.points.length);
|
|
1575
|
+
let matched = 0;
|
|
1576
|
+
let rangeIndex = 0;
|
|
1577
|
+
for (let pos = first.start; pos < limit; pos += 1) {
|
|
1578
|
+
const point = target.points[pos];
|
|
1579
|
+
while (matched > 0 && point !== literal.points[matched]) matched = literal.fallback[matched - 1] ?? 0;
|
|
1580
|
+
if (point === literal.points[matched]) matched += 1;
|
|
1581
|
+
if (matched !== literal.points.length) continue;
|
|
1582
|
+
const start = pos + 1 - matched;
|
|
1583
|
+
matched = literal.fallback[matched - 1] ?? 0;
|
|
1584
|
+
while (rangeIndex < ranges.length && (ranges[rangeIndex]?.end ?? -1) < start) rangeIndex += 1;
|
|
1585
|
+
const range = ranges[rangeIndex];
|
|
1586
|
+
if (!range || start < range.start) continue;
|
|
1587
|
+
const previous = next.at(-1);
|
|
1588
|
+
if (previous && previous.end === pos) previous.end = pos + 1;
|
|
1589
|
+
else next.push({
|
|
1590
|
+
start: pos + 1,
|
|
1591
|
+
end: pos + 1
|
|
1592
|
+
});
|
|
1593
|
+
}
|
|
1594
|
+
return next;
|
|
1595
|
+
}
|
|
1596
|
+
function starSandboxGlobRanges(points, ranges) {
|
|
1597
|
+
const next = [];
|
|
1598
|
+
let coveredThrough = -1;
|
|
1599
|
+
for (const range of mergeSandboxGlobRanges(ranges.map((item) => ({
|
|
1600
|
+
start: item.start,
|
|
1601
|
+
end: item.end
|
|
1602
|
+
})))) {
|
|
1603
|
+
let cursor = range.start;
|
|
1604
|
+
if (cursor <= coveredThrough) cursor = coveredThrough + 1;
|
|
1605
|
+
while (cursor <= range.end) {
|
|
1606
|
+
let far = cursor;
|
|
1607
|
+
while (far < points.length && points[far] !== "/") far += 1;
|
|
1608
|
+
next.push({
|
|
1609
|
+
start: cursor,
|
|
1610
|
+
end: far
|
|
1611
|
+
});
|
|
1612
|
+
coveredThrough = far;
|
|
1613
|
+
if (far >= range.end) break;
|
|
1614
|
+
cursor = far + 1;
|
|
1615
|
+
}
|
|
1616
|
+
}
|
|
1617
|
+
return mergeSandboxGlobRanges(next);
|
|
1618
|
+
}
|
|
1619
|
+
function globstarSandboxGlobRanges(target, ranges) {
|
|
1620
|
+
const next = [];
|
|
1621
|
+
for (const range of ranges) next.push({
|
|
1622
|
+
start: range.start,
|
|
1623
|
+
end: firstLineTerminatorAtOrAfter(target, range.end)
|
|
1624
|
+
});
|
|
1625
|
+
return mergeSandboxGlobRanges(next);
|
|
1626
|
+
}
|
|
1627
|
+
function globstarSlashSandboxGlobRanges(target, ranges) {
|
|
1628
|
+
const follows = target.slashFollowRanges;
|
|
1629
|
+
const next = [];
|
|
1630
|
+
const emitted = [];
|
|
1631
|
+
let followIndex = 0;
|
|
1632
|
+
const sortedRanges = ranges.toSorted((left, right) => left.start - right.start || left.end - right.end);
|
|
1633
|
+
for (const range of sortedRanges) {
|
|
1634
|
+
next.push({
|
|
1635
|
+
start: range.start,
|
|
1636
|
+
end: range.end
|
|
1637
|
+
});
|
|
1638
|
+
const bound = firstLineTerminatorAtOrAfter(target, range.end);
|
|
1639
|
+
while (followIndex < follows.length) {
|
|
1640
|
+
const follow = follows[followIndex];
|
|
1641
|
+
if (follow === void 0 || follow.start > range.start) break;
|
|
1642
|
+
followIndex += 1;
|
|
1643
|
+
}
|
|
1644
|
+
while (followIndex < follows.length) {
|
|
1645
|
+
const follow = follows[followIndex];
|
|
1646
|
+
if (follow === void 0 || follow.start > bound) break;
|
|
1647
|
+
emitted.push({
|
|
1648
|
+
start: follow.start,
|
|
1649
|
+
end: follow.end
|
|
1650
|
+
});
|
|
1651
|
+
followIndex += 1;
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1654
|
+
return mergeSortedSandboxGlobRanges(next, emitted);
|
|
1655
|
+
}
|
|
1656
|
+
function singleSandboxGlobRanges(points, ranges, matches) {
|
|
1657
|
+
const next = [];
|
|
1658
|
+
for (const range of ranges) {
|
|
1659
|
+
let runStart = -1;
|
|
1660
|
+
let runEnd = -1;
|
|
1661
|
+
const last = Math.min(range.end, points.length - 1);
|
|
1662
|
+
for (let pos = range.start; pos <= last; pos += 1) {
|
|
1663
|
+
const point = points[pos];
|
|
1664
|
+
if (point === void 0 || !matches(point)) continue;
|
|
1665
|
+
const at = pos + 1;
|
|
1666
|
+
if (runStart < 0) {
|
|
1667
|
+
runStart = at;
|
|
1668
|
+
runEnd = at;
|
|
1669
|
+
} else if (at === runEnd + 1) runEnd = at;
|
|
1670
|
+
else {
|
|
1671
|
+
next.push({
|
|
1672
|
+
start: runStart,
|
|
1673
|
+
end: runEnd
|
|
1674
|
+
});
|
|
1675
|
+
runStart = at;
|
|
1676
|
+
runEnd = at;
|
|
1677
|
+
}
|
|
1678
|
+
}
|
|
1679
|
+
if (runStart >= 0) next.push({
|
|
1680
|
+
start: runStart,
|
|
1681
|
+
end: runEnd
|
|
1682
|
+
});
|
|
1683
|
+
}
|
|
1684
|
+
return mergeSandboxGlobRanges(next);
|
|
1685
|
+
}
|
|
1686
|
+
function matchSandboxGlobTokens(url, tokens) {
|
|
1687
|
+
const target = createSandboxGlobTarget(url);
|
|
1688
|
+
let ranges = [{
|
|
1689
|
+
start: 0,
|
|
1690
|
+
end: 0
|
|
1691
|
+
}];
|
|
1692
|
+
for (let index = 0; index < tokens.length; index += 1) {
|
|
1693
|
+
const token = tokens[index];
|
|
1694
|
+
if (token === void 0) break;
|
|
1695
|
+
if (token.kind === "literal") ranges = literalSandboxGlobRanges(target, token, ranges);
|
|
1696
|
+
else if (token.kind === "star") ranges = starSandboxGlobRanges(target.points, ranges);
|
|
1697
|
+
else if (token.kind === "globstar") ranges = globstarSandboxGlobRanges(target, ranges);
|
|
1698
|
+
else if (token.kind === "globstarSlash") {
|
|
1699
|
+
ranges = globstarSlashSandboxGlobRanges(target, ranges);
|
|
1700
|
+
while (tokens[index + 1]?.kind === "globstarSlash") index += 1;
|
|
1701
|
+
} else ranges = singleSandboxGlobRanges(target.points, ranges, token.matches);
|
|
1702
|
+
if (ranges.length === 0) return false;
|
|
1703
|
+
}
|
|
1704
|
+
return ranges.some((range) => range.start <= target.points.length && target.points.length <= range.end);
|
|
1705
|
+
}
|
|
1706
|
+
/**
|
|
1707
|
+
* Compiles a Codex sandbox glob into a linear matcher. The sandbox context is
|
|
1708
|
+
* model-session output and the target path is model-requested, so the matcher
|
|
1709
|
+
* must stay free of catastrophic backtracking: each token advances cursor
|
|
1710
|
+
* ranges in one pass instead of letting a regex retry overlapping quantifiers.
|
|
1711
|
+
*/
|
|
1712
|
+
function compileSandboxGlobMatcher(pattern) {
|
|
1713
|
+
const tokens = tokenizeSandboxGlobPattern(pattern);
|
|
1714
|
+
return (target) => matchSandboxGlobTokens(target, tokens);
|
|
1447
1715
|
}
|
|
1448
1716
|
function compileSandboxGlobCharacterClass(pattern, startIndex) {
|
|
1449
1717
|
let index = startIndex + 1;
|
|
@@ -2881,8 +3149,14 @@ async function ensureCodexSandboxExecServerEnvironment(params) {
|
|
|
2881
3149
|
if (processAuthority && !("node" in execServer)) {
|
|
2882
3150
|
const authorities = execServer.processAuthorities ??= /* @__PURE__ */ new Map();
|
|
2883
3151
|
if (!authorities.has(processAuthority.authPath)) {
|
|
2884
|
-
|
|
2885
|
-
|
|
3152
|
+
const unsubscribe = params.client.addCloseHandler(() => {
|
|
3153
|
+
unsubscribe();
|
|
3154
|
+
authorities.delete(processAuthority.authPath);
|
|
3155
|
+
});
|
|
3156
|
+
authorities.set(processAuthority.authPath, {
|
|
3157
|
+
authority: processAuthority,
|
|
3158
|
+
unsubscribe
|
|
3159
|
+
});
|
|
2886
3160
|
}
|
|
2887
3161
|
}
|
|
2888
3162
|
const environmentId = nodeLease ? `openclaw-node-${nodeLease.id}` : processAuthority ? `${execServer.environmentId}-${processAuthority.id}` : execServer.environmentId;
|
|
@@ -3058,7 +3332,7 @@ async function startOpenClawExecServer(sandbox) {
|
|
|
3058
3332
|
handleNodeConnection(execServer, socket, requestUrl);
|
|
3059
3333
|
return;
|
|
3060
3334
|
}
|
|
3061
|
-
handleConnection(execServer, socket, execServer.processAuthorities?.get(requestUrl.pathname));
|
|
3335
|
+
handleConnection(execServer, socket, execServer.processAuthorities?.get(requestUrl.pathname)?.authority);
|
|
3062
3336
|
});
|
|
3063
3337
|
embeddedAgentLog.info("codex sandbox exec-server started", {
|
|
3064
3338
|
environmentId,
|
|
@@ -4480,29 +4754,7 @@ function createCodexDynamicToolSpecs(params) {
|
|
|
4480
4754
|
function projectCodexDynamicTools(tools) {
|
|
4481
4755
|
const projectedTools = [];
|
|
4482
4756
|
const quarantinedTools = [];
|
|
4483
|
-
|
|
4484
|
-
try {
|
|
4485
|
-
length = tools.length;
|
|
4486
|
-
} catch {
|
|
4487
|
-
return {
|
|
4488
|
-
tools: [],
|
|
4489
|
-
quarantinedTools: [{
|
|
4490
|
-
tool: "tool[0]",
|
|
4491
|
-
violations: ["tool[0] is unreadable"]
|
|
4492
|
-
}]
|
|
4493
|
-
};
|
|
4494
|
-
}
|
|
4495
|
-
for (let toolIndex = 0; toolIndex < length; toolIndex += 1) {
|
|
4496
|
-
let tool;
|
|
4497
|
-
try {
|
|
4498
|
-
tool = tools[toolIndex];
|
|
4499
|
-
} catch {
|
|
4500
|
-
quarantinedTools.push({
|
|
4501
|
-
tool: `tool[${toolIndex}]`,
|
|
4502
|
-
violations: [`tool[${toolIndex}] is unreadable`]
|
|
4503
|
-
});
|
|
4504
|
-
continue;
|
|
4505
|
-
}
|
|
4757
|
+
for (const [toolIndex, tool] of tools.entries()) {
|
|
4506
4758
|
const descriptor = readCodexDynamicToolDescriptor(tool, toolIndex);
|
|
4507
4759
|
if ("diagnostic" in descriptor) {
|
|
4508
4760
|
quarantinedTools.push(descriptor.diagnostic);
|
|
@@ -4608,38 +4860,10 @@ function finalizeCodexToolAvailability(entries) {
|
|
|
4608
4860
|
//#region extensions/codex/src/app-server/dynamic-tool-content.ts
|
|
4609
4861
|
function enforceWholeSkillResult(toolName, result, maxChars) {
|
|
4610
4862
|
if (toolName !== "skills_read" || isToolResultError(result)) return result;
|
|
4611
|
-
return
|
|
4612
|
-
}
|
|
4613
|
-
function sanitizeToolTextRuns(rawContent) {
|
|
4614
|
-
const content = [];
|
|
4615
|
-
for (let index = 0; index < rawContent.length;) {
|
|
4616
|
-
const item = rawContent[index];
|
|
4617
|
-
if (item.type !== "text") {
|
|
4618
|
-
content.push(item);
|
|
4619
|
-
index += 1;
|
|
4620
|
-
continue;
|
|
4621
|
-
}
|
|
4622
|
-
const textRun = [];
|
|
4623
|
-
while (index < rawContent.length) {
|
|
4624
|
-
const next = rawContent[index];
|
|
4625
|
-
if (next.type !== "text") break;
|
|
4626
|
-
textRun.push(next);
|
|
4627
|
-
index += 1;
|
|
4628
|
-
}
|
|
4629
|
-
const sanitizedText = sanitizeToolResult(textRun.map((entry) => entry.text).join(""));
|
|
4630
|
-
let offset = 0;
|
|
4631
|
-
content.push(...textRun.map((entry, runIndex) => {
|
|
4632
|
-
const targetEnd = runIndex === textRun.length - 1 ? sanitizedText.length : Math.min(sanitizedText.length, offset + entry.text.length);
|
|
4633
|
-
const text = sliceUtf16Safe(sanitizedText, offset, targetEnd);
|
|
4634
|
-
const sanitized = Object.assign({}, entry, { text });
|
|
4635
|
-
offset += text.length;
|
|
4636
|
-
return sanitized;
|
|
4637
|
-
}));
|
|
4638
|
-
}
|
|
4639
|
-
return content;
|
|
4863
|
+
return result.content.reduce((total, item) => total + (item.type === "text" ? estimateToolResultTextChars(item.text) : 0), 0) <= maxChars ? result : failedToolResult(`This Codex turn cannot deliver the whole skill within its ${maxChars}-character weighted output budget. No instructions were returned; use a harness with a larger instruction budget.`);
|
|
4640
4864
|
}
|
|
4641
4865
|
function convertToolContents(rawContent, maxChars) {
|
|
4642
|
-
const content =
|
|
4866
|
+
const content = rawContent;
|
|
4643
4867
|
const totalTextChars = content.reduce((total, item) => total + (item.type === "text" ? item.text.length : 0), 0);
|
|
4644
4868
|
if (content.reduce((total, item) => total + (item.type === "text" ? estimateToolResultTextChars(item.text) : 0), 0) <= maxChars) return content.map(convertToolContent);
|
|
4645
4869
|
const noticeText = `...(OpenClaw truncated dynamic tool result: original ${totalTextChars} chars, weighted budget ${maxChars}; rerun with narrower args.)`;
|
|
@@ -4723,31 +4947,44 @@ function projectCodexExecutableDynamicToolSurface(tools, hookContext) {
|
|
|
4723
4947
|
}
|
|
4724
4948
|
//#endregion
|
|
4725
4949
|
//#region extensions/codex/src/app-server/dynamic-tool-source-reply.ts
|
|
4950
|
+
function applyCurrentMessageProvider(toolName, args, currentProvider) {
|
|
4951
|
+
const hasProvider = typeof args.provider === "string" && args.provider.trim().length > 0 || typeof args.channel === "string" && args.channel.trim().length > 0;
|
|
4952
|
+
const provider = currentProvider?.trim();
|
|
4953
|
+
if (toolName !== "message" || hasProvider || !provider) return args;
|
|
4954
|
+
return {
|
|
4955
|
+
...args,
|
|
4956
|
+
provider
|
|
4957
|
+
};
|
|
4958
|
+
}
|
|
4726
4959
|
/**
|
|
4727
4960
|
* Resolves the source-reply facts of one Codex dynamic tool result and records whether
|
|
4728
4961
|
* it ends the Codex turn on `response`. A final reply
|
|
4729
4962
|
* authored by a `canDeliverSourceReply` tool, read from the result after middleware and
|
|
4730
|
-
* extensions,
|
|
4731
|
-
* row after the send. Only calls in the model-only
|
|
4732
|
-
* exposes that namespace to Code Mode programs,
|
|
4963
|
+
* extensions, stays on the response until batch settlement. The host delivers it
|
|
4964
|
+
* and writes its transcript row after the send. Only calls in the model-only
|
|
4965
|
+
* namespace qualify: Codex never exposes that namespace to Code Mode programs,
|
|
4966
|
+
* so a program's intermediate call
|
|
4733
4967
|
* cannot end the turn or reach the conversation.
|
|
4734
4968
|
*/
|
|
4735
4969
|
function resolveCodexToolResultSourceReply(params) {
|
|
4736
|
-
const
|
|
4737
|
-
const toolConfirmed =
|
|
4738
|
-
const confirmed =
|
|
4970
|
+
const messageTool = params.toolName === "message";
|
|
4971
|
+
const toolConfirmed = messageTool && !params.resultIsError && (params.rawResult.terminate === true || params.result.terminate === true);
|
|
4972
|
+
const confirmed = messageTool && (toolConfirmed || params.deliveredSourceReply);
|
|
4739
4973
|
const final = confirmed ? params.executedArgs.final !== false : void 0;
|
|
4740
4974
|
const payload = params.canDeliverSourceReply === true && !params.resultIsError && params.call.namespace === "openclaw_direct" ? captureToolAuthoredSourceReply({
|
|
4741
4975
|
result: params.result,
|
|
4742
4976
|
toolCallId: params.call.callId,
|
|
4743
4977
|
idempotencyScope: params.runId ?? params.call.turnId
|
|
4744
4978
|
}) : void 0;
|
|
4745
|
-
if (payload) params.payloads.push(payload);
|
|
4746
4979
|
const toolAuthoredFinal = Boolean(payload);
|
|
4747
4980
|
const continuesSourceReplyProgress = confirmed && final === false;
|
|
4748
4981
|
const terminate = toolAuthoredFinal || (params.rawResult.terminate === true || params.result.terminate === true) && !continuesSourceReplyProgress || [params.rawResult, params.result].some(({ details }) => isRecord(details) && typeof details.status === "string" && details.status.trim().toLowerCase() === "yielded") || confirmed && final === true || void 0;
|
|
4749
4982
|
params.response.terminate = terminate;
|
|
4750
|
-
|
|
4983
|
+
params.response.finalSourceReplyDelivered = params.deliveredSourceReply && final === true || void 0;
|
|
4984
|
+
if (payload) params.response.toolAuthoredSourceReply = {
|
|
4985
|
+
...payload,
|
|
4986
|
+
toolAuthoredForTurnId: params.call.turnId
|
|
4987
|
+
};
|
|
4751
4988
|
return {
|
|
4752
4989
|
toolConfirmed,
|
|
4753
4990
|
final,
|
|
@@ -4775,22 +5012,6 @@ function assertCodexDynamicToolInputMatchesSchema(params) {
|
|
|
4775
5012
|
const omittedSuffix = omitted > 0 ? `; ${omitted} more violation(s) omitted` : "";
|
|
4776
5013
|
throw new Error(`Invalid arguments for tool "${params.toolName}": ${details}${omittedSuffix}.`);
|
|
4777
5014
|
}
|
|
4778
|
-
function applyCurrentMessageProvider(toolName, args, currentProvider) {
|
|
4779
|
-
const hasProvider = typeof args.provider === "string" && args.provider.trim().length > 0 || typeof args.channel === "string" && args.channel.trim().length > 0;
|
|
4780
|
-
const provider = currentProvider?.trim();
|
|
4781
|
-
if (toolName !== "message" || hasProvider || !provider) return args;
|
|
4782
|
-
return {
|
|
4783
|
-
...args,
|
|
4784
|
-
provider
|
|
4785
|
-
};
|
|
4786
|
-
}
|
|
4787
|
-
function computerFrameImageIdentity(content) {
|
|
4788
|
-
if (!Array.isArray(content)) return;
|
|
4789
|
-
const images = content.filter((block) => block.type === "image");
|
|
4790
|
-
if (images.length !== 1) return;
|
|
4791
|
-
const image = expectDefined(images[0], "single Codex computer frame image");
|
|
4792
|
-
return createHash("sha256").update(JSON.stringify([image.mimeType, image.data])).digest("hex");
|
|
4793
|
-
}
|
|
4794
5015
|
function createCodexDynamicToolBridge(params) {
|
|
4795
5016
|
const toolResultHookContext = toToolResultHookContext(params.hookContext);
|
|
4796
5017
|
const contextWindowTokens = params.hookContext?.contextWindowTokens;
|
|
@@ -4919,6 +5140,7 @@ function createCodexDynamicToolBridge(params) {
|
|
|
4919
5140
|
let messagingFacts;
|
|
4920
5141
|
let executedArgsForPresentation = args;
|
|
4921
5142
|
let rawIsErrorForPresentation = false;
|
|
5143
|
+
let finalSourceReplyDelivered = false;
|
|
4922
5144
|
let telemetryRawResultForPresentation;
|
|
4923
5145
|
let presentationIsError = false;
|
|
4924
5146
|
return runAgentHarnessToolInvocation({
|
|
@@ -4933,6 +5155,7 @@ function createCodexDynamicToolBridge(params) {
|
|
|
4933
5155
|
runId: toolResultHookContext.runId,
|
|
4934
5156
|
startedAt: invocationStartedAt,
|
|
4935
5157
|
signal,
|
|
5158
|
+
assertCurrent: params.assertCurrent,
|
|
4936
5159
|
boundaries: executionBoundaries,
|
|
4937
5160
|
retainExecutionSnapshot: options?.retainExecutionSnapshot,
|
|
4938
5161
|
initialArguments: args,
|
|
@@ -4951,7 +5174,8 @@ function createCodexDynamicToolBridge(params) {
|
|
|
4951
5174
|
});
|
|
4952
5175
|
return toolArgsRecord;
|
|
4953
5176
|
},
|
|
4954
|
-
beforeExecute: () => {
|
|
5177
|
+
beforeExecute: async () => {
|
|
5178
|
+
await params.assertCurrentAsync?.();
|
|
4955
5179
|
messagingContext = {
|
|
4956
5180
|
config: params.hookContext?.config,
|
|
4957
5181
|
currentChannelId: params.hookContext?.currentChannelId,
|
|
@@ -5001,6 +5225,8 @@ function createCodexDynamicToolBridge(params) {
|
|
|
5001
5225
|
deliveredPayload: rawResult
|
|
5002
5226
|
})
|
|
5003
5227
|
});
|
|
5228
|
+
finalSourceReplyDelivered = deliveredSourceReply && executedArgs.final !== false;
|
|
5229
|
+
telemetry.finalSourceReplyDelivered ||= finalSourceReplyDelivered || void 0;
|
|
5004
5230
|
if (toolName === "message" && messageDelivery?.sourceReplyDelivered) telemetry.sourceReplyDelivered = true;
|
|
5005
5231
|
messagingFacts = {
|
|
5006
5232
|
messagingDelivered,
|
|
@@ -5063,7 +5289,6 @@ function createCodexDynamicToolBridge(params) {
|
|
|
5063
5289
|
transcriptDetails: asOptionalRecord(sanitizeToolResult(result))?.details
|
|
5064
5290
|
};
|
|
5065
5291
|
const sourceReply = resolveCodexToolResultSourceReply({
|
|
5066
|
-
sourceReplyDeliveryMode: params.hookContext?.sourceReplyDeliveryMode,
|
|
5067
5292
|
canDeliverSourceReply: toolEntry.tool.canDeliverSourceReply,
|
|
5068
5293
|
toolName,
|
|
5069
5294
|
call,
|
|
@@ -5073,7 +5298,6 @@ function createCodexDynamicToolBridge(params) {
|
|
|
5073
5298
|
deliveredSourceReply,
|
|
5074
5299
|
executedArgs,
|
|
5075
5300
|
runId: toolResultHookContext.runId,
|
|
5076
|
-
payloads: telemetry.messagingToolSourceReplyPayloads,
|
|
5077
5301
|
response
|
|
5078
5302
|
});
|
|
5079
5303
|
const autoDeliveryTtsMediaUrls = getCoreTtsToolResultMediaUrls(rawResult);
|
|
@@ -5137,7 +5361,9 @@ function createCodexDynamicToolBridge(params) {
|
|
|
5137
5361
|
executedArguments: executedArgs,
|
|
5138
5362
|
executionStarted: executionBoundary.executionStarted,
|
|
5139
5363
|
replaySafe,
|
|
5140
|
-
sideEffectEvidence: executionBoundary.didStartExecution && !replaySafe || void 0
|
|
5364
|
+
sideEffectEvidence: executionBoundary.didStartExecution && !replaySafe || void 0,
|
|
5365
|
+
terminate: finalSourceReplyDelivered || void 0,
|
|
5366
|
+
finalSourceReplyDelivered: finalSourceReplyDelivered || void 0
|
|
5141
5367
|
};
|
|
5142
5368
|
}
|
|
5143
5369
|
});
|