@proofoftech/flowsafe 0.20.0 → 0.21.0

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 (233) hide show
  1. package/CHANGELOG.md +81 -0
  2. package/README.md +55 -8
  3. package/deployment-identity-protocol.d.mts +28 -3
  4. package/deployment-identity-protocol.mjs +275 -21
  5. package/dist/agent-host/router.d.ts.map +1 -1
  6. package/dist/agent-host/router.js +11 -2
  7. package/dist/agent-host/router.js.map +1 -1
  8. package/dist/agent-host/thread-host.d.ts +3 -1
  9. package/dist/agent-host/thread-host.d.ts.map +1 -1
  10. package/dist/agent-host/thread-host.js +837 -332
  11. package/dist/agent-host/thread-host.js.map +1 -1
  12. package/dist/agent-host/thread-topology.d.ts +8 -0
  13. package/dist/agent-host/thread-topology.d.ts.map +1 -1
  14. package/dist/agent-host/thread-topology.js +239 -62
  15. package/dist/agent-host/thread-topology.js.map +1 -1
  16. package/dist/agent-runner/durable-agent-runner.d.ts +90 -6
  17. package/dist/agent-runner/durable-agent-runner.d.ts.map +1 -1
  18. package/dist/agent-runner/durable-agent-runner.js +371 -29
  19. package/dist/agent-runner/durable-agent-runner.js.map +1 -1
  20. package/dist/agent-runner/index.d.ts +1 -1
  21. package/dist/agent-runner/index.d.ts.map +1 -1
  22. package/dist/agent-runner/index.js.map +1 -1
  23. package/dist/approval-api/actor-context.d.ts +4 -0
  24. package/dist/approval-api/actor-context.d.ts.map +1 -1
  25. package/dist/approval-api/actor-context.js +53 -5
  26. package/dist/approval-api/actor-context.js.map +1 -1
  27. package/dist/approval-api/principal.d.ts +1 -1
  28. package/dist/approval-api/principal.js +1 -1
  29. package/dist/approval-api/retention.d.ts +1 -2
  30. package/dist/approval-api/retention.d.ts.map +1 -1
  31. package/dist/approval-api/retention.js.map +1 -1
  32. package/dist/approval-api/service.d.ts +10 -14
  33. package/dist/approval-api/service.d.ts.map +1 -1
  34. package/dist/approval-api/service.js +49 -22
  35. package/dist/approval-api/service.js.map +1 -1
  36. package/dist/audit-export/index.d.ts +2 -2
  37. package/dist/audit-export/index.js +2 -2
  38. package/dist/background-tasks/d1-storage.d.ts +4 -3
  39. package/dist/background-tasks/d1-storage.d.ts.map +1 -1
  40. package/dist/background-tasks/d1-storage.js +7 -13
  41. package/dist/background-tasks/d1-storage.js.map +1 -1
  42. package/dist/do-runner/constants.d.ts +3 -0
  43. package/dist/do-runner/constants.d.ts.map +1 -0
  44. package/dist/do-runner/constants.js +3 -0
  45. package/dist/do-runner/constants.js.map +1 -0
  46. package/dist/do-runner/d1-storage.d.ts +31 -157
  47. package/dist/do-runner/d1-storage.d.ts.map +1 -1
  48. package/dist/do-runner/d1-storage.js +933 -402
  49. package/dist/do-runner/d1-storage.js.map +1 -1
  50. package/dist/do-runner/durable-object.d.ts.map +1 -1
  51. package/dist/do-runner/durable-object.js +462 -175
  52. package/dist/do-runner/durable-object.js.map +1 -1
  53. package/dist/do-runner/execution-admission.d.ts +114 -0
  54. package/dist/do-runner/execution-admission.d.ts.map +1 -0
  55. package/dist/do-runner/execution-admission.js +206 -0
  56. package/dist/do-runner/execution-admission.js.map +1 -0
  57. package/dist/do-runner/execution-context.d.ts.map +1 -1
  58. package/dist/do-runner/execution-context.js +1 -0
  59. package/dist/do-runner/execution-context.js.map +1 -1
  60. package/dist/do-runner/execution-fence.d.ts +74 -30
  61. package/dist/do-runner/execution-fence.d.ts.map +1 -1
  62. package/dist/do-runner/execution-fence.js +684 -120
  63. package/dist/do-runner/execution-fence.js.map +1 -1
  64. package/dist/do-runner/fenced-workflow-capability.d.ts +64 -0
  65. package/dist/do-runner/fenced-workflow-capability.d.ts.map +1 -0
  66. package/dist/do-runner/fenced-workflow-capability.js +3 -0
  67. package/dist/do-runner/fenced-workflow-capability.js.map +1 -0
  68. package/dist/do-runner/fenced-workflows-d1.d.ts +15 -0
  69. package/dist/do-runner/fenced-workflows-d1.d.ts.map +1 -0
  70. package/dist/do-runner/fenced-workflows-d1.js +894 -0
  71. package/dist/do-runner/fenced-workflows-d1.js.map +1 -0
  72. package/dist/do-runner/index.d.ts +13 -8
  73. package/dist/do-runner/index.d.ts.map +1 -1
  74. package/dist/do-runner/index.js +6 -2
  75. package/dist/do-runner/index.js.map +1 -1
  76. package/dist/do-runner/initial-admission-refusal.d.ts +7 -0
  77. package/dist/do-runner/initial-admission-refusal.d.ts.map +1 -0
  78. package/dist/do-runner/initial-admission-refusal.js +41 -0
  79. package/dist/do-runner/initial-admission-refusal.js.map +1 -0
  80. package/dist/do-runner/inventory.d.ts +2 -1
  81. package/dist/do-runner/inventory.d.ts.map +1 -1
  82. package/dist/do-runner/inventory.js +28 -39
  83. package/dist/do-runner/inventory.js.map +1 -1
  84. package/dist/do-runner/notification-predicate.d.ts +7 -7
  85. package/dist/do-runner/notification-predicate.d.ts.map +1 -1
  86. package/dist/do-runner/notification-predicate.js +134 -7
  87. package/dist/do-runner/notification-predicate.js.map +1 -1
  88. package/dist/do-runner/run-lifecycle.d.ts +20 -1
  89. package/dist/do-runner/run-lifecycle.d.ts.map +1 -1
  90. package/dist/do-runner/run-lifecycle.js +67 -13
  91. package/dist/do-runner/run-lifecycle.js.map +1 -1
  92. package/dist/do-runner/run-provenance.d.ts +38 -0
  93. package/dist/do-runner/run-provenance.d.ts.map +1 -0
  94. package/dist/do-runner/run-provenance.js +152 -0
  95. package/dist/do-runner/run-provenance.js.map +1 -0
  96. package/dist/do-runner/run-storage-tables.d.ts +2 -0
  97. package/dist/do-runner/run-storage-tables.d.ts.map +1 -0
  98. package/dist/do-runner/run-storage-tables.js +4 -0
  99. package/dist/do-runner/run-storage-tables.js.map +1 -0
  100. package/dist/do-runner/run-terminal-state.d.ts +29 -0
  101. package/dist/do-runner/run-terminal-state.d.ts.map +1 -0
  102. package/dist/do-runner/run-terminal-state.js +105 -0
  103. package/dist/do-runner/run-terminal-state.js.map +1 -0
  104. package/dist/do-runner/runtime.d.ts +108 -46
  105. package/dist/do-runner/runtime.d.ts.map +1 -1
  106. package/dist/do-runner/runtime.js +927 -438
  107. package/dist/do-runner/runtime.js.map +1 -1
  108. package/dist/do-runner/start-idempotency.d.ts +35 -258
  109. package/dist/do-runner/start-idempotency.d.ts.map +1 -1
  110. package/dist/do-runner/start-idempotency.js +602 -494
  111. package/dist/do-runner/start-idempotency.js.map +1 -1
  112. package/dist/do-runner/start-reservation-contract.d.ts +103 -0
  113. package/dist/do-runner/start-reservation-contract.d.ts.map +1 -0
  114. package/dist/do-runner/start-reservation-contract.js +338 -0
  115. package/dist/do-runner/start-reservation-contract.js.map +1 -0
  116. package/dist/do-runner/suspension-deadline.d.ts +4 -11
  117. package/dist/do-runner/suspension-deadline.d.ts.map +1 -1
  118. package/dist/do-runner/suspension-deadline.js +8 -12
  119. package/dist/do-runner/suspension-deadline.js.map +1 -1
  120. package/dist/do-runner/table-prefix.d.ts.map +1 -1
  121. package/dist/do-runner/table-prefix.js +2 -1
  122. package/dist/do-runner/table-prefix.js.map +1 -1
  123. package/dist/do-runner/testing.d.ts +3 -0
  124. package/dist/do-runner/testing.d.ts.map +1 -0
  125. package/dist/do-runner/testing.js +3 -0
  126. package/dist/do-runner/testing.js.map +1 -0
  127. package/dist/do-runner/thread-do.d.ts +2 -1
  128. package/dist/do-runner/thread-do.d.ts.map +1 -1
  129. package/dist/do-runner/thread-do.js +14 -10
  130. package/dist/do-runner/thread-do.js.map +1 -1
  131. package/dist/do-runner/workflow-snapshot-row.d.ts +49 -0
  132. package/dist/do-runner/workflow-snapshot-row.d.ts.map +1 -0
  133. package/dist/do-runner/workflow-snapshot-row.js +97 -0
  134. package/dist/do-runner/workflow-snapshot-row.js.map +1 -0
  135. package/dist/goals/objective-routes.d.ts +1 -5
  136. package/dist/goals/objective-routes.d.ts.map +1 -1
  137. package/dist/goals/objective-routes.js +32 -53
  138. package/dist/goals/objective-routes.js.map +1 -1
  139. package/dist/host-kit/approval-bridge.d.ts.map +1 -1
  140. package/dist/host-kit/approval-bridge.js +10 -7
  141. package/dist/host-kit/approval-bridge.js.map +1 -1
  142. package/dist/host-kit/do-response.d.ts +16 -0
  143. package/dist/host-kit/do-response.d.ts.map +1 -1
  144. package/dist/host-kit/do-response.js +181 -0
  145. package/dist/host-kit/do-response.js.map +1 -1
  146. package/dist/host-kit/do-run-topology.d.ts +2 -14
  147. package/dist/host-kit/do-run-topology.d.ts.map +1 -1
  148. package/dist/host-kit/do-run-topology.js +31 -24
  149. package/dist/host-kit/do-run-topology.js.map +1 -1
  150. package/dist/host-kit/env-vars.d.ts.map +1 -1
  151. package/dist/host-kit/env-vars.js +5 -6
  152. package/dist/host-kit/env-vars.js.map +1 -1
  153. package/dist/host-kit/flowsafe-worker.d.ts +38 -6
  154. package/dist/host-kit/flowsafe-worker.d.ts.map +1 -1
  155. package/dist/host-kit/flowsafe-worker.js +110 -93
  156. package/dist/host-kit/flowsafe-worker.js.map +1 -1
  157. package/dist/host-kit/host-approval-service.d.ts +4 -14
  158. package/dist/host-kit/host-approval-service.d.ts.map +1 -1
  159. package/dist/host-kit/host-approval-service.js +23 -40
  160. package/dist/host-kit/host-approval-service.js.map +1 -1
  161. package/dist/host-kit/index.d.ts +7 -1
  162. package/dist/host-kit/index.d.ts.map +1 -1
  163. package/dist/host-kit/index.js +4 -0
  164. package/dist/host-kit/index.js.map +1 -1
  165. package/dist/host-kit/run-route-error.d.ts +3 -17
  166. package/dist/host-kit/run-route-error.d.ts.map +1 -1
  167. package/dist/host-kit/run-route-error.js +4 -24
  168. package/dist/host-kit/run-route-error.js.map +1 -1
  169. package/dist/host-kit/run-router.d.ts +6 -2
  170. package/dist/host-kit/run-router.d.ts.map +1 -1
  171. package/dist/host-kit/run-router.js +93 -80
  172. package/dist/host-kit/run-router.js.map +1 -1
  173. package/dist/host-kit/thread-topology.d.ts +1 -1
  174. package/dist/host-kit/thread-topology.d.ts.map +1 -1
  175. package/dist/host-kit/thread-topology.js +7 -3
  176. package/dist/host-kit/thread-topology.js.map +1 -1
  177. package/dist/internal-error-response.d.ts.map +1 -1
  178. package/dist/internal-error-response.js +16 -6
  179. package/dist/internal-error-response.js.map +1 -1
  180. package/dist/schedules/index.d.ts +1 -0
  181. package/dist/schedules/index.d.ts.map +1 -1
  182. package/dist/schedules/index.js +1 -7
  183. package/dist/schedules/index.js.map +1 -1
  184. package/dist/schedules/mutation-contract.d.ts +38 -0
  185. package/dist/schedules/mutation-contract.d.ts.map +1 -0
  186. package/dist/schedules/mutation-contract.js +21 -0
  187. package/dist/schedules/mutation-contract.js.map +1 -0
  188. package/dist/schedules/router.d.ts +11 -19
  189. package/dist/schedules/router.d.ts.map +1 -1
  190. package/dist/schedules/router.js +130 -49
  191. package/dist/schedules/router.js.map +1 -1
  192. package/dist/schedules/schedules-d1.d.ts +11 -5
  193. package/dist/schedules/schedules-d1.d.ts.map +1 -1
  194. package/dist/schedules/schedules-d1.js +570 -143
  195. package/dist/schedules/schedules-d1.js.map +1 -1
  196. package/dist/schedules/storage.d.ts +0 -7
  197. package/dist/schedules/storage.d.ts.map +1 -1
  198. package/dist/schedules/storage.js +0 -27
  199. package/dist/schedules/storage.js.map +1 -1
  200. package/dist/schedules/tick.d.ts.map +1 -1
  201. package/dist/schedules/tick.js +7 -1
  202. package/dist/schedules/tick.js.map +1 -1
  203. package/dist/signal-providers/webhook-route.d.ts +1 -1
  204. package/dist/signal-providers/webhook-route.d.ts.map +1 -1
  205. package/dist/signal-providers/webhook-route.js +99 -109
  206. package/dist/signal-providers/webhook-route.js.map +1 -1
  207. package/dist/signals/d1-shared.d.ts +11 -8
  208. package/dist/signals/d1-shared.d.ts.map +1 -1
  209. package/dist/signals/d1-shared.js +1 -6
  210. package/dist/signals/d1-shared.js.map +1 -1
  211. package/dist/signals/index.d.ts +1 -1
  212. package/dist/signals/index.d.ts.map +1 -1
  213. package/dist/signals/index.js +1 -1
  214. package/dist/signals/index.js.map +1 -1
  215. package/dist/signals/notification-dispatch.d.ts +96 -5
  216. package/dist/signals/notification-dispatch.d.ts.map +1 -1
  217. package/dist/signals/notification-dispatch.js +418 -53
  218. package/dist/signals/notification-dispatch.js.map +1 -1
  219. package/dist/signals/notifications-d1.d.ts +6 -1
  220. package/dist/signals/notifications-d1.d.ts.map +1 -1
  221. package/dist/signals/notifications-d1.js +215 -10
  222. package/dist/signals/notifications-d1.js.map +1 -1
  223. package/dist/signals/router.d.ts +6 -4
  224. package/dist/signals/router.d.ts.map +1 -1
  225. package/dist/signals/router.js +49 -84
  226. package/dist/signals/router.js.map +1 -1
  227. package/dist/signals/thread-do-routes.d.ts +2 -0
  228. package/dist/signals/thread-do-routes.d.ts.map +1 -1
  229. package/dist/signals/thread-do-routes.js +252 -73
  230. package/dist/signals/thread-do-routes.js.map +1 -1
  231. package/package.json +6 -3
  232. package/patches/@mastra__core@1.53.0.patch +54 -0
  233. package/scripts/seed-deployment-identity.mjs +12 -5
@@ -1,5 +1,9 @@
1
- import { EXECUTION_FENCE_STATES } from '#deployment-identity-protocol';
1
+ import { type DeploymentIdentityProtocolRow, EXECUTION_FENCE_STATES } from '#deployment-identity-protocol';
2
2
  import { DoStatusError } from './do-status-error.js';
3
+ import { type D1RunExecutionIdentity, type D1StartExecutionIdentity, ExecutionFenceUnreadableError, type ProofEntryExpectation, type RunExecutionIdentity } from './execution-admission.js';
4
+ import { type StartReservationReading } from './start-reservation-contract.js';
5
+ import { type D1RunAddress } from './workflow-snapshot-row.js';
6
+ export { ExecutionFenceUnreadableError } from './execution-admission.js';
3
7
  /**
4
8
  * The state vocabulary, the table, that table's fixed row key, and the DDL
5
9
  * built from all three are IMPORTED, never declared here — and they are not
@@ -57,9 +61,20 @@ export interface ExecutionFenceReading {
57
61
  readonly proofKey?: string;
58
62
  /** The run the proof-only state has already admitted, once one started. */
59
63
  readonly proofRunId?: string;
64
+ readonly mutationEpoch?: number;
65
+ readonly requireMutationEpoch?: boolean;
66
+ readonly transitionRevision?: number;
67
+ /** Server-side proof identity; omitted from the admin JSON projection. */
68
+ readonly proofExecution?: D1RunExecutionIdentity;
69
+ }
70
+ /** An authoritative store reading, including durable administrative versioning. */
71
+ export interface ExecutionFenceVersionedReading extends ExecutionFenceReading {
72
+ readonly mutationEpoch: number;
73
+ readonly requireMutationEpoch: boolean;
74
+ readonly transitionRevision: number;
60
75
  }
61
76
  /** The reading every unfenced surface uses — see `ExecutionFenceStore` absence. */
62
- export declare const OPEN_EXECUTION_FENCE: ExecutionFenceReading;
77
+ export declare const OPEN_EXECUTION_FENCE: ExecutionFenceVersionedReading;
63
78
  /**
64
79
  * Read the fence a surface was wired with, resolving the typed opt-out.
65
80
  *
@@ -76,7 +91,7 @@ export declare const OPEN_EXECUTION_FENCE: ExecutionFenceReading;
76
91
  * same reason `'none'` does, and never as a silent default a host can reach by
77
92
  * forgetting — the option types that feed this are required.
78
93
  */
79
- export declare function readExecutionFence(fence: ExecutionFenceWiring | undefined): Promise<ExecutionFenceReading>;
94
+ export declare function readExecutionFence(fence: ExecutionFenceWiring | undefined): Promise<ExecutionFenceVersionedReading>;
80
95
  export declare function executionFenceFor(db: ExecutionFenceDatabase): ExecutionFenceStore;
81
96
  /**
82
97
  * Minimal structural D1 surface, the same posture as SnapshotDatabase and
@@ -125,21 +140,17 @@ export declare class FenceTransitionConflictError extends DoStatusError {
125
140
  readonly reason: {
126
141
  readonly code: 'FENCE_CAS_CONFLICT';
127
142
  readonly state: ExecutionFenceState;
143
+ readonly mutationEpoch?: number;
144
+ readonly requireMutationEpoch?: boolean;
145
+ readonly transitionRevision?: number;
146
+ readonly proofKey?: string;
147
+ readonly proofRunId?: string;
148
+ readonly conflict?: 'expectation-mismatch' | 'versioned-expectation-required';
128
149
  };
129
- constructor(expected: ExecutionFenceState, current: ExecutionFenceState);
130
- }
131
- /**
132
- * The fence could not be READ. Deliberately distinct from
133
- * ExecutionFencedError: no state was observed, so nothing may conclude the
134
- * deployment is open — which is why this carries the same 503 a refusal does
135
- * and every request-path caller lets it propagate.
136
- */
137
- export declare class ExecutionFenceUnreadableError extends DoStatusError {
138
- readonly status = 503;
139
- readonly reason: {
140
- readonly code: 'EXECUTION_FENCE_UNREADABLE';
141
- };
142
- constructor(message: string, options?: ErrorOptions);
150
+ constructor(expected: ExecutionFenceState, current: ExecutionFenceState, details?: {
151
+ reading: ExecutionFenceVersionedReading;
152
+ conflict: 'expectation-mismatch' | 'versioned-expectation-required';
153
+ });
143
154
  }
144
155
  /**
145
156
  * Render a fence refusal as the JSON response the taxonomy specifies.
@@ -161,11 +172,8 @@ export declare function executionFencedResponse(state: ExecutionFenceState, entr
161
172
  * null would invite a caller to read "no proof run yet" out of a state that has
162
173
  * no proof at all.
163
174
  */
164
- export declare function executionFenceReadingPayload(reading: ExecutionFenceReading): {
165
- state: ExecutionFenceState;
166
- proofKey?: string;
167
- proofRunId?: string;
168
- };
175
+ export declare function executionFenceReadingPayload(reading: ExecutionFenceVersionedReading): ExecutionFenceVersionedReading;
176
+ export declare function executionFenceReadingPayload(reading: ExecutionFenceReading): ExecutionFenceReading;
169
177
  /**
170
178
  * A fence refusal that CROSSED a Durable Object boundary and was rebuilt on the
171
179
  * far side.
@@ -203,7 +211,7 @@ export type ExecutionFenceRefusal = ExecutionFencedError | ExecutionFenceUnreada
203
211
  *
204
212
  * The two codes are matched by name rather than by any structural sniff: only
205
213
  * refusals this package authors publish them, and both are declared as literals
206
- * on the classes above, so a code arriving over the wire came from one of them.
214
+ * on the corresponding error classes, so a code arriving over the wire came from one of them.
207
215
  */
208
216
  export declare function isExecutionFenceRefusal(error: unknown): error is ExecutionFenceRefusal;
209
217
  /**
@@ -235,7 +243,7 @@ export declare function admitsRunStart(reading: ExecutionFenceReading, idempoten
235
243
  * never finish, because finishing is what the suspended runs are waiting for.
236
244
  * In proof-only, only the nominated run.
237
245
  */
238
- export declare function admitsExistingRun(reading: ExecutionFenceReading, runId?: string): boolean;
246
+ export declare function admitsExistingRun(reading: ExecutionFenceReading, candidate?: string | RunExecutionIdentity): boolean;
239
247
  /**
240
248
  * May standing configuration that ARMS future work be authored — a schedule
241
249
  * created/updated/resumed, an objective set, a due schedule fire claimed?
@@ -250,6 +258,27 @@ export declare function admitsWorkAuthoring(reading: ExecutionFenceReading): boo
250
258
  * queue re-driving itself alongside it is not a proof of anything.
251
259
  */
252
260
  export declare function admitsDrainableExecution(reading: ExecutionFenceReading): boolean;
261
+ /** @internal Exact current-stage observation for initial admission. */
262
+ export interface ExecutionFenceAdmissionObservation {
263
+ readonly reading: ExecutionFenceVersionedReading;
264
+ readonly schemaStage: 7;
265
+ readonly raw: DeploymentIdentityProtocolRow;
266
+ }
267
+ /** @internal */
268
+ export declare function executionFenceAdmissionValues(observation: ExecutionFenceAdmissionObservation): readonly unknown[];
269
+ /** @internal */
270
+ export declare function executionFenceAdmissionSql(input: {
271
+ readonly callerEpoch: string;
272
+ readonly semantic: readonly string[];
273
+ readonly schema: string;
274
+ readonly statePredicate: string;
275
+ }): string;
276
+ /** @internal Validate an already-observed current-schema RETURNING row. */
277
+ export declare function decodeExecutionFenceAdmissionRow(row: DeploymentIdentityProtocolRow): ExecutionFenceAdmissionObservation;
278
+ /** @internal Validate actual PRAGMA rows from a consistent readback batch. */
279
+ export declare function validateExecutionFenceAdmissionSchema(result: unknown): Promise<void>;
280
+ /** @internal */
281
+ export declare function captureExecutionFenceAdmissionSchema(result: unknown): Promise<string>;
253
282
  export interface ExecutionFenceStoreOptions {
254
283
  /** Injectable clock for `updated_at` (tests, deterministic fixtures). */
255
284
  now?: () => number;
@@ -271,6 +300,9 @@ export interface ExecutionFenceTransition {
271
300
  * field exists to police arrived pre-blessed at the type level.
272
301
  */
273
302
  proofKey?: unknown;
303
+ expectedMutationEpoch?: unknown;
304
+ expectedRevision?: unknown;
305
+ advanceMutationEpoch?: unknown;
274
306
  }
275
307
  /**
276
308
  * The deployment's fence, over one D1 database — the SAME database the runner's
@@ -288,11 +320,13 @@ export declare class ExecutionFenceStore {
288
320
  * question, and would turn a read-only replica or a revoked-write incident
289
321
  * into an outage instead of a degrade.
290
322
  *
291
- * A missing table and a missing row both read as `open` — the 0.19 upgrade
292
- * rule. Anything else that fails becomes ExecutionFenceUnreadableError, so
293
- * no caller can mistake a storage fault for an open deployment.
323
+ * A missing table or missing legacy row reads as `open`. A missing modern row is
324
+ * unreadable and is never silently recreated.
294
325
  */
295
- read(): Promise<ExecutionFenceReading>;
326
+ read(): Promise<ExecutionFenceVersionedReading>;
327
+ usesDatabase(binding: object): boolean;
328
+ /** @internal Pure strict observation; seed only on the admission preparation path. */
329
+ readForAdmission(): Promise<ExecutionFenceAdmissionObservation>;
296
330
  /**
297
331
  * Provisioning-time seeding: write the deployment's INITIAL fence state.
298
332
  *
@@ -319,7 +353,7 @@ export declare class ExecutionFenceStore {
319
353
  * state the implicit reading already reported, so the CAS that follows means
320
354
  * exactly what it would have meant on a seeded database.
321
355
  */
322
- transition(input: ExecutionFenceTransition): Promise<ExecutionFenceReading>;
356
+ transition(input: ExecutionFenceTransition): Promise<ExecutionFenceVersionedReading>;
323
357
  /**
324
358
  * Bind the proof-only state to the run it admitted, conditionally.
325
359
  *
@@ -330,6 +364,16 @@ export declare class ExecutionFenceStore {
330
364
  * Re-writing the SAME runId is admitted so a retry of an interrupted start
331
365
  * converges instead of deadlocking on its own earlier write.
332
366
  */
333
- recordProofRun(proofKey: string, runId: string): Promise<boolean>;
367
+ recordProofRun(proofKey: string, runId: string, admitted?: Pick<ExecutionFenceVersionedReading, 'mutationEpoch' | 'transitionRevision'>): Promise<boolean>;
368
+ readCurrentRunExecution(address: D1RunAddress): Promise<D1RunExecutionIdentity | undefined>;
369
+ rebindProofRun(options: {
370
+ reservation: StartReservationReading;
371
+ execution: D1StartExecutionIdentity;
372
+ proof: ProofEntryExpectation;
373
+ mutationEpoch?: number;
374
+ reservationStore: {
375
+ usesDatabase(binding: object): boolean;
376
+ };
377
+ }): Promise<boolean>;
334
378
  }
335
379
  //# sourceMappingURL=execution-fence.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"execution-fence.d.ts","sourceRoot":"","sources":["../../src/do-runner/execution-fence.ts"],"names":[],"mappings":"AAyCA,OA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