codex-chatgpt-control 0.5.1-alpha.2 → 0.5.1-alpha.4

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 (231) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +43 -0
  3. package/contracts/v1/fixtures/backend-capabilities.json +40 -1
  4. package/contracts/v1/fixtures/backend-compatibility.json +21 -0
  5. package/contracts/v1/fixtures/backend-version.json +6 -1
  6. package/contracts/v1/fixtures/download-blocked-by-browser.json +22 -0
  7. package/contracts/v1/fixtures/download-receipt-failed.json +22 -0
  8. package/contracts/v1/fixtures/download-receipt-timeout.json +22 -0
  9. package/contracts/v1/fixtures/journal-rpc-indeterminate.json +32 -0
  10. package/contracts/v1/fixtures/journal-rpc-unsupported-platform.json +32 -0
  11. package/contracts/v1/fixtures/journal-runtime-unavailable.json +32 -0
  12. package/contracts/v1/fixtures/operation-action-prepared-event.json +42 -0
  13. package/contracts/v1/fixtures/operation-action.json +13 -0
  14. package/contracts/v1/fixtures/operation-artifact-receipt.json +14 -0
  15. package/contracts/v1/fixtures/operation-artifact-transfer-intent-event.json +24 -0
  16. package/contracts/v1/fixtures/operation-artifact-transfer-receipt-event.json +26 -0
  17. package/contracts/v1/fixtures/operation-artifact-transfer-state.json +178 -0
  18. package/contracts/v1/fixtures/operation-blocker.json +10 -0
  19. package/contracts/v1/fixtures/operation-collect-request.json +17 -0
  20. package/contracts/v1/fixtures/operation-collect-result.json +42 -0
  21. package/contracts/v1/fixtures/operation-control-receipt.json +13 -0
  22. package/contracts/v1/fixtures/operation-control-request.json +18 -0
  23. package/contracts/v1/fixtures/operation-control-result.json +31 -0
  24. package/contracts/v1/fixtures/operation-event.json +18 -0
  25. package/contracts/v1/fixtures/operation-handle.json +10 -0
  26. package/contracts/v1/fixtures/operation-inspect-request.json +13 -0
  27. package/contracts/v1/fixtures/operation-inspect-result.json +205 -0
  28. package/contracts/v1/fixtures/operation-ownership-baseline-event.json +34 -0
  29. package/contracts/v1/fixtures/operation-receipt.json +32 -0
  30. package/contracts/v1/fixtures/operation-recovery-decision.json +7 -0
  31. package/contracts/v1/fixtures/operation-recovery-observation.json +12 -0
  32. package/contracts/v1/fixtures/operation-request.json +33 -0
  33. package/contracts/v1/fixtures/operation-state.json +144 -0
  34. package/contracts/v1/fixtures/operation-submission-witness-event.json +20 -0
  35. package/contracts/v1/fixtures/operation-submission-witness.json +11 -0
  36. package/contracts/v1/fixtures/operation-submit-result.json +16 -0
  37. package/contracts/v1/fixtures/operation-target-established-event.json +21 -0
  38. package/contracts/v1/manifest.json +185 -1
  39. package/contracts/v1/parity-suite.json +106 -8
  40. package/contracts/v1/schemas/backend-compatibility.schema.json +65 -0
  41. package/contracts/v1/schemas/backend-request.schema.json +8 -2
  42. package/contracts/v1/schemas/capabilities.schema.json +81 -1
  43. package/contracts/v1/schemas/manifest.schema.json +57 -0
  44. package/contracts/v1/schemas/operation-action.schema.json +155 -0
  45. package/contracts/v1/schemas/operation-artifact-receipt.schema.json +89 -0
  46. package/contracts/v1/schemas/operation-blocker.schema.json +70 -0
  47. package/contracts/v1/schemas/operation-collect-request.schema.json +46 -0
  48. package/contracts/v1/schemas/operation-collect-result.schema.json +74 -0
  49. package/contracts/v1/schemas/operation-control-receipt.schema.json +108 -0
  50. package/contracts/v1/schemas/operation-control-request.schema.json +111 -0
  51. package/contracts/v1/schemas/operation-control-result.schema.json +112 -0
  52. package/contracts/v1/schemas/operation-event.schema.json +756 -0
  53. package/contracts/v1/schemas/operation-handle.schema.json +55 -0
  54. package/contracts/v1/schemas/operation-inspect-request.schema.json +42 -0
  55. package/contracts/v1/schemas/operation-inspect-result.schema.json +1662 -0
  56. package/contracts/v1/schemas/operation-receipt.schema.json +153 -0
  57. package/contracts/v1/schemas/operation-recovery.schema.json +314 -0
  58. package/contracts/v1/schemas/operation-request.schema.json +158 -0
  59. package/contracts/v1/schemas/operation-state.schema.json +691 -0
  60. package/contracts/v1/schemas/operation-submission-witness.schema.json +48 -0
  61. package/contracts/v1/schemas/operation-submit-result.schema.json +94 -0
  62. package/contracts/v1/surface-drift-policy.json +50 -0
  63. package/contracts/v1/vectors/operation-request-digest-v1.json +43 -0
  64. package/dist/codex-chatgpt-control-backend.mjs +45882 -9361
  65. package/dist/codex-chatgpt-control-journal.mjs +5547 -0
  66. package/dist/codex-chatgpt-control-live-smoke.bundle.mjs +51677 -0
  67. package/dist/codex-chatgpt-control-release-canary.bundle.mjs +52104 -0
  68. package/dist/codex-chatgpt-control.bundle.mjs +48392 -10260
  69. package/dist/src/backend/client.d.ts +103 -2
  70. package/dist/src/backend/client.js +1436 -97
  71. package/dist/src/backend/compatibility.d.ts +12 -0
  72. package/dist/src/backend/compatibility.js +208 -0
  73. package/dist/src/backend/protocol.d.ts +84 -1
  74. package/dist/src/backend/protocol.js +31 -5
  75. package/dist/src/backend/runtime-identity.d.ts +10 -0
  76. package/dist/src/backend/runtime-identity.js +141 -0
  77. package/dist/src/backend/session.d.ts +10 -2
  78. package/dist/src/backend/session.js +478 -7
  79. package/dist/src/backend/stdio-server.d.ts +4 -1
  80. package/dist/src/backend/stdio-server.js +240 -28
  81. package/dist/src/browser/active-composer-file-input.d.ts +9 -0
  82. package/dist/src/browser/active-composer-file-input.js +33 -0
  83. package/dist/src/browser/attach.d.ts +4 -1
  84. package/dist/src/browser/attach.js +136 -28
  85. package/dist/src/browser/chatgpt-url.d.ts +2 -0
  86. package/dist/src/browser/chatgpt-url.js +9 -0
  87. package/dist/src/browser/downloads.d.ts +17 -1
  88. package/dist/src/browser/downloads.js +150 -28
  89. package/dist/src/browser/page-state.js +6 -0
  90. package/dist/src/client.d.ts +43 -0
  91. package/dist/src/client.js +1279 -59
  92. package/dist/src/commands/artifacts.js +6 -4
  93. package/dist/src/commands/chat-popover.d.ts +37 -0
  94. package/dist/src/commands/chat-popover.js +537 -0
  95. package/dist/src/commands/configuration.d.ts +5 -0
  96. package/dist/src/commands/configuration.js +134 -21
  97. package/dist/src/commands/context.js +10 -3
  98. package/dist/src/commands/doctor.d.ts +1 -1
  99. package/dist/src/commands/doctor.js +27 -4
  100. package/dist/src/commands/experience.d.ts +5 -0
  101. package/dist/src/commands/experience.js +104 -21
  102. package/dist/src/commands/files.js +14 -33
  103. package/dist/src/commands/modes.js +85 -21
  104. package/dist/src/commands/power-discovery.d.ts +130 -0
  105. package/dist/src/commands/power-discovery.js +669 -0
  106. package/dist/src/commands/project-sources.js +325 -31
  107. package/dist/src/commands/sequence.js +59 -32
  108. package/dist/src/commands/session.js +19 -6
  109. package/dist/src/commands/work.js +31 -0
  110. package/dist/src/dom/composer-text.d.ts +6 -0
  111. package/dist/src/dom/composer-text.js +85 -0
  112. package/dist/src/errors.d.ts +9 -0
  113. package/dist/src/errors.js +22 -0
  114. package/dist/src/index.d.ts +6 -0
  115. package/dist/src/index.js +9 -0
  116. package/dist/src/operations/artifact-output.d.ts +69 -0
  117. package/dist/src/operations/artifact-output.js +1748 -0
  118. package/dist/src/operations/artifact-stream.d.ts +19 -0
  119. package/dist/src/operations/artifact-stream.js +35 -0
  120. package/dist/src/operations/artifact-transfer.d.ts +149 -0
  121. package/dist/src/operations/artifact-transfer.js +1312 -0
  122. package/dist/src/operations/browser-adapter.d.ts +167 -0
  123. package/dist/src/operations/browser-adapter.js +2103 -0
  124. package/dist/src/operations/browser-observation.d.ts +110 -0
  125. package/dist/src/operations/browser-observation.js +1256 -0
  126. package/dist/src/operations/browser-target.d.ts +105 -0
  127. package/dist/src/operations/browser-target.js +531 -0
  128. package/dist/src/operations/canonical.d.ts +4 -0
  129. package/dist/src/operations/canonical.js +412 -0
  130. package/dist/src/operations/chatgpt-runtime.d.ts +72 -0
  131. package/dist/src/operations/chatgpt-runtime.js +1232 -0
  132. package/dist/src/operations/client.d.ts +138 -0
  133. package/dist/src/operations/client.js +1145 -0
  134. package/dist/src/operations/collector.d.ts +195 -0
  135. package/dist/src/operations/collector.js +1039 -0
  136. package/dist/src/operations/configuration-routing.d.ts +4 -0
  137. package/dist/src/operations/configuration-routing.js +14 -0
  138. package/dist/src/operations/control.d.ts +372 -0
  139. package/dist/src/operations/control.js +1498 -0
  140. package/dist/src/operations/file-identity.d.ts +33 -0
  141. package/dist/src/operations/file-identity.js +153 -0
  142. package/dist/src/operations/handle.d.ts +19 -0
  143. package/dist/src/operations/handle.js +727 -0
  144. package/dist/src/operations/index.d.ts +25 -0
  145. package/dist/src/operations/index.js +25 -0
  146. package/dist/src/operations/journal-authority.d.ts +12 -0
  147. package/dist/src/operations/journal-authority.js +1 -0
  148. package/dist/src/operations/journal-rpc-client.d.ts +12 -0
  149. package/dist/src/operations/journal-rpc-client.js +225 -0
  150. package/dist/src/operations/journal-rpc-protocol.d.ts +32 -0
  151. package/dist/src/operations/journal-rpc-protocol.js +214 -0
  152. package/dist/src/operations/journal-rpc-server.d.ts +15 -0
  153. package/dist/src/operations/journal-rpc-server.js +272 -0
  154. package/dist/src/operations/journal.d.ts +143 -0
  155. package/dist/src/operations/journal.js +1957 -0
  156. package/dist/src/operations/production-attachments.d.ts +118 -0
  157. package/dist/src/operations/production-attachments.js +1035 -0
  158. package/dist/src/operations/production-chatgpt-artifacts.d.ts +74 -0
  159. package/dist/src/operations/production-chatgpt-artifacts.js +1146 -0
  160. package/dist/src/operations/production-chatgpt-attachments.d.ts +80 -0
  161. package/dist/src/operations/production-chatgpt-attachments.js +1639 -0
  162. package/dist/src/operations/production-configuration.d.ts +42 -0
  163. package/dist/src/operations/production-configuration.js +1544 -0
  164. package/dist/src/operations/production-primitives.d.ts +53 -0
  165. package/dist/src/operations/production-primitives.js +856 -0
  166. package/dist/src/operations/production-work-steer.d.ts +203 -0
  167. package/dist/src/operations/production-work-steer.js +1218 -0
  168. package/dist/src/operations/recovery.d.ts +80 -0
  169. package/dist/src/operations/recovery.js +174 -0
  170. package/dist/src/operations/runtime-adapter.d.ts +126 -0
  171. package/dist/src/operations/runtime-adapter.js +802 -0
  172. package/dist/src/operations/send-once.d.ts +224 -0
  173. package/dist/src/operations/send-once.js +1081 -0
  174. package/dist/src/operations/service.d.ts +286 -0
  175. package/dist/src/operations/service.js +2831 -0
  176. package/dist/src/operations/staging.d.ts +136 -0
  177. package/dist/src/operations/staging.js +630 -0
  178. package/dist/src/operations/state-machine.d.ts +29 -0
  179. package/dist/src/operations/state-machine.js +2047 -0
  180. package/dist/src/operations/submission.d.ts +423 -0
  181. package/dist/src/operations/submission.js +1676 -0
  182. package/dist/src/operations/transactional-chat-power.d.ts +17 -0
  183. package/dist/src/operations/transactional-chat-power.js +212 -0
  184. package/dist/src/operations/turn-ownership.d.ts +202 -0
  185. package/dist/src/operations/turn-ownership.js +700 -0
  186. package/dist/src/operations/types.d.ts +454 -0
  187. package/dist/src/operations/types.js +20 -0
  188. package/dist/src/operations/wire-requests.d.ts +21 -0
  189. package/dist/src/operations/wire-requests.js +396 -0
  190. package/dist/src/operations/wire-results.d.ts +97 -0
  191. package/dist/src/operations/wire-results.js +818 -0
  192. package/dist/src/runner/responses.d.ts +3 -1
  193. package/dist/src/runner/responses.js +19 -1
  194. package/dist/src/runner/result.js +227 -55
  195. package/dist/src/runner/types.d.ts +12 -0
  196. package/dist/src/runtime/command-routing.d.ts +149 -0
  197. package/dist/src/runtime/command-routing.js +431 -0
  198. package/dist/src/runtime/coordinated-browser.d.ts +24 -0
  199. package/dist/src/runtime/coordinated-browser.js +315 -0
  200. package/dist/src/runtime/coordinated-page.d.ts +41 -0
  201. package/dist/src/runtime/coordinated-page.js +651 -0
  202. package/dist/src/runtime/operation-context.d.ts +142 -0
  203. package/dist/src/runtime/operation-context.js +410 -0
  204. package/dist/src/runtime/runtime-session.d.ts +95 -0
  205. package/dist/src/runtime/runtime-session.js +314 -0
  206. package/dist/src/runtime/tab-coordinator.d.ts +200 -0
  207. package/dist/src/runtime/tab-coordinator.js +1200 -0
  208. package/dist/src/runtime/value-boundaries.d.ts +18 -0
  209. package/dist/src/runtime/value-boundaries.js +49 -0
  210. package/dist/src/safety/blockers.js +8 -1
  211. package/dist/src/safety/untrusted-output.js +2 -1
  212. package/dist/src/scripts/backend-server.js +4 -1
  213. package/dist/src/scripts/capture-surface-profile.js +7 -2
  214. package/dist/src/scripts/journal-server.d.ts +2 -0
  215. package/dist/src/scripts/journal-server.js +37 -0
  216. package/dist/src/scripts/live-smoke/harness.js +79 -7
  217. package/dist/src/scripts/live-smoke/scenarios.d.ts +42 -1
  218. package/dist/src/scripts/live-smoke/scenarios.js +147 -30
  219. package/dist/src/scripts/live-smoke/transactional.d.ts +17 -0
  220. package/dist/src/scripts/live-smoke/transactional.js +254 -0
  221. package/dist/src/scripts/live-smoke/types.d.ts +3 -0
  222. package/dist/src/scripts/release-canary-module.js +17 -4
  223. package/dist/src/types.d.ts +38 -1
  224. package/package.json +8 -3
  225. package/references/2026-08-16-transactional-operations.md +459 -0
  226. package/references/2026-09-06-journal-service.md +140 -0
  227. package/references/agents-runner.md +34 -0
  228. package/references/backend-protocol.md +176 -0
  229. package/references/python-parity.md +137 -0
  230. package/references/responses-adapter.md +19 -0
  231. package/references/streaming.md +6 -0
@@ -0,0 +1,423 @@
1
+ import type { MutationBoundary, OperationActionOutcome, OperationHandleV1, OperationPhase, OperationStateV1, OperationSurface } from "./types.js";
2
+ import type { OwnershipBaseline } from "./turn-ownership.js";
3
+ export type SubmissionAttachmentIdentity = Readonly<{
4
+ identityDigest: string;
5
+ ordinal: number;
6
+ }>;
7
+ export type SubmissionExpectedEnvelope = Readonly<{
8
+ surface: OperationSurface;
9
+ targetBindingDigest: string;
10
+ configurationReceiptDigest: string;
11
+ composerReceiptDigest: string;
12
+ attachmentManifest: Readonly<{
13
+ count: number;
14
+ orderPolicy: "exact";
15
+ identities: readonly SubmissionAttachmentIdentity[];
16
+ }>;
17
+ }>;
18
+ export type SubmissionActionIds = Readonly<{
19
+ /** Required when the operation has not yet recorded a Send intent. */
20
+ sendActionId: string;
21
+ /** Required when files need a new handoff intent. */
22
+ fileHandoffActionId?: string;
23
+ }>;
24
+ export type SubmissionOperationSnapshot = Readonly<{
25
+ state: Readonly<OperationStateV1>;
26
+ handle: Readonly<OperationHandleV1>;
27
+ actionIds: SubmissionActionIds;
28
+ }>;
29
+ export type SubmissionStageRequest = Readonly<{
30
+ operationId: string;
31
+ requestDigest: string;
32
+ surface: OperationSurface;
33
+ targetBindingDigest: string;
34
+ configurationReceiptDigest: string;
35
+ composerReceiptDigest: string;
36
+ }>;
37
+ export type SubmissionStageObservation = Readonly<{
38
+ status: "exact";
39
+ evidenceDigest: string;
40
+ } | {
41
+ status: "mismatch";
42
+ reason: "target" | "configuration" | "composer" | "unknown";
43
+ evidenceDigest?: string;
44
+ } | {
45
+ status: "unavailable";
46
+ reason: "target" | "configuration" | "composer" | "unknown";
47
+ evidenceDigest?: string;
48
+ }>;
49
+ export type SubmissionAttachmentObservation = Readonly<{
50
+ status: "absent";
51
+ evidenceDigest: string;
52
+ count: 0;
53
+ orderPolicy: "exact";
54
+ identityDigests: readonly [];
55
+ } | {
56
+ status: "exact";
57
+ evidenceDigest: string;
58
+ count: number;
59
+ orderPolicy: "exact";
60
+ identityDigests: readonly string[];
61
+ } | {
62
+ status: "mismatch" | "delayed" | "ambiguous" | "unavailable";
63
+ evidenceDigest?: string;
64
+ }>;
65
+ export type SubmissionAttachmentRequest = Readonly<{
66
+ operationId: string;
67
+ requestDigest: string;
68
+ surface: OperationSurface;
69
+ targetBindingDigest: string;
70
+ manifest: SubmissionExpectedEnvelope["attachmentManifest"];
71
+ }>;
72
+ export type SubmissionIntentRequest = Readonly<{
73
+ operationId: string;
74
+ requestDigest: string;
75
+ surface: OperationSurface;
76
+ actionId: string;
77
+ kind: "file_handoff" | "send";
78
+ repeatPolicy: "observe_only_after_intent";
79
+ targetBindingDigest: string;
80
+ }>;
81
+ export type SubmissionHandoffRequest = Readonly<{
82
+ operationId: string;
83
+ requestDigest: string;
84
+ surface: OperationSurface;
85
+ actionId: string;
86
+ targetBindingDigest: string;
87
+ manifest: SubmissionExpectedEnvelope["attachmentManifest"];
88
+ /** Request-local cancellation; never serialized or persisted. */
89
+ signal?: AbortSignal;
90
+ /** Absolute request deadline; never serialized or persisted. */
91
+ deadlineAt?: number;
92
+ }>;
93
+ export type SubmissionHandoffResult = Readonly<{
94
+ status: "satisfied";
95
+ evidenceDigest: string;
96
+ } | {
97
+ status: "not_satisfied";
98
+ blockerCode?: SubmissionBlockerCode;
99
+ evidenceDigest?: string;
100
+ } | {
101
+ status: "uncertain";
102
+ evidenceDigest?: string;
103
+ quarantine: "provider" | "caller";
104
+ }>;
105
+ export type SubmissionFinalTransactionRequest = Readonly<{
106
+ operationId: string;
107
+ requestDigest: string;
108
+ surface: OperationSurface;
109
+ actionId: string;
110
+ mode: "mutate_once" | "observe_only";
111
+ /** A sanitized clone; adapters must not receive the original request object. */
112
+ expected: SubmissionExpectedEnvelope;
113
+ /** Durable pre-Send baseline supplied before the sole activation. */
114
+ persistPreSendBaseline?: (baseline: OwnershipBaseline) => Promise<void>;
115
+ /** Existing durable baseline used by observation-only recovery. */
116
+ durableBaseline?: OwnershipBaseline;
117
+ /** Request cancellation/deadline are propagated to the short tab/read probes. */
118
+ signal?: AbortSignal;
119
+ deadlineAt?: number;
120
+ }>;
121
+ /**
122
+ * Request-local, adapter-owned Send preparation. `prepared` is an opaque
123
+ * capability owned by the browser adapter; the submission journal never
124
+ * receives it. Only the complete redacted ownership baseline crosses the
125
+ * atomic persistence boundary below.
126
+ */
127
+ export type SubmissionPrepareSendRequest = Readonly<{
128
+ operationId: string;
129
+ requestDigest: string;
130
+ surface: OperationSurface;
131
+ actionId: string;
132
+ expected: SubmissionExpectedEnvelope;
133
+ signal?: AbortSignal;
134
+ deadlineAt?: number;
135
+ }>;
136
+ export type SubmissionPreparedSend = Readonly<{
137
+ /** Opaque request-local adapter capability; never serialize or journal. */
138
+ prepared: unknown;
139
+ baseline: OwnershipBaseline;
140
+ evidenceDigest: string;
141
+ }>;
142
+ export type SubmissionPrepareSendResult = Readonly<{
143
+ status: "prepared";
144
+ prepared: SubmissionPreparedSend;
145
+ } | {
146
+ status: "blocked";
147
+ result: Extract<SubmissionFinalTransactionResult, {
148
+ status: "blocked";
149
+ }>;
150
+ }>;
151
+ /**
152
+ * The sole durable Send boundary. `executeAllowed: false` means another
153
+ * caller already committed the same action; the caller must recover and may
154
+ * not invoke the browser mutation.
155
+ */
156
+ export type SubmissionPreparedSendPersistenceRequest = Readonly<{
157
+ operationId: string;
158
+ /** Parent operation digest used to address the durable journal. */
159
+ durableRequestDigest: string;
160
+ /** Action request identity; normally equal to durableRequestDigest for Send. */
161
+ requestDigest: string;
162
+ surface: OperationSurface;
163
+ actionId: string;
164
+ kind: "send";
165
+ repeatPolicy: "observe_only_after_intent";
166
+ targetBindingDigest: string;
167
+ baseline: OwnershipBaseline;
168
+ }>;
169
+ export type SubmissionPreparedSendPersistenceResult = Readonly<{
170
+ status: "committed";
171
+ executeAllowed: boolean;
172
+ } | {
173
+ status: "not_committed";
174
+ blockerCode?: SubmissionBlockerCode;
175
+ evidenceDigest?: string;
176
+ } | {
177
+ status: "uncertain";
178
+ evidenceDigest?: string;
179
+ }>;
180
+ export type SubmissionExecutePreparedSendRequest = Readonly<{
181
+ operationId: string;
182
+ requestDigest: string;
183
+ surface: OperationSurface;
184
+ actionId: string;
185
+ expected: SubmissionExpectedEnvelope;
186
+ prepared: SubmissionPreparedSend;
187
+ signal?: AbortSignal;
188
+ deadlineAt?: number;
189
+ }>;
190
+ export type SubmissionExecutePreparedSendResult = Readonly<{
191
+ status: "activated" | "activation_threw";
192
+ activation: "activated" | "activation_threw";
193
+ mutationMayHaveOccurred: true;
194
+ } | {
195
+ status: "blocked";
196
+ result: Extract<SubmissionFinalTransactionResult, {
197
+ status: "blocked";
198
+ }>;
199
+ } | {
200
+ status: "uncertain";
201
+ result: Extract<SubmissionFinalTransactionResult, {
202
+ status: "uncertain";
203
+ }>;
204
+ }>;
205
+ export type SubmissionVerifyPreparedSendRequest = Readonly<{
206
+ operationId: string;
207
+ requestDigest: string;
208
+ surface: OperationSurface;
209
+ actionId: string;
210
+ expected: SubmissionExpectedEnvelope;
211
+ prepared: SubmissionPreparedSend;
212
+ activation: "activated" | "activation_threw";
213
+ mutationMayHaveOccurred: true;
214
+ signal?: AbortSignal;
215
+ deadlineAt?: number;
216
+ }>;
217
+ export type SubmissionRecoverSendRequest = Readonly<{
218
+ operationId: string;
219
+ requestDigest: string;
220
+ surface: OperationSurface;
221
+ actionId: string;
222
+ expected: SubmissionExpectedEnvelope;
223
+ durableBaseline: OwnershipBaseline;
224
+ signal?: AbortSignal;
225
+ deadlineAt?: number;
226
+ }>;
227
+ /** Redacted provider identity proof returned by the post-Send observer. */
228
+ export type SubmissionTargetEstablishmentObservation = Readonly<{
229
+ targetBindingDigest: string;
230
+ anchorDigest: string;
231
+ causalSendActionId: string;
232
+ conversationId: string;
233
+ canonicalThreadUrl: string;
234
+ userTurnId: string;
235
+ userTurnEvidenceDigest: string;
236
+ postSendDeltaDigest?: string;
237
+ evidenceDigest: string;
238
+ observedAt?: string;
239
+ }>;
240
+ export type SubmissionTargetEstablishmentRequest = Readonly<{
241
+ operationId: string;
242
+ requestDigest: string;
243
+ targetBindingDigest: string;
244
+ anchorDigest: string;
245
+ causalSendActionId: string;
246
+ conversationId: string;
247
+ canonicalThreadUrl: string;
248
+ userTurnId: string;
249
+ userTurnEvidenceDigest: string;
250
+ postSendDeltaDigest?: string;
251
+ evidenceDigest: string;
252
+ observedAt?: string;
253
+ }>;
254
+ export type SubmissionFinalTransactionResult = Readonly<{
255
+ status: "submitted" | "already_submitted";
256
+ targetBindingDigest: string;
257
+ evidenceDigest: string;
258
+ userTurnId: string;
259
+ userTurnEvidenceDigest: string;
260
+ /** Exact before/after user-turn delta proof for the original Send. */
261
+ postSendDeltaDigest?: string;
262
+ assistantTurnId?: string;
263
+ targetEstablishment?: SubmissionTargetEstablishmentObservation;
264
+ } | {
265
+ status: "blocked";
266
+ blockerCode: SubmissionBlockerCode;
267
+ evidenceDigest?: string;
268
+ } | {
269
+ status: "uncertain";
270
+ evidenceDigest?: string;
271
+ quarantine: "provider" | "caller";
272
+ }>;
273
+ export type SubmissionPhaseEvidence = Readonly<{
274
+ kind: "phase";
275
+ operationId: string;
276
+ requestDigest: string;
277
+ surface: OperationSurface;
278
+ phase: "ready";
279
+ mutationBoundary: MutationBoundary;
280
+ targetBindingDigest: string;
281
+ evidenceDigest: string;
282
+ actionId?: string;
283
+ actionOutcome?: OperationActionOutcome;
284
+ }>;
285
+ export type SubmissionReceiptEvidence = Readonly<{
286
+ kind: "receipt";
287
+ operationId: string;
288
+ requestDigest: string;
289
+ surface: OperationSurface;
290
+ phase: "submitted";
291
+ mutationBoundary: "send_may_have_occurred";
292
+ targetBindingDigest: string;
293
+ evidenceDigest: string;
294
+ userTurnId: string;
295
+ userTurnEvidenceDigest: string;
296
+ postSendDeltaDigest: string;
297
+ observedAt?: string;
298
+ assistantTurnId?: string;
299
+ }>;
300
+ export type SubmissionBlockerEvidence = Readonly<{
301
+ kind: "blocker";
302
+ operationId: string;
303
+ requestDigest: string;
304
+ surface: OperationSurface;
305
+ phase: OperationPhase;
306
+ mutationBoundary: MutationBoundary;
307
+ /** Absent only for a blocker observed before target binding. */
308
+ targetBindingDigest?: string;
309
+ blocker: SubmissionBlocker;
310
+ }>;
311
+ export type SubmissionPersistenceRequest = SubmissionPhaseEvidence | SubmissionReceiptEvidence | SubmissionBlockerEvidence;
312
+ export type SubmissionPorts = Readonly<{
313
+ /** Observe the exact target/configuration/composer values without mutating. */
314
+ observeStaging(request: SubmissionStageRequest): Promise<SubmissionStageObservation>;
315
+ /** Persist one non-repeatable file-handoff intent before its browser mutation starts. */
316
+ persistActionIntent(request: SubmissionIntentRequest): Promise<void>;
317
+ /** One file handoff attempt. The adapter must settle or explicitly quarantine before resolving. */
318
+ executeFileHandoffOnce(request: SubmissionHandoffRequest): Promise<SubmissionHandoffResult>;
319
+ /** Bounded observation of exact attachment identity/count/order postconditions. */
320
+ observeAttachments(request: SubmissionAttachmentRequest): Promise<SubmissionAttachmentObservation>;
321
+ /**
322
+ * Read-only Send preparation. The returned provider capability remains
323
+ * request-local and is never accepted by a journal port.
324
+ */
325
+ prepareSend?: (request: SubmissionPrepareSendRequest) => Promise<SubmissionPrepareSendResult>;
326
+ /** Atomic action-intent plus complete ownership-baseline persistence. */
327
+ persistPreparedSend?: (request: SubmissionPreparedSendPersistenceRequest) => Promise<SubmissionPreparedSendPersistenceResult>;
328
+ /** Execute the one prepared Send activation; this port must not persist. */
329
+ executePreparedSend?: (request: SubmissionExecutePreparedSendRequest) => Promise<SubmissionExecutePreparedSendResult>;
330
+ /** Read-only verification after the prepared activation settles. */
331
+ verifyPreparedSend?: (request: SubmissionVerifyPreparedSendRequest) => Promise<SubmissionFinalTransactionResult>;
332
+ /** Read-only restart recovery anchored to the durable per-action baseline. */
333
+ recoverSend?: (request: SubmissionRecoverSendRequest) => Promise<SubmissionFinalTransactionResult>;
334
+ /**
335
+ * Legacy final transaction surface retained for source compatibility only.
336
+ * runAtomicSubmission never uses it for Send because it cannot prove the
337
+ * atomic intent+baseline boundary.
338
+ */
339
+ executeFinalTabTransaction: (request: SubmissionFinalTransactionRequest) => Promise<SubmissionFinalTransactionResult>;
340
+ /** @deprecated Old split baseline callback; never used by the atomic Send path. */
341
+ persistOwnershipBaseline?: (request: Readonly<{
342
+ operationId: string;
343
+ requestDigest: string;
344
+ targetBindingDigest: string;
345
+ actionId: string;
346
+ baseline: OwnershipBaseline;
347
+ }>) => Promise<void>;
348
+ /** Persist a provider-assigned identity before the submitted phase/receipt. */
349
+ establishTarget?: (request: SubmissionTargetEstablishmentRequest) => Promise<unknown>;
350
+ /** Persist redacted phase/receipt/blocker evidence; never accepts raw request fields. */
351
+ persistReceiptEvidence(request: SubmissionPersistenceRequest): Promise<void>;
352
+ }>;
353
+ export type SubmissionBlockerCode = "operation_cancelled" | "operation_timeout" | "stale_handle" | "operation_state_corrupt" | "target_binding_mismatch" | "target_evidence_unavailable" | "configuration_drift" | "composer_drift" | "attachment_manifest_mismatch" | "input_file_changed" | "ambiguous_file_handoff" | "ambiguous_submit" | "concurrent_user_turn" | "send_control_unavailable" | "tab_ownership_conflict" | "runtime_incompatible" | "backend_unavailable" | "browser_bridge_unavailable" | "login_required" | "captcha" | "rate_limited" | "permission_required" | "needs_confirmation" | "selector_drift" | "journal_unavailable" | "port_protocol_violation" | "already_completed";
354
+ export type SubmissionBlocker = Readonly<{
355
+ code: SubmissionBlockerCode;
356
+ evidenceDigest?: string;
357
+ /** Whether a caller may ask for a read-only observation. Never means retry the mutation. */
358
+ observationRequired: boolean;
359
+ mutationBoundary: MutationBoundary;
360
+ }>;
361
+ type SubmissionResultIdentity = Readonly<{
362
+ operationId: string;
363
+ requestDigest: string;
364
+ surface: OperationSurface;
365
+ }>;
366
+ type SubmissionResultBase = SubmissionResultIdentity & Readonly<{
367
+ targetBindingDigest: string;
368
+ }>;
369
+ type SubmissionBlockerResultBase = SubmissionResultIdentity & Readonly<{
370
+ /** Absent only when target resolution failed before a durable binding existed. */
371
+ targetBindingDigest?: string;
372
+ }>;
373
+ export type SubmissionResult = (SubmissionResultBase & Readonly<{
374
+ kind: "submitted";
375
+ actionId: string;
376
+ evidenceDigest: string;
377
+ userTurnId: string;
378
+ userTurnEvidenceDigest: string;
379
+ assistantTurnId?: string;
380
+ }>) | (SubmissionResultBase & Readonly<{
381
+ kind: "already_submitted";
382
+ actionId?: string;
383
+ evidenceDigest: string;
384
+ userTurnId: string;
385
+ userTurnEvidenceDigest: string;
386
+ assistantTurnId?: string;
387
+ }>) | (SubmissionResultBase & Readonly<{
388
+ /** A terminal durable receipt using its dedicated user-turn evidence. */
389
+ kind: "completed_receipt";
390
+ actionId?: string;
391
+ evidenceDigest: string;
392
+ userTurnId: string;
393
+ userTurnEvidenceDigest: string;
394
+ assistantTurnId: string;
395
+ }>) | (SubmissionBlockerResultBase & Readonly<{
396
+ kind: "cancelled";
397
+ blocker: SubmissionBlocker & Readonly<{
398
+ code: "operation_cancelled" | "operation_timeout";
399
+ }>;
400
+ }>) | (SubmissionBlockerResultBase & Readonly<{
401
+ kind: "blocked";
402
+ blocker: SubmissionBlocker;
403
+ }>) | (SubmissionBlockerResultBase & Readonly<{
404
+ kind: "uncertain";
405
+ blocker: SubmissionBlocker;
406
+ }>);
407
+ export declare class SubmissionInputError extends Error {
408
+ readonly code: SubmissionBlockerCode;
409
+ constructor(code: SubmissionBlockerCode, message: string);
410
+ }
411
+ /**
412
+ * Execute one operation-aware submission. All non-repeatable calls are
413
+ * preceded by a durable intent and all ambiguous outcomes become observation
414
+ * only. This function intentionally does not generate operation or action
415
+ * IDs; callers must provide the durable action IDs.
416
+ */
417
+ export declare function runAtomicSubmission(operation: SubmissionOperationSnapshot, expected: SubmissionExpectedEnvelope, ports: SubmissionPorts, options?: Readonly<{
418
+ signal?: AbortSignal;
419
+ deadlineAt?: number;
420
+ }>): Promise<SubmissionResult>;
421
+ /** Validate a redacted provider identity proof at an adapter boundary. */
422
+ export declare function validateSubmissionTargetEstablishment(value: unknown, expectedTargetBindingDigest: string, expectedActionId?: string): asserts value is SubmissionTargetEstablishmentObservation;
423
+ export {};