@openclaw/codex 2026.10.1-beta.2 → 2026.10.5-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.setup/{account-usage-runtime-DGqFpAud.mjs → account-usage-runtime-QBZsvZS8.mjs} +8 -7
- package/dist/.setup/{app-server-policy-Bg4FZw1f.mjs → app-server-policy-D_zv8J7V.mjs} +3 -4
- package/dist/.setup/{apply-CXTudl9p.mjs → apply-CBMV8LN0.mjs} +40 -51
- package/dist/.setup/{attempt-client-cleanup-BH0hW2xU.mjs → attempt-client-cleanup-t-kd_1ys.mjs} +6 -6
- package/dist/.setup/attempt-terminal-jO5IMj9K.mjs +2 -0
- package/dist/.setup/{attempt-workspace-context-BY0jprWJ.mjs → attempt-workspace-context-CcwP3DA3.mjs} +21 -18
- package/dist/.setup/{auth-binding-BoMwpuPN.mjs → auth-binding-BaxlhaNx.mjs} +2 -2
- package/dist/.setup/{auth-cache-key-CGm0UJOr.mjs → auth-cache-key-DyfUvsSa.mjs} +30 -41
- package/dist/.setup/{binding-connection-C-08ez1w.mjs → binding-connection-B7HAAZSI.mjs} +2 -2
- package/dist/.setup/{binding-connection.runtime-Dn2p-fdy.mjs → binding-connection.runtime-DAXn7iFl.mjs} +6 -5
- package/dist/.setup/{bounded-turn-pGsfXcmH.mjs → bounded-turn-CyQVQwGe.mjs} +21 -17
- package/dist/.setup/{bounded-turn-isolation-DklXNk3k.mjs → bounded-turn-isolation-BfDAo-qZ.mjs} +4 -4
- package/dist/.setup/{build-state-CqQnsg7T.mjs → build-state-CzLMy1S9.mjs} +1 -1
- package/dist/.setup/{capabilities-kQntafj_.mjs → capabilities-DbOzOglY.mjs} +1 -1
- package/dist/.setup/{client-catalog-response-Bqp7WG51.mjs → client-catalog-response-DsbEAtpd.mjs} +25 -32
- package/dist/.setup/{client-C8lgBOoO.mjs → client-y7nO6X9c.mjs} +198 -247
- package/dist/.setup/{command-dispatch-DhBbFIQ5.mjs → command-dispatch-uA9lz2Kf.mjs} +3 -4
- package/dist/.setup/{command-formatters-DV3DHhdr.mjs → command-formatters-xW9KpoSZ.mjs} +16 -26
- package/dist/.setup/{command-handlers-ztOOzm6O.mjs → command-handlers-VBaJnpZo.mjs} +270 -360
- package/dist/.setup/{command-rpc-CuC5fPom.mjs → command-rpc-C9VxOLuG.mjs} +19 -18
- package/dist/.setup/{compact-tUb9AYfH.mjs → compact-CD8xJxXS.mjs} +41 -61
- package/dist/.setup/{computer-use-BBN9y326.mjs → computer-use-CiToXF5C.mjs} +109 -147
- package/dist/.setup/{config-0Gxk3_eq.mjs → config-C1YVVLEA.mjs} +32 -59
- package/dist/.setup/config-contracts.shared-D85SGEuq.mjs +4 -0
- package/dist/.setup/{config-options-HG_Rr3W_.mjs → config-options-DDzeNQ8m.mjs} +52 -90
- package/dist/.setup/{config-parsing-BQq-CHTF.mjs → config-parsing-DsWSCPHO.mjs} +19 -55
- package/dist/.setup/{config-runtime-cUYrqu_a.mjs → config-runtime-DWzK-k0n.mjs} +2 -2
- package/dist/.setup/{config-security-KAPScztc.mjs → config-security-clxAZYWX.mjs} +35 -39
- package/dist/.setup/config-utils-DN_YT7dE.mjs +47 -0
- package/dist/.setup/{context-engine-projection-CsgYSQhW.mjs → context-engine-projection-ps-yn_ci.mjs} +10 -22
- package/dist/.setup/{conversation-binding-B3MNMVzb.mjs → conversation-binding-CTSLDM9S.mjs} +85 -119
- package/dist/.setup/{conversation-binding-data-DJ4ix-W5.mjs → conversation-binding-data-UgLuTSQT.mjs} +9 -8
- package/dist/.setup/{conversation-control-CYsMlCuE.mjs → conversation-control-GXM3unE4.mjs} +7 -10
- package/dist/.setup/{cyber-failover-Bb1J6hS1.mjs → cyber-failover-D4dgNfFf.mjs} +2 -5
- package/dist/.setup/{cyber-failover-notice-XR03ef31.mjs → cyber-failover-notice-ljgGGL0s.mjs} +1 -1
- package/dist/.setup/{doctor-start-options-DPW9JxIE.mjs → doctor-start-options-JjTAl-q_.mjs} +5 -5
- package/dist/.setup/{dynamic-tool-build-C8xGEXmR.mjs → dynamic-tool-build-D731PCdv.mjs} +57 -69
- package/dist/.setup/{dynamic-tools-DyERJnR6.mjs → dynamic-tools-D0pYbxHH.mjs} +689 -710
- package/dist/.setup/{effective-mcp-catalog-C26Mio5l.mjs → effective-mcp-catalog-1hWFKghy.mjs} +11 -20
- package/dist/.setup/{elicitation-input-r9axtppm.mjs → elicitation-input-DXG_qaXr.mjs} +14 -20
- package/dist/.setup/{ephemeral-turn-D8VcDTNo.mjs → ephemeral-turn-Cphy5Qr_.mjs} +3 -3
- package/dist/.setup/{event-projector-assistant-message-BN7CNUB5.mjs → event-projector-assistant-message-CLMKN4x-.mjs} +2 -2
- package/dist/.setup/{event-projector-usage-03R0I2dM.mjs → event-projector-usage-BpKfdoTm.mjs} +20 -33
- package/dist/.setup/{event-projector-values-DTqZHizf.mjs → event-projector-values-CLvG1Hil.mjs} +4 -5
- package/dist/.setup/history-rejection-B4nOXNXF.mjs +13 -0
- package/dist/.setup/{inference-context-D-9gWlTR.mjs → inference-context-DNlGwzwy.mjs} +10 -11
- package/dist/.setup/{inference-dispatch-B5UKEUyC.mjs → inference-dispatch-CO6tTs4q.mjs} +5 -4
- package/dist/.setup/{inference-metadata-CgIf7sOx.mjs → inference-metadata-DCvcG_N_.mjs} +36 -41
- package/dist/.setup/{inference-proxy-DUO5E2QQ.mjs → inference-proxy-BDWV0djM.mjs} +10 -14
- package/dist/.setup/{isolated-completion-C0jrcplS.mjs → isolated-completion-Bhqd2yBq.mjs} +8 -8
- package/dist/.setup/local-runtime-attribution-CZz2DJ4q.mjs +15 -0
- package/dist/.setup/{managed-binary-C1VFoVPf.mjs → managed-binary-BtIjV7yN.mjs} +16 -36
- package/dist/.setup/{mcp-app-session-preparation-BxN0_CYe.mjs → mcp-app-session-preparation-DqSvxFqc.mjs} +24 -25
- package/dist/.setup/{mcp-tool-metadata-j10HhfTC.mjs → mcp-tool-metadata-DW41snf3.mjs} +1 -1
- package/dist/.setup/{model-catalog-DZyNeDKG.mjs → model-catalog-B227ST3D.mjs} +6 -6
- package/dist/.setup/{models-DSseKSMg.mjs → models-DdRyi93L.mjs} +6 -10
- package/dist/.setup/{native-auth-Cjb9y7IZ.mjs → native-auth-esN5MdIv.mjs} +5 -5
- package/dist/.setup/{native-execution-policy-ClzpdG3D.mjs → native-execution-policy-MXEe7PB3.mjs} +11 -28
- package/dist/.setup/native-hook-relay-BUWIOrSr.mjs +561 -0
- package/dist/.setup/{native-mcp-app-CqcPVmhH.mjs → native-mcp-app-CjxJQ4F7.mjs} +6 -6
- package/dist/.setup/native-skill-isolation-UMVoNjZz.mjs +391 -0
- package/dist/.setup/{native-subagent-monitor-BUYOUp9X.mjs → native-subagent-monitor-iHc8oLg5.mjs} +505 -639
- package/dist/.setup/{native-subagent-pending-assignments-BDqhOdJp.mjs → native-subagent-pending-assignments-DmVhedNs.mjs} +11 -23
- package/dist/.setup/{native-task-assignments-C6KVqiN1.mjs → native-task-assignments-DimsQ9Qa.mjs} +73 -27
- package/dist/.setup/{node-cli-sessions-B5oNDkUS.mjs → node-cli-sessions-CzKg2nGq.mjs} +18 -26
- package/dist/.setup/{node-exec-server.runtime-0xSEjKYt.mjs → node-exec-server.runtime-BWkULhBM.mjs} +5 -8
- package/dist/.setup/{plan-BJ37d2Og.mjs → plan-C_F3aio0.mjs} +40 -50
- package/dist/.setup/{plugin-activation-BcyBv8PG.mjs → plugin-activation-D7WkJMvU.mjs} +4 -5
- package/dist/.setup/{plugin-app-cache-key-BW8rd98k.mjs → plugin-app-cache-key-Bg9DbDI6.mjs} +18 -23
- package/dist/.setup/{plugin-approval-roundtrip-CuahdPLC.mjs → plugin-approval-roundtrip-BSV-51ig.mjs} +4 -6
- package/dist/.setup/{plugin-inventory-Bf0_piTw.mjs → plugin-inventory-CYgdo14P.mjs} +28 -43
- package/dist/.setup/{plugin-marketplace-discovery-SQPhSuic.mjs → plugin-marketplace-discovery-BblHM3DU.mjs} +7 -10
- package/dist/.setup/{plugin-metadata-cache-DWnB7VMj.mjs → plugin-metadata-cache-Bi8TAPwX.mjs} +5 -10
- package/dist/.setup/project-doc-thread-config-BVcvnps8.mjs +490 -0
- package/dist/.setup/{provider-BnwHVD_z.mjs → provider-BJ4xhaGX.mjs} +4 -4
- package/dist/.setup/{provider-capabilities-D68Whix6.mjs → provider-capabilities-CjRaV3bx.mjs} +1 -1
- package/dist/.setup/{rate-limits-CMPy24F5.mjs → rate-limits-CI8pTPqL.mjs} +15 -32
- package/dist/.setup/reasoning-effort-CS9kKWB9.mjs +37 -0
- package/dist/.setup/{request-jSbhc1sg.mjs → request-Y8dmbqZ3.mjs} +28 -48
- package/dist/.setup/{rpc-error-hmWM21RB.mjs → rpc-error-C98SHchT.mjs} +3 -6
- package/dist/.setup/{run-attempt-BLDZeYLD.mjs → run-attempt-Dx7a4Mfm.mjs} +927 -849
- package/dist/.setup/{run-attempt-lifecycle-BuZgVbDA.mjs → run-attempt-lifecycle-KN4oh-7O.mjs} +13 -4
- package/dist/.setup/{runtime-artifact-CUTOOnKw.mjs → runtime-artifact-C13pR7tD.mjs} +18 -22
- package/dist/.setup/{runtime-artifact-connection-CADz3_BY.mjs → runtime-artifact-connection-jS5DeCok.mjs} +3 -3
- package/dist/.setup/{sandbox-guard-WqE8yPge.mjs → sandbox-guard-DIImwCy1.mjs} +4 -6
- package/dist/.setup/service-tier-normalization-BPgw2Wdt.mjs +9 -0
- package/dist/.setup/{session-binding-Ce7BqiPN.mjs → session-binding-JEHNMPsr.mjs} +13 -40
- package/dist/.setup/{session-binding-record-BZB8RgcF.mjs → session-binding-record-DU_0biMD.mjs} +4 -4
- package/dist/.setup/{session-binding-record-codec-z4ZpDn6E.mjs → session-binding-record-codec-BpH8u_G9.mjs} +16 -39
- package/dist/.setup/{session-binding-sidecars-BrdV95Fg.mjs → session-binding-sidecars-DD-enC8w.mjs} +49 -54
- package/dist/.setup/{session-catalog-adoption-CPIP4S_y.mjs → session-catalog-adoption-Ca3OYGYM.mjs} +23 -27
- package/dist/.setup/{session-catalog-archive-DcgwvSbF.mjs → session-catalog-archive-Bv6gV7x9.mjs} +6 -6
- package/dist/.setup/{session-catalog-events-Bdjw9HEn.mjs → session-catalog-events-DzFlXNUe.mjs} +6 -5
- package/dist/.setup/{session-catalog-index-DufISKJ6.mjs → session-catalog-index-DozvkUPd.mjs} +111 -105
- package/dist/.setup/{session-catalog-index-order-nhyO0wdW.mjs → session-catalog-index-order-CTfoefow.mjs} +28 -5
- package/dist/.setup/{session-catalog-limits-DEU36Qlo.mjs → session-catalog-limits-BynIoOYm.mjs} +1 -1
- package/dist/.setup/{session-catalog-list-request-tXephOB4.mjs → session-catalog-list-request-D4MYNgDB.mjs} +11 -8
- package/dist/.setup/{session-catalog-native-projection-D6IiLtMb.mjs → session-catalog-native-projection-rCKnZud1.mjs} +5 -61
- package/dist/.setup/{session-catalog-node-adoption-7-WEQTB1.mjs → session-catalog-node-adoption-BdP9Zjqo.mjs} +2 -2
- package/dist/.setup/{session-catalog-node-continue-DLWBwAAO.mjs → session-catalog-node-continue-CNJibO4_.mjs} +27 -49
- package/dist/.setup/{session-catalog-node-lookup-Uufckwcm.mjs → session-catalog-node-lookup-BH_DBGa9.mjs} +3 -3
- package/dist/.setup/{session-catalog-parsing-B-qWJh2x.mjs → session-catalog-parsing-DkeoVn60.mjs} +9 -19
- package/dist/.setup/{session-catalog-projection-8aHNwzWD.mjs → session-catalog-projection-DDVmALHj.mjs} +8 -22
- package/dist/.setup/session-catalog-source-CygTGmrb.mjs +58 -0
- package/dist/.setup/{session-cli-kH4vuGod.mjs → session-cli-GwU0izn-.mjs} +20 -41
- package/dist/.setup/{session-history-BogBHKLk.mjs → session-history-BO6i_pfk.mjs} +1 -1
- package/dist/.setup/{session-history-import-NWKPa4ZO.mjs → session-history-import-CaO8s6ta.mjs} +4 -4
- package/dist/.setup/{session-history-read-CNN8zwbD.mjs → session-history-read-BI_2jRED.mjs} +4 -15
- package/dist/.setup/{session-history.worker-Cq_4DYgN.mjs → session-history.worker-DJQfek5p.mjs} +147 -159
- package/dist/.setup/{session-initialization-D6dtFQkE.mjs → session-initialization-Bi_2DKhc.mjs} +3 -5
- package/dist/.setup/{session-permission-policy-BxIUJ0Zd.mjs → session-permission-policy-CD2MAWU8.mjs} +12 -20
- package/dist/.setup/{session-retirement-Czbchv_O.mjs → session-retirement-IoS3zr17.mjs} +7 -7
- package/dist/.setup/{settled-turn-context-BZsMjkIO.mjs → settled-turn-context-BPL6D3RO.mjs} +1 -1
- package/dist/.setup/{settled-turn-finalizer-DjZsIwbZ.mjs → settled-turn-finalizer-X-Fylp-u.mjs} +12 -11
- package/dist/.setup/{shared-client-qhyYWbew.mjs → shared-client-ByIwuAC-.mjs} +172 -229
- package/dist/.setup/{side-question-D3NJlgbl.mjs → side-question-BDUdozFy.mjs} +116 -137
- package/dist/.setup/{source-BYu0T780.mjs → source-Bxbqf3S1.mjs} +37 -56
- package/dist/.setup/thread-archive-guard-LKdwQKyr.mjs +56 -0
- package/dist/.setup/{thread-lifecycle-Cbz_7ySv.mjs → thread-lifecycle-run-CfP4PnEf.mjs} +348 -484
- package/dist/.setup/thread-model-selection-DcVebr8N.mjs +61 -0
- package/dist/.setup/{thread-ownership-DwuSrt3s.mjs → thread-ownership-Be53aiaG.mjs} +5 -5
- package/dist/.setup/{thread-ownership-queue-Dp24d7-F.mjs → thread-ownership-queue-CeyYScUC.mjs} +5 -6
- package/dist/.setup/{thread-policy-DoNxbhqt.mjs → thread-policy-CHgY-KNl.mjs} +4 -4
- package/dist/.setup/thread-requests-BgzJwJtS.mjs +745 -0
- package/dist/.setup/{thread-resume-BT6NHMkM.mjs → thread-resume-B2EmMcgE.mjs} +5 -5
- package/dist/.setup/{timeout-CXOfNoaX.mjs → timeout-D0mEWSGG.mjs} +6 -12
- package/dist/.setup/{transcript-history-projection-B9a7HwUV.mjs → transcript-history-projection-DfKcoZCB.mjs} +3 -4
- package/dist/.setup/{transcript-mirror-BfLRARNL.mjs → transcript-mirror-Bee2o6jj.mjs} +68 -68
- package/dist/.setup/{transcript-mirror-attestation-YSegaktH.mjs → transcript-mirror-attestation-BzUXnrvv.mjs} +5 -2
- package/dist/.setup/{transport-stdio-a0HDa2Mj.mjs → transport-stdio-CRWTkKOn.mjs} +67 -77
- package/dist/.setup/{transport-websocket-zqJ0Cmtn.mjs → transport-websocket-DIyPfkHo.mjs} +8 -16
- package/dist/.setup/{turn-router-sS69wYnI.mjs → turn-router-DKDAziUW.mjs} +30 -31
- package/dist/.setup/upstream-prompt-provenance-Ccd9MFRJ.mjs +44 -0
- package/dist/.setup/{upstream-session-fork-ChSld66u.mjs → upstream-session-fork-Djp_yssT.mjs} +50 -43
- package/dist/.setup/{usage-D8e8Xiqf.mjs → usage-DQA-peQC.mjs} +4 -4
- package/dist/.setup/{usage-limit-error-GbT-5NcW.mjs → usage-limit-error-2t3KBqiX.mjs} +12 -21
- package/dist/.setup/web-search-item-CvokaZOo.mjs +20 -0
- package/dist/.setup/{web-search-provider.runtime-dL2GD1Kl.mjs → web-search-provider.runtime-BsuCMNix.mjs} +3 -3
- package/dist/.setup/{workspace-write-sandbox-probe-DmUHLrrl.mjs → workspace-write-sandbox-probe-BDWO2Qkh.mjs} +4 -4
- package/dist/api.js +15 -15
- package/dist/catalog-page.worker.js +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/doctor-contract-api.js +5 -6
- package/dist/harness.js +32 -61
- package/dist/index.js +302 -416
- package/dist/media-understanding-provider.js +32 -43
- package/dist/migration-provider-api.js +1 -1
- package/dist/native-session-binding-api.js +1 -1
- package/dist/native-tool-policy.js +23 -1
- package/dist/provider-discovery.js +1 -1
- package/dist/session-history-worker-runtime.js +52 -31
- package/dist/session-history.worker.js +1 -1
- package/openclaw.plugin.json +20 -3
- package/package.json +7 -7
- package/dist/.setup/attempt-terminal-gZrxQ35N.mjs +0 -5
- package/dist/.setup/plugin-thread-config-deadline-B8LGaZNW.mjs +0 -124
- package/dist/.setup/service-tier-normalization-Cei89SW6.mjs +0 -15
- package/dist/.setup/shell-dynamic-tools-D3Brj3g9.mjs +0 -85
- package/dist/.setup/thread-archive-guard-C9frICzX.mjs +0 -60
- package/dist/.setup/thread-requests-CL1e8Wmx.mjs +0 -2111
- package/dist/.setup/upstream-prompt-provenance-fXkKbPVC.mjs +0 -37
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { a as readCodexCatalogDecodeRoute, c as isRpcResponse, i as listenCodexAppServerLines, n as projectCodexCatalogMessage, o as CodexAppServerMessageDecoder, r as createCodexAppServerMessageWriter, s as redactCodexAppServerLinePreview } from "./client-catalog-response-
|
|
1
|
+
import { a as readCodexCatalogDecodeRoute, c as isRpcResponse, i as listenCodexAppServerLines, n as projectCodexCatalogMessage, o as CodexAppServerMessageDecoder, r as createCodexAppServerMessageWriter, s as redactCodexAppServerLinePreview } from "./client-catalog-response-DsbEAtpd.mjs";
|
|
2
2
|
import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
|
|
3
|
-
import { c as MIN_SUPPORTED_CODEX_APP_SERVER_VERSION, s as CODEX_APP_SERVER_VERSION } from "./managed-binary-
|
|
4
|
-
import { a as
|
|
5
|
-
import { i as CodexAppServerScopedRequestRejectedError, n as CodexAppServerLocalRequestCancellationError, o as isCodexAppServerOverloadError, r as CodexAppServerRpcError, t as CODEX_APP_SERVER_OVERLOADED_ERROR_CODE } from "./rpc-error-
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { c as MIN_SUPPORTED_CODEX_APP_SERVER_VERSION, s as CODEX_APP_SERVER_VERSION } from "./managed-binary-BtIjV7yN.mjs";
|
|
4
|
+
import { a as closeCodexAppServerTransport, l as getCodexAppServerRegisteredTransportIdentity, o as closeCodexAppServerTransportAndWait, s as hasCodexAppServerNaturalExit, t as createStdioTransport } from "./transport-stdio-CRWTkKOn.mjs";
|
|
5
|
+
import { i as CodexAppServerScopedRequestRejectedError, n as CodexAppServerLocalRequestCancellationError, o as isCodexAppServerOverloadError, r as CodexAppServerRpcError, t as CODEX_APP_SERVER_OVERLOADED_ERROR_CODE } from "./rpc-error-C98SHchT.mjs";
|
|
6
|
+
import { n as codexCatalogSourceForClient, s as recordCodexCatalogResponseSource, t as closeCodexCatalogClientSource } from "./session-catalog-source-CygTGmrb.mjs";
|
|
7
|
+
import { i as reuseCodexCatalogPreview } from "./session-catalog-native-projection-rCKnZud1.mjs";
|
|
8
|
+
import { n as resolveCodexAppServerRuntimeOptions } from "./config-runtime-DWzK-k0n.mjs";
|
|
8
9
|
import { codexCatalogPageWorkerEntrypoint } from "../catalog-page-worker-entrypoint.js";
|
|
9
|
-
import { t as createWebSocketTransport } from "./transport-websocket-
|
|
10
|
-
import { t as __exportAll } from "./session-binding-sidecars-
|
|
10
|
+
import { t as createWebSocketTransport } from "./transport-websocket-DIyPfkHo.mjs";
|
|
11
|
+
import { t as __exportAll } from "./session-binding-sidecars-DD-enC8w.mjs";
|
|
11
12
|
import { isRecord, normalizeOptionalString, readStringField } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
12
13
|
import { randomUUID } from "node:crypto";
|
|
13
14
|
import { normalizeJsonSchemaForTypeBox } from "openclaw/plugin-sdk/json-schema-runtime";
|
|
14
15
|
import { addSafeTimeoutDelayGraceMs, addTimerTimeoutGraceMs, parseStrictNonNegativeInteger } from "openclaw/plugin-sdk/number-runtime";
|
|
16
|
+
import { sliceUtf16Safe, truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
15
17
|
import path from "node:path";
|
|
16
18
|
import { coerceErrorMessage, toStringifiedError } from "openclaw/plugin-sdk/error-runtime";
|
|
17
|
-
import { sliceUtf16Safe, truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
18
19
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
19
|
-
import { hasPendingInternalDiagnosticEvent } from "openclaw/plugin-sdk/diagnostic-runtime";
|
|
20
20
|
import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
|
|
21
21
|
import { OPENCLAW_VERSION, embeddedAgentLog, formatToolExecutionErrorMessage, normalizeQuestionTimeoutSeconds, resolveToolExecutionErrorKind } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
22
22
|
import { sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
|
|
@@ -30,8 +30,9 @@ const CATALOG_WORKER_IDLE_MS = 6e4;
|
|
|
30
30
|
const runInCatalogWorkerContext = AsyncLocalStorage.snapshot();
|
|
31
31
|
/** Late responses retain their decode route after cancellation removes the waiter. */
|
|
32
32
|
function codexCatalogRequestId(method, params, sequence, catalogPreview) {
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
if (!catalogPreview) return sequence;
|
|
34
|
+
const thread = method === "thread/read" && isJsonObject(params) && params.includeTurns !== true;
|
|
35
|
+
return method === "thread/list" || thread ? Number.MAX_SAFE_INTEGER - 2 * sequence - (thread ? 1 : 0) : sequence;
|
|
35
36
|
}
|
|
36
37
|
/** Each physical client owns one decoder, including incomplete-line recovery state. */
|
|
37
38
|
var CodexCatalogWorker = class {
|
|
@@ -43,7 +44,7 @@ var CodexCatalogWorker = class {
|
|
|
43
44
|
get continuation() {
|
|
44
45
|
return this.continuationRoute;
|
|
45
46
|
}
|
|
46
|
-
async decode(line, route, attempts
|
|
47
|
+
async decode(line, route, attempts) {
|
|
47
48
|
if (this.closed) return;
|
|
48
49
|
if (!this.continuationRoute && route !== "unresolved" && line.byteLength <= INLINE_CATALOG_MAX_BYTES) {
|
|
49
50
|
let parsed;
|
|
@@ -54,7 +55,7 @@ var CodexCatalogWorker = class {
|
|
|
54
55
|
await Promise.resolve();
|
|
55
56
|
if (this.closed) return;
|
|
56
57
|
const attempt = attempts.get(route.id);
|
|
57
|
-
const projection = attempt
|
|
58
|
+
const projection = attempt?.catalogProjection;
|
|
58
59
|
return projectCodexCatalogMessage(parsed, {
|
|
59
60
|
route,
|
|
60
61
|
remainingRows: attempt ? projection?.remainingRows : 0
|
|
@@ -70,6 +71,7 @@ var CodexCatalogWorker = class {
|
|
|
70
71
|
if (this.closed) return;
|
|
71
72
|
this.pool = new WorkerTaskPool({
|
|
72
73
|
workerUrl: resolveRuntimeWorkerUrl(codexCatalogPageWorkerEntrypoint),
|
|
74
|
+
workerClass: "singleton",
|
|
73
75
|
maxWorkers: 1,
|
|
74
76
|
maxPendingTasks: 1,
|
|
75
77
|
maxPendingBytes: Number.MAX_SAFE_INTEGER,
|
|
@@ -78,16 +80,16 @@ var CodexCatalogWorker = class {
|
|
|
78
80
|
});
|
|
79
81
|
}
|
|
80
82
|
const attempt = route === "unresolved" ? void 0 : attempts.get(route.id);
|
|
81
|
-
const remainingRows = attempt ?
|
|
83
|
+
const remainingRows = attempt ? attempt.catalogProjection?.remainingRows : 0;
|
|
82
84
|
let catalogRows;
|
|
83
85
|
if (route === "unresolved") {
|
|
84
86
|
catalogRows = /* @__PURE__ */ new Map();
|
|
85
87
|
for (const [id, pending] of attempts) {
|
|
86
|
-
const projection =
|
|
88
|
+
const projection = pending.catalogProjection;
|
|
87
89
|
if (typeof id === "number" && projection) catalogRows.set(id, projection.remainingRows);
|
|
88
90
|
}
|
|
89
91
|
}
|
|
90
|
-
const bytes = line.
|
|
92
|
+
const bytes = line.byteLength === line.buffer.byteLength && line.buffer instanceof ArrayBuffer ? new Uint8Array(line.buffer) : Uint8Array.from(line);
|
|
91
93
|
const decoded = await this.pool.run({
|
|
92
94
|
bytes,
|
|
93
95
|
route,
|
|
@@ -314,8 +316,8 @@ var CodexAppServerVersionError = class extends Error {
|
|
|
314
316
|
constructor(detectedVersion) {
|
|
315
317
|
const detected = detectedVersion ? `detected ${detectedVersion}` : "OpenClaw could not determine the running Codex version";
|
|
316
318
|
super(`Codex app-server ${MIN_SUPPORTED_CODEX_APP_SERVER_VERSION} or newer is required, but ${detected}. Update the configured Codex app-server binary, or remove custom command overrides to use the managed binary.`);
|
|
317
|
-
this.name = "CodexAppServerVersionError";
|
|
318
319
|
this.detectedVersion = detectedVersion;
|
|
320
|
+
this.name = "CodexAppServerVersionError";
|
|
319
321
|
}
|
|
320
322
|
};
|
|
321
323
|
function assertSupportedCodexAppServerVersion(response) {
|
|
@@ -381,7 +383,7 @@ var CodexAppServerNotifications = class {
|
|
|
381
383
|
//#endregion
|
|
382
384
|
//#region extensions/codex/src/app-server/client-response.ts
|
|
383
385
|
/** Settles one wire attempt and reports newly observed native execution. */
|
|
384
|
-
function dispatchCodexAppServerResponse(response, attempts,
|
|
386
|
+
function dispatchCodexAppServerResponse(response, attempts, source, previewStates) {
|
|
385
387
|
const pending = attempts.get(response.id);
|
|
386
388
|
if (!pending) return false;
|
|
387
389
|
attempts.delete(response.id);
|
|
@@ -391,7 +393,7 @@ function dispatchCodexAppServerResponse(response, attempts, catalogResponses, so
|
|
|
391
393
|
return false;
|
|
392
394
|
}
|
|
393
395
|
const nativeExecution = pending.method === "thread/backgroundTerminals/list" && isJsonObject(response.result) && Array.isArray(response.result.data) && response.result.data.length > 0;
|
|
394
|
-
const cache =
|
|
396
|
+
const cache = pending.catalogProjection?.preview;
|
|
395
397
|
if (cache && previewStates && isJsonObject(response.result) && Array.isArray(response.result.data)) try {
|
|
396
398
|
for (const [index, row] of response.result.data.entries()) if (isJsonObject(row) && typeof row.id === "string" && row.ephemeral !== true) {
|
|
397
399
|
const preview = reuseCodexCatalogPreview({
|
|
@@ -500,16 +502,13 @@ function createCodexRequestAttempt(params) {
|
|
|
500
502
|
let timer;
|
|
501
503
|
let removeAbort;
|
|
502
504
|
const waiterAttachedAtMs = diagnostics && observe ? performance.now() : 0;
|
|
503
|
-
const
|
|
505
|
+
const detach = (waiterOutcome) => {
|
|
506
|
+
if (!waiter) return false;
|
|
507
|
+
waiter = void 0;
|
|
504
508
|
clearTimeout(timer);
|
|
505
509
|
timer = void 0;
|
|
506
510
|
removeAbort?.();
|
|
507
511
|
removeAbort = void 0;
|
|
508
|
-
};
|
|
509
|
-
const detach = (waiterOutcome) => {
|
|
510
|
-
if (!waiter) return false;
|
|
511
|
-
waiter = void 0;
|
|
512
|
-
cleanup();
|
|
513
512
|
if (!params.retainWritten || !mayHaveWritten) finish(mayHaveWritten ? "correlation-closed" : "not-written");
|
|
514
513
|
observeAttempt({
|
|
515
514
|
kind: "waiter",
|
|
@@ -623,20 +622,18 @@ function failedToolResult(message, status = "failed") {
|
|
|
623
622
|
//#endregion
|
|
624
623
|
//#region extensions/codex/src/app-server/tool-abort-terminal-reason.ts
|
|
625
624
|
/** Leaf helper shared by native and dynamic tool diagnostics. */
|
|
626
|
-
const
|
|
627
|
-
"codex_startup_timeout",
|
|
628
|
-
"turn_completion_idle_timeout",
|
|
629
|
-
"turn_progress_idle_timeout",
|
|
630
|
-
"turn_terminal_idle_timeout"
|
|
625
|
+
const CODEX_ABORT_TERMINAL_REASONS = /* @__PURE__ */ new Map([
|
|
626
|
+
["codex_startup_timeout", "timed_out"],
|
|
627
|
+
["turn_completion_idle_timeout", "timed_out"],
|
|
628
|
+
["turn_progress_idle_timeout", "timed_out"],
|
|
629
|
+
["turn_terminal_idle_timeout", "timed_out"],
|
|
630
|
+
["client_closed", "failed"]
|
|
631
631
|
]);
|
|
632
632
|
/** Preserves timeout provenance when an enclosing run aborts an active tool. */
|
|
633
633
|
function resolveCodexToolAbortTerminalReason(signal) {
|
|
634
634
|
try {
|
|
635
635
|
const reason = signal.reason;
|
|
636
|
-
if (typeof reason === "string")
|
|
637
|
-
if (CODEX_TIMEOUT_ABORT_REASONS.has(reason)) return "timed_out";
|
|
638
|
-
return reason === "client_closed" ? "failed" : "cancelled";
|
|
639
|
-
}
|
|
636
|
+
if (typeof reason === "string") return CODEX_ABORT_TERMINAL_REASONS.get(reason) ?? "cancelled";
|
|
640
637
|
if (reason && typeof reason === "object") {
|
|
641
638
|
const record = reason;
|
|
642
639
|
if (record.name === "TimeoutError" || record.reason === "timeout") return "timed_out";
|
|
@@ -707,151 +704,150 @@ function formatDynamicToolTimeoutDetails(params) {
|
|
|
707
704
|
};
|
|
708
705
|
}
|
|
709
706
|
async function handleDynamicToolCallWithTimeout(params) {
|
|
710
|
-
return await runWithAsyncWorkResources((onAcquired) =>
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
...
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
response
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
response
|
|
707
|
+
return await runWithAsyncWorkResources(async (onAcquired) => {
|
|
708
|
+
let didNotifyAgentToolResult = false;
|
|
709
|
+
const conservativeRaceResponses = /* @__PURE__ */ new WeakSet();
|
|
710
|
+
const finalizeTerminal = (response) => {
|
|
711
|
+
const executionSnapshot = params.toolBridge.consumeToolExecutionSnapshot?.(params.call.callId);
|
|
712
|
+
const ownerKey = params.toolBridge.sideEffectOwnerKeyForTool?.(params.call.tool);
|
|
713
|
+
const observedExecutionStarted = executionSnapshot?.executionStarted ?? (conservativeRaceResponses.has(response) ? void 0 : response.executionStarted);
|
|
714
|
+
const terminalResolution = params.observeToolTerminal?.({
|
|
715
|
+
toolCallId: params.call.callId,
|
|
716
|
+
toolName: params.call.tool,
|
|
717
|
+
result: copyInternalToolResultState(response, {
|
|
718
|
+
...response,
|
|
719
|
+
details: response.transcriptDetails
|
|
720
|
+
}),
|
|
721
|
+
arguments: response.executedArguments ?? executionSnapshot?.executedArguments ?? params.call.arguments,
|
|
722
|
+
...params.toolMeta ? { meta: params.toolMeta } : {},
|
|
723
|
+
...ownerKey ? { ownerMutation: { ownerKey } } : {},
|
|
724
|
+
replaySafe: ownerKey ? false : response.replaySafe,
|
|
725
|
+
...observedExecutionStarted !== void 0 ? { executionStarted: observedExecutionStarted } : {},
|
|
726
|
+
outcome: response.success ? "success" : "failure",
|
|
727
|
+
...!response.success ? { failure: { error: readDynamicToolResponseText(response) } } : {}
|
|
728
|
+
});
|
|
729
|
+
if (terminalResolution) {
|
|
730
|
+
response.terminalResolution = terminalResolution;
|
|
731
|
+
response.executionStarted = terminalResolution.executionStarted;
|
|
732
|
+
response.executedArguments = terminalResolution.executedArguments ?? response.executedArguments;
|
|
733
|
+
response.sideEffectEvidence = terminalResolution.sideEffectEvidence || void 0;
|
|
734
|
+
}
|
|
735
|
+
return response;
|
|
736
|
+
};
|
|
737
|
+
const createFailedAfterPossibleDispatch = (message, terminalReason) => {
|
|
738
|
+
const response = createFailedDynamicToolResponse(message, {
|
|
739
|
+
executionStarted: true,
|
|
740
|
+
sideEffectEvidence: true,
|
|
741
|
+
terminalReason
|
|
742
|
+
});
|
|
743
|
+
conservativeRaceResponses.add(response);
|
|
744
|
+
return response;
|
|
745
|
+
};
|
|
746
|
+
const notifyAgentToolResult = (event) => {
|
|
747
|
+
if (didNotifyAgentToolResult) return;
|
|
748
|
+
didNotifyAgentToolResult = true;
|
|
749
|
+
try {
|
|
750
|
+
params.onAgentToolResult?.(event);
|
|
751
|
+
} catch (error) {
|
|
752
|
+
const message = formatToolExecutionErrorMessage(error, "Unknown error");
|
|
753
|
+
embeddedAgentLog.warn(`onAgentToolResult handler failed: tool=${params.call.tool} error=${message}`);
|
|
754
|
+
}
|
|
755
|
+
};
|
|
756
|
+
const notifyFailedToolResult = (message, terminalReason = "failed") => {
|
|
757
|
+
notifyAgentToolResult({
|
|
758
|
+
toolName: params.call.tool,
|
|
759
|
+
result: failedToolResult(message, terminalReason),
|
|
760
|
+
isError: true
|
|
761
|
+
});
|
|
762
|
+
};
|
|
763
|
+
if (params.signal.aborted) {
|
|
764
|
+
const message = "OpenClaw dynamic tool call aborted before execution.";
|
|
765
|
+
const terminalReason = resolveCodexToolAbortTerminalReason(params.signal);
|
|
766
|
+
params.onFallbackSelected?.();
|
|
767
|
+
notifyFailedToolResult(message, terminalReason);
|
|
768
|
+
return finalizeTerminal(createFailedDynamicToolResponse(message, {
|
|
769
|
+
executionStarted: false,
|
|
770
|
+
terminalReason
|
|
771
|
+
}));
|
|
742
772
|
}
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
773
|
+
const controller = new AbortController();
|
|
774
|
+
let timeout;
|
|
775
|
+
let timedOut = false;
|
|
776
|
+
let toolCallSettled = false;
|
|
777
|
+
let completedSuccessfully = false;
|
|
778
|
+
let operationReleased = false;
|
|
779
|
+
let resolveAbort;
|
|
780
|
+
const abortFromRun = () => {
|
|
781
|
+
const message = "OpenClaw dynamic tool call aborted.";
|
|
782
|
+
const terminalReason = resolveCodexToolAbortTerminalReason(params.signal);
|
|
783
|
+
controller.abort(params.signal.reason ?? /* @__PURE__ */ new Error(message));
|
|
784
|
+
if (toolCallSettled) return;
|
|
785
|
+
params.onFallbackSelected?.();
|
|
786
|
+
notifyFailedToolResult(message, terminalReason);
|
|
787
|
+
resolveAbort?.(createFailedAfterPossibleDispatch(message, terminalReason));
|
|
788
|
+
};
|
|
789
|
+
const releaseOperation = () => {
|
|
790
|
+
if (operationReleased) return;
|
|
791
|
+
operationReleased = true;
|
|
792
|
+
params.signal.removeEventListener("abort", abortFromRun);
|
|
793
|
+
if (!controller.signal.aborted) controller.abort(/* @__PURE__ */ new Error("OpenClaw dynamic tool call finished."));
|
|
794
|
+
};
|
|
795
|
+
onAcquired({
|
|
796
|
+
release: releaseOperation,
|
|
797
|
+
releaseBeforeResultWhenIdle: true
|
|
798
|
+
});
|
|
799
|
+
const abortPromise = new Promise((resolve) => {
|
|
800
|
+
resolveAbort = resolve;
|
|
801
|
+
});
|
|
802
|
+
const timeoutPromise = new Promise((resolve) => {
|
|
803
|
+
const { timeoutMs } = params;
|
|
804
|
+
timeout = setTimeout(() => {
|
|
805
|
+
timedOut = true;
|
|
806
|
+
const timeoutDetails = formatDynamicToolTimeoutDetails({
|
|
807
|
+
call: params.call,
|
|
808
|
+
timeoutMs
|
|
809
|
+
});
|
|
810
|
+
params.onFallbackSelected?.();
|
|
811
|
+
controller.abort(new Error(timeoutDetails.responseMessage));
|
|
812
|
+
params.onTimeout?.();
|
|
813
|
+
embeddedAgentLog.warn("codex dynamic tool call timed out", {
|
|
814
|
+
...timeoutDetails.meta,
|
|
815
|
+
consoleMessage: timeoutDetails.consoleMessage
|
|
816
|
+
});
|
|
817
|
+
notifyFailedToolResult(timeoutDetails.responseMessage, "timed_out");
|
|
818
|
+
resolve(createFailedAfterPossibleDispatch(timeoutDetails.responseMessage, "timed_out"));
|
|
819
|
+
}, timeoutMs);
|
|
820
|
+
timeout.unref?.();
|
|
750
821
|
});
|
|
751
|
-
conservativeRaceResponses.add(response);
|
|
752
|
-
return response;
|
|
753
|
-
};
|
|
754
|
-
const notifyAgentToolResult = (event) => {
|
|
755
|
-
if (didNotifyAgentToolResult) return;
|
|
756
|
-
didNotifyAgentToolResult = true;
|
|
757
822
|
try {
|
|
758
|
-
params.
|
|
823
|
+
params.signal.addEventListener("abort", abortFromRun, { once: true });
|
|
824
|
+
if (params.signal.aborted) abortFromRun();
|
|
825
|
+
const response = await Promise.race([
|
|
826
|
+
params.toolBridge.handleToolCall(params.call, {
|
|
827
|
+
signal: controller.signal,
|
|
828
|
+
onAgentToolResult: notifyAgentToolResult,
|
|
829
|
+
toolCallOrdinal: params.toolCallOrdinal,
|
|
830
|
+
retainExecutionSnapshot: true
|
|
831
|
+
}),
|
|
832
|
+
abortPromise,
|
|
833
|
+
timeoutPromise
|
|
834
|
+
]);
|
|
835
|
+
if (!response.success && !didNotifyAgentToolResult) notifyFailedToolResult(readDynamicToolResponseText(response), response.diagnosticTerminalReason ?? "failed");
|
|
836
|
+
const terminal = finalizeTerminal(response);
|
|
837
|
+
completedSuccessfully = terminal.success;
|
|
838
|
+
return terminal;
|
|
759
839
|
} catch (error) {
|
|
760
|
-
const
|
|
761
|
-
|
|
840
|
+
const terminalReason = params.signal.aborted ? resolveCodexToolAbortTerminalReason(params.signal) : resolveToolExecutionErrorKind(error);
|
|
841
|
+
const message = formatToolExecutionErrorMessage(error, "OpenClaw dynamic tool call failed.");
|
|
842
|
+
notifyFailedToolResult(message, terminalReason);
|
|
843
|
+
return finalizeTerminal(createFailedAfterPossibleDispatch(message, terminalReason));
|
|
844
|
+
} finally {
|
|
845
|
+
clearTimeout(timeout);
|
|
846
|
+
toolCallSettled = true;
|
|
847
|
+
resolveAbort = void 0;
|
|
848
|
+
if (!completedSuccessfully || timedOut || controller.signal.aborted) releaseOperation();
|
|
762
849
|
}
|
|
763
|
-
};
|
|
764
|
-
const notifyFailedToolResult = (message, terminalReason = "failed") => {
|
|
765
|
-
notifyAgentToolResult({
|
|
766
|
-
toolName: params.call.tool,
|
|
767
|
-
result: failedToolResult(message, terminalReason),
|
|
768
|
-
isError: true
|
|
769
|
-
});
|
|
770
|
-
};
|
|
771
|
-
if (params.signal.aborted) {
|
|
772
|
-
const message = "OpenClaw dynamic tool call aborted before execution.";
|
|
773
|
-
const terminalReason = resolveCodexToolAbortTerminalReason(params.signal);
|
|
774
|
-
params.onFallbackSelected?.();
|
|
775
|
-
notifyFailedToolResult(message, terminalReason);
|
|
776
|
-
return finalizeTerminal(createFailedDynamicToolResponse(message, {
|
|
777
|
-
executionStarted: false,
|
|
778
|
-
terminalReason
|
|
779
|
-
}));
|
|
780
|
-
}
|
|
781
|
-
const controller = new AbortController();
|
|
782
|
-
let timeout;
|
|
783
|
-
let timedOut = false;
|
|
784
|
-
let toolCallSettled = false;
|
|
785
|
-
let completedSuccessfully = false;
|
|
786
|
-
let operationReleased = false;
|
|
787
|
-
let resolveAbort;
|
|
788
|
-
const abortFromRun = () => {
|
|
789
|
-
const message = "OpenClaw dynamic tool call aborted.";
|
|
790
|
-
const terminalReason = resolveCodexToolAbortTerminalReason(params.signal);
|
|
791
|
-
controller.abort(params.signal.reason ?? /* @__PURE__ */ new Error(message));
|
|
792
|
-
if (toolCallSettled) return;
|
|
793
|
-
params.onFallbackSelected?.();
|
|
794
|
-
notifyFailedToolResult(message, terminalReason);
|
|
795
|
-
resolveAbort?.(createFailedAfterPossibleDispatch(message, terminalReason));
|
|
796
|
-
};
|
|
797
|
-
const releaseOperation = () => {
|
|
798
|
-
if (operationReleased) return;
|
|
799
|
-
operationReleased = true;
|
|
800
|
-
params.signal.removeEventListener("abort", abortFromRun);
|
|
801
|
-
if (!controller.signal.aborted) controller.abort(/* @__PURE__ */ new Error("OpenClaw dynamic tool call finished."));
|
|
802
|
-
};
|
|
803
|
-
retainCleanup(releaseOperation);
|
|
804
|
-
const abortPromise = new Promise((resolve) => {
|
|
805
|
-
resolveAbort = resolve;
|
|
806
850
|
});
|
|
807
|
-
const timeoutPromise = new Promise((resolve) => {
|
|
808
|
-
const { timeoutMs } = params;
|
|
809
|
-
timeout = setTimeout(() => {
|
|
810
|
-
timedOut = true;
|
|
811
|
-
const timeoutDetails = formatDynamicToolTimeoutDetails({
|
|
812
|
-
call: params.call,
|
|
813
|
-
timeoutMs
|
|
814
|
-
});
|
|
815
|
-
params.onFallbackSelected?.();
|
|
816
|
-
controller.abort(new Error(timeoutDetails.responseMessage));
|
|
817
|
-
params.onTimeout?.();
|
|
818
|
-
embeddedAgentLog.warn("codex dynamic tool call timed out", {
|
|
819
|
-
...timeoutDetails.meta,
|
|
820
|
-
consoleMessage: timeoutDetails.consoleMessage
|
|
821
|
-
});
|
|
822
|
-
notifyFailedToolResult(timeoutDetails.responseMessage, "timed_out");
|
|
823
|
-
resolve(createFailedAfterPossibleDispatch(timeoutDetails.responseMessage, "timed_out"));
|
|
824
|
-
}, timeoutMs);
|
|
825
|
-
timeout.unref?.();
|
|
826
|
-
});
|
|
827
|
-
try {
|
|
828
|
-
params.signal.addEventListener("abort", abortFromRun, { once: true });
|
|
829
|
-
if (params.signal.aborted) abortFromRun();
|
|
830
|
-
const response = await Promise.race([
|
|
831
|
-
params.toolBridge.handleToolCall(params.call, {
|
|
832
|
-
signal: controller.signal,
|
|
833
|
-
onAgentToolResult: notifyAgentToolResult,
|
|
834
|
-
toolCallOrdinal: params.toolCallOrdinal,
|
|
835
|
-
retainExecutionSnapshot: true
|
|
836
|
-
}),
|
|
837
|
-
abortPromise,
|
|
838
|
-
timeoutPromise
|
|
839
|
-
]);
|
|
840
|
-
if (!response.success && !didNotifyAgentToolResult) notifyFailedToolResult(readDynamicToolResponseText(response), response.diagnosticTerminalReason ?? "failed");
|
|
841
|
-
const terminal = finalizeTerminal(response);
|
|
842
|
-
completedSuccessfully = terminal.success;
|
|
843
|
-
return terminal;
|
|
844
|
-
} catch (error) {
|
|
845
|
-
const terminalReason = params.signal.aborted ? resolveCodexToolAbortTerminalReason(params.signal) : resolveToolExecutionErrorKind(error);
|
|
846
|
-
const message = formatToolExecutionErrorMessage(error, "OpenClaw dynamic tool call failed.");
|
|
847
|
-
notifyFailedToolResult(message, terminalReason);
|
|
848
|
-
return finalizeTerminal(createFailedAfterPossibleDispatch(message, terminalReason));
|
|
849
|
-
} finally {
|
|
850
|
-
if (timeout) clearTimeout(timeout);
|
|
851
|
-
toolCallSettled = true;
|
|
852
|
-
resolveAbort = void 0;
|
|
853
|
-
if (!completedSuccessfully || timedOut || controller.signal.aborted) releaseOperation();
|
|
854
|
-
}
|
|
855
851
|
}
|
|
856
852
|
function readDynamicToolResponseText(response) {
|
|
857
853
|
return response.contentItems.flatMap((item) => item.type === "inputText" && typeof item.text === "string" ? [item.text] : []).join("\n").trim() || "OpenClaw dynamic tool call failed.";
|
|
@@ -863,7 +859,6 @@ function toCodexDynamicToolProtocolResponse(response) {
|
|
|
863
859
|
success: response.success
|
|
864
860
|
};
|
|
865
861
|
}
|
|
866
|
-
/** Adds async-started progress details when a tool result continues out of band. */
|
|
867
862
|
function toCodexDynamicToolProgressResponse(response, protocolResponse) {
|
|
868
863
|
const transcriptDetails = isJsonObject(response.transcriptDetails) ? response.transcriptDetails : void 0;
|
|
869
864
|
const mcpAppPreview = isJsonObject(transcriptDetails?.mcpAppPreview) ? transcriptDetails.mcpAppPreview : void 0;
|
|
@@ -877,37 +872,6 @@ function toCodexDynamicToolProgressResponse(response, protocolResponse) {
|
|
|
877
872
|
} : { mcpAppPreview }
|
|
878
873
|
};
|
|
879
874
|
}
|
|
880
|
-
function shouldReleaseTurnAfterTerminalDynamicTool(state) {
|
|
881
|
-
return !state.completed && !state.aborted && state.responseSuccess && !state.currentTurnHadNonTerminalDynamicToolResult && state.activeAppServerTurnRequests === 0 && state.activeTurnItemIdsCount === 0 && state.pendingOpenClawDynamicToolCompletionIdsCount === 0;
|
|
882
|
-
}
|
|
883
|
-
function resolveTerminalDynamicToolBatchAction(state) {
|
|
884
|
-
if (state.activeAppServerTurnRequests > 0 || state.activeTurnItemIdsCount > 0 || state.pendingOpenClawDynamicToolCompletionIdsCount > 0) return "wait";
|
|
885
|
-
if (state.currentTurnHadNonTerminalDynamicToolResult) return "clear-nonterminal-batch";
|
|
886
|
-
if (state.hasPendingTerminalDynamicToolRelease) return "release-pending-terminal";
|
|
887
|
-
return "idle";
|
|
888
|
-
}
|
|
889
|
-
function isDynamicToolTerminalDiagnosticEvent(event) {
|
|
890
|
-
return event.type === "tool.execution.completed" || event.type === "tool.execution.error" || event.type === "tool.execution.blocked";
|
|
891
|
-
}
|
|
892
|
-
function isMatchingDynamicToolTerminalDiagnostic(params) {
|
|
893
|
-
if (params.event.toolCallId !== params.call.callId || params.event.toolName !== params.call.tool) return false;
|
|
894
|
-
if (params.runId !== void 0) return params.event.runId === params.runId;
|
|
895
|
-
if (params.sessionId !== void 0) return params.event.sessionId === params.sessionId;
|
|
896
|
-
if (params.sessionKey !== void 0) return params.event.sessionKey === params.sessionKey;
|
|
897
|
-
return params.event.runId === void 0 && params.event.sessionId === void 0 && params.event.sessionKey === void 0;
|
|
898
|
-
}
|
|
899
|
-
function hasPendingDynamicToolTerminalDiagnostic(params) {
|
|
900
|
-
return hasPendingInternalDiagnosticEvent((event) => {
|
|
901
|
-
if (!isDynamicToolTerminalDiagnosticEvent(event)) return false;
|
|
902
|
-
return isMatchingDynamicToolTerminalDiagnostic({
|
|
903
|
-
event,
|
|
904
|
-
call: params.call,
|
|
905
|
-
runId: params.runId,
|
|
906
|
-
sessionId: params.sessionId,
|
|
907
|
-
sessionKey: params.sessionKey
|
|
908
|
-
});
|
|
909
|
-
});
|
|
910
|
-
}
|
|
911
875
|
function resolveDynamicToolCallTimeoutMs(params) {
|
|
912
876
|
const args = isJsonObject(params.call.arguments) ? params.call.arguments : void 0;
|
|
913
877
|
if (params.call.tool === "node_exec") {
|
|
@@ -3661,7 +3625,7 @@ var CodexServerRequests = class {
|
|
|
3661
3625
|
method: request.method,
|
|
3662
3626
|
timeoutMs
|
|
3663
3627
|
});
|
|
3664
|
-
deadline.resolve(
|
|
3628
|
+
deadline.resolve(failedToolResponse(`OpenClaw dynamic tool call timed out after ${timeoutMs}ms before sending a response to Codex.`));
|
|
3665
3629
|
controller.abort(/* @__PURE__ */ new Error("codex app-server server request timed out"));
|
|
3666
3630
|
}, timeoutMs);
|
|
3667
3631
|
timeout.unref?.();
|
|
@@ -3712,13 +3676,7 @@ var CodexServerRequests = class {
|
|
|
3712
3676
|
}
|
|
3713
3677
|
};
|
|
3714
3678
|
function defaultServerRequestResponse(request) {
|
|
3715
|
-
if (request.method === "item/tool/call") return
|
|
3716
|
-
contentItems: [{
|
|
3717
|
-
type: "inputText",
|
|
3718
|
-
text: "OpenClaw did not register a handler for this app-server tool call."
|
|
3719
|
-
}],
|
|
3720
|
-
success: false
|
|
3721
|
-
};
|
|
3679
|
+
if (request.method === "item/tool/call") return failedToolResponse("OpenClaw did not register a handler for this app-server tool call.");
|
|
3722
3680
|
if (request.method === "item/commandExecution/requestApproval" || request.method === "item/fileChange/requestApproval") return { decision: "decline" };
|
|
3723
3681
|
if (request.method === "item/permissions/requestApproval") return {
|
|
3724
3682
|
permissions: {},
|
|
@@ -3728,11 +3686,11 @@ function defaultServerRequestResponse(request) {
|
|
|
3728
3686
|
if (request.method === "mcpServer/elicitation/request") return createCodexElicitationResponse("decline", null, { message: "OpenClaw has no interactive handler for this elicitation." });
|
|
3729
3687
|
return {};
|
|
3730
3688
|
}
|
|
3731
|
-
function
|
|
3689
|
+
function failedToolResponse(text) {
|
|
3732
3690
|
return {
|
|
3733
3691
|
contentItems: [{
|
|
3734
3692
|
type: "inputText",
|
|
3735
|
-
text
|
|
3693
|
+
text
|
|
3736
3694
|
}],
|
|
3737
3695
|
success: false
|
|
3738
3696
|
};
|
|
@@ -3753,6 +3711,12 @@ var client_exports = /* @__PURE__ */ __exportAll({
|
|
|
3753
3711
|
const CODEX_APP_SERVER_STDERR_TAIL_MAX = 2e3;
|
|
3754
3712
|
const CODEX_APP_SERVER_OVERLOAD_MAX_RETRIES = 3;
|
|
3755
3713
|
const CODEX_APP_SERVER_OVERLOAD_RETRY_BASE_MS = 50;
|
|
3714
|
+
function remainingRequestTime(method, signal, deadline) {
|
|
3715
|
+
if (signal?.aborted) throw new CodexAppServerLocalRequestCancellationError(method, "aborted", false, signal.reason);
|
|
3716
|
+
const remainingMs = deadline === void 0 ? void 0 : deadline - performance.now();
|
|
3717
|
+
if (remainingMs !== void 0 && remainingMs <= 0) throw new CodexAppServerLocalRequestCancellationError(method, "timed out", false);
|
|
3718
|
+
return remainingMs;
|
|
3719
|
+
}
|
|
3756
3720
|
function isCodexAppServerRequestTimeoutError(error) {
|
|
3757
3721
|
return error instanceof Error && "code" in error && error.code === "CODEX_APP_SERVER_LOCAL_REQUEST_CANCELLED" && "reason" in error && error.reason === "timed out";
|
|
3758
3722
|
}
|
|
@@ -3766,15 +3730,18 @@ var CodexAppServerIndeterminateTransportError = class extends Error {
|
|
|
3766
3730
|
};
|
|
3767
3731
|
/** True when a local cancellation can leave an app-server request in flight. */
|
|
3768
3732
|
function isCodexAppServerIndeterminateRequestCancellationError(error) {
|
|
3769
|
-
return error
|
|
3733
|
+
return hasRequestWriteState(error, "CODEX_APP_SERVER_LOCAL_REQUEST_CANCELLED", true);
|
|
3770
3734
|
}
|
|
3771
3735
|
/** True when local cancellation happened before a request write was attempted. */
|
|
3772
3736
|
function isCodexAppServerPrewriteRequestCancellationError(error) {
|
|
3773
|
-
return error
|
|
3737
|
+
return hasRequestWriteState(error, "CODEX_APP_SERVER_LOCAL_REQUEST_CANCELLED", false);
|
|
3774
3738
|
}
|
|
3775
3739
|
/** True when transport failure cannot prove a written request stopped running. */
|
|
3776
3740
|
function isCodexAppServerIndeterminateTransportError(error) {
|
|
3777
|
-
return error
|
|
3741
|
+
return hasRequestWriteState(error, "CODEX_APP_SERVER_REQUEST_TRANSPORT_INDETERMINATE", true);
|
|
3742
|
+
}
|
|
3743
|
+
function hasRequestWriteState(error, code, written) {
|
|
3744
|
+
return error instanceof Error && "code" in error && error.code === code && "mayHaveWritten" in error && error.mayHaveWritten === written;
|
|
3778
3745
|
}
|
|
3779
3746
|
function isCodexAppServerConnectionClosedError(error) {
|
|
3780
3747
|
if (!(error instanceof Error)) return false;
|
|
@@ -3787,7 +3754,6 @@ var CodexAppServerClient = class CodexAppServerClient {
|
|
|
3787
3754
|
this.decoder = new CodexAppServerMessageDecoder(logCodexAppServerParseFailure);
|
|
3788
3755
|
this.catalogWorker = new CodexCatalogWorker();
|
|
3789
3756
|
this.pending = /* @__PURE__ */ new Map();
|
|
3790
|
-
this.catalogResponses = /* @__PURE__ */ new WeakMap();
|
|
3791
3757
|
this.serverRequests = new CodexServerRequests((response) => this.writeMessage(response));
|
|
3792
3758
|
this.notificationDispatch = new CodexAppServerNotifications();
|
|
3793
3759
|
this.closeHandlers = /* @__PURE__ */ new Set();
|
|
@@ -3983,9 +3949,7 @@ var CodexAppServerClient = class CodexAppServerClient {
|
|
|
3983
3949
|
async requestWithOverloadRetry(method, params, options, onWriteStateChange, onResponse) {
|
|
3984
3950
|
const deadline = options.timeoutMs !== void 0 && Number.isFinite(options.timeoutMs) ? performance.now() + options.timeoutMs : void 0;
|
|
3985
3951
|
for (let retry = 0;; retry += 1) {
|
|
3986
|
-
|
|
3987
|
-
const remainingTimeoutMs = deadline === void 0 ? void 0 : deadline - performance.now();
|
|
3988
|
-
if (remainingTimeoutMs !== void 0 && remainingTimeoutMs <= 0) throw new CodexAppServerLocalRequestCancellationError(method, "timed out", false);
|
|
3952
|
+
const remainingTimeoutMs = remainingRequestTime(method, options.signal, deadline);
|
|
3989
3953
|
try {
|
|
3990
3954
|
return await this.requestOnce(method, params, {
|
|
3991
3955
|
...options,
|
|
@@ -4000,14 +3964,12 @@ var CodexAppServerClient = class CodexAppServerClient {
|
|
|
4000
3964
|
}
|
|
4001
3965
|
}
|
|
4002
3966
|
async waitForOverloadRetry(method, backoffMs, deadline, signal) {
|
|
4003
|
-
|
|
4004
|
-
const remainingMs = deadline === void 0 ? void 0 : deadline - performance.now();
|
|
4005
|
-
if (remainingMs !== void 0 && remainingMs <= 0) throw new CodexAppServerLocalRequestCancellationError(method, "timed out", false);
|
|
3967
|
+
const remainingMs = remainingRequestTime(method, signal, deadline);
|
|
4006
3968
|
const delayMs = remainingMs === void 0 ? backoffMs : Math.min(backoffMs, remainingMs);
|
|
4007
3969
|
try {
|
|
4008
3970
|
await sleepWithAbort(delayMs, signal, { ref: false });
|
|
4009
3971
|
} catch (error) {
|
|
4010
|
-
|
|
3972
|
+
remainingRequestTime(method, signal);
|
|
4011
3973
|
throw error;
|
|
4012
3974
|
}
|
|
4013
3975
|
}
|
|
@@ -4041,18 +4003,17 @@ var CodexAppServerClient = class CodexAppServerClient {
|
|
|
4041
4003
|
localError: (error, written) => written && !isCodexAppServerIndeterminateRequestCancellationError(error) && !isCodexAppServerIndeterminateTransportError(error) ? new CodexAppServerIndeterminateTransportError(method, error) : error
|
|
4042
4004
|
});
|
|
4043
4005
|
this.pending.set(id, attempt);
|
|
4044
|
-
if (options.catalogPreview)
|
|
4006
|
+
if (options.catalogPreview) attempt.catalogProjection = {
|
|
4045
4007
|
preview: options.catalogPreviewCache,
|
|
4046
4008
|
remainingRows: options.catalogRows
|
|
4047
|
-
}
|
|
4009
|
+
};
|
|
4048
4010
|
const result = attempt.wait({
|
|
4049
4011
|
...options,
|
|
4050
4012
|
overloadAttemptOrdinal
|
|
4051
4013
|
}, deadline);
|
|
4052
4014
|
dispatchCodexRequestAttempt(attempt, options, () => {
|
|
4053
4015
|
if (this.closed) throw this.closeError ?? /* @__PURE__ */ new Error("codex app-server client is closed");
|
|
4054
|
-
|
|
4055
|
-
if (deadline !== void 0 && performance.now() >= deadline) throw new CodexAppServerLocalRequestCancellationError(method, "timed out", false);
|
|
4016
|
+
remainingRequestTime(method, options.signal, deadline);
|
|
4056
4017
|
}, () => {
|
|
4057
4018
|
this.writeMessage(message, (error) => attempt.failLocal(error), () => {
|
|
4058
4019
|
attempt.markWritten();
|
|
@@ -4124,13 +4085,9 @@ var CodexAppServerClient = class CodexAppServerClient {
|
|
|
4124
4085
|
}
|
|
4125
4086
|
this.privateTransportSecrets.add(secret);
|
|
4126
4087
|
}
|
|
4127
|
-
redactPrivateText(text) {
|
|
4128
|
-
let redacted = text;
|
|
4129
|
-
for (const secret of this.privateTransportSecrets) redacted = redacted.replaceAll(secret, "[REDACTED]");
|
|
4130
|
-
return redacted;
|
|
4131
|
-
}
|
|
4132
4088
|
redactPrivateStderr(chunk) {
|
|
4133
|
-
|
|
4089
|
+
let text = this.privateStderrPending + chunk;
|
|
4090
|
+
for (const secret of this.privateTransportSecrets) text = text.replaceAll(secret, "[REDACTED]");
|
|
4134
4091
|
let held = 0;
|
|
4135
4092
|
for (const secret of this.privateTransportSecrets) for (let length = 1; length < secret.length; length++) if (text.endsWith(secret.slice(0, length))) held = Math.max(held, length);
|
|
4136
4093
|
this.privateStderrPending = held ? text.slice(-held) : "";
|
|
@@ -4140,7 +4097,7 @@ var CodexAppServerClient = class CodexAppServerClient {
|
|
|
4140
4097
|
if (this.closed || !parsed || typeof parsed !== "object") return;
|
|
4141
4098
|
const message = parsed;
|
|
4142
4099
|
if (isRpcResponse(message)) {
|
|
4143
|
-
this.
|
|
4100
|
+
this.nativeExecutionObserved = dispatchCodexAppServerResponse(message, this.pending, codexCatalogSourceForClient(this), previewStates) || this.nativeExecutionObserved;
|
|
4144
4101
|
return;
|
|
4145
4102
|
}
|
|
4146
4103
|
if (!("method" in message)) return;
|
|
@@ -4158,15 +4115,12 @@ var CodexAppServerClient = class CodexAppServerClient {
|
|
|
4158
4115
|
});
|
|
4159
4116
|
}
|
|
4160
4117
|
async decodeCatalogLine(line, route) {
|
|
4161
|
-
const decoded = await this.catalogWorker.decode(line, route, this.pending
|
|
4118
|
+
const decoded = await this.catalogWorker.decode(line, route, this.pending);
|
|
4162
4119
|
if (!decoded || this.closed) return;
|
|
4163
4120
|
for (const failure of decoded.failures) logCodexAppServerParseFailure(failure.value, failure.error, failure.fragmentCount);
|
|
4164
4121
|
if (decoded.projectionError) this.pending.get(decoded.projectionError.id)?.reject(decoded.projectionError.error, false);
|
|
4165
4122
|
else if (decoded.message) this.handleParsedMessage(decoded.message, decoded.previewStates);
|
|
4166
4123
|
}
|
|
4167
|
-
handleResponse(response, previewStates) {
|
|
4168
|
-
this.nativeExecutionObserved = dispatchCodexAppServerResponse(response, this.pending, this.catalogResponses, codexCatalogSourceForClient(this), previewStates) || this.nativeExecutionObserved;
|
|
4169
|
-
}
|
|
4170
4124
|
handleNotification(notification) {
|
|
4171
4125
|
const params = notification.params;
|
|
4172
4126
|
if (notification.method === "serverRequest/resolved") this.serverRequests.resolve(params);
|
|
@@ -4190,10 +4144,6 @@ var CodexAppServerClient = class CodexAppServerClient {
|
|
|
4190
4144
|
embeddedAgentLog.warn("codex catalog worker shutdown failed", { error: closeError });
|
|
4191
4145
|
});
|
|
4192
4146
|
this.serverRequestsClosed = this.serverRequests.close(error);
|
|
4193
|
-
this.rejectPendingRequests(error);
|
|
4194
|
-
return true;
|
|
4195
|
-
}
|
|
4196
|
-
rejectPendingRequests(error) {
|
|
4197
4147
|
for (const pending of this.pending.values()) pending.close(error);
|
|
4198
4148
|
this.pending.clear();
|
|
4199
4149
|
for (const handler of this.closeHandlers) try {
|
|
@@ -4201,6 +4151,7 @@ var CodexAppServerClient = class CodexAppServerClient {
|
|
|
4201
4151
|
} catch (closeError) {
|
|
4202
4152
|
embeddedAgentLog.warn("codex app-server close handler failed", { error: closeError });
|
|
4203
4153
|
}
|
|
4154
|
+
return true;
|
|
4204
4155
|
}
|
|
4205
4156
|
};
|
|
4206
4157
|
const CODEX_APP_SERVER_APPROVAL_REQUEST_METHODS = /* @__PURE__ */ new Set([
|
|
@@ -4212,4 +4163,4 @@ function isCodexAppServerApprovalRequest(method) {
|
|
|
4212
4163
|
return CODEX_APP_SERVER_APPROVAL_REQUEST_METHODS.has(method);
|
|
4213
4164
|
}
|
|
4214
4165
|
//#endregion
|
|
4215
|
-
export {
|
|
4166
|
+
export { createFailedDynamicToolResponse as A, resolveCodexThreadRolloutPath as C, toCodexDynamicToolProgressResponse as D, resolveDynamicToolCallTimeoutMs as E, getCodexAppServerClientInstanceId as F, isCodexAppServerBrokenPipeError as I, resolveCodexAppServerClientInstanceId as L, readCodexAppServerWarningMessage as M, isUnsupportedCodexAppServerVersionError as N, toCodexDynamicToolProtocolResponse as O, CODEX_APP_SERVER_OPT_OUT_NOTIFICATION_METHODS as P, readSupervisionResponseThreadId as S, handleDynamicToolCallWithTimeout as T, assertCodexTurnStartResponse as _, isCodexAppServerIndeterminateRequestCancellationError as a, readCodexErrorNotification as b, isCodexAppServerRequestTimeoutError as c, assertCodexModelListResponse as d, assertCodexPassiveTurnItems as f, assertCodexThreadStartResponse as g, assertCodexThreadResumeResponse as h, isCodexAppServerConnectionClosedError as i, failedToolResult as j, resolveCodexToolAbortTerminalReason as k, CodexServerRequestResolvedError as l, assertCodexThreadForkResponse as m, client_exports as n, isCodexAppServerIndeterminateTransportError as o, assertCodexThreadAcceptsDirectInput as p, isCodexAppServerApprovalRequest as r, isCodexAppServerPrewriteRequestCancellationError as s, CodexAppServerClient as t, CodexThreadDirectInputError as u, assertExactSupervisionModelSelection as v, createCodexElicitationResponse as w, readCodexTurnCompletedNotification as x, readCodexDynamicToolCallParams as y };
|