@openclaw/codex 2026.9.6 → 2026.9.8

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.
Files changed (158) hide show
  1. package/README.md +2 -0
  2. package/assets/icon.png +0 -0
  3. package/dist/.setup/{account-usage-runtime-Eem_WGqY.mjs → account-usage-runtime-G348lY1q.mjs} +5 -5
  4. package/dist/.setup/{apply-DDOi8uNx.mjs → apply-Cqb-YoCS.mjs} +22 -36
  5. package/dist/.setup/{attempt-client-cleanup-CEv1cKwF.mjs → attempt-client-cleanup-B-S7ngS_.mjs} +128 -37
  6. package/dist/.setup/attempt-workspace-context-BJ5Z_olH.mjs +164 -0
  7. package/dist/.setup/{auth-binding-DhLWa_7K.mjs → auth-binding-BLWz7stm.mjs} +14 -1
  8. package/dist/.setup/{auth-cache-key-B2mpaI9D.mjs → auth-cache-key-Dnps4W4_.mjs} +36 -34
  9. package/dist/.setup/{auth-profile-WqZtZfXN.mjs → auth-profile-B0okYl2D.mjs} +1 -2
  10. package/dist/.setup/auth-start-options-BPIPeEX8.mjs +44 -0
  11. package/dist/.setup/{binding-connection-ThoatDcb.mjs → binding-connection-DTtN1KrX.mjs} +2 -2
  12. package/dist/.setup/{binding-connection.runtime-yoHrABt-.mjs → binding-connection.runtime-6TpgD1M6.mjs} +4 -4
  13. package/dist/.setup/{bounded-turn-B2HScEgT.mjs → bounded-turn-BNunZPtz.mjs} +15 -18
  14. package/dist/.setup/bounded-turn-isolation-B8K_ylqk.mjs +14 -0
  15. package/dist/.setup/{build-state-C7EnDVgr.mjs → build-state-DIQ5O_-S.mjs} +1 -1
  16. package/dist/.setup/{capabilities-CDXOOFdZ.mjs → capabilities-B3WEZl4e.mjs} +2 -10
  17. package/dist/.setup/{client-catalog-response-BMgt_4q4.mjs → client-catalog-response-DRvx_wCC.mjs} +1 -1
  18. package/dist/.setup/{client-Cs08OXVQ.mjs → client-qyUBJlGZ.mjs} +138 -399
  19. package/dist/.setup/{command-dispatch-B4JuOsOk.mjs → command-dispatch-Btrs1D6f.mjs} +5 -8
  20. package/dist/.setup/{command-formatters-Bmqvr9tO.mjs → command-formatters-R3ckE3Co.mjs} +29 -61
  21. package/dist/.setup/{command-handlers-DW7Lx9oH.mjs → command-handlers-DvlCHJch.mjs} +222 -343
  22. package/dist/.setup/{command-rpc-DixIj3HW.mjs → command-rpc-skzRq4wD.mjs} +15 -18
  23. package/dist/.setup/compact-8ttks5U5.mjs +776 -0
  24. package/dist/.setup/{config-BoTP_mrL.mjs → config-DKhXquav.mjs} +26 -28
  25. package/dist/.setup/{config-options-BvaRs51b.mjs → config-options-CzyWLTJt.mjs} +24 -37
  26. package/dist/.setup/{config-parsing-CcB9iPoq.mjs → config-parsing-b088LyhT.mjs} +57 -60
  27. package/dist/.setup/{config-runtime-C8Rw1m1m.mjs → config-runtime-C0NbLms1.mjs} +2 -2
  28. package/dist/.setup/{config-security-BEReZ6go.mjs → config-security-CE-FcGw9.mjs} +32 -111
  29. package/dist/.setup/{config-utils-DujwEnhg.mjs → config-utils-D0CXecki.mjs} +3 -13
  30. package/dist/.setup/context-engine-projection-PezSESth.mjs +387 -0
  31. package/dist/.setup/{conversation-binding-DP-gMrBP.mjs → conversation-binding-74LaGGH-.mjs} +67 -90
  32. package/dist/.setup/{conversation-binding-data-CrcyZk6O.mjs → conversation-binding-data-C746z5Pn.mjs} +8 -12
  33. package/dist/.setup/{conversation-control-uK9Jomlc.mjs → conversation-control-OrN6zuaY.mjs} +8 -8
  34. package/dist/.setup/{cyber-failover-DYwbmf1o.mjs → cyber-failover-XV0nNRZu.mjs} +1 -1
  35. package/dist/.setup/{cyber-failover-notice-e9G3J9-e.mjs → cyber-failover-notice-RNpGpTyP.mjs} +1 -1
  36. package/dist/.setup/{dynamic-tools-BDXl-8Cw.mjs → dynamic-tools-Db2sY5cZ.mjs} +2305 -2606
  37. package/dist/.setup/{effective-mcp-catalog-CvnvnGIe.mjs → effective-mcp-catalog-Bi6-SQ7i.mjs} +8 -17
  38. package/dist/.setup/{ephemeral-turn-poidXgek.mjs → ephemeral-turn-DiCS1ijR.mjs} +3 -3
  39. package/dist/.setup/event-projector-assistant-message-MV_1dj-3.mjs +69 -0
  40. package/dist/.setup/{event-projector-usage-CnBS8Wa3.mjs → event-projector-usage-03R0I2dM.mjs} +3 -25
  41. package/dist/.setup/event-projector-values-DJSz8BTk.mjs +106 -0
  42. package/dist/.setup/incognito-session-DWYapfwf.mjs +2 -0
  43. package/dist/.setup/{inference-context-D96l9-ew.mjs → inference-context-D-9gWlTR.mjs} +16 -18
  44. package/dist/.setup/inference-dispatch-CMZtjQyz.mjs +359 -0
  45. package/dist/.setup/inference-metadata-CgIf7sOx.mjs +81 -0
  46. package/dist/.setup/{inference-proxy-b-aJMSxm.mjs → inference-proxy-DhcXOgUE.mjs} +174 -214
  47. package/dist/.setup/{isolated-completion-BIZFhTNG.mjs → isolated-completion-D80IXfQF.mjs} +9 -12
  48. package/dist/.setup/{managed-binary-BnshlFag.mjs → managed-binary-kiWRhNRE.mjs} +8 -12
  49. package/dist/.setup/{model-catalog-CfXJf9Ay.mjs → model-catalog-DiC0Tkha.mjs} +11 -10
  50. package/dist/.setup/model-runtime-BdqzOMkU.mjs +11 -0
  51. package/dist/.setup/{models-KnqBv0hE.mjs → models-DfLmPV0k.mjs} +9 -18
  52. package/dist/.setup/{native-auth-rWbGbMn3.mjs → native-auth-CuG53tu4.mjs} +4 -4
  53. package/dist/.setup/{native-execution-policy-umd0tgh4.mjs → native-execution-policy-BxZJy5mP.mjs} +5 -30
  54. package/dist/.setup/{native-subagent-monitor-D3filLY2.mjs → native-subagent-monitor-BwkQXf9e.mjs} +4395 -3609
  55. package/dist/.setup/native-subagent-pending-assignments-DwkCzLvD.mjs +203 -0
  56. package/dist/.setup/native-task-assignments-DMQ0g3hu.mjs +194 -0
  57. package/dist/.setup/{node-cli-sessions-r3avj02l.mjs → node-cli-sessions-HC4W6FLI.mjs} +19 -49
  58. package/dist/.setup/{node-exec-server.runtime-BDwWXVpK.mjs → node-exec-server.runtime-BgBfWQqo.mjs} +3 -6
  59. package/dist/.setup/{plan-CN3VwfNU.mjs → plan-DPdMk1Oy.mjs} +49 -92
  60. package/dist/.setup/{plugin-activation-DT3MNtqj.mjs → plugin-activation-cNHRfaxU.mjs} +8 -36
  61. package/dist/.setup/{plugin-app-cache-key-B2CsSdnV.mjs → plugin-app-cache-key-BL9B5H0L.mjs} +6 -23
  62. package/dist/.setup/{plugin-inventory-BoRei8Z4.mjs → plugin-inventory-Cky2XJUw.mjs} +21 -21
  63. package/dist/.setup/{plugin-marketplace-discovery-CDOi8IFs.mjs → plugin-marketplace-discovery-D_dV9FXa.mjs} +18 -24
  64. package/dist/.setup/{plugin-metadata-cache-Ctmo83k_.mjs → plugin-metadata-cache-BRwtRct9.mjs} +116 -176
  65. package/dist/.setup/{provider-BOsxQHOM.mjs → provider-D6F_7p1I.mjs} +11 -14
  66. package/dist/.setup/{provider-capabilities-BfE88FZ5.mjs → provider-capabilities-DG5qbsUZ.mjs} +13 -18
  67. package/dist/.setup/{rate-limits-CMU3DUD0.mjs → rate-limits-B7-X2TgG.mjs} +9 -31
  68. package/dist/.setup/{request-D2L0zMrq.mjs → request-BZOfsSXW.mjs} +7 -6
  69. package/dist/.setup/responses-oauth-twnuTaAa.mjs +93 -0
  70. package/dist/.setup/rpc-error-BlD2vuzn.mjs +31 -0
  71. package/dist/.setup/{run-attempt-BHu11r7h.mjs → run-attempt-dYJhjZrp.mjs} +1035 -1023
  72. package/dist/.setup/{run-attempt-lifecycle-B7JbY4-F.mjs → run-attempt-lifecycle-C-6O3Exn.mjs} +10 -24
  73. package/dist/.setup/{runtime-artifact-CLZ8udh-.mjs → runtime-artifact-DDQ-HGXf.mjs} +16 -4
  74. package/dist/.setup/runtime-artifact-connection-D68qQn1m.mjs +78 -0
  75. package/dist/.setup/sandbox-guard-DjCz2eOw.mjs +126 -0
  76. package/dist/.setup/scope-DOC1Xjc8.mjs +6 -0
  77. package/dist/.setup/session-binding-DGCYAfvD.mjs +443 -0
  78. package/dist/.setup/{session-binding-record-BGoz8wOK.mjs → session-binding-record-Oe9L-CNY.mjs} +52 -130
  79. package/dist/.setup/{session-binding-sidecars-BlB5EvIS.mjs → session-binding-sidecars-jo6H8dFr.mjs} +196 -17
  80. package/dist/.setup/{session-catalog-Pno1xGcl.mjs → session-catalog-BFafIiF6.mjs} +185 -350
  81. package/dist/.setup/{session-catalog-adoption-BI6UTDZT.mjs → session-catalog-adoption-BU_pHWG7.mjs} +7 -6
  82. package/dist/.setup/{session-catalog-archive-lHBqzhaO.mjs → session-catalog-archive-spHfihri.mjs} +6 -6
  83. package/dist/.setup/session-catalog-events-BMCFMZw-.mjs +139 -0
  84. package/dist/.setup/session-catalog-home-id-vlih0B_g.mjs +22 -0
  85. package/dist/.setup/{session-catalog-index-B9_VQIUz.mjs → session-catalog-index-DwJjnF5k.mjs} +126 -122
  86. package/dist/.setup/{session-catalog-index-order-hcdz07yN.mjs → session-catalog-index-order-BcQpHks3.mjs} +1 -1
  87. package/dist/.setup/{session-catalog-index-state-Dgh8ORJm.mjs → session-catalog-index-state-TeO7EyO-.mjs} +3 -2
  88. package/dist/.setup/session-catalog-limits-DDxOsQeC.mjs +14 -0
  89. package/dist/.setup/session-catalog-list-request-CvtxrYSe.mjs +170 -0
  90. package/dist/.setup/session-catalog-native-projection-CuaFZuQE.mjs +178 -0
  91. package/dist/.setup/{session-catalog-node-adoption-ITddWx_X.mjs → session-catalog-node-adoption-DgXvSGu0.mjs} +10 -27
  92. package/dist/.setup/{session-catalog-node-continue-6g6qi4A9.mjs → session-catalog-node-continue-DjKXHBbi.mjs} +8 -10
  93. package/dist/.setup/session-catalog-node-lookup-CtAXI5W5.mjs +56 -0
  94. package/dist/.setup/{session-catalog-native-projection-DowriLid.mjs → session-catalog-parsing-CPGaPYr-.mjs} +11 -194
  95. package/dist/.setup/{session-catalog-projection-zK_PUsiE.mjs → session-catalog-projection-CGfzfP93.mjs} +6 -4
  96. package/dist/.setup/session-catalog-provenance-DoAvktcj.mjs +95 -0
  97. package/dist/.setup/{session-cli-irrD-uo7.mjs → session-cli-DlmBHYIe.mjs} +9 -22
  98. package/dist/.setup/{session-history-BrqhSCf9.mjs → session-history-D83lJWHG.mjs} +4 -6
  99. package/dist/.setup/{session-history-import-D-3wAgOP.mjs → session-history-import-WhX-X33a.mjs} +7 -10
  100. package/dist/.setup/session-history-read-Ov3StuL4.mjs +133 -0
  101. package/dist/.setup/{session-history.worker-CaCh0xF_.mjs → session-history.worker-MnPKncqP.mjs} +9 -5
  102. package/dist/.setup/session-initialization-6aveB9qb.mjs +22 -0
  103. package/dist/.setup/{session-permission-policy-BI1QK_98.mjs → session-permission-policy-Ci_fVX6y.mjs} +4 -8
  104. package/dist/.setup/{session-retirement-BH-S6qkJ.mjs → session-retirement-LlYWBKTJ.mjs} +17 -17
  105. package/dist/.setup/{settled-turn-context-fmwouT5I.mjs → settled-turn-context-D4yj4rxf.mjs} +1 -1
  106. package/dist/.setup/{settled-turn-finalizer-DiAi6Kx6.mjs → settled-turn-finalizer-DW9W3gza.mjs} +14 -10
  107. package/dist/.setup/{shared-client-DA4VR4Eb.mjs → shared-client-CJCTeFpQ.mjs} +783 -412
  108. package/dist/.setup/shared-client-lifecycle-7xgtlo15.mjs +153 -0
  109. package/dist/.setup/{side-question-BJ1wSDcB.mjs → side-question-BLeGj7TQ.mjs} +79 -143
  110. package/dist/.setup/{source-CUzJq5WN.mjs → source-CJis_1EF.mjs} +80 -137
  111. package/dist/.setup/{thread-lifecycle-B3mfz1TG.mjs → thread-lifecycle-_bAbjedG.mjs} +294 -737
  112. package/dist/.setup/{thread-ownership-DcTtAcXj.mjs → thread-ownership-B6pPt21M.mjs} +45 -10
  113. package/dist/.setup/{incognito-session-uhrBF6wJ.mjs → thread-ownership-queue-Dp24d7-F.mjs} +1 -2
  114. package/dist/.setup/{thread-policy-DGuQsuFC.mjs → thread-policy-gNPzzpVp.mjs} +46 -7
  115. package/dist/.setup/{thread-requests-BLvGkP2R.mjs → thread-requests-OWGOiDaV.mjs} +199 -302
  116. package/dist/.setup/{thread-resume-DIBXwOpE.mjs → thread-resume-GOry0AYh.mjs} +6 -6
  117. package/dist/.setup/{timeout-C910MdAB.mjs → timeout-CXOfNoaX.mjs} +1 -35
  118. package/dist/.setup/{transcript-history-projection-ZZpkFkJ_.mjs → transcript-history-projection-DRSifI-1.mjs} +17 -89
  119. package/dist/.setup/{transcript-mirror-attestation-CzM-94NC.mjs → transcript-mirror-attestation-YSegaktH.mjs} +3 -4
  120. package/dist/.setup/{transcript-mirror-BtHDBp1G.mjs → transcript-mirror-kxmCYsuF.mjs} +7 -9
  121. package/dist/.setup/{transport-stdio-h2VHOskC.mjs → transport-stdio-Bdegpn2V.mjs} +5 -22
  122. package/dist/.setup/transport-websocket-BTBE-LD9.mjs +211 -0
  123. package/dist/.setup/{upstream-prompt-provenance-LphB8slG.mjs → upstream-prompt-provenance-fXkKbPVC.mjs} +3 -9
  124. package/dist/.setup/{upstream-session-fork-BUr4OUbC.mjs → upstream-session-fork-gkdRj2yH.mjs} +23 -23
  125. package/dist/.setup/{usage-BML0r-ua.mjs → usage-CApUvLOV.mjs} +4 -4
  126. package/dist/.setup/{usage-limit-error-DUMbefVY.mjs → usage-limit-error-wSMQkbpV.mjs} +4 -19
  127. package/dist/.setup/{web-search-provider.runtime-CDKlN-Rv.mjs → web-search-provider.runtime-UKgeiBUG.mjs} +8 -19
  128. package/dist/api.js +9 -11
  129. package/dist/catalog-page.worker.js +1 -1
  130. package/dist/cli-metadata.js +1 -1
  131. package/dist/doctor-contract-api.js +50 -8
  132. package/dist/harness.js +344 -1
  133. package/dist/index.js +193 -245
  134. package/dist/media-understanding-provider.js +9 -22
  135. package/dist/migration-provider-api.js +1 -1
  136. package/dist/provider-discovery.js +1 -1
  137. package/dist/session-history-worker-runtime.js +3 -3
  138. package/dist/session-history.worker.js +1 -1
  139. package/openclaw.plugin.json +14 -2
  140. package/package.json +7 -6
  141. package/dist/.setup/attempt-workspace-context-DUVEn_CS.mjs +0 -331
  142. package/dist/.setup/compact-Du5UvtxA.mjs +0 -680
  143. package/dist/.setup/event-projector-assistant-message-BsruvNrH.mjs +0 -103
  144. package/dist/.setup/event-projector-items-C6L_5ZiT.mjs +0 -234
  145. package/dist/.setup/harness-a_MsE4-_.mjs +0 -355
  146. package/dist/.setup/history-rejection-B4nOXNXF.mjs +0 -13
  147. package/dist/.setup/image-payload-sanitizer-tupAr-2o.mjs +0 -79
  148. package/dist/.setup/local-runtime-attribution-B_2mnqhb.mjs +0 -19
  149. package/dist/.setup/native-subagent-history-0nYYgo0k.mjs +0 -148
  150. package/dist/.setup/native-subagent-task-ids-wb8CKZGN.mjs +0 -441
  151. package/dist/.setup/plugin-approval-roundtrip-C0MZzCuP.mjs +0 -122
  152. package/dist/.setup/rolldown-runtime-8H4AJuhK.mjs +0 -14
  153. package/dist/.setup/sandbox-guard-C2sRMOEY.mjs +0 -166
  154. package/dist/.setup/session-binding-Cm0apEbd.mjs +0 -692
  155. package/dist/.setup/session-catalog-events-Bj6j94E_.mjs +0 -347
  156. package/dist/.setup/session-history-read-B3ZfSUbF.mjs +0 -50
  157. package/dist/.setup/session-initialization-rcgbZiid.mjs +0 -75
  158. package/dist/.setup/thread-history-page-DoVpnHim.mjs +0 -83
@@ -1,115 +1,11 @@
1
- import { i as normalizeCodexServiceTier, m as CODEX_PLUGIN_MARKETPLACE_NAME_PATTERN } from "./config-utils-DujwEnhg.mjs";
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
- const mcpServerNames = Array.isArray(entry.mcpServerNames) && entry.mcpServerNames.every((serverName) => typeof serverName === "string") ? entry.mcpServerNames : void 0;
409
- if (entry.source === "account") {
410
- if ("appId" in entry || typeof entry.appName !== "string" || typeof entry.allowDestructiveActions !== "boolean" || entry.allowOpenWorld !== void 0 && typeof entry.allowOpenWorld !== "boolean" || destructiveApprovalMode === "invalid" || !mcpServerNames) return;
411
- parsedApps[appId] = {
412
- source: "account",
413
- appName: entry.appName,
414
- allowDestructiveActions: entry.allowDestructiveActions,
415
- ...typeof entry.allowOpenWorld === "boolean" ? { allowOpenWorld: entry.allowOpenWorld } : {},
416
- ...destructiveApprovalMode ? { destructiveApprovalMode } : {},
417
- mcpServerNames
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 { readCodexNativeSubagentHistoryOwner as C, matchesCodexNativeSubagentHistoryOwner as S, adoptCodexNativeSubagentSubmissions as _, ownsStoredSessionGeneration as a, codexNativeSubagentHistoryConnectionFingerprint as b, readCodexBindingTimestamp as c, readCurrentCodexNativeSubagentSubmissions as d, readPluginAppPolicyContext as f, validateBindingForWrite as g, stripUndefinedBinding as h, matchesCodexNativeSubagentSubmissionBinding as i, readCurrentCodexAppServerBinding as l, sessionBindingIdentity as m, assertCodexBindingMayBeReplaced as n, preserveCodexNativeSubagentSubmissions as o, readStoredCodexAppServerBinding as p, bindingStoreKey as r, readCodexAppServerThreadBinding as s, CodexSupervisionBindingReplacementError as t, readCurrentCodexAppServerBindings as u, mutateCodexNativeSubagentSubmissions as v, createCodexNativeSubagentHistoryOwner as x, assertHistoryOwnerMatchesRegistration as y };
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 };
@@ -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
- notice: `Left Codex binding sidecar in place because ${reason}: ${source.sidecarPath}`
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-Cm0apEbd.mjs").then((n) => n.s), import("./conversation-binding-data-CrcyZk6O.mjs").then((n) => n.t)]);
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 retainNotice(`its session is owned by agent harness ${owner.agentHarnessId}`);
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 sourceSessionFile = typeof raw.sessionFile === "string" && raw.sessionFile.trim() ? raw.sessionFile : source.transcriptPath;
322
- const ownerSessionFile = typeof raw.sessionFile === "string" && raw.sessionFile.trim() ? raw.sessionFile : owner?.transcriptPath;
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 retainNotice(ownershipWarning);
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 };