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

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 (191) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +27 -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/operation-action-prepared-event.json +42 -0
  7. package/contracts/v1/fixtures/operation-action.json +13 -0
  8. package/contracts/v1/fixtures/operation-artifact-receipt.json +14 -0
  9. package/contracts/v1/fixtures/operation-artifact-transfer-intent-event.json +24 -0
  10. package/contracts/v1/fixtures/operation-artifact-transfer-receipt-event.json +26 -0
  11. package/contracts/v1/fixtures/operation-artifact-transfer-state.json +178 -0
  12. package/contracts/v1/fixtures/operation-blocker.json +10 -0
  13. package/contracts/v1/fixtures/operation-collect-request.json +17 -0
  14. package/contracts/v1/fixtures/operation-collect-result.json +42 -0
  15. package/contracts/v1/fixtures/operation-control-receipt.json +13 -0
  16. package/contracts/v1/fixtures/operation-control-request.json +18 -0
  17. package/contracts/v1/fixtures/operation-control-result.json +31 -0
  18. package/contracts/v1/fixtures/operation-event.json +18 -0
  19. package/contracts/v1/fixtures/operation-handle.json +10 -0
  20. package/contracts/v1/fixtures/operation-inspect-request.json +13 -0
  21. package/contracts/v1/fixtures/operation-inspect-result.json +205 -0
  22. package/contracts/v1/fixtures/operation-ownership-baseline-event.json +34 -0
  23. package/contracts/v1/fixtures/operation-receipt.json +32 -0
  24. package/contracts/v1/fixtures/operation-recovery-decision.json +7 -0
  25. package/contracts/v1/fixtures/operation-recovery-observation.json +12 -0
  26. package/contracts/v1/fixtures/operation-request.json +33 -0
  27. package/contracts/v1/fixtures/operation-state.json +144 -0
  28. package/contracts/v1/fixtures/operation-submission-witness-event.json +20 -0
  29. package/contracts/v1/fixtures/operation-submission-witness.json +11 -0
  30. package/contracts/v1/fixtures/operation-submit-result.json +16 -0
  31. package/contracts/v1/fixtures/operation-target-established-event.json +21 -0
  32. package/contracts/v1/manifest.json +155 -1
  33. package/contracts/v1/parity-suite.json +96 -1
  34. package/contracts/v1/schemas/backend-compatibility.schema.json +65 -0
  35. package/contracts/v1/schemas/backend-request.schema.json +8 -2
  36. package/contracts/v1/schemas/capabilities.schema.json +81 -1
  37. package/contracts/v1/schemas/manifest.schema.json +57 -0
  38. package/contracts/v1/schemas/operation-action.schema.json +155 -0
  39. package/contracts/v1/schemas/operation-artifact-receipt.schema.json +89 -0
  40. package/contracts/v1/schemas/operation-blocker.schema.json +70 -0
  41. package/contracts/v1/schemas/operation-collect-request.schema.json +46 -0
  42. package/contracts/v1/schemas/operation-collect-result.schema.json +74 -0
  43. package/contracts/v1/schemas/operation-control-receipt.schema.json +108 -0
  44. package/contracts/v1/schemas/operation-control-request.schema.json +111 -0
  45. package/contracts/v1/schemas/operation-control-result.schema.json +112 -0
  46. package/contracts/v1/schemas/operation-event.schema.json +756 -0
  47. package/contracts/v1/schemas/operation-handle.schema.json +55 -0
  48. package/contracts/v1/schemas/operation-inspect-request.schema.json +42 -0
  49. package/contracts/v1/schemas/operation-inspect-result.schema.json +1662 -0
  50. package/contracts/v1/schemas/operation-receipt.schema.json +153 -0
  51. package/contracts/v1/schemas/operation-recovery.schema.json +314 -0
  52. package/contracts/v1/schemas/operation-request.schema.json +158 -0
  53. package/contracts/v1/schemas/operation-state.schema.json +691 -0
  54. package/contracts/v1/schemas/operation-submission-witness.schema.json +48 -0
  55. package/contracts/v1/schemas/operation-submit-result.schema.json +94 -0
  56. package/contracts/v1/surface-drift-policy.json +50 -0
  57. package/contracts/v1/vectors/operation-request-digest-v1.json +43 -0
  58. package/dist/codex-chatgpt-control-backend.mjs +43897 -9094
  59. package/dist/codex-chatgpt-control.bundle.mjs +46360 -10262
  60. package/dist/src/backend/client.d.ts +103 -2
  61. package/dist/src/backend/client.js +1436 -97
  62. package/dist/src/backend/compatibility.d.ts +12 -0
  63. package/dist/src/backend/compatibility.js +208 -0
  64. package/dist/src/backend/protocol.d.ts +84 -1
  65. package/dist/src/backend/protocol.js +31 -5
  66. package/dist/src/backend/runtime-identity.d.ts +10 -0
  67. package/dist/src/backend/runtime-identity.js +141 -0
  68. package/dist/src/backend/session.d.ts +10 -2
  69. package/dist/src/backend/session.js +478 -7
  70. package/dist/src/backend/stdio-server.d.ts +4 -1
  71. package/dist/src/backend/stdio-server.js +240 -28
  72. package/dist/src/browser/active-composer-file-input.d.ts +9 -0
  73. package/dist/src/browser/active-composer-file-input.js +33 -0
  74. package/dist/src/browser/attach.d.ts +4 -1
  75. package/dist/src/browser/attach.js +136 -28
  76. package/dist/src/browser/downloads.d.ts +2 -0
  77. package/dist/src/client.d.ts +38 -0
  78. package/dist/src/client.js +1222 -59
  79. package/dist/src/commands/configuration.js +13 -7
  80. package/dist/src/commands/doctor.d.ts +1 -1
  81. package/dist/src/commands/doctor.js +26 -3
  82. package/dist/src/commands/experience.js +35 -0
  83. package/dist/src/commands/files.js +4 -27
  84. package/dist/src/commands/modes.js +49 -17
  85. package/dist/src/commands/power-discovery.d.ts +130 -0
  86. package/dist/src/commands/power-discovery.js +627 -0
  87. package/dist/src/commands/project-sources.js +325 -31
  88. package/dist/src/commands/sequence.js +59 -32
  89. package/dist/src/commands/session.js +7 -2
  90. package/dist/src/commands/work.js +31 -0
  91. package/dist/src/errors.d.ts +9 -0
  92. package/dist/src/errors.js +22 -0
  93. package/dist/src/index.d.ts +6 -0
  94. package/dist/src/index.js +9 -0
  95. package/dist/src/operations/artifact-output.d.ts +69 -0
  96. package/dist/src/operations/artifact-output.js +1748 -0
  97. package/dist/src/operations/artifact-stream.d.ts +19 -0
  98. package/dist/src/operations/artifact-stream.js +35 -0
  99. package/dist/src/operations/artifact-transfer.d.ts +149 -0
  100. package/dist/src/operations/artifact-transfer.js +1312 -0
  101. package/dist/src/operations/browser-adapter.d.ts +161 -0
  102. package/dist/src/operations/browser-adapter.js +2023 -0
  103. package/dist/src/operations/browser-observation.d.ts +110 -0
  104. package/dist/src/operations/browser-observation.js +1208 -0
  105. package/dist/src/operations/browser-target.d.ts +103 -0
  106. package/dist/src/operations/browser-target.js +489 -0
  107. package/dist/src/operations/canonical.d.ts +4 -0
  108. package/dist/src/operations/canonical.js +412 -0
  109. package/dist/src/operations/chatgpt-runtime.d.ts +72 -0
  110. package/dist/src/operations/chatgpt-runtime.js +1150 -0
  111. package/dist/src/operations/client.d.ts +138 -0
  112. package/dist/src/operations/client.js +1143 -0
  113. package/dist/src/operations/collector.d.ts +195 -0
  114. package/dist/src/operations/collector.js +1039 -0
  115. package/dist/src/operations/control.d.ts +372 -0
  116. package/dist/src/operations/control.js +1498 -0
  117. package/dist/src/operations/file-identity.d.ts +33 -0
  118. package/dist/src/operations/file-identity.js +153 -0
  119. package/dist/src/operations/handle.d.ts +19 -0
  120. package/dist/src/operations/handle.js +727 -0
  121. package/dist/src/operations/index.d.ts +22 -0
  122. package/dist/src/operations/index.js +22 -0
  123. package/dist/src/operations/journal.d.ts +142 -0
  124. package/dist/src/operations/journal.js +1931 -0
  125. package/dist/src/operations/production-attachments.d.ts +116 -0
  126. package/dist/src/operations/production-attachments.js +1018 -0
  127. package/dist/src/operations/production-chatgpt-artifacts.d.ts +74 -0
  128. package/dist/src/operations/production-chatgpt-artifacts.js +1146 -0
  129. package/dist/src/operations/production-chatgpt-attachments.d.ts +71 -0
  130. package/dist/src/operations/production-chatgpt-attachments.js +1563 -0
  131. package/dist/src/operations/production-configuration.d.ts +42 -0
  132. package/dist/src/operations/production-configuration.js +1363 -0
  133. package/dist/src/operations/production-primitives.d.ts +53 -0
  134. package/dist/src/operations/production-primitives.js +1073 -0
  135. package/dist/src/operations/production-work-steer.d.ts +203 -0
  136. package/dist/src/operations/production-work-steer.js +1218 -0
  137. package/dist/src/operations/recovery.d.ts +80 -0
  138. package/dist/src/operations/recovery.js +174 -0
  139. package/dist/src/operations/runtime-adapter.d.ts +118 -0
  140. package/dist/src/operations/runtime-adapter.js +786 -0
  141. package/dist/src/operations/send-once.d.ts +224 -0
  142. package/dist/src/operations/send-once.js +1081 -0
  143. package/dist/src/operations/service.d.ts +281 -0
  144. package/dist/src/operations/service.js +2810 -0
  145. package/dist/src/operations/staging.d.ts +136 -0
  146. package/dist/src/operations/staging.js +630 -0
  147. package/dist/src/operations/state-machine.d.ts +29 -0
  148. package/dist/src/operations/state-machine.js +2047 -0
  149. package/dist/src/operations/submission.d.ts +423 -0
  150. package/dist/src/operations/submission.js +1676 -0
  151. package/dist/src/operations/turn-ownership.d.ts +202 -0
  152. package/dist/src/operations/turn-ownership.js +700 -0
  153. package/dist/src/operations/types.d.ts +454 -0
  154. package/dist/src/operations/types.js +20 -0
  155. package/dist/src/operations/wire-requests.d.ts +21 -0
  156. package/dist/src/operations/wire-requests.js +396 -0
  157. package/dist/src/operations/wire-results.d.ts +97 -0
  158. package/dist/src/operations/wire-results.js +818 -0
  159. package/dist/src/runner/responses.d.ts +3 -1
  160. package/dist/src/runner/responses.js +19 -1
  161. package/dist/src/runner/result.js +227 -55
  162. package/dist/src/runner/types.d.ts +12 -0
  163. package/dist/src/runtime/command-routing.d.ts +149 -0
  164. package/dist/src/runtime/command-routing.js +431 -0
  165. package/dist/src/runtime/coordinated-browser.d.ts +24 -0
  166. package/dist/src/runtime/coordinated-browser.js +315 -0
  167. package/dist/src/runtime/coordinated-page.d.ts +39 -0
  168. package/dist/src/runtime/coordinated-page.js +634 -0
  169. package/dist/src/runtime/operation-context.d.ts +142 -0
  170. package/dist/src/runtime/operation-context.js +410 -0
  171. package/dist/src/runtime/runtime-session.d.ts +95 -0
  172. package/dist/src/runtime/runtime-session.js +314 -0
  173. package/dist/src/runtime/tab-coordinator.d.ts +200 -0
  174. package/dist/src/runtime/tab-coordinator.js +1200 -0
  175. package/dist/src/runtime/value-boundaries.d.ts +18 -0
  176. package/dist/src/runtime/value-boundaries.js +49 -0
  177. package/dist/src/safety/untrusted-output.js +2 -1
  178. package/dist/src/scripts/backend-server.js +4 -1
  179. package/dist/src/scripts/live-smoke/harness.js +79 -7
  180. package/dist/src/scripts/live-smoke/scenarios.d.ts +28 -0
  181. package/dist/src/scripts/live-smoke/scenarios.js +110 -18
  182. package/dist/src/scripts/live-smoke/types.d.ts +3 -0
  183. package/dist/src/scripts/release-canary-module.js +17 -4
  184. package/dist/src/types.d.ts +38 -1
  185. package/package.json +1 -1
  186. package/references/2026-08-16-transactional-operations.md +459 -0
  187. package/references/agents-runner.md +34 -0
  188. package/references/backend-protocol.md +73 -0
  189. package/references/python-parity.md +72 -0
  190. package/references/responses-adapter.md +19 -0
  191. package/references/streaming.md +6 -0
@@ -0,0 +1,372 @@
1
+ import { type MutationBoundary, type OperationBlockerCode, type OperationControlReceiptV1, type OperationControlRequestV1, type OperationHandleV1, type OperationStateV1 } from "./types.js";
2
+ import type { OwnershipBaseline } from "./turn-ownership.js";
3
+ /**
4
+ * Adapter-free coordinator for operation-bound Stop and Work steer.
5
+ *
6
+ * The coordinator deliberately has no browser or journal dependency. A
7
+ * caller supplies a keyed control request digest and ports for reloading the
8
+ * authenticated parent state, recording an action intent/receipt, observing
9
+ * the exact assistant turn, and executing one bounded browser transaction.
10
+ * Stop retains its generic one-shot port. Work steer has a stricter,
11
+ * four-phase port: prepare (read only), atomically persist the child intent
12
+ * with its complete per-action baseline, executePrepared once, then verify or
13
+ * recover observation-only. The steer prompt is request-local and never
14
+ * crosses any port in a durable shape.
15
+ */
16
+ export declare const CONTROL_COORDINATOR_SCHEMA_VERSION: "chatgpt.browser_control.operation_control_coordinator.v1";
17
+ export type ControlParentReadRequest = Readonly<{
18
+ operationId: string;
19
+ parentRequestDigest: string;
20
+ parentTargetBindingDigest: string;
21
+ controlActionId: string;
22
+ action: "stop" | "steer";
23
+ expectedAssistantTurnId: string;
24
+ requestDigest: string;
25
+ }>;
26
+ export type ControlParentSnapshot = Readonly<{
27
+ /** Authenticated, freshly reloaded materialized state. */
28
+ state: OperationStateV1;
29
+ /** The current locator derived by the journal owner, not caller input. */
30
+ handle: OperationHandleV1;
31
+ /** A previously persisted receipt for this exact control action, if any. */
32
+ existingReceipt?: OperationControlReceiptV1;
33
+ /**
34
+ * Complete per-action Work-steer anchor loaded from authenticated durable
35
+ * state. It is required for observation-only replay after an intent crossed
36
+ * the fencing point. The shape deliberately contains no prompt, URL, DOM,
37
+ * labels, or provider exception material.
38
+ */
39
+ existingSteerIntent?: ControlSteerDurableIntent;
40
+ }>;
41
+ /**
42
+ * Request-local Work-steer preparation. This is a control-layer envelope for
43
+ * the browser primitive's prepared record. Every field is identity/evidence;
44
+ * prompt text is intentionally absent.
45
+ */
46
+ export type ControlSteerPrepared = Readonly<{
47
+ schemaVersion: typeof CONTROL_COORDINATOR_SCHEMA_VERSION;
48
+ parentOperationId: string;
49
+ parentRequestDigest: string;
50
+ parentTargetBindingDigest: string;
51
+ controlActionId: string;
52
+ action: "steer";
53
+ /** Digest of the child control request; never substituted for parent identity. */
54
+ requestDigest: string;
55
+ expectedAssistantTurnId: string;
56
+ /** Derived by the observation authority from the exact parent assistant. */
57
+ assistantBranchId: string;
58
+ assistantParentTurnId: string;
59
+ baselineSnapshotDigest: string;
60
+ preparedDigest: string;
61
+ /** Complete, redacted, immutable pre-steer ownership baseline. */
62
+ baseline: OwnershipBaseline;
63
+ }>;
64
+ /**
65
+ * Versioned, prompt-free material for the keyed prepared-action digest.
66
+ *
67
+ * The journal stores `preparedDigest`, not this material, but a restart must
68
+ * be able to reconstruct exactly what was authenticated from the durable
69
+ * action-prepared event. The browser primitive and its service adapter should
70
+ * pass this material (canonicalized by the adapter's digest authority) to the
71
+ * same keyed `work-steer-prepared` digest domain. Keeping the material here
72
+ * makes that contract explicit without making the coordinator depend on a
73
+ * key, browser, or journal implementation.
74
+ */
75
+ export declare const CONTROL_STEER_PREPARED_MATERIAL_SCHEMA_VERSION: "chatgpt.browser_control.production_work_steer.v1";
76
+ export type ControlSteerPreparedDigestMaterial = Readonly<{
77
+ schemaVersion: typeof CONTROL_STEER_PREPARED_MATERIAL_SCHEMA_VERSION;
78
+ operationId: string;
79
+ parentRequestDigest: string;
80
+ targetBindingDigest: string;
81
+ controlActionId: string;
82
+ action: "work_steer";
83
+ expectedAssistantTurnId: string;
84
+ assistantBranchId: string;
85
+ assistantParentTurnId: string;
86
+ baselineSnapshotDigest: string;
87
+ baseline: OwnershipBaseline;
88
+ }>;
89
+ /**
90
+ * Build the exact redacted digest material from either a prepared result or
91
+ * an atomic persistence request. This clones and freezes caller data so a
92
+ * later mutation/accessor cannot change what a service hashes or journals.
93
+ */
94
+ export declare function controlSteerPreparedDigestMaterial(value: Pick<ControlSteerPrepared, "parentOperationId" | "parentRequestDigest" | "parentTargetBindingDigest" | "controlActionId" | "expectedAssistantTurnId" | "assistantBranchId" | "assistantParentTurnId" | "baselineSnapshotDigest" | "baseline">): ControlSteerPreparedDigestMaterial;
95
+ /**
96
+ * Durable replay material. This is intentionally identity fields plus the
97
+ * complete OwnershipBaseline only. A service may map it to its
98
+ * `action_prepared` journal event; it must not add the request prompt.
99
+ */
100
+ export type ControlSteerDurableIntent = ControlSteerPrepared;
101
+ export type ControlSteerPrepareRequest = Readonly<{
102
+ schemaVersion: typeof CONTROL_COORDINATOR_SCHEMA_VERSION;
103
+ parentOperationId: string;
104
+ parentRequestDigest: string;
105
+ parentTargetBindingDigest: string;
106
+ controlActionId: string;
107
+ requestDigest: string;
108
+ expectedAssistantTurnId: string;
109
+ signal: AbortSignal;
110
+ deadlineAt: number;
111
+ }>;
112
+ export type ControlSteerExecutePreparedRequest = Readonly<{
113
+ schemaVersion: typeof CONTROL_COORDINATOR_SCHEMA_VERSION;
114
+ prepared: ControlSteerPrepared;
115
+ signal: AbortSignal;
116
+ deadlineAt: number;
117
+ }>;
118
+ export type ControlSteerVerifyRequest = Readonly<{
119
+ schemaVersion: typeof CONTROL_COORDINATOR_SCHEMA_VERSION;
120
+ prepared: ControlSteerPrepared;
121
+ signal: AbortSignal;
122
+ deadlineAt: number;
123
+ }>;
124
+ export type ControlSteerRecoverRequest = Readonly<{
125
+ schemaVersion: typeof CONTROL_COORDINATOR_SCHEMA_VERSION;
126
+ prepared: ControlSteerPrepared;
127
+ /** Caller-supplied authenticated baseline; must equal prepared.baseline. */
128
+ baseline: OwnershipBaseline;
129
+ signal: AbortSignal;
130
+ deadlineAt: number;
131
+ }>;
132
+ /** The only persistence argument exposed by the steer coordinator. */
133
+ export type ControlSteerIntentAndBaselinePersistenceRequest = Readonly<{
134
+ schemaVersion: typeof CONTROL_COORDINATOR_SCHEMA_VERSION;
135
+ parentOperationId: string;
136
+ parentRequestDigest: string;
137
+ parentTargetBindingDigest: string;
138
+ controlActionId: string;
139
+ action: "steer";
140
+ requestDigest: string;
141
+ expectedAssistantTurnId: string;
142
+ assistantBranchId: string;
143
+ assistantParentTurnId: string;
144
+ baselineSnapshotDigest: string;
145
+ preparedDigest: string;
146
+ baseline: OwnershipBaseline;
147
+ }>;
148
+ /**
149
+ * Atomic persistence reports an explicit disposition. In particular, a
150
+ * different unresolved action is a typed block, not a false execute flag that
151
+ * could accidentally send the caller down a recovery path for another action.
152
+ */
153
+ export type ControlSteerIntentAndBaselinePersistenceResult = Readonly<{
154
+ schemaVersion: typeof CONTROL_COORDINATOR_SCHEMA_VERSION;
155
+ disposition: "acquired";
156
+ }> | Readonly<{
157
+ schemaVersion: typeof CONTROL_COORDINATOR_SCHEMA_VERSION;
158
+ disposition: "same_action_recovery";
159
+ }> | Readonly<{
160
+ schemaVersion: typeof CONTROL_COORDINATOR_SCHEMA_VERSION;
161
+ disposition: "blocked";
162
+ blockerCode: "provider_concurrency_unsupported";
163
+ }>;
164
+ export type ControlSteerVerificationReceipt = Readonly<{
165
+ schemaVersion: typeof CONTROL_COORDINATOR_SCHEMA_VERSION;
166
+ baselineSnapshotDigest: string;
167
+ preparedDigest: string;
168
+ assistantTurnId: string;
169
+ assistantBranchId: string;
170
+ assistantParentTurnId: string;
171
+ userTurnId: string;
172
+ userTurnEvidenceDigest: string;
173
+ postSendDeltaDigest: string;
174
+ evidenceDigest: string;
175
+ }>;
176
+ type ControlSteerPhaseBase = Readonly<{
177
+ schemaVersion: typeof CONTROL_COORDINATOR_SCHEMA_VERSION;
178
+ phase: "prepare" | "execute_prepared" | "verify" | "recovery";
179
+ parentOperationId: string;
180
+ parentRequestDigest: string;
181
+ parentTargetBindingDigest: string;
182
+ controlActionId: string;
183
+ action: "steer";
184
+ requestDigest: string;
185
+ expectedAssistantTurnId: string;
186
+ assistantBranchId?: string;
187
+ assistantParentTurnId?: string;
188
+ baselineSnapshotDigest?: string;
189
+ preparedDigest?: string;
190
+ }>;
191
+ export type ControlSteerPhaseResult = (ControlSteerPhaseBase & Readonly<{
192
+ phase: "prepare";
193
+ status: "prepared";
194
+ observationRequired: false;
195
+ mutationBoundary: "none";
196
+ prepared: ControlSteerPrepared;
197
+ }>) | (ControlSteerPhaseBase & Readonly<{
198
+ phase: "execute_prepared";
199
+ status: "executed";
200
+ observationRequired: true;
201
+ mutationBoundary: "control_may_have_occurred";
202
+ }>) | (ControlSteerPhaseBase & Readonly<{
203
+ phase: "verify" | "recovery";
204
+ status: "satisfied";
205
+ observationRequired: false;
206
+ mutationBoundary: "control_may_have_occurred";
207
+ receipt: ControlSteerVerificationReceipt;
208
+ assistantBranchId: string;
209
+ assistantParentTurnId: string;
210
+ baselineSnapshotDigest: string;
211
+ preparedDigest: string;
212
+ }>) | (ControlSteerPhaseBase & Readonly<{
213
+ status: "blocked";
214
+ blockerCode: OperationBlockerCode;
215
+ observationRequired: boolean;
216
+ mutationBoundary: "none" | "control_may_have_occurred";
217
+ evidenceDigest?: string;
218
+ }>) | (ControlSteerPhaseBase & Readonly<{
219
+ status: "uncertain";
220
+ blockerCode: OperationBlockerCode;
221
+ observationRequired: true;
222
+ mutationBoundary: "control_may_have_occurred";
223
+ quarantine: "caller" | "provider";
224
+ evidenceDigest?: string;
225
+ }>);
226
+ export type ControlTurnObservation = Readonly<{
227
+ status: "generating";
228
+ assistantTurnId: string;
229
+ evidenceDigest: string;
230
+ } | {
231
+ status: "terminal" | "not_found" | "mismatch" | "uncertain";
232
+ assistantTurnId?: string;
233
+ evidenceDigest?: string;
234
+ reason?: "different_turn" | "not_generating" | "target_mismatch" | "unavailable";
235
+ }>;
236
+ export type ControlTurnObservationRequest = Readonly<{
237
+ operationId: string;
238
+ parentRequestDigest: string;
239
+ targetBindingDigest: string;
240
+ expectedAssistantTurnId: string;
241
+ signal: AbortSignal;
242
+ deadlineAt: number;
243
+ }>;
244
+ export type ControlPostconditionObservation = Readonly<{
245
+ status: "satisfied";
246
+ assistantTurnId: string;
247
+ evidenceDigest: string;
248
+ } | {
249
+ status: "not_satisfied";
250
+ assistantTurnId?: string;
251
+ blockerCode: OperationBlockerCode;
252
+ evidenceDigest?: string;
253
+ } | {
254
+ status: "uncertain";
255
+ assistantTurnId?: string;
256
+ blockerCode?: OperationBlockerCode;
257
+ evidenceDigest?: string;
258
+ }>;
259
+ export type ControlPostconditionRequest = Readonly<{
260
+ operationId: string;
261
+ parentRequestDigest: string;
262
+ targetBindingDigest: string;
263
+ action: "stop" | "steer";
264
+ controlActionId: string;
265
+ expectedAssistantTurnId: string;
266
+ requestDigest: string;
267
+ signal: AbortSignal;
268
+ deadlineAt: number;
269
+ }>;
270
+ export type ControlIntentPersistenceRequest = Readonly<{
271
+ operationId: string;
272
+ parentRequestDigest: string;
273
+ targetBindingDigest: string;
274
+ controlActionId: string;
275
+ /** The coordinator uses this compatibility port for Stop only. */
276
+ action: "stop" | "steer";
277
+ requestDigest: string;
278
+ }>;
279
+ export type ControlExecutionRequest = Readonly<{
280
+ operationId: string;
281
+ parentRequestDigest: string;
282
+ targetBindingDigest: string;
283
+ controlActionId: string;
284
+ action: "stop" | "steer";
285
+ expectedAssistantTurnId: string;
286
+ requestDigest: string;
287
+ /** Work steer never uses this compatibility port; its prompt stays in the browser primitive closure. */
288
+ signal: AbortSignal;
289
+ deadlineAt: number;
290
+ }>;
291
+ export type ControlExecutionResult = ControlPostconditionObservation;
292
+ export type ControlPostconditionRetryPolicy = Readonly<{
293
+ /** Total observations including the first immediate postcondition read. */
294
+ maxAttempts: number;
295
+ /** Delay between observation-only attempts; no browser actor is held while waiting. */
296
+ intervalMs: number;
297
+ }>;
298
+ /** Default bounded settle window for provider Stop controls. */
299
+ export declare const CONTROL_POSTCONDITION_RETRY_POLICY: ControlPostconditionRetryPolicy;
300
+ export type ControlReceiptPersistenceRequest = Readonly<{
301
+ receipt: OperationControlReceiptV1;
302
+ /** Rich per-action ownership evidence for Work-steer integration. */
303
+ steerReceipt?: ControlSteerVerificationReceipt;
304
+ }>;
305
+ export type ControlPorts = Readonly<{
306
+ readParent(request: ControlParentReadRequest): Promise<ControlParentSnapshot>;
307
+ observeTurn(request: ControlTurnObservationRequest): Promise<ControlTurnObservation>;
308
+ persistActionIntent(request: ControlIntentPersistenceRequest): Promise<void>;
309
+ executeOnce(request: ControlExecutionRequest): Promise<ControlExecutionResult>;
310
+ observePostcondition(request: ControlPostconditionRequest): Promise<ControlPostconditionObservation>;
311
+ postconditionRetry?: ControlPostconditionRetryPolicy;
312
+ persistReceipt(request: ControlReceiptPersistenceRequest): Promise<void>;
313
+ /** Read-only Work-steer preparation. No prompt crosses this boundary. */
314
+ prepareSteer?(request: ControlSteerPrepareRequest): Promise<ControlSteerPhaseResult>;
315
+ /** Atomic child intent + complete per-action baseline persistence. */
316
+ persistSteerIntentAndBaseline?(request: ControlSteerIntentAndBaselinePersistenceRequest): Promise<ControlSteerIntentAndBaselinePersistenceResult>;
317
+ /** One-shot Work-steer mutation. The port must await fill/click settlement. */
318
+ executeSteerPrepared?(request: ControlSteerExecutePreparedRequest): Promise<ControlSteerPhaseResult>;
319
+ /** Read-only postcondition after the same invocation's executePrepared. */
320
+ verifySteer?(request: ControlSteerVerifyRequest): Promise<ControlSteerPhaseResult>;
321
+ /** Read-only restart/quarantine recovery; never compose, fill, or click. */
322
+ recoverSteer?(request: ControlSteerRecoverRequest): Promise<ControlSteerPhaseResult>;
323
+ }>;
324
+ export type ControlOptions = Readonly<{
325
+ signal?: AbortSignal;
326
+ /** Absolute epoch milliseconds. The earlier of this and request timeout wins. */
327
+ deadlineAt?: number;
328
+ now?: () => number;
329
+ }>;
330
+ export type ControlBlocker = Readonly<{
331
+ code: OperationBlockerCode;
332
+ observationRequired: boolean;
333
+ mutationBoundary: MutationBoundary;
334
+ evidenceDigest?: string;
335
+ }>;
336
+ export type ControlResultBase = Readonly<{
337
+ controlActionId: string;
338
+ parentOperationId: string;
339
+ parentRequestDigest: string;
340
+ parentTargetBindingDigest: string;
341
+ requestDigest: string;
342
+ action: "stop" | "steer";
343
+ expectedAssistantTurnId: string;
344
+ }>;
345
+ export type ControlResult = (ControlResultBase & Readonly<{
346
+ kind: "completed";
347
+ receipt: OperationControlReceiptV1;
348
+ /** Present only after a verified Work-steer exact delta. */
349
+ steerReceipt?: ControlSteerVerificationReceipt;
350
+ }>) | (ControlResultBase & Readonly<{
351
+ kind: "blocked";
352
+ blocker: ControlBlocker;
353
+ receipt?: OperationControlReceiptV1;
354
+ steerReceipt?: ControlSteerVerificationReceipt;
355
+ }>) | (ControlResultBase & Readonly<{
356
+ kind: "uncertain";
357
+ blocker: ControlBlocker;
358
+ receipt?: OperationControlReceiptV1;
359
+ steerReceipt?: ControlSteerVerificationReceipt;
360
+ }>);
361
+ export declare class ControlInputError extends Error {
362
+ readonly code: OperationBlockerCode;
363
+ constructor(code: OperationBlockerCode, message: string);
364
+ }
365
+ /**
366
+ * Run one operation-bound control action. A durable action intent authorizes
367
+ * at most one executeOnce call. Any later call with the same action ID is
368
+ * observation-only, even when the previous call rejected after the provider
369
+ * may already have acted.
370
+ */
371
+ export declare function runOperationControl(request: OperationControlRequestV1, requestDigest: string, ports: ControlPorts, options?: ControlOptions): Promise<ControlResult>;
372
+ export {};