@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
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { a as matchesCodexNativeSubagentSubmissionOwner, h as codexNativeSubagentHistoryConnectionFingerprint, r as readNativePendingAssignments, s as readCodexNativeSubagentSubmissions, t as matchesNativeAssignmentLifecycle } from "./native-subagent-pending-assignments-BDqhOdJp.mjs";
|
|
2
|
+
import { a as readStoredCodexAppServerBinding, t as legacyAppPolicyEntrySchema } from "./session-binding-record-codec-z4ZpDn6E.mjs";
|
|
3
|
+
import { t as __exportAll } from "./session-binding-sidecars-BrdV95Fg.mjs";
|
|
4
|
+
import { asOptionalRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
|
+
import { createHash } from "node:crypto";
|
|
6
|
+
import { isDeepStrictEqual } from "node:util";
|
|
7
|
+
import { AgentHarnessPreflightError } from "openclaw/plugin-sdk/agent-harness-registration";
|
|
8
|
+
import { resolveSessionAgentIdsStrict } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
9
|
+
//#region extensions/codex/src/app-server/session-binding-record.ts
|
|
10
|
+
/** Generation-aware binding reads and ownership checks over the canonical persisted codec. */
|
|
11
|
+
var session_binding_record_exports = /* @__PURE__ */ __exportAll({
|
|
12
|
+
CodexSupervisionBindingReplacementError: () => CodexSupervisionBindingReplacementError,
|
|
13
|
+
assertCodexBindingMayBeReplaced: () => assertCodexBindingMayBeReplaced,
|
|
14
|
+
bindingStoreKey: () => bindingStoreKey,
|
|
15
|
+
matchesCodexNativeSubagentSubmissionBinding: () => matchesCodexNativeSubagentSubmissionBinding,
|
|
16
|
+
ownsStoredSessionGeneration: () => ownsStoredSessionGeneration,
|
|
17
|
+
preserveCodexNativeSubagentSubmissions: () => preserveCodexNativeSubagentSubmissions,
|
|
18
|
+
preserveNativePendingAssignments: () => preserveNativePendingAssignments,
|
|
19
|
+
preserveNativeTaskImport: () => preserveNativeTaskImport,
|
|
20
|
+
readCurrentCodexAppServerBinding: () => readCurrentCodexAppServerBinding,
|
|
21
|
+
readCurrentCodexAppServerBindings: () => readCurrentCodexAppServerBindings,
|
|
22
|
+
readCurrentCodexNativeSubagentSubmissions: () => readCurrentCodexNativeSubagentSubmissions,
|
|
23
|
+
readCurrentNativePendingAssignments: () => readCurrentNativePendingAssignments,
|
|
24
|
+
readPluginAppPolicyContext: () => readPluginAppPolicyContext,
|
|
25
|
+
readStoredCodexAppServerBinding: () => readStoredCodexAppServerBinding,
|
|
26
|
+
sessionBindingIdentity: () => sessionBindingIdentity
|
|
27
|
+
});
|
|
28
|
+
/** Resolves the same agent scope OpenClaw uses for transcript/session ownership. */
|
|
29
|
+
function sessionBindingIdentity(params) {
|
|
30
|
+
const { sessionAgentId } = resolveSessionAgentIdsStrict(params);
|
|
31
|
+
const sessionKey = params.sessionKey?.trim();
|
|
32
|
+
return {
|
|
33
|
+
kind: "session",
|
|
34
|
+
agentId: sessionAgentId,
|
|
35
|
+
sessionId: params.sessionId,
|
|
36
|
+
...sessionKey ? { sessionKey } : {}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/** Stable plugin-state key for one current binding owner. */
|
|
40
|
+
function bindingStoreKey(identity) {
|
|
41
|
+
if (identity.kind === "session") {
|
|
42
|
+
const rawAgentId = identity.agentId.trim();
|
|
43
|
+
const sessionId = identity.sessionId.trim();
|
|
44
|
+
if (!rawAgentId) throw new Error("Codex app-server binding requires an agent id");
|
|
45
|
+
if (!sessionId) throw new Error("Codex app-server binding requires a session id");
|
|
46
|
+
const agentId = resolveSessionAgentIdsStrict({ agentId: rawAgentId }).sessionAgentId;
|
|
47
|
+
const sessionKey = identity.sessionKey?.trim();
|
|
48
|
+
if (sessionKey) return `session-key:${agentId}:${createHash("sha256").update(sessionKey).digest("base64url")}`;
|
|
49
|
+
return `session:${agentId}:${sessionId}`;
|
|
50
|
+
}
|
|
51
|
+
const bindingId = identity.bindingId.trim();
|
|
52
|
+
if (!bindingId) throw new Error("Codex app-server conversation binding requires a binding id");
|
|
53
|
+
return `conversation:${bindingId}`;
|
|
54
|
+
}
|
|
55
|
+
function ownsStoredSessionGeneration(identity, current) {
|
|
56
|
+
return identity.kind !== "session" || !current?.sessionId || current.sessionId === identity.sessionId;
|
|
57
|
+
}
|
|
58
|
+
/** The same physical-generation check serves execution and read-only projections. */
|
|
59
|
+
function readCurrentCodexAppServerBinding(state, identity) {
|
|
60
|
+
const key = bindingStoreKey(identity);
|
|
61
|
+
return decodeCurrentCodexAppServerBinding(key, state.lookup(key), identity);
|
|
62
|
+
}
|
|
63
|
+
function decodeCurrentCodexAppServerBinding(key, raw, identity) {
|
|
64
|
+
const stored = readStoredCodexAppServerBinding(raw);
|
|
65
|
+
if (raw !== void 0 && !stored) throw new Error(`Invalid Codex app-server binding row: ${key}`);
|
|
66
|
+
return stored?.state === "active" && ownsStoredSessionGeneration(identity, stored) ? stored.binding : void 0;
|
|
67
|
+
}
|
|
68
|
+
/** Acquire fresh rows off-thread; decode lazily to preserve caller failure ordering. */
|
|
69
|
+
async function* readCurrentCodexAppServerBindings(state, identities) {
|
|
70
|
+
const lookupMany = state.lookupMany?.bind(state);
|
|
71
|
+
for (let offset = 0; offset < identities.length; offset += 1e4) {
|
|
72
|
+
const batch = identities.slice(offset, offset + 1e4);
|
|
73
|
+
let keys;
|
|
74
|
+
if (lookupMany) try {
|
|
75
|
+
keys = batch.map(bindingStoreKey);
|
|
76
|
+
} catch {}
|
|
77
|
+
if (!keys || !lookupMany) {
|
|
78
|
+
for (const identity of batch) {
|
|
79
|
+
const key = bindingStoreKey(identity);
|
|
80
|
+
yield decodeCurrentCodexAppServerBinding(key, await state.lookup(key), identity);
|
|
81
|
+
}
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
const values = await lookupMany(keys);
|
|
85
|
+
for (let index = 0; index < batch.length; index++) {
|
|
86
|
+
const value = values[index];
|
|
87
|
+
if (!value.ok) throw value.error;
|
|
88
|
+
yield decodeCurrentCodexAppServerBinding(keys[index], value.value, batch[index]);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function matchesCodexNativeSubagentSubmissionBinding(binding, owner) {
|
|
93
|
+
return binding.threadId === owner.parentThreadId && !binding.pendingSupervisionBranch && codexNativeSubagentHistoryConnectionFingerprint(binding) === owner.connectionFingerprint;
|
|
94
|
+
}
|
|
95
|
+
/** Unknown metadata stays opaque through ordinary binding writes. */
|
|
96
|
+
function preserveCodexNativeSubagentSubmissions(currentBinding, nextBinding, value) {
|
|
97
|
+
return currentBinding.threadId === nextBinding.threadId && codexNativeSubagentHistoryConnectionFingerprint(currentBinding) === codexNativeSubagentHistoryConnectionFingerprint(nextBinding) && isDeepStrictEqual(currentBinding.pendingSupervisionBranch, nextBinding.pendingSupervisionBranch) ? value : void 0;
|
|
98
|
+
}
|
|
99
|
+
function readCurrentCodexNativeSubagentSubmissions(state, identity, owner) {
|
|
100
|
+
const stored = readCurrentNativeSubagentBinding(state, identity, owner);
|
|
101
|
+
if (!stored) return [];
|
|
102
|
+
const submissions = readCodexNativeSubagentSubmissions(stored.nativeSubagentSubmissions);
|
|
103
|
+
return submissions && matchesCodexNativeSubagentSubmissionOwner(submissions.owner, owner) ? submissions.receipts : [];
|
|
104
|
+
}
|
|
105
|
+
function readCurrentNativePendingAssignments(state, identity, owner) {
|
|
106
|
+
const stored = readCurrentNativeSubagentBinding(state, identity, owner);
|
|
107
|
+
return (readNativePendingAssignments(stored?.nativeSubagentAssignments)?.assignments ?? []).filter((entry) => matchesNativeAssignmentLifecycle(entry.owner, owner));
|
|
108
|
+
}
|
|
109
|
+
function readCurrentNativeSubagentBinding(state, identity, owner) {
|
|
110
|
+
const key = bindingStoreKey(identity);
|
|
111
|
+
const raw = state.lookup(key);
|
|
112
|
+
const stored = readStoredCodexAppServerBinding(raw);
|
|
113
|
+
if (raw !== void 0 && !stored) throw new Error(`Invalid Codex app-server binding row: ${key}`);
|
|
114
|
+
if (stored?.state !== "active" || !ownsStoredSessionGeneration(identity, stored) || identity.kind === "session" && owner.sessionId !== identity.sessionId || !matchesCodexNativeSubagentSubmissionBinding(stored.binding, owner)) return;
|
|
115
|
+
return stored;
|
|
116
|
+
}
|
|
117
|
+
function preserveNativeTaskImport(current) {
|
|
118
|
+
return current?.nativeSubagentTaskImport !== void 0 ? { nativeSubagentTaskImport: current.nativeSubagentTaskImport } : {};
|
|
119
|
+
}
|
|
120
|
+
/** Preserve inventory through native rotation, never across a connection-policy change. */
|
|
121
|
+
function preserveNativePendingAssignments(current, next, value) {
|
|
122
|
+
return codexNativeSubagentHistoryConnectionFingerprint(current) === codexNativeSubagentHistoryConnectionFingerprint(next) && isDeepStrictEqual(current.pendingSupervisionBranch, next.pendingSupervisionBranch) ? value : void 0;
|
|
123
|
+
}
|
|
124
|
+
var CodexSupervisionBindingReplacementError = class extends Error {
|
|
125
|
+
constructor(threadId, operation) {
|
|
126
|
+
super(`Refusing to replace supervised Codex thread ${threadId} while ${operation}; its native user-home connection and model ownership must be preserved`);
|
|
127
|
+
this.name = "CodexSupervisionBindingReplacementError";
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
function assertCodexBindingMayBeReplaced(binding, operation, expected) {
|
|
131
|
+
if (expected) throw new AgentHarnessPreflightError(`Codex native model ownership prevents ${operation}. Continue or compact the original session in its native runtime, or create a new chat with a concrete model; the original binding was preserved.`);
|
|
132
|
+
if (binding?.connectionScope === "supervision") throw new CodexSupervisionBindingReplacementError(binding.threadId, operation);
|
|
133
|
+
}
|
|
134
|
+
function readPluginAppPolicyContext(value) {
|
|
135
|
+
const record = asOptionalRecord(value);
|
|
136
|
+
if (!record || typeof record.fingerprint !== "string") return;
|
|
137
|
+
const apps = asOptionalRecord(record.apps);
|
|
138
|
+
if (!apps) return;
|
|
139
|
+
const parsedApps = {};
|
|
140
|
+
for (const [appId, rawEntry] of Object.entries(apps)) {
|
|
141
|
+
const entry = asOptionalRecord(rawEntry);
|
|
142
|
+
if (!entry || "appId" in entry) return;
|
|
143
|
+
const parsed = legacyAppPolicyEntrySchema.safeParse(entry);
|
|
144
|
+
if (!parsed.success) return;
|
|
145
|
+
const validated = parsed.data;
|
|
146
|
+
const { destructiveApprovalMode } = validated;
|
|
147
|
+
const policy = {
|
|
148
|
+
allowDestructiveActions: validated.allowDestructiveActions,
|
|
149
|
+
...validated.allowOpenWorld !== void 0 ? { allowOpenWorld: validated.allowOpenWorld } : {},
|
|
150
|
+
...destructiveApprovalMode ? { destructiveApprovalMode } : {},
|
|
151
|
+
mcpServerNames: validated.mcpServerNames
|
|
152
|
+
};
|
|
153
|
+
if (validated.source === "account") parsedApps[appId] = {
|
|
154
|
+
source: "account",
|
|
155
|
+
appName: validated.appName,
|
|
156
|
+
...policy
|
|
157
|
+
};
|
|
158
|
+
else parsedApps[appId] = {
|
|
159
|
+
configKey: validated.configKey,
|
|
160
|
+
marketplaceName: validated.marketplaceName,
|
|
161
|
+
pluginName: validated.pluginName,
|
|
162
|
+
...policy
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
const parsedPluginAppIds = {};
|
|
166
|
+
const pluginAppIds = record.pluginAppIds === void 0 ? {} : asOptionalRecord(record.pluginAppIds);
|
|
167
|
+
if (!pluginAppIds) return;
|
|
168
|
+
for (const [configKey, appIds] of Object.entries(pluginAppIds)) {
|
|
169
|
+
if (!Array.isArray(appIds) || appIds.some((appId) => typeof appId !== "string")) return;
|
|
170
|
+
parsedPluginAppIds[configKey] = appIds;
|
|
171
|
+
}
|
|
172
|
+
return {
|
|
173
|
+
fingerprint: record.fingerprint,
|
|
174
|
+
apps: parsedApps,
|
|
175
|
+
pluginAppIds: parsedPluginAppIds
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
//#endregion
|
|
179
|
+
export { ownsStoredSessionGeneration as a, preserveNativeTaskImport as c, readCurrentCodexNativeSubagentSubmissions as d, readCurrentNativePendingAssignments as f, session_binding_record_exports as h, matchesCodexNativeSubagentSubmissionBinding as i, readCurrentCodexAppServerBinding as l, sessionBindingIdentity as m, assertCodexBindingMayBeReplaced as n, preserveCodexNativeSubagentSubmissions as o, readPluginAppPolicyContext as p, bindingStoreKey as r, preserveNativePendingAssignments as s, CodexSupervisionBindingReplacementError as t, readCurrentCodexAppServerBindings as u };
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { n as CODEX_PLUGIN_MARKETPLACE_NAME_PATTERN, t as normalizeCodexServiceTier } from "./service-tier-normalization-Cei89SW6.mjs";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region extensions/codex/src/app-server/session-binding-record-codec.ts
|
|
4
|
+
/** Canonical persisted binding codec; safe to load before worker transaction admission. */
|
|
5
|
+
const optionalStringSchema = z.string().optional().catch(void 0);
|
|
6
|
+
const optionalBooleanSchema = z.boolean().optional().catch(void 0);
|
|
7
|
+
const optionalNonBlankStringSchema = z.string().refine((value) => Boolean(value.trim())).optional().catch(void 0);
|
|
8
|
+
const optionalTimestampSchema = z.string().refine((value) => Number.isFinite(Date.parse(value))).optional().catch(void 0);
|
|
9
|
+
const pendingSupervisionBranchSchema = z.object({
|
|
10
|
+
sourceThreadId: z.string().trim().min(1),
|
|
11
|
+
connectionFingerprint: z.string().trim().min(1).optional(),
|
|
12
|
+
lastTurnId: z.string().trim().min(1).optional(),
|
|
13
|
+
cleanupThreadIds: z.array(z.string().trim().min(1)).max(2).optional()
|
|
14
|
+
}).strict().superRefine((pending, context) => {
|
|
15
|
+
const cleanupThreadIds = pending.cleanupThreadIds ?? [];
|
|
16
|
+
if (new Set(cleanupThreadIds).size !== cleanupThreadIds.length) context.addIssue({
|
|
17
|
+
code: "custom",
|
|
18
|
+
message: "pending supervision cleanup thread ids must be unique"
|
|
19
|
+
});
|
|
20
|
+
if (cleanupThreadIds.includes(pending.sourceThreadId)) context.addIssue({
|
|
21
|
+
code: "custom",
|
|
22
|
+
message: "pending supervision cleanup cannot target its source"
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
const contextEngineProjectionSchema = z.object({
|
|
26
|
+
schemaVersion: z.literal(1),
|
|
27
|
+
mode: z.literal("thread_bootstrap"),
|
|
28
|
+
epoch: z.string().refine((value) => Boolean(value.trim())),
|
|
29
|
+
fingerprint: optionalStringSchema
|
|
30
|
+
}).strict();
|
|
31
|
+
const contextEngineSchema = z.object({
|
|
32
|
+
schemaVersion: z.literal(1),
|
|
33
|
+
engineId: z.string(),
|
|
34
|
+
policyFingerprint: z.string(),
|
|
35
|
+
projection: contextEngineProjectionSchema.optional().catch(void 0)
|
|
36
|
+
}).strict();
|
|
37
|
+
const destructiveApprovalModeSchema = z.enum([
|
|
38
|
+
"allow",
|
|
39
|
+
"deny",
|
|
40
|
+
"auto",
|
|
41
|
+
"ask"
|
|
42
|
+
]).optional();
|
|
43
|
+
const accountAppPolicyEntrySchema = z.object({
|
|
44
|
+
source: z.literal("account"),
|
|
45
|
+
appName: z.string(),
|
|
46
|
+
allowDestructiveActions: z.boolean(),
|
|
47
|
+
allowOpenWorld: z.boolean().optional(),
|
|
48
|
+
destructiveApprovalMode: destructiveApprovalModeSchema.catch(void 0),
|
|
49
|
+
mcpServerNames: z.array(z.string())
|
|
50
|
+
}).strict();
|
|
51
|
+
const pluginAppPolicyEntrySchema = z.object({
|
|
52
|
+
source: z.literal("plugin").optional(),
|
|
53
|
+
configKey: z.string(),
|
|
54
|
+
marketplaceName: z.string().regex(CODEX_PLUGIN_MARKETPLACE_NAME_PATTERN),
|
|
55
|
+
pluginName: z.string(),
|
|
56
|
+
allowDestructiveActions: z.boolean(),
|
|
57
|
+
allowOpenWorld: z.boolean().optional(),
|
|
58
|
+
destructiveApprovalMode: destructiveApprovalModeSchema.catch(void 0),
|
|
59
|
+
mcpServerNames: z.array(z.string())
|
|
60
|
+
}).strict();
|
|
61
|
+
const pluginAppPolicyContextSchema = z.object({
|
|
62
|
+
fingerprint: z.string(),
|
|
63
|
+
apps: z.record(z.string(), z.union([accountAppPolicyEntrySchema, pluginAppPolicyEntrySchema])),
|
|
64
|
+
pluginAppIds: z.record(z.string(), z.array(z.string())).default({})
|
|
65
|
+
}).strict();
|
|
66
|
+
const legacyAppPolicyEntrySchema = z.union([accountAppPolicyEntrySchema.extend({ destructiveApprovalMode: destructiveApprovalModeSchema }).strip(), pluginAppPolicyEntrySchema.extend({ destructiveApprovalMode: destructiveApprovalModeSchema }).strip()]);
|
|
67
|
+
const threadBindingSchema = z.object({
|
|
68
|
+
threadId: z.string().refine((value) => Boolean(value.trim())),
|
|
69
|
+
clientId: optionalStringSchema,
|
|
70
|
+
cwd: z.string(),
|
|
71
|
+
rolloutPath: optionalNonBlankStringSchema,
|
|
72
|
+
connectionScope: z.literal("supervision").optional(),
|
|
73
|
+
supervisionSourceThreadId: z.string().trim().min(1).optional(),
|
|
74
|
+
authProfileId: optionalStringSchema,
|
|
75
|
+
agentWorkspaceDeveloperInstructions: optionalStringSchema,
|
|
76
|
+
model: optionalStringSchema,
|
|
77
|
+
preserveNativeModel: z.literal(true).optional().catch(void 0),
|
|
78
|
+
pendingSupervisionBranch: pendingSupervisionBranchSchema.optional(),
|
|
79
|
+
pendingResumeConfiguration: z.literal(true).optional(),
|
|
80
|
+
modelProvider: z.string().transform((value) => value.trim()).pipe(z.string().min(1)).optional().catch(void 0),
|
|
81
|
+
approvalPolicy: z.preprocess((value) => value === "on-failure" ? "on-request" : value, z.enum([
|
|
82
|
+
"never",
|
|
83
|
+
"on-request",
|
|
84
|
+
"untrusted"
|
|
85
|
+
]).optional()).catch(void 0),
|
|
86
|
+
sandbox: z.enum([
|
|
87
|
+
"read-only",
|
|
88
|
+
"workspace-write",
|
|
89
|
+
"danger-full-access"
|
|
90
|
+
]).optional().catch(void 0),
|
|
91
|
+
serviceTier: z.preprocess(normalizeCodexServiceTier, z.custom((value) => typeof value === "string").optional()).optional().catch(void 0),
|
|
92
|
+
networkProxyProfileName: optionalStringSchema,
|
|
93
|
+
networkProxyConfigFingerprint: optionalStringSchema,
|
|
94
|
+
dynamicToolsFingerprint: optionalStringSchema,
|
|
95
|
+
dynamicToolsContainDeferred: optionalBooleanSchema,
|
|
96
|
+
webSearchThreadConfigFingerprint: optionalStringSchema,
|
|
97
|
+
nativeSkillIsolationFingerprint: optionalStringSchema,
|
|
98
|
+
userMcpServersFingerprint: optionalStringSchema,
|
|
99
|
+
mcpServersFingerprint: optionalStringSchema,
|
|
100
|
+
configuredMcpOwnershipVersion: z.literal(1).optional().catch(void 0),
|
|
101
|
+
ringZeroConfigFingerprint: optionalStringSchema,
|
|
102
|
+
ringZeroClientInstanceId: optionalStringSchema,
|
|
103
|
+
/** Durable fact preventing a later unrestricted turn from widening this thread. */
|
|
104
|
+
nativeToolPolicyRestricted: z.literal(true).optional().catch(void 0),
|
|
105
|
+
nativeHookRelayGeneration: optionalNonBlankStringSchema,
|
|
106
|
+
appServerRuntimeFingerprint: optionalStringSchema,
|
|
107
|
+
pluginAppsFingerprint: optionalStringSchema,
|
|
108
|
+
pluginAppsInputFingerprint: optionalStringSchema,
|
|
109
|
+
pluginAppPolicyContext: pluginAppPolicyContextSchema.optional().catch(void 0),
|
|
110
|
+
contextEngine: contextEngineSchema.optional().catch(void 0),
|
|
111
|
+
environmentSelectionFingerprint: optionalStringSchema,
|
|
112
|
+
conversationStartId: optionalStringSchema,
|
|
113
|
+
conversationSourceTransferComplete: z.literal(true).optional().catch(void 0),
|
|
114
|
+
historyCoveredThrough: optionalTimestampSchema,
|
|
115
|
+
continuityCalibration: z.object({
|
|
116
|
+
promptChars: z.number().int().positive(),
|
|
117
|
+
inputTokens: z.number().int().positive()
|
|
118
|
+
}).optional().catch(void 0)
|
|
119
|
+
}).superRefine((binding, context) => {
|
|
120
|
+
if (binding.connectionScope === "supervision") {
|
|
121
|
+
if (!binding.supervisionSourceThreadId) context.addIssue({
|
|
122
|
+
code: "custom",
|
|
123
|
+
message: "supervision connection ownership requires its native source thread id"
|
|
124
|
+
});
|
|
125
|
+
if (binding.preserveNativeModel !== true) context.addIssue({
|
|
126
|
+
code: "custom",
|
|
127
|
+
message: "supervision connection ownership requires native model ownership"
|
|
128
|
+
});
|
|
129
|
+
if (binding.conversationSourceTransferComplete !== true) context.addIssue({
|
|
130
|
+
code: "custom",
|
|
131
|
+
message: "supervision connection ownership requires a completed source transfer"
|
|
132
|
+
});
|
|
133
|
+
if (!binding.pendingSupervisionBranch && (!binding.model?.trim() || !binding.modelProvider)) context.addIssue({
|
|
134
|
+
code: "custom",
|
|
135
|
+
message: "materialized supervision bindings require a native model and provider"
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
if (binding.supervisionSourceThreadId && binding.connectionScope !== "supervision") context.addIssue({
|
|
139
|
+
code: "custom",
|
|
140
|
+
message: "a supervision source thread id requires supervision connection ownership"
|
|
141
|
+
});
|
|
142
|
+
if (!binding.pendingSupervisionBranch) return;
|
|
143
|
+
if (binding.threadId !== binding.pendingSupervisionBranch.sourceThreadId) context.addIssue({
|
|
144
|
+
code: "custom",
|
|
145
|
+
message: "pending supervision source must match the provisional thread binding"
|
|
146
|
+
});
|
|
147
|
+
if (binding.supervisionSourceThreadId !== binding.pendingSupervisionBranch.sourceThreadId) context.addIssue({
|
|
148
|
+
code: "custom",
|
|
149
|
+
message: "pending supervision source must match its durable source identity"
|
|
150
|
+
});
|
|
151
|
+
if (binding.preserveNativeModel !== true) context.addIssue({
|
|
152
|
+
code: "custom",
|
|
153
|
+
message: "pending supervision bindings must defer model selection to Codex App Server"
|
|
154
|
+
});
|
|
155
|
+
if (binding.connectionScope !== "supervision") context.addIssue({
|
|
156
|
+
code: "custom",
|
|
157
|
+
message: "pending supervision bindings require supervision connection ownership"
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
function matchesPendingSupervisionBranch(binding, expected) {
|
|
161
|
+
const pending = binding?.pendingSupervisionBranch;
|
|
162
|
+
const cleanup = pending?.cleanupThreadIds ?? [];
|
|
163
|
+
const expectedCleanup = expected.cleanupThreadIds ?? [];
|
|
164
|
+
return binding?.threadId === expected.sourceThreadId && pending?.sourceThreadId === expected.sourceThreadId && pending.connectionFingerprint === expected.connectionFingerprint && pending.lastTurnId === expected.lastTurnId && cleanup.length === expectedCleanup.length && cleanup.every((threadId, index) => threadId === expectedCleanup[index]);
|
|
165
|
+
}
|
|
166
|
+
const bindingLeaseSchema = z.object({
|
|
167
|
+
token: z.string().refine((value) => Boolean(value.trim())),
|
|
168
|
+
expiresAt: z.number().finite()
|
|
169
|
+
});
|
|
170
|
+
const storedSessionIdSchema = z.string().transform((value) => value.trim()).pipe(z.string().min(1)).optional().catch(void 0);
|
|
171
|
+
const storedBindingSchema = z.discriminatedUnion("state", [z.object({
|
|
172
|
+
version: z.literal(1),
|
|
173
|
+
state: z.literal("active"),
|
|
174
|
+
binding: threadBindingSchema,
|
|
175
|
+
sessionId: storedSessionIdSchema,
|
|
176
|
+
lease: bindingLeaseSchema.optional().catch(void 0),
|
|
177
|
+
nativeSubagentSubmissions: z.unknown().optional(),
|
|
178
|
+
nativeSubagentAssignments: z.unknown().optional(),
|
|
179
|
+
nativeSubagentTaskImport: z.unknown().optional()
|
|
180
|
+
}), z.object({
|
|
181
|
+
version: z.literal(1),
|
|
182
|
+
state: z.literal("cleared"),
|
|
183
|
+
sessionId: storedSessionIdSchema,
|
|
184
|
+
lease: bindingLeaseSchema.optional().catch(void 0),
|
|
185
|
+
retired: z.literal(true).optional().catch(void 0),
|
|
186
|
+
nativeSubagentTaskImport: z.unknown().optional()
|
|
187
|
+
})]);
|
|
188
|
+
function readStoredCodexAppServerBinding(value) {
|
|
189
|
+
const result = storedBindingSchema.safeParse(value);
|
|
190
|
+
if (!result.success) return;
|
|
191
|
+
return stripUndefinedValue(result.data);
|
|
192
|
+
}
|
|
193
|
+
function validateBindingForWrite(binding) {
|
|
194
|
+
const validated = readCodexAppServerThreadBinding(binding);
|
|
195
|
+
if (!validated) throw new Error("Invalid Codex app-server thread binding");
|
|
196
|
+
return stripUndefinedBinding(validated);
|
|
197
|
+
}
|
|
198
|
+
/** Parses stored or shipped sidecar data into the current domain value. */
|
|
199
|
+
function readCodexAppServerThreadBinding(value) {
|
|
200
|
+
const result = threadBindingSchema.safeParse(value);
|
|
201
|
+
if (!result.success) return;
|
|
202
|
+
return result.data;
|
|
203
|
+
}
|
|
204
|
+
function stripUndefinedBinding(binding) {
|
|
205
|
+
return stripUndefinedValue(binding);
|
|
206
|
+
}
|
|
207
|
+
function stripUndefinedValue(value) {
|
|
208
|
+
if (Array.isArray(value)) return value.map(stripUndefinedValue);
|
|
209
|
+
if (!value || typeof value !== "object") return value;
|
|
210
|
+
return Object.fromEntries(Object.entries(value).filter(([, entry]) => entry !== void 0).map(([key, entry]) => [key, stripUndefinedValue(entry)]));
|
|
211
|
+
}
|
|
212
|
+
function readCodexBindingTimestamp(value) {
|
|
213
|
+
return optionalTimestampSchema.parse(value);
|
|
214
|
+
}
|
|
215
|
+
//#endregion
|
|
216
|
+
export { readStoredCodexAppServerBinding as a, readCodexBindingTimestamp as i, matchesPendingSupervisionBranch as n, stripUndefinedBinding as o, readCodexAppServerThreadBinding as r, validateBindingForWrite as s, legacyAppPolicyEntrySchema as t };
|
package/dist/.setup/{session-binding-sidecars-jo6H8dFr.mjs → session-binding-sidecars-BrdV95Fg.mjs}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as CODEX_APP_SERVER_BINDING_NAMESPACE, r as CODEX_APP_SERVER_BINDING_MAX_ENTRIES } from "./session-binding-meta-Lkm5Lpf4.mjs";
|
|
2
2
|
import "node:module";
|
|
3
3
|
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
import { isDeepStrictEqual } from "node:util";
|
|
@@ -137,6 +137,12 @@ function createLegacyWebhookListenerDoctorContract(params) {
|
|
|
137
137
|
};
|
|
138
138
|
const prefix = `channels.${params.channelKey}`;
|
|
139
139
|
return {
|
|
140
|
+
historicalWebhookListener: {
|
|
141
|
+
channelId: params.channelKey,
|
|
142
|
+
port: params.defaultPort,
|
|
143
|
+
preserveAuthoredActivation: params.preserveAuthoredActivation,
|
|
144
|
+
...params.defaultHost === void 0 ? {} : { host: params.defaultHost }
|
|
145
|
+
},
|
|
140
146
|
legacyConfigRules: [{
|
|
141
147
|
path: ["channels", params.channelKey],
|
|
142
148
|
message: `${prefix} webhook listeners moved to Gateway routes. Run "openclaw doctor --fix" to preserve explicitly configured listener settings as legacyWebhook.`,
|
|
@@ -478,7 +484,7 @@ async function migrateSource(source, candidates, params, store) {
|
|
|
478
484
|
return await withFileLock(source.sidecarPath, LEGACY_BINDING_LOCK_OPTIONS, async () => {
|
|
479
485
|
const [contents, stat] = await Promise.all([fs.readFile(source.sidecarPath, "utf8"), fs.stat(source.sidecarPath)]);
|
|
480
486
|
const raw = JSON.parse(contents);
|
|
481
|
-
const [{ bindingStoreKey, createStoredCodexAppServerBinding, normalizeStoredCodexAppServerBindingFingerprints, readStoredCodexAppServerBinding }, { legacyCodexConversationBindingId }] = await Promise.all([import("./session-binding-
|
|
487
|
+
const [{ bindingStoreKey, createStoredCodexAppServerBinding, normalizeStoredCodexAppServerBindingFingerprints, readStoredCodexAppServerBinding }, { legacyCodexConversationBindingId }] = await Promise.all([import("./session-binding-Ce7BqiPN.mjs").then((n) => n.i), import("./conversation-binding-data-DJ4ix-W5.mjs").then((n) => n.t)]);
|
|
482
488
|
const agentId = owner?.agentId ?? (source.agentIds.size === 1 ? [...source.agentIds][0] : void 0);
|
|
483
489
|
const baseStored = createStoredCodexAppServerBinding(raw, {
|
|
484
490
|
now: stat.mtime.toISOString(),
|
package/dist/.setup/{session-catalog-adoption-BU_pHWG7.mjs → session-catalog-adoption-CPIP4S_y.mjs}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { T as requireBoundThread, d as boundedCatalogString, o as CatalogParamsError } from "./session-catalog-parsing-
|
|
2
|
-
import {
|
|
1
|
+
import { T as requireBoundThread, d as boundedCatalogString, o as CatalogParamsError } from "./session-catalog-parsing-B-qWJh2x.mjs";
|
|
2
|
+
import { m as sessionBindingIdentity } from "./session-binding-record-BZB8RgcF.mjs";
|
|
3
3
|
import { n as codexUpstreamBaseline, t as codexLastTerminalTurnId } from "./session-upstream-marker-D15C9NHp.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import { adoptionSessionKeyRest, catalogSessionActions } from "./session-catalog-node-adoption-
|
|
4
|
+
import { n as reclaimCurrentCodexSessionGeneration } from "./session-binding-Ce7BqiPN.mjs";
|
|
5
|
+
import { adoptionSessionKeyRest, catalogSessionActions } from "./session-catalog-node-adoption-7-WEQTB1.mjs";
|
|
6
6
|
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
7
|
import { listSessionCatalogEntries, sessionCatalogAdoptedSessionKey, sessionCatalogAdoptedSourceKey } from "openclaw/plugin-sdk/session-catalog";
|
|
8
8
|
//#region extensions/codex/src/session-catalog-adoption.ts
|
|
@@ -21,6 +21,7 @@ function adoptionSessionKey(threadId, sourceHomeId) {
|
|
|
21
21
|
function isAdoptionSessionKeyForThread(sessionKey, threadId, sourceHomeId) {
|
|
22
22
|
return adoptionSessionKeyRest(sessionKey) === adoptionSessionKey(threadId, sourceHomeId);
|
|
23
23
|
}
|
|
24
|
+
const adoptionCandidatesByRevision = /* @__PURE__ */ new WeakMap();
|
|
24
25
|
function readCodexSupervisionMarker(entry) {
|
|
25
26
|
const codex = isRecord(entry.pluginExtensions?.codex) ? entry.pluginExtensions.codex : void 0;
|
|
26
27
|
const marker = codex && isRecord(codex.supervision) ? codex.supervision : void 0;
|
|
@@ -33,12 +34,6 @@ function readCodexSupervisionMarker(entry) {
|
|
|
33
34
|
};
|
|
34
35
|
}
|
|
35
36
|
async function listAdoptedSessionEntries(params) {
|
|
36
|
-
const entries = listSessionCatalogEntries({
|
|
37
|
-
...params.agentId ? { agentId: params.agentId } : {},
|
|
38
|
-
config: params.config ?? {},
|
|
39
|
-
runtime: params.runtime,
|
|
40
|
-
sessionEntries: params.sessionEntries
|
|
41
|
-
});
|
|
42
37
|
const candidateForEntry = ({ agentId, entry, sessionKey }) => {
|
|
43
38
|
const sessionKeyRest = adoptionSessionKeyRest(sessionKey);
|
|
44
39
|
const marker = readCodexSupervisionMarker(entry);
|
|
@@ -59,15 +54,27 @@ async function listAdoptedSessionEntries(params) {
|
|
|
59
54
|
};
|
|
60
55
|
};
|
|
61
56
|
function* candidates() {
|
|
62
|
-
for (const entry of
|
|
57
|
+
for (const entry of listSessionCatalogEntries({
|
|
58
|
+
...params.agentId ? { agentId: params.agentId } : {},
|
|
59
|
+
config: params.config ?? {},
|
|
60
|
+
runtime: params.runtime,
|
|
61
|
+
sessionEntries: params.sessionEntries
|
|
62
|
+
})) {
|
|
63
63
|
const candidate = candidateForEntry(entry);
|
|
64
64
|
if (candidate) yield candidate;
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
const collect = (selected, readBinding =
|
|
67
|
+
const collect = async (selected, readBinding = async (identity) => {
|
|
68
|
+
const bindings = params.bindingStore.readMany([identity]);
|
|
69
|
+
try {
|
|
70
|
+
return (await bindings.next()).value;
|
|
71
|
+
} finally {
|
|
72
|
+
await bindings.return(void 0);
|
|
73
|
+
}
|
|
74
|
+
}) => {
|
|
68
75
|
const adopted = /* @__PURE__ */ new Map();
|
|
69
76
|
for (const { agentId, sessionKey, sessionKeyRest, sessionId, marker, identity } of selected) {
|
|
70
|
-
const binding = readBinding(identity);
|
|
77
|
+
const binding = await readBinding(identity);
|
|
71
78
|
const sourceThreadId = binding?.supervisionSourceThreadId?.trim();
|
|
72
79
|
const boundThreadId = binding?.threadId.trim();
|
|
73
80
|
if (binding?.connectionScope !== "supervision" || !sourceThreadId || !boundThreadId || sessionKeyRest !== adoptionSessionKey(sourceThreadId, marker.sourceHomeId)) continue;
|
|
@@ -82,18 +89,27 @@ async function listAdoptedSessionEntries(params) {
|
|
|
82
89
|
}
|
|
83
90
|
return adopted;
|
|
84
91
|
};
|
|
85
|
-
|
|
92
|
+
const revision = params.sessionEntries?.revision;
|
|
93
|
+
const cached = revision ? adoptionCandidatesByRevision.get(revision) : void 0;
|
|
86
94
|
let prepared;
|
|
87
95
|
try {
|
|
88
|
-
prepared =
|
|
96
|
+
if (cached && cached.config === params.config && cached.agentId === params.agentId) prepared = cached.candidates;
|
|
97
|
+
else {
|
|
98
|
+
prepared = [...candidates()];
|
|
99
|
+
if (revision) adoptionCandidatesByRevision.set(revision, {
|
|
100
|
+
config: params.config,
|
|
101
|
+
agentId: params.agentId,
|
|
102
|
+
candidates: prepared
|
|
103
|
+
});
|
|
104
|
+
}
|
|
89
105
|
} catch {
|
|
90
106
|
return collect(candidates());
|
|
91
107
|
}
|
|
92
108
|
const bindings = params.bindingStore.readMany(prepared.map(({ identity }) => identity));
|
|
93
109
|
try {
|
|
94
|
-
return collect(prepared, () => bindings.next().value);
|
|
110
|
+
return await collect(prepared, async () => (await bindings.next()).value);
|
|
95
111
|
} finally {
|
|
96
|
-
bindings.return(void 0);
|
|
112
|
+
await bindings.return(void 0);
|
|
97
113
|
}
|
|
98
114
|
}
|
|
99
115
|
async function findAdoptedSessionEntry(params) {
|
|
@@ -152,7 +168,7 @@ async function createOrReuseAdoptedSession(params) {
|
|
|
152
168
|
sourceThreadId: params.sourceThread.id,
|
|
153
169
|
...params.sourceHomeId ? { sourceHomeId: params.sourceHomeId } : {}
|
|
154
170
|
};
|
|
155
|
-
const { createImportedCodexSession } = await import("./session-history-import-
|
|
171
|
+
const { createImportedCodexSession } = await import("./session-history-import-NWKPa4ZO.mjs");
|
|
156
172
|
const created = await createImportedCodexSession({
|
|
157
173
|
runtime: params.api.runtime,
|
|
158
174
|
bindingStore: params.bindingStore,
|
package/dist/.setup/{session-catalog-archive-spHfihri.mjs → session-catalog-archive-DcgwvSbF.mjs}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { o as CatalogParamsError } from "./session-catalog-parsing-
|
|
2
|
-
import {
|
|
1
|
+
import { o as CatalogParamsError } from "./session-catalog-parsing-B-qWJh2x.mjs";
|
|
2
|
+
import { m as sessionBindingIdentity } from "./session-binding-record-BZB8RgcF.mjs";
|
|
3
3
|
import { t as assertCodexArchiveDescendantsUnowned } from "./thread-archive-guard-C9frICzX.mjs";
|
|
4
|
-
import "./session-binding-
|
|
5
|
-
import { catalogSessionActions } from "./session-catalog-node-adoption-
|
|
6
|
-
import { isAdoptionSessionKeyForThread, requireIdleThread } from "./session-catalog-adoption-
|
|
4
|
+
import "./session-binding-Ce7BqiPN.mjs";
|
|
5
|
+
import { catalogSessionActions } from "./session-catalog-node-adoption-7-WEQTB1.mjs";
|
|
6
|
+
import { isAdoptionSessionKeyForThread, requireIdleThread } from "./session-catalog-adoption-CPIP4S_y.mjs";
|
|
7
7
|
import { listAgentIds } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
8
8
|
import { sessionCatalogAdoptedSourceKey } from "openclaw/plugin-sdk/session-catalog";
|
|
9
9
|
//#region extensions/codex/src/session-catalog-archive.ts
|
|
@@ -26,31 +26,26 @@ function assertNoPendingSupervisionBranch(params) {
|
|
|
26
26
|
}
|
|
27
27
|
/** Archives one inactive Gateway-local Codex thread after a fresh status read. */
|
|
28
28
|
async function archiveLocalCodexSession(params) {
|
|
29
|
-
return await catalogSessionActions.enqueue(sessionCatalogAdoptedSourceKey(params.hostId ?? "gateway:local", params.threadId), async () => {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
requireIdleThread(descendant, "archive");
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
await control.archiveThread(params.threadId);
|
|
49
|
-
return { archived: true };
|
|
50
|
-
};
|
|
51
|
-
return await params.control.withPinnedConnection(run);
|
|
29
|
+
return await catalogSessionActions.enqueue(sessionCatalogAdoptedSourceKey(params.hostId ?? "gateway:local", params.threadId), () => params.bindingStore.withThreadArchiveFence(() => params.control.withPinnedConnection(async (control) => {
|
|
30
|
+
assertNoPendingSupervisionBranch(params);
|
|
31
|
+
await control.requireEligibleThread(params.threadId);
|
|
32
|
+
const thread = await control.readThread(params.threadId, false);
|
|
33
|
+
if (thread.id !== params.threadId) throw new Error("Codex app-server returned a different thread than requested");
|
|
34
|
+
requireIdleThread(thread, "archive");
|
|
35
|
+
if (await params.bindingStore.hasOtherThreadOwner(params.threadId)) throw new CatalogParamsError("Codex session cannot be archived while it is attached to an OpenClaw session");
|
|
36
|
+
await assertCodexArchiveDescendantsUnowned({
|
|
37
|
+
bindingStore: params.bindingStore,
|
|
38
|
+
threadId: params.threadId,
|
|
39
|
+
listPage: (request) => control.listDescendantPage(request),
|
|
40
|
+
assertDescendantIdle: async (descendantThreadId) => {
|
|
41
|
+
const descendant = await control.readThread(descendantThreadId, false);
|
|
42
|
+
if (descendant.id !== descendantThreadId) throw new Error("Codex app-server returned a different descendant than requested");
|
|
43
|
+
requireIdleThread(descendant, "archive");
|
|
44
|
+
}
|
|
52
45
|
});
|
|
53
|
-
|
|
46
|
+
await control.archiveThread(params.threadId);
|
|
47
|
+
return { archived: true };
|
|
48
|
+
})));
|
|
54
49
|
}
|
|
55
50
|
//#endregion
|
|
56
51
|
export { archiveLocalCodexSession };
|
package/dist/.setup/{session-catalog-events-DePDzzjc.mjs → session-catalog-events-KIXOoSnQ.mjs}
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { c as MAX_CWD_LENGTH, d as boundedCatalogString } from "./session-catalog-parsing-
|
|
2
|
-
import { n as defineCodexBuildState } from "./build-state-
|
|
3
|
-
import { r as inferCodexAppServerConnectionClass } from "./config-security-
|
|
1
|
+
import { c as MAX_CWD_LENGTH, d as boundedCatalogString } from "./session-catalog-parsing-B-qWJh2x.mjs";
|
|
2
|
+
import { n as defineCodexBuildState } from "./build-state-CIi3Ckqu.mjs";
|
|
3
|
+
import { r as inferCodexAppServerConnectionClass } from "./config-security-KAPScztc.mjs";
|
|
4
4
|
import { n as resolveCodexAppServerLocalHomeDir } from "./auth-start-options-BPIPeEX8.mjs";
|
|
5
5
|
import { n as codexCatalogHomeIdFromCanonicalPath } from "./session-catalog-home-id-vlih0B_g.mjs";
|
|
6
|
-
import { t as buildCodexAppServerConnectionFingerprint } from "./plugin-app-cache-key-
|
|
7
|
-
import { d as observeCodexCatalogEphemeralThreads, r as projectCodexCatalogNativeThread, s as codexCatalogSourceForClient } from "./session-catalog-native-projection-
|
|
6
|
+
import { t as buildCodexAppServerConnectionFingerprint } from "./plugin-app-cache-key-BW8rd98k.mjs";
|
|
7
|
+
import { d as observeCodexCatalogEphemeralThreads, r as projectCodexCatalogNativeThread, s as codexCatalogSourceForClient } from "./session-catalog-native-projection-CTBd4EUm.mjs";
|
|
8
8
|
import { createHash } from "node:crypto";
|
|
9
9
|
import { embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-registration";
|
|
10
10
|
import path from "node:path";
|