@openclaw/codex 2026.9.4 → 2026.9.6

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 (160) hide show
  1. package/assets/activity.svg +30 -0
  2. package/assets/icon.png +0 -0
  3. package/dist/.setup/account-usage-runtime-Eem_WGqY.mjs +75 -0
  4. package/dist/{apply-CvT8tW5i.js → .setup/apply-DDOi8uNx.mjs} +24 -30
  5. package/dist/.setup/async-questions-DdhOCwGi.mjs +27 -0
  6. package/dist/{attempt-client-cleanup-DKHzbwt5.js → .setup/attempt-client-cleanup-CEv1cKwF.mjs} +79 -49
  7. package/dist/.setup/attempt-terminal-gZrxQ35N.mjs +5 -0
  8. package/dist/.setup/attempt-workspace-context-DUVEn_CS.mjs +331 -0
  9. package/dist/{auth-binding-CWlKVccJ.js → .setup/auth-binding-DhLWa_7K.mjs} +1 -1
  10. package/dist/{auth-cache-key-7orQae_j.js → .setup/auth-cache-key-B2mpaI9D.mjs} +9 -81
  11. package/dist/{auth-profile-CwzO4_RG.js → .setup/auth-profile-WqZtZfXN.mjs} +1 -1
  12. package/dist/.setup/auth-profile-health-oHizqgye.mjs +53 -0
  13. package/dist/.setup/auth-profile-recovery-BREezV0L.mjs +14 -0
  14. package/dist/.setup/binding-connection-ThoatDcb.mjs +50 -0
  15. package/dist/.setup/binding-connection.runtime-yoHrABt-.mjs +48 -0
  16. package/dist/{bounded-turn-C_Hneydj.js → .setup/bounded-turn-B2HScEgT.mjs} +143 -32
  17. package/dist/{build-state-BCmg9-5p.js → .setup/build-state-C7EnDVgr.mjs} +1 -1
  18. package/dist/{capabilities-8vx68WLH.js → .setup/capabilities-CDXOOFdZ.mjs} +1 -1
  19. package/dist/{client-B57KWPQx.js → .setup/client-Cs08OXVQ.mjs} +705 -512
  20. package/dist/.setup/client-catalog-response-BMgt_4q4.mjs +285 -0
  21. package/dist/{command-dispatch-BpduNGVf.js → .setup/command-dispatch-B4JuOsOk.mjs} +8 -4
  22. package/dist/{command-formatters-lxlkNZgU.js → .setup/command-formatters-Bmqvr9tO.mjs} +8 -4
  23. package/dist/{command-handlers-tiL9iWj7.js → .setup/command-handlers-DW7Lx9oH.mjs} +137 -186
  24. package/dist/{command-rpc-CR5EOEZX.js → .setup/command-rpc-DixIj3HW.mjs} +47 -23
  25. package/dist/{compact-B_H3AOd7.js → .setup/compact-Du5UvtxA.mjs} +29 -51
  26. package/dist/{config-oIORaQ5T.js → .setup/config-BoTP_mrL.mjs} +5 -4
  27. package/dist/{config-options-CXMq1T-C.js → .setup/config-options-BvaRs51b.mjs} +50 -446
  28. package/dist/{protocol-5bh1G-H7.js → .setup/config-parsing-CcB9iPoq.mjs} +9 -51
  29. package/dist/{config-runtime-D0zGNIHu.js → .setup/config-runtime-C8Rw1m1m.mjs} +2 -2
  30. package/dist/.setup/config-security-BEReZ6go.mjs +380 -0
  31. package/dist/{conversation-binding-DsB4-O7U.js → .setup/conversation-binding-DP-gMrBP.mjs} +29 -38
  32. package/dist/{conversation-binding-data-BiodpIzq.js → .setup/conversation-binding-data-CrcyZk6O.mjs} +1 -1
  33. package/dist/{conversation-control-CtUu1b3m.js → .setup/conversation-control-uK9Jomlc.mjs} +32 -67
  34. package/dist/.setup/cyber-failover-DYwbmf1o.mjs +123 -0
  35. package/dist/.setup/cyber-failover-notice-e9G3J9-e.mjs +17 -0
  36. package/dist/{dynamic-tools-CmN5RAip.js → .setup/dynamic-tools-BDXl-8Cw.mjs} +936 -620
  37. package/dist/{effective-mcp-catalog-Bd73bqA8.js → .setup/effective-mcp-catalog-CvnvnGIe.mjs} +3 -3
  38. package/dist/{ephemeral-turn-D78_VmzO.js → .setup/ephemeral-turn-poidXgek.mjs} +9 -7
  39. package/dist/{event-projector-assistant-message-BmBM4qBV.js → .setup/event-projector-assistant-message-BsruvNrH.mjs} +8 -7
  40. package/dist/{event-projector-items-5VhsECCO.js → .setup/event-projector-items-C6L_5ZiT.mjs} +42 -8
  41. package/dist/{attempt-notifications-C9XufG6l.js → .setup/event-projector-usage-CnBS8Wa3.mjs} +102 -9
  42. package/dist/{harness-C7rRa7bm.js → .setup/harness-a_MsE4-_.mjs} +81 -21
  43. package/dist/{inference-context-Dr_mzvk4.js → .setup/inference-context-D96l9-ew.mjs} +1 -1
  44. package/dist/.setup/inference-proxy-b-aJMSxm.mjs +601 -0
  45. package/dist/{isolated-completion-DWVb5U2J.js → .setup/isolated-completion-BIZFhTNG.mjs} +18 -11
  46. package/dist/.setup/launch-args-DbFCehO7.mjs +196 -0
  47. package/dist/{managed-binary-D22rNEcR.js → .setup/managed-binary-BnshlFag.mjs} +14 -3
  48. package/dist/{managed-thread-store-D1t5jh3G.js → .setup/managed-thread-store-BMqgThVL.mjs} +48 -14
  49. package/dist/{model-catalog-Dq2n8f_p.js → .setup/model-catalog-CfXJf9Ay.mjs} +36 -12
  50. package/dist/{models-PCKOim-h.js → .setup/models-KnqBv0hE.mjs} +3 -3
  51. package/dist/.setup/native-auth-rWbGbMn3.mjs +57 -0
  52. package/dist/{native-subagent-history-DjtPloaU.js → .setup/native-subagent-history-0nYYgo0k.mjs} +43 -35
  53. package/dist/.setup/native-subagent-monitor-D3filLY2.mjs +4859 -0
  54. package/dist/{native-subagent-task-ids-BzTdT0Uw.js → .setup/native-subagent-task-ids-wb8CKZGN.mjs} +98 -44
  55. package/dist/{node-cli-sessions-DKaOmVUh.js → .setup/node-cli-sessions-r3avj02l.mjs} +86 -68
  56. package/dist/.setup/node-exec-server.runtime-BDwWXVpK.mjs +247 -0
  57. package/dist/{plan-7uG-Fp36.js → .setup/plan-CN3VwfNU.mjs} +133 -119
  58. package/dist/{plugin-activation-BYQculil.js → .setup/plugin-activation-DT3MNtqj.mjs} +7 -16
  59. package/dist/{plugin-app-cache-key-d0eKxy7b.js → .setup/plugin-app-cache-key-B2CsSdnV.mjs} +32 -44
  60. package/dist/{plugin-approval-roundtrip-Bz3FT8W5.js → .setup/plugin-approval-roundtrip-C0MZzCuP.mjs} +1 -1
  61. package/dist/{plugin-inventory-oL4Na1ZG.js → .setup/plugin-inventory-BoRei8Z4.mjs} +21 -11
  62. package/dist/{plugin-marketplace-discovery-P-Vndfqq.js → .setup/plugin-marketplace-discovery-CDOi8IFs.mjs} +4 -1
  63. package/dist/{plugin-metadata-cache-ClPJpRio.js → .setup/plugin-metadata-cache-Ctmo83k_.mjs} +226 -141
  64. package/dist/.setup/protocol-CANUwXJ3.mjs +17 -0
  65. package/dist/{provider-MQ8PVkuE.js → .setup/provider-BOsxQHOM.mjs} +9 -5
  66. package/dist/{provider-capabilities-BvCUL69A.js → .setup/provider-capabilities-BfE88FZ5.mjs} +31 -3
  67. package/dist/{rate-limits-CBMmWBr9.js → .setup/rate-limits-CMU3DUD0.mjs} +174 -151
  68. package/dist/{request-B7hEkBGq.js → .setup/request-D2L0zMrq.mjs} +130 -42
  69. package/dist/{run-attempt-CvsAAGa0.js → .setup/run-attempt-BHu11r7h.mjs} +1628 -966
  70. package/dist/.setup/run-attempt-lifecycle-B7JbY4-F.mjs +71 -0
  71. package/dist/{runtime-artifact-BJ0rXBZ_.js → .setup/runtime-artifact-CLZ8udh-.mjs} +29 -45
  72. package/dist/{sandbox-guard-BxgyoM8M.js → .setup/sandbox-guard-C2sRMOEY.mjs} +3 -3
  73. package/dist/{session-binding-CI8UuilT.js → .setup/session-binding-Cm0apEbd.mjs} +36 -83
  74. package/dist/{session-binding-record-Bcvslnhf.js → .setup/session-binding-record-BGoz8wOK.mjs} +202 -5
  75. package/dist/.setup/session-binding-sidecars-BlB5EvIS.mjs +546 -0
  76. package/dist/.setup/session-catalog-Pno1xGcl.mjs +2764 -0
  77. package/dist/{session-catalog-adoption-tcZi1IfX.js → .setup/session-catalog-adoption-BI6UTDZT.mjs} +58 -26
  78. package/dist/{session-catalog-archive-CwKg8Xz2.js → .setup/session-catalog-archive-lHBqzhaO.mjs} +6 -6
  79. package/dist/.setup/session-catalog-events-Bj6j94E_.mjs +347 -0
  80. package/dist/.setup/session-catalog-index-B9_VQIUz.mjs +1170 -0
  81. package/dist/.setup/session-catalog-index-order-hcdz07yN.mjs +48 -0
  82. package/dist/.setup/session-catalog-index-state-Dgh8ORJm.mjs +183 -0
  83. package/dist/{thread-history-page-D0JIp48V.js → .setup/session-catalog-native-projection-DowriLid.mjs} +223 -95
  84. package/dist/{session-catalog-node-adoption-B1tgDW-m.js → .setup/session-catalog-node-adoption-ITddWx_X.mjs} +25 -13
  85. package/dist/{session-catalog-node-continue-Ci-DXyJP.js → .setup/session-catalog-node-continue-6g6qi4A9.mjs} +24 -15
  86. package/dist/.setup/session-catalog-projection-zK_PUsiE.mjs +422 -0
  87. package/dist/{session-cli-DNN_jhGc.js → .setup/session-cli-irrD-uo7.mjs} +3 -3
  88. package/dist/{session-history-Cz-tOOYj.js → .setup/session-history-BrqhSCf9.mjs} +19 -19
  89. package/dist/{session-history-import-DwyijFI6.js → .setup/session-history-import-D-3wAgOP.mjs} +4 -4
  90. package/dist/{session-history-read-cxPUxyVV.js → .setup/session-history-read-B3ZfSUbF.mjs} +2 -2
  91. package/dist/{session-history.worker-BeK1YOyT.js → .setup/session-history.worker-CaCh0xF_.mjs} +10 -24
  92. package/dist/{session-initialization-Ct0_Hzmg.js → .setup/session-initialization-rcgbZiid.mjs} +2 -2
  93. package/dist/{session-permission-policy-BBmXA8Eg.js → .setup/session-permission-policy-BI1QK_98.mjs} +2 -2
  94. package/dist/{session-retirement-B2YfbAAT.js → .setup/session-retirement-BH-S6qkJ.mjs} +26 -7
  95. package/dist/{settled-turn-context-Du6gdUDd.js → .setup/settled-turn-context-fmwouT5I.mjs} +2 -2
  96. package/dist/{settled-turn-finalizer-Dn91stmc.js → .setup/settled-turn-finalizer-DiAi6Kx6.mjs} +12 -12
  97. package/dist/{shared-client-CscigXXL.js → .setup/shared-client-DA4VR4Eb.mjs} +332 -221
  98. package/dist/{side-question-BGMJQf4U.js → .setup/side-question-BJ1wSDcB.mjs} +183 -230
  99. package/dist/{source-CElXU0Oy.js → .setup/source-CUzJq5WN.mjs} +11 -10
  100. package/dist/.setup/spawn-error-CL3n6MAa.mjs +57 -0
  101. package/dist/{thread-archive-guard-DfpBr-Sz.js → .setup/thread-archive-guard-C9frICzX.mjs} +10 -3
  102. package/dist/.setup/thread-history-page-DoVpnHim.mjs +83 -0
  103. package/dist/{thread-lifecycle-DXl1-I6b.js → .setup/thread-lifecycle-B3mfz1TG.mjs} +347 -2318
  104. package/dist/{thread-ownership-BsDRTsyp.js → .setup/thread-ownership-DcTtAcXj.mjs} +6 -4
  105. package/dist/{thread-policy-BuEQfE0g.js → .setup/thread-policy-DGuQsuFC.mjs} +19 -3
  106. package/dist/.setup/thread-requests-BLvGkP2R.mjs +2205 -0
  107. package/dist/{thread-resume-DsDOZpFg.js → .setup/thread-resume-DIBXwOpE.mjs} +8 -5
  108. package/dist/.setup/timeout-C910MdAB.mjs +80 -0
  109. package/dist/{transcript-history-projection-v17wXgdK.js → .setup/transcript-history-projection-ZZpkFkJ_.mjs} +96 -61
  110. package/dist/{transcript-mirror-C5CKgNy6.js → .setup/transcript-mirror-BtHDBp1G.mjs} +224 -195
  111. package/dist/{transcript-mirror-attestation-DibE0krH.js → .setup/transcript-mirror-attestation-CzM-94NC.mjs} +4 -1
  112. package/dist/{transport-stdio-BGjHoYLr.js → .setup/transport-stdio-h2VHOskC.mjs} +274 -89
  113. package/dist/{upstream-session-fork-BZerMte_.js → .setup/upstream-session-fork-BUr4OUbC.mjs} +51 -42
  114. package/dist/{usage-tCk-mg_x.js → .setup/usage-BML0r-ua.mjs} +5 -4
  115. package/dist/.setup/usage-limit-error-DUMbefVY.mjs +166 -0
  116. package/dist/{web-search-provider.runtime-B7bGbGWq.js → .setup/web-search-provider.runtime-CDKlN-Rv.mjs} +4 -3
  117. package/dist/api.js +23 -12
  118. package/dist/catalog-page-worker-entrypoint.js +12 -0
  119. package/dist/catalog-page.worker.js +9 -0
  120. package/dist/cli-metadata.js +1 -1
  121. package/dist/doctor-contract-api.js +8 -528
  122. package/dist/harness.js +1 -1
  123. package/dist/index.js +306 -215
  124. package/dist/media-understanding-provider.js +3 -3
  125. package/dist/migration-provider-api.js +1 -1
  126. package/dist/native-tool-policy.js +12 -0
  127. package/dist/provider-discovery.js +18 -0
  128. package/dist/session-history-worker-runtime.js +36 -35
  129. package/dist/session-history.worker.js +2 -2
  130. package/dist/web-search-contract-api.js +1 -1
  131. package/openclaw.plugin.json +354 -69
  132. package/package.json +14 -8
  133. package/dist/attempt-context-D44yeDII.js +0 -636
  134. package/dist/binding-connection-D3udKbIE.js +0 -60
  135. package/dist/event-projector-usage-BfXmpOec.js +0 -102
  136. package/dist/inference-proxy-HGXKUIre.js +0 -311
  137. package/dist/launch-args-RXQwn8zV.js +0 -90
  138. package/dist/native-subagent-history-owner-Pcp7JuVF.js +0 -34
  139. package/dist/native-subagent-monitor-fQ7eIXEf.js +0 -2978
  140. package/dist/node-exec-server.runtime-Cl2vapEi.js +0 -226
  141. package/dist/rpc-error-ttN_QjEm.js +0 -30
  142. package/dist/session-catalog-ct-AH01I.js +0 -1477
  143. package/dist/session-catalog-home-id-CwhLdC03.js +0 -18
  144. package/dist/session-catalog-provenance-D-dIfRAH.js +0 -96
  145. package/dist/timeout-BVw8aaM1.js +0 -33
  146. package/dist/version-omm6IPI3.js +0 -12
  147. /package/dist/{auth-profile-selection-DFu9e167.js → .setup/auth-profile-selection-DFu9e167.mjs} +0 -0
  148. /package/dist/{config-utils-DujwEnhg.js → .setup/config-utils-DujwEnhg.mjs} +0 -0
  149. /package/dist/{context-compaction-activity-CMla5FPJ.js → .setup/context-compaction-activity-CMla5FPJ.mjs} +0 -0
  150. /package/dist/{elicitation-input-DPoK8F7w.js → .setup/elicitation-input-DPoK8F7w.mjs} +0 -0
  151. /package/dist/{history-rejection-B4nOXNXF.js → .setup/history-rejection-B4nOXNXF.mjs} +0 -0
  152. /package/dist/{image-payload-sanitizer-tupAr-2o.js → .setup/image-payload-sanitizer-tupAr-2o.mjs} +0 -0
  153. /package/dist/{incognito-session-uhrBF6wJ.js → .setup/incognito-session-uhrBF6wJ.mjs} +0 -0
  154. /package/dist/{local-runtime-attribution-B_2mnqhb.js → .setup/local-runtime-attribution-B_2mnqhb.mjs} +0 -0
  155. /package/dist/{native-execution-policy-umd0tgh4.js → .setup/native-execution-policy-umd0tgh4.mjs} +0 -0
  156. /package/dist/{rolldown-runtime-8H4AJuhK.js → .setup/rolldown-runtime-8H4AJuhK.mjs} +0 -0
  157. /package/dist/{session-binding-meta-B7aEMU7g.js → .setup/session-binding-meta-B7aEMU7g.mjs} +0 -0
  158. /package/dist/{session-upstream-marker-D15C9NHp.js → .setup/session-upstream-marker-D15C9NHp.mjs} +0 -0
  159. /package/dist/{upstream-prompt-provenance-LphB8slG.js → .setup/upstream-prompt-provenance-LphB8slG.mjs} +0 -0
  160. /package/dist/{web-search-provider.shared-BrZmlqyR.js → .setup/web-search-provider.shared-BrZmlqyR.mjs} +0 -0
@@ -1,8 +1,115 @@
1
- import { i as normalizeCodexServiceTier, m as CODEX_PLUGIN_MARKETPLACE_NAME_PATTERN } from "./config-utils-DujwEnhg.js";
1
+ import { i as normalizeCodexServiceTier, m as CODEX_PLUGIN_MARKETPLACE_NAME_PATTERN } from "./config-utils-DujwEnhg.mjs";
2
+ import { asOptionalRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
2
3
  import { createHash } from "node:crypto";
4
+ import { isDeepStrictEqual } from "node:util";
3
5
  import { AgentHarnessPreflightError } from "openclaw/plugin-sdk/agent-harness-registration";
4
6
  import { resolveSessionAgentIdsStrict } from "openclaw/plugin-sdk/agent-scope-runtime";
5
7
  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
6
113
  //#region extensions/codex/src/app-server/session-binding-record.ts
7
114
  /** Canonical binding codec and synchronous generation-aware reads; no lifecycle or auth loading. */
8
115
  /** Resolves the same agent scope OpenClaw uses for transcript/session ownership. */
@@ -85,7 +192,7 @@ const threadBindingSchema = z.object({
85
192
  connectionScope: z.literal("supervision").optional(),
86
193
  supervisionSourceThreadId: z.string().trim().min(1).optional(),
87
194
  authProfileId: optionalStringSchema,
88
- agentWorkspaceDeveloperInstructions: optionalNonBlankStringSchema,
195
+ agentWorkspaceDeveloperInstructions: optionalStringSchema,
89
196
  model: optionalStringSchema,
90
197
  preserveNativeModel: z.literal(true).optional().catch(void 0),
91
198
  pendingSupervisionBranch: pendingSupervisionBranchSchema.optional(),
@@ -180,7 +287,8 @@ const storedBindingSchema = z.discriminatedUnion("state", [z.object({
180
287
  state: z.literal("active"),
181
288
  binding: threadBindingSchema,
182
289
  sessionId: storedSessionIdSchema,
183
- lease: bindingLeaseSchema.optional().catch(void 0)
290
+ lease: bindingLeaseSchema.optional().catch(void 0),
291
+ nativeSubagentSubmissions: z.unknown().optional()
184
292
  }), z.object({
185
293
  version: z.literal(1),
186
294
  state: z.literal("cleared"),
@@ -237,11 +345,46 @@ function readCodexBindingTimestamp(value) {
237
345
  /** The same physical-generation check serves execution and read-only projections. */
238
346
  function readCurrentCodexAppServerBinding(state, identity) {
239
347
  const key = bindingStoreKey(identity);
240
- const raw = state.lookup(key);
348
+ return decodeCurrentCodexAppServerBinding(key, state.lookup(key), identity);
349
+ }
350
+ function decodeCurrentCodexAppServerBinding(key, raw, identity) {
241
351
  const stored = readStoredCodexAppServerBinding(raw);
242
352
  if (raw !== void 0 && !stored) throw new Error(`Invalid Codex app-server binding row: ${key}`);
243
353
  return stored?.state === "active" && ownsStoredSessionGeneration(identity, stored) ? stored.binding : void 0;
244
354
  }
355
+ /** Consume synchronously so each list phase acquires fresh binding authority. */
356
+ function* readCurrentCodexAppServerBindings(state, identities) {
357
+ let keys;
358
+ if (state.lookupMany && identities.length > 1 && identities.length <= 1e4) try {
359
+ keys = identities.map(bindingStoreKey);
360
+ } catch {}
361
+ if (!keys || !state.lookupMany) {
362
+ for (const identity of identities) yield readCurrentCodexAppServerBinding(state, identity);
363
+ return;
364
+ }
365
+ const values = state.lookupMany(keys);
366
+ for (let index = 0; index < identities.length; index++) {
367
+ const value = values[index];
368
+ if (!value.ok) throw value.error;
369
+ yield decodeCurrentCodexAppServerBinding(keys[index], value.value, identities[index]);
370
+ }
371
+ }
372
+ function matchesCodexNativeSubagentSubmissionBinding(binding, owner) {
373
+ return binding.threadId === owner.parentThreadId && !binding.pendingSupervisionBranch && codexNativeSubagentHistoryConnectionFingerprint(binding) === owner.connectionFingerprint;
374
+ }
375
+ /** Unknown metadata stays opaque through ordinary binding writes. */
376
+ function preserveCodexNativeSubagentSubmissions(currentBinding, nextBinding, value) {
377
+ return currentBinding.threadId === nextBinding.threadId && codexNativeSubagentHistoryConnectionFingerprint(currentBinding) === codexNativeSubagentHistoryConnectionFingerprint(nextBinding) && isDeepStrictEqual(currentBinding.pendingSupervisionBranch, nextBinding.pendingSupervisionBranch) ? value : void 0;
378
+ }
379
+ function readCurrentCodexNativeSubagentSubmissions(state, identity, owner) {
380
+ const key = bindingStoreKey(identity);
381
+ const raw = state.lookup(key);
382
+ const stored = readStoredCodexAppServerBinding(raw);
383
+ if (raw !== void 0 && !stored) throw new Error(`Invalid Codex app-server binding row: ${key}`);
384
+ if (stored?.state !== "active" || !ownsStoredSessionGeneration(identity, stored) || identity.kind === "session" && owner.sessionId !== identity.sessionId || !matchesCodexNativeSubagentSubmissionBinding(stored.binding, owner)) return [];
385
+ const submissions = readCodexNativeSubagentSubmissions(stored.nativeSubagentSubmissions);
386
+ return submissions && matchesCodexNativeSubagentSubmissionOwner(submissions.owner, owner) ? submissions.receipts : [];
387
+ }
245
388
  var CodexSupervisionBindingReplacementError = class extends Error {
246
389
  constructor(threadId, operation) {
247
390
  super(`Refusing to replace supervised Codex thread ${threadId} while ${operation}; its native user-home connection and model ownership must be preserved`);
@@ -252,5 +395,59 @@ function assertCodexBindingMayBeReplaced(binding, operation, expected) {
252
395
  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.`);
253
396
  if (binding?.connectionScope === "supervision") throw new CodexSupervisionBindingReplacementError(binding.threadId, operation);
254
397
  }
398
+ function readPluginAppPolicyContext(value, bindingSchemaVersion) {
399
+ const record = asOptionalRecord(value);
400
+ if (!record || typeof record.fingerprint !== "string") return;
401
+ const apps = asOptionalRecord(record.apps);
402
+ if (!apps) return;
403
+ const parsedApps = {};
404
+ for (const [appId, rawEntry] of Object.entries(apps)) {
405
+ const entry = asOptionalRecord(rawEntry);
406
+ if (!entry) return;
407
+ 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 } : {},
428
+ ...destructiveApprovalMode ? { destructiveApprovalMode } : {},
429
+ mcpServerNames
430
+ };
431
+ }
432
+ const parsedPluginAppIds = {};
433
+ if (record.pluginAppIds !== void 0 && (!record.pluginAppIds || typeof record.pluginAppIds !== "object" || Array.isArray(record.pluginAppIds))) return;
434
+ if (record.pluginAppIds && typeof record.pluginAppIds === "object") for (const [configKey, appIds] of Object.entries(record.pluginAppIds)) {
435
+ if (!Array.isArray(appIds) || appIds.some((appId) => typeof appId !== "string")) return;
436
+ parsedPluginAppIds[configKey] = appIds;
437
+ }
438
+ return {
439
+ fingerprint: record.fingerprint,
440
+ apps: parsedApps,
441
+ pluginAppIds: parsedPluginAppIds
442
+ };
443
+ }
444
+ function readDestructiveApprovalMode(value, bindingSchemaVersion) {
445
+ if (value === void 0) return;
446
+ if (value === "allow" || value === "deny") return value;
447
+ if (value === "auto") return bindingSchemaVersion === 1 ? "allow" : "auto";
448
+ if (value === "ask" && bindingSchemaVersion === 2) return "ask";
449
+ if (value === "on-request" && bindingSchemaVersion === 1) return "auto";
450
+ return "invalid";
451
+ }
255
452
  //#endregion
256
- export { readCodexAppServerThreadBinding as a, readStoredCodexAppServerBinding as c, validateBindingForWrite as d, ownsStoredSessionGeneration as i, sessionBindingIdentity as l, assertCodexBindingMayBeReplaced as n, readCodexBindingTimestamp as o, bindingStoreKey as r, readCurrentCodexAppServerBinding as s, CodexSupervisionBindingReplacementError as t, stripUndefinedBinding as u };
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 };