@openclaw/codex 2026.9.7 → 2026.10.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/dist/.setup/{account-usage-runtime-DFhbh1zz.mjs → account-usage-runtime-C4GFoef_.mjs} +5 -5
- package/dist/.setup/app-server-policy-Bg4FZw1f.mjs +23 -0
- package/dist/.setup/{apply-D3GcSoSa.mjs → apply-D02fLpgN.mjs} +48 -39
- package/dist/.setup/attempt-client-cleanup-yLjGwbwT.mjs +155 -0
- package/dist/.setup/{attempt-workspace-context-C5HigshI.mjs → attempt-workspace-context-CbSzT6V2.mjs} +11 -15
- package/dist/.setup/{auth-binding-BLWz7stm.mjs → auth-binding-BoMwpuPN.mjs} +17 -25
- package/dist/.setup/{auth-cache-key-Dbvq-QgB.mjs → auth-cache-key-CEd9QlIs.mjs} +244 -82
- package/dist/.setup/{auth-profile-B0okYl2D.mjs → auth-profile-CgHQ8Vot.mjs} +2 -1
- package/dist/.setup/{auth-profile-selection-DFu9e167.mjs → auth-profile-selection-hr8ocLtz.mjs} +5 -7
- package/dist/.setup/{binding-connection-DTtN1KrX.mjs → binding-connection-C-08ez1w.mjs} +2 -2
- package/dist/.setup/{binding-connection.runtime-6TpgD1M6.mjs → binding-connection.runtime-Dn2p-fdy.mjs} +3 -3
- package/dist/.setup/{bounded-turn-CbjoN2OW.mjs → bounded-turn-DlHlNTyS.mjs} +14 -13
- package/dist/.setup/{bounded-turn-isolation-B8K_ylqk.mjs → bounded-turn-isolation-DklXNk3k.mjs} +4 -4
- package/dist/.setup/{build-state-Da1_z0kd.mjs → build-state-CIi3Ckqu.mjs} +1 -1
- package/dist/.setup/{capabilities-B3WEZl4e.mjs → capabilities-kQntafj_.mjs} +1 -1
- package/dist/.setup/{client-N0JpgSzF.mjs → client-CBzEVDyb.mjs} +438 -160
- package/dist/.setup/{client-catalog-response-5HHLdcde.mjs → client-catalog-response-CmvIiDdj.mjs} +57 -25
- package/dist/.setup/command-authorization-AikPDtcc.mjs +15 -0
- package/dist/.setup/{command-dispatch-BeAoaovI.mjs → command-dispatch-BE_RdMou.mjs} +3 -3
- package/dist/.setup/{command-formatters-R3ckE3Co.mjs → command-formatters-DV3DHhdr.mjs} +7 -5
- package/dist/.setup/{command-handlers-ylTMS00z.mjs → command-handlers-DNoRq5Ps.mjs} +82 -144
- package/dist/.setup/{command-rpc-CGJGUQ6Y.mjs → command-rpc-B6xsq2dB.mjs} +23 -31
- package/dist/.setup/{compact-C2WamavS.mjs → compact-BLSAd-ru.mjs} +117 -65
- package/dist/.setup/{plugin-metadata-cache-DsjsL1dr.mjs → computer-use-DpolvQHw.mjs} +66 -203
- package/dist/.setup/{config-DKhXquav.mjs → config-0Gxk3_eq.mjs} +5 -6
- package/dist/.setup/{config-options-CzyWLTJt.mjs → config-options-HG_Rr3W_.mjs} +13 -23
- package/dist/.setup/{config-parsing-b088LyhT.mjs → config-parsing-BQq-CHTF.mjs} +41 -4
- package/dist/.setup/{config-runtime-C0NbLms1.mjs → config-runtime-cUYrqu_a.mjs} +2 -2
- package/dist/.setup/{config-security-CE-FcGw9.mjs → config-security-KAPScztc.mjs} +20 -36
- package/dist/.setup/{context-engine-projection-PezSESth.mjs → context-engine-projection-CsgYSQhW.mjs} +11 -14
- package/dist/.setup/{conversation-binding-3Min8qvP.mjs → conversation-binding-CgSSD1Qz.mjs} +36 -48
- package/dist/.setup/{conversation-binding-data-C746z5Pn.mjs → conversation-binding-data-DJ4ix-W5.mjs} +1 -1
- package/dist/.setup/{conversation-control-CEP8X5JC.mjs → conversation-control-tCg763cI.mjs} +19 -21
- package/dist/.setup/{cyber-failover-XV0nNRZu.mjs → cyber-failover-Bb1J6hS1.mjs} +1 -1
- package/dist/.setup/{cyber-failover-notice-RNpGpTyP.mjs → cyber-failover-notice-XR03ef31.mjs} +1 -1
- package/dist/.setup/doctor-start-options-DPW9JxIE.mjs +63 -0
- package/dist/.setup/dynamic-tool-build-CVrx02cH.mjs +463 -0
- package/dist/.setup/{dynamic-tools-DzlsLUuS.mjs → dynamic-tools-DdsymYGQ.mjs} +238 -878
- package/dist/.setup/{effective-mcp-catalog-CxUtC-xG.mjs → effective-mcp-catalog-BysTBZCW.mjs} +83 -11
- package/dist/.setup/{elicitation-input-DPoK8F7w.mjs → elicitation-input-r9axtppm.mjs} +4 -2
- package/dist/.setup/{ephemeral-turn-CDsPJOa2.mjs → ephemeral-turn-oPKxs3ia.mjs} +2 -2
- package/dist/.setup/{event-projector-assistant-message-CigreO4K.mjs → event-projector-assistant-message-YCL2wspu.mjs} +2 -2
- package/dist/.setup/{event-projector-values-DJSz8BTk.mjs → event-projector-values-DTqZHizf.mjs} +2 -12
- package/dist/.setup/{inference-dispatch-CMZtjQyz.mjs → inference-dispatch-B5UKEUyC.mjs} +12 -21
- package/dist/.setup/{inference-proxy-DhcXOgUE.mjs → inference-proxy-DUO5E2QQ.mjs} +6 -5
- package/dist/.setup/{isolated-completion-Dm3PzxJk.mjs → isolated-completion-D5gbKm6k.mjs} +8 -8
- package/dist/.setup/{managed-binary-kiWRhNRE.mjs → managed-binary-C1VFoVPf.mjs} +31 -38
- package/dist/.setup/mcp-app-session-preparation-CdqsXwZX.mjs +223 -0
- package/dist/.setup/mcp-tool-metadata-j10HhfTC.mjs +43 -0
- package/dist/.setup/{model-catalog-PAuZgJC6.mjs → model-catalog-Dj_uvusa.mjs} +7 -7
- package/dist/.setup/{models-DHXZtVVk.mjs → models-Du_i5G_t.mjs} +10 -7
- package/dist/.setup/{native-auth-CuG53tu4.mjs → native-auth-Cjb9y7IZ.mjs} +5 -6
- package/dist/.setup/{native-execution-policy-BxZJy5mP.mjs → native-execution-policy-ClzpdG3D.mjs} +1 -12
- package/dist/.setup/native-mcp-app-DV7VbfzF.mjs +310 -0
- package/dist/.setup/{native-subagent-monitor-Dpsmf2wz.mjs → native-subagent-monitor-CCEFO6qK.mjs} +235 -318
- package/dist/.setup/{native-subagent-pending-assignments-DwkCzLvD.mjs → native-subagent-pending-assignments-BDqhOdJp.mjs} +0 -4
- package/dist/.setup/{native-task-assignments-DMQ0g3hu.mjs → native-task-assignments-C6KVqiN1.mjs} +9 -8
- package/dist/.setup/{node-cli-sessions-HC4W6FLI.mjs → node-cli-sessions-B5oNDkUS.mjs} +11 -17
- package/dist/.setup/{node-exec-server.runtime-BgBfWQqo.mjs → node-exec-server.runtime-0xSEjKYt.mjs} +2 -2
- package/dist/.setup/{plan-Y-QIvrKB.mjs → plan-CUHSIOep.mjs} +67 -89
- package/dist/.setup/{plugin-activation-cNHRfaxU.mjs → plugin-activation-BcyBv8PG.mjs} +4 -4
- package/dist/.setup/{plugin-app-cache-key-BL9B5H0L.mjs → plugin-app-cache-key-BW8rd98k.mjs} +11 -15
- package/dist/.setup/plugin-approval-roundtrip-uAR-oQfr.mjs +109 -0
- package/dist/.setup/{plugin-inventory-Cky2XJUw.mjs → plugin-inventory-Bf0_piTw.mjs} +29 -51
- package/dist/.setup/{plugin-marketplace-discovery-D_dV9FXa.mjs → plugin-marketplace-discovery-SQPhSuic.mjs} +2 -16
- package/dist/.setup/plugin-metadata-cache-DWnB7VMj.mjs +84 -0
- package/dist/.setup/plugin-thread-config-deadline-CdRzGJt4.mjs +124 -0
- package/dist/.setup/{provider-DH8NSzGt.mjs → provider-BP8ZaZqn.mjs} +4 -4
- package/dist/.setup/provider-capabilities-Z5ZbBxqP.mjs +50 -0
- package/dist/.setup/{rate-limits-B7-X2TgG.mjs → rate-limits-CMPy24F5.mjs} +1 -5
- package/dist/.setup/{request-BHZ1nz8d.mjs → request-BH3FvYUE.mjs} +189 -49
- package/dist/.setup/rpc-error-hmWM21RB.mjs +57 -0
- package/dist/.setup/{run-attempt-D8RZUOzY.mjs → run-attempt-CgvFoW7R.mjs} +553 -727
- package/dist/.setup/{run-attempt-lifecycle-C-6O3Exn.mjs → run-attempt-lifecycle-BuZgVbDA.mjs} +19 -3
- package/dist/.setup/{runtime-artifact-DDQ-HGXf.mjs → runtime-artifact-CUTOOnKw.mjs} +5 -6
- package/dist/.setup/{runtime-artifact-connection-D68qQn1m.mjs → runtime-artifact-connection-CADz3_BY.mjs} +5 -4
- package/dist/.setup/{sandbox-guard-DjCz2eOw.mjs → sandbox-guard-WqE8yPge.mjs} +3 -3
- package/dist/.setup/service-tier-normalization-Cei89SW6.mjs +15 -0
- package/dist/.setup/{session-binding-DGCYAfvD.mjs → session-binding-Ce7BqiPN.mjs} +92 -102
- package/dist/.setup/session-binding-meta-Lkm5Lpf4.mjs +15 -0
- package/dist/.setup/session-binding-record-BZB8RgcF.mjs +179 -0
- package/dist/.setup/session-binding-record-codec-z4ZpDn6E.mjs +216 -0
- package/dist/.setup/{session-binding-sidecars-jo6H8dFr.mjs → session-binding-sidecars-BrdV95Fg.mjs} +8 -2
- package/dist/.setup/{session-catalog-adoption-BU_pHWG7.mjs → session-catalog-adoption-CPIP4S_y.mjs} +34 -18
- package/dist/.setup/{session-catalog-archive-spHfihri.mjs → session-catalog-archive-DcgwvSbF.mjs} +24 -29
- package/dist/.setup/{session-catalog-events-DePDzzjc.mjs → session-catalog-events-KIXOoSnQ.mjs} +5 -5
- package/dist/.setup/{session-catalog-index-CZvDzC6z.mjs → session-catalog-index-DPICGlxr.mjs} +361 -72
- package/dist/.setup/{session-catalog-index-order-BcQpHks3.mjs → session-catalog-index-order-nhyO0wdW.mjs} +1 -1
- package/dist/.setup/{session-catalog-limits-DDxOsQeC.mjs → session-catalog-limits-DEU36Qlo.mjs} +1 -1
- package/dist/.setup/{session-catalog-index-state-TeO7EyO-.mjs → session-catalog-list-request-tXephOB4.mjs} +180 -6
- package/dist/.setup/{session-catalog-native-projection-DjhwGL6x.mjs → session-catalog-native-projection-CTBd4EUm.mjs} +7 -6
- package/dist/.setup/{session-catalog-node-adoption-DgXvSGu0.mjs → session-catalog-node-adoption-7-WEQTB1.mjs} +12 -2
- package/dist/.setup/{session-catalog-node-continue-DjKXHBbi.mjs → session-catalog-node-continue-DLWBwAAO.mjs} +11 -15
- package/dist/.setup/{session-catalog-node-lookup-CtAXI5W5.mjs → session-catalog-node-lookup-Uufckwcm.mjs} +2 -2
- package/dist/.setup/{session-catalog-parsing-CPGaPYr-.mjs → session-catalog-parsing-B-qWJh2x.mjs} +70 -28
- package/dist/.setup/{session-catalog-projection-Cr5qP5Dj.mjs → session-catalog-projection-CE0_Hffi.mjs} +6 -122
- package/dist/.setup/{session-catalog-provenance-DoAvktcj.mjs → session-catalog-provenance-CmsOE5mh.mjs} +6 -1
- package/dist/.setup/{session-cli-Cn_nCqfq.mjs → session-cli-kH4vuGod.mjs} +1 -2
- package/dist/.setup/{session-history-D83lJWHG.mjs → session-history-BogBHKLk.mjs} +1 -1
- package/dist/.setup/{session-history-import-WhX-X33a.mjs → session-history-import-NWKPa4ZO.mjs} +4 -4
- package/dist/.setup/{session-history-read-Ov3StuL4.mjs → session-history-read-CNN8zwbD.mjs} +8 -19
- package/dist/.setup/{session-history.worker-MnPKncqP.mjs → session-history.worker-Cq_4DYgN.mjs} +3 -3
- package/dist/.setup/{session-initialization-6aveB9qb.mjs → session-initialization-D6dtFQkE.mjs} +2 -2
- package/dist/.setup/{session-permission-policy-Ci_fVX6y.mjs → session-permission-policy-BxIUJ0Zd.mjs} +8 -37
- package/dist/.setup/{session-retirement-qMTxkNx2.mjs → session-retirement-aC60o6P3.mjs} +14 -15
- package/dist/.setup/{settled-turn-context-D4yj4rxf.mjs → settled-turn-context-BZsMjkIO.mjs} +13 -6
- package/dist/.setup/{settled-turn-finalizer-BsvEabkw.mjs → settled-turn-finalizer-CDxCejjC.mjs} +8 -8
- package/dist/.setup/{shared-client-DqyTMYug.mjs → shared-client-DJJ3ljH2.mjs} +291 -272
- package/dist/.setup/{provider-capabilities-CAxoF-X1.mjs → shell-dynamic-tools-Do9lIAT1.mjs} +16 -55
- package/dist/.setup/{side-question-C4kCmQy1.mjs → side-question-B7T0_GEC.mjs} +99 -91
- package/dist/.setup/{source-CS_7GFJZ.mjs → source-DH70LqN0.mjs} +24 -40
- package/dist/.setup/{thread-lifecycle-DPflntEJ.mjs → thread-lifecycle-DkcoX9q-.mjs} +262 -305
- package/dist/.setup/{thread-ownership-roNP0l1c.mjs → thread-ownership-0aRHD9iK.mjs} +10 -8
- package/dist/.setup/{thread-policy-DTd-DtkX.mjs → thread-policy-CXZV97TS.mjs} +22 -21
- package/dist/.setup/{thread-requests-B_bRnMGN.mjs → thread-requests-COrRJcZb.mjs} +107 -98
- package/dist/.setup/{thread-resume-CdDaoc7T.mjs → thread-resume-rx7J68Rx.mjs} +10 -18
- package/dist/.setup/{transcript-history-projection-DRSifI-1.mjs → transcript-history-projection-B9a7HwUV.mjs} +11 -16
- package/dist/.setup/{transcript-mirror-kxmCYsuF.mjs → transcript-mirror-BfLRARNL.mjs} +64 -67
- package/dist/.setup/{transport-stdio-Bdegpn2V.mjs → transport-stdio-a0HDa2Mj.mjs} +27 -8
- package/dist/.setup/{transport-websocket-BTBE-LD9.mjs → transport-websocket-zqJ0Cmtn.mjs} +3 -8
- package/dist/.setup/{attempt-client-cleanup-DOP-cW5j.mjs → turn-router-CX1-EoCp.mjs} +75 -170
- package/dist/.setup/{upstream-session-fork-CBeVjBpT.mjs → upstream-session-fork-LYlaQnbt.mjs} +35 -46
- package/dist/.setup/{usage-BMzNxeR_.mjs → usage-Dmx7B0W2.mjs} +4 -4
- package/dist/.setup/{usage-limit-error-QXerDo3i.mjs → usage-limit-error-M8jVnITZ.mjs} +4 -4
- package/dist/.setup/{web-search-provider.runtime-P77OUeoo.mjs → web-search-provider.runtime-CsVmqbFm.mjs} +4 -20
- package/dist/.setup/websocket-data-XlRvt8Ys.mjs +6 -0
- package/dist/.setup/workspace-write-sandbox-probe-DmUHLrrl.mjs +118 -0
- package/dist/api.js +34 -54
- package/dist/catalog-page.worker.js +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/doctor-contract-api.js +15 -27
- package/dist/harness.js +37 -22
- package/dist/index.js +2880 -276
- package/dist/media-understanding-provider.js +2 -2
- package/dist/migration-provider-api.js +1 -1
- package/dist/native-session-binding-api.js +2 -0
- package/dist/provider-discovery.js +1 -1
- package/dist/session-history-worker-runtime.js +33 -4
- package/dist/session-history.worker.js +1 -1
- package/openclaw.plugin.json +3 -3
- package/package.json +6 -6
- package/dist/.setup/config-utils-D0CXecki.mjs +0 -57
- package/dist/.setup/incognito-session-DWYapfwf.mjs +0 -2
- package/dist/.setup/managed-thread-store-BMqgThVL.mjs +0 -100
- package/dist/.setup/rpc-error-BlD2vuzn.mjs +0 -31
- package/dist/.setup/session-binding-meta-B7aEMU7g.mjs +0 -6
- package/dist/.setup/session-binding-record-Oe9L-CNY.mjs +0 -375
- package/dist/.setup/session-catalog-4sCdv5qx.mjs +0 -2610
- package/dist/.setup/session-catalog-list-request-CvtxrYSe.mjs +0 -170
- package/dist/.setup/shared-client-lifecycle-DJIgqgMw.mjs +0 -153
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
|
|
2
|
-
import { d as retireSharedCodexAppServerClientIfCurrent } from "./shared-client-lifecycle-DJIgqgMw.mjs";
|
|
3
|
-
import { n as CodexAppServerRpcError } from "./rpc-error-BlD2vuzn.mjs";
|
|
4
2
|
import { n as waitForPromiseOrAbort, t as abortReason } from "./timeout-CXOfNoaX.mjs";
|
|
5
|
-
import {
|
|
6
|
-
import { E as readCodexTurnCompletedNotification, a as isCodexAppServerBrokenPipeError, d as isCodexAppServerRequestTimeoutError, l as isCodexAppServerOverloadError } from "./client-N0JpgSzF.mjs";
|
|
7
|
-
import { t as __exportAll } from "./session-binding-sidecars-jo6H8dFr.mjs";
|
|
3
|
+
import { x as readCodexTurnCompletedNotification } from "./client-CBzEVDyb.mjs";
|
|
8
4
|
import { normalizeOptionalString, readStringField } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
5
|
import { AsyncResource } from "node:async_hooks";
|
|
10
6
|
import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
|
|
11
7
|
import { sanitizeTerminalText } from "openclaw/plugin-sdk/text-chunking";
|
|
12
|
-
import {
|
|
8
|
+
import { embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
13
9
|
import { redactSensitiveText } from "openclaw/plugin-sdk/logging-core";
|
|
14
10
|
//#region extensions/codex/src/app-server/event-projector-items.ts
|
|
15
11
|
const itemStatuses = /* @__PURE__ */ new Map([
|
|
16
12
|
["completed", "completed"],
|
|
17
13
|
["failed", "failed"],
|
|
18
14
|
["error", "failed"],
|
|
15
|
+
["interrupted", "failed"],
|
|
19
16
|
["declined", "blocked"],
|
|
20
17
|
["inProgress", "running"],
|
|
21
18
|
["in_progress", "running"],
|
|
@@ -144,6 +141,15 @@ function readCodexNotificationThreadId(record) {
|
|
|
144
141
|
function readCodexNotificationTurnId(record) {
|
|
145
142
|
return (isJsonObject(record.turn) ? normalizeOptionalString(record.turn.id) : void 0) ?? normalizeOptionalString(record.turnId);
|
|
146
143
|
}
|
|
144
|
+
function readCodexNotificationScope(value) {
|
|
145
|
+
if (!isJsonObject(value)) return {};
|
|
146
|
+
const threadId = readCodexNotificationThreadId(value);
|
|
147
|
+
const turnId = readCodexNotificationTurnId(value);
|
|
148
|
+
return {
|
|
149
|
+
...threadId ? { threadId } : {},
|
|
150
|
+
...turnId ? { turnId } : {}
|
|
151
|
+
};
|
|
152
|
+
}
|
|
147
153
|
//#endregion
|
|
148
154
|
//#region extensions/codex/src/app-server/event-projector-diagnostics.ts
|
|
149
155
|
function redactCodexEventKind(method) {
|
|
@@ -192,6 +198,52 @@ var CodexProjectionDiagnostics = class {
|
|
|
192
198
|
}
|
|
193
199
|
};
|
|
194
200
|
//#endregion
|
|
201
|
+
//#region extensions/codex/src/app-server/mcp-request-route.ts
|
|
202
|
+
/** Subscope of the physical client router; there is no independent connection or registry. */
|
|
203
|
+
var CodexMcpRequestRoutes = class {
|
|
204
|
+
constructor() {
|
|
205
|
+
this.routes = /* @__PURE__ */ new Map();
|
|
206
|
+
}
|
|
207
|
+
hasSiblingWork(threadId) {
|
|
208
|
+
return [...this.routes.values()].some((route) => route.threadId !== threadId);
|
|
209
|
+
}
|
|
210
|
+
async run(options, operation) {
|
|
211
|
+
options.signal?.throwIfAborted();
|
|
212
|
+
const key = JSON.stringify([options.threadId, options.serverName]);
|
|
213
|
+
if (this.routes.has(key)) throw new Error("An MCP App call is already pending for this server in the conversation");
|
|
214
|
+
const route = {
|
|
215
|
+
threadId: options.threadId,
|
|
216
|
+
controller: new AbortController(),
|
|
217
|
+
onRequest: AsyncResource.bind(options.onRequest)
|
|
218
|
+
};
|
|
219
|
+
const abort = () => route.controller.abort(options.signal?.reason);
|
|
220
|
+
options.signal?.addEventListener("abort", abort, { once: true });
|
|
221
|
+
this.routes.set(key, route);
|
|
222
|
+
try {
|
|
223
|
+
return await operation();
|
|
224
|
+
} finally {
|
|
225
|
+
options.signal?.removeEventListener("abort", abort);
|
|
226
|
+
this.routes.delete(key);
|
|
227
|
+
route.controller.abort(/* @__PURE__ */ new Error("MCP App call ended"));
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
route(request, scope, signal, setExecutionTimeoutMs) {
|
|
231
|
+
if (scope.turnId || request.method !== "mcpServer/elicitation/request" || !isJsonObject(request.params) || typeof request.params.serverName !== "string") return;
|
|
232
|
+
const route = this.routes.get(JSON.stringify([scope.threadId, request.params.serverName]));
|
|
233
|
+
if (!route) return;
|
|
234
|
+
return (async () => {
|
|
235
|
+
const requestSignal = AbortSignal.any([signal, route.controller.signal]);
|
|
236
|
+
requestSignal.throwIfAborted();
|
|
237
|
+
const result = await route.onRequest(request, scope, requestSignal, setExecutionTimeoutMs);
|
|
238
|
+
return requestSignal.aborted ? void 0 : result;
|
|
239
|
+
})();
|
|
240
|
+
}
|
|
241
|
+
close(error) {
|
|
242
|
+
for (const route of this.routes.values()) route.controller.abort(error);
|
|
243
|
+
this.routes.clear();
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
//#endregion
|
|
195
247
|
//#region extensions/codex/src/app-server/turn-router.ts
|
|
196
248
|
const DEFAULT_PREBIND_NOTIFICATION_LIMIT = 256;
|
|
197
249
|
const DEFAULT_GLOBAL_WARNING_LIMIT = 32;
|
|
@@ -209,18 +261,23 @@ function getCodexAppServerTurnRouter(client) {
|
|
|
209
261
|
}
|
|
210
262
|
var ClientTurnRouter = class {
|
|
211
263
|
hasSiblingWork(threadId) {
|
|
212
|
-
|
|
213
|
-
for (const
|
|
264
|
+
if (this.mcpRequests.hasSiblingWork(threadId)) return true;
|
|
265
|
+
for (const threads of [this.routes, this.nativeTurnCompletionWatchers]) for (const siblingThreadId of threads.keys()) if (siblingThreadId !== threadId) return true;
|
|
214
266
|
return false;
|
|
215
267
|
}
|
|
216
268
|
constructor(client) {
|
|
217
269
|
this.routes = /* @__PURE__ */ new Map();
|
|
270
|
+
this.mcpRequests = new CodexMcpRequestRoutes();
|
|
218
271
|
this.globalWarnings = [];
|
|
219
272
|
this.nativeTurnCompletionWatchers = /* @__PURE__ */ new Map();
|
|
220
273
|
client.addNotificationHandler((notification) => this.routeNotification(notification));
|
|
221
274
|
client.addRequestHandler((request, signal, setExecutionTimeoutMs) => this.routeRequest(request, signal, setExecutionTimeoutMs));
|
|
222
275
|
client.addCloseHandler((closedClient) => this.dispose(closedClient.getCloseError()));
|
|
223
276
|
}
|
|
277
|
+
async withMcpToolCall(options, run) {
|
|
278
|
+
this.assertActive();
|
|
279
|
+
return await this.mcpRequests.run(options, run);
|
|
280
|
+
}
|
|
224
281
|
reserveThread(options) {
|
|
225
282
|
this.assertActive();
|
|
226
283
|
const threadId = requireId(options.threadId, "thread id");
|
|
@@ -315,6 +372,7 @@ var ClientTurnRouter = class {
|
|
|
315
372
|
if (this.closeError) return;
|
|
316
373
|
const closeError = cause ? new Error("codex app-server turn router closed", { cause }) : /* @__PURE__ */ new Error("codex app-server turn router closed");
|
|
317
374
|
this.closeError = closeError;
|
|
375
|
+
this.mcpRequests.close(closeError);
|
|
318
376
|
for (const route of this.routes.values()) this.release(route, closeError);
|
|
319
377
|
for (const watchers of this.nativeTurnCompletionWatchers.values()) for (const watcher of watchers) watcher.finish(false);
|
|
320
378
|
}
|
|
@@ -383,7 +441,7 @@ var ClientTurnRouter = class {
|
|
|
383
441
|
}
|
|
384
442
|
routeNotification(notification) {
|
|
385
443
|
if (this.closeError) return;
|
|
386
|
-
const scope =
|
|
444
|
+
const scope = readCodexNotificationScope(notification.params);
|
|
387
445
|
if (!scope.threadId && (notification.method === "configWarning" || notification.method === "warning")) {
|
|
388
446
|
if (this.globalWarnings.length === DEFAULT_GLOBAL_WARNING_LIMIT) this.globalWarnings.shift();
|
|
389
447
|
this.globalWarnings.push(notification);
|
|
@@ -443,8 +501,13 @@ var ClientTurnRouter = class {
|
|
|
443
501
|
}
|
|
444
502
|
async routeRequest(request, signal = new AbortController().signal, setExecutionTimeoutMs) {
|
|
445
503
|
if (this.closeError || signal.aborted) return;
|
|
446
|
-
const scope =
|
|
504
|
+
const scope = readCodexNotificationScope(request.params);
|
|
447
505
|
if (!scope.threadId) return;
|
|
506
|
+
const manual = this.mcpRequests.route(request, {
|
|
507
|
+
threadId: scope.threadId,
|
|
508
|
+
...scope.turnId ? { turnId: scope.turnId } : {}
|
|
509
|
+
}, signal, setExecutionTimeoutMs);
|
|
510
|
+
if (manual) return await manual;
|
|
448
511
|
const route = this.routes.get(scope.threadId);
|
|
449
512
|
if (!route) return;
|
|
450
513
|
const requestSignal = AbortSignal.any([signal, route.controller.signal]);
|
|
@@ -477,7 +540,7 @@ var ClientTurnRouter = class {
|
|
|
477
540
|
const handler = route.handlers?.onNotification;
|
|
478
541
|
if (!handler) return;
|
|
479
542
|
for (const pending of route.pending.splice(0)) {
|
|
480
|
-
if (route.gate !== "bound" && (pending.notification.method === "configWarning" || pending.notification.method === "warning" && !
|
|
543
|
+
if (route.gate !== "bound" && (pending.notification.method === "configWarning" || pending.notification.method === "warning" && !readCodexNotificationScope(pending.notification.params).threadId)) {
|
|
481
544
|
route.pending.push(pending);
|
|
482
545
|
continue;
|
|
483
546
|
}
|
|
@@ -562,168 +625,10 @@ var ClientTurnRouter = class {
|
|
|
562
625
|
if (route.released && !this.canDrainClosedTurn(route, completedTurnId)) throw route.released;
|
|
563
626
|
}
|
|
564
627
|
};
|
|
565
|
-
function readScope(value) {
|
|
566
|
-
if (!isJsonObject(value)) return {};
|
|
567
|
-
const threadId = readCodexNotificationThreadId(value);
|
|
568
|
-
const turnId = readCodexNotificationTurnId(value);
|
|
569
|
-
return {
|
|
570
|
-
...threadId ? { threadId } : {},
|
|
571
|
-
...turnId ? { turnId } : {}
|
|
572
|
-
};
|
|
573
|
-
}
|
|
574
628
|
function requireId(value, label) {
|
|
575
629
|
const normalized = value.trim();
|
|
576
630
|
if (!normalized) throw new Error(`codex app-server ${label} must not be empty`);
|
|
577
631
|
return normalized;
|
|
578
632
|
}
|
|
579
633
|
//#endregion
|
|
580
|
-
|
|
581
|
-
var attempt_client_cleanup_exports = /* @__PURE__ */ __exportAll({
|
|
582
|
-
CODEX_APP_SERVER_INTERRUPT_TIMEOUT_MS: () => CODEX_APP_SERVER_INTERRUPT_TIMEOUT_MS,
|
|
583
|
-
CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS: () => CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS,
|
|
584
|
-
CodexAppServerUnsafeSubscriptionError: () => CodexAppServerUnsafeSubscriptionError,
|
|
585
|
-
assertCodexThreadResumeSubscription: () => assertCodexThreadResumeSubscription,
|
|
586
|
-
closeCodexStartupClientBestEffort: () => closeCodexStartupClientBestEffort,
|
|
587
|
-
interruptCodexTurnAndWaitBestEffort: () => interruptCodexTurnAndWaitBestEffort,
|
|
588
|
-
isCodexAppServerUnsafeSubscriptionError: () => isCodexAppServerUnsafeSubscriptionError,
|
|
589
|
-
isCodexNoActiveTurnInterruptError: () => isCodexNoActiveTurnInterruptError,
|
|
590
|
-
retireUnsafeCodexTurnClientBestEffort: () => retireUnsafeCodexTurnClientBestEffort,
|
|
591
|
-
shouldRetireCodexStartupClient: () => shouldRetireCodexStartupClient,
|
|
592
|
-
terminateCodexBackgroundTerminals: () => terminateCodexBackgroundTerminals,
|
|
593
|
-
unsubscribeCodexThreadBestEffort: () => unsubscribeCodexThreadBestEffort
|
|
594
|
-
});
|
|
595
|
-
const CODEX_APP_SERVER_INTERRUPT_TIMEOUT_MS = 5e3;
|
|
596
|
-
const CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS = 5e3;
|
|
597
|
-
const CODEX_NO_ACTIVE_TURN_ERROR_CODE = -32600;
|
|
598
|
-
const CODEX_NO_ACTIVE_TURN_ERROR_MESSAGE = "no active turn to interrupt";
|
|
599
|
-
/** Codex also reports this before an accepted turn publishes its start event. */
|
|
600
|
-
function isCodexNoActiveTurnInterruptError(error) {
|
|
601
|
-
return error instanceof CodexAppServerRpcError && error.code === CODEX_NO_ACTIVE_TURN_ERROR_CODE && error.message === CODEX_NO_ACTIVE_TURN_ERROR_MESSAGE;
|
|
602
|
-
}
|
|
603
|
-
/** Raised when a thread subscription may be live on a client OpenClaw no longer controls. */
|
|
604
|
-
var CodexAppServerUnsafeSubscriptionError = class extends Error {
|
|
605
|
-
constructor(message, options) {
|
|
606
|
-
super(message, options);
|
|
607
|
-
this.name = "CodexAppServerUnsafeSubscriptionError";
|
|
608
|
-
}
|
|
609
|
-
};
|
|
610
|
-
function isCodexAppServerUnsafeSubscriptionError(error) {
|
|
611
|
-
return error instanceof CodexAppServerUnsafeSubscriptionError;
|
|
612
|
-
}
|
|
613
|
-
function assertCodexThreadResumeSubscription(requestedThreadId, returnedThreadId) {
|
|
614
|
-
if (returnedThreadId !== requestedThreadId) throw new CodexAppServerUnsafeSubscriptionError(`Codex thread/resume returned ${returnedThreadId} for ${requestedThreadId}`);
|
|
615
|
-
}
|
|
616
|
-
async function closeCodexStartupClientBestEffort(client) {
|
|
617
|
-
if (!client) return;
|
|
618
|
-
const retiredSharedClient = retireSharedCodexAppServerClientIfCurrent(client);
|
|
619
|
-
if (!retiredSharedClient || retiredSharedClient.closed) await client.closeAndWait();
|
|
620
|
-
}
|
|
621
|
-
/** Retires an unsafe turn client without replacing an already-authoritative failure. */
|
|
622
|
-
async function retireUnsafeCodexTurnClientBestEffort(client, operation) {
|
|
623
|
-
try {
|
|
624
|
-
await closeCodexStartupClientBestEffort(client);
|
|
625
|
-
} catch (error) {
|
|
626
|
-
embeddedAgentLog.debug("codex app-server unsafe turn client retirement failed", {
|
|
627
|
-
operation,
|
|
628
|
-
error
|
|
629
|
-
});
|
|
630
|
-
try {
|
|
631
|
-
client.close();
|
|
632
|
-
} catch (closeError) {
|
|
633
|
-
embeddedAgentLog.debug("codex app-server unsafe turn client close failed", {
|
|
634
|
-
operation,
|
|
635
|
-
error: closeError
|
|
636
|
-
});
|
|
637
|
-
}
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
/** Sends a bounded turn interrupt and waits for Codex to confirm terminal abort handling. */
|
|
641
|
-
async function interruptCodexTurnAndWaitBestEffort(client, params) {
|
|
642
|
-
const timeoutMs = params.timeoutMs && Number.isFinite(params.timeoutMs) && params.timeoutMs > 0 ? params.timeoutMs : CODEX_APP_SERVER_INTERRUPT_TIMEOUT_MS;
|
|
643
|
-
const requestParams = {
|
|
644
|
-
threadId: params.threadId,
|
|
645
|
-
turnId: params.turnId
|
|
646
|
-
};
|
|
647
|
-
let cancelWatch;
|
|
648
|
-
try {
|
|
649
|
-
if (!params.turnId) {
|
|
650
|
-
await client.request("turn/interrupt", requestParams, { timeoutMs });
|
|
651
|
-
return true;
|
|
652
|
-
}
|
|
653
|
-
const deadline = Date.now() + timeoutMs;
|
|
654
|
-
const started = createDeferred();
|
|
655
|
-
const completion = getCodexAppServerTurnRouter(client).watchNativeTurnCompletion({
|
|
656
|
-
threadId: params.threadId,
|
|
657
|
-
turnId: params.turnId,
|
|
658
|
-
timeoutMs,
|
|
659
|
-
onStarted: () => started.resolve(true)
|
|
660
|
-
});
|
|
661
|
-
cancelWatch = completion.cancel;
|
|
662
|
-
if (completion.state !== "pending") return await completion.completion;
|
|
663
|
-
const requestInterrupt = async () => {
|
|
664
|
-
try {
|
|
665
|
-
await client.request("turn/interrupt", requestParams, {
|
|
666
|
-
timeoutMs: Math.max(1, deadline - Date.now()),
|
|
667
|
-
signal: completion.settledSignal
|
|
668
|
-
});
|
|
669
|
-
return true;
|
|
670
|
-
} catch (error) {
|
|
671
|
-
if (completion.state === "confirmed") return true;
|
|
672
|
-
if (isCodexNoActiveTurnInterruptError(error)) return false;
|
|
673
|
-
throw error;
|
|
674
|
-
}
|
|
675
|
-
};
|
|
676
|
-
if (!await requestInterrupt()) {
|
|
677
|
-
if (await Promise.race([completion.completion.then(() => false), started.promise]) && completion.state === "pending" && Date.now() < deadline) await requestInterrupt();
|
|
678
|
-
}
|
|
679
|
-
return await completion.completion;
|
|
680
|
-
} catch (error) {
|
|
681
|
-
embeddedAgentLog.debug("codex app-server turn interrupt failed during abort", { error });
|
|
682
|
-
return false;
|
|
683
|
-
} finally {
|
|
684
|
-
cancelWatch?.();
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
/** Stops native terminals on the cancelled thread without retiring peer threads. */
|
|
688
|
-
async function terminateCodexBackgroundTerminals(client, threadId, oneShotCliRun = false, waitForNativeItems) {
|
|
689
|
-
const options = {
|
|
690
|
-
timeoutMs: CODEX_APP_SERVER_INTERRUPT_TIMEOUT_MS,
|
|
691
|
-
signal: AbortSignal.timeout(CODEX_APP_SERVER_INTERRUPT_TIMEOUT_MS)
|
|
692
|
-
};
|
|
693
|
-
try {
|
|
694
|
-
const { data } = await client.request("thread/backgroundTerminals/list", { threadId }, options);
|
|
695
|
-
for (const { processId } of data) await client.request("thread/backgroundTerminals/terminate", {
|
|
696
|
-
threadId,
|
|
697
|
-
processId
|
|
698
|
-
}, options);
|
|
699
|
-
if (data.length > 0) {
|
|
700
|
-
if ((await client.request("thread/backgroundTerminals/list", {
|
|
701
|
-
threadId,
|
|
702
|
-
limit: 1
|
|
703
|
-
}, options)).data.length > 0) throw new Error("native background terminals remain running");
|
|
704
|
-
if (oneShotCliRun) throw new Error("native terminal termination did not confirm process cleanup");
|
|
705
|
-
}
|
|
706
|
-
await waitForNativeItems?.(options.signal);
|
|
707
|
-
} catch (cause) {
|
|
708
|
-
throw new Error("Codex background-terminal cleanup failed; inspect the thread's running terminals before starting more work.", { cause });
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
async function unsubscribeCodexThreadBestEffort(client, params) {
|
|
712
|
-
try {
|
|
713
|
-
await unsubscribeCodexAppServerLiveThread(client, params.threadId, params.timeoutMs, params.assertCurrent);
|
|
714
|
-
return true;
|
|
715
|
-
} catch (error) {
|
|
716
|
-
params.assertCurrent?.();
|
|
717
|
-
embeddedAgentLog.debug("codex app-server thread unsubscribe cleanup failed", {
|
|
718
|
-
threadId: params.threadId,
|
|
719
|
-
error
|
|
720
|
-
});
|
|
721
|
-
return false;
|
|
722
|
-
}
|
|
723
|
-
}
|
|
724
|
-
function shouldRetireCodexStartupClient(error, spawnedBy, signal) {
|
|
725
|
-
if (signal.aborted || isCodexAppServerStartupError(error) || isCodexAppServerRequestTimeoutError(error)) return true;
|
|
726
|
-
return !isCodexAppServerStartSelectionChangedError(error) && !isCodexAppServerOverloadError(error) && !(error instanceof AgentHarnessPreflightError && error.scope === void 0) && (isCodexAppServerBrokenPipeError(error) || !spawnedBy);
|
|
727
|
-
}
|
|
728
|
-
//#endregion
|
|
729
|
-
export { itemStatus as A, auditNativeToolUnfinishedStatus as C, isSideEffectingNativeToolItem as D, isProjectedNativeToolItem as E, matchesCodexSnapshotTurn as M, shouldClearTerminalPresentationForNativeItem as N, itemKind as O, unknownItemStatus as P, auditNativeToolTerminalStatus as S, isNonSuccessItemStatus as T, CodexProjectionDiagnostics as _, attempt_client_cleanup_exports as a, readCodexNotificationTurnId as b, isCodexAppServerUnsafeSubscriptionError as c, shouldRetireCodexStartupClient as d, terminateCodexBackgroundTerminals as f, hasCodexAppServerSiblingRouteWork as g, getCodexAppServerTurnRouter as h, assertCodexThreadResumeSubscription as i, itemTitle as j, itemName as k, isCodexNoActiveTurnInterruptError as l, CODEX_APP_SERVER_NATIVE_TURN_WAIT_TIMEOUT_MS as m, CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS as n, closeCodexStartupClientBestEffort as o, unsubscribeCodexThreadBestEffort as p, CodexAppServerUnsafeSubscriptionError as r, interruptCodexTurnAndWaitBestEffort as s, CODEX_APP_SERVER_INTERRUPT_TIMEOUT_MS as t, retireUnsafeCodexTurnClientBestEffort as u, isCodexNotificationForTurn as v, isMutatingNativeToolItem as w, auditNativeToolName as x, readCodexNotificationThreadId as y };
|
|
634
|
+
export { itemStatus as _, isCodexNotificationForTurn as a, shouldClearTerminalPresentationForNativeItem as b, auditNativeToolName as c, isMutatingNativeToolItem as d, isNonSuccessItemStatus as f, itemName as g, itemKind as h, CodexProjectionDiagnostics as i, auditNativeToolTerminalStatus as l, isSideEffectingNativeToolItem as m, getCodexAppServerTurnRouter as n, readCodexNotificationThreadId as o, isProjectedNativeToolItem as p, hasCodexAppServerSiblingRouteWork as r, readCodexNotificationTurnId as s, CODEX_APP_SERVER_NATIVE_TURN_WAIT_TIMEOUT_MS as t, auditNativeToolUnfinishedStatus as u, itemTitle as v, unknownItemStatus as x, matchesCodexSnapshotTurn as y };
|
package/dist/.setup/{upstream-session-fork-CBeVjBpT.mjs → upstream-session-fork-LYlaQnbt.mjs}
RENAMED
|
@@ -1,37 +1,39 @@
|
|
|
1
1
|
import { i as isJsonObject, r as flattenCodexDynamicToolFunctions } from "./protocol-CANUwXJ3.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { d as readCodexPluginConfig } from "./config-parsing-
|
|
4
|
-
import { s as assertCodexModelBackedReviewerEffectiveConfig } from "./config-options-
|
|
2
|
+
import { m as sessionBindingIdentity } from "./session-binding-record-BZB8RgcF.mjs";
|
|
3
|
+
import { d as readCodexPluginConfig } from "./config-parsing-BQq-CHTF.mjs";
|
|
4
|
+
import { s as assertCodexModelBackedReviewerEffectiveConfig } from "./config-options-HG_Rr3W_.mjs";
|
|
5
5
|
import { t as withCodexAppServerThreadMutation } from "./thread-ownership-queue-Dp24d7-F.mjs";
|
|
6
|
+
import { i as CodexAppServerScopedRequestRejectedError, o as isCodexAppServerOverloadError } from "./rpc-error-hmWM21RB.mjs";
|
|
6
7
|
import { i as readUpstreamUserText, r as readMirrorIdentity } from "./upstream-prompt-provenance-fXkKbPVC.mjs";
|
|
7
|
-
import { r as projectCodexUserItemText } from "./transcript-history-projection-
|
|
8
|
+
import { r as projectCodexUserItemText } from "./transcript-history-projection-B9a7HwUV.mjs";
|
|
8
9
|
import { n as codexUpstreamBaseline, t as codexLastTerminalTurnId } from "./session-upstream-marker-D15C9NHp.mjs";
|
|
9
|
-
import { r as buildCodexPluginAppCacheKey } from "./plugin-app-cache-key-
|
|
10
|
-
import { n as readCodexSessionMeta } from "./session-catalog-provenance-
|
|
11
|
-
import
|
|
12
|
-
import { r as resolveOpenClawExecPolicyForCodexAppServer } from "./config-
|
|
13
|
-
import { r as resolveCodexSupervisionAppServerRuntimeOptions } from "./config-runtime-
|
|
10
|
+
import { r as buildCodexPluginAppCacheKey } from "./plugin-app-cache-key-BW8rd98k.mjs";
|
|
11
|
+
import { n as readCodexSessionMeta } from "./session-catalog-provenance-CmsOE5mh.mjs";
|
|
12
|
+
import "./request-BH3FvYUE.mjs";
|
|
13
|
+
import { r as resolveOpenClawExecPolicyForCodexAppServer } from "./config-0Gxk3_eq.mjs";
|
|
14
|
+
import { r as resolveCodexSupervisionAppServerRuntimeOptions } from "./config-runtime-cUYrqu_a.mjs";
|
|
14
15
|
import { a as fingerprintCodexMirrorSourceMessage, c as readCodexMirrorSourceFingerprint } from "./transcript-mirror-attestation-YSegaktH.mjs";
|
|
15
|
-
import { P as claimCodexAppServerLiveThread, R as hasCodexAppServerLiveThread, f as readCodexAppServerClientDesktopGenerationFingerprint } from "./shared-client-
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import "./session-binding-
|
|
19
|
-
import {
|
|
20
|
-
import "./thread-ownership-
|
|
21
|
-
import { n as resolveCodexNativeExecutionPolicy } from "./native-execution-policy-
|
|
22
|
-
import { l as
|
|
23
|
-
import {
|
|
24
|
-
import { n as
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
16
|
+
import { P as claimCodexAppServerLiveThread, R as hasCodexAppServerLiveThread, f as readCodexAppServerClientDesktopGenerationFingerprint } from "./shared-client-DJJ3ljH2.mjs";
|
|
17
|
+
import { m as assertCodexThreadForkResponse, p as assertCodexThreadAcceptsDirectInput, s as isCodexAppServerPrewriteRequestCancellationError } from "./client-CBzEVDyb.mjs";
|
|
18
|
+
import { A as buildCodexNativeHookRelayId, Ct as mergeCodexThreadConfigs, D as assertCodexNativeHookRelayAllowed, H as parseCodexNativeToolCatalog, L as checkCodexThreadAppAvailability, N as resolveCodexNativeHookRelayEvents, O as buildCodexNativeHookRelayConfig, Q as fingerprintUserMcpServersConfigPatch, Tt as shouldBuildCodexPluginThreadConfig, U as applyCodexNativeSkillIsolation, W as resolveCodexNativeSkillIsolation, Z as fingerprintJsonObject, a as buildCodexThreadConfiguration, g as buildDeveloperInstructions, gt as buildCodexPluginThreadConfig, m as resolveCodexWebSearchPlan, q as codexDynamicToolsFingerprint } from "./thread-requests-COrRJcZb.mjs";
|
|
19
|
+
import "./session-binding-Ce7BqiPN.mjs";
|
|
20
|
+
import { n as CodexThreadPolicyHandoffError, o as refreshCodexThreadPolicy } from "./thread-policy-CXZV97TS.mjs";
|
|
21
|
+
import "./thread-ownership-0aRHD9iK.mjs";
|
|
22
|
+
import { n as resolveCodexNativeExecutionPolicy } from "./native-execution-policy-ClzpdG3D.mjs";
|
|
23
|
+
import { l as isCodexDynamicToolExcluded } from "./shell-dynamic-tools-Do9lIAT1.mjs";
|
|
24
|
+
import { c as prepareCodexWorkspaceDeveloperInstructions } from "./attempt-workspace-context-CbSzT6V2.mjs";
|
|
25
|
+
import { n as resolveCodexProviderWebSearchSupportForClient } from "./provider-capabilities-Z5ZbBxqP.mjs";
|
|
26
|
+
import { n as prepareCodexSessionInitialization } from "./session-initialization-D6dtFQkE.mjs";
|
|
27
|
+
import { createImportedCodexSession } from "./session-history-import-NWKPa4ZO.mjs";
|
|
28
|
+
import { isRecord, normalizeOptionalString, readNonBlankString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
27
29
|
import { randomUUID } from "node:crypto";
|
|
28
30
|
import { isDeepStrictEqual } from "node:util";
|
|
29
31
|
import path from "node:path";
|
|
30
32
|
import { lstat } from "node:fs/promises";
|
|
31
33
|
import { root } from "openclaw/plugin-sdk/file-access-runtime";
|
|
32
34
|
import { constants, createZstdDecompress } from "node:zlib";
|
|
33
|
-
import { resolveAgentWorkspaceDir } from "openclaw/plugin-sdk/agent-runtime";
|
|
34
35
|
import { loadCodexBundleMcpThreadConfig } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
36
|
+
import { resolveAgentWorkspaceDir } from "openclaw/plugin-sdk/agent-runtime";
|
|
35
37
|
import { loadExecApprovals } from "openclaw/plugin-sdk/exec-approvals-runtime";
|
|
36
38
|
import { resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
|
|
37
39
|
import { buildCodexUserMcpServersThreadConfigPatchForRuntime, resolveCodexMcpToolOverridesForAgent } from "openclaw/plugin-sdk/codex-mcp-projection";
|
|
@@ -726,19 +728,18 @@ async function forkCanonicalCodexSession(params) {
|
|
|
726
728
|
}
|
|
727
729
|
//#endregion
|
|
728
730
|
//#region extensions/codex/src/app-server/upstream-session-fork.ts
|
|
729
|
-
function
|
|
730
|
-
|
|
731
|
-
|
|
731
|
+
function unavailable(message) {
|
|
732
|
+
return {
|
|
733
|
+
status: "failed",
|
|
734
|
+
code: "upstream-unavailable",
|
|
735
|
+
message
|
|
736
|
+
};
|
|
732
737
|
}
|
|
733
738
|
async function forkCodexUpstreamSession(params, options) {
|
|
734
739
|
try {
|
|
735
|
-
const sourceFingerprint = params.upstream.kind === "codex-app-server" ?
|
|
740
|
+
const sourceFingerprint = params.upstream.kind === "codex-app-server" && isRecord(params.upstream.ref) ? readNonBlankString(params.upstream.ref.connectionFingerprint) : void 0;
|
|
736
741
|
const requestControl = sourceFingerprint ? await options.controlFactory.forUpstream(params.source.agentId, sourceFingerprint) : void 0;
|
|
737
|
-
if (!sourceFingerprint || !requestControl) return
|
|
738
|
-
status: "failed",
|
|
739
|
-
code: "upstream-unavailable",
|
|
740
|
-
message: "This Codex thread is not available on the current connection. Reconnect to its host and try again."
|
|
741
|
-
};
|
|
742
|
+
if (!sourceFingerprint || !requestControl) return unavailable("This Codex thread is not available on the current connection. Reconnect to its host and try again.");
|
|
742
743
|
return await requestControl.withPinnedConnection(async (control) => {
|
|
743
744
|
const sourceBinding = options.bindingStore.read(sessionBindingIdentity({
|
|
744
745
|
...params.source,
|
|
@@ -759,11 +760,7 @@ async function forkCodexUpstreamSession(params, options) {
|
|
|
759
760
|
throw new Error("Codex fork cleanup could not be verified; inspect the retained native thread before retrying.", { cause });
|
|
760
761
|
}
|
|
761
762
|
});
|
|
762
|
-
if (sourceFingerprint !== control.connectionFingerprint || supervised && (sourceBinding.supervisionSourceThreadId !== params.upstream.threadId || (sourceBinding.pendingSupervisionBranch?.connectionFingerprint ?? sourceBinding.appServerRuntimeFingerprint) !== sourceFingerprint)) return
|
|
763
|
-
status: "failed",
|
|
764
|
-
code: "upstream-unavailable",
|
|
765
|
-
message: "This Codex thread is not available on the current connection. Reconnect to its host and try again."
|
|
766
|
-
};
|
|
763
|
+
if (sourceFingerprint !== control.connectionFingerprint || supervised && (sourceBinding.supervisionSourceThreadId !== params.upstream.threadId || (sourceBinding.pendingSupervisionBranch?.connectionFingerprint ?? sourceBinding.appServerRuntimeFingerprint) !== sourceFingerprint)) return unavailable("This Codex thread is not available on the current connection. Reconnect to its host and try again.");
|
|
767
764
|
const resolved = await resolveCodexUpstreamForkBoundary({
|
|
768
765
|
...params.source,
|
|
769
766
|
threadId: sourceThreadId,
|
|
@@ -884,19 +881,11 @@ async function forkCodexUpstreamSession(params, options) {
|
|
|
884
881
|
};
|
|
885
882
|
} catch (error) {
|
|
886
883
|
if (!initializerOwnsFork) await options.bindingStore.withThreadArchiveFence(() => archiveFreshFork(forkedThreadId));
|
|
887
|
-
return
|
|
888
|
-
status: "failed",
|
|
889
|
-
code: "upstream-unavailable",
|
|
890
|
-
message: error instanceof Error ? error.message : "The Codex fork could not be imported. Refresh sessions and try again."
|
|
891
|
-
};
|
|
884
|
+
return unavailable(error instanceof Error ? error.message : "The Codex fork could not be imported. Refresh sessions and try again.");
|
|
892
885
|
}
|
|
893
886
|
});
|
|
894
887
|
} catch (error) {
|
|
895
|
-
return
|
|
896
|
-
status: "failed",
|
|
897
|
-
code: "upstream-unavailable",
|
|
898
|
-
message: error instanceof Error ? error.message : "The Codex thread could not be forked. Check that Codex is available, then try again."
|
|
899
|
-
};
|
|
888
|
+
return unavailable(error instanceof Error ? error.message : "The Codex thread could not be forked. Check that Codex is available, then try again.");
|
|
900
889
|
}
|
|
901
890
|
}
|
|
902
891
|
//#endregion
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as buildCodexAppServerUsageSnapshot } from "./rate-limits-
|
|
2
|
-
import {
|
|
3
|
-
import "./config-
|
|
4
|
-
import { n as resolveCodexAppServerRuntimeOptions } from "./config-runtime-
|
|
1
|
+
import { t as buildCodexAppServerUsageSnapshot } from "./rate-limits-CMPy24F5.mjs";
|
|
2
|
+
import { t as readCodexAppServerUsage } from "./request-BH3FvYUE.mjs";
|
|
3
|
+
import "./config-0Gxk3_eq.mjs";
|
|
4
|
+
import { n as resolveCodexAppServerRuntimeOptions } from "./config-runtime-cUYrqu_a.mjs";
|
|
5
5
|
import { CODEX_APP_SERVER_AUTH_MARKER } from "openclaw/plugin-sdk/agent-runtime";
|
|
6
6
|
//#region extensions/codex/src/app-server/usage.ts
|
|
7
7
|
/** Handles the synthetic usage credential for a Codex-backed OpenAI route. */
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
|
|
2
|
-
import { a as shouldRefreshCodexRateLimitsForUsageLimitMessage, i as resolveCodexUsageLimitResetAtMs, n as formatCodexUsageLimitErrorMessage } from "./rate-limits-
|
|
3
|
-
import { t as CODEX_CONTROL_METHODS } from "./capabilities-
|
|
4
|
-
import { X as readRecentCodexRateLimits, Y as readCodexRateLimitsRevision, Z as rememberCodexRateLimitsRead } from "./shared-client-
|
|
2
|
+
import { a as shouldRefreshCodexRateLimitsForUsageLimitMessage, i as resolveCodexUsageLimitResetAtMs, n as formatCodexUsageLimitErrorMessage } from "./rate-limits-CMPy24F5.mjs";
|
|
3
|
+
import { t as CODEX_CONTROL_METHODS } from "./capabilities-kQntafj_.mjs";
|
|
4
|
+
import { X as readRecentCodexRateLimits, Y as readCodexRateLimitsRevision, Z as rememberCodexRateLimitsRead } from "./shared-client-DJJ3ljH2.mjs";
|
|
5
5
|
import { readStringField } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
|
-
import { markAuthProfileBlockedUntil } from "openclaw/plugin-sdk/agent-runtime";
|
|
7
6
|
import { embeddedAgentLog, formatErrorMessage } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
7
|
+
import { markAuthProfileBlockedUntil } from "openclaw/plugin-sdk/agent-runtime";
|
|
8
8
|
//#region extensions/codex/src/app-server/usage-limit-error.ts
|
|
9
9
|
const CODEX_USAGE_LIMIT_RATE_LIMIT_REFRESH_TIMEOUT_MS = 5e3;
|
|
10
10
|
var CodexUsageLimitPromptError = class extends Error {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { runBoundedCodexAppServerTurn } from "./bounded-turn-
|
|
4
|
-
import { normalizeOptionalString, normalizeTrimmedStringList } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
1
|
+
import { p as buildCodexNativeWebSearchThreadConfig } from "./thread-requests-COrRJcZb.mjs";
|
|
2
|
+
import { l as projectCodexWebSearchItem } from "./native-subagent-monitor-CCEFO6qK.mjs";
|
|
3
|
+
import { runBoundedCodexAppServerTurn } from "./bounded-turn-DlHlNTyS.mjs";
|
|
5
4
|
import { readStringParam, resolveSearchTimeoutSeconds, wrapWebContent } from "openclaw/plugin-sdk/provider-web-search";
|
|
6
5
|
//#region extensions/codex/src/web-search-provider.runtime.ts
|
|
7
6
|
async function executeCodexWebSearchProviderTool(ctx, args, executionContext, options) {
|
|
@@ -27,7 +26,7 @@ async function executeCodexWebSearchProviderTool(ctx, args, executionContext, op
|
|
|
27
26
|
isolation: "private-stdio",
|
|
28
27
|
threadConfig: buildCodexNativeWebSearchThreadConfig(ctx.config)
|
|
29
28
|
});
|
|
30
|
-
const searches = result.items.filter((item) => item.type === "webSearch").map(
|
|
29
|
+
const searches = result.items.filter((item) => item.type === "webSearch").map(projectCodexWebSearchItem);
|
|
31
30
|
if (searches.length === 0) throw new Error("Codex hosted search completed without invoking web search.");
|
|
32
31
|
return {
|
|
33
32
|
query,
|
|
@@ -44,20 +43,5 @@ async function executeCodexWebSearchProviderTool(ctx, args, executionContext, op
|
|
|
44
43
|
searches
|
|
45
44
|
};
|
|
46
45
|
}
|
|
47
|
-
function summarizeCodexWebSearchItem(item) {
|
|
48
|
-
const action = isJsonObject(item.action) ? item.action : void 0;
|
|
49
|
-
const actionType = normalizeOptionalString(action?.type);
|
|
50
|
-
const queries = actionType === "search" ? normalizeTrimmedStringList(action?.queries) : [];
|
|
51
|
-
const query = normalizeOptionalString(item.query) ?? (actionType === "search" ? normalizeOptionalString(action?.query) : void 0) ?? queries[0];
|
|
52
|
-
const url = normalizeOptionalString(action?.url);
|
|
53
|
-
const pattern = normalizeOptionalString(action?.pattern);
|
|
54
|
-
return {
|
|
55
|
-
...query ? { query } : {},
|
|
56
|
-
...queries.length > 0 ? { queries } : {},
|
|
57
|
-
...actionType && actionType !== "search" ? { action: actionType } : {},
|
|
58
|
-
...url ? { url } : {},
|
|
59
|
-
...pattern ? { pattern } : {}
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
46
|
//#endregion
|
|
63
47
|
export { executeCodexWebSearchProviderTool };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
//#region extensions/codex/src/app-server/websocket-data.ts
|
|
2
|
+
function codexWebSocketDataToBuffer(data) {
|
|
3
|
+
return Array.isArray(data) ? Buffer.concat(data) : Buffer.isBuffer(data) ? data : data instanceof Uint8Array ? Buffer.from(data.buffer, data.byteOffset, data.byteLength) : Buffer.from(data);
|
|
4
|
+
}
|
|
5
|
+
//#endregion
|
|
6
|
+
export { codexWebSocketDataToBuffer as t };
|