@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,3 @@
1
+ /** Entry-specific exports preserve one History type identity per release tier. */
2
+ export { AttemptConflictError, AttemptStateError, DuplicateRowError, FingerprintAlgorithmMismatchError, HistoryClockError, HistoryIntegrityError, HistorySchemaError, InvalidStorePatchError, MissingRowError, StaleWriterError, createMemoryStore, openDurableHistory } from './history.shared.untrimmed.js';
3
+ export type { Divergence, FieldRow, Fingerprint, GenerationPatch, GenerationRow, GenerationState, IAbandonRequest, IAcceptanceRecord, IAcceptanceRequest, IAddressSegment, IAttemptRecord, IAttemptRequest, IAttemptState, IClockCapability, ICompletedEnvelope, ICompletedNavigationReader, ICompletedProjectionReader, ICompletedResultReader, ICompletedResultReference, IDurableHistory, IDurableHistoryOptions, IHistoryScope, IOperation, IRecoveryOutcome, IResultVerification, IScopedSubject, ISelectedFact, ISelectedFingerprintRequest, ISelectedFingerprintResolution, ISelectedNode, ISelectedReadRequest, ISha256Capability, ISqliteCapability, ISqliteConnection, ISqliteRow, ISqliteRunResult, ISqliteStatement, ISqliteSynchronousResult, ISqliteValue, IStageRequest, IValueProjectionDescriptor, IValueProjectionFact, IValueProjectionMember, IValueProjectionTraversal, IVersionedRecord, IVersionedSubject, IWriterAcquisition, IWriterAcquisitionRequest, IWriterLease, Identity, MemoryStoreOptions, Outcome, Path, RecordedRead, ResultKey, Store, StoreMetadata, Subject, SubjectPatch, SubjectRow } from './history.shared.untrimmed.js';
@@ -0,0 +1,11 @@
1
+ // This file is read by tools that parse documentation comments conforming to the TSDoc standard.
2
+ // It should be published with your NPM package. It should not be tracked by Git.
3
+ {
4
+ "tsdocVersion": "0.12",
5
+ "toolPackages": [
6
+ {
7
+ "packageName": "@microsoft/api-extractor",
8
+ "packageVersion": "7.59.2"
9
+ }
10
+ ]
11
+ }
@@ -0,0 +1,99 @@
1
+ /**
2
+ * Exact completed-snapshot reading contracts used by Materialization. These
3
+ * interfaces locate immutable results but neither implement a backend nor decide
4
+ * freshness, publication, authorization, or candidate eligibility.
5
+ * @packageDocumentation
6
+ */
7
+ import type { IAddressSegment, IOperation, ISelectedFact, ISelectedNode, IValueProjectionDescriptor, IValueProjectionFact } from '@microdelta/value';
8
+ /**
9
+ * A caller-visible locator for one completed immutable snapshot. The opaque
10
+ * locator carries whatever analysis and environment scope its reader requires;
11
+ * it is never a payload or a request to follow a current pointer.
12
+ * @alpha
13
+ */
14
+ export interface ICompletedResultReference {
15
+ /** Dispatches resolution to the completed-result contract. */
16
+ readonly kind: 'completed-result';
17
+ /** Opaque exact snapshot locator interpreted only by its injected reader. */
18
+ readonly locator: string;
19
+ }
20
+ /** A selected Value-owned scalar fact requested at an exact retained address. @alpha */
21
+ export interface ISelectedReadRequest {
22
+ /** The literal operation whose fact is requested. */
23
+ readonly operation: IOperation;
24
+ /** Container-aware path within this selected result value. */
25
+ readonly address: readonly IAddressSegment[];
26
+ }
27
+ /**
28
+ * Metadata lookup is scoped to the exact result reference and full requested
29
+ * selection. The encoding tag prevents an indexed digest from another semantic
30
+ * version being mistaken for this selection.
31
+ * @alpha
32
+ */
33
+ export type ISelectedFingerprintRequest = {
34
+ readonly kind: 'selected';
35
+ readonly operation: IOperation;
36
+ readonly address: readonly IAddressSegment[];
37
+ readonly encoding: 'MDO1';
38
+ } | {
39
+ readonly kind: 'projection';
40
+ readonly descriptor: IValueProjectionDescriptor;
41
+ readonly encoding: 'MDP1';
42
+ } | {
43
+ readonly kind: 'materialized-output';
44
+ readonly address: readonly IAddressSegment[];
45
+ readonly encoding: 'MDS1';
46
+ };
47
+ /** Explicit results keep absent or incompatible metadata from implying equality. @alpha */
48
+ export type ISelectedFingerprintResolution = {
49
+ readonly kind: 'compatible';
50
+ readonly fingerprint: string;
51
+ } | {
52
+ readonly kind: 'unavailable';
53
+ } | {
54
+ readonly kind: 'incompatible';
55
+ } | {
56
+ readonly kind: 'ambiguous';
57
+ };
58
+ /**
59
+ * Synchronous scalar access and fingerprint-only resolution for one exact
60
+ * completed snapshot. A compatible fingerprint answer must be backed by the
61
+ * same semantics as a selected read; resolving metadata never reads payload.
62
+ * @alpha
63
+ */
64
+ export interface ICompletedResultReader {
65
+ /** Read the requested fact from exactly this reference, never from current. */
66
+ readSelected(reference: ICompletedResultReference, request: ISelectedReadRequest): ISelectedFact;
67
+ /** Resolve matching metadata only; unavailable metadata does not trigger a read. */
68
+ resolveFingerprint(reference: ICompletedResultReference, request: ISelectedFingerprintRequest): ISelectedFingerprintResolution;
69
+ }
70
+ /**
71
+ * Optional capability for readers that can supply an exact keyed projection as
72
+ * selected member values. Scalar readers do not need to implement projections.
73
+ * @alpha
74
+ */
75
+ export interface ICompletedProjectionReader {
76
+ /** Read only the projection's requested address and keyed selected values. */
77
+ readProjection(reference: ICompletedResultReference, descriptor: IValueProjectionDescriptor): IValueProjectionFact;
78
+ }
79
+ /**
80
+ * Optional capability for readers that can navigate one exact completed
81
+ * snapshot node by node, for lazy nested views. A navigation answer is the
82
+ * scalar value fact or the record/array shape at exactly the requested address;
83
+ * answering it must not read the root payload, a sibling or an unrequested
84
+ * descendant. Presence and key-order facts at nested addresses are answered by
85
+ * the same reader's {@link ICompletedResultReader.readSelected}. Every answer is
86
+ * synchronous: storage that can only load asynchronously cannot implement this
87
+ * capability. Scalar-only readers need not implement it.
88
+ * @alpha
89
+ */
90
+ export interface ICompletedNavigationReader {
91
+ /** Navigate to exactly one node of this reference, never following a current pointer. */
92
+ readNode(reference: ICompletedResultReference, address: readonly IAddressSegment[]): ISelectedNode;
93
+ /**
94
+ * Return the complete supported data of one container subtree, only for an
95
+ * explicit output request. Record key order must be the snapshot's order.
96
+ */
97
+ readSubtree(reference: ICompletedResultReference, address: readonly IAddressSegment[]): unknown;
98
+ }
99
+ //# sourceMappingURL=completed-results.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"completed-results.d.ts","sourceRoot":"","sources":["../../src/completed-results.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EACV,eAAe,EACf,UAAU,EACV,aAAa,EACb,aAAa,EACb,0BAA0B,EAC1B,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAE3B;;;;;GAKG;AACH,MAAM,WAAW,yBAAyB;IACxC,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AY,CAAC,SAAS,EAAE,yBAAyB,EAAE,OAAO,EAAE,oBAAoB,GAAG,aAAa,CAAC;IACjG,oFAAoF;IACpF,kBAAkB,CAChB,SAAS,EAAE,yBAAyB,EACpC,OAAO,EAAE,2BAA2B,GACnC,8BAA8B,CAAC;CACnC;AAED;;;;GAIG;AACH,MAAM,WAAW,0BAA0B;IACzC,8EAA8E;IAC9E,cAAc,CACZ,SAAS,EAAE,yBAAyB,EACpC,UAAU,EAAE,0BAA0B,GACrC,oBAAoB,CAAC;CACzB;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,0BAA0B;IACzC,yFAAyF;IACzF,QAAQ,CAAC,SAAS,EAAE,yBAAyB,EAAE,OAAO,EAAE,SAAS,eAAe,EAAE,GAAG,aAAa,CAAC;IACnG;;;OAGG;IACH,WAAW,CAAC,SAAS,EAAE,yBAAyB,EAAE,OAAO,EAAE,SAAS,eAAe,EAAE,GAAG,OAAO,CAAC;CACjG"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=completed-results.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"completed-results.js","sourceRoot":"","sources":["../../src/completed-results.ts"],"names":[],"mappings":""}
@@ -0,0 +1,339 @@
1
+ /**
2
+ * Contracts of History's durable authority: the one consistency owner for
3
+ * immutable completed results, attempt history, the single logical writer,
4
+ * atomic publication, current pointers and separate acceptance records
5
+ * (PUB-001, ARC-007). These are project-private alpha shapes. They carry
6
+ * Resolution's provenance and evidence as versioned opaque records and never
7
+ * interpret Definition, Tracking or Resolution meaning; deciding whether a
8
+ * result is currently acceptable remains Resolution's responsibility.
9
+ * @packageDocumentation
10
+ */
11
+ import type { IClockCapability, ISha256Capability, ISqliteCapability } from '@microdelta/machine';
12
+ import type { ICompletedNavigationReader, ICompletedResultReader, ICompletedResultReference } from '../completed-results.js';
13
+ /**
14
+ * The analysis and environment that scope every subject, attempt and result
15
+ * within one logical store. The same subject text in another analysis or
16
+ * environment is a different scoped subject (RES-001/002). Both are complete
17
+ * opaque non-empty strings compared by exact equality.
18
+ * @alpha
19
+ */
20
+ export interface IHistoryScope {
21
+ /** The analysis whose history this is. */
22
+ readonly analysis: string;
23
+ /** The logical environment within that analysis. */
24
+ readonly environment: string;
25
+ }
26
+ /**
27
+ * One scoped subject: the author's complete opaque subject string inside its
28
+ * analysis/environment scope. History never derives, prefixes or reinterprets
29
+ * the subject; it identifies a history of work, not one exact result.
30
+ * @alpha
31
+ */
32
+ export interface IScopedSubject extends IHistoryScope {
33
+ /** The author's complete subject string, compared by exact string equality. */
34
+ readonly subject: string;
35
+ }
36
+ /**
37
+ * A scoped subject narrowed to one compatibility group (REUSE-008): a positive
38
+ * safe integer chosen by the author per memoized step. Candidate lookup filters
39
+ * by it before Resolution validates current evidence.
40
+ * @alpha
41
+ */
42
+ export interface IVersionedSubject extends IScopedSubject {
43
+ /** The positive safe-integer compatibility group. */
44
+ readonly version: number;
45
+ }
46
+ /**
47
+ * A versioned record whose meaning another owner defines, such as
48
+ * Resolution's execution provenance, current acceptance evidence or an
49
+ * attempt's failure evidence. History validates only that the format tag is a
50
+ * non-empty string, the format version is a positive safe integer and the
51
+ * content is supported Value data; it stores the content in canonical MDS1
52
+ * form and returns it decoded and frozen, never interpreting it.
53
+ * @alpha
54
+ */
55
+ export interface IVersionedRecord {
56
+ /** The owner-defined format identity, for example a Resolution schema name. */
57
+ readonly format: string;
58
+ /** The owner-defined positive safe-integer version of that format. */
59
+ readonly formatVersion: number;
60
+ /** Supported Value data; its meaning belongs to the format's owner. */
61
+ readonly content: unknown;
62
+ }
63
+ /**
64
+ * Proof of current single-logical-writer ownership. The holder is an opaque
65
+ * caller identity; the fence is the store-wide token issued at acquisition,
66
+ * which only increases; `expiresAt` is the lease boundary in History's
67
+ * clock domain (epoch milliseconds). Presenting a lease authorizes storage
68
+ * mutation only while holder, fence and unexpired lease still match the durable
69
+ * writer state; it never authorizes author execution.
70
+ * @alpha
71
+ */
72
+ export interface IWriterLease {
73
+ /** The opaque identity that acquired the lease. */
74
+ readonly holder: string;
75
+ /** The fencing token issued for this acquisition. */
76
+ readonly fence: number;
77
+ /** The first effective time at which the lease is no longer valid. */
78
+ readonly expiresAt: number;
79
+ }
80
+ /**
81
+ * The outcome of asking for the single logical writer. `held` reports an
82
+ * observed unexpired holder, not a failed compare-and-swap (PUB-005), and
83
+ * grants nothing.
84
+ * @alpha
85
+ */
86
+ export type IWriterAcquisition = {
87
+ /** The caller now owns the store's writer lease. */
88
+ readonly kind: 'acquired';
89
+ /** The new lease with its freshly issued fence. */
90
+ readonly lease: IWriterLease;
91
+ } | {
92
+ /** Another unexpired holder owns the store. */
93
+ readonly kind: 'held';
94
+ /** The observed holder identity. */
95
+ readonly holder: string;
96
+ /** When that holder's lease expires, in History's clock domain. */
97
+ readonly expiresAt: number;
98
+ };
99
+ /** A request for the writer lease. @alpha */
100
+ export interface IWriterAcquisitionRequest {
101
+ /** The opaque non-empty identity of the prospective holder. */
102
+ readonly holder: string;
103
+ /** Positive safe-integer lease duration in milliseconds. */
104
+ readonly leaseMilliseconds: number;
105
+ }
106
+ /**
107
+ * Identifies one admitted execution for allocation or recovery. The attempt
108
+ * key is a stable caller-derived identity for exactly one execution, scoped by
109
+ * logical store, analysis, environment and subject; it is not a subject-level
110
+ * cache key. The intent digest is an opaque digest Resolution computes from
111
+ * the complete invocation it intends to run; History compares it only for
112
+ * exact equality, so a reused key with a different intent is a conflict.
113
+ * @alpha
114
+ */
115
+ export interface IAttemptRequest extends IVersionedSubject {
116
+ /** The stable key of one admitted execution. */
117
+ readonly attemptKey: string;
118
+ /** Resolution's opaque digest of that execution's complete intent. */
119
+ readonly intentDigest: string;
120
+ }
121
+ /**
122
+ * Durable attempt lifecycle. `allocated` and `staged` are incomplete;
123
+ * `completed` produced exactly one published result; `failed` and
124
+ * `interrupted` ended without a result. Staged content is attempt evidence,
125
+ * never a completed result.
126
+ * @alpha
127
+ */
128
+ export type IAttemptState = 'allocated' | 'staged' | 'completed' | 'failed' | 'interrupted';
129
+ /**
130
+ * One durable attempt as History records it. The attempt identity is issued
131
+ * from a store-wide counter that never reissues a value, including after
132
+ * abandonment or process death (PUB-003).
133
+ * @alpha
134
+ */
135
+ export interface IAttemptRecord extends IAttemptRequest {
136
+ /** The never-reused store-wide attempt identity. */
137
+ readonly attemptId: number;
138
+ /** The current lifecycle state. */
139
+ readonly state: IAttemptState;
140
+ /** The fence of the lease that allocated this attempt. */
141
+ readonly allocatedFence: number;
142
+ /** The fence that completed, failed or interrupted it; null while incomplete. */
143
+ readonly endedFence: number | null;
144
+ /** The exact completed result, present only in the `completed` state. */
145
+ readonly result: ICompletedResultReference | null;
146
+ /** Owner-defined evidence of a failed or interrupted attempt, otherwise null. */
147
+ readonly outcome: IVersionedRecord | null;
148
+ }
149
+ /**
150
+ * Candidate content for an allocated attempt. The payload must be supported
151
+ * Value data with a record or array root; the provenance is Resolution's
152
+ * versioned record; dependencies are exact references to completed results in
153
+ * the same store and scope that this execution consumed.
154
+ * @alpha
155
+ */
156
+ export interface IStageRequest {
157
+ /** The allocated attempt to stage. */
158
+ readonly attemptId: number;
159
+ /** The author result data, copied into canonical MDS1 form. */
160
+ readonly payload: unknown;
161
+ /** Resolution's execution provenance for this attempt. */
162
+ readonly provenance: IVersionedRecord;
163
+ /** Exact completed results this execution depends on, in the caller's order. */
164
+ readonly dependencies: readonly ICompletedResultReference[];
165
+ }
166
+ /** Ends an incomplete attempt without a result, preserving its evidence. @alpha */
167
+ export interface IAbandonRequest {
168
+ /** The incomplete attempt to end. */
169
+ readonly attemptId: number;
170
+ /** Whether execution failed or was interrupted. */
171
+ readonly outcome: 'failed' | 'interrupted';
172
+ /** Owner-defined evidence of what happened. */
173
+ readonly evidence: IVersionedRecord;
174
+ }
175
+ /**
176
+ * Read-only recovery of one identified execution. Recovery reports what
177
+ * durably happened and never executes, publishes or records acceptance:
178
+ * `absent` means the key was never allocated in this scope, `incomplete` an
179
+ * allocated or staged attempt, `unsuccessful` a failed or interrupted one and
180
+ * `completed` the exact result that execution published.
181
+ * @alpha
182
+ */
183
+ export type IRecoveryOutcome = {
184
+ readonly kind: 'absent';
185
+ } | {
186
+ readonly kind: 'incomplete';
187
+ readonly attempt: IAttemptRecord;
188
+ } | {
189
+ readonly kind: 'unsuccessful';
190
+ readonly attempt: IAttemptRecord;
191
+ } | {
192
+ readonly kind: 'completed';
193
+ readonly attempt: IAttemptRecord;
194
+ /** The exact result that this identified execution published. */
195
+ readonly reference: ICompletedResultReference;
196
+ };
197
+ /**
198
+ * Framework metadata of one immutable completed result, readable without
199
+ * loading its author payload. Provenance and dependencies are the historical
200
+ * truth recorded at publication; later acceptance never rewrites them (RES-007).
201
+ * @alpha
202
+ */
203
+ export interface ICompletedEnvelope extends IVersionedSubject {
204
+ /** The exact scoped reference of this result. */
205
+ readonly reference: ICompletedResultReference;
206
+ /** The attempt that produced this result; a result has exactly one. */
207
+ readonly attemptId: number;
208
+ /** Store-wide publication order; later publications have larger values. */
209
+ readonly publication: number;
210
+ /** The supported Value snapshot encoding of the stored payload. */
211
+ readonly encoding: 'MDS1';
212
+ /** Resolution's execution provenance, decoded and frozen. */
213
+ readonly provenance: IVersionedRecord;
214
+ /** Exact completed results this execution depended on, in recorded order. */
215
+ readonly dependencies: readonly ICompletedResultReference[];
216
+ }
217
+ /**
218
+ * Records that an existing completed result was accepted by a current
219
+ * verification. It needs writer ownership to write, but no attempt: a valid
220
+ * hit claims no execution. The evidence names the current dependencies the
221
+ * verification followed, which may differ from the original provenance.
222
+ * @alpha
223
+ */
224
+ export interface IAcceptanceRequest {
225
+ /** The exact completed result that was accepted. */
226
+ readonly reference: ICompletedResultReference;
227
+ /** Resolution's versioned acceptance evidence. */
228
+ readonly evidence: IVersionedRecord;
229
+ /** Exact completed results the current verification followed. */
230
+ readonly dependencies: readonly ICompletedResultReference[];
231
+ }
232
+ /** One immutable current-acceptance record, separate from the result it names. @alpha */
233
+ export interface IAcceptanceRecord {
234
+ /** Store-wide never-reused acceptance identity, increasing in record order. */
235
+ readonly acceptanceId: number;
236
+ /** The accepted exact result. */
237
+ readonly reference: ICompletedResultReference;
238
+ /** The writer fence under which the acceptance was recorded. */
239
+ readonly fence: number;
240
+ /** Resolution's acceptance evidence, decoded and frozen. */
241
+ readonly evidence: IVersionedRecord;
242
+ /** Exact results the verification followed, in recorded order. */
243
+ readonly dependencies: readonly ICompletedResultReference[];
244
+ }
245
+ /**
246
+ * Result of regenerating a completed result's selected index from its stored
247
+ * canonical payload and comparing it with the stored index.
248
+ * @alpha
249
+ */
250
+ export type IResultVerification = {
251
+ readonly kind: 'consistent';
252
+ } | {
253
+ readonly kind: 'inconsistent';
254
+ readonly detail: string;
255
+ };
256
+ /**
257
+ * Host capabilities and identity for opening a durable History store. Node
258
+ * access stays behind the injected SQLite and clock capabilities. The logical
259
+ * store identity is independent of the file location: a moved file keeps its
260
+ * identity, and a file holding another logical store is rejected.
261
+ * @alpha
262
+ */
263
+ export interface IDurableHistoryOptions {
264
+ /** Opens the persistent SQLite file; History owns every statement and schema. */
265
+ readonly sqlite: ISqliteCapability;
266
+ /** Supplies wall-clock observations for History's lease policy. */
267
+ readonly clock: IClockCapability;
268
+ /** Computes content fingerprints for the selected index. */
269
+ readonly sha256: ISha256Capability;
270
+ /** The host location of the SQLite file, passed only to `sqlite`. */
271
+ readonly location: string;
272
+ /** The logical store identity this file must hold, or is created to hold. */
273
+ readonly logicalStore: string;
274
+ }
275
+ /**
276
+ * History's durable authority over one logical store. Every mutation except
277
+ * acquisition requires the current writer lease and checks holder, fence and
278
+ * unexpired lease inside its own transaction. Exact reads never consult a
279
+ * current pointer, and a missing or wrong-scope reference is an integrity
280
+ * failure, never a miss to be repaired by recomputation.
281
+ *
282
+ * Clock policy: each holder operation evaluates time as the larger of the
283
+ * host reading and a persisted store-wide high-water, then persists that value,
284
+ * including when the operation is rejected. Backward host movement therefore
285
+ * delays expiry and a forward jump can expire a lease early; neither lets an
286
+ * old fence act after a successor acquires, because every successor receives a
287
+ * larger fence. A host reading that is not a nonnegative safe integer fails
288
+ * the operation without any change. This is a local single-file policy, not a
289
+ * distributed-time or liveness guarantee.
290
+ * @alpha
291
+ */
292
+ export interface IDurableHistory {
293
+ /** The logical store identity this authority holds. */
294
+ readonly logicalStore: string;
295
+ /** Exact selected reads over completed results, answered from their generated index. */
296
+ readonly reader: ICompletedResultReader & ICompletedNavigationReader;
297
+ /** Acquire the single logical writer, or report the observed unexpired holder. */
298
+ acquireWriter(request: IWriterAcquisitionRequest): IWriterAcquisition;
299
+ /** Extend a still-valid lease; a stale or expired lease is rejected. */
300
+ renewWriter(lease: IWriterLease, leaseMilliseconds: number): IWriterLease;
301
+ /** End a still-valid lease without resetting the fence. */
302
+ releaseWriter(lease: IWriterLease): void;
303
+ /** Inspect the recorded holder, if any, without granting authority. */
304
+ currentWriter(): IWriterLease | undefined;
305
+ /**
306
+ * Durably allocate one attempt in its own commit before any staging. The
307
+ * same key with the same intent returns the existing attempt in whatever
308
+ * state it reached; the same key with a different intent or version rejects.
309
+ */
310
+ allocateAttempt(lease: IWriterLease, request: IAttemptRequest): IAttemptRecord;
311
+ /** Persist candidate content for an allocated attempt without publishing it. */
312
+ stageAttempt(lease: IWriterLease, request: IStageRequest): IAttemptRecord;
313
+ /**
314
+ * In one commit, install the staged payload, its generated selected index
315
+ * and fingerprints, provenance, dependencies, the completed attempt state
316
+ * and the scoped current pointer. Publishing an already completed attempt
317
+ * returns its existing reference.
318
+ */
319
+ publishAttempt(lease: IWriterLease, attemptId: number): ICompletedResultReference;
320
+ /** End an incomplete attempt as failed or interrupted, retaining its evidence. */
321
+ abandonAttempt(lease: IWriterLease, request: IAbandonRequest): IAttemptRecord;
322
+ /** Report what durably happened to one identified execution, read-only. */
323
+ recoverAttempt(request: IAttemptRequest): IRecoveryOutcome;
324
+ /** Completed results for one scoped subject and version, latest publication first. */
325
+ findCandidates(subject: IVersionedSubject): readonly ICompletedEnvelope[];
326
+ /** The scoped subject's latest publication, if any; never rewound by acceptance. */
327
+ readCurrent(subject: IScopedSubject): ICompletedResultReference | undefined;
328
+ /** Read one exact result's metadata without loading its payload. */
329
+ readEnvelope(reference: ICompletedResultReference): ICompletedEnvelope;
330
+ /** Regenerate and compare one exact result's index from its canonical payload. */
331
+ verifyResult(reference: ICompletedResultReference): IResultVerification;
332
+ /** Record a current acceptance of an existing result without touching it or the current pointer. */
333
+ recordAcceptance(lease: IWriterLease, request: IAcceptanceRequest): IAcceptanceRecord;
334
+ /** Acceptance records naming one exact result, in record order. */
335
+ readAcceptances(reference: ICompletedResultReference): readonly IAcceptanceRecord[];
336
+ /** Release the SQLite file; later calls fail. */
337
+ close(): void;
338
+ }
339
+ //# sourceMappingURL=contracts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../../src/durable/contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAElG,OAAO,KAAK,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAE7H;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,0CAA0C;IAC1C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,oDAAoD;IACpD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED;;;;;GAKG;AACH,MAAM,WAAW,cAAe,SAAQ,aAAa;IACnD,+EAA+E;IAC/E,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;GAKG;AACH,MAAM,WAAW,iBAAkB,SAAQ,cAAc;IACvD,qDAAqD;IACrD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAgB;IAC/B,+EAA+E;IAC/E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;I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AC,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,GAAG,yBAAyB,CAAC;IAClF,kFAAkF;IAClF,cAAc,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,eAAe,GAAG,cAAc,CAAC;IAC9E,2EAA2E;IAC3E,cAAc,CAAC,OAAO,EAAE,eAAe,GAAG,gBAAgB,CAAC;IAE3D,sFAAsF;IACtF,cAAc,CAAC,OAAO,EAAE,iBAAiB,GAAG,SAAS,kBAAkB,EAAE,CAAC;IAC1E,oFAAoF;IACpF,WAAW,CAAC,OAAO,EAAE,cAAc,GAAG,yBAAyB,GAAG,SAAS,CAAC;IAC5E,oEAAoE;IACpE,YAAY,CAAC,SAAS,EAAE,yBAAyB,GAAG,kBAAkB,CAAC;IACvE,kFAAkF;IAClF,YAAY,CAAC,SAAS,EAAE,yBAAyB,GAAG,mBAAmB,CAAC;IAExE,oGAAoG;IACpG,gBAAgB,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,kBAAkB,GAAG,iBAAiB,CAAC;IACtF,mEAAmE;IACnE,eAAe,CAAC,SAAS,EAAE,yBAAyB,GAAG,SAAS,iBAAiB,EAAE,CAAC;IAEpF,iDAAiD;IACjD,KAAK,IAAI,IAAI,CAAC;CACf"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=contracts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../../src/durable/contracts.ts"],"names":[],"mappings":""}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Distinct failure classes of the durable History authority. Diagnostics must
3
+ * distinguish stale ownership, conflicting execution identity, invalid
4
+ * lifecycle transitions, unsupported storage and integrity failures rather
5
+ * than report a generic miss (execution.md, required validation fixtures).
6
+ * None of these classes extends `TypeError`, so a reader never mistakes a
7
+ * storage failure for Value's rejection of a selection's shape.
8
+ * @packageDocumentation
9
+ */
10
+ /**
11
+ * The store's contents contradict History's invariants or the caller's exact
12
+ * reference: a malformed, missing or wrong-scope reference, a dangling
13
+ * dependency, or index/payload content that does not match its digests.
14
+ * History never repairs such a failure by following a current pointer or
15
+ * recomputing.
16
+ * @alpha
17
+ */
18
+ export declare class HistoryIntegrityError extends Error {
19
+ /** Create an integrity failure with a diagnostic message. */
20
+ constructor(message: string);
21
+ }
22
+ /**
23
+ * The SQLite file does not hold exactly History's supported schema for the
24
+ * requested logical store: unknown, incomplete, foreign or differently
25
+ * versioned storage is rejected before any work rather than migrated by guess.
26
+ * @alpha
27
+ */
28
+ export declare class HistorySchemaError extends Error {
29
+ /** Create a schema rejection with a diagnostic message. */
30
+ constructor(message: string);
31
+ }
32
+ /**
33
+ * A presented writer lease no longer matches the durable holder, fence or
34
+ * unexpired lease, so the mutation was rejected with no change other than the
35
+ * observed clock high-water (PUB-002).
36
+ * @alpha
37
+ */
38
+ export declare class StaleWriterError extends Error {
39
+ /** Create a stale-ownership rejection with a diagnostic message. */
40
+ constructor(message: string);
41
+ }
42
+ /**
43
+ * An attempt key is already bound to a different execution intent, version
44
+ * or scoped subject. The key identifies one execution; it cannot serve another.
45
+ * @alpha
46
+ */
47
+ export declare class AttemptConflictError extends Error {
48
+ /** Create an execution-identity conflict with a diagnostic message. */
49
+ constructor(message: string);
50
+ }
51
+ /**
52
+ * A lifecycle operation was requested from a state that does not permit it,
53
+ * such as staging a completed attempt or publishing one that was never staged.
54
+ * @alpha
55
+ */
56
+ export declare class AttemptStateError extends Error {
57
+ /** Create an invalid-transition rejection with a diagnostic message. */
58
+ constructor(message: string);
59
+ }
60
+ /**
61
+ * The injected clock failed to produce a nonnegative safe-integer epoch
62
+ * millisecond reading, so the time-dependent operation was refused unchanged.
63
+ * @alpha
64
+ */
65
+ export declare class HistoryClockError extends Error {
66
+ /** Create a clock refusal with a diagnostic message. */
67
+ constructor(message: string);
68
+ }
69
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/durable/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;GAOG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,6DAA6D;gBAC1C,OAAO,EAAE,MAAM;CAInC;AAED;;;;;GAKG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,2DAA2D;gBACxC,OAAO,EAAE,MAAM;CAInC;AAED;;;;;GAKG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,oEAAoE;gBACjD,OAAO,EAAE,MAAM;CAInC;AAED;;;;GAIG;AACH,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,uEAAuE;gBACpD,OAAO,EAAE,MAAM;CAInC;AAED;;;;GAIG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,wEAAwE;gBACrD,OAAO,EAAE,MAAM;CAInC;AAED;;;;GAIG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,wDAAwD;gBACrC,OAAO,EAAE,MAAM;CAInC"}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Distinct failure classes of the durable History authority. Diagnostics must
3
+ * distinguish stale ownership, conflicting execution identity, invalid
4
+ * lifecycle transitions, unsupported storage and integrity failures rather
5
+ * than report a generic miss (execution.md, required validation fixtures).
6
+ * None of these classes extends `TypeError`, so a reader never mistakes a
7
+ * storage failure for Value's rejection of a selection's shape.
8
+ * @packageDocumentation
9
+ */
10
+ /**
11
+ * The store's contents contradict History's invariants or the caller's exact
12
+ * reference: a malformed, missing or wrong-scope reference, a dangling
13
+ * dependency, or index/payload content that does not match its digests.
14
+ * History never repairs such a failure by following a current pointer or
15
+ * recomputing.
16
+ * @alpha
17
+ */
18
+ export class HistoryIntegrityError extends Error {
19
+ /** Create an integrity failure with a diagnostic message. */
20
+ constructor(message) {
21
+ super(message);
22
+ this.name = 'HistoryIntegrityError';
23
+ }
24
+ }
25
+ /**
26
+ * The SQLite file does not hold exactly History's supported schema for the
27
+ * requested logical store: unknown, incomplete, foreign or differently
28
+ * versioned storage is rejected before any work rather than migrated by guess.
29
+ * @alpha
30
+ */
31
+ export class HistorySchemaError extends Error {
32
+ /** Create a schema rejection with a diagnostic message. */
33
+ constructor(message) {
34
+ super(message);
35
+ this.name = 'HistorySchemaError';
36
+ }
37
+ }
38
+ /**
39
+ * A presented writer lease no longer matches the durable holder, fence or
40
+ * unexpired lease, so the mutation was rejected with no change other than the
41
+ * observed clock high-water (PUB-002).
42
+ * @alpha
43
+ */
44
+ export class StaleWriterError extends Error {
45
+ /** Create a stale-ownership rejection with a diagnostic message. */
46
+ constructor(message) {
47
+ super(message);
48
+ this.name = 'StaleWriterError';
49
+ }
50
+ }
51
+ /**
52
+ * An attempt key is already bound to a different execution intent, version
53
+ * or scoped subject. The key identifies one execution; it cannot serve another.
54
+ * @alpha
55
+ */
56
+ export class AttemptConflictError extends Error {
57
+ /** Create an execution-identity conflict with a diagnostic message. */
58
+ constructor(message) {
59
+ super(message);
60
+ this.name = 'AttemptConflictError';
61
+ }
62
+ }
63
+ /**
64
+ * A lifecycle operation was requested from a state that does not permit it,
65
+ * such as staging a completed attempt or publishing one that was never staged.
66
+ * @alpha
67
+ */
68
+ export class AttemptStateError extends Error {
69
+ /** Create an invalid-transition rejection with a diagnostic message. */
70
+ constructor(message) {
71
+ super(message);
72
+ this.name = 'AttemptStateError';
73
+ }
74
+ }
75
+ /**
76
+ * The injected clock failed to produce a nonnegative safe-integer epoch
77
+ * millisecond reading, so the time-dependent operation was refused unchanged.
78
+ * @alpha
79
+ */
80
+ export class HistoryClockError extends Error {
81
+ /** Create a clock refusal with a diagnostic message. */
82
+ constructor(message) {
83
+ super(message);
84
+ this.name = 'HistoryClockError';
85
+ }
86
+ }
87
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/durable/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;GAOG;AACH,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAC9C,6DAA6D;IAC7D,YAAmB,OAAe;QAChC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACtC,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAC3C,2DAA2D;IAC3D,YAAmB,OAAe;QAChC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACnC,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IACzC,oEAAoE;IACpE,YAAmB,OAAe;QAChC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAC7C,uEAAuE;IACvE,YAAmB,OAAe;QAChC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACrC,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAC1C,wEAAwE;IACxE,YAAmB,OAAe;QAChC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAC1C,wDAAwD;IACxD,YAAmB,OAAe;QAChC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF"}