@openclaw/codex 2026.9.8 → 2026.10.1-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/dist/.setup/{account-usage-runtime-G348lY1q.mjs → account-usage-runtime-DGqFpAud.mjs} +5 -5
- package/dist/.setup/app-server-policy-Bg4FZw1f.mjs +23 -0
- package/dist/.setup/{apply-Cqb-YoCS.mjs → apply-CXTudl9p.mjs} +48 -39
- package/dist/.setup/attempt-client-cleanup-BH0hW2xU.mjs +155 -0
- package/dist/.setup/{attempt-workspace-context-BJ5Z_olH.mjs → attempt-workspace-context-BY0jprWJ.mjs} +11 -15
- package/dist/.setup/{auth-binding-BLWz7stm.mjs → auth-binding-BoMwpuPN.mjs} +17 -25
- package/dist/.setup/{auth-cache-key-Dnps4W4_.mjs → auth-cache-key-CGm0UJOr.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-isolation-B8K_ylqk.mjs → bounded-turn-isolation-DklXNk3k.mjs} +4 -4
- package/dist/.setup/{bounded-turn-BNunZPtz.mjs → bounded-turn-pGsfXcmH.mjs} +14 -13
- package/dist/.setup/{build-state-DIQ5O_-S.mjs → build-state-CqQnsg7T.mjs} +1 -1
- package/dist/.setup/{capabilities-B3WEZl4e.mjs → capabilities-kQntafj_.mjs} +1 -1
- package/dist/.setup/{client-qyUBJlGZ.mjs → client-C8lgBOoO.mjs} +438 -160
- package/dist/.setup/{client-catalog-response-DRvx_wCC.mjs → client-catalog-response-Bqp7WG51.mjs} +57 -25
- package/dist/.setup/command-authorization-AikPDtcc.mjs +15 -0
- package/dist/.setup/{command-dispatch-Btrs1D6f.mjs → command-dispatch-DhBbFIQ5.mjs} +3 -3
- package/dist/.setup/{command-formatters-R3ckE3Co.mjs → command-formatters-DV3DHhdr.mjs} +7 -5
- package/dist/.setup/{command-handlers-DvlCHJch.mjs → command-handlers-ztOOzm6O.mjs} +82 -144
- package/dist/.setup/{command-rpc-skzRq4wD.mjs → command-rpc-CuC5fPom.mjs} +23 -31
- package/dist/.setup/{compact-8ttks5U5.mjs → compact-tUb9AYfH.mjs} +117 -65
- package/dist/.setup/{plugin-metadata-cache-BRwtRct9.mjs → computer-use-BBN9y326.mjs} +65 -202
- 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-74LaGGH-.mjs → conversation-binding-B3MNMVzb.mjs} +36 -48
- package/dist/.setup/{conversation-binding-data-C746z5Pn.mjs → conversation-binding-data-DJ4ix-W5.mjs} +1 -1
- package/dist/.setup/{conversation-control-OrN6zuaY.mjs → conversation-control-CYsMlCuE.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-C8xGEXmR.mjs +463 -0
- package/dist/.setup/{dynamic-tools-Db2sY5cZ.mjs → dynamic-tools-DyERJnR6.mjs} +238 -878
- package/dist/.setup/{effective-mcp-catalog-Bi6-SQ7i.mjs → effective-mcp-catalog-C26Mio5l.mjs} +83 -11
- package/dist/.setup/{elicitation-input-DPoK8F7w.mjs → elicitation-input-r9axtppm.mjs} +4 -2
- package/dist/.setup/{ephemeral-turn-DiCS1ijR.mjs → ephemeral-turn-D8VcDTNo.mjs} +2 -2
- package/dist/.setup/{event-projector-assistant-message-MV_1dj-3.mjs → event-projector-assistant-message-BN7CNUB5.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-D80IXfQF.mjs → isolated-completion-C0jrcplS.mjs} +8 -8
- package/dist/.setup/{managed-binary-kiWRhNRE.mjs → managed-binary-C1VFoVPf.mjs} +31 -38
- package/dist/.setup/mcp-app-session-preparation-BxN0_CYe.mjs +223 -0
- package/dist/.setup/mcp-tool-metadata-j10HhfTC.mjs +43 -0
- package/dist/.setup/{model-catalog-DiC0Tkha.mjs → model-catalog-DZyNeDKG.mjs} +7 -7
- package/dist/.setup/{models-DfLmPV0k.mjs → models-DSseKSMg.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-CqcPVmhH.mjs +310 -0
- package/dist/.setup/{native-subagent-monitor-BwkQXf9e.mjs → native-subagent-monitor-BUYOUp9X.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-DPdMk1Oy.mjs → plan-BJ37d2Og.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-CuahdPLC.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-B8LGaZNW.mjs +124 -0
- package/dist/.setup/{provider-D6F_7p1I.mjs → provider-BnwHVD_z.mjs} +4 -4
- package/dist/.setup/provider-capabilities-D68Whix6.mjs +50 -0
- package/dist/.setup/{rate-limits-B7-X2TgG.mjs → rate-limits-CMPy24F5.mjs} +1 -5
- package/dist/.setup/{request-BZOfsSXW.mjs → request-jSbhc1sg.mjs} +189 -49
- package/dist/.setup/rpc-error-hmWM21RB.mjs +57 -0
- package/dist/.setup/{run-attempt-dYJhjZrp.mjs → run-attempt-BLDZeYLD.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-BMCFMZw-.mjs → session-catalog-events-Bdjw9HEn.mjs} +5 -5
- package/dist/.setup/{session-catalog-index-DwJjnF5k.mjs → session-catalog-index-DufISKJ6.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-CuaFZuQE.mjs → session-catalog-native-projection-D6IiLtMb.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-CGfzfP93.mjs → session-catalog-projection-8aHNwzWD.mjs} +6 -122
- package/dist/.setup/{session-catalog-provenance-DoAvktcj.mjs → session-catalog-provenance-CmsOE5mh.mjs} +6 -1
- package/dist/.setup/{session-cli-DlmBHYIe.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-LlYWBKTJ.mjs → session-retirement-Czbchv_O.mjs} +14 -15
- package/dist/.setup/{settled-turn-context-D4yj4rxf.mjs → settled-turn-context-BZsMjkIO.mjs} +13 -6
- package/dist/.setup/{settled-turn-finalizer-DW9W3gza.mjs → settled-turn-finalizer-DjZsIwbZ.mjs} +8 -8
- package/dist/.setup/{shared-client-CJCTeFpQ.mjs → shared-client-qhyYWbew.mjs} +291 -272
- package/dist/.setup/{provider-capabilities-DG5qbsUZ.mjs → shell-dynamic-tools-D3Brj3g9.mjs} +16 -55
- package/dist/.setup/{side-question-BLeGj7TQ.mjs → side-question-D3NJlgbl.mjs} +99 -91
- package/dist/.setup/{source-CJis_1EF.mjs → source-BYu0T780.mjs} +24 -40
- package/dist/.setup/{thread-lifecycle-_bAbjedG.mjs → thread-lifecycle-Cbz_7ySv.mjs} +262 -305
- package/dist/.setup/{thread-ownership-B6pPt21M.mjs → thread-ownership-DwuSrt3s.mjs} +10 -8
- package/dist/.setup/{thread-policy-gNPzzpVp.mjs → thread-policy-DoNxbhqt.mjs} +22 -21
- package/dist/.setup/{thread-requests-OWGOiDaV.mjs → thread-requests-CL1e8Wmx.mjs} +107 -98
- package/dist/.setup/{thread-resume-GOry0AYh.mjs → thread-resume-BT6NHMkM.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-B-S7ngS_.mjs → turn-router-sS69wYnI.mjs} +75 -170
- package/dist/.setup/{upstream-session-fork-gkdRj2yH.mjs → upstream-session-fork-ChSld66u.mjs} +35 -46
- package/dist/.setup/{usage-CApUvLOV.mjs → usage-D8e8Xiqf.mjs} +4 -4
- package/dist/.setup/{usage-limit-error-wSMQkbpV.mjs → usage-limit-error-GbT-5NcW.mjs} +4 -4
- package/dist/.setup/{web-search-provider.runtime-UKgeiBUG.mjs → web-search-provider.runtime-dL2GD1Kl.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-BFafIiF6.mjs +0 -2599
- package/dist/.setup/session-catalog-list-request-CvtxrYSe.mjs +0 -170
- package/dist/.setup/shared-client-lifecycle-7xgtlo15.mjs +0 -153
package/dist/.setup/{run-attempt-lifecycle-C-6O3Exn.mjs → run-attempt-lifecycle-BuZgVbDA.mjs}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as attemptTerminal } from "./attempt-terminal-gZrxQ35N.mjs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import fs from "node:fs/promises";
|
|
4
|
-
import { awaitAgentEndSideEffects, embeddedAgentLog, runAgentEndSideEffects } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
4
|
+
import { awaitAgentEndSideEffects, embeddedAgentLog, formatErrorMessage, runAgentEndSideEffects } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
5
5
|
import { emitAgentHarnessAttemptEvent } from "openclaw/plugin-sdk/agent-harness-attempt-runtime";
|
|
6
6
|
//#region extensions/codex/src/app-server/workspace-dir-cache.ts
|
|
7
7
|
/** Process-local cache of Codex workspaces already created by the run loop. */
|
|
@@ -16,7 +16,8 @@ function shouldKeepCodexSharedAbortOpen(params) {
|
|
|
16
16
|
}
|
|
17
17
|
function withCodexAppServerFastModeServiceTier(appServer, params, configuredAppServer = appServer) {
|
|
18
18
|
const fastMode = typeof params.fastMode === "function" ? params.fastMode() : params.fastMode;
|
|
19
|
-
const
|
|
19
|
+
const configuredServiceTier = configuredAppServer.serviceTier === "ultrafast" ? "priority" : configuredAppServer.serviceTier;
|
|
20
|
+
const serviceTier = fastMode === void 0 ? configuredServiceTier : fastMode ? "priority" : null;
|
|
20
21
|
if (serviceTier === appServer.serviceTier) return appServer;
|
|
21
22
|
return {
|
|
22
23
|
...appServer,
|
|
@@ -53,5 +54,20 @@ async function runCodexAgentEndHook(params, hookParams) {
|
|
|
53
54
|
}
|
|
54
55
|
runAgentEndSideEffects(sideEffectParams);
|
|
55
56
|
}
|
|
57
|
+
function reportCodexBackgroundCleanupFailure(params, error) {
|
|
58
|
+
const message = formatErrorMessage(error);
|
|
59
|
+
embeddedAgentLog.warn("codex native background work remains unsettled", {
|
|
60
|
+
runId: params.runId,
|
|
61
|
+
sessionId: params.sessionId,
|
|
62
|
+
error: message
|
|
63
|
+
});
|
|
64
|
+
emitCodexAppServerEvent(params, {
|
|
65
|
+
stream: "codex_app_server.lifecycle",
|
|
66
|
+
data: {
|
|
67
|
+
phase: "background_cleanup_failed",
|
|
68
|
+
error: message
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
56
72
|
//#endregion
|
|
57
|
-
export {
|
|
73
|
+
export { runCodexAgentEndHook as a, reportCodexBackgroundCleanupFailure as i, ensureCodexWorkspaceDirOnce as n, shouldKeepCodexSharedAbortOpen as o, estimateCodexAppServerProjectedTurnTokens as r, withCodexAppServerFastModeServiceTier as s, emitCodexAppServerEvent as t };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { n as isCodexAppServerProxyLaunch } from "./launch-args-DbFCehO7.mjs";
|
|
2
|
-
import { a as resolvePackagedCodexNativeCommand } from "./managed-binary-
|
|
3
|
-
import { n as resolveCodexAppServerSpawnEnv, r as resolveCodexAppServerSpawnInvocation } from "./transport-stdio-
|
|
4
|
-
import { captureCodexConfiguredConnection, finalizeCodexConfiguredConnection, isCodexConfiguredConnectionArtifact, validateCodexConfiguredConnectionCapture } from "./runtime-artifact-connection-
|
|
2
|
+
import { a as resolvePackagedCodexNativeCommand } from "./managed-binary-C1VFoVPf.mjs";
|
|
3
|
+
import { n as resolveCodexAppServerSpawnEnv, r as resolveCodexAppServerSpawnInvocation } from "./transport-stdio-a0HDa2Mj.mjs";
|
|
4
|
+
import { captureCodexConfiguredConnection, finalizeCodexConfiguredConnection, isCodexConfiguredConnectionArtifact, validateCodexConfiguredConnectionCapture } from "./runtime-artifact-connection-CADz3_BY.mjs";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
6
|
import { resolveWindowsExecutablePath } from "openclaw/plugin-sdk/windows-spawn";
|
|
7
|
+
import { resolveGlobalSingleton } from "openclaw/plugin-sdk/global-singleton";
|
|
7
8
|
import { constants } from "node:fs";
|
|
8
9
|
import path from "node:path";
|
|
9
10
|
import fs$1 from "node:fs/promises";
|
|
@@ -47,9 +48,7 @@ const SAFE_NODE_OPTIONS_DNS_RESULT_ORDERS = /* @__PURE__ */ new Set([
|
|
|
47
48
|
]);
|
|
48
49
|
const ARTIFACT_BINDINGS_SYMBOL = Symbol.for("openclaw.codexAppServerRuntimeArtifactBindings");
|
|
49
50
|
function getRuntimeArtifactBindings() {
|
|
50
|
-
|
|
51
|
-
globalState[ARTIFACT_BINDINGS_SYMBOL] ??= /* @__PURE__ */ new WeakMap();
|
|
52
|
-
return globalState[ARTIFACT_BINDINGS_SYMBOL];
|
|
51
|
+
return resolveGlobalSingleton(ARTIFACT_BINDINGS_SYMBOL, () => /* @__PURE__ */ new WeakMap());
|
|
53
52
|
}
|
|
54
53
|
function throwIfAborted(signal) {
|
|
55
54
|
if (!signal?.aborted) return;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { t as codexAppServerStartOptionsKey } from "./config-options-
|
|
2
|
-
import "./config-runtime-
|
|
3
|
-
import { r as resolveCodexAppServerUnixSocketPath } from "./transport-websocket-
|
|
1
|
+
import { t as codexAppServerStartOptionsKey } from "./config-options-HG_Rr3W_.mjs";
|
|
2
|
+
import "./config-runtime-cUYrqu_a.mjs";
|
|
3
|
+
import { r as resolveCodexAppServerUnixSocketPath } from "./transport-websocket-zqJ0Cmtn.mjs";
|
|
4
|
+
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
5
|
import { createHash } from "node:crypto";
|
|
5
6
|
import path from "node:path";
|
|
6
7
|
//#region extensions/codex/src/app-server/runtime-artifact-connection.ts
|
|
@@ -64,7 +65,7 @@ function fingerprint(descriptor) {
|
|
|
64
65
|
function decodeConnectionId(id) {
|
|
65
66
|
if (!isCodexConfiguredConnectionArtifact(id) || Buffer.byteLength(id) > 2048) throw new Error("Invalid Codex configured connection artifact");
|
|
66
67
|
const value = JSON.parse(Buffer.from(id.slice(31), "base64url").toString("utf8"));
|
|
67
|
-
if (!
|
|
68
|
+
if (!isRecord(value) || value.kind !== "configured-connection" || value.transport !== "websocket" && value.transport !== "unix" || typeof value.selectionFingerprint !== "string" || !/^[a-f0-9]{64}$/u.test(value.selectionFingerprint) || typeof value.runtimeIdentityFingerprint !== "string" || !/^[a-f0-9]{64}$/u.test(value.runtimeIdentityFingerprint)) throw new Error("Invalid Codex configured connection descriptor");
|
|
68
69
|
const descriptor = {
|
|
69
70
|
kind: value.kind,
|
|
70
71
|
transport: value.transport,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { l as isCodexRemoteExecPlacementSandbox } from "./config-parsing-
|
|
2
|
-
import { n as resolveCodexNativeExecutionPolicy, t as formatCodexNativeNodeExecBlock } from "./native-execution-policy-
|
|
3
|
-
import { t as __exportAll } from "./session-binding-sidecars-
|
|
1
|
+
import { l as isCodexRemoteExecPlacementSandbox } from "./config-parsing-BQq-CHTF.mjs";
|
|
2
|
+
import { n as resolveCodexNativeExecutionPolicy, t as formatCodexNativeNodeExecBlock } from "./native-execution-policy-ClzpdG3D.mjs";
|
|
3
|
+
import { t as __exportAll } from "./session-binding-sidecars-BrdV95Fg.mjs";
|
|
4
4
|
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
import { tryResolveDefaultAgentId } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
6
6
|
import { parseAgentSessionKey } from "openclaw/plugin-sdk/routing";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region extensions/codex/src/app-server/config-contracts.shared.ts
|
|
2
|
+
const CODEX_PLUGIN_MARKETPLACE_NAME_PATTERN = /^[A-Za-z0-9_-]+$/;
|
|
3
|
+
//#endregion
|
|
4
|
+
//#region extensions/codex/src/app-server/service-tier-normalization.ts
|
|
5
|
+
function normalizeCodexServiceTier(value) {
|
|
6
|
+
if (typeof value !== "string") return;
|
|
7
|
+
const trimmed = value.trim();
|
|
8
|
+
if (!trimmed) return;
|
|
9
|
+
const normalized = trimmed.toLowerCase();
|
|
10
|
+
if (normalized === "fast" || normalized === "priority") return "priority";
|
|
11
|
+
if (normalized === "flex") return "flex";
|
|
12
|
+
return trimmed;
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { CODEX_PLUGIN_MARKETPLACE_NAME_PATTERN as n, normalizeCodexServiceTier as t };
|
|
@@ -1,96 +1,59 @@
|
|
|
1
|
-
import { i as adoptCodexNativeSubagentSubmissions, n as mutateNativePendingAssignments, o as mutateCodexNativeSubagentSubmissions } from "./native-subagent-pending-assignments-
|
|
2
|
-
import {
|
|
3
|
-
import { n as
|
|
4
|
-
import { n as
|
|
5
|
-
import {
|
|
1
|
+
import { i as adoptCodexNativeSubagentSubmissions, n as mutateNativePendingAssignments, o as mutateCodexNativeSubagentSubmissions } from "./native-subagent-pending-assignments-BDqhOdJp.mjs";
|
|
2
|
+
import { a as readStoredCodexAppServerBinding, i as readCodexBindingTimestamp, n as matchesPendingSupervisionBranch, o as stripUndefinedBinding, r as readCodexAppServerThreadBinding, s as validateBindingForWrite } from "./session-binding-record-codec-z4ZpDn6E.mjs";
|
|
3
|
+
import { a as ownsStoredSessionGeneration, c as preserveNativeTaskImport, d as readCurrentCodexNativeSubagentSubmissions, f as readCurrentNativePendingAssignments, i as matchesCodexNativeSubagentSubmissionBinding, l as readCurrentCodexAppServerBinding, m as sessionBindingIdentity, n as assertCodexBindingMayBeReplaced, o as preserveCodexNativeSubagentSubmissions, p as readPluginAppPolicyContext, r as bindingStoreKey, s as preserveNativePendingAssignments, t as CodexSupervisionBindingReplacementError, u as readCurrentCodexAppServerBindings } from "./session-binding-record-BZB8RgcF.mjs";
|
|
4
|
+
import { a as PHYSICAL_SESSION_RETIRE_TTL_MS, i as CODEX_APP_SERVER_BINDING_NAMESPACE, n as CODEX_APP_SERVER_BINDING_LEASE, r as CODEX_APP_SERVER_BINDING_MAX_ENTRIES, t as CODEX_APP_SERVER_BINDING_GUARDED_REQUEST_TIMEOUT_MS } from "./session-binding-meta-Lkm5Lpf4.mjs";
|
|
5
|
+
import { n as normalizeCodexAppServerBindingModelProvider } from "./auth-profile-CgHQ8Vot.mjs";
|
|
6
|
+
import { t as __exportAll } from "./session-binding-sidecars-BrdV95Fg.mjs";
|
|
6
7
|
import { asOptionalRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
8
|
import { createHash } from "node:crypto";
|
|
8
9
|
import { AgentHarnessSessionSupersededError, embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
9
|
-
import {
|
|
10
|
+
import { combineNativeSessionBindingAuthority as combineCodexBindingAuthority, createNativeSessionBindingLifecycle, prepareNativeSessionGenerationAuthority, reclaimNativeSessionGenerationWithAuthority, resolveNativeSessionBindingWithAuthority } from "openclaw/plugin-sdk/agent-harness-session-runtime";
|
|
11
|
+
//#region extensions/codex/src/app-server/session-binding-authority.ts
|
|
12
|
+
/** Decides whether a run may share the durable stable-key binding owner. */
|
|
13
|
+
async function resolveCodexRunSessionBindingAuthority(params) {
|
|
14
|
+
return (await prepareNativeSessionGenerationAuthority({
|
|
15
|
+
...params,
|
|
16
|
+
target: params.identity,
|
|
17
|
+
createSupersededError: createCodexSessionGenerationSupersededError
|
|
18
|
+
})).state;
|
|
19
|
+
}
|
|
20
|
+
/** Builds the terminal coordination error used when a newer OpenClaw session owns the binding. */
|
|
21
|
+
function createCodexSessionGenerationSupersededError(sessionId) {
|
|
22
|
+
return new AgentHarnessSessionSupersededError(`Codex session generation is no longer current: ${sessionId}`);
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
10
25
|
//#region extensions/codex/src/app-server/session-binding-native-mutations.ts
|
|
11
26
|
/** The caller supplies the transaction's freshly parsed row and current-authority closure. */
|
|
12
27
|
function mutateNativeSubagentBinding({ identity, current, mutation, assertCurrent }) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
assertCurrent();
|
|
16
|
-
if (current?.state !== "active" || !ownsStoredSessionGeneration(identity, current) || identity.kind === "session" && mutation.owner.sessionId !== identity.sessionId || !matchesCodexNativeSubagentSubmissionBinding(current.binding, mutation.owner)) return { result: false };
|
|
17
|
-
const changed = mutateNativePendingAssignments({
|
|
18
|
-
current: current.nativeSubagentAssignments,
|
|
19
|
-
owner: mutation.owner,
|
|
20
|
-
assignment: mutation.assignment,
|
|
21
|
-
consume: mutation.kind === "consume-native-subagent-assignment"
|
|
22
|
-
});
|
|
23
|
-
if (!changed.applied) return { result: false };
|
|
24
|
-
const { nativeSubagentAssignments: _previous, ...bindingOwner } = current;
|
|
25
|
-
return {
|
|
26
|
-
result: true,
|
|
27
|
-
next: {
|
|
28
|
-
...bindingOwner,
|
|
29
|
-
...changed.next ? { nativeSubagentAssignments: changed.next } : {}
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
if (!assertCurrent) throw new Error("Codex native subagent submission mutation requires current authority.");
|
|
28
|
+
const isAssignment = mutation.kind === "record-native-subagent-assignment" || mutation.kind === "consume-native-subagent-assignment";
|
|
29
|
+
if (!assertCurrent) throw new Error(`Codex native ${isAssignment ? "assignment" : "subagent submission"} mutation requires current authority.`);
|
|
34
30
|
assertCurrent();
|
|
35
31
|
if (current?.state !== "active" || !ownsStoredSessionGeneration(identity, current) || identity.kind === "session" && mutation.owner.sessionId !== identity.sessionId || !matchesCodexNativeSubagentSubmissionBinding(current.binding, mutation.owner)) return { result: false };
|
|
36
|
-
const
|
|
32
|
+
const field = isAssignment ? "nativeSubagentAssignments" : "nativeSubagentSubmissions";
|
|
33
|
+
const changed = isAssignment ? mutateNativePendingAssignments({
|
|
34
|
+
current: current.nativeSubagentAssignments,
|
|
35
|
+
owner: mutation.owner,
|
|
36
|
+
assignment: mutation.assignment,
|
|
37
|
+
consume: mutation.kind === "consume-native-subagent-assignment"
|
|
38
|
+
}) : mutateCodexNativeSubagentSubmissions({
|
|
37
39
|
current: current.nativeSubagentSubmissions,
|
|
38
40
|
owner: mutation.owner,
|
|
39
41
|
receipt: mutation.receipt,
|
|
40
42
|
consume: mutation.kind === "consume-native-subagent-submission"
|
|
41
43
|
});
|
|
42
44
|
if (!changed.applied) return { result: false };
|
|
43
|
-
const {
|
|
45
|
+
const { [field]: _previous, ...bindingOwner } = current;
|
|
44
46
|
return {
|
|
45
47
|
result: true,
|
|
46
48
|
next: {
|
|
47
49
|
...bindingOwner,
|
|
48
|
-
...changed.next ? {
|
|
50
|
+
...changed.next ? { [field]: changed.next } : {}
|
|
49
51
|
}
|
|
50
52
|
};
|
|
51
53
|
}
|
|
52
54
|
//#endregion
|
|
53
|
-
//#region extensions/codex/src/app-server/session-binding.ts
|
|
54
|
-
/** SQLite-backed Codex app-server thread bindings. */
|
|
55
|
-
var session_binding_exports = /* @__PURE__ */ __exportAll({
|
|
56
|
-
CODEX_APP_SERVER_BINDING_GUARDED_REQUEST_TIMEOUT_MS: () => CODEX_APP_SERVER_BINDING_GUARDED_REQUEST_TIMEOUT_MS,
|
|
57
|
-
CODEX_APP_SERVER_BINDING_MAX_ENTRIES: () => CODEX_APP_SERVER_BINDING_MAX_ENTRIES,
|
|
58
|
-
CODEX_APP_SERVER_BINDING_NAMESPACE: () => CODEX_APP_SERVER_BINDING_NAMESPACE,
|
|
59
|
-
CodexSupervisionBindingReplacementError: () => CodexSupervisionBindingReplacementError,
|
|
60
|
-
assertCodexBindingMayBeReplaced: () => assertCodexBindingMayBeReplaced,
|
|
61
|
-
bindingStoreKey: () => bindingStoreKey,
|
|
62
|
-
createCodexAppServerBindingStore: () => createCodexAppServerBindingStore,
|
|
63
|
-
createCodexSessionGenerationSupersededError: () => createCodexSessionGenerationSupersededError,
|
|
64
|
-
createStoredCodexAppServerBinding: () => createStoredCodexAppServerBinding,
|
|
65
|
-
hashCodexAppServerBindingFingerprint: () => hashCodexAppServerBindingFingerprint,
|
|
66
|
-
normalizeStoredCodexAppServerBindingFingerprints: () => normalizeStoredCodexAppServerBindingFingerprints,
|
|
67
|
-
readCodexAppServerThreadBinding: () => readCodexAppServerThreadBinding,
|
|
68
|
-
readStoredCodexAppServerBinding: () => readStoredCodexAppServerBinding,
|
|
69
|
-
reclaimCurrentCodexSessionGeneration: () => reclaimCurrentCodexSessionGeneration,
|
|
70
|
-
resolveCodexRunSessionBindingAuthority: () => resolveCodexRunSessionBindingAuthority,
|
|
71
|
-
resolveCodexSessionBinding: () => resolveCodexSessionBinding,
|
|
72
|
-
sessionBindingIdentity: () => sessionBindingIdentity,
|
|
73
|
-
validateBindingForWrite: () => validateBindingForWrite
|
|
74
|
-
});
|
|
75
|
-
const BINDING_LEASE_RETRY_INTERVAL_MS = 1e3;
|
|
55
|
+
//#region extensions/codex/src/app-server/session-binding-codec.ts
|
|
76
56
|
const BOUNDED_BINDING_FINGERPRINT_PATTERN = /^sha256:[a-f0-9]{64}$/i;
|
|
77
|
-
const CODEX_APP_SERVER_BINDING_GUARDED_REQUEST_TIMEOUT_MS = 6e4;
|
|
78
|
-
const BINDING_LEASE_STALE_MS = 65e3;
|
|
79
|
-
const BINDING_LEASE_WAIT_MS = 7e4;
|
|
80
|
-
const BINDING_LEASE_RENEW_INTERVAL_MS = Math.floor(BINDING_LEASE_STALE_MS / 3);
|
|
81
|
-
const PHYSICAL_SESSION_RETIRE_TTL_MS = BINDING_LEASE_WAIT_MS;
|
|
82
|
-
/** Decides whether a run may share the durable stable-key binding owner. */
|
|
83
|
-
function resolveCodexRunSessionBindingAuthority(params) {
|
|
84
|
-
return captureNativeSessionGenerationAuthority({
|
|
85
|
-
...params,
|
|
86
|
-
target: params.identity,
|
|
87
|
-
createSupersededError: createCodexSessionGenerationSupersededError
|
|
88
|
-
}).state;
|
|
89
|
-
}
|
|
90
|
-
/** Builds the terminal coordination error used when a newer OpenClaw session owns the binding. */
|
|
91
|
-
function createCodexSessionGenerationSupersededError(sessionId) {
|
|
92
|
-
return new AgentHarnessSessionSupersededError(`Codex session generation is no longer current: ${sessionId}`);
|
|
93
|
-
}
|
|
94
57
|
function hashCodexAppServerBindingFingerprint(canonical) {
|
|
95
58
|
return `sha256:${createHash("sha256").update(canonical).digest("hex")}`;
|
|
96
59
|
}
|
|
@@ -123,8 +86,8 @@ function createStoredCodexAppServerBinding(value, options = {}) {
|
|
|
123
86
|
const rawRecord = asOptionalRecord(value);
|
|
124
87
|
if (!rawRecord) return;
|
|
125
88
|
const record = normalizeLegacyBindingFingerprints(rawRecord);
|
|
126
|
-
if (record.schemaVersion !==
|
|
127
|
-
const pluginAppPolicyContext = readPluginAppPolicyContext(record.pluginAppPolicyContext
|
|
89
|
+
if (record.schemaVersion !== 2) return;
|
|
90
|
+
const pluginAppPolicyContext = readPluginAppPolicyContext(record.pluginAppPolicyContext);
|
|
128
91
|
const historyCoveredThrough = readCodexBindingTimestamp(record.historyCoveredThrough) ?? readCodexBindingTimestamp(record.updatedAt) ?? readCodexBindingTimestamp(record.createdAt) ?? readCodexBindingTimestamp(options.now) ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
129
92
|
const authProfileId = typeof record.authProfileId === "string" ? record.authProfileId : void 0;
|
|
130
93
|
const binding = readCodexAppServerThreadBinding({
|
|
@@ -144,12 +107,46 @@ function createStoredCodexAppServerBinding(value, options = {}) {
|
|
|
144
107
|
binding: stripUndefinedBinding(binding)
|
|
145
108
|
} : void 0;
|
|
146
109
|
}
|
|
110
|
+
//#endregion
|
|
111
|
+
//#region extensions/codex/src/app-server/session-binding.ts
|
|
112
|
+
/** SQLite-backed Codex app-server thread bindings. */
|
|
113
|
+
var session_binding_exports = /* @__PURE__ */ __exportAll({
|
|
114
|
+
CODEX_APP_SERVER_BINDING_GUARDED_REQUEST_TIMEOUT_MS: () => CODEX_APP_SERVER_BINDING_GUARDED_REQUEST_TIMEOUT_MS,
|
|
115
|
+
CODEX_APP_SERVER_BINDING_MAX_ENTRIES: () => CODEX_APP_SERVER_BINDING_MAX_ENTRIES,
|
|
116
|
+
CODEX_APP_SERVER_BINDING_NAMESPACE: () => CODEX_APP_SERVER_BINDING_NAMESPACE,
|
|
117
|
+
CodexSupervisionBindingReplacementError: () => CodexSupervisionBindingReplacementError,
|
|
118
|
+
assertCodexBindingMayBeReplaced: () => assertCodexBindingMayBeReplaced,
|
|
119
|
+
bindingStoreKey: () => bindingStoreKey,
|
|
120
|
+
clearCodexBindingForClient: () => clearCodexBindingForClient,
|
|
121
|
+
combineCodexBindingAuthority: () => combineCodexBindingAuthority,
|
|
122
|
+
createCodexAppServerBindingStore: () => createCodexAppServerBindingStore,
|
|
123
|
+
createCodexSessionGenerationSupersededError: () => createCodexSessionGenerationSupersededError,
|
|
124
|
+
createStoredCodexAppServerBinding: () => createStoredCodexAppServerBinding,
|
|
125
|
+
hashCodexAppServerBindingFingerprint: () => hashCodexAppServerBindingFingerprint,
|
|
126
|
+
normalizeStoredCodexAppServerBindingFingerprints: () => normalizeStoredCodexAppServerBindingFingerprints,
|
|
127
|
+
readCodexAppServerThreadBinding: () => readCodexAppServerThreadBinding,
|
|
128
|
+
readStoredCodexAppServerBinding: () => readStoredCodexAppServerBinding,
|
|
129
|
+
reclaimCurrentCodexSessionGeneration: () => reclaimCurrentCodexSessionGeneration,
|
|
130
|
+
resolveCodexRunSessionBindingAuthority: () => resolveCodexRunSessionBindingAuthority,
|
|
131
|
+
resolveCodexSessionBinding: () => resolveCodexSessionBinding,
|
|
132
|
+
sessionBindingIdentity: () => sessionBindingIdentity,
|
|
133
|
+
validateBindingForWrite: () => validateBindingForWrite
|
|
134
|
+
});
|
|
135
|
+
/** Attempt cleanup may only clear the physical owner captured before its awaited work. */
|
|
136
|
+
async function clearCodexBindingForClient(store, identity, thread, authority) {
|
|
137
|
+
if (!thread.clientId) return false;
|
|
138
|
+
return await store.mutate(identity, {
|
|
139
|
+
kind: "clear",
|
|
140
|
+
threadId: thread.threadId,
|
|
141
|
+
clientId: thread.clientId
|
|
142
|
+
}, authority.assertCurrent, authority);
|
|
143
|
+
}
|
|
147
144
|
function bindingLeaseLostError(key, cause) {
|
|
148
145
|
return new Error(`Lost Codex binding lease: ${key}`, cause === void 0 ? void 0 : { cause });
|
|
149
146
|
}
|
|
150
147
|
/** Lets the authoritative OpenClaw session generation claim a stale stable binding row. */
|
|
151
148
|
async function reclaimCurrentCodexSessionGeneration(params) {
|
|
152
|
-
return await
|
|
149
|
+
return await reclaimNativeSessionGenerationWithAuthority({
|
|
153
150
|
...params,
|
|
154
151
|
target: params.identity,
|
|
155
152
|
generation: codexSessionGenerationOperations(params.bindingStore, params.identity),
|
|
@@ -159,7 +156,7 @@ async function reclaimCurrentCodexSessionGeneration(params) {
|
|
|
159
156
|
/** Resolve continuity before selecting native queues, catalogs, or connections. */
|
|
160
157
|
async function resolveCodexSessionBinding(params) {
|
|
161
158
|
const identity = params.identity;
|
|
162
|
-
return await
|
|
159
|
+
return await resolveNativeSessionBindingWithAuthority({
|
|
163
160
|
...params,
|
|
164
161
|
...identity.kind === "session" ? {
|
|
165
162
|
target: identity,
|
|
@@ -175,13 +172,9 @@ async function resolveCodexSessionBinding(params) {
|
|
|
175
172
|
/** Creates the single binding facade owned by the Codex plugin runtime. */
|
|
176
173
|
function createCodexAppServerBindingStore(state) {
|
|
177
174
|
const lifecycle = createNativeSessionBindingLifecycle(state, {
|
|
175
|
+
workerCodec: "codex",
|
|
178
176
|
readRecord: readStoredCodexAppServerBinding,
|
|
179
|
-
lease:
|
|
180
|
-
staleMs: BINDING_LEASE_STALE_MS,
|
|
181
|
-
waitMs: BINDING_LEASE_WAIT_MS,
|
|
182
|
-
retryIntervalMs: BINDING_LEASE_RETRY_INTERVAL_MS,
|
|
183
|
-
renewIntervalMs: BINDING_LEASE_RENEW_INTERVAL_MS
|
|
184
|
-
},
|
|
177
|
+
lease: CODEX_APP_SERVER_BINDING_LEASE,
|
|
185
178
|
releaseTtlMs: (key, current) => current.nativeSubagentTaskImport !== void 0 || current.state === "active" || current.retired === true && !key.startsWith("session:") ? void 0 : current.retired === true ? PHYSICAL_SESSION_RETIRE_TTL_MS : 1,
|
|
186
179
|
onReleaseFailure: (key, error) => embeddedAgentLog.warn("failed to release codex app-server binding lease", {
|
|
187
180
|
key,
|
|
@@ -201,6 +194,7 @@ function createCodexAppServerBindingStore(state) {
|
|
|
201
194
|
});
|
|
202
195
|
const prepareLease = (identity, options = {}) => ({
|
|
203
196
|
assertCurrent: options.assertCurrent,
|
|
197
|
+
authority: options.authority,
|
|
204
198
|
prepareLease(current, lease) {
|
|
205
199
|
if (current?.state === "cleared" && current.retired === true && ownsStoredSessionGeneration(identity, current) && !options.allowRetired) return;
|
|
206
200
|
if (current?.state === "active") return {
|
|
@@ -245,7 +239,7 @@ function createCodexAppServerBindingStore(state) {
|
|
|
245
239
|
};
|
|
246
240
|
return {
|
|
247
241
|
read: (identity) => readCurrentCodexAppServerBinding(state, identity),
|
|
248
|
-
|
|
242
|
+
readMany: (identities) => readCurrentCodexAppServerBindings(state.asyncReads, identities),
|
|
249
243
|
readNativeSubagentAssignments: (identity, owner) => readCurrentNativePendingAssignments(state, identity, owner),
|
|
250
244
|
readNativeSubagentSubmissions: (identity, owner) => readCurrentCodexNativeSubagentSubmissions(state, identity, owner),
|
|
251
245
|
async hasOtherThreadOwner(threadId, currentIdentity) {
|
|
@@ -283,7 +277,7 @@ function createCodexAppServerBindingStore(state) {
|
|
|
283
277
|
expectedPreviousSessionId: currentSessionId
|
|
284
278
|
};
|
|
285
279
|
},
|
|
286
|
-
async mutate(identity, mutation, assertCurrent) {
|
|
280
|
+
async mutate(identity, mutation, assertCurrent, authority) {
|
|
287
281
|
return await lifecycle.withMutation(async () => {
|
|
288
282
|
const key = bindingStoreKey(identity);
|
|
289
283
|
const retainLegacyClear = mutation.kind === "clear" && key.startsWith("conversation:legacy-");
|
|
@@ -330,7 +324,7 @@ function createCodexAppServerBindingStore(state) {
|
|
|
330
324
|
const retiredGeneration = current?.state === "cleared" && current.retired === true && ownsGeneration;
|
|
331
325
|
const preservesSupervisionOwner = mutation.kind === "set" && active?.binding.connectionScope === "supervision" && isSameSupervisionOwner(active.binding, mutation.binding);
|
|
332
326
|
const replacesExpectedOrdinaryOwner = mutation.kind === "replace-thread" && active?.binding.threadId === mutation.expectedThreadId && active.binding.connectionScope !== "supervision" && mutation.binding.connectionScope !== "supervision" && mutation.binding.threadId !== mutation.expectedThreadId;
|
|
333
|
-
if (mutation.kind === "set" && (mutation.if?.kind === "absent" && storedActive || current !== void 0 && !ownsGeneration || retiredGeneration || active?.binding.connectionScope === "supervision" && !preservesSupervisionOwner) || mutation.kind === "patch" && active?.binding.threadId !== mutation.threadId || mutation.kind === "replace-thread" && !replacesExpectedOrdinaryOwner || (mutation.kind === "patch-pending-supervision-branch" || mutation.kind === "commit-pending-supervision-branch") && !matchesPendingSupervisionBranch(active?.binding, mutation.expected) || mutation.kind === "clear" && (!ownsGeneration || mutation.threadId !== void 0 && active?.binding.threadId !== mutation.threadId || active?.binding.connectionScope === "supervision")) return { result: false };
|
|
327
|
+
if ((mutation.kind === "patch" || mutation.kind === "clear") && Object.hasOwn(mutation, "clientId") && mutation.clientId !== active?.binding.clientId || mutation.kind === "set" && (mutation.if?.kind === "absent" && storedActive || current !== void 0 && !ownsGeneration || retiredGeneration || active?.binding.connectionScope === "supervision" && !preservesSupervisionOwner) || mutation.kind === "patch" && active?.binding.threadId !== mutation.threadId || mutation.kind === "replace-thread" && !replacesExpectedOrdinaryOwner || (mutation.kind === "patch-pending-supervision-branch" || mutation.kind === "commit-pending-supervision-branch") && !matchesPendingSupervisionBranch(active?.binding, mutation.expected) || mutation.kind === "clear" && (!ownsGeneration || mutation.threadId !== void 0 && active?.binding.threadId !== mutation.threadId || active?.binding.connectionScope === "supervision")) return { result: false };
|
|
334
328
|
if (mutation.kind === "clear" && retiredGeneration) return { result: true };
|
|
335
329
|
if (mutation.kind === "clear") return {
|
|
336
330
|
result: true,
|
|
@@ -343,22 +337,18 @@ function createCodexAppServerBindingStore(state) {
|
|
|
343
337
|
}
|
|
344
338
|
};
|
|
345
339
|
let binding;
|
|
346
|
-
if (mutation.kind === "set" || mutation.kind === "replace-thread") binding =
|
|
347
|
-
else if (mutation.kind === "patch-pending-supervision-branch") binding =
|
|
340
|
+
if (mutation.kind === "set" || mutation.kind === "replace-thread") binding = mutation.binding;
|
|
341
|
+
else if (mutation.kind === "patch-pending-supervision-branch") binding = {
|
|
348
342
|
...active.binding,
|
|
349
343
|
pendingSupervisionBranch: mutation.pending
|
|
350
|
-
}
|
|
351
|
-
else
|
|
344
|
+
};
|
|
345
|
+
else binding = {
|
|
352
346
|
...active.binding,
|
|
353
347
|
...mutation.patch,
|
|
354
348
|
threadId: mutation.threadId,
|
|
355
|
-
pendingSupervisionBranch: void 0
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
...active.binding,
|
|
359
|
-
...mutation.patch,
|
|
360
|
-
threadId: mutation.threadId
|
|
361
|
-
});
|
|
349
|
+
...mutation.kind === "commit-pending-supervision-branch" ? { pendingSupervisionBranch: void 0 } : {}
|
|
350
|
+
};
|
|
351
|
+
binding = validateBindingForWrite(binding);
|
|
362
352
|
const nativeSubagentSubmissions = active ? preserveCodexNativeSubagentSubmissions(active.binding, binding, active.nativeSubagentSubmissions) : void 0;
|
|
363
353
|
const nativeSubagentAssignments = active ? preserveNativePendingAssignments(active.binding, binding, active.nativeSubagentAssignments) : void 0;
|
|
364
354
|
return {
|
|
@@ -374,10 +364,10 @@ function createCodexAppServerBindingStore(state) {
|
|
|
374
364
|
...ownedLease
|
|
375
365
|
}
|
|
376
366
|
};
|
|
377
|
-
}, (next) => mutation.kind === "clear" && next.nativeSubagentTaskImport === void 0 && !retainLegacyClear && !lifecycle.hasLease(key) ? 1 : void 0, assertCurrent);
|
|
367
|
+
}, (next) => mutation.kind === "clear" && next.nativeSubagentTaskImport === void 0 && !retainLegacyClear && !lifecycle.hasLease(key) ? 1 : void 0, assertCurrent, authority);
|
|
378
368
|
});
|
|
379
369
|
},
|
|
380
|
-
async adoptSessionGeneration(identity, expectedPreviousSessionId, assertCurrent) {
|
|
370
|
+
async adoptSessionGeneration(identity, expectedPreviousSessionId, assertCurrent, authority) {
|
|
381
371
|
return await lifecycle.withMutation(async () => {
|
|
382
372
|
const key = bindingStoreKey(identity);
|
|
383
373
|
const expectedSessionId = expectedPreviousSessionId.trim();
|
|
@@ -397,7 +387,7 @@ function createCodexAppServerBindingStore(state) {
|
|
|
397
387
|
...adoptedSubmissions !== void 0 ? { nativeSubagentSubmissions: adoptedSubmissions } : {}
|
|
398
388
|
}
|
|
399
389
|
};
|
|
400
|
-
}, void 0, assertCurrent);
|
|
390
|
+
}, void 0, assertCurrent, authority);
|
|
401
391
|
});
|
|
402
392
|
},
|
|
403
393
|
resetSessionGeneration: (identity) => transitionSessionGeneration(identity, "reset"),
|
|
@@ -415,17 +405,17 @@ function createCodexAppServerBindingStore(state) {
|
|
|
415
405
|
}
|
|
416
406
|
}, (stored, mutation) => run(stored?.state === "active" ? stored.binding : void 0, mutation));
|
|
417
407
|
},
|
|
418
|
-
withLease: (identity, run) => lifecycle.withLease(bindingStoreKey(identity), run, prepareLease(identity))
|
|
408
|
+
withLease: (identity, run, options) => lifecycle.withLease(bindingStoreKey(identity), run, prepareLease(identity, options))
|
|
419
409
|
};
|
|
420
410
|
}
|
|
421
411
|
function codexSessionGenerationOperations(store, identity) {
|
|
422
412
|
return {
|
|
423
413
|
prepareReclaim: () => store.prepareSessionGenerationReclaim(identity),
|
|
424
|
-
adopt: (expectedPreviousSessionId,
|
|
425
|
-
reclaim: (expectedPreviousSessionId,
|
|
414
|
+
adopt: (expectedPreviousSessionId, authority) => store.adoptSessionGeneration(identity, expectedPreviousSessionId, authority.assertCurrent, authority),
|
|
415
|
+
reclaim: (expectedPreviousSessionId, authority) => store.mutate(identity, {
|
|
426
416
|
kind: "reclaim-generation",
|
|
427
417
|
expectedPreviousSessionId
|
|
428
|
-
}, assertCurrent)
|
|
418
|
+
}, authority.assertCurrent, authority)
|
|
429
419
|
};
|
|
430
420
|
}
|
|
431
421
|
function isSameSupervisionOwner(current, replacement) {
|
|
@@ -440,4 +430,4 @@ function preservedSessionGeneration(identity, current) {
|
|
|
440
430
|
return storedSessionGeneration(identity, current);
|
|
441
431
|
}
|
|
442
432
|
//#endregion
|
|
443
|
-
export {
|
|
433
|
+
export { hashCodexAppServerBindingFingerprint as a, session_binding_exports as i, reclaimCurrentCodexSessionGeneration as n, createCodexSessionGenerationSupersededError as o, resolveCodexSessionBinding as r, resolveCodexRunSessionBindingAuthority as s, clearCodexBindingForClient as t };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region extensions/codex/src/app-server/session-binding-meta.ts
|
|
2
|
+
/** Process-stable plugin-state metadata for Codex app-server bindings. */
|
|
3
|
+
const CODEX_APP_SERVER_BINDING_NAMESPACE = "app-server-thread-bindings";
|
|
4
|
+
const CODEX_APP_SERVER_BINDING_MAX_ENTRIES = 5e4;
|
|
5
|
+
const CODEX_APP_SERVER_BINDING_GUARDED_REQUEST_TIMEOUT_MS = 6e4;
|
|
6
|
+
const staleMs = 65e3;
|
|
7
|
+
const CODEX_APP_SERVER_BINDING_LEASE = {
|
|
8
|
+
staleMs,
|
|
9
|
+
waitMs: 7e4,
|
|
10
|
+
retryIntervalMs: 1e3,
|
|
11
|
+
renewIntervalMs: Math.floor(staleMs / 3)
|
|
12
|
+
};
|
|
13
|
+
const PHYSICAL_SESSION_RETIRE_TTL_MS = CODEX_APP_SERVER_BINDING_LEASE.waitMs;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { PHYSICAL_SESSION_RETIRE_TTL_MS as a, CODEX_APP_SERVER_BINDING_NAMESPACE as i, CODEX_APP_SERVER_BINDING_LEASE as n, CODEX_APP_SERVER_BINDING_MAX_ENTRIES as r, CODEX_APP_SERVER_BINDING_GUARDED_REQUEST_TIMEOUT_MS as t };
|