@openclaw/codex 2026.9.6 → 2026.9.7
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 +2 -0
- package/assets/icon.png +0 -0
- package/dist/.setup/{account-usage-runtime-Eem_WGqY.mjs → account-usage-runtime-DFhbh1zz.mjs} +5 -5
- package/dist/.setup/{apply-DDOi8uNx.mjs → apply-D3GcSoSa.mjs} +22 -36
- package/dist/.setup/{attempt-client-cleanup-CEv1cKwF.mjs → attempt-client-cleanup-DOP-cW5j.mjs} +128 -37
- package/dist/.setup/attempt-workspace-context-C5HigshI.mjs +164 -0
- package/dist/.setup/{auth-binding-DhLWa_7K.mjs → auth-binding-BLWz7stm.mjs} +14 -1
- package/dist/.setup/{auth-cache-key-B2mpaI9D.mjs → auth-cache-key-Dbvq-QgB.mjs} +36 -34
- package/dist/.setup/{auth-profile-WqZtZfXN.mjs → auth-profile-B0okYl2D.mjs} +1 -2
- package/dist/.setup/auth-start-options-BPIPeEX8.mjs +44 -0
- package/dist/.setup/{binding-connection-ThoatDcb.mjs → binding-connection-DTtN1KrX.mjs} +2 -2
- package/dist/.setup/{binding-connection.runtime-yoHrABt-.mjs → binding-connection.runtime-6TpgD1M6.mjs} +4 -4
- package/dist/.setup/{bounded-turn-B2HScEgT.mjs → bounded-turn-CbjoN2OW.mjs} +15 -18
- package/dist/.setup/bounded-turn-isolation-B8K_ylqk.mjs +14 -0
- package/dist/.setup/{build-state-C7EnDVgr.mjs → build-state-Da1_z0kd.mjs} +1 -1
- package/dist/.setup/{capabilities-CDXOOFdZ.mjs → capabilities-B3WEZl4e.mjs} +2 -10
- package/dist/.setup/{client-Cs08OXVQ.mjs → client-N0JpgSzF.mjs} +138 -399
- package/dist/.setup/{client-catalog-response-BMgt_4q4.mjs → client-catalog-response-5HHLdcde.mjs} +1 -1
- package/dist/.setup/{command-dispatch-B4JuOsOk.mjs → command-dispatch-BeAoaovI.mjs} +5 -8
- package/dist/.setup/{command-formatters-Bmqvr9tO.mjs → command-formatters-R3ckE3Co.mjs} +29 -61
- package/dist/.setup/{command-handlers-DW7Lx9oH.mjs → command-handlers-ylTMS00z.mjs} +222 -343
- package/dist/.setup/{command-rpc-DixIj3HW.mjs → command-rpc-CGJGUQ6Y.mjs} +15 -18
- package/dist/.setup/compact-C2WamavS.mjs +776 -0
- package/dist/.setup/{config-BoTP_mrL.mjs → config-DKhXquav.mjs} +26 -28
- package/dist/.setup/{config-options-BvaRs51b.mjs → config-options-CzyWLTJt.mjs} +24 -37
- package/dist/.setup/{config-parsing-CcB9iPoq.mjs → config-parsing-b088LyhT.mjs} +57 -60
- package/dist/.setup/{config-runtime-C8Rw1m1m.mjs → config-runtime-C0NbLms1.mjs} +2 -2
- package/dist/.setup/{config-security-BEReZ6go.mjs → config-security-CE-FcGw9.mjs} +32 -111
- package/dist/.setup/{config-utils-DujwEnhg.mjs → config-utils-D0CXecki.mjs} +3 -13
- package/dist/.setup/context-engine-projection-PezSESth.mjs +387 -0
- package/dist/.setup/{conversation-binding-DP-gMrBP.mjs → conversation-binding-3Min8qvP.mjs} +67 -90
- package/dist/.setup/{conversation-binding-data-CrcyZk6O.mjs → conversation-binding-data-C746z5Pn.mjs} +8 -12
- package/dist/.setup/{conversation-control-uK9Jomlc.mjs → conversation-control-CEP8X5JC.mjs} +8 -8
- package/dist/.setup/{cyber-failover-DYwbmf1o.mjs → cyber-failover-XV0nNRZu.mjs} +1 -1
- package/dist/.setup/{cyber-failover-notice-e9G3J9-e.mjs → cyber-failover-notice-RNpGpTyP.mjs} +1 -1
- package/dist/.setup/{dynamic-tools-BDXl-8Cw.mjs → dynamic-tools-DzlsLUuS.mjs} +2305 -2606
- package/dist/.setup/{effective-mcp-catalog-CvnvnGIe.mjs → effective-mcp-catalog-CxUtC-xG.mjs} +8 -17
- package/dist/.setup/{ephemeral-turn-poidXgek.mjs → ephemeral-turn-CDsPJOa2.mjs} +3 -3
- package/dist/.setup/event-projector-assistant-message-CigreO4K.mjs +69 -0
- package/dist/.setup/{event-projector-usage-CnBS8Wa3.mjs → event-projector-usage-03R0I2dM.mjs} +3 -25
- package/dist/.setup/event-projector-values-DJSz8BTk.mjs +106 -0
- package/dist/.setup/incognito-session-DWYapfwf.mjs +2 -0
- package/dist/.setup/{inference-context-D96l9-ew.mjs → inference-context-D-9gWlTR.mjs} +16 -18
- package/dist/.setup/inference-dispatch-CMZtjQyz.mjs +359 -0
- package/dist/.setup/inference-metadata-CgIf7sOx.mjs +81 -0
- package/dist/.setup/{inference-proxy-b-aJMSxm.mjs → inference-proxy-DhcXOgUE.mjs} +174 -214
- package/dist/.setup/{isolated-completion-BIZFhTNG.mjs → isolated-completion-Dm3PzxJk.mjs} +9 -12
- package/dist/.setup/{managed-binary-BnshlFag.mjs → managed-binary-kiWRhNRE.mjs} +8 -12
- package/dist/.setup/{model-catalog-CfXJf9Ay.mjs → model-catalog-PAuZgJC6.mjs} +11 -10
- package/dist/.setup/model-runtime-BdqzOMkU.mjs +11 -0
- package/dist/.setup/{models-KnqBv0hE.mjs → models-DHXZtVVk.mjs} +9 -18
- package/dist/.setup/{native-auth-rWbGbMn3.mjs → native-auth-CuG53tu4.mjs} +4 -4
- package/dist/.setup/{native-execution-policy-umd0tgh4.mjs → native-execution-policy-BxZJy5mP.mjs} +5 -30
- package/dist/.setup/{native-subagent-monitor-D3filLY2.mjs → native-subagent-monitor-Dpsmf2wz.mjs} +4395 -3609
- package/dist/.setup/native-subagent-pending-assignments-DwkCzLvD.mjs +203 -0
- package/dist/.setup/native-task-assignments-DMQ0g3hu.mjs +194 -0
- package/dist/.setup/{node-cli-sessions-r3avj02l.mjs → node-cli-sessions-HC4W6FLI.mjs} +19 -49
- package/dist/.setup/{node-exec-server.runtime-BDwWXVpK.mjs → node-exec-server.runtime-BgBfWQqo.mjs} +3 -6
- package/dist/.setup/{plan-CN3VwfNU.mjs → plan-Y-QIvrKB.mjs} +49 -92
- package/dist/.setup/{plugin-activation-DT3MNtqj.mjs → plugin-activation-cNHRfaxU.mjs} +8 -36
- package/dist/.setup/{plugin-app-cache-key-B2CsSdnV.mjs → plugin-app-cache-key-BL9B5H0L.mjs} +6 -23
- package/dist/.setup/{plugin-inventory-BoRei8Z4.mjs → plugin-inventory-Cky2XJUw.mjs} +21 -21
- package/dist/.setup/{plugin-marketplace-discovery-CDOi8IFs.mjs → plugin-marketplace-discovery-D_dV9FXa.mjs} +18 -24
- package/dist/.setup/{plugin-metadata-cache-Ctmo83k_.mjs → plugin-metadata-cache-DsjsL1dr.mjs} +115 -175
- package/dist/.setup/{provider-BOsxQHOM.mjs → provider-DH8NSzGt.mjs} +11 -14
- package/dist/.setup/{provider-capabilities-BfE88FZ5.mjs → provider-capabilities-CAxoF-X1.mjs} +13 -18
- package/dist/.setup/{rate-limits-CMU3DUD0.mjs → rate-limits-B7-X2TgG.mjs} +9 -31
- package/dist/.setup/{request-D2L0zMrq.mjs → request-BHZ1nz8d.mjs} +7 -6
- package/dist/.setup/responses-oauth-twnuTaAa.mjs +93 -0
- package/dist/.setup/rpc-error-BlD2vuzn.mjs +31 -0
- package/dist/.setup/{run-attempt-BHu11r7h.mjs → run-attempt-D8RZUOzY.mjs} +1035 -1023
- package/dist/.setup/{run-attempt-lifecycle-B7JbY4-F.mjs → run-attempt-lifecycle-C-6O3Exn.mjs} +10 -24
- package/dist/.setup/{runtime-artifact-CLZ8udh-.mjs → runtime-artifact-DDQ-HGXf.mjs} +16 -4
- package/dist/.setup/runtime-artifact-connection-D68qQn1m.mjs +78 -0
- package/dist/.setup/sandbox-guard-DjCz2eOw.mjs +126 -0
- package/dist/.setup/scope-DOC1Xjc8.mjs +6 -0
- package/dist/.setup/session-binding-DGCYAfvD.mjs +443 -0
- package/dist/.setup/{session-binding-record-BGoz8wOK.mjs → session-binding-record-Oe9L-CNY.mjs} +52 -130
- package/dist/.setup/{session-binding-sidecars-BlB5EvIS.mjs → session-binding-sidecars-jo6H8dFr.mjs} +196 -17
- package/dist/.setup/{session-catalog-Pno1xGcl.mjs → session-catalog-4sCdv5qx.mjs} +170 -324
- package/dist/.setup/{session-catalog-adoption-BI6UTDZT.mjs → session-catalog-adoption-BU_pHWG7.mjs} +7 -6
- package/dist/.setup/{session-catalog-archive-lHBqzhaO.mjs → session-catalog-archive-spHfihri.mjs} +6 -6
- package/dist/.setup/session-catalog-events-DePDzzjc.mjs +139 -0
- package/dist/.setup/session-catalog-home-id-vlih0B_g.mjs +22 -0
- package/dist/.setup/{session-catalog-index-B9_VQIUz.mjs → session-catalog-index-CZvDzC6z.mjs} +126 -122
- package/dist/.setup/{session-catalog-index-order-hcdz07yN.mjs → session-catalog-index-order-BcQpHks3.mjs} +1 -1
- package/dist/.setup/{session-catalog-index-state-Dgh8ORJm.mjs → session-catalog-index-state-TeO7EyO-.mjs} +3 -2
- package/dist/.setup/session-catalog-limits-DDxOsQeC.mjs +14 -0
- package/dist/.setup/session-catalog-list-request-CvtxrYSe.mjs +170 -0
- package/dist/.setup/session-catalog-native-projection-DjhwGL6x.mjs +178 -0
- package/dist/.setup/{session-catalog-node-adoption-ITddWx_X.mjs → session-catalog-node-adoption-DgXvSGu0.mjs} +10 -27
- package/dist/.setup/{session-catalog-node-continue-6g6qi4A9.mjs → session-catalog-node-continue-DjKXHBbi.mjs} +8 -10
- package/dist/.setup/session-catalog-node-lookup-CtAXI5W5.mjs +56 -0
- package/dist/.setup/{session-catalog-native-projection-DowriLid.mjs → session-catalog-parsing-CPGaPYr-.mjs} +11 -194
- package/dist/.setup/{session-catalog-projection-zK_PUsiE.mjs → session-catalog-projection-Cr5qP5Dj.mjs} +6 -4
- package/dist/.setup/session-catalog-provenance-DoAvktcj.mjs +95 -0
- package/dist/.setup/{session-cli-irrD-uo7.mjs → session-cli-Cn_nCqfq.mjs} +9 -22
- package/dist/.setup/{session-history-BrqhSCf9.mjs → session-history-D83lJWHG.mjs} +4 -6
- package/dist/.setup/{session-history-import-D-3wAgOP.mjs → session-history-import-WhX-X33a.mjs} +7 -10
- package/dist/.setup/session-history-read-Ov3StuL4.mjs +133 -0
- package/dist/.setup/{session-history.worker-CaCh0xF_.mjs → session-history.worker-MnPKncqP.mjs} +9 -5
- package/dist/.setup/session-initialization-6aveB9qb.mjs +22 -0
- package/dist/.setup/{session-permission-policy-BI1QK_98.mjs → session-permission-policy-Ci_fVX6y.mjs} +4 -8
- package/dist/.setup/{session-retirement-BH-S6qkJ.mjs → session-retirement-qMTxkNx2.mjs} +17 -17
- package/dist/.setup/{settled-turn-context-fmwouT5I.mjs → settled-turn-context-D4yj4rxf.mjs} +1 -1
- package/dist/.setup/{settled-turn-finalizer-DiAi6Kx6.mjs → settled-turn-finalizer-BsvEabkw.mjs} +14 -10
- package/dist/.setup/{shared-client-DA4VR4Eb.mjs → shared-client-DqyTMYug.mjs} +783 -412
- package/dist/.setup/shared-client-lifecycle-DJIgqgMw.mjs +153 -0
- package/dist/.setup/{side-question-BJ1wSDcB.mjs → side-question-C4kCmQy1.mjs} +79 -143
- package/dist/.setup/{source-CUzJq5WN.mjs → source-CS_7GFJZ.mjs} +80 -137
- package/dist/.setup/{thread-lifecycle-B3mfz1TG.mjs → thread-lifecycle-DPflntEJ.mjs} +294 -737
- package/dist/.setup/{incognito-session-uhrBF6wJ.mjs → thread-ownership-queue-Dp24d7-F.mjs} +1 -2
- package/dist/.setup/{thread-ownership-DcTtAcXj.mjs → thread-ownership-roNP0l1c.mjs} +45 -10
- package/dist/.setup/{thread-policy-DGuQsuFC.mjs → thread-policy-DTd-DtkX.mjs} +46 -7
- package/dist/.setup/{thread-requests-BLvGkP2R.mjs → thread-requests-B_bRnMGN.mjs} +199 -302
- package/dist/.setup/{thread-resume-DIBXwOpE.mjs → thread-resume-CdDaoc7T.mjs} +6 -6
- package/dist/.setup/{timeout-C910MdAB.mjs → timeout-CXOfNoaX.mjs} +1 -35
- package/dist/.setup/{transcript-history-projection-ZZpkFkJ_.mjs → transcript-history-projection-DRSifI-1.mjs} +17 -89
- package/dist/.setup/{transcript-mirror-attestation-CzM-94NC.mjs → transcript-mirror-attestation-YSegaktH.mjs} +3 -4
- package/dist/.setup/{transcript-mirror-BtHDBp1G.mjs → transcript-mirror-kxmCYsuF.mjs} +7 -9
- package/dist/.setup/{transport-stdio-h2VHOskC.mjs → transport-stdio-Bdegpn2V.mjs} +5 -22
- package/dist/.setup/transport-websocket-BTBE-LD9.mjs +211 -0
- package/dist/.setup/{upstream-prompt-provenance-LphB8slG.mjs → upstream-prompt-provenance-fXkKbPVC.mjs} +3 -9
- package/dist/.setup/{upstream-session-fork-BUr4OUbC.mjs → upstream-session-fork-CBeVjBpT.mjs} +23 -23
- package/dist/.setup/{usage-BML0r-ua.mjs → usage-BMzNxeR_.mjs} +4 -4
- package/dist/.setup/{usage-limit-error-DUMbefVY.mjs → usage-limit-error-QXerDo3i.mjs} +4 -19
- package/dist/.setup/{web-search-provider.runtime-CDKlN-Rv.mjs → web-search-provider.runtime-P77OUeoo.mjs} +8 -19
- package/dist/api.js +9 -11
- package/dist/catalog-page.worker.js +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/doctor-contract-api.js +50 -8
- package/dist/harness.js +344 -1
- package/dist/index.js +193 -245
- package/dist/media-understanding-provider.js +9 -22
- package/dist/migration-provider-api.js +1 -1
- package/dist/provider-discovery.js +1 -1
- package/dist/session-history-worker-runtime.js +3 -3
- package/dist/session-history.worker.js +1 -1
- package/openclaw.plugin.json +14 -2
- package/package.json +7 -6
- package/dist/.setup/attempt-workspace-context-DUVEn_CS.mjs +0 -331
- package/dist/.setup/compact-Du5UvtxA.mjs +0 -680
- package/dist/.setup/event-projector-assistant-message-BsruvNrH.mjs +0 -103
- package/dist/.setup/event-projector-items-C6L_5ZiT.mjs +0 -234
- package/dist/.setup/harness-a_MsE4-_.mjs +0 -355
- package/dist/.setup/history-rejection-B4nOXNXF.mjs +0 -13
- package/dist/.setup/image-payload-sanitizer-tupAr-2o.mjs +0 -79
- package/dist/.setup/local-runtime-attribution-B_2mnqhb.mjs +0 -19
- package/dist/.setup/native-subagent-history-0nYYgo0k.mjs +0 -148
- package/dist/.setup/native-subagent-task-ids-wb8CKZGN.mjs +0 -441
- package/dist/.setup/plugin-approval-roundtrip-C0MZzCuP.mjs +0 -122
- package/dist/.setup/rolldown-runtime-8H4AJuhK.mjs +0 -14
- package/dist/.setup/sandbox-guard-C2sRMOEY.mjs +0 -166
- package/dist/.setup/session-binding-Cm0apEbd.mjs +0 -692
- package/dist/.setup/session-catalog-events-Bj6j94E_.mjs +0 -347
- package/dist/.setup/session-history-read-B3ZfSUbF.mjs +0 -50
- package/dist/.setup/session-initialization-rcgbZiid.mjs +0 -75
- package/dist/.setup/thread-history-page-DoVpnHim.mjs +0 -83
package/dist/.setup/{session-binding-record-BGoz8wOK.mjs → session-binding-record-Oe9L-CNY.mjs}
RENAMED
|
@@ -1,115 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as CODEX_PLUGIN_MARKETPLACE_NAME_PATTERN, r as normalizeCodexServiceTier } from "./config-utils-D0CXecki.mjs";
|
|
2
|
+
import { a as matchesCodexNativeSubagentSubmissionOwner, h as codexNativeSubagentHistoryConnectionFingerprint, r as readNativePendingAssignments, s as readCodexNativeSubagentSubmissions, t as matchesNativeAssignmentLifecycle } from "./native-subagent-pending-assignments-DwkCzLvD.mjs";
|
|
2
3
|
import { asOptionalRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
4
|
import { createHash } from "node:crypto";
|
|
4
5
|
import { isDeepStrictEqual } from "node:util";
|
|
5
6
|
import { AgentHarnessPreflightError } from "openclaw/plugin-sdk/agent-harness-registration";
|
|
6
7
|
import { resolveSessionAgentIdsStrict } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
7
8
|
import { z } from "zod";
|
|
8
|
-
//#region extensions/codex/src/app-server/native-subagent-history-owner.ts
|
|
9
|
-
const nonBlankString = z.string().refine((value) => Boolean(value.trim()));
|
|
10
|
-
const codexNativeSubagentHistoryOwnerSchema = z.object({
|
|
11
|
-
parentThreadId: nonBlankString,
|
|
12
|
-
sessionId: nonBlankString,
|
|
13
|
-
lifecycleRevision: nonBlankString.optional(),
|
|
14
|
-
connectionFingerprint: z.string().regex(/^[a-f0-9]{64}$/u)
|
|
15
|
-
});
|
|
16
|
-
/** Automatic recovery may follow native rotation only within the same host lifecycle and connection. */
|
|
17
|
-
function matchesCodexNativeSubagentHistoryOwner(stored, current) {
|
|
18
|
-
return stored.connectionFingerprint === current.connectionFingerprint && stored.lifecycleRevision === current.lifecycleRevision && (stored.lifecycleRevision !== void 0 || stored.sessionId === current.sessionId);
|
|
19
|
-
}
|
|
20
|
-
function codexNativeSubagentHistoryConnectionFingerprint(binding) {
|
|
21
|
-
if (!binding.appServerRuntimeFingerprint) return;
|
|
22
|
-
return createHash("sha256").update(JSON.stringify([
|
|
23
|
-
binding.appServerRuntimeFingerprint,
|
|
24
|
-
binding.connectionScope ?? null,
|
|
25
|
-
binding.authProfileId ?? null
|
|
26
|
-
])).digest("hex");
|
|
27
|
-
}
|
|
28
|
-
function createCodexNativeSubagentHistoryOwner(params) {
|
|
29
|
-
const connectionFingerprint = codexNativeSubagentHistoryConnectionFingerprint(params.binding);
|
|
30
|
-
return connectionFingerprint ? {
|
|
31
|
-
parentThreadId: params.parentThreadId,
|
|
32
|
-
sessionId: params.sessionId,
|
|
33
|
-
...params.lifecycleRevision ? { lifecycleRevision: params.lifecycleRevision } : {},
|
|
34
|
-
connectionFingerprint
|
|
35
|
-
} : void 0;
|
|
36
|
-
}
|
|
37
|
-
function readCodexNativeSubagentHistoryOwner(detail) {
|
|
38
|
-
const value = asOptionalRecord(detail)?.nativeHistory;
|
|
39
|
-
if (value === void 0) return;
|
|
40
|
-
const owner = codexNativeSubagentHistoryOwnerSchema.safeParse(value);
|
|
41
|
-
if (!owner.success) throw new Error("Subagent history owner is invalid.");
|
|
42
|
-
const { lifecycleRevision, ...required } = owner.data;
|
|
43
|
-
return lifecycleRevision === void 0 ? required : {
|
|
44
|
-
...required,
|
|
45
|
-
lifecycleRevision
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
function assertHistoryOwnerMatchesRegistration(saved, current, parentThreadId, requireSaved = false) {
|
|
49
|
-
if (requireSaved && !saved) throw new Error("Subagent completion history owner is missing.");
|
|
50
|
-
if (saved && (!current || saved.parentThreadId !== parentThreadId || saved.connectionFingerprint !== current.connectionFingerprint || saved.sessionId !== current.sessionId || saved.lifecycleRevision !== current.lifecycleRevision)) throw new Error("Subagent completion history owner is contradictory.");
|
|
51
|
-
}
|
|
52
|
-
//#endregion
|
|
53
|
-
//#region extensions/codex/src/app-server/native-subagent-submission.ts
|
|
54
|
-
const identifier = z.string().refine((value) => Boolean(value.trim()));
|
|
55
|
-
const submissionSchema = z.object({
|
|
56
|
-
parentTurnId: identifier,
|
|
57
|
-
callId: identifier,
|
|
58
|
-
childThreadId: identifier,
|
|
59
|
-
submissionId: identifier,
|
|
60
|
-
predecessorRunId: identifier,
|
|
61
|
-
predecessorNativeTurnId: identifier
|
|
62
|
-
}).strict();
|
|
63
|
-
const submissionsSchema = z.object({
|
|
64
|
-
version: z.literal(1),
|
|
65
|
-
owner: codexNativeSubagentHistoryOwnerSchema,
|
|
66
|
-
receipts: z.array(submissionSchema)
|
|
67
|
-
}).strict().refine(({ receipts }) => new Set(receipts.map(({ parentTurnId, callId }) => JSON.stringify([parentTurnId, callId]))).size === receipts.length);
|
|
68
|
-
function matchesCodexNativeSubagentSubmissionOwner(stored, current) {
|
|
69
|
-
return stored.parentThreadId === current.parentThreadId && matchesCodexNativeSubagentHistoryOwner(stored, current);
|
|
70
|
-
}
|
|
71
|
-
function readCodexNativeSubagentSubmissions(value) {
|
|
72
|
-
if (value === void 0) return;
|
|
73
|
-
const parsed = submissionsSchema.safeParse(value);
|
|
74
|
-
if (!parsed.success) throw new Error("Invalid Codex native subagent submission metadata.");
|
|
75
|
-
return parsed.data;
|
|
76
|
-
}
|
|
77
|
-
function mutateCodexNativeSubagentSubmissions(params) {
|
|
78
|
-
const current = readCodexNativeSubagentSubmissions(params.current);
|
|
79
|
-
const owner = codexNativeSubagentHistoryOwnerSchema.parse(params.owner);
|
|
80
|
-
const receipt = submissionSchema.parse(params.receipt);
|
|
81
|
-
if (current && !matchesCodexNativeSubagentSubmissionOwner(current.owner, owner)) return { applied: false };
|
|
82
|
-
const receipts = current?.receipts ?? [];
|
|
83
|
-
const existing = receipts.find((entry) => entry.parentTurnId === receipt.parentTurnId && entry.callId === receipt.callId);
|
|
84
|
-
if (existing && !isDeepStrictEqual(existing, receipt)) return { applied: false };
|
|
85
|
-
if (params.consume) {
|
|
86
|
-
if (!current) return { applied: false };
|
|
87
|
-
const remaining = receipts.filter((entry) => entry !== existing);
|
|
88
|
-
return {
|
|
89
|
-
applied: true,
|
|
90
|
-
...remaining.length ? { next: {
|
|
91
|
-
version: 1,
|
|
92
|
-
owner: current.owner,
|
|
93
|
-
receipts: remaining
|
|
94
|
-
} } : {}
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
return {
|
|
98
|
-
applied: true,
|
|
99
|
-
next: {
|
|
100
|
-
version: 1,
|
|
101
|
-
owner: current?.owner ?? owner,
|
|
102
|
-
receipts: existing ? receipts : [...receipts, receipt]
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
/** Physical adoption cannot establish continuity for an unstamped receipt. */
|
|
107
|
-
function adoptCodexNativeSubagentSubmissions(value) {
|
|
108
|
-
if (value === void 0) return;
|
|
109
|
-
const parsed = submissionsSchema.safeParse(value);
|
|
110
|
-
return !parsed.success || parsed.data.owner.lifecycleRevision ? value : void 0;
|
|
111
|
-
}
|
|
112
|
-
//#endregion
|
|
113
9
|
//#region extensions/codex/src/app-server/session-binding-record.ts
|
|
114
10
|
/** Canonical binding codec and synchronous generation-aware reads; no lifecycle or auth loading. */
|
|
115
11
|
/** Resolves the same agent scope OpenClaw uses for transcript/session ownership. */
|
|
@@ -184,6 +80,7 @@ const pluginAppPolicyContextSchema = z.object({
|
|
|
184
80
|
apps: z.record(z.string(), z.union([accountAppPolicyEntrySchema, pluginAppPolicyEntrySchema])),
|
|
185
81
|
pluginAppIds: z.record(z.string(), z.array(z.string())).default({})
|
|
186
82
|
}).strict();
|
|
83
|
+
const legacyAppPolicyEntrySchema = z.union([accountAppPolicyEntrySchema.strip(), pluginAppPolicyEntrySchema.strip()]);
|
|
187
84
|
const threadBindingSchema = z.object({
|
|
188
85
|
threadId: z.string().refine((value) => Boolean(value.trim())),
|
|
189
86
|
clientId: optionalStringSchema,
|
|
@@ -277,6 +174,12 @@ const threadBindingSchema = z.object({
|
|
|
277
174
|
message: "pending supervision bindings require supervision connection ownership"
|
|
278
175
|
});
|
|
279
176
|
});
|
|
177
|
+
function matchesPendingSupervisionBranch(binding, expected) {
|
|
178
|
+
const pending = binding?.pendingSupervisionBranch;
|
|
179
|
+
const cleanup = pending?.cleanupThreadIds ?? [];
|
|
180
|
+
const expectedCleanup = expected.cleanupThreadIds ?? [];
|
|
181
|
+
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]);
|
|
182
|
+
}
|
|
280
183
|
const bindingLeaseSchema = z.object({
|
|
281
184
|
token: z.string().refine((value) => Boolean(value.trim())),
|
|
282
185
|
expiresAt: z.number().finite()
|
|
@@ -288,13 +191,16 @@ const storedBindingSchema = z.discriminatedUnion("state", [z.object({
|
|
|
288
191
|
binding: threadBindingSchema,
|
|
289
192
|
sessionId: storedSessionIdSchema,
|
|
290
193
|
lease: bindingLeaseSchema.optional().catch(void 0),
|
|
291
|
-
nativeSubagentSubmissions: z.unknown().optional()
|
|
194
|
+
nativeSubagentSubmissions: z.unknown().optional(),
|
|
195
|
+
nativeSubagentAssignments: z.unknown().optional(),
|
|
196
|
+
nativeSubagentTaskImport: z.unknown().optional()
|
|
292
197
|
}), z.object({
|
|
293
198
|
version: z.literal(1),
|
|
294
199
|
state: z.literal("cleared"),
|
|
295
200
|
sessionId: storedSessionIdSchema,
|
|
296
201
|
lease: bindingLeaseSchema.optional().catch(void 0),
|
|
297
|
-
retired: z.literal(true).optional().catch(void 0)
|
|
202
|
+
retired: z.literal(true).optional().catch(void 0),
|
|
203
|
+
nativeSubagentTaskImport: z.unknown().optional()
|
|
298
204
|
})]);
|
|
299
205
|
/** Stable plugin-state key for one current binding owner. */
|
|
300
206
|
function bindingStoreKey(identity) {
|
|
@@ -385,6 +291,21 @@ function readCurrentCodexNativeSubagentSubmissions(state, identity, owner) {
|
|
|
385
291
|
const submissions = readCodexNativeSubagentSubmissions(stored.nativeSubagentSubmissions);
|
|
386
292
|
return submissions && matchesCodexNativeSubagentSubmissionOwner(submissions.owner, owner) ? submissions.receipts : [];
|
|
387
293
|
}
|
|
294
|
+
function readCurrentNativePendingAssignments(state, identity, owner) {
|
|
295
|
+
const key = bindingStoreKey(identity);
|
|
296
|
+
const raw = state.lookup(key);
|
|
297
|
+
const stored = readStoredCodexAppServerBinding(raw);
|
|
298
|
+
if (raw !== void 0 && !stored) throw new Error(`Invalid Codex app-server binding row: ${key}`);
|
|
299
|
+
if (stored?.state !== "active" || !ownsStoredSessionGeneration(identity, stored) || identity.kind === "session" && owner.sessionId !== identity.sessionId || !matchesCodexNativeSubagentSubmissionBinding(stored.binding, owner)) return [];
|
|
300
|
+
return (readNativePendingAssignments(stored.nativeSubagentAssignments)?.assignments ?? []).filter((entry) => matchesNativeAssignmentLifecycle(entry.owner, owner));
|
|
301
|
+
}
|
|
302
|
+
function preserveNativeTaskImport(current) {
|
|
303
|
+
return current?.nativeSubagentTaskImport !== void 0 ? { nativeSubagentTaskImport: current.nativeSubagentTaskImport } : {};
|
|
304
|
+
}
|
|
305
|
+
/** Preserve inventory through native rotation, never across a connection-policy change. */
|
|
306
|
+
function preserveNativePendingAssignments(current, next, value) {
|
|
307
|
+
return codexNativeSubagentHistoryConnectionFingerprint(current) === codexNativeSubagentHistoryConnectionFingerprint(next) && isDeepStrictEqual(current.pendingSupervisionBranch, next.pendingSupervisionBranch) ? value : void 0;
|
|
308
|
+
}
|
|
388
309
|
var CodexSupervisionBindingReplacementError = class extends Error {
|
|
389
310
|
constructor(threadId, operation) {
|
|
390
311
|
super(`Refusing to replace supervised Codex thread ${threadId} while ${operation}; its native user-home connection and model ownership must be preserved`);
|
|
@@ -405,28 +326,29 @@ function readPluginAppPolicyContext(value, bindingSchemaVersion) {
|
|
|
405
326
|
const entry = asOptionalRecord(rawEntry);
|
|
406
327
|
if (!entry) return;
|
|
407
328
|
const destructiveApprovalMode = readDestructiveApprovalMode(entry.destructiveApprovalMode, bindingSchemaVersion);
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
};
|
|
419
|
-
continue;
|
|
420
|
-
}
|
|
421
|
-
if ("appId" in entry || entry.source !== void 0 && entry.source !== "plugin" || typeof entry.configKey !== "string" || typeof entry.marketplaceName !== "string" || !CODEX_PLUGIN_MARKETPLACE_NAME_PATTERN.test(entry.marketplaceName) || typeof entry.pluginName !== "string" || typeof entry.allowDestructiveActions !== "boolean" || entry.allowOpenWorld !== void 0 && typeof entry.allowOpenWorld !== "boolean" || destructiveApprovalMode === "invalid" || !mcpServerNames) return;
|
|
422
|
-
parsedApps[appId] = {
|
|
423
|
-
configKey: entry.configKey,
|
|
424
|
-
marketplaceName: entry.marketplaceName,
|
|
425
|
-
pluginName: entry.pluginName,
|
|
426
|
-
allowDestructiveActions: entry.allowDestructiveActions,
|
|
427
|
-
...typeof entry.allowOpenWorld === "boolean" ? { allowOpenWorld: entry.allowOpenWorld } : {},
|
|
329
|
+
if ("appId" in entry || destructiveApprovalMode === "invalid") return;
|
|
330
|
+
const parsed = legacyAppPolicyEntrySchema.safeParse({
|
|
331
|
+
...entry,
|
|
332
|
+
destructiveApprovalMode
|
|
333
|
+
});
|
|
334
|
+
if (!parsed.success) return;
|
|
335
|
+
const validated = parsed.data;
|
|
336
|
+
const policy = {
|
|
337
|
+
allowDestructiveActions: validated.allowDestructiveActions,
|
|
338
|
+
...validated.allowOpenWorld !== void 0 ? { allowOpenWorld: validated.allowOpenWorld } : {},
|
|
428
339
|
...destructiveApprovalMode ? { destructiveApprovalMode } : {},
|
|
429
|
-
mcpServerNames
|
|
340
|
+
mcpServerNames: validated.mcpServerNames
|
|
341
|
+
};
|
|
342
|
+
if (validated.source === "account") parsedApps[appId] = {
|
|
343
|
+
source: "account",
|
|
344
|
+
appName: validated.appName,
|
|
345
|
+
...policy
|
|
346
|
+
};
|
|
347
|
+
else parsedApps[appId] = {
|
|
348
|
+
configKey: validated.configKey,
|
|
349
|
+
marketplaceName: validated.marketplaceName,
|
|
350
|
+
pluginName: validated.pluginName,
|
|
351
|
+
...policy
|
|
430
352
|
};
|
|
431
353
|
}
|
|
432
354
|
const parsedPluginAppIds = {};
|
|
@@ -450,4 +372,4 @@ function readDestructiveApprovalMode(value, bindingSchemaVersion) {
|
|
|
450
372
|
return "invalid";
|
|
451
373
|
}
|
|
452
374
|
//#endregion
|
|
453
|
-
export {
|
|
375
|
+
export { readStoredCodexAppServerBinding as _, matchesPendingSupervisionBranch as a, validateBindingForWrite as b, preserveNativePendingAssignments as c, readCodexBindingTimestamp as d, readCurrentCodexAppServerBinding as f, readPluginAppPolicyContext as g, readCurrentNativePendingAssignments as h, matchesCodexNativeSubagentSubmissionBinding as i, preserveNativeTaskImport as l, readCurrentCodexNativeSubagentSubmissions as m, assertCodexBindingMayBeReplaced as n, ownsStoredSessionGeneration as o, readCurrentCodexAppServerBindings as p, bindingStoreKey as r, preserveCodexNativeSubagentSubmissions as s, CodexSupervisionBindingReplacementError as t, readCodexAppServerThreadBinding as u, sessionBindingIdentity as v, stripUndefinedBinding as y };
|
package/dist/.setup/{session-binding-sidecars-BlB5EvIS.mjs → session-binding-sidecars-jo6H8dFr.mjs}
RENAMED
|
@@ -1,16 +1,199 @@
|
|
|
1
1
|
import { n as CODEX_APP_SERVER_BINDING_NAMESPACE, t as CODEX_APP_SERVER_BINDING_MAX_ENTRIES } from "./session-binding-meta-B7aEMU7g.mjs";
|
|
2
|
+
import "node:module";
|
|
2
3
|
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
4
|
import { isDeepStrictEqual } from "node:util";
|
|
4
5
|
import { listAgentIds, resolveAgentDir, resolveSessionAgentIdsStrict } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
5
6
|
import path from "node:path";
|
|
6
7
|
import fs from "node:fs/promises";
|
|
7
|
-
import { canonicalPathFromExistingAncestor, isPathInside } from "openclaw/plugin-sdk/file-access-runtime";
|
|
8
8
|
import { extractErrorCode } from "openclaw/plugin-sdk/error-runtime";
|
|
9
|
+
import { canonicalPathFromExistingAncestor, isPathInside } from "openclaw/plugin-sdk/file-access-runtime";
|
|
9
10
|
import { normalizeAgentId } from "openclaw/plugin-sdk/routing";
|
|
10
11
|
import { pathExists } from "openclaw/plugin-sdk/security-runtime";
|
|
11
12
|
import { withFileLock } from "openclaw/plugin-sdk/file-lock";
|
|
12
|
-
import { archiveLegacyStateSource, legacyStateFileExists } from "openclaw/plugin-sdk/runtime-doctor-migrations";
|
|
13
13
|
import { resolveStorePath } from "openclaw/plugin-sdk/session-store-paths";
|
|
14
|
+
//#region \0rolldown/runtime.js
|
|
15
|
+
var __defProp = Object.defineProperty;
|
|
16
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
17
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
18
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
19
|
+
var __exportAll = (all, no_symbols) => {
|
|
20
|
+
let target = {};
|
|
21
|
+
for (var name in all) __defProp(target, name, {
|
|
22
|
+
get: all[name],
|
|
23
|
+
enumerable: true
|
|
24
|
+
});
|
|
25
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
26
|
+
return target;
|
|
27
|
+
};
|
|
28
|
+
var __copyProps = (to, from, except, desc) => {
|
|
29
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
30
|
+
key = keys[i];
|
|
31
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
32
|
+
get: ((k) => from[k]).bind(null, key),
|
|
33
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return to;
|
|
37
|
+
};
|
|
38
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region packages/normalization-core/src/record-coerce.ts
|
|
41
|
+
/** Type guard for non-array object records at browser-safe boundaries. */
|
|
42
|
+
function isRecord$1(value) {
|
|
43
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
44
|
+
}
|
|
45
|
+
/** Returns a non-array record or null. */
|
|
46
|
+
function asNullableRecord$1(value) {
|
|
47
|
+
return isRecord$1(value) ? value : null;
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region src/config/channel-config-normalization.ts
|
|
51
|
+
/** Applies one channel-specific doctor migration to every object-shaped account. */
|
|
52
|
+
function normalizeChannelAccounts(params) {
|
|
53
|
+
const rawAccounts = asNullableRecord$1(params.entry.accounts);
|
|
54
|
+
if (!rawAccounts) return {
|
|
55
|
+
entry: params.entry,
|
|
56
|
+
changed: false
|
|
57
|
+
};
|
|
58
|
+
let changed = false;
|
|
59
|
+
const accounts = { ...rawAccounts };
|
|
60
|
+
for (const [accountId, value] of Object.entries(rawAccounts)) {
|
|
61
|
+
const account = asNullableRecord$1(value);
|
|
62
|
+
if (!account) continue;
|
|
63
|
+
const normalized = params.normalizeAccount({
|
|
64
|
+
account,
|
|
65
|
+
accountId,
|
|
66
|
+
pathPrefix: `${params.pathPrefix}.accounts.${accountId}`,
|
|
67
|
+
changes: params.changes
|
|
68
|
+
});
|
|
69
|
+
if (normalized.changed) {
|
|
70
|
+
accounts[accountId] = normalized.entry;
|
|
71
|
+
changed = true;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return changed ? {
|
|
75
|
+
entry: {
|
|
76
|
+
...params.entry,
|
|
77
|
+
accounts
|
|
78
|
+
},
|
|
79
|
+
changed: true
|
|
80
|
+
} : {
|
|
81
|
+
entry: params.entry,
|
|
82
|
+
changed: false
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
/** Applies the same channel-specific doctor migration at root and account scope. */
|
|
86
|
+
function normalizeChannelConfigEntries(params) {
|
|
87
|
+
const changes = params.changes ?? [];
|
|
88
|
+
const channels = params.cfg.channels;
|
|
89
|
+
const entry = asNullableRecord$1(channels?.[params.channelId]);
|
|
90
|
+
if (!entry) return {
|
|
91
|
+
config: params.cfg,
|
|
92
|
+
changes
|
|
93
|
+
};
|
|
94
|
+
const channelPath = `channels.${params.channelId}`;
|
|
95
|
+
const root = params.normalizeEntry({
|
|
96
|
+
entry,
|
|
97
|
+
pathPrefix: channelPath,
|
|
98
|
+
changes
|
|
99
|
+
});
|
|
100
|
+
const accounts = normalizeChannelAccounts({
|
|
101
|
+
entry: root.entry,
|
|
102
|
+
pathPrefix: channelPath,
|
|
103
|
+
changes,
|
|
104
|
+
normalizeAccount: (accountParams) => params.normalizeEntry({
|
|
105
|
+
entry: accountParams.account,
|
|
106
|
+
accountId: accountParams.accountId,
|
|
107
|
+
pathPrefix: accountParams.pathPrefix,
|
|
108
|
+
changes: accountParams.changes
|
|
109
|
+
})
|
|
110
|
+
});
|
|
111
|
+
if (!root.changed && !accounts.changed) return {
|
|
112
|
+
config: params.cfg,
|
|
113
|
+
changes
|
|
114
|
+
};
|
|
115
|
+
return {
|
|
116
|
+
config: {
|
|
117
|
+
...params.cfg,
|
|
118
|
+
channels: {
|
|
119
|
+
...channels,
|
|
120
|
+
[params.channelId]: accounts.entry
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
changes
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
//#endregion
|
|
127
|
+
//#region src/plugin-sdk/legacy-webhook-listener-migration.ts
|
|
128
|
+
/** Preserve explicitly configured webhook listeners while moving ingress onto Gateway routes. */
|
|
129
|
+
function createLegacyWebhookListenerDoctorContract(params) {
|
|
130
|
+
const portKey = params.portKey ?? "webhookPort";
|
|
131
|
+
const hostKey = params.hostKey === void 0 ? "webhookHost" : params.hostKey;
|
|
132
|
+
const source = (entry) => params.webhookKey ? asNullableRecord$1(entry[params.webhookKey]) : entry;
|
|
133
|
+
const hasLegacy = (value) => {
|
|
134
|
+
const entry = asNullableRecord$1(value);
|
|
135
|
+
const listener = entry && source(entry);
|
|
136
|
+
return Boolean(listener && (Object.hasOwn(listener, portKey) || hostKey && Object.hasOwn(listener, hostKey)));
|
|
137
|
+
};
|
|
138
|
+
const prefix = `channels.${params.channelKey}`;
|
|
139
|
+
return {
|
|
140
|
+
legacyConfigRules: [{
|
|
141
|
+
path: ["channels", params.channelKey],
|
|
142
|
+
message: `${prefix} webhook listeners moved to Gateway routes. Run "openclaw doctor --fix" to preserve explicitly configured listener settings as legacyWebhook.`,
|
|
143
|
+
match: (value) => {
|
|
144
|
+
const accounts = asNullableRecord$1(asNullableRecord$1(value)?.accounts);
|
|
145
|
+
return hasLegacy(value) || Object.values(accounts ?? {}).some(hasLegacy);
|
|
146
|
+
}
|
|
147
|
+
}],
|
|
148
|
+
normalizeCompatibilityConfig: ({ cfg }) => {
|
|
149
|
+
const root = asNullableRecord$1(asNullableRecord$1(cfg.channels)?.[params.channelKey]);
|
|
150
|
+
const inherited = root && source(root);
|
|
151
|
+
const canonicalRoot = asNullableRecord$1(root?.legacyWebhook);
|
|
152
|
+
return normalizeChannelConfigEntries({
|
|
153
|
+
cfg,
|
|
154
|
+
channelId: params.channelKey,
|
|
155
|
+
normalizeEntry: ({ entry, accountId, pathPrefix, changes }) => {
|
|
156
|
+
const listener = source(entry);
|
|
157
|
+
if (!listener || !hasLegacy(entry)) return {
|
|
158
|
+
entry,
|
|
159
|
+
changed: false
|
|
160
|
+
};
|
|
161
|
+
const next = { ...entry };
|
|
162
|
+
const port = Object.hasOwn(listener, portKey) ? listener[portKey] : (accountId ? canonicalRoot?.port ?? inherited?.[portKey] : void 0) ?? params.defaultPort;
|
|
163
|
+
const inheritedHost = accountId ? canonicalRoot ? canonicalRoot.host : (hostKey ? inherited?.[hostKey] : void 0) ?? params.defaultHost : params.defaultHost;
|
|
164
|
+
const host = hostKey ? listener[hostKey] ?? inheritedHost : inheritedHost;
|
|
165
|
+
const legacyPath = [pathPrefix, params.webhookKey].filter(Boolean).join(".");
|
|
166
|
+
if (Object.hasOwn(entry, "legacyWebhook")) changes.push(`Removed ${legacyPath} legacy listener keys; ${pathPrefix}.legacyWebhook is already configured.`);
|
|
167
|
+
else if (accountId && root?.legacyWebhook === false) changes.push(`Removed ${legacyPath} legacy listener keys; ${prefix}.legacyWebhook: false keeps this account's inherited listener disabled.`);
|
|
168
|
+
else {
|
|
169
|
+
next.legacyWebhook = {
|
|
170
|
+
port,
|
|
171
|
+
...host !== void 0 ? { host } : {}
|
|
172
|
+
};
|
|
173
|
+
changes.push(`Moved ${legacyPath} listener settings to ${pathPrefix}.legacyWebhook. Point the external callback or reverse proxy at the Gateway port and webhook path, verify delivery, then set legacyWebhook: false to disable legacy forwarding.`);
|
|
174
|
+
}
|
|
175
|
+
const updated = params.webhookKey ? { ...listener } : next;
|
|
176
|
+
delete updated[portKey];
|
|
177
|
+
if (hostKey) delete updated[hostKey];
|
|
178
|
+
if (params.webhookKey) {
|
|
179
|
+
if (Object.keys(updated).length) next[params.webhookKey] = updated;
|
|
180
|
+
else delete next[params.webhookKey];
|
|
181
|
+
}
|
|
182
|
+
return {
|
|
183
|
+
entry: next,
|
|
184
|
+
changed: true
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
//#endregion
|
|
192
|
+
//#region \0openclaw:bundled-sdk:openclaw/plugin-sdk/runtime-doctor-migrations
|
|
193
|
+
var runtime_doctor_migrations_exports = /* @__PURE__ */ __exportAll({ createLegacyWebhookListenerDoctorContract: () => createLegacyWebhookListenerDoctorContract });
|
|
194
|
+
import * as import_openclaw_plugin_sdk_runtime_doctor_migrations from "openclaw/plugin-sdk/runtime-doctor-migrations";
|
|
195
|
+
__reExport(runtime_doctor_migrations_exports, import_openclaw_plugin_sdk_runtime_doctor_migrations);
|
|
196
|
+
//#endregion
|
|
14
197
|
//#region extensions/codex/src/migration/session-binding-legacy-index.ts
|
|
15
198
|
async function readLegacySessionIndex(storePath) {
|
|
16
199
|
let contents;
|
|
@@ -154,7 +337,7 @@ async function* iterateIndexedSidecars(surface) {
|
|
|
154
337
|
continue;
|
|
155
338
|
}
|
|
156
339
|
const sidecarPath = `${transcriptPath}${LEGACY_BINDING_SUFFIX}`;
|
|
157
|
-
if (await legacyStateFileExists(sidecarPath)) yield sidecarPath;
|
|
340
|
+
if (await (0, runtime_doctor_migrations_exports.legacyStateFileExists)(sidecarPath)) yield sidecarPath;
|
|
158
341
|
}
|
|
159
342
|
}
|
|
160
343
|
}
|
|
@@ -285,22 +468,17 @@ function copyBindingForSession(stored, sessionId) {
|
|
|
285
468
|
}
|
|
286
469
|
async function migrateSource(source, candidates, params, store) {
|
|
287
470
|
let importedKeys = 0;
|
|
288
|
-
const retain = (reason) => ({
|
|
289
|
-
archived: false,
|
|
290
|
-
importedKeys,
|
|
291
|
-
warning: `Left Codex binding sidecar in place because ${reason}: ${source.sidecarPath}`
|
|
292
|
-
});
|
|
293
|
-
const retainNotice = (reason) => ({
|
|
471
|
+
const retain = (reason, level = "warning") => ({
|
|
294
472
|
archived: false,
|
|
295
473
|
importedKeys,
|
|
296
|
-
|
|
474
|
+
[level]: `Left Codex binding sidecar in place because ${reason}: ${source.sidecarPath}`
|
|
297
475
|
});
|
|
298
476
|
const owner = candidates.length === 1 ? candidates[0] : void 0;
|
|
299
477
|
try {
|
|
300
478
|
return await withFileLock(source.sidecarPath, LEGACY_BINDING_LOCK_OPTIONS, async () => {
|
|
301
479
|
const [contents, stat] = await Promise.all([fs.readFile(source.sidecarPath, "utf8"), fs.stat(source.sidecarPath)]);
|
|
302
480
|
const raw = JSON.parse(contents);
|
|
303
|
-
const [{ bindingStoreKey, createStoredCodexAppServerBinding, normalizeStoredCodexAppServerBindingFingerprints, readStoredCodexAppServerBinding }, { legacyCodexConversationBindingId }] = await Promise.all([import("./session-binding-
|
|
481
|
+
const [{ bindingStoreKey, createStoredCodexAppServerBinding, normalizeStoredCodexAppServerBindingFingerprints, readStoredCodexAppServerBinding }, { legacyCodexConversationBindingId }] = await Promise.all([import("./session-binding-DGCYAfvD.mjs").then((n) => n.s), import("./conversation-binding-data-C746z5Pn.mjs").then((n) => n.t)]);
|
|
304
482
|
const agentId = owner?.agentId ?? (source.agentIds.size === 1 ? [...source.agentIds][0] : void 0);
|
|
305
483
|
const baseStored = createStoredCodexAppServerBinding(raw, {
|
|
306
484
|
now: stat.mtime.toISOString(),
|
|
@@ -311,15 +489,16 @@ async function migrateSource(source, candidates, params, store) {
|
|
|
311
489
|
});
|
|
312
490
|
if (!baseStored) return retain("its binding is invalid");
|
|
313
491
|
if (candidates.length > 1) return retain(`${candidates.length} matching session owners make ownership ambiguous`);
|
|
314
|
-
if (owner?.agentHarnessId && owner.agentHarnessId !== CODEX_AGENT_HARNESS_ID) return
|
|
492
|
+
if (owner?.agentHarnessId && owner.agentHarnessId !== CODEX_AGENT_HARNESS_ID) return retain(`its session is owned by agent harness ${owner.agentHarnessId}`, "notice");
|
|
315
493
|
const readEvidence = params.context.readSessionIdentityEvidenceBatch;
|
|
316
494
|
const canonicalOwner = owner && readEvidence ? (await readEvidence([{
|
|
317
495
|
agentId: owner.agentId,
|
|
318
496
|
sessionId: owner.sessionId
|
|
319
497
|
}]))[0] : void 0;
|
|
320
498
|
const canCreateOwner = !readEvidence || canonicalOwner?.state === "unknown";
|
|
321
|
-
const
|
|
322
|
-
const
|
|
499
|
+
const storedSessionFile = typeof raw.sessionFile === "string" && raw.sessionFile.trim() ? raw.sessionFile : void 0;
|
|
500
|
+
const sourceSessionFile = storedSessionFile ?? source.transcriptPath;
|
|
501
|
+
const ownerSessionFile = storedSessionFile ?? owner?.transcriptPath;
|
|
323
502
|
const conversationKeys = [sourceSessionFile, ...ownerSessionFile && ownerSessionFile !== sourceSessionFile ? [ownerSessionFile] : []].map((sessionFile) => bindingStoreKey({
|
|
324
503
|
kind: "conversation",
|
|
325
504
|
bindingId: legacyCodexConversationBindingId(sessionFile)
|
|
@@ -406,11 +585,11 @@ async function migrateSource(source, candidates, params, store) {
|
|
|
406
585
|
});
|
|
407
586
|
if (hasExpected(await store.lookup(sessionEntry.key), sessionEntry.value)) return retain(`${ownershipWarning}; its stale session binding could not be retired`);
|
|
408
587
|
}
|
|
409
|
-
if (typeof ownershipResult === "string") return
|
|
588
|
+
if (typeof ownershipResult === "string") return retain(ownershipWarning, "notice");
|
|
410
589
|
} else for (const entry of entries) if (!hasExpected(await store.lookup(entry.key), entry.value)) return retain(`canonical plugin state changed at ${entry.key}`);
|
|
411
590
|
}
|
|
412
591
|
const archiveWarnings = [];
|
|
413
|
-
await archiveLegacyStateSource({
|
|
592
|
+
await (0, runtime_doctor_migrations_exports.archiveLegacyStateSource)({
|
|
414
593
|
filePath: source.sidecarPath,
|
|
415
594
|
label: "Codex app-server binding",
|
|
416
595
|
changes: [],
|
|
@@ -543,4 +722,4 @@ async function migrateLegacySessionBindingSidecars(params) {
|
|
|
543
722
|
};
|
|
544
723
|
}
|
|
545
724
|
//#endregion
|
|
546
|
-
export { detectLegacySessionBindingSidecars, migrateLegacySessionBindingSidecars };
|
|
725
|
+
export { detectLegacySessionBindingSidecars, migrateLegacySessionBindingSidecars, __exportAll as t };
|