@openclaw/codex 2026.9.5 → 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/dist/.setup/{account-usage-runtime-C2MOIvfq.mjs → account-usage-runtime-Eem_WGqY.mjs} +5 -5
- package/dist/.setup/{apply-CJ0ZfmBG.mjs → apply-DDOi8uNx.mjs} +22 -28
- package/dist/.setup/{attempt-client-cleanup-BpYKdTA0.mjs → attempt-client-cleanup-CEv1cKwF.mjs} +58 -43
- package/dist/.setup/attempt-workspace-context-DUVEn_CS.mjs +331 -0
- package/dist/.setup/{auth-cache-key-QirmgiCo.mjs → auth-cache-key-B2mpaI9D.mjs} +9 -81
- 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-Bm38niE8.mjs → binding-connection-ThoatDcb.mjs} +1 -1
- package/dist/.setup/{binding-connection.runtime-CnRMC0ta.mjs → binding-connection.runtime-yoHrABt-.mjs} +4 -4
- package/dist/.setup/{bounded-turn-BtlZcivC.mjs → bounded-turn-B2HScEgT.mjs} +138 -32
- package/dist/.setup/{build-state-Xx9ybZqa.mjs → build-state-C7EnDVgr.mjs} +1 -1
- package/dist/.setup/{capabilities-_vXcZGSx.mjs → capabilities-CDXOOFdZ.mjs} +1 -1
- package/dist/.setup/{client-vXs2929Q.mjs → client-Cs08OXVQ.mjs} +583 -559
- package/dist/.setup/client-catalog-response-BMgt_4q4.mjs +285 -0
- package/dist/.setup/{command-dispatch-naHIZwwF.mjs → command-dispatch-B4JuOsOk.mjs} +8 -4
- package/dist/.setup/{command-formatters-CGEkdawF.mjs → command-formatters-Bmqvr9tO.mjs} +8 -4
- package/dist/.setup/{command-handlers-BtAJEW1X.mjs → command-handlers-DW7Lx9oH.mjs} +106 -172
- package/dist/.setup/{command-rpc-DHFpn4le.mjs → command-rpc-DixIj3HW.mjs} +36 -21
- package/dist/.setup/{compact-C3i3qlzj.mjs → compact-Du5UvtxA.mjs} +14 -21
- package/dist/.setup/{config-CedDWjM-.mjs → config-BoTP_mrL.mjs} +3 -3
- package/dist/.setup/{config-options-BsanJ8QG.mjs → config-options-BvaRs51b.mjs} +46 -30
- package/dist/.setup/{config-runtime-CeAhl_h4.mjs → config-runtime-C8Rw1m1m.mjs} +1 -1
- package/dist/.setup/{config-security-BRQ2mgW9.mjs → config-security-BEReZ6go.mjs} +35 -120
- package/dist/.setup/{conversation-binding-DhzrpTM6.mjs → conversation-binding-DP-gMrBP.mjs} +21 -32
- package/dist/.setup/{conversation-control-DN53ns41.mjs → conversation-control-uK9Jomlc.mjs} +28 -67
- package/dist/.setup/{dynamic-tools-D16lOp67.mjs → dynamic-tools-BDXl-8Cw.mjs} +848 -578
- package/dist/.setup/{effective-mcp-catalog-K6kLCN8X.mjs → effective-mcp-catalog-CvnvnGIe.mjs} +3 -3
- package/dist/.setup/{ephemeral-turn-R1gA8Sn6.mjs → ephemeral-turn-poidXgek.mjs} +9 -6
- package/dist/.setup/{event-projector-assistant-message-DNUR1s0A.mjs → event-projector-assistant-message-BsruvNrH.mjs} +2 -4
- package/dist/.setup/{event-projector-items-DyTQ_XqL.mjs → event-projector-items-C6L_5ZiT.mjs} +42 -8
- package/dist/.setup/{event-projector-usage-C7Ntzs-f.mjs → event-projector-usage-CnBS8Wa3.mjs} +1 -1
- package/dist/.setup/{harness-rxaaoN-o.mjs → harness-a_MsE4-_.mjs} +23 -17
- package/dist/.setup/{inference-context-fulhZuz8.mjs → inference-context-D96l9-ew.mjs} +1 -1
- package/dist/.setup/inference-proxy-b-aJMSxm.mjs +601 -0
- package/dist/.setup/{isolated-completion-B6srt48J.mjs → isolated-completion-BIZFhTNG.mjs} +17 -10
- package/dist/.setup/launch-args-DbFCehO7.mjs +196 -0
- package/dist/.setup/{managed-binary-DP6Rib3P.mjs → managed-binary-BnshlFag.mjs} +13 -2
- package/dist/.setup/{model-catalog-DkvUuBey.mjs → model-catalog-CfXJf9Ay.mjs} +9 -10
- package/dist/.setup/{models-BDFgm_G-.mjs → models-KnqBv0hE.mjs} +3 -3
- package/dist/.setup/{native-auth-BLZGqFjw.mjs → native-auth-rWbGbMn3.mjs} +4 -4
- package/dist/.setup/{native-subagent-history-YXaL6dMd.mjs → native-subagent-history-0nYYgo0k.mjs} +26 -13
- package/dist/.setup/{native-subagent-monitor-B1hxzIOy.mjs → native-subagent-monitor-D3filLY2.mjs} +145 -317
- package/dist/.setup/{native-subagent-task-ids-DsuOonKv.mjs → native-subagent-task-ids-wb8CKZGN.mjs} +69 -39
- package/dist/.setup/{node-cli-sessions-Cl8b2ZF3.mjs → node-cli-sessions-r3avj02l.mjs} +86 -68
- package/dist/.setup/node-exec-server.runtime-BDwWXVpK.mjs +247 -0
- package/dist/.setup/{plan-xD7WKYTM.mjs → plan-CN3VwfNU.mjs} +74 -76
- package/dist/.setup/{plugin-activation-r8nq5Jzp.mjs → plugin-activation-DT3MNtqj.mjs} +7 -16
- package/dist/.setup/{plugin-app-cache-key-BOxKP7db.mjs → plugin-app-cache-key-B2CsSdnV.mjs} +4 -20
- package/dist/.setup/{plugin-approval-roundtrip-CjfzafAZ.mjs → plugin-approval-roundtrip-C0MZzCuP.mjs} +1 -1
- package/dist/.setup/{plugin-inventory-DUle8DLz.mjs → plugin-inventory-BoRei8Z4.mjs} +16 -7
- package/dist/.setup/{plugin-marketplace-discovery-P-Vndfqq.mjs → plugin-marketplace-discovery-CDOi8IFs.mjs} +4 -1
- package/dist/.setup/{plugin-metadata-cache-DsS5buNa.mjs → plugin-metadata-cache-Ctmo83k_.mjs} +224 -154
- package/dist/.setup/protocol-CANUwXJ3.mjs +17 -0
- package/dist/.setup/{provider-fFh_-VR3.mjs → provider-BOsxQHOM.mjs} +9 -5
- package/dist/.setup/{provider-capabilities-B8J4Dy-O.mjs → provider-capabilities-BfE88FZ5.mjs} +31 -3
- package/dist/.setup/{rate-limits-DOEGYRNs.mjs → rate-limits-CMU3DUD0.mjs} +116 -137
- package/dist/.setup/{request-BioXJLYa.mjs → request-D2L0zMrq.mjs} +23 -15
- package/dist/.setup/{run-attempt-rlA07pUv.mjs → run-attempt-BHu11r7h.mjs} +1197 -617
- package/dist/.setup/{runtime-artifact-Dy38Z5iU.mjs → runtime-artifact-CLZ8udh-.mjs} +29 -45
- package/dist/.setup/{sandbox-guard-BBP-RbTf.mjs → sandbox-guard-C2sRMOEY.mjs} +1 -1
- package/dist/.setup/{session-binding-_0W_fHRr.mjs → session-binding-Cm0apEbd.mjs} +3 -32
- package/dist/.setup/{session-binding-record-TH3xA0zj.mjs → session-binding-record-BGoz8wOK.mjs} +22 -3
- package/dist/.setup/{session-binding-sidecars-CKYEcfNn.mjs → session-binding-sidecars-BlB5EvIS.mjs} +48 -45
- package/dist/.setup/{session-catalog-fUdWDx-U.mjs → session-catalog-Pno1xGcl.mjs} +482 -182
- package/dist/.setup/{session-catalog-adoption-CR_whkEW.mjs → session-catalog-adoption-BI6UTDZT.mjs} +57 -25
- package/dist/.setup/{session-catalog-archive-CwZaPacf.mjs → session-catalog-archive-lHBqzhaO.mjs} +6 -6
- package/dist/.setup/{session-catalog-events-jMcYfQyd.mjs → session-catalog-events-Bj6j94E_.mjs} +122 -25
- package/dist/.setup/{session-catalog-index-B141u15s.mjs → session-catalog-index-B9_VQIUz.mjs} +178 -78
- package/dist/.setup/{session-catalog-index-order-Cc5BzlQr.mjs → session-catalog-index-order-hcdz07yN.mjs} +2 -2
- package/dist/.setup/{session-catalog-index-state-BAuDztHN.mjs → session-catalog-index-state-Dgh8ORJm.mjs} +5 -2
- package/dist/.setup/{session-catalog-native-projection-ChV3cCtm.mjs → session-catalog-native-projection-DowriLid.mjs} +30 -13
- package/dist/.setup/{session-catalog-node-adoption-BVRsYOSh.mjs → session-catalog-node-adoption-ITddWx_X.mjs} +24 -12
- package/dist/.setup/{session-catalog-node-continue-Dowv8osw.mjs → session-catalog-node-continue-6g6qi4A9.mjs} +22 -13
- package/dist/.setup/{session-catalog-projection-C1Bj9Jl-.mjs → session-catalog-projection-zK_PUsiE.mjs} +13 -5
- package/dist/.setup/{session-cli-DIj-IE-E.mjs → session-cli-irrD-uo7.mjs} +4 -4
- package/dist/.setup/{session-history-C--SrLI8.mjs → session-history-BrqhSCf9.mjs} +17 -22
- package/dist/.setup/{session-history-import-JHXT5Xfi.mjs → session-history-import-D-3wAgOP.mjs} +4 -4
- package/dist/.setup/{session-history.worker-CpNj7H_P.mjs → session-history.worker-CaCh0xF_.mjs} +5 -18
- package/dist/.setup/{session-initialization-DH1z6fXn.mjs → session-initialization-rcgbZiid.mjs} +2 -2
- package/dist/.setup/{session-permission-policy-DhurXY0l.mjs → session-permission-policy-BI1QK_98.mjs} +2 -2
- package/dist/.setup/{session-retirement-CU87AOg9.mjs → session-retirement-BH-S6qkJ.mjs} +25 -6
- package/dist/.setup/{settled-turn-finalizer-CiY2bLFK.mjs → settled-turn-finalizer-DiAi6Kx6.mjs} +8 -8
- package/dist/.setup/{shared-client-BpTtuLQ5.mjs → shared-client-DA4VR4Eb.mjs} +59 -89
- package/dist/.setup/{side-question-DSCZyoBD.mjs → side-question-BJ1wSDcB.mjs} +147 -211
- package/dist/.setup/{source-Bjp4UQij.mjs → source-CUzJq5WN.mjs} +9 -9
- package/dist/.setup/spawn-error-CL3n6MAa.mjs +57 -0
- package/dist/.setup/{thread-archive-guard-jmecf6OJ.mjs → thread-archive-guard-C9frICzX.mjs} +10 -3
- package/dist/.setup/{thread-history-page-BTx-4xsg.mjs → thread-history-page-DoVpnHim.mjs} +1 -1
- package/dist/.setup/{thread-lifecycle-Cik28qWn.mjs → thread-lifecycle-B3mfz1TG.mjs} +172 -2271
- package/dist/.setup/{thread-ownership-skomxnIt.mjs → thread-ownership-DcTtAcXj.mjs} +4 -2
- package/dist/.setup/{thread-policy-Cjs4B8xf.mjs → thread-policy-DGuQsuFC.mjs} +19 -3
- package/dist/.setup/thread-requests-BLvGkP2R.mjs +2205 -0
- package/dist/.setup/{thread-resume-BkNpj9Pz.mjs → thread-resume-DIBXwOpE.mjs} +6 -6
- package/dist/.setup/{timeout-DZF05XrR.mjs → timeout-C910MdAB.mjs} +19 -2
- package/dist/.setup/{transcript-history-projection-DHNBDhCU.mjs → transcript-history-projection-ZZpkFkJ_.mjs} +94 -64
- package/dist/.setup/{transcript-mirror-D4qp_leP.mjs → transcript-mirror-BtHDBp1G.mjs} +218 -198
- package/dist/.setup/{transport-stdio-Cmx94Oiy.mjs → transport-stdio-h2VHOskC.mjs} +135 -55
- package/dist/.setup/{upstream-session-fork-D3UKxgVD.mjs → upstream-session-fork-BUr4OUbC.mjs} +44 -36
- package/dist/.setup/{usage-BOgBEKso.mjs → usage-BML0r-ua.mjs} +5 -4
- package/dist/.setup/{usage-limit-error-C0ow7DOc.mjs → usage-limit-error-DUMbefVY.mjs} +4 -4
- package/dist/.setup/{web-search-provider.runtime-CTGuJt6i.mjs → 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 +2 -2
- package/dist/harness.js +1 -1
- package/dist/index.js +221 -170
- package/dist/media-understanding-provider.js +2 -2
- package/dist/migration-provider-api.js +1 -1
- package/dist/provider-discovery.js +1 -1
- package/dist/session-history-worker-runtime.js +15 -32
- package/dist/session-history.worker.js +1 -1
- package/package.json +9 -6
- package/dist/.setup/attempt-context-VXVwTCfS.mjs +0 -636
- package/dist/.setup/inference-proxy-CC15HuSi.mjs +0 -311
- package/dist/.setup/launch-args-DnMak49W.mjs +0 -111
- package/dist/.setup/node-exec-server.runtime-BaViBKNz.mjs +0 -226
- package/dist/.setup/version-CoqzXPgK.mjs +0 -12
- package/dist/.setup/{native-execution-policy-YBMHSzC4.mjs → native-execution-policy-umd0tgh4.mjs} +1 -1
|
@@ -1,30 +1,71 @@
|
|
|
1
|
-
import {
|
|
2
|
-
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
3
|
import { c as isCodexPairedNodeRemoteExecPlacementSandbox, d as readCodexPluginConfig, l as isCodexRemoteExecPlacementSandbox, u as isCodexSandboxExecServerEnabled } from "./config-parsing-CcB9iPoq.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import { i as resolveCodexAppServerHomeScope, l as resolveCodexModelBackedReviewerPolicyContext } from "./config-options-
|
|
6
|
-
import { n as formatCodexUsageLimitErrorMessage } from "./rate-limits-
|
|
7
|
-
import { i as resolveCodexBindingAppServerConnection, r as requireCodexSupervisionModelSelection } from "./binding-connection-
|
|
8
|
-
import { n as resolveOpenClawExecPolicyForCodexAppServer, t as canUseCodexModelBackedApprovalsReviewerForModel } from "./config-
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { a as
|
|
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";
|
|
19
21
|
import { readStringField } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
20
22
|
import { randomUUID } from "node:crypto";
|
|
21
23
|
import { isDeepStrictEqual } from "node:util";
|
|
22
24
|
import { resolveSessionAgentIdsStrict } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
25
|
+
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
23
26
|
import { resolveAgentWorkspaceDir } from "openclaw/plugin-sdk/agent-runtime";
|
|
24
|
-
import { buildAgentHookContextChannelFields, embeddedAgentLog, formatErrorMessage
|
|
27
|
+
import { buildAgentHookContextChannelFields, embeddedAgentLog, formatErrorMessage as formatErrorMessage$1, resolveSandboxContext, runAgentCleanupStep } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
25
28
|
import { loadExecApprovals } from "openclaw/plugin-sdk/exec-approvals-runtime";
|
|
26
29
|
import { loadCodexBundleMcpApprovalConfig, resolveCodexMcpToolOverridesForAgent } from "openclaw/plugin-sdk/codex-mcp-projection";
|
|
27
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);
|
|
39
|
+
}
|
|
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
|
|
28
69
|
//#region extensions/codex/src/app-server/side-question-instructions.ts
|
|
29
70
|
const SIDE_DEVELOPER_INSTRUCTIONS = `You are in a side conversation, not the main thread.
|
|
30
71
|
|
|
@@ -279,6 +320,7 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
279
320
|
let sandboxEnvironmentClient;
|
|
280
321
|
let nativeHookRelay;
|
|
281
322
|
const activeDynamicToolCalls = /* @__PURE__ */ new Set();
|
|
323
|
+
let primaryFailure;
|
|
282
324
|
const releaseSandboxEnvironment = async () => {
|
|
283
325
|
if (!sandboxEnvironment) return;
|
|
284
326
|
const environment = sandboxEnvironment;
|
|
@@ -320,33 +362,25 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
320
362
|
});
|
|
321
363
|
const approvalPolicy = hasCodexMcpToolApprovalOverrides(params.cfg?.mcp?.servers, Object.keys(projectedMcpServers), projectedMcpServers) ? withMcpElicitationsApprovalPolicy(appServer.approvalPolicy) : appServer.approvalPolicy;
|
|
322
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";
|
|
323
374
|
const { toolBridge, webSearchPlan } = await createCodexSideToolBridge({
|
|
324
|
-
params:
|
|
375
|
+
params: sideRunParams,
|
|
325
376
|
cwd,
|
|
377
|
+
resolvedWorkspace: effectiveParams.workspaceDir ?? cwd,
|
|
326
378
|
pluginConfig,
|
|
327
379
|
sessionAgentId,
|
|
328
380
|
nativeToolSurfaceEnabled,
|
|
329
|
-
nativeProviderWebSearchSupport
|
|
330
|
-
config: params.cfg,
|
|
331
|
-
nativeToolSurfaceEnabled
|
|
332
|
-
}).kind === "native-hosted" ? await resolveCodexProviderWebSearchSupportForClient({
|
|
333
|
-
client,
|
|
334
|
-
timeoutMs: appServer.requestTimeoutMs,
|
|
335
|
-
modelProviderOverride: modelSelection.modelProvider,
|
|
336
|
-
signal: runAbortController.signal
|
|
337
|
-
}) : "unsupported",
|
|
381
|
+
nativeProviderWebSearchSupport,
|
|
338
382
|
sessionPermissionPolicy,
|
|
339
|
-
|
|
340
|
-
signal: runAbortController.signal
|
|
341
|
-
});
|
|
342
|
-
ensureCodexAppServerClientRuntime(client, {
|
|
343
|
-
agentDir: params.agentDir,
|
|
344
|
-
authProfileId: startupPreparedAuth?.kind === "api-key" ? void 0 : connection.requestAuthProfileId,
|
|
345
|
-
...!usesSupervisionConnection ? {
|
|
346
|
-
authProfileStore: preparedRuntimeAuth.authProfileStore,
|
|
347
|
-
authMode: startupPreparedAuth?.kind === "api-key" ? "prepared-api-key" : "profile"
|
|
348
|
-
} : {},
|
|
349
|
-
config: params.cfg
|
|
383
|
+
runAbortController
|
|
350
384
|
});
|
|
351
385
|
const handleServerRequest = async (request, _scope, requestSignal, setExecutionTimeoutMs) => {
|
|
352
386
|
const signal = AbortSignal.any([requestSignal, runAbortController.signal]);
|
|
@@ -426,14 +460,6 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
426
460
|
activeDynamicToolCalls.delete(toolCall);
|
|
427
461
|
}
|
|
428
462
|
};
|
|
429
|
-
const selectClient = (nextClient) => {
|
|
430
|
-
client = nextClient;
|
|
431
|
-
ensureCodexAppServerClientRuntime(client, {
|
|
432
|
-
agentDir: params.agentDir,
|
|
433
|
-
authProfileId: connection.requestAuthProfileId,
|
|
434
|
-
config: params.cfg
|
|
435
|
-
});
|
|
436
|
-
};
|
|
437
463
|
const serviceTier = binding.serviceTier ?? appServer.serviceTier;
|
|
438
464
|
const nativeHookRelayEvents = resolveCodexSideNativeHookRelayEvents({
|
|
439
465
|
configuredEvents: options.nativeHookRelay?.events,
|
|
@@ -580,7 +606,9 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
580
606
|
}
|
|
581
607
|
return response.thread.id;
|
|
582
608
|
}),
|
|
583
|
-
onClientChange:
|
|
609
|
+
onClientChange: (nextClient) => {
|
|
610
|
+
client = nextClient;
|
|
611
|
+
}
|
|
584
612
|
});
|
|
585
613
|
const effort = usesSupervisionConnection ? void 0 : resolveCodexAppServerReasoningEffort({
|
|
586
614
|
thinkLevel: params.resolvedThinkLevel ?? "off",
|
|
@@ -652,36 +680,33 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
652
680
|
text: result.text,
|
|
653
681
|
usage: result.usage
|
|
654
682
|
};
|
|
683
|
+
} catch (error) {
|
|
684
|
+
primaryFailure = { error };
|
|
685
|
+
throw error;
|
|
655
686
|
} finally {
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
try {
|
|
680
|
-
await releaseSandboxEnvironment();
|
|
681
|
-
} finally {
|
|
682
|
-
releaseCodexAppServerClientLease(clientLease);
|
|
683
|
-
nativeHookRelay?.unregister();
|
|
684
|
-
await runAgentCleanupStep({
|
|
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({
|
|
685
710
|
runId: sideRunParams.runId,
|
|
686
711
|
sessionId: sideRunParams.sessionId,
|
|
687
712
|
step: "codex-side-native-hook-relay-release",
|
|
@@ -689,9 +714,9 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
689
714
|
cleanup: async () => {
|
|
690
715
|
await nativeHookRelay?.drain();
|
|
691
716
|
}
|
|
692
|
-
})
|
|
693
|
-
|
|
694
|
-
}
|
|
717
|
+
})
|
|
718
|
+
]
|
|
719
|
+
});
|
|
695
720
|
}
|
|
696
721
|
}
|
|
697
722
|
function resolveCodexSideNativeHookRelayEvents(params) {
|
|
@@ -784,136 +809,64 @@ function buildSideRunAttemptParams(params, options) {
|
|
|
784
809
|
},
|
|
785
810
|
onBlockReply: params.opts?.onBlockReply,
|
|
786
811
|
onPartialReply: params.opts?.onPartialReply,
|
|
812
|
+
onToolResult: params.opts?.onToolResult,
|
|
813
|
+
requireExplicitMessageTarget: true,
|
|
787
814
|
hostCapabilities: params.hostCapabilities,
|
|
788
815
|
sandbox: params.sandbox
|
|
789
816
|
};
|
|
790
817
|
}
|
|
791
818
|
async function createCodexSideToolBridge(input) {
|
|
792
|
-
const
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
requesterModel: input.params.runtimeModel ? {
|
|
819
|
-
provider: input.params.runtimeModel.provider,
|
|
820
|
-
model: input.params.runtimeModel.id
|
|
821
|
-
} : void 0,
|
|
822
|
-
sessionKey: sandboxSessionKey,
|
|
823
|
-
runSessionKey: input.params.sessionKey && input.params.sessionKey !== sandboxSessionKey ? input.params.sessionKey : void 0,
|
|
824
|
-
sessionId: input.params.sessionId,
|
|
825
|
-
exec: input.sessionPermissionPolicy && { mode: input.sessionPermissionPolicy.execMode },
|
|
826
|
-
sessionPermissionPolicy: input.sessionPermissionPolicy,
|
|
827
|
-
runId: input.runId,
|
|
828
|
-
agentDir: input.params.agentDir ?? resolveAgentDir$2(input.params.cfg ?? {}, input.sessionAgentId),
|
|
829
|
-
workspaceDir: input.cwd,
|
|
830
|
-
spawnWorkspaceDir: resolveAttemptSpawnWorkspaceDir({
|
|
831
|
-
sandbox,
|
|
832
|
-
resolvedWorkspace: input.params.workspaceDir ?? input.cwd
|
|
833
|
-
}),
|
|
834
|
-
config: input.params.cfg,
|
|
835
|
-
preparedModelRuntime: input.params.preparedModelRuntime,
|
|
836
|
-
abortSignal: input.signal,
|
|
837
|
-
modelProvider: runtimeModel.provider,
|
|
838
|
-
modelId: input.params.model,
|
|
839
|
-
modelCompat: runtimeModel.compat && typeof runtimeModel.compat === "object" ? runtimeModel.compat : void 0,
|
|
840
|
-
modelApi: runtimeModel.api,
|
|
841
|
-
modelContextWindowTokens: runtimeModel.contextWindow,
|
|
842
|
-
modelAuthMode: resolveModelAuthMode(runtimeModel.provider, input.params.cfg, void 0, { workspaceDir: input.cwd }),
|
|
843
|
-
suppressManagedWebSearch: false,
|
|
844
|
-
webFetchHostnameAllowlistRef,
|
|
845
|
-
...input.params.messageProvider || input.params.messageChannel ? {
|
|
846
|
-
messageProvider: messageToolProvider,
|
|
847
|
-
toolPolicyMessageProvider: input.params.messageProvider ?? input.params.messageChannel
|
|
848
|
-
} : {},
|
|
849
|
-
...input.params.chatType ? { chatType: input.params.chatType } : {},
|
|
850
|
-
...input.params.agentAccountId ? { agentAccountId: input.params.agentAccountId } : {},
|
|
851
|
-
...input.params.messageTo ? { messageTo: input.params.messageTo } : {},
|
|
852
|
-
...input.params.messageThreadId !== void 0 ? { messageThreadId: input.params.messageThreadId } : {},
|
|
853
|
-
...input.params.chatId ? { nativeChannelId: input.params.chatId } : {},
|
|
854
|
-
...input.params.messageActionTurnCapability ? { messageActionTurnCapability: input.params.messageActionTurnCapability } : {},
|
|
855
|
-
...input.params.groupId !== void 0 ? { groupId: input.params.groupId } : {},
|
|
856
|
-
...input.params.groupChannel !== void 0 ? { groupChannel: input.params.groupChannel } : {},
|
|
857
|
-
...input.params.groupSpace !== void 0 ? { groupSpace: input.params.groupSpace } : {},
|
|
858
|
-
...input.params.memberRoleIds ? { memberRoleIds: input.params.memberRoleIds } : {},
|
|
859
|
-
...input.params.spawnedBy !== void 0 ? { spawnedBy: input.params.spawnedBy } : {},
|
|
860
|
-
...input.params.senderId !== void 0 ? { senderId: input.params.senderId } : {},
|
|
861
|
-
...input.params.senderName !== void 0 ? { senderName: input.params.senderName } : {},
|
|
862
|
-
...input.params.senderUsername !== void 0 ? { senderUsername: input.params.senderUsername } : {},
|
|
863
|
-
...input.params.senderE164 !== void 0 ? { senderE164: input.params.senderE164 } : {},
|
|
864
|
-
...input.params.senderIsOwner !== void 0 ? { senderIsOwner: input.params.senderIsOwner } : {},
|
|
865
|
-
...input.params.currentChannelId ? { currentChannelId: input.params.currentChannelId } : {},
|
|
866
|
-
hookChannelId: buildAgentHookContextChannelFields({
|
|
867
|
-
sessionKey: input.params.sessionKey,
|
|
868
|
-
messageChannel: input.params.messageChannel,
|
|
869
|
-
messageProvider: input.params.messageProvider,
|
|
870
|
-
currentChannelId: input.params.currentChannelId
|
|
871
|
-
}).channelId,
|
|
872
|
-
sandbox,
|
|
873
|
-
...toolConstructionPlan ? { toolConstructionPlan } : {},
|
|
874
|
-
...questionPrompt ? { questionPrompt } : {},
|
|
875
|
-
emitBeforeToolCallDiagnostics: false,
|
|
876
|
-
modelHasVision: runtimeModel.input?.includes("image") ?? false,
|
|
877
|
-
requireExplicitMessageTarget: true
|
|
878
|
-
});
|
|
879
|
-
const codexFilteredTools = filterCodexDynamicTools(allTools, input.pluginConfig);
|
|
880
|
-
tools = filterCodexVisionTools(codexFilteredTools, {
|
|
881
|
-
modelHasVision: runtimeModel.input?.includes("image") ?? false,
|
|
882
|
-
nativeImageInspectionEnabled: input.nativeToolSurfaceEnabled
|
|
883
|
-
});
|
|
884
|
-
}
|
|
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
|
+
});
|
|
885
845
|
const requestedWebSearchPlan = resolveCodexWebSearchPlan({
|
|
886
|
-
config:
|
|
846
|
+
config: params.config,
|
|
887
847
|
nativeToolSurfaceEnabled: input.nativeToolSurfaceEnabled,
|
|
888
848
|
nativeProviderWebSearchSupport: input.nativeProviderWebSearchSupport,
|
|
889
|
-
webSearchAllowed
|
|
849
|
+
webSearchAllowed
|
|
890
850
|
});
|
|
891
|
-
webFetchHostnameAllowlistRef.value = requestedWebSearchPlan.webFetchHostnameAllowlist;
|
|
892
851
|
const webSearchPlan = requestedWebSearchPlan.kind === "managed" ? resolveCodexWebSearchPlan({
|
|
893
|
-
config:
|
|
852
|
+
config: params.config,
|
|
894
853
|
webSearchAllowed: false
|
|
895
854
|
}) : requestedWebSearchPlan;
|
|
896
|
-
const exposedTools =
|
|
897
|
-
const hookChannelFields = buildAgentHookContextChannelFields({
|
|
898
|
-
sessionKey: input.params.sessionKey,
|
|
899
|
-
messageChannel: input.params.messageChannel,
|
|
900
|
-
messageProvider: input.params.messageProvider,
|
|
901
|
-
currentChannelId: input.params.currentChannelId
|
|
902
|
-
});
|
|
855
|
+
const exposedTools = tools.filter((tool) => tool.name !== "web_search" && tool.name !== "computer");
|
|
903
856
|
return {
|
|
904
857
|
toolBridge: createCodexDynamicToolBridge({
|
|
905
858
|
tools: exposedTools,
|
|
906
|
-
signal: input.signal,
|
|
859
|
+
signal: input.runAbortController.signal,
|
|
907
860
|
loading: resolveCodexDynamicToolsLoading(input.pluginConfig),
|
|
908
861
|
hookContext: {
|
|
909
862
|
agentId: input.sessionAgentId,
|
|
910
|
-
config:
|
|
911
|
-
contextWindowTokens:
|
|
912
|
-
sessionId:
|
|
913
|
-
sessionKey:
|
|
914
|
-
runId:
|
|
915
|
-
currentChannelProvider:
|
|
916
|
-
...
|
|
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)
|
|
917
870
|
}
|
|
918
871
|
}),
|
|
919
872
|
webSearchPlan
|
|
@@ -934,26 +887,9 @@ async function forkCodexSideThread(client, params, options) {
|
|
|
934
887
|
}
|
|
935
888
|
}
|
|
936
889
|
function isMissingCodexParentThreadError(error) {
|
|
937
|
-
const message = formatErrorMessage(error);
|
|
890
|
+
const message = formatErrorMessage$1(error);
|
|
938
891
|
return message.includes("no rollout found for thread id") || message.includes("includeTurns is unavailable before first user message");
|
|
939
892
|
}
|
|
940
|
-
async function cleanupCodexSideThread(client, params) {
|
|
941
|
-
if (!params.threadId) return;
|
|
942
|
-
if (params.interrupt && params.turnId !== void 0) {
|
|
943
|
-
if (!await interruptCodexTurnAndWaitBestEffort(client, {
|
|
944
|
-
threadId: params.threadId,
|
|
945
|
-
turnId: params.turnId,
|
|
946
|
-
timeoutMs: params.timeoutMs
|
|
947
|
-
})) {
|
|
948
|
-
await retireUnsafeCodexTurnClientBestEffort(client, "side turn interrupt");
|
|
949
|
-
return;
|
|
950
|
-
}
|
|
951
|
-
}
|
|
952
|
-
if (!await unsubscribeCodexThreadBestEffort(client, {
|
|
953
|
-
threadId: params.threadId,
|
|
954
|
-
timeoutMs: params.timeoutMs
|
|
955
|
-
})) await retireUnsafeCodexTurnClientBestEffort(client, "side thread unsubscribe");
|
|
956
|
-
}
|
|
957
893
|
function formatCodexErrorMessage(params, rateLimits) {
|
|
958
894
|
const error = isJsonObject(params.error) ? params.error : void 0;
|
|
959
895
|
const message = formatCodexUsageLimitErrorMessage({
|
|
@@ -961,7 +897,7 @@ function formatCodexErrorMessage(params, rateLimits) {
|
|
|
961
897
|
codexErrorInfo: error?.codexErrorInfo,
|
|
962
898
|
rateLimits
|
|
963
899
|
}) ?? (error ? readStringField(error, "message") ?? readStringField(error, "error") : void 0) ?? readStringField(params, "message") ?? "Codex /btw side thread failed.";
|
|
964
|
-
return new Error(formatErrorMessage(message));
|
|
900
|
+
return new Error(formatErrorMessage$1(message));
|
|
965
901
|
}
|
|
966
902
|
//#endregion
|
|
967
903
|
export { runCodexAppServerSideQuestion };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
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-
|
|
3
|
-
import { a as defaultCodexAppInventoryCache, r as buildCodexPluginAppCacheKey } from "./plugin-app-cache-key-
|
|
4
|
-
import { o as withCodexAppServerJsonClient } from "./request-
|
|
5
|
-
import "./config-
|
|
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
|
|
@@ -410,13 +410,13 @@ function sourcePluginAppFactWithInventory(app, info, installedApp) {
|
|
|
410
410
|
};
|
|
411
411
|
if (!installedApp.enabled) return {
|
|
412
412
|
...app,
|
|
413
|
-
isAccessible:
|
|
413
|
+
isAccessible: true,
|
|
414
414
|
isEnabled: false
|
|
415
415
|
};
|
|
416
416
|
return {
|
|
417
417
|
...app,
|
|
418
|
-
isAccessible:
|
|
419
|
-
isEnabled:
|
|
418
|
+
isAccessible: installedApp.callable,
|
|
419
|
+
isEnabled: installedApp.enabled,
|
|
420
420
|
...!installedApp.callable ? { isCallable: false } : {}
|
|
421
421
|
};
|
|
422
422
|
}
|
|
@@ -516,4 +516,4 @@ function sanitizePluginName(value) {
|
|
|
516
516
|
return value.trim().toLowerCase().replaceAll(/\s+/gu, "-");
|
|
517
517
|
}
|
|
518
518
|
//#endregion
|
|
519
|
-
export { source_exports as a,
|
|
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 };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-registration";
|
|
2
|
+
import { resolveGlobalSingleton } from "openclaw/plugin-sdk/global-singleton";
|
|
3
|
+
//#region extensions/codex/src/app-server/spawn-error.ts
|
|
4
|
+
const failures = resolveGlobalSingleton(Symbol.for("openclaw.codexSpawnFailures"), () => ({
|
|
5
|
+
commands: /* @__PURE__ */ new Map(),
|
|
6
|
+
errors: /* @__PURE__ */ new WeakMap(),
|
|
7
|
+
reported: /* @__PURE__ */ new Set()
|
|
8
|
+
}));
|
|
9
|
+
/** Also accepts the command runner's sanitized launch code (without syscall/errno). */
|
|
10
|
+
function codexSpawnFailureReason(error) {
|
|
11
|
+
if (!(error instanceof Error)) return;
|
|
12
|
+
const failure = error;
|
|
13
|
+
if (failure.syscall === void 0 || failure.syscall.startsWith("spawn")) {
|
|
14
|
+
if (failure.code === "EBADARCH" || failure.errno === -86 || failure.code === "Unknown system error -86") return "is not runnable on this CPU";
|
|
15
|
+
if (failure.code === "ENOENT") return "or its working directory was not found";
|
|
16
|
+
if (failure.code === "EACCES") return "is not executable or its working directory is inaccessible";
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
var CodexAppServerSpawnError = class extends Error {
|
|
20
|
+
constructor(command, reason, cause) {
|
|
21
|
+
super(`Codex catalog updater cannot run: ${command} ${reason}. Repair the executable or working directory and restart the Gateway.`, { cause });
|
|
22
|
+
this.command = command;
|
|
23
|
+
this.name = "CodexAppServerSpawnError";
|
|
24
|
+
failures.errors.set(this, this);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
function findCodexAppServerSpawnError(error) {
|
|
28
|
+
let current = error;
|
|
29
|
+
const seen = /* @__PURE__ */ new Set();
|
|
30
|
+
while (current instanceof Error && !seen.has(current)) {
|
|
31
|
+
const failure = failures.errors.get(current);
|
|
32
|
+
if (failure) return failure;
|
|
33
|
+
seen.add(current);
|
|
34
|
+
current = current.cause;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function describeCodexSpawnError(error, command) {
|
|
38
|
+
const reason = codexSpawnFailureReason(error);
|
|
39
|
+
return reason ? new CodexAppServerSpawnError(command, reason, error) : error;
|
|
40
|
+
}
|
|
41
|
+
function getCodexAppServerSpawnFailure(command) {
|
|
42
|
+
return failures.commands.get(command);
|
|
43
|
+
}
|
|
44
|
+
function recordCodexAppServerSpawnFailure(error, command, launchKey) {
|
|
45
|
+
const described = describeCodexSpawnError(error, command);
|
|
46
|
+
const failure = findCodexAppServerSpawnError(described);
|
|
47
|
+
if (failure) failures.commands.set(launchKey, failure);
|
|
48
|
+
return described;
|
|
49
|
+
}
|
|
50
|
+
function reportCodexCatalogSpawnFailure(failure) {
|
|
51
|
+
if (!failures.reported.has(failure.command)) {
|
|
52
|
+
failures.reported.add(failure.command);
|
|
53
|
+
embeddedAgentLog.warn(failure.message);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
export { reportCodexCatalogSpawnFailure as a, recordCodexAppServerSpawnFailure as i, findCodexAppServerSpawnError as n, getCodexAppServerSpawnFailure as r, describeCodexSpawnError as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
|
|
2
2
|
import { normalizeBoundedOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
//#region extensions/codex/src/app-server/thread-archive-guard.ts
|
|
4
4
|
const DESCENDANT_PAGE_LIMIT = 100;
|
|
@@ -19,11 +19,12 @@ async function assertCodexArchiveDescendantsUnowned(params) {
|
|
|
19
19
|
if (!ancestorThreadId) throw new Error("cannot verify Codex archive descendants for an invalid thread id");
|
|
20
20
|
const seenCursors = /* @__PURE__ */ new Set();
|
|
21
21
|
const seenThreadIds = /* @__PURE__ */ new Set([ancestorThreadId]);
|
|
22
|
+
let archived = false;
|
|
22
23
|
let cursor;
|
|
23
24
|
for (let pageIndex = 0; pageIndex < MAX_DESCENDANT_PAGES; pageIndex += 1) {
|
|
24
25
|
const response = await params.listPage({
|
|
25
26
|
ancestorThreadId,
|
|
26
|
-
archived
|
|
27
|
+
archived,
|
|
27
28
|
limit: DESCENDANT_PAGE_LIMIT,
|
|
28
29
|
sortKey: "created_at",
|
|
29
30
|
sortDirection: "desc",
|
|
@@ -42,7 +43,13 @@ async function assertCodexArchiveDescendantsUnowned(params) {
|
|
|
42
43
|
if (await params.bindingStore.hasOtherThreadOwner(descendantThreadId)) throw new Error("cannot archive a Codex thread while a spawned descendant is owned by an OpenClaw session");
|
|
43
44
|
}
|
|
44
45
|
const nextCursor = readNextCursor(response.nextCursor);
|
|
45
|
-
if (!nextCursor)
|
|
46
|
+
if (!nextCursor) {
|
|
47
|
+
if (archived) return;
|
|
48
|
+
archived = true;
|
|
49
|
+
cursor = void 0;
|
|
50
|
+
seenCursors.clear();
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
46
53
|
if (seenCursors.has(nextCursor)) throw new Error("Codex app-server returned a repeated descendant-list cursor");
|
|
47
54
|
seenCursors.add(nextCursor);
|
|
48
55
|
cursor = nextCursor;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { M as parseTranscriptPage, P as readControlCursor, v as CatalogParamsError } from "./session-catalog-native-projection-DowriLid.mjs";
|
|
2
2
|
//#region extensions/codex/src/app-server/thread-history-page.ts
|
|
3
3
|
const TURN_ITEM_CURSOR_PREFIX = "turn-item:";
|
|
4
4
|
function encodeTurnItemCursor(turnCursor, itemId) {
|