@microdelta/history 0.0.0 → 0.1.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 (71) hide show
  1. package/README.md +19 -4
  2. package/dist/api/history.alpha.d.ts +3 -0
  3. package/dist/api/history.beta.d.ts +3 -0
  4. package/dist/api/history.conformance.store.alpha.d.ts +3 -0
  5. package/dist/api/history.conformance.store.beta.d.ts +3 -0
  6. package/dist/api/history.conformance.store.public.d.ts +3 -0
  7. package/dist/api/history.conformance.store.raw.alpha.d.ts +215 -0
  8. package/dist/api/history.conformance.store.raw.beta.d.ts +215 -0
  9. package/dist/api/history.conformance.store.raw.public.d.ts +215 -0
  10. package/dist/api/history.conformance.store.raw.untrimmed.d.ts +215 -0
  11. package/dist/api/history.conformance.store.untrimmed.d.ts +3 -0
  12. package/dist/api/history.public.d.ts +3 -0
  13. package/dist/api/history.root.raw.alpha.d.ts +1058 -0
  14. package/dist/api/history.root.raw.beta.d.ts +393 -0
  15. package/dist/api/history.root.raw.public.d.ts +393 -0
  16. package/dist/api/history.root.raw.untrimmed.d.ts +1059 -0
  17. package/dist/api/history.shared.alpha.d.ts +1091 -0
  18. package/dist/api/history.shared.beta.d.ts +426 -0
  19. package/dist/api/history.shared.public.d.ts +426 -0
  20. package/dist/api/history.shared.untrimmed.d.ts +1092 -0
  21. package/dist/api/history.untrimmed.d.ts +3 -0
  22. package/dist/api/tsdoc-metadata.json +11 -0
  23. package/dist/src/completed-results.d.ts +99 -0
  24. package/dist/src/completed-results.d.ts.map +1 -0
  25. package/dist/src/completed-results.js +2 -0
  26. package/dist/src/completed-results.js.map +1 -0
  27. package/dist/src/durable/contracts.d.ts +339 -0
  28. package/dist/src/durable/contracts.d.ts.map +1 -0
  29. package/dist/src/durable/contracts.js +2 -0
  30. package/dist/src/durable/contracts.js.map +1 -0
  31. package/dist/src/durable/errors.d.ts +69 -0
  32. package/dist/src/durable/errors.d.ts.map +1 -0
  33. package/dist/src/durable/errors.js +87 -0
  34. package/dist/src/durable/errors.js.map +1 -0
  35. package/dist/src/durable/index.d.ts +9 -0
  36. package/dist/src/durable/index.d.ts.map +1 -0
  37. package/dist/src/durable/index.js +590 -0
  38. package/dist/src/durable/index.js.map +1 -0
  39. package/dist/src/durable/locator.d.ts +31 -0
  40. package/dist/src/durable/locator.d.ts.map +1 -0
  41. package/dist/src/durable/locator.js +50 -0
  42. package/dist/src/durable/locator.js.map +1 -0
  43. package/dist/src/durable/schema.d.ts +28 -0
  44. package/dist/src/durable/schema.d.ts.map +1 -0
  45. package/dist/src/durable/schema.js +266 -0
  46. package/dist/src/durable/schema.js.map +1 -0
  47. package/dist/src/durable/selected-index.d.ts +94 -0
  48. package/dist/src/durable/selected-index.d.ts.map +1 -0
  49. package/dist/src/durable/selected-index.js +592 -0
  50. package/dist/src/durable/selected-index.js.map +1 -0
  51. package/dist/src/index.d.ts +26 -0
  52. package/dist/src/index.d.ts.map +1 -0
  53. package/dist/src/index.js +13 -0
  54. package/dist/src/index.js.map +1 -0
  55. package/dist/src/store/index.d.ts +128 -0
  56. package/dist/src/store/index.d.ts.map +1 -0
  57. package/dist/src/store/index.js +33 -0
  58. package/dist/src/store/index.js.map +1 -0
  59. package/dist/src/store/memory/index.d.ts +24 -0
  60. package/dist/src/store/memory/index.d.ts.map +1 -0
  61. package/dist/src/store/memory/index.js +162 -0
  62. package/dist/src/store/memory/index.js.map +1 -0
  63. package/dist/src/types.d.ts +100 -0
  64. package/dist/src/types.d.ts.map +1 -0
  65. package/dist/src/types.js +2 -0
  66. package/dist/src/types.js.map +1 -0
  67. package/dist/test/conformance/store/index.d.ts +34 -0
  68. package/dist/test/conformance/store/index.d.ts.map +1 -0
  69. package/dist/test/conformance/store/index.js +368 -0
  70. package/dist/test/conformance/store/index.js.map +1 -0
  71. package/package.json +48 -8
@@ -0,0 +1,1058 @@
1
+ /**
2
+ * Result History & Publication. This entry exposes the existing row Store,
3
+ * its memory adapter and compatibility schema unchanged, the exact
4
+ * completed-result reading ports, and the project-private alpha durable
5
+ * authority that owns attempts, the single logical writer, atomic publication
6
+ * and acceptance records. It never decides candidate validity or freshness.
7
+ * @packageDocumentation
8
+ */
9
+
10
+ /**
11
+ * An attempt key is already bound to a different execution intent, version
12
+ * or scoped subject. The key identifies one execution; it cannot serve another.
13
+ * @alpha
14
+ */
15
+ export declare class AttemptConflictError extends Error {
16
+ /** Create an execution-identity conflict with a diagnostic message. */
17
+ constructor(message: string);
18
+ }
19
+
20
+ /**
21
+ * A lifecycle operation was requested from a state that does not permit it,
22
+ * such as staging a completed attempt or publishing one that was never staged.
23
+ * @alpha
24
+ */
25
+ export declare class AttemptStateError extends Error {
26
+ /** Create an invalid-transition rejection with a diagnostic message. */
27
+ constructor(message: string);
28
+ }
29
+
30
+ /**
31
+ * Create a memory Store with linearizable CAS in a single JavaScript isolate.
32
+ * Each mutation snapshots its arguments before checking and changing the maps;
33
+ * the qualifying check and write have no await or caller callback between them.
34
+ * Values and fingerprints have separate indexes, so verification never touches
35
+ * payloads. The injected snapshot capability owns its supported value domain
36
+ * and failure behavior. This is a test backend, not durable or shared across
37
+ * processes.
38
+ *
39
+ * Only row storage is implemented here. Publication across multiple rows,
40
+ * generation allocation, lease ownership, and reclamation belong to higher layers.
41
+ * @public
42
+ */
43
+ export declare function createMemoryStore(capability: ISnapshotCapability, options?: MemoryStoreOptions): Store;
44
+
45
+ /** The first observed difference in a persisted read or a nested verification. @public */
46
+ export declare type Divergence = {
47
+ read: RecordedRead;
48
+ was: Fingerprint;
49
+ now: Fingerprint | 'missing';
50
+ } | {
51
+ read: Extract<RecordedRead, {
52
+ kind: 'memo';
53
+ }>;
54
+ nested: Divergence;
55
+ };
56
+
57
+ /** Insert-only storage encountered an existing complete tuple. @public */
58
+ export declare class DuplicateRowError extends Error {
59
+ /** Identify an insert conflict without modifying the retained row. @public */
60
+ constructor(message?: string);
61
+ }
62
+
63
+ /** An immutable value node and its caller-computed fingerprint. @public */
64
+ export declare interface FieldRow {
65
+ key: ResultKey;
66
+ generation: number;
67
+ path: Path;
68
+ fingerprint: Fingerprint;
69
+ value: unknown;
70
+ }
71
+
72
+ /**
73
+ * Compatibility shapes for the scaffold row Store. Their names and string paths
74
+ * describe that storage port, not the target Value Semantics or identity model.
75
+ */
76
+ /** Opaque, stable, hex-encoded content digest; equality is string equality. @public */
77
+ export declare type Fingerprint = string & {
78
+ readonly __fp: unique symbol;
79
+ };
80
+
81
+ /** Stored fingerprints cannot be compared with this runtime's algorithm. @public */
82
+ export declare class FingerprintAlgorithmMismatchError extends Error {
83
+ /** Name both identifiers so migrations are explicit rather than silent misses. @public */
84
+ constructor(storedAlgorithm: string, runtimeAlgorithm: string);
85
+ }
86
+
87
+ /** Writable generation columns; tuple identity cannot change after insertion. @public */
88
+ export declare type GenerationPatch = Partial<Omit<GenerationRow, 'key' | 'generation'>>;
89
+
90
+ /** A retained attempt, with lifecycle and numbering supplied by its caller. @public */
91
+ export declare interface GenerationRow {
92
+ key: ResultKey;
93
+ generation: number;
94
+ state: GenerationState;
95
+ reads: RecordedRead[];
96
+ identity: Identity | undefined;
97
+ startedAt: number;
98
+ endedAt: number | null;
99
+ cost: Record<string, number>;
100
+ arrival: string;
101
+ abandonReason?: 'error' | 'lease-expired' | 'refused';
102
+ error?: {
103
+ message: string;
104
+ stack?: string;
105
+ };
106
+ }
107
+
108
+ /** Retained lifecycle states interpreted by repository and claim, not by storage. @public */
109
+ export declare type GenerationState = 'claimed' | 'current' | 'superseded' | 'abandoned';
110
+
111
+ /**
112
+ * The injected clock failed to produce a nonnegative safe-integer epoch
113
+ * millisecond reading, so the time-dependent operation was refused unchanged.
114
+ * @alpha
115
+ */
116
+ export declare class HistoryClockError extends Error {
117
+ /** Create a clock refusal with a diagnostic message. */
118
+ constructor(message: string);
119
+ }
120
+
121
+ /**
122
+ * The store's contents contradict History's invariants or the caller's exact
123
+ * reference: a malformed, missing or wrong-scope reference, a dangling
124
+ * dependency, or index/payload content that does not match its digests.
125
+ * History never repairs such a failure by following a current pointer or
126
+ * recomputing.
127
+ * @alpha
128
+ */
129
+ export declare class HistoryIntegrityError extends Error {
130
+ /** Create an integrity failure with a diagnostic message. */
131
+ constructor(message: string);
132
+ }
133
+
134
+ /**
135
+ * The SQLite file does not hold exactly History's supported schema for the
136
+ * requested logical store: unknown, incomplete, foreign or differently
137
+ * versioned storage is rejected before any work rather than migrated by guess.
138
+ * @alpha
139
+ */
140
+ export declare class HistorySchemaError extends Error {
141
+ /** Create a schema rejection with a diagnostic message. */
142
+ constructor(message: string);
143
+ }
144
+
145
+ /** Ends an incomplete attempt without a result, preserving its evidence. @alpha */
146
+ export declare interface IAbandonRequest {
147
+ /** The incomplete attempt to end. */
148
+ readonly attemptId: number;
149
+ /** Whether execution failed or was interrupted. */
150
+ readonly outcome: 'failed' | 'interrupted';
151
+ /** Owner-defined evidence of what happened. */
152
+ readonly evidence: IVersionedRecord;
153
+ }
154
+
155
+ /** One immutable current-acceptance record, separate from the result it names. @alpha */
156
+ export declare interface IAcceptanceRecord {
157
+ /** Store-wide never-reused acceptance identity, increasing in record order. */
158
+ readonly acceptanceId: number;
159
+ /** The accepted exact result. */
160
+ readonly reference: ICompletedResultReference;
161
+ /** The writer fence under which the acceptance was recorded. */
162
+ readonly fence: number;
163
+ /** Resolution's acceptance evidence, decoded and frozen. */
164
+ readonly evidence: IVersionedRecord;
165
+ /** Exact results the verification followed, in recorded order. */
166
+ readonly dependencies: readonly ICompletedResultReference[];
167
+ }
168
+
169
+ /**
170
+ * Records that an existing completed result was accepted by a current
171
+ * verification. It needs writer ownership to write, but no attempt: a valid
172
+ * hit claims no execution. The evidence names the current dependencies the
173
+ * verification followed, which may differ from the original provenance.
174
+ * @alpha
175
+ */
176
+ export declare interface IAcceptanceRequest {
177
+ /** The exact completed result that was accepted. */
178
+ readonly reference: ICompletedResultReference;
179
+ /** Resolution's versioned acceptance evidence. */
180
+ readonly evidence: IVersionedRecord;
181
+ /** Exact completed results the current verification followed. */
182
+ readonly dependencies: readonly ICompletedResultReference[];
183
+ }
184
+
185
+ /** @alpha A path segment whose kind follows the container's operation semantics. */
186
+ export declare type IAddressSegment =
187
+ /** A literal string-keyed record lookup, including keys containing punctuation. */
188
+ {
189
+ readonly kind: 'property';
190
+ readonly key: string;
191
+ }
192
+ /** A positional array lookup; it does not designate a logical member identity. */
193
+ | {
194
+ readonly kind: 'index';
195
+ readonly index: number;
196
+ };
197
+
198
+ /**
199
+ * One durable attempt as History records it. The attempt identity is issued
200
+ * from a store-wide counter that never reissues a value, including after
201
+ * abandonment or process death (PUB-003).
202
+ * @alpha
203
+ */
204
+ export declare interface IAttemptRecord extends IAttemptRequest {
205
+ /** The never-reused store-wide attempt identity. */
206
+ readonly attemptId: number;
207
+ /** The current lifecycle state. */
208
+ readonly state: IAttemptState;
209
+ /** The fence of the lease that allocated this attempt. */
210
+ readonly allocatedFence: number;
211
+ /** The fence that completed, failed or interrupted it; null while incomplete. */
212
+ readonly endedFence: number | null;
213
+ /** The exact completed result, present only in the `completed` state. */
214
+ readonly result: ICompletedResultReference | null;
215
+ /** Owner-defined evidence of a failed or interrupted attempt, otherwise null. */
216
+ readonly outcome: IVersionedRecord | null;
217
+ }
218
+
219
+ /**
220
+ * Identifies one admitted execution for allocation or recovery. The attempt
221
+ * key is a stable caller-derived identity for exactly one execution, scoped by
222
+ * logical store, analysis, environment and subject; it is not a subject-level
223
+ * cache key. The intent digest is an opaque digest Resolution computes from
224
+ * the complete invocation it intends to run; History compares it only for
225
+ * exact equality, so a reused key with a different intent is a conflict.
226
+ * @alpha
227
+ */
228
+ export declare interface IAttemptRequest extends IVersionedSubject {
229
+ /** The stable key of one admitted execution. */
230
+ readonly attemptKey: string;
231
+ /** Resolution's opaque digest of that execution's complete intent. */
232
+ readonly intentDigest: string;
233
+ }
234
+
235
+ /**
236
+ * Durable attempt lifecycle. `allocated` and `staged` are incomplete;
237
+ * `completed` produced exactly one published result; `failed` and
238
+ * `interrupted` ended without a result. Staged content is attempt evidence,
239
+ * never a completed result.
240
+ * @alpha
241
+ */
242
+ export declare type IAttemptState = 'allocated' | 'staged' | 'completed' | 'failed' | 'interrupted';
243
+
244
+ /**
245
+ * Reads the host's current wall-clock time. Each reading is one observation in
246
+ * whole UTC milliseconds since the Unix epoch, always a finite safe integer.
247
+ * Readings are not monotonic: the host clock can move backwards or jump
248
+ * forwards between readings, and the capability reports that movement
249
+ * unchanged. Deciding how such movement affects leases or other ownership is
250
+ * the consumer's policy, not the clock's.
251
+ * @alpha
252
+ */
253
+ export declare interface IClockCapability {
254
+ /** Return the current UTC epoch time in whole milliseconds, or throw if the host cannot provide one. */
255
+ currentEpochMilliseconds(): number;
256
+ }
257
+
258
+ /**
259
+ * Framework metadata of one immutable completed result, readable without
260
+ * loading its author payload. Provenance and dependencies are the historical
261
+ * truth recorded at publication; later acceptance never rewrites them (RES-007).
262
+ * @alpha
263
+ */
264
+ export declare interface ICompletedEnvelope extends IVersionedSubject {
265
+ /** The exact scoped reference of this result. */
266
+ readonly reference: ICompletedResultReference;
267
+ /** The attempt that produced this result; a result has exactly one. */
268
+ readonly attemptId: number;
269
+ /** Store-wide publication order; later publications have larger values. */
270
+ readonly publication: number;
271
+ /** The supported Value snapshot encoding of the stored payload. */
272
+ readonly encoding: 'MDS1';
273
+ /** Resolution's execution provenance, decoded and frozen. */
274
+ readonly provenance: IVersionedRecord;
275
+ /** Exact completed results this execution depended on, in recorded order. */
276
+ readonly dependencies: readonly ICompletedResultReference[];
277
+ }
278
+
279
+ /**
280
+ * Optional capability for readers that can navigate one exact completed
281
+ * snapshot node by node, for lazy nested views. A navigation answer is the
282
+ * scalar value fact or the record/array shape at exactly the requested address;
283
+ * answering it must not read the root payload, a sibling or an unrequested
284
+ * descendant. Presence and key-order facts at nested addresses are answered by
285
+ * the same reader's {@link ICompletedResultReader.readSelected}. Every answer is
286
+ * synchronous: storage that can only load asynchronously cannot implement this
287
+ * capability. Scalar-only readers need not implement it.
288
+ * @alpha
289
+ */
290
+ export declare interface ICompletedNavigationReader {
291
+ /** Navigate to exactly one node of this reference, never following a current pointer. */
292
+ readNode(reference: ICompletedResultReference, address: readonly IAddressSegment[]): ISelectedNode;
293
+ /**
294
+ * Return the complete supported data of one container subtree, only for an
295
+ * explicit output request. Record key order must be the snapshot's order.
296
+ */
297
+ readSubtree(reference: ICompletedResultReference, address: readonly IAddressSegment[]): unknown;
298
+ }
299
+
300
+ /**
301
+ * Optional capability for readers that can supply an exact keyed projection as
302
+ * selected member values. Scalar readers do not need to implement projections.
303
+ * @alpha
304
+ */
305
+ export declare interface ICompletedProjectionReader {
306
+ /** Read only the projection's requested address and keyed selected values. */
307
+ readProjection(reference: ICompletedResultReference, descriptor: IValueProjectionDescriptor): IValueProjectionFact;
308
+ }
309
+
310
+ /**
311
+ * Synchronous scalar access and fingerprint-only resolution for one exact
312
+ * completed snapshot. A compatible fingerprint answer must be backed by the
313
+ * same semantics as a selected read; resolving metadata never reads payload.
314
+ * @alpha
315
+ */
316
+ export declare interface ICompletedResultReader {
317
+ /** Read the requested fact from exactly this reference, never from current. */
318
+ readSelected(reference: ICompletedResultReference, request: ISelectedReadRequest): ISelectedFact;
319
+ /** Resolve matching metadata only; unavailable metadata does not trigger a read. */
320
+ resolveFingerprint(reference: ICompletedResultReference, request: ISelectedFingerprintRequest): ISelectedFingerprintResolution;
321
+ }
322
+
323
+ /**
324
+ * A caller-visible locator for one completed immutable snapshot. The opaque
325
+ * locator carries whatever analysis and environment scope its reader requires;
326
+ * it is never a payload or a request to follow a current pointer.
327
+ * @alpha
328
+ */
329
+ export declare interface ICompletedResultReference {
330
+ /** Dispatches resolution to the completed-result contract. */
331
+ readonly kind: 'completed-result';
332
+ /** Opaque exact snapshot locator interpreted only by its injected reader. */
333
+ readonly locator: string;
334
+ }
335
+
336
+ /**
337
+ * Compatibility identity shape stored in scaffold rows. It does not establish
338
+ * target subject identity, binding correspondence, or collection semantics.
339
+ * @public
340
+ */
341
+ export declare type Identity = {
342
+ kind: 'type';
343
+ type: string;
344
+ key: string;
345
+ } | {
346
+ kind: 'step';
347
+ name: string;
348
+ inputs: readonly Identity[];
349
+ } | {
350
+ kind: 'member';
351
+ of: Identity;
352
+ path: Path;
353
+ } | {
354
+ kind: 'collection';
355
+ step: string;
356
+ source: Identity;
357
+ };
358
+
359
+ /**
360
+ * History's durable authority over one logical store. Every mutation except
361
+ * acquisition requires the current writer lease and checks holder, fence and
362
+ * unexpired lease inside its own transaction. Exact reads never consult a
363
+ * current pointer, and a missing or wrong-scope reference is an integrity
364
+ * failure, never a miss to be repaired by recomputation.
365
+ *
366
+ * Clock policy: each holder operation evaluates time as the larger of the
367
+ * host reading and a persisted store-wide high-water, then persists that value,
368
+ * including when the operation is rejected. Backward host movement therefore
369
+ * delays expiry and a forward jump can expire a lease early; neither lets an
370
+ * old fence act after a successor acquires, because every successor receives a
371
+ * larger fence. A host reading that is not a nonnegative safe integer fails
372
+ * the operation without any change. This is a local single-file policy, not a
373
+ * distributed-time or liveness guarantee.
374
+ * @alpha
375
+ */
376
+ export declare interface IDurableHistory {
377
+ /** The logical store identity this authority holds. */
378
+ readonly logicalStore: string;
379
+ /** Exact selected reads over completed results, answered from their generated index. */
380
+ readonly reader: ICompletedResultReader & ICompletedNavigationReader;
381
+ /** Acquire the single logical writer, or report the observed unexpired holder. */
382
+ acquireWriter(request: IWriterAcquisitionRequest): IWriterAcquisition;
383
+ /** Extend a still-valid lease; a stale or expired lease is rejected. */
384
+ renewWriter(lease: IWriterLease, leaseMilliseconds: number): IWriterLease;
385
+ /** End a still-valid lease without resetting the fence. */
386
+ releaseWriter(lease: IWriterLease): void;
387
+ /** Inspect the recorded holder, if any, without granting authority. */
388
+ currentWriter(): IWriterLease | undefined;
389
+ /**
390
+ * Durably allocate one attempt in its own commit before any staging. The
391
+ * same key with the same intent returns the existing attempt in whatever
392
+ * state it reached; the same key with a different intent or version rejects.
393
+ */
394
+ allocateAttempt(lease: IWriterLease, request: IAttemptRequest): IAttemptRecord;
395
+ /** Persist candidate content for an allocated attempt without publishing it. */
396
+ stageAttempt(lease: IWriterLease, request: IStageRequest): IAttemptRecord;
397
+ /**
398
+ * In one commit, install the staged payload, its generated selected index
399
+ * and fingerprints, provenance, dependencies, the completed attempt state
400
+ * and the scoped current pointer. Publishing an already completed attempt
401
+ * returns its existing reference.
402
+ */
403
+ publishAttempt(lease: IWriterLease, attemptId: number): ICompletedResultReference;
404
+ /** End an incomplete attempt as failed or interrupted, retaining its evidence. */
405
+ abandonAttempt(lease: IWriterLease, request: IAbandonRequest): IAttemptRecord;
406
+ /** Report what durably happened to one identified execution, read-only. */
407
+ recoverAttempt(request: IAttemptRequest): IRecoveryOutcome;
408
+ /** Completed results for one scoped subject and version, latest publication first. */
409
+ findCandidates(subject: IVersionedSubject): readonly ICompletedEnvelope[];
410
+ /** The scoped subject's latest publication, if any; never rewound by acceptance. */
411
+ readCurrent(subject: IScopedSubject): ICompletedResultReference | undefined;
412
+ /** Read one exact result's metadata without loading its payload. */
413
+ readEnvelope(reference: ICompletedResultReference): ICompletedEnvelope;
414
+ /** Regenerate and compare one exact result's index from its canonical payload. */
415
+ verifyResult(reference: ICompletedResultReference): IResultVerification;
416
+ /** Record a current acceptance of an existing result without touching it or the current pointer. */
417
+ recordAcceptance(lease: IWriterLease, request: IAcceptanceRequest): IAcceptanceRecord;
418
+ /** Acceptance records naming one exact result, in record order. */
419
+ readAcceptances(reference: ICompletedResultReference): readonly IAcceptanceRecord[];
420
+ /** Release the SQLite file; later calls fail. */
421
+ close(): void;
422
+ }
423
+
424
+ /**
425
+ * Host capabilities and identity for opening a durable History store. Node
426
+ * access stays behind the injected SQLite and clock capabilities. The logical
427
+ * store identity is independent of the file location: a moved file keeps its
428
+ * identity, and a file holding another logical store is rejected.
429
+ * @alpha
430
+ */
431
+ export declare interface IDurableHistoryOptions {
432
+ /** Opens the persistent SQLite file; History owns every statement and schema. */
433
+ readonly sqlite: ISqliteCapability;
434
+ /** Supplies wall-clock observations for History's lease policy. */
435
+ readonly clock: IClockCapability;
436
+ /** Computes content fingerprints for the selected index. */
437
+ readonly sha256: ISha256Capability;
438
+ /** The host location of the SQLite file, passed only to `sqlite`. */
439
+ readonly location: string;
440
+ /** The logical store identity this file must hold, or is created to hold. */
441
+ readonly logicalStore: string;
442
+ }
443
+
444
+ /**
445
+ * The analysis and environment that scope every subject, attempt and result
446
+ * within one logical store. The same subject text in another analysis or
447
+ * environment is a different scoped subject (RES-001/002). Both are complete
448
+ * opaque non-empty strings compared by exact equality.
449
+ * @alpha
450
+ */
451
+ export declare interface IHistoryScope {
452
+ /** The analysis whose history this is. */
453
+ readonly analysis: string;
454
+ /** The logical environment within that analysis. */
455
+ readonly environment: string;
456
+ }
457
+
458
+ /** A patch attempted to modify an immutable address or managed CAS version. @public */
459
+ export declare class InvalidStorePatchError extends Error {
460
+ /** Identify a structurally forbidden patch before any columns are changed. @public */
461
+ constructor(message?: string);
462
+ }
463
+
464
+ /** @alpha A supported JavaScript observation operation with its own fact meaning. */
465
+ export declare type IOperation = 'value' | 'own' | 'membership' | 'length' | 'keys';
466
+
467
+ /**
468
+ * Read-only recovery of one identified execution. Recovery reports what
469
+ * durably happened and never executes, publishes or records acceptance:
470
+ * `absent` means the key was never allocated in this scope, `incomplete` an
471
+ * allocated or staged attempt, `unsuccessful` a failed or interrupted one and
472
+ * `completed` the exact result that execution published.
473
+ * @alpha
474
+ */
475
+ export declare type IRecoveryOutcome = {
476
+ readonly kind: 'absent';
477
+ } | {
478
+ readonly kind: 'incomplete';
479
+ readonly attempt: IAttemptRecord;
480
+ } | {
481
+ readonly kind: 'unsuccessful';
482
+ readonly attempt: IAttemptRecord;
483
+ } | {
484
+ readonly kind: 'completed';
485
+ readonly attempt: IAttemptRecord;
486
+ /** The exact result that this identified execution published. */
487
+ readonly reference: ICompletedResultReference;
488
+ };
489
+
490
+ /**
491
+ * Result of regenerating a completed result's selected index from its stored
492
+ * canonical payload and comparing it with the stored index.
493
+ * @alpha
494
+ */
495
+ export declare type IResultVerification = {
496
+ readonly kind: 'consistent';
497
+ } | {
498
+ readonly kind: 'inconsistent';
499
+ readonly detail: string;
500
+ };
501
+
502
+ /**
503
+ * One scoped subject: the author's complete opaque subject string inside its
504
+ * analysis/environment scope. History never derives, prefixes or reinterprets
505
+ * the subject; it identifies a history of work, not one exact result.
506
+ * @alpha
507
+ */
508
+ export declare interface IScopedSubject extends IHistoryScope {
509
+ /** The author's complete subject string, compared by exact string equality. */
510
+ readonly subject: string;
511
+ }
512
+
513
+ /**
514
+ * One immediate lookup result for a caller-supplied root, address, and
515
+ * operation. The fact may be the selected object reference itself, so it is
516
+ * neither a detached snapshot nor retained Tracking evidence. Tracking adds
517
+ * binding and capture relationships and decides what data to encode as evidence.
518
+ * @alpha
519
+ */
520
+ export declare interface ISelectedFact {
521
+ /** The literal access whose result was selected. */
522
+ readonly operation: IOperation;
523
+ /** Ordered container-aware steps from the supplied root to the selected location. */
524
+ readonly address: readonly IAddressSegment[];
525
+ /** The selected value or structural fact; an object value remains the source reference. */
526
+ readonly fact: unknown;
527
+ }
528
+
529
+ /**
530
+ * Metadata lookup is scoped to the exact result reference and full requested
531
+ * selection. The encoding tag prevents an indexed digest from another semantic
532
+ * version being mistaken for this selection.
533
+ * @alpha
534
+ */
535
+ export declare type ISelectedFingerprintRequest = {
536
+ readonly kind: 'selected';
537
+ readonly operation: IOperation;
538
+ readonly address: readonly IAddressSegment[];
539
+ readonly encoding: 'MDO1';
540
+ } | {
541
+ readonly kind: 'projection';
542
+ readonly descriptor: IValueProjectionDescriptor;
543
+ readonly encoding: 'MDP1';
544
+ } | {
545
+ readonly kind: 'materialized-output';
546
+ readonly address: readonly IAddressSegment[];
547
+ readonly encoding: 'MDS1';
548
+ };
549
+
550
+ /** Explicit results keep absent or incompatible metadata from implying equality. @alpha */
551
+ export declare type ISelectedFingerprintResolution = {
552
+ readonly kind: 'compatible';
553
+ readonly fingerprint: string;
554
+ } | {
555
+ readonly kind: 'unavailable';
556
+ } | {
557
+ readonly kind: 'incompatible';
558
+ } | {
559
+ readonly kind: 'ambiguous';
560
+ };
561
+
562
+ /**
563
+ * The kind of node that one exact structured address selects. A scalar leaf is
564
+ * its ordinary `value` selected fact. A record or array is described only by
565
+ * its container shape: navigating through a container is transport metadata for
566
+ * a lazy view, never a whole-object observation, so no member, identity or
567
+ * serialized subtree is implied. Array length is carried so a view need not ask
568
+ * again, but it becomes observation evidence only when a consumer reads it.
569
+ * Shapes are never placed inside {@link ISelectedFact.fact}.
570
+ * @alpha
571
+ */
572
+ export declare type ISelectedNode =
573
+ /** A supported scalar (undefined, null, boolean, number or string) read at the address. */
574
+ {
575
+ readonly kind: 'scalar';
576
+ readonly selected: ISelectedFact;
577
+ }
578
+ /** A string-keyed plain-data record, possibly with a supported custom prototype chain. */
579
+ | {
580
+ readonly kind: 'record';
581
+ readonly address: readonly IAddressSegment[];
582
+ }
583
+ /** A standard array; `length` counts slots including holes. */
584
+ | {
585
+ readonly kind: 'array';
586
+ readonly address: readonly IAddressSegment[];
587
+ readonly length: number;
588
+ };
589
+
590
+ /** A selected Value-owned scalar fact requested at an exact retained address. @alpha */
591
+ export declare interface ISelectedReadRequest {
592
+ /** The literal operation whose fact is requested. */
593
+ readonly operation: IOperation;
594
+ /** Container-aware path within this selected result value. */
595
+ readonly address: readonly IAddressSegment[];
596
+ }
597
+
598
+ /**
599
+ * Computes SHA-256 over the UTF-8 bytes of supplied canonical evidence.
600
+ * Machine supplies hashing only; callers define the meaning and framing of
601
+ * the input before it crosses this host boundary.
602
+ * @alpha
603
+ */
604
+ export declare interface ISha256Capability {
605
+ /** Return the lowercase hexadecimal SHA-256 digest of the input text. */
606
+ sha256(input: string): string;
607
+ }
608
+
609
+ /**
610
+ * Produces a synchronous detached copy of primitives, arrays, ordinary objects'
611
+ * enumerable string-keyed properties, Date, RegExp, Map, Set, ArrayBuffer, and
612
+ * typed-array/DataView contents. It preserves cycles and repeated references
613
+ * within one copy and isolates both input and returned snapshots. Functions,
614
+ * symbols, and raw SharedArrayBuffer values fail. Getters may run; nonenumerable
615
+ * and symbol-keyed properties and arbitrary class prototypes are not preserved.
616
+ * This contract defines neither durable encoding nor canonical identity. It is
617
+ * public because History's direct memory-store constructor requires injection.
618
+ * @public
619
+ */
620
+ declare interface ISnapshotCapability {
621
+ /** Return a detached copy or throw before a caller mutates owned state. */
622
+ snapshot<T>(value: T): T;
623
+ }
624
+
625
+ /**
626
+ * Opens persistent local SQLite databases for a consumer that owns its own
627
+ * SQL and schema, such as History's durable authority. Opening fails for a
628
+ * directory, a missing parent directory, a file that is not a SQLite database,
629
+ * or a location that cannot hold a persistent write-ahead-logged database,
630
+ * including `:memory:` and the empty path. Opening never silently weakens the
631
+ * host's durable configuration.
632
+ * @alpha
633
+ */
634
+ export declare interface ISqliteCapability {
635
+ /** Open or create the database file at `location` and return its owned connection. */
636
+ openSqlite(location: string): ISqliteConnection;
637
+ }
638
+
639
+ /**
640
+ * An open connection to one persistent local SQLite database file. The caller
641
+ * that opened it owns it and must close it. The host selects durable
642
+ * configuration for every connection: write-ahead logging, FULL synchronous
643
+ * commits, enforced foreign keys and a bounded wait on a locked database.
644
+ * Callers supply every SQL statement and schema; the connection has no
645
+ * knowledge of what the tables mean.
646
+ *
647
+ * Transactions are synchronous, top-level and IMMEDIATE: the write lock is
648
+ * taken before the callback runs, the callback's writes commit together when
649
+ * it returns, and all of them roll back when it throws. Nesting is refused
650
+ * rather than given savepoint semantics. Calls through the connection or its
651
+ * statements made by asynchronous work that a callback left behind fail after
652
+ * the transaction ends. This protects only this connection's storage: it does
653
+ * not prevent other effects of that leftover JavaScript.
654
+ * @alpha
655
+ */
656
+ export declare interface ISqliteConnection {
657
+ /** Execute SQL text that takes no bound values, such as schema statements. */
658
+ exec(sql: string): void;
659
+ /** Prepare one statement for repeated execution with bound values. */
660
+ prepare(sql: string): ISqliteStatement;
661
+ /**
662
+ * Run `operation` inside one IMMEDIATE transaction and return its result.
663
+ * A value thrown by `operation` rolls back every write and is rethrown
664
+ * unchanged. A Promise or thenable result, or a returned object or function
665
+ * whose `then` cannot be inspected, rolls back and fails with `TypeError`;
666
+ * an error raised while inspecting that `then` is not rethrown. A call made
667
+ * while this connection's transaction callback is running fails without
668
+ * invoking `operation`.
669
+ */
670
+ transaction<T>(operation: () => T & ISqliteSynchronousResult<T>): T;
671
+ /**
672
+ * Release the database file. Closing again has no effect; any later use of
673
+ * the connection or its statements fails. Closing from inside a transaction
674
+ * callback fails, which rolls that transaction back if the failure propagates,
675
+ * and work that outlived a transaction callback cannot close the connection.
676
+ */
677
+ close(): void;
678
+ }
679
+
680
+ /**
681
+ * One result row keyed by result column name. Rows are transport data owned by
682
+ * the caller; they carry no driver type, prototype behavior or live link to
683
+ * stored content.
684
+ * @alpha
685
+ */
686
+ export declare interface ISqliteRow {
687
+ /** The value SQLite returned for the named result column. */
688
+ readonly [column: string]: ISqliteValue;
689
+ }
690
+
691
+ /**
692
+ * The only mutation fact a statement run reports. Row identifiers and other
693
+ * driver details stay inside the host.
694
+ * @alpha
695
+ */
696
+ export declare interface ISqliteRunResult {
697
+ /** Rows inserted, updated or deleted directly by the statement. */
698
+ readonly changes: number;
699
+ }
700
+
701
+ /**
702
+ * One prepared SQL statement bound to the connection that prepared it. Values
703
+ * are always bound positionally and never interpolated into SQL text. Every
704
+ * call fails once the owning connection is closed, and fails when it is made by
705
+ * work inherited from an already ended transaction callback.
706
+ * @alpha
707
+ */
708
+ export declare interface ISqliteStatement {
709
+ /** Execute the statement for its effect and report how many rows changed. */
710
+ run(...values: readonly ISqliteValue[]): ISqliteRunResult;
711
+ /** Return the first result row, or `undefined` when the statement yields none. */
712
+ get(...values: readonly ISqliteValue[]): ISqliteRow | undefined;
713
+ /** Return every result row in the order SQLite produced them. */
714
+ all(...values: readonly ISqliteValue[]): readonly ISqliteRow[];
715
+ }
716
+
717
+ /**
718
+ * Makes a transaction callback's return type unusable when it is, or may be, a
719
+ * Promise or other thenable. A transaction commits when its callback returns;
720
+ * an asynchronous callback would return before its awaited work, so such
721
+ * results are rejected at compile time and, independently, at runtime.
722
+ *
723
+ * Any union constituent with a callable `then` rejects the whole result, so
724
+ * `number | Promise<number>` is refused like `Promise<number>`. Results the
725
+ * compiler cannot classify, `any` and `unknown`, are left to the runtime check
726
+ * rather than rejecting ordinary untyped data.
727
+ * @alpha
728
+ */
729
+ export declare type ISqliteSynchronousResult<T> = 0 extends 1 & T ? unknown : [Extract<T, {
730
+ readonly then: (...parameters: never[]) => unknown;
731
+ }>] extends [never] ? unknown : never;
732
+
733
+ /**
734
+ * One value that crosses the SQLite host boundary, either as a bound parameter
735
+ * or as a returned cell: text, a finite number, SQL NULL, or a BLOB copied into
736
+ * a plain `Uint8Array`. A returned INTEGER is exact because values outside the
737
+ * safe-integer range fail instead of being rounded. Booleans, bigints,
738
+ * `undefined`, non-finite numbers and objects are outside the domain and are
739
+ * refused at runtime even when a caller bypasses these types.
740
+ * @alpha
741
+ */
742
+ export declare type ISqliteValue = string | number | null | Uint8Array;
743
+
744
+ /**
745
+ * Candidate content for an allocated attempt. The payload must be supported
746
+ * Value data with a record or array root; the provenance is Resolution's
747
+ * versioned record; dependencies are exact references to completed results in
748
+ * the same store and scope that this execution consumed.
749
+ * @alpha
750
+ */
751
+ export declare interface IStageRequest {
752
+ /** The allocated attempt to stage. */
753
+ readonly attemptId: number;
754
+ /** The author result data, copied into canonical MDS1 form. */
755
+ readonly payload: unknown;
756
+ /** Resolution's execution provenance for this attempt. */
757
+ readonly provenance: IVersionedRecord;
758
+ /** Exact completed results this execution depends on, in the caller's order. */
759
+ readonly dependencies: readonly ICompletedResultReference[];
760
+ }
761
+
762
+ /**
763
+ * The Value-owned meaning of a selected keyed projection, independent of its
764
+ * composition binding or collection policy.
765
+ * @alpha
766
+ */
767
+ export declare interface IValueProjectionDescriptor {
768
+ /** Relative path from each member to the selected value. */
769
+ readonly address: readonly IAddressSegment[];
770
+ /** Projection content selects member values, never member identity or presence. */
771
+ readonly operation: 'value';
772
+ /** States whether all members were promised or only an exact visited subset was read. */
773
+ readonly traversal: IValueProjectionTraversal;
774
+ }
775
+
776
+ /**
777
+ * A content fact whose caller-owned binding remains outside Value's encoding.
778
+ * @alpha
779
+ */
780
+ export declare interface IValueProjectionFact {
781
+ /** Selection and coverage whose meaning governs every supplied member value. */
782
+ readonly descriptor: IValueProjectionDescriptor;
783
+ /** Unique collection-scoped keys paired with their selected content; key order is not ordered consumption evidence. */
784
+ readonly members: readonly IValueProjectionMember[];
785
+ }
786
+
787
+ /**
788
+ * One unique stable member key and the selected supported value for that member.
789
+ * @alpha
790
+ */
791
+ export declare type IValueProjectionMember = readonly [key: string, value: unknown];
792
+
793
+ /**
794
+ * Coverage semantics for one keyed projection. Exhaustive coverage is a source
795
+ * promise; a visited traversal retains the exact ordered set of observed keys.
796
+ * @alpha
797
+ */
798
+ export declare type IValueProjectionTraversal = {
799
+ readonly kind: 'exhaustive';
800
+ readonly complete: true;
801
+ } | {
802
+ readonly kind: 'visited';
803
+ readonly complete: false;
804
+ readonly keys: readonly string[];
805
+ };
806
+
807
+ /**
808
+ * A versioned record whose meaning another owner defines, such as
809
+ * Resolution's execution provenance, current acceptance evidence or an
810
+ * attempt's failure evidence. History validates only that the format tag is a
811
+ * non-empty string, the format version is a positive safe integer and the
812
+ * content is supported Value data; it stores the content in canonical MDS1
813
+ * form and returns it decoded and frozen, never interpreting it.
814
+ * @alpha
815
+ */
816
+ export declare interface IVersionedRecord {
817
+ /** The owner-defined format identity, for example a Resolution schema name. */
818
+ readonly format: string;
819
+ /** The owner-defined positive safe-integer version of that format. */
820
+ readonly formatVersion: number;
821
+ /** Supported Value data; its meaning belongs to the format's owner. */
822
+ readonly content: unknown;
823
+ }
824
+
825
+ /**
826
+ * A scoped subject narrowed to one compatibility group (REUSE-008): a positive
827
+ * safe integer chosen by the author per memoized step. Candidate lookup filters
828
+ * by it before Resolution validates current evidence.
829
+ * @alpha
830
+ */
831
+ export declare interface IVersionedSubject extends IScopedSubject {
832
+ /** The positive safe-integer compatibility group. */
833
+ readonly version: number;
834
+ }
835
+
836
+ /**
837
+ * The outcome of asking for the single logical writer. `held` reports an
838
+ * observed unexpired holder, not a failed compare-and-swap (PUB-005), and
839
+ * grants nothing.
840
+ * @alpha
841
+ */
842
+ export declare type IWriterAcquisition = {
843
+ /** The caller now owns the store's writer lease. */
844
+ readonly kind: 'acquired';
845
+ /** The new lease with its freshly issued fence. */
846
+ readonly lease: IWriterLease;
847
+ } | {
848
+ /** Another unexpired holder owns the store. */
849
+ readonly kind: 'held';
850
+ /** The observed holder identity. */
851
+ readonly holder: string;
852
+ /** When that holder's lease expires, in History's clock domain. */
853
+ readonly expiresAt: number;
854
+ };
855
+
856
+ /** A request for the writer lease. @alpha */
857
+ export declare interface IWriterAcquisitionRequest {
858
+ /** The opaque non-empty identity of the prospective holder. */
859
+ readonly holder: string;
860
+ /** Positive safe-integer lease duration in milliseconds. */
861
+ readonly leaseMilliseconds: number;
862
+ }
863
+
864
+ /**
865
+ * Proof of current single-logical-writer ownership. The holder is an opaque
866
+ * caller identity; the fence is the store-wide token issued at acquisition,
867
+ * which only increases; `expiresAt` is the lease boundary in History's
868
+ * clock domain (epoch milliseconds). Presenting a lease authorizes storage
869
+ * mutation only while holder, fence and unexpired lease still match the durable
870
+ * writer state; it never authorizes author execution.
871
+ * @alpha
872
+ */
873
+ export declare interface IWriterLease {
874
+ /** The opaque identity that acquired the lease. */
875
+ readonly holder: string;
876
+ /** The fencing token issued for this acquisition. */
877
+ readonly fence: number;
878
+ /** The first effective time at which the lease is no longer valid. */
879
+ readonly expiresAt: number;
880
+ }
881
+
882
+ /** Options for the isolated, non-durable test backend. @public */
883
+ export declare interface MemoryStoreOptions {
884
+ /** Metadata compatibility identifier; the initial store format uses sha256. */
885
+ fingerprintAlgorithm?: string;
886
+ /* Excluded from this release type: _onValueRead */
887
+ }
888
+
889
+ /** An update targeted a generation that has never been inserted. @public */
890
+ export declare class MissingRowError extends Error {
891
+ /** Identify an absent update target; updates never implicitly insert. @public */
892
+ constructor(message?: string);
893
+ }
894
+
895
+ /**
896
+ * Open (creating when empty) the durable History store for one logical store.
897
+ * The file is rejected before any work unless it is empty or holds exactly
898
+ * this schema version for this logical store.
899
+ * @alpha
900
+ */
901
+ export declare function openDurableHistory(options: IDurableHistoryOptions): IDurableHistory;
902
+
903
+ /** Observable call outcomes; an unmemoized named execution has no storage key. @public */
904
+ export declare type Outcome = {
905
+ kind: 'served';
906
+ key: ResultKey;
907
+ generation: number;
908
+ } | {
909
+ kind: 'executed';
910
+ key: ResultKey;
911
+ generation: number;
912
+ } | {
913
+ kind: 'checked';
914
+ key: ResultKey;
915
+ wouldExecute: boolean;
916
+ divergence?: Divergence;
917
+ } | {
918
+ kind: 'refused';
919
+ key: ResultKey;
920
+ reason: unknown;
921
+ } | {
922
+ kind: 'failed';
923
+ key: ResultKey;
924
+ error: unknown;
925
+ } | {
926
+ kind: 'abandoned';
927
+ key: ResultKey;
928
+ reason: 'error' | 'lease-expired' | 'refused';
929
+ } | {
930
+ kind: 'ran';
931
+ };
932
+
933
+ /** A legacy row-storage address, not the future structured semantic path. @public */
934
+ export declare type Path = string;
935
+
936
+ /** Legacy persisted read rows; target observation encoding remains undecided. @public */
937
+ export declare type RecordedRead = {
938
+ kind: 'field';
939
+ arg: number;
940
+ path: Path;
941
+ fingerprint: Fingerprint;
942
+ } | {
943
+ kind: 'whole';
944
+ arg: number;
945
+ fingerprint: Fingerprint;
946
+ } | {
947
+ kind: 'memo';
948
+ key: ResultKey;
949
+ generation: number;
950
+ };
951
+
952
+ /** Complete storage tuple. Backends must preserve boundaries between all three parts. @public */
953
+ export declare type ResultKey = {
954
+ step: string;
955
+ revision: number;
956
+ subjectHash: string;
957
+ };
958
+
959
+ /**
960
+ * A presented writer lease no longer matches the durable holder, fence or
961
+ * unexpired lease, so the mutation was rejected with no change other than the
962
+ * observed clock high-water (PUB-002).
963
+ * @alpha
964
+ */
965
+ export declare class StaleWriterError extends Error {
966
+ /** Create a stale-ownership rejection with a diagnostic message. */
967
+ constructor(message: string);
968
+ }
969
+
970
+ /**
971
+ * Storage mechanism for independent rows, with linearizable subject CAS.
972
+ * All inputs and returned rows are detached snapshots: caller mutation cannot
973
+ * alter persisted data. Values may only change by inserting another generation.
974
+ * There is no transaction spanning these methods; callers must not infer atomic
975
+ * claim/generation publication from the per-row CAS guarantee.
976
+ * @public
977
+ */
978
+ export declare interface Store {
979
+ /** Return detached format metadata; opening code must reject algorithm mismatches. */
980
+ meta(): Promise<StoreMetadata>;
981
+ /** Read a detached subject snapshot, or undefined for an absent tuple. */
982
+ getSubject(key: ResultKey): Promise<SubjectRow | undefined>;
983
+ /** Insert only; duplicate tuples reject, as do versions outside safe integers. */
984
+ putSubject(row: SubjectRow): Promise<void>;
985
+ /**
986
+ * Atomically apply a shallow column patch only when the stored version matches.
987
+ * Success increments that version once, even for an empty patch; a missing or
988
+ * stale row returns false without changes. Key/version properties reject at
989
+ * runtime, including extras passed from untyped JavaScript callers.
990
+ * An exhausted MAX_SAFE_INTEGER version rejects rather than reporting success
991
+ * without advancing the token. Neither rejection changes the stored row.
992
+ */
993
+ casSubject(key: ResultKey, expectedVersion: number, patch: SubjectPatch): Promise<boolean>;
994
+ /** Read a detached generation, or undefined for an absent tuple. */
995
+ getGeneration(key: ResultKey, generation: number): Promise<GenerationRow | undefined>;
996
+ /** Return detached rows for exactly this complete key; ordering is unspecified. */
997
+ listGenerations(key: ResultKey): Promise<GenerationRow[]>;
998
+ /** Insert only; generation numbers are supplied, never allocated by storage. */
999
+ putGeneration(row: GenerationRow): Promise<void>;
1000
+ /** Patch an existing row; missing tuples and attempts to change its key reject. */
1001
+ updateGeneration(key: ResultKey, generation: number, patch: GenerationPatch): Promise<void>;
1002
+ /**
1003
+ * Insert an atomic batch of immutable fields. Duplicate addresses, within the
1004
+ * batch or already stored, reject the whole batch without inserting anything.
1005
+ * This proposed storage refinement enforces retained-value immutability.
1006
+ */
1007
+ putFields(rows: FieldRow[]): Promise<void>;
1008
+ /** Return requested field snapshots; absent paths are omitted. */
1009
+ getFields(key: ResultKey, generation: number, paths: Path[]): Promise<FieldRow[]>;
1010
+ /** Return requested fingerprints without reading/deserializing any field value. */
1011
+ getFingerprints(key: ResultKey, generation: number, paths: Path[]): Promise<Map<Path, Fingerprint>>;
1012
+ /**
1013
+ * Query leases strictly less than now, oldest first, with at most limit rows.
1014
+ * Zero limit returns no rows. This query never sweeps or changes a claim.
1015
+ */
1016
+ expiredClaims(now: number, limit: number): Promise<SubjectRow[]>;
1017
+ /** Release resources owned by this store. */
1018
+ close(): Promise<void>;
1019
+ }
1020
+
1021
+ /** Persisted format identifiers, checked before using a store's fingerprints. @public */
1022
+ export declare interface StoreMetadata {
1023
+ schemaVersion: number;
1024
+ fingerprintAlgorithm: string;
1025
+ }
1026
+
1027
+ /** Legacy row subject shape; future author-supplied subject identity is separate. @public */
1028
+ export declare type Subject = Extract<Identity, {
1029
+ kind: 'step';
1030
+ }>;
1031
+
1032
+ /** Writable subject columns; the complete key and CAS token cannot be patched. @public */
1033
+ export declare type SubjectPatch = Partial<Omit<SubjectRow, 'key' | 'version'>>;
1034
+
1035
+ /**
1036
+ * One compare-and-set row per complete result key. Repository owns generation
1037
+ * meaning; claim owns lease meaning. Storage only preserves and patches columns.
1038
+ * @public
1039
+ */
1040
+ export declare interface SubjectRow {
1041
+ key: ResultKey;
1042
+ subject: Subject;
1043
+ /** Nonnegative safe-integer CAS token, incremented once per successful CAS. */
1044
+ version: number;
1045
+ currentGeneration: number | null;
1046
+ claim: null | {
1047
+ generation: number;
1048
+ holder: string;
1049
+ leaseUntil: number;
1050
+ progress: {
1051
+ fingerprint: Fingerprint;
1052
+ value: unknown;
1053
+ } | null;
1054
+ };
1055
+ durations: number[];
1056
+ }
1057
+
1058
+ export { }