@openclaw/codex 2026.9.4 → 2026.9.6
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/assets/activity.svg +30 -0
- package/assets/icon.png +0 -0
- package/dist/.setup/account-usage-runtime-Eem_WGqY.mjs +75 -0
- package/dist/{apply-CvT8tW5i.js → .setup/apply-DDOi8uNx.mjs} +24 -30
- package/dist/.setup/async-questions-DdhOCwGi.mjs +27 -0
- package/dist/{attempt-client-cleanup-DKHzbwt5.js → .setup/attempt-client-cleanup-CEv1cKwF.mjs} +79 -49
- package/dist/.setup/attempt-terminal-gZrxQ35N.mjs +5 -0
- package/dist/.setup/attempt-workspace-context-DUVEn_CS.mjs +331 -0
- package/dist/{auth-binding-CWlKVccJ.js → .setup/auth-binding-DhLWa_7K.mjs} +1 -1
- package/dist/{auth-cache-key-7orQae_j.js → .setup/auth-cache-key-B2mpaI9D.mjs} +9 -81
- package/dist/{auth-profile-CwzO4_RG.js → .setup/auth-profile-WqZtZfXN.mjs} +1 -1
- package/dist/.setup/auth-profile-health-oHizqgye.mjs +53 -0
- package/dist/.setup/auth-profile-recovery-BREezV0L.mjs +14 -0
- package/dist/.setup/binding-connection-ThoatDcb.mjs +50 -0
- package/dist/.setup/binding-connection.runtime-yoHrABt-.mjs +48 -0
- package/dist/{bounded-turn-C_Hneydj.js → .setup/bounded-turn-B2HScEgT.mjs} +143 -32
- package/dist/{build-state-BCmg9-5p.js → .setup/build-state-C7EnDVgr.mjs} +1 -1
- package/dist/{capabilities-8vx68WLH.js → .setup/capabilities-CDXOOFdZ.mjs} +1 -1
- package/dist/{client-B57KWPQx.js → .setup/client-Cs08OXVQ.mjs} +705 -512
- package/dist/.setup/client-catalog-response-BMgt_4q4.mjs +285 -0
- package/dist/{command-dispatch-BpduNGVf.js → .setup/command-dispatch-B4JuOsOk.mjs} +8 -4
- package/dist/{command-formatters-lxlkNZgU.js → .setup/command-formatters-Bmqvr9tO.mjs} +8 -4
- package/dist/{command-handlers-tiL9iWj7.js → .setup/command-handlers-DW7Lx9oH.mjs} +137 -186
- package/dist/{command-rpc-CR5EOEZX.js → .setup/command-rpc-DixIj3HW.mjs} +47 -23
- package/dist/{compact-B_H3AOd7.js → .setup/compact-Du5UvtxA.mjs} +29 -51
- package/dist/{config-oIORaQ5T.js → .setup/config-BoTP_mrL.mjs} +5 -4
- package/dist/{config-options-CXMq1T-C.js → .setup/config-options-BvaRs51b.mjs} +50 -446
- package/dist/{protocol-5bh1G-H7.js → .setup/config-parsing-CcB9iPoq.mjs} +9 -51
- package/dist/{config-runtime-D0zGNIHu.js → .setup/config-runtime-C8Rw1m1m.mjs} +2 -2
- package/dist/.setup/config-security-BEReZ6go.mjs +380 -0
- package/dist/{conversation-binding-DsB4-O7U.js → .setup/conversation-binding-DP-gMrBP.mjs} +29 -38
- package/dist/{conversation-binding-data-BiodpIzq.js → .setup/conversation-binding-data-CrcyZk6O.mjs} +1 -1
- package/dist/{conversation-control-CtUu1b3m.js → .setup/conversation-control-uK9Jomlc.mjs} +32 -67
- package/dist/.setup/cyber-failover-DYwbmf1o.mjs +123 -0
- package/dist/.setup/cyber-failover-notice-e9G3J9-e.mjs +17 -0
- package/dist/{dynamic-tools-CmN5RAip.js → .setup/dynamic-tools-BDXl-8Cw.mjs} +936 -620
- package/dist/{effective-mcp-catalog-Bd73bqA8.js → .setup/effective-mcp-catalog-CvnvnGIe.mjs} +3 -3
- package/dist/{ephemeral-turn-D78_VmzO.js → .setup/ephemeral-turn-poidXgek.mjs} +9 -7
- package/dist/{event-projector-assistant-message-BmBM4qBV.js → .setup/event-projector-assistant-message-BsruvNrH.mjs} +8 -7
- package/dist/{event-projector-items-5VhsECCO.js → .setup/event-projector-items-C6L_5ZiT.mjs} +42 -8
- package/dist/{attempt-notifications-C9XufG6l.js → .setup/event-projector-usage-CnBS8Wa3.mjs} +102 -9
- package/dist/{harness-C7rRa7bm.js → .setup/harness-a_MsE4-_.mjs} +81 -21
- package/dist/{inference-context-Dr_mzvk4.js → .setup/inference-context-D96l9-ew.mjs} +1 -1
- package/dist/.setup/inference-proxy-b-aJMSxm.mjs +601 -0
- package/dist/{isolated-completion-DWVb5U2J.js → .setup/isolated-completion-BIZFhTNG.mjs} +18 -11
- package/dist/.setup/launch-args-DbFCehO7.mjs +196 -0
- package/dist/{managed-binary-D22rNEcR.js → .setup/managed-binary-BnshlFag.mjs} +14 -3
- package/dist/{managed-thread-store-D1t5jh3G.js → .setup/managed-thread-store-BMqgThVL.mjs} +48 -14
- package/dist/{model-catalog-Dq2n8f_p.js → .setup/model-catalog-CfXJf9Ay.mjs} +36 -12
- package/dist/{models-PCKOim-h.js → .setup/models-KnqBv0hE.mjs} +3 -3
- package/dist/.setup/native-auth-rWbGbMn3.mjs +57 -0
- package/dist/{native-subagent-history-DjtPloaU.js → .setup/native-subagent-history-0nYYgo0k.mjs} +43 -35
- package/dist/.setup/native-subagent-monitor-D3filLY2.mjs +4859 -0
- package/dist/{native-subagent-task-ids-BzTdT0Uw.js → .setup/native-subagent-task-ids-wb8CKZGN.mjs} +98 -44
- package/dist/{node-cli-sessions-DKaOmVUh.js → .setup/node-cli-sessions-r3avj02l.mjs} +86 -68
- package/dist/.setup/node-exec-server.runtime-BDwWXVpK.mjs +247 -0
- package/dist/{plan-7uG-Fp36.js → .setup/plan-CN3VwfNU.mjs} +133 -119
- package/dist/{plugin-activation-BYQculil.js → .setup/plugin-activation-DT3MNtqj.mjs} +7 -16
- package/dist/{plugin-app-cache-key-d0eKxy7b.js → .setup/plugin-app-cache-key-B2CsSdnV.mjs} +32 -44
- package/dist/{plugin-approval-roundtrip-Bz3FT8W5.js → .setup/plugin-approval-roundtrip-C0MZzCuP.mjs} +1 -1
- package/dist/{plugin-inventory-oL4Na1ZG.js → .setup/plugin-inventory-BoRei8Z4.mjs} +21 -11
- package/dist/{plugin-marketplace-discovery-P-Vndfqq.js → .setup/plugin-marketplace-discovery-CDOi8IFs.mjs} +4 -1
- package/dist/{plugin-metadata-cache-ClPJpRio.js → .setup/plugin-metadata-cache-Ctmo83k_.mjs} +226 -141
- package/dist/.setup/protocol-CANUwXJ3.mjs +17 -0
- package/dist/{provider-MQ8PVkuE.js → .setup/provider-BOsxQHOM.mjs} +9 -5
- package/dist/{provider-capabilities-BvCUL69A.js → .setup/provider-capabilities-BfE88FZ5.mjs} +31 -3
- package/dist/{rate-limits-CBMmWBr9.js → .setup/rate-limits-CMU3DUD0.mjs} +174 -151
- package/dist/{request-B7hEkBGq.js → .setup/request-D2L0zMrq.mjs} +130 -42
- package/dist/{run-attempt-CvsAAGa0.js → .setup/run-attempt-BHu11r7h.mjs} +1628 -966
- package/dist/.setup/run-attempt-lifecycle-B7JbY4-F.mjs +71 -0
- package/dist/{runtime-artifact-BJ0rXBZ_.js → .setup/runtime-artifact-CLZ8udh-.mjs} +29 -45
- package/dist/{sandbox-guard-BxgyoM8M.js → .setup/sandbox-guard-C2sRMOEY.mjs} +3 -3
- package/dist/{session-binding-CI8UuilT.js → .setup/session-binding-Cm0apEbd.mjs} +36 -83
- package/dist/{session-binding-record-Bcvslnhf.js → .setup/session-binding-record-BGoz8wOK.mjs} +202 -5
- package/dist/.setup/session-binding-sidecars-BlB5EvIS.mjs +546 -0
- package/dist/.setup/session-catalog-Pno1xGcl.mjs +2764 -0
- package/dist/{session-catalog-adoption-tcZi1IfX.js → .setup/session-catalog-adoption-BI6UTDZT.mjs} +58 -26
- package/dist/{session-catalog-archive-CwKg8Xz2.js → .setup/session-catalog-archive-lHBqzhaO.mjs} +6 -6
- package/dist/.setup/session-catalog-events-Bj6j94E_.mjs +347 -0
- package/dist/.setup/session-catalog-index-B9_VQIUz.mjs +1170 -0
- package/dist/.setup/session-catalog-index-order-hcdz07yN.mjs +48 -0
- package/dist/.setup/session-catalog-index-state-Dgh8ORJm.mjs +183 -0
- package/dist/{thread-history-page-D0JIp48V.js → .setup/session-catalog-native-projection-DowriLid.mjs} +223 -95
- package/dist/{session-catalog-node-adoption-B1tgDW-m.js → .setup/session-catalog-node-adoption-ITddWx_X.mjs} +25 -13
- package/dist/{session-catalog-node-continue-Ci-DXyJP.js → .setup/session-catalog-node-continue-6g6qi4A9.mjs} +24 -15
- package/dist/.setup/session-catalog-projection-zK_PUsiE.mjs +422 -0
- package/dist/{session-cli-DNN_jhGc.js → .setup/session-cli-irrD-uo7.mjs} +3 -3
- package/dist/{session-history-Cz-tOOYj.js → .setup/session-history-BrqhSCf9.mjs} +19 -19
- package/dist/{session-history-import-DwyijFI6.js → .setup/session-history-import-D-3wAgOP.mjs} +4 -4
- package/dist/{session-history-read-cxPUxyVV.js → .setup/session-history-read-B3ZfSUbF.mjs} +2 -2
- package/dist/{session-history.worker-BeK1YOyT.js → .setup/session-history.worker-CaCh0xF_.mjs} +10 -24
- package/dist/{session-initialization-Ct0_Hzmg.js → .setup/session-initialization-rcgbZiid.mjs} +2 -2
- package/dist/{session-permission-policy-BBmXA8Eg.js → .setup/session-permission-policy-BI1QK_98.mjs} +2 -2
- package/dist/{session-retirement-B2YfbAAT.js → .setup/session-retirement-BH-S6qkJ.mjs} +26 -7
- package/dist/{settled-turn-context-Du6gdUDd.js → .setup/settled-turn-context-fmwouT5I.mjs} +2 -2
- package/dist/{settled-turn-finalizer-Dn91stmc.js → .setup/settled-turn-finalizer-DiAi6Kx6.mjs} +12 -12
- package/dist/{shared-client-CscigXXL.js → .setup/shared-client-DA4VR4Eb.mjs} +332 -221
- package/dist/{side-question-BGMJQf4U.js → .setup/side-question-BJ1wSDcB.mjs} +183 -230
- package/dist/{source-CElXU0Oy.js → .setup/source-CUzJq5WN.mjs} +11 -10
- package/dist/.setup/spawn-error-CL3n6MAa.mjs +57 -0
- package/dist/{thread-archive-guard-DfpBr-Sz.js → .setup/thread-archive-guard-C9frICzX.mjs} +10 -3
- package/dist/.setup/thread-history-page-DoVpnHim.mjs +83 -0
- package/dist/{thread-lifecycle-DXl1-I6b.js → .setup/thread-lifecycle-B3mfz1TG.mjs} +347 -2318
- package/dist/{thread-ownership-BsDRTsyp.js → .setup/thread-ownership-DcTtAcXj.mjs} +6 -4
- package/dist/{thread-policy-BuEQfE0g.js → .setup/thread-policy-DGuQsuFC.mjs} +19 -3
- package/dist/.setup/thread-requests-BLvGkP2R.mjs +2205 -0
- package/dist/{thread-resume-DsDOZpFg.js → .setup/thread-resume-DIBXwOpE.mjs} +8 -5
- package/dist/.setup/timeout-C910MdAB.mjs +80 -0
- package/dist/{transcript-history-projection-v17wXgdK.js → .setup/transcript-history-projection-ZZpkFkJ_.mjs} +96 -61
- package/dist/{transcript-mirror-C5CKgNy6.js → .setup/transcript-mirror-BtHDBp1G.mjs} +224 -195
- package/dist/{transcript-mirror-attestation-DibE0krH.js → .setup/transcript-mirror-attestation-CzM-94NC.mjs} +4 -1
- package/dist/{transport-stdio-BGjHoYLr.js → .setup/transport-stdio-h2VHOskC.mjs} +274 -89
- package/dist/{upstream-session-fork-BZerMte_.js → .setup/upstream-session-fork-BUr4OUbC.mjs} +51 -42
- package/dist/{usage-tCk-mg_x.js → .setup/usage-BML0r-ua.mjs} +5 -4
- package/dist/.setup/usage-limit-error-DUMbefVY.mjs +166 -0
- package/dist/{web-search-provider.runtime-B7bGbGWq.js → .setup/web-search-provider.runtime-CDKlN-Rv.mjs} +4 -3
- package/dist/api.js +23 -12
- package/dist/catalog-page-worker-entrypoint.js +12 -0
- package/dist/catalog-page.worker.js +9 -0
- package/dist/cli-metadata.js +1 -1
- package/dist/doctor-contract-api.js +8 -528
- package/dist/harness.js +1 -1
- package/dist/index.js +306 -215
- package/dist/media-understanding-provider.js +3 -3
- package/dist/migration-provider-api.js +1 -1
- package/dist/native-tool-policy.js +12 -0
- package/dist/provider-discovery.js +18 -0
- package/dist/session-history-worker-runtime.js +36 -35
- package/dist/session-history.worker.js +2 -2
- package/dist/web-search-contract-api.js +1 -1
- package/openclaw.plugin.json +354 -69
- package/package.json +14 -8
- package/dist/attempt-context-D44yeDII.js +0 -636
- package/dist/binding-connection-D3udKbIE.js +0 -60
- package/dist/event-projector-usage-BfXmpOec.js +0 -102
- package/dist/inference-proxy-HGXKUIre.js +0 -311
- package/dist/launch-args-RXQwn8zV.js +0 -90
- package/dist/native-subagent-history-owner-Pcp7JuVF.js +0 -34
- package/dist/native-subagent-monitor-fQ7eIXEf.js +0 -2978
- package/dist/node-exec-server.runtime-Cl2vapEi.js +0 -226
- package/dist/rpc-error-ttN_QjEm.js +0 -30
- package/dist/session-catalog-ct-AH01I.js +0 -1477
- package/dist/session-catalog-home-id-CwhLdC03.js +0 -18
- package/dist/session-catalog-provenance-D-dIfRAH.js +0 -96
- package/dist/timeout-BVw8aaM1.js +0 -33
- package/dist/version-omm6IPI3.js +0 -12
- /package/dist/{auth-profile-selection-DFu9e167.js → .setup/auth-profile-selection-DFu9e167.mjs} +0 -0
- /package/dist/{config-utils-DujwEnhg.js → .setup/config-utils-DujwEnhg.mjs} +0 -0
- /package/dist/{context-compaction-activity-CMla5FPJ.js → .setup/context-compaction-activity-CMla5FPJ.mjs} +0 -0
- /package/dist/{elicitation-input-DPoK8F7w.js → .setup/elicitation-input-DPoK8F7w.mjs} +0 -0
- /package/dist/{history-rejection-B4nOXNXF.js → .setup/history-rejection-B4nOXNXF.mjs} +0 -0
- /package/dist/{image-payload-sanitizer-tupAr-2o.js → .setup/image-payload-sanitizer-tupAr-2o.mjs} +0 -0
- /package/dist/{incognito-session-uhrBF6wJ.js → .setup/incognito-session-uhrBF6wJ.mjs} +0 -0
- /package/dist/{local-runtime-attribution-B_2mnqhb.js → .setup/local-runtime-attribution-B_2mnqhb.mjs} +0 -0
- /package/dist/{native-execution-policy-umd0tgh4.js → .setup/native-execution-policy-umd0tgh4.mjs} +0 -0
- /package/dist/{rolldown-runtime-8H4AJuhK.js → .setup/rolldown-runtime-8H4AJuhK.mjs} +0 -0
- /package/dist/{session-binding-meta-B7aEMU7g.js → .setup/session-binding-meta-B7aEMU7g.mjs} +0 -0
- /package/dist/{session-upstream-marker-D15C9NHp.js → .setup/session-upstream-marker-D15C9NHp.mjs} +0 -0
- /package/dist/{upstream-prompt-provenance-LphB8slG.js → .setup/upstream-prompt-provenance-LphB8slG.mjs} +0 -0
- /package/dist/{web-search-provider.shared-BrZmlqyR.js → .setup/web-search-provider.shared-BrZmlqyR.mjs} +0 -0
|
@@ -1,40 +1,72 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { n as
|
|
7
|
-
import { i as resolveCodexBindingAppServerConnection, r as requireCodexSupervisionModelSelection } from "./binding-connection-
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { n as
|
|
17
|
-
import {
|
|
1
|
+
import { m as sessionBindingIdentity } from "./session-binding-record-BGoz8wOK.mjs";
|
|
2
|
+
import { l as shouldAutoApproveCodexAppServerApprovals, n as hasCodexMcpToolApprovalOverrides, u as withMcpElicitationsApprovalPolicy, y as readCodexRequirementsToml } from "./config-security-BEReZ6go.mjs";
|
|
3
|
+
import { c as isCodexPairedNodeRemoteExecPlacementSandbox, d as readCodexPluginConfig, l as isCodexRemoteExecPlacementSandbox, u as isCodexSandboxExecServerEnabled } from "./config-parsing-CcB9iPoq.mjs";
|
|
4
|
+
import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
|
|
5
|
+
import { i as resolveCodexAppServerHomeScope, l as resolveCodexModelBackedReviewerPolicyContext } from "./config-options-BvaRs51b.mjs";
|
|
6
|
+
import { n as formatCodexUsageLimitErrorMessage } from "./rate-limits-CMU3DUD0.mjs";
|
|
7
|
+
import { i as resolveCodexBindingAppServerConnection, r as requireCodexSupervisionModelSelection } from "./binding-connection-ThoatDcb.mjs";
|
|
8
|
+
import { n as resolveOpenClawExecPolicyForCodexAppServer, t as canUseCodexModelBackedApprovalsReviewerForModel } from "./config-BoTP_mrL.mjs";
|
|
9
|
+
import { Z as resolveCodexAppServerPreparedAuthHandoff, c as getLeasedSharedCodexAppServerClient, m as releaseCodexAppServerClientLease, q as readRecentCodexRateLimits, x as withLeasedCodexAppServerClientStartSelectionRetry } from "./shared-client-DA4VR4Eb.mjs";
|
|
10
|
+
import { C as readCodexDynamicToolCallParams, D as handleDynamicToolCallWithTimeout, E as createCodexElicitationResponse, L as resolveCodexToolAbortTerminalReason, S as assertCodexTurnStartResponse, i as isCodexAppServerApprovalRequest, j as resolveDynamicToolCallTimeoutMs, s as isCodexAppServerIndeterminateRequestCancellationError, y as assertCodexThreadForkResponse } from "./client-Cs08OXVQ.mjs";
|
|
11
|
+
import { f as terminateCodexBackgroundTerminals, p as unsubscribeCodexThreadBestEffort, s as interruptCodexTurnAndWaitBestEffort, u as retireUnsafeCodexTurnClientBestEffort } from "./attempt-client-cleanup-CEv1cKwF.mjs";
|
|
12
|
+
import { t as CodexEphemeralTurn } from "./ephemeral-turn-poidXgek.mjs";
|
|
13
|
+
import { A as emitCodexNativePreToolUseFailureDiagnostic, D as buildCodexNativeHookRelayDisabledConfig, E as buildCodexNativeHookRelayConfig, S as CODEX_NATIVE_HOOK_RELAY_EVENTS, St as refreshCodexPluginAppApprovalPolicy, _ as resolveCodexAppServerRequestModelSelection, dt as resolveCodexDynamicToolsLoading, g as resolveCodexAppServerModelProvider, h as CODEX_NATIVE_PERSONALITY_NONE, p as resolveCodexWebSearchPlan, r as buildCodexRuntimeThreadConfig, xt as mergeCodexThreadConfigs, y as resolveCodexBindingModelProviderFallback } from "./thread-requests-BLvGkP2R.mjs";
|
|
14
|
+
import { M as resolveCodexAppServerReasoningEffort, j as readCodexSupportedReasoningEfforts, o as buildCodexUserInput, r as buildCodexTemporalAdditionalContext } from "./thread-lifecycle-B3mfz1TG.mjs";
|
|
15
|
+
import { o as resolveCodexSessionBinding } from "./session-binding-Cm0apEbd.mjs";
|
|
16
|
+
import { a as refreshCodexThreadPolicy, i as assertCodexSupervisionThreadLineage, n as CodexThreadPolicyHandoffError } from "./thread-policy-DGuQsuFC.mjs";
|
|
17
|
+
import { t as resolveCodexNativeExecutionBlock } from "./sandbox-guard-C2sRMOEY.mjs";
|
|
18
|
+
import { C as shouldEnableCodexAppServerNativeToolSurface, S as resolveCodexSandboxEnvironmentSelection, a as emitDynamicToolStartedDiagnostic, b as resolveCodexExternalSandboxPolicyForOpenClawSandbox, c as ensureCodexSandboxExecServerEnvironment, i as emitDynamicToolErrorDiagnostic, l as releaseCodexSandboxExecServerEnvironment, m as buildDynamicTools, o as emitDynamicToolTerminalDiagnostic, p as CodexNativeToolLifecycleProjector, r as routeCodexAppServerElicitationRequest, s as handleCodexAppServerApprovalRequest, t as createCodexDynamicToolBridge, w as shouldRequireCodexSandboxExecServerEnvironment, x as resolveCodexMessageToolProvider } from "./dynamic-tools-BDXl-8Cw.mjs";
|
|
19
|
+
import { n as resolveCodexProviderWebSearchSupportForClient } from "./provider-capabilities-BfE88FZ5.mjs";
|
|
20
|
+
import { a as resolveCodexAppServerForModelProvider, i as resolveCodexSessionPermissionCwd, n as applyCodexSessionPermissionPolicy, r as resolveCodexEffectiveSessionPermissionPolicy, t as CODEX_SESSION_PERMISSION_EXEC_MODES } from "./session-permission-policy-BI1QK_98.mjs";
|
|
18
21
|
import { readStringField } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
19
22
|
import { randomUUID } from "node:crypto";
|
|
23
|
+
import { isDeepStrictEqual } from "node:util";
|
|
20
24
|
import { resolveSessionAgentIdsStrict } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
25
|
+
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
21
26
|
import { resolveAgentWorkspaceDir } from "openclaw/plugin-sdk/agent-runtime";
|
|
22
|
-
import { buildAgentHookContextChannelFields, embeddedAgentLog, formatErrorMessage
|
|
27
|
+
import { buildAgentHookContextChannelFields, embeddedAgentLog, formatErrorMessage as formatErrorMessage$1, resolveSandboxContext, runAgentCleanupStep } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
23
28
|
import { loadExecApprovals } from "openclaw/plugin-sdk/exec-approvals-runtime";
|
|
24
|
-
import { isDeepStrictEqual } from "node:util";
|
|
25
29
|
import { loadCodexBundleMcpApprovalConfig, resolveCodexMcpToolOverridesForAgent } from "openclaw/plugin-sdk/codex-mcp-projection";
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
import { registerNativeHookRelayForBundledRuntime } from "openclaw/plugin-sdk/native-hook-relay-runtime";
|
|
31
|
+
//#region extensions/codex/src/app-server/side-question-cleanup.ts
|
|
32
|
+
async function cleanupCodexSideQuestion(client, params) {
|
|
33
|
+
const errors = [];
|
|
34
|
+
for (const cleanup of [() => cleanupCodexSideThread(client, params), ...params.afterThreadCleanup]) try {
|
|
35
|
+
const pending = cleanup();
|
|
36
|
+
if (pending) await pending;
|
|
37
|
+
} catch (error) {
|
|
38
|
+
errors.push(error);
|
|
32
39
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
if (errors.length === 0) return;
|
|
41
|
+
if (params.failure) errors.unshift(params.failure.error);
|
|
42
|
+
if (errors.length === 1) throw errors[0];
|
|
43
|
+
throw new AggregateError(errors, errors.map(formatErrorMessage).join("; "), { cause: errors[0] });
|
|
44
|
+
}
|
|
45
|
+
async function cleanupCodexSideThread(client, params) {
|
|
46
|
+
if (!params.threadId) return;
|
|
47
|
+
if (params.interrupt && params.turnId !== void 0) {
|
|
48
|
+
if (!await interruptCodexTurnAndWaitBestEffort(client, {
|
|
49
|
+
threadId: params.threadId,
|
|
50
|
+
turnId: params.turnId,
|
|
51
|
+
timeoutMs: params.timeoutMs
|
|
52
|
+
})) {
|
|
53
|
+
await retireUnsafeCodexTurnClientBestEffort(client, "side turn interrupt");
|
|
54
|
+
throw new Error("Codex /btw cleanup could not confirm the side turn stopped; background terminals may still be running.");
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (params.terminateBackgroundTerminals && params.turnId !== void 0) try {
|
|
58
|
+
await terminateCodexBackgroundTerminals(client, params.threadId);
|
|
59
|
+
} catch (error) {
|
|
60
|
+
await retireUnsafeCodexTurnClientBestEffort(client, "side background terminals");
|
|
61
|
+
throw error;
|
|
62
|
+
}
|
|
63
|
+
if (!await unsubscribeCodexThreadBestEffort(client, {
|
|
64
|
+
threadId: params.threadId,
|
|
65
|
+
timeoutMs: params.timeoutMs
|
|
66
|
+
})) await retireUnsafeCodexTurnClientBestEffort(client, "side thread unsubscribe");
|
|
67
|
+
}
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region extensions/codex/src/app-server/side-question-instructions.ts
|
|
38
70
|
const SIDE_DEVELOPER_INSTRUCTIONS = `You are in a side conversation, not the main thread.
|
|
39
71
|
|
|
40
72
|
This side conversation is for answering questions and lightweight, non-mutating exploration without disrupting the main thread. Do not present yourself as continuing the main thread's active task.
|
|
@@ -48,6 +80,19 @@ External tools may be available according to this thread's current permissions.
|
|
|
48
80
|
You may perform non-mutating inspection, including reading or searching files and running checks that do not alter repo-tracked files.
|
|
49
81
|
|
|
50
82
|
Do not modify files, source, git state, permissions, configuration, workspace state, or external state unless the user explicitly requests that mutation in this side conversation. Do not request escalated permissions or broader sandbox access unless the user explicitly requests a mutation that requires it. If the user explicitly requests a mutation, keep it minimal, local to the request, and avoid disrupting the main thread.`;
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region extensions/codex/src/app-server/side-question.ts
|
|
85
|
+
const SIDE_QUESTION_COMPLETION_TIMEOUT_MS = 6e5;
|
|
86
|
+
var CodexSideQuestionTimeoutError = class extends Error {
|
|
87
|
+
constructor(..._args) {
|
|
88
|
+
super(..._args);
|
|
89
|
+
this.name = "TimeoutError";
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
const CODEX_SIDE_NATIVE_HOOK_RELAY_MIN_TTL_MS = 18e5;
|
|
93
|
+
const CODEX_SIDE_NATIVE_HOOK_RELAY_TTL_GRACE_MS = 3e5;
|
|
94
|
+
const CODEX_SIDE_NATIVE_HOOK_RELAY_STARTUP_REQUEST_COUNT = 3;
|
|
95
|
+
const CODEX_SIDE_NATIVE_HOOK_RELAY_EVENTS_WITH_APP_SERVER_APPROVALS = CODEX_NATIVE_HOOK_RELAY_EVENTS.filter((event) => event !== "permission_request");
|
|
51
96
|
async function runCodexAppServerSideQuestion(params, options) {
|
|
52
97
|
const bindingIdentity = sessionBindingIdentity({
|
|
53
98
|
sessionId: params.sessionId,
|
|
@@ -126,11 +171,12 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
126
171
|
bindingModel: binding.model,
|
|
127
172
|
nativeAuthProfile: usesSupervisionConnection || preparedNativeAuthProfile
|
|
128
173
|
});
|
|
129
|
-
const connection = resolveCodexBindingAppServerConnection({
|
|
174
|
+
const connection = await resolveCodexBindingAppServerConnection({
|
|
130
175
|
binding,
|
|
131
176
|
authProfileId,
|
|
132
177
|
pluginConfig,
|
|
133
178
|
execPolicy,
|
|
179
|
+
assertCurrent,
|
|
134
180
|
modelProvider: reviewerPolicyContext.modelProvider,
|
|
135
181
|
model: reviewerPolicyContext.model,
|
|
136
182
|
config: params.cfg,
|
|
@@ -222,6 +268,7 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
222
268
|
if (nativeExecutionBlock) throw new Error(nativeExecutionBlock);
|
|
223
269
|
if (!nativeToolSurfaceEnabled) throw new Error("Codex-native /btw side-question mode is unavailable because the effective tool policy restricts Codex native tools for this session.");
|
|
224
270
|
const clientOptions = {
|
|
271
|
+
assertCurrent,
|
|
225
272
|
startOptions: appServer.start,
|
|
226
273
|
timeoutMs: appServer.requestTimeoutMs,
|
|
227
274
|
authRequirement: preparedRuntimeAuth.plan.modelRoute?.authRequirement,
|
|
@@ -273,6 +320,7 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
273
320
|
let sandboxEnvironmentClient;
|
|
274
321
|
let nativeHookRelay;
|
|
275
322
|
const activeDynamicToolCalls = /* @__PURE__ */ new Set();
|
|
323
|
+
let primaryFailure;
|
|
276
324
|
const releaseSandboxEnvironment = async () => {
|
|
277
325
|
if (!sandboxEnvironment) return;
|
|
278
326
|
const environment = sandboxEnvironment;
|
|
@@ -314,35 +362,27 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
314
362
|
});
|
|
315
363
|
const approvalPolicy = hasCodexMcpToolApprovalOverrides(params.cfg?.mcp?.servers, Object.keys(projectedMcpServers), projectedMcpServers) ? withMcpElicitationsApprovalPolicy(appServer.approvalPolicy) : appServer.approvalPolicy;
|
|
316
364
|
const sandbox = appServer.sandbox;
|
|
365
|
+
const nativeProviderWebSearchSupport = resolveCodexWebSearchPlan({
|
|
366
|
+
config: params.cfg,
|
|
367
|
+
nativeToolSurfaceEnabled
|
|
368
|
+
}).kind === "native-hosted" ? await resolveCodexProviderWebSearchSupportForClient({
|
|
369
|
+
client,
|
|
370
|
+
timeoutMs: appServer.requestTimeoutMs,
|
|
371
|
+
modelProviderOverride: modelSelection.modelProvider,
|
|
372
|
+
signal: runAbortController.signal
|
|
373
|
+
}) : "unsupported";
|
|
317
374
|
const { toolBridge, webSearchPlan } = await createCodexSideToolBridge({
|
|
318
|
-
params:
|
|
375
|
+
params: sideRunParams,
|
|
319
376
|
cwd,
|
|
377
|
+
resolvedWorkspace: effectiveParams.workspaceDir ?? cwd,
|
|
320
378
|
pluginConfig,
|
|
321
379
|
sessionAgentId,
|
|
322
380
|
nativeToolSurfaceEnabled,
|
|
323
|
-
nativeProviderWebSearchSupport
|
|
324
|
-
config: params.cfg,
|
|
325
|
-
nativeToolSurfaceEnabled
|
|
326
|
-
}).kind === "native-hosted" ? await resolveCodexProviderWebSearchSupportForClient({
|
|
327
|
-
client,
|
|
328
|
-
timeoutMs: appServer.requestTimeoutMs,
|
|
329
|
-
modelProviderOverride: modelSelection.modelProvider,
|
|
330
|
-
signal: runAbortController.signal
|
|
331
|
-
}) : "unsupported",
|
|
381
|
+
nativeProviderWebSearchSupport,
|
|
332
382
|
sessionPermissionPolicy,
|
|
333
|
-
|
|
334
|
-
signal: runAbortController.signal
|
|
335
|
-
});
|
|
336
|
-
ensureCodexAppServerClientRuntime(client, {
|
|
337
|
-
agentDir: params.agentDir,
|
|
338
|
-
authProfileId: startupPreparedAuth?.kind === "api-key" ? void 0 : connection.requestAuthProfileId,
|
|
339
|
-
...!usesSupervisionConnection ? {
|
|
340
|
-
authProfileStore: preparedRuntimeAuth.authProfileStore,
|
|
341
|
-
authMode: startupPreparedAuth?.kind === "api-key" ? "prepared-api-key" : "profile"
|
|
342
|
-
} : {},
|
|
343
|
-
config: params.cfg
|
|
383
|
+
runAbortController
|
|
344
384
|
});
|
|
345
|
-
const handleServerRequest = async (request, _scope, requestSignal) => {
|
|
385
|
+
const handleServerRequest = async (request, _scope, requestSignal, setExecutionTimeoutMs) => {
|
|
346
386
|
const signal = AbortSignal.any([requestSignal, runAbortController.signal]);
|
|
347
387
|
if (signal.aborted) return;
|
|
348
388
|
if (!childThreadId || !turnId) return;
|
|
@@ -377,8 +417,10 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
377
417
|
if (!call || call.threadId !== childThreadId || call.turnId !== turnId) return;
|
|
378
418
|
const timeoutMs = resolveDynamicToolCallTimeoutMs({
|
|
379
419
|
call,
|
|
380
|
-
config: params.cfg
|
|
420
|
+
config: params.cfg,
|
|
421
|
+
toolBridge
|
|
381
422
|
});
|
|
423
|
+
setExecutionTimeoutMs?.(timeoutMs);
|
|
382
424
|
const toolStartedAt = Date.now();
|
|
383
425
|
const diagnosticContext = {
|
|
384
426
|
call,
|
|
@@ -418,14 +460,6 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
418
460
|
activeDynamicToolCalls.delete(toolCall);
|
|
419
461
|
}
|
|
420
462
|
};
|
|
421
|
-
const selectClient = (nextClient) => {
|
|
422
|
-
client = nextClient;
|
|
423
|
-
ensureCodexAppServerClientRuntime(client, {
|
|
424
|
-
agentDir: params.agentDir,
|
|
425
|
-
authProfileId: connection.requestAuthProfileId,
|
|
426
|
-
config: params.cfg
|
|
427
|
-
});
|
|
428
|
-
};
|
|
429
463
|
const serviceTier = binding.serviceTier ?? appServer.serviceTier;
|
|
430
464
|
const nativeHookRelayEvents = resolveCodexSideNativeHookRelayEvents({
|
|
431
465
|
configuredEvents: options.nativeHookRelay?.events,
|
|
@@ -459,6 +493,8 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
459
493
|
else pendingNativePreToolUseFailures.push(failure);
|
|
460
494
|
}
|
|
461
495
|
}) : void 0;
|
|
496
|
+
await nativeHookRelay?.prepareInvocation();
|
|
497
|
+
assertCurrent();
|
|
462
498
|
const nativeHookRelayConfig = nativeHookRelay ? buildCodexNativeHookRelayConfig({
|
|
463
499
|
relay: nativeHookRelay,
|
|
464
500
|
events: nativeHookRelayEvents,
|
|
@@ -570,7 +606,9 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
570
606
|
}
|
|
571
607
|
return response.thread.id;
|
|
572
608
|
}),
|
|
573
|
-
onClientChange:
|
|
609
|
+
onClientChange: (nextClient) => {
|
|
610
|
+
client = nextClient;
|
|
611
|
+
}
|
|
574
612
|
});
|
|
575
613
|
const effort = usesSupervisionConnection ? void 0 : resolveCodexAppServerReasoningEffort({
|
|
576
614
|
thinkLevel: params.resolvedThinkLevel ?? "off",
|
|
@@ -579,11 +617,7 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
579
617
|
});
|
|
580
618
|
const turnResponse = assertCodexTurnStartResponse(await client.request("turn/start", {
|
|
581
619
|
threadId: sideThreadId,
|
|
582
|
-
input:
|
|
583
|
-
type: "text",
|
|
584
|
-
text: params.question.trim(),
|
|
585
|
-
text_elements: []
|
|
586
|
-
}],
|
|
620
|
+
input: buildCodexUserInput(params.question.trim(), params.images),
|
|
587
621
|
additionalContext: buildCodexTemporalAdditionalContext(sideRunParams, { sessionStatusAvailable: toolBridge.availableTools.some((tool) => tool.name === "session_status") }),
|
|
588
622
|
...sandboxEnvironment ? {
|
|
589
623
|
cwd: sandboxEnvironment.cwd,
|
|
@@ -640,45 +674,49 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
640
674
|
codexErrorInfo: result.turn?.error?.codexErrorInfo ?? null
|
|
641
675
|
} }, readRecentCodexRateLimits(client));
|
|
642
676
|
if (result.turn?.status === "interrupted") throw new Error("Codex /btw side thread was interrupted.");
|
|
643
|
-
const trimmed = result.text;
|
|
644
677
|
assertCurrent();
|
|
645
|
-
if (!
|
|
678
|
+
if (!result.text) throw new Error("Codex /btw completed without an answer.");
|
|
646
679
|
return {
|
|
647
|
-
text:
|
|
680
|
+
text: result.text,
|
|
648
681
|
usage: result.usage
|
|
649
682
|
};
|
|
683
|
+
} catch (error) {
|
|
684
|
+
primaryFailure = { error };
|
|
685
|
+
throw error;
|
|
650
686
|
} finally {
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
collector?.route.release()
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
687
|
+
nativeToolRunWasAbortedBeforeCleanup = runAbortController.signal.aborted;
|
|
688
|
+
params.opts?.abortSignal?.removeEventListener("abort", abortFromUpstream);
|
|
689
|
+
if (!runAbortController.signal.aborted) runAbortController.abort("codex_side_question_finished");
|
|
690
|
+
await Promise.allSettled(activeDynamicToolCalls);
|
|
691
|
+
await cleanupCodexSideQuestion(childClient ?? client, {
|
|
692
|
+
threadId: childThreadId,
|
|
693
|
+
turnId,
|
|
694
|
+
interrupt: !(collector?.completed || collector?.route.completed),
|
|
695
|
+
terminateBackgroundTerminals: nativeToolRunWasAbortedBeforeCleanup,
|
|
696
|
+
timeoutMs: appServer.requestTimeoutMs,
|
|
697
|
+
failure: primaryFailure,
|
|
698
|
+
afterThreadCleanup: [
|
|
699
|
+
async () => {
|
|
700
|
+
if (policyWriteUncertain && childClient) await retireUnsafeCodexTurnClientBestEffort(childClient, "side policy handoff");
|
|
701
|
+
},
|
|
702
|
+
() => collector?.route.release(),
|
|
703
|
+
() => nativeToolLifecycleProjector?.finalizeActive(nativeToolRunWasAbortedBeforeCleanup),
|
|
704
|
+
activateNativePreToolUseFailureFallback,
|
|
705
|
+
flushPendingNativePreToolUseFailures,
|
|
706
|
+
releaseSandboxEnvironment,
|
|
707
|
+
() => releaseCodexAppServerClientLease(clientLease),
|
|
708
|
+
() => nativeHookRelay?.unregister(),
|
|
709
|
+
() => runAgentCleanupStep({
|
|
710
|
+
runId: sideRunParams.runId,
|
|
711
|
+
sessionId: sideRunParams.sessionId,
|
|
712
|
+
step: "codex-side-native-hook-relay-release",
|
|
713
|
+
log: embeddedAgentLog,
|
|
714
|
+
cleanup: async () => {
|
|
715
|
+
await nativeHookRelay?.drain();
|
|
716
|
+
}
|
|
717
|
+
})
|
|
718
|
+
]
|
|
719
|
+
});
|
|
682
720
|
}
|
|
683
721
|
}
|
|
684
722
|
function resolveCodexSideNativeHookRelayEvents(params) {
|
|
@@ -687,7 +725,7 @@ function resolveCodexSideNativeHookRelayEvents(params) {
|
|
|
687
725
|
}
|
|
688
726
|
function registerCodexSideNativeHookRelay(params) {
|
|
689
727
|
if (params.options.enabled === false) return;
|
|
690
|
-
return
|
|
728
|
+
return registerNativeHookRelayForBundledRuntime({
|
|
691
729
|
provider: "codex",
|
|
692
730
|
...params.agentId ? { agentId: params.agentId } : {},
|
|
693
731
|
sessionId: params.sessionId,
|
|
@@ -771,132 +809,64 @@ function buildSideRunAttemptParams(params, options) {
|
|
|
771
809
|
},
|
|
772
810
|
onBlockReply: params.opts?.onBlockReply,
|
|
773
811
|
onPartialReply: params.opts?.onPartialReply,
|
|
812
|
+
onToolResult: params.opts?.onToolResult,
|
|
813
|
+
requireExplicitMessageTarget: true,
|
|
774
814
|
hostCapabilities: params.hostCapabilities,
|
|
775
815
|
sandbox: params.sandbox
|
|
776
816
|
};
|
|
777
817
|
}
|
|
778
818
|
async function createCodexSideToolBridge(input) {
|
|
779
|
-
const
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
sessionKey: sandboxSessionKey,
|
|
806
|
-
runSessionKey: input.params.sessionKey && input.params.sessionKey !== sandboxSessionKey ? input.params.sessionKey : void 0,
|
|
807
|
-
sessionId: input.params.sessionId,
|
|
808
|
-
exec: input.sessionPermissionPolicy && { mode: input.sessionPermissionPolicy.execMode },
|
|
809
|
-
sessionPermissionPolicy: input.sessionPermissionPolicy,
|
|
810
|
-
runId: input.runId,
|
|
811
|
-
agentDir: input.params.agentDir ?? resolveAgentDir$2(input.params.cfg ?? {}, input.sessionAgentId),
|
|
812
|
-
workspaceDir: input.cwd,
|
|
813
|
-
spawnWorkspaceDir: resolveAttemptSpawnWorkspaceDir({
|
|
814
|
-
sandbox,
|
|
815
|
-
resolvedWorkspace: input.params.workspaceDir ?? input.cwd
|
|
816
|
-
}),
|
|
817
|
-
config: input.params.cfg,
|
|
818
|
-
preparedModelRuntime: input.params.preparedModelRuntime,
|
|
819
|
-
abortSignal: input.signal,
|
|
820
|
-
modelProvider: runtimeModel.provider,
|
|
821
|
-
modelId: input.params.model,
|
|
822
|
-
modelCompat: runtimeModel.compat && typeof runtimeModel.compat === "object" ? runtimeModel.compat : void 0,
|
|
823
|
-
modelApi: runtimeModel.api,
|
|
824
|
-
modelContextWindowTokens: runtimeModel.contextWindow,
|
|
825
|
-
modelAuthMode: resolveModelAuthMode(runtimeModel.provider, input.params.cfg, void 0, { workspaceDir: input.cwd }),
|
|
826
|
-
suppressManagedWebSearch: false,
|
|
827
|
-
webFetchHostnameAllowlistRef,
|
|
828
|
-
...input.params.messageProvider || input.params.messageChannel ? {
|
|
829
|
-
messageProvider: messageToolProvider,
|
|
830
|
-
toolPolicyMessageProvider: input.params.messageProvider ?? input.params.messageChannel
|
|
831
|
-
} : {},
|
|
832
|
-
...input.params.chatType ? { chatType: input.params.chatType } : {},
|
|
833
|
-
...input.params.agentAccountId ? { agentAccountId: input.params.agentAccountId } : {},
|
|
834
|
-
...input.params.messageTo ? { messageTo: input.params.messageTo } : {},
|
|
835
|
-
...input.params.messageThreadId !== void 0 ? { messageThreadId: input.params.messageThreadId } : {},
|
|
836
|
-
...input.params.chatId ? { nativeChannelId: input.params.chatId } : {},
|
|
837
|
-
...input.params.messageActionTurnCapability ? { messageActionTurnCapability: input.params.messageActionTurnCapability } : {},
|
|
838
|
-
...input.params.groupId !== void 0 ? { groupId: input.params.groupId } : {},
|
|
839
|
-
...input.params.groupChannel !== void 0 ? { groupChannel: input.params.groupChannel } : {},
|
|
840
|
-
...input.params.groupSpace !== void 0 ? { groupSpace: input.params.groupSpace } : {},
|
|
841
|
-
...input.params.memberRoleIds ? { memberRoleIds: input.params.memberRoleIds } : {},
|
|
842
|
-
...input.params.spawnedBy !== void 0 ? { spawnedBy: input.params.spawnedBy } : {},
|
|
843
|
-
...input.params.senderId !== void 0 ? { senderId: input.params.senderId } : {},
|
|
844
|
-
...input.params.senderName !== void 0 ? { senderName: input.params.senderName } : {},
|
|
845
|
-
...input.params.senderUsername !== void 0 ? { senderUsername: input.params.senderUsername } : {},
|
|
846
|
-
...input.params.senderE164 !== void 0 ? { senderE164: input.params.senderE164 } : {},
|
|
847
|
-
...input.params.senderIsOwner !== void 0 ? { senderIsOwner: input.params.senderIsOwner } : {},
|
|
848
|
-
...input.params.currentChannelId ? { currentChannelId: input.params.currentChannelId } : {},
|
|
849
|
-
hookChannelId: buildAgentHookContextChannelFields({
|
|
850
|
-
sessionKey: input.params.sessionKey,
|
|
851
|
-
messageChannel: input.params.messageChannel,
|
|
852
|
-
messageProvider: input.params.messageProvider,
|
|
853
|
-
currentChannelId: input.params.currentChannelId
|
|
854
|
-
}).channelId,
|
|
855
|
-
sandbox,
|
|
856
|
-
...toolConstructionPlan ? { toolConstructionPlan } : {},
|
|
857
|
-
...questionPrompt ? { questionPrompt } : {},
|
|
858
|
-
emitBeforeToolCallDiagnostics: false,
|
|
859
|
-
modelHasVision: runtimeModel.input?.includes("image") ?? false,
|
|
860
|
-
requireExplicitMessageTarget: true
|
|
861
|
-
});
|
|
862
|
-
const codexFilteredTools = filterCodexDynamicTools(allTools, input.pluginConfig);
|
|
863
|
-
tools = filterCodexVisionTools(codexFilteredTools, {
|
|
864
|
-
modelHasVision: runtimeModel.input?.includes("image") ?? false,
|
|
865
|
-
nativeImageInspectionEnabled: input.nativeToolSurfaceEnabled
|
|
866
|
-
});
|
|
867
|
-
}
|
|
819
|
+
const { params } = input;
|
|
820
|
+
const sandboxSessionKey = params.sandboxSessionKey?.trim() || params.sessionKey?.trim() || params.sessionId || input.sessionAgentId;
|
|
821
|
+
const sandbox = params.sandbox !== void 0 ? params.sandbox : await resolveSandboxContext({
|
|
822
|
+
config: params.config,
|
|
823
|
+
sessionKey: sandboxSessionKey,
|
|
824
|
+
workspaceDir: input.cwd
|
|
825
|
+
});
|
|
826
|
+
let webSearchAllowed = false;
|
|
827
|
+
const tools = await buildDynamicTools({
|
|
828
|
+
params,
|
|
829
|
+
resolvedWorkspace: input.resolvedWorkspace,
|
|
830
|
+
effectiveWorkspace: input.cwd,
|
|
831
|
+
sandboxSessionKey,
|
|
832
|
+
sandbox,
|
|
833
|
+
nativeToolSurfaceEnabled: input.nativeToolSurfaceEnabled,
|
|
834
|
+
nativeProviderWebSearchSupport: input.nativeProviderWebSearchSupport,
|
|
835
|
+
sessionPermissionPolicy: input.sessionPermissionPolicy,
|
|
836
|
+
runAbortController: input.runAbortController,
|
|
837
|
+
sessionAgentId: input.sessionAgentId,
|
|
838
|
+
policyAgentId: input.sessionAgentId,
|
|
839
|
+
pluginConfig: input.pluginConfig,
|
|
840
|
+
onYieldDetected: () => {},
|
|
841
|
+
onWebSearchPolicyResolved: (allowed) => {
|
|
842
|
+
webSearchAllowed = allowed;
|
|
843
|
+
}
|
|
844
|
+
});
|
|
868
845
|
const requestedWebSearchPlan = resolveCodexWebSearchPlan({
|
|
869
|
-
config:
|
|
846
|
+
config: params.config,
|
|
870
847
|
nativeToolSurfaceEnabled: input.nativeToolSurfaceEnabled,
|
|
871
848
|
nativeProviderWebSearchSupport: input.nativeProviderWebSearchSupport,
|
|
872
|
-
webSearchAllowed
|
|
849
|
+
webSearchAllowed
|
|
873
850
|
});
|
|
874
|
-
webFetchHostnameAllowlistRef.value = requestedWebSearchPlan.webFetchHostnameAllowlist;
|
|
875
851
|
const webSearchPlan = requestedWebSearchPlan.kind === "managed" ? resolveCodexWebSearchPlan({
|
|
876
|
-
config:
|
|
852
|
+
config: params.config,
|
|
877
853
|
webSearchAllowed: false
|
|
878
854
|
}) : requestedWebSearchPlan;
|
|
879
|
-
const exposedTools =
|
|
880
|
-
const hookChannelFields = buildAgentHookContextChannelFields({
|
|
881
|
-
sessionKey: input.params.sessionKey,
|
|
882
|
-
messageChannel: input.params.messageChannel,
|
|
883
|
-
messageProvider: input.params.messageProvider,
|
|
884
|
-
currentChannelId: input.params.currentChannelId
|
|
885
|
-
});
|
|
855
|
+
const exposedTools = tools.filter((tool) => tool.name !== "web_search" && tool.name !== "computer");
|
|
886
856
|
return {
|
|
887
857
|
toolBridge: createCodexDynamicToolBridge({
|
|
888
858
|
tools: exposedTools,
|
|
889
|
-
signal: input.signal,
|
|
859
|
+
signal: input.runAbortController.signal,
|
|
890
860
|
loading: resolveCodexDynamicToolsLoading(input.pluginConfig),
|
|
891
861
|
hookContext: {
|
|
892
862
|
agentId: input.sessionAgentId,
|
|
893
|
-
config:
|
|
894
|
-
contextWindowTokens:
|
|
895
|
-
sessionId:
|
|
896
|
-
sessionKey:
|
|
897
|
-
runId:
|
|
898
|
-
currentChannelProvider:
|
|
899
|
-
...
|
|
863
|
+
config: params.config,
|
|
864
|
+
contextWindowTokens: params.model.contextWindow,
|
|
865
|
+
sessionId: params.sessionId,
|
|
866
|
+
sessionKey: params.sessionKey,
|
|
867
|
+
runId: params.runId,
|
|
868
|
+
currentChannelProvider: resolveCodexMessageToolProvider(params),
|
|
869
|
+
...buildAgentHookContextChannelFields(params)
|
|
900
870
|
}
|
|
901
871
|
}),
|
|
902
872
|
webSearchPlan
|
|
@@ -917,26 +887,9 @@ async function forkCodexSideThread(client, params, options) {
|
|
|
917
887
|
}
|
|
918
888
|
}
|
|
919
889
|
function isMissingCodexParentThreadError(error) {
|
|
920
|
-
const message = formatErrorMessage(error);
|
|
890
|
+
const message = formatErrorMessage$1(error);
|
|
921
891
|
return message.includes("no rollout found for thread id") || message.includes("includeTurns is unavailable before first user message");
|
|
922
892
|
}
|
|
923
|
-
async function cleanupCodexSideThread(client, params) {
|
|
924
|
-
if (!params.threadId) return;
|
|
925
|
-
if (params.interrupt && params.turnId !== void 0) {
|
|
926
|
-
if (!await interruptCodexTurnAndWaitBestEffort(client, {
|
|
927
|
-
threadId: params.threadId,
|
|
928
|
-
turnId: params.turnId,
|
|
929
|
-
timeoutMs: params.timeoutMs
|
|
930
|
-
})) {
|
|
931
|
-
await retireUnsafeCodexTurnClientBestEffort(client, "side turn interrupt");
|
|
932
|
-
return;
|
|
933
|
-
}
|
|
934
|
-
}
|
|
935
|
-
if (!await unsubscribeCodexThreadBestEffort(client, {
|
|
936
|
-
threadId: params.threadId,
|
|
937
|
-
timeoutMs: params.timeoutMs
|
|
938
|
-
})) await retireUnsafeCodexTurnClientBestEffort(client, "side thread unsubscribe");
|
|
939
|
-
}
|
|
940
893
|
function formatCodexErrorMessage(params, rateLimits) {
|
|
941
894
|
const error = isJsonObject(params.error) ? params.error : void 0;
|
|
942
895
|
const message = formatCodexUsageLimitErrorMessage({
|
|
@@ -944,7 +897,7 @@ function formatCodexErrorMessage(params, rateLimits) {
|
|
|
944
897
|
codexErrorInfo: error?.codexErrorInfo,
|
|
945
898
|
rateLimits
|
|
946
899
|
}) ?? (error ? readStringField(error, "message") ?? readStringField(error, "error") : void 0) ?? readStringField(params, "message") ?? "Codex /btw side thread failed.";
|
|
947
|
-
return new Error(formatErrorMessage(message));
|
|
900
|
+
return new Error(formatErrorMessage$1(message));
|
|
948
901
|
}
|
|
949
902
|
//#endregion
|
|
950
903
|
export { runCodexAppServerSideQuestion };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.
|
|
2
|
-
import { c as CODEX_PLUGINS_MARKETPLACE_NAME, i as pluginReadParams, n as isOpenAiCuratedMarketplace } from "./plugin-inventory-
|
|
3
|
-
import {
|
|
4
|
-
import { o as withCodexAppServerJsonClient } from "./request-
|
|
5
|
-
import "./config-
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
|
|
2
|
+
import { c as CODEX_PLUGINS_MARKETPLACE_NAME, i as pluginReadParams, n as isOpenAiCuratedMarketplace } from "./plugin-inventory-BoRei8Z4.mjs";
|
|
3
|
+
import { a as defaultCodexAppInventoryCache, r as buildCodexPluginAppCacheKey } from "./plugin-app-cache-key-B2CsSdnV.mjs";
|
|
4
|
+
import { o as withCodexAppServerJsonClient } from "./request-D2L0zMrq.mjs";
|
|
5
|
+
import "./config-BoTP_mrL.mjs";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import os from "node:os";
|
|
8
8
|
import fs from "node:fs/promises";
|
|
9
|
-
import { coerceErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
10
9
|
import { isPathInside } from "openclaw/plugin-sdk/file-access-runtime";
|
|
10
|
+
import { coerceErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
11
11
|
import { pathExists } from "openclaw/plugin-sdk/security-runtime";
|
|
12
12
|
import { readJsonFileWithFallback } from "openclaw/plugin-sdk/json-store";
|
|
13
13
|
//#region extensions/codex/src/migration/helpers.ts
|
|
@@ -120,6 +120,7 @@ async function discoverCodexMemorySources(codexHome) {
|
|
|
120
120
|
//#region extensions/codex/src/migration/source.ts
|
|
121
121
|
var source_exports = /* @__PURE__ */ __exportAll({
|
|
122
122
|
codexPluginMigrationSubscriptionWarning: () => codexPluginMigrationSubscriptionWarning,
|
|
123
|
+
defaultCodexHome: () => defaultCodexHome,
|
|
123
124
|
discoverCodexSource: () => discoverCodexSource,
|
|
124
125
|
hasCodexSource: () => hasCodexSource
|
|
125
126
|
});
|
|
@@ -409,13 +410,13 @@ function sourcePluginAppFactWithInventory(app, info, installedApp) {
|
|
|
409
410
|
};
|
|
410
411
|
if (!installedApp.enabled) return {
|
|
411
412
|
...app,
|
|
412
|
-
isAccessible:
|
|
413
|
+
isAccessible: true,
|
|
413
414
|
isEnabled: false
|
|
414
415
|
};
|
|
415
416
|
return {
|
|
416
417
|
...app,
|
|
417
|
-
isAccessible:
|
|
418
|
-
isEnabled:
|
|
418
|
+
isAccessible: installedApp.callable,
|
|
419
|
+
isEnabled: installedApp.enabled,
|
|
419
420
|
...!installedApp.callable ? { isCallable: false } : {}
|
|
420
421
|
};
|
|
421
422
|
}
|
|
@@ -515,4 +516,4 @@ function sanitizePluginName(value) {
|
|
|
515
516
|
return value.trim().toLowerCase().replaceAll(/\s+/gu, "-");
|
|
516
517
|
}
|
|
517
518
|
//#endregion
|
|
518
|
-
export {
|
|
519
|
+
export { source_exports as a, sanitizeName as c, hasCodexSource as i, defaultCodexHome as n, exists as o, discoverCodexSource as r, readJsonObject as s, codexPluginMigrationSubscriptionWarning as t };
|