@microdelta/history 0.1.0 → 0.3.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.
- package/README.md +15 -3
- package/dist/api/history.alpha.d.ts +2 -2
- package/dist/api/history.root.raw.alpha.d.ts +380 -21
- package/dist/api/history.root.raw.beta.d.ts +40 -2
- package/dist/api/history.root.raw.public.d.ts +40 -2
- package/dist/api/history.root.raw.untrimmed.d.ts +380 -21
- package/dist/api/history.shared.alpha.d.ts +376 -19
- package/dist/api/history.shared.beta.d.ts +36 -0
- package/dist/api/history.shared.public.d.ts +36 -0
- package/dist/api/history.shared.untrimmed.d.ts +376 -19
- package/dist/api/history.untrimmed.d.ts +2 -2
- package/dist/src/durable/contracts.d.ts +292 -17
- package/dist/src/durable/contracts.d.ts.map +1 -1
- package/dist/src/durable/errors.d.ts +44 -3
- package/dist/src/durable/errors.d.ts.map +1 -1
- package/dist/src/durable/errors.js +43 -7
- package/dist/src/durable/errors.js.map +1 -1
- package/dist/src/durable/index.d.ts.map +1 -1
- package/dist/src/durable/index.js +299 -111
- package/dist/src/durable/index.js.map +1 -1
- package/dist/src/durable/journal.d.ts +53 -0
- package/dist/src/durable/journal.d.ts.map +1 -0
- package/dist/src/durable/journal.js +174 -0
- package/dist/src/durable/journal.js.map +1 -0
- package/dist/src/durable/records.d.ts +40 -0
- package/dist/src/durable/records.d.ts.map +1 -0
- package/dist/src/durable/records.js +74 -0
- package/dist/src/durable/records.js.map +1 -0
- package/dist/src/durable/schema.d.ts +14 -3
- package/dist/src/durable/schema.d.ts.map +1 -1
- package/dist/src/durable/schema.js +99 -21
- package/dist/src/durable/schema.js.map +1 -1
- package/dist/src/durable/selected-index.d.ts.map +1 -1
- package/dist/src/durable/selected-index.js +19 -5
- package/dist/src/durable/selected-index.js.map +1 -1
- package/dist/src/durable/sqlite-boundary.d.ts +11 -0
- package/dist/src/durable/sqlite-boundary.d.ts.map +1 -0
- package/dist/src/durable/sqlite-boundary.js +79 -0
- package/dist/src/durable/sqlite-boundary.js.map +1 -0
- package/dist/src/index.d.ts +7 -5
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +5 -3
- package/dist/src/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -14,9 +14,21 @@ single-file schema, distinct from the legacy Store, with:
|
|
|
14
14
|
- never-reused attempt identities with stable keys and intent digests;
|
|
15
15
|
- staging and one-commit atomic publication with a current pointer per scoped subject;
|
|
16
16
|
- immutable completed results with an exact scoped selected reader generated from their canonical payload;
|
|
17
|
-
- separate acceptance records
|
|
17
|
+
- separate acceptance records, namespaced by the explicitly named environment that recorded them;
|
|
18
|
+
- environment namespaces within one store, so a trial run's attempts, heads,
|
|
19
|
+
candidates, acceptances and journal records never satisfy production;
|
|
20
|
+
- recorded, fenced promotions that admit named exact results of one environment
|
|
21
|
+
into another of the same analysis, without moving or rewriting either one's history;
|
|
22
|
+
- Run Supervision's operation journal: opaque versioned records per environment,
|
|
23
|
+
owner-named collection and key, committed atomically by compare-and-set under
|
|
24
|
+
writer fencing, with undeclared record formats and versions refused.
|
|
18
25
|
|
|
19
|
-
It stores Resolution's provenance
|
|
20
|
-
reuse eligibility
|
|
26
|
+
It stores Resolution's provenance and Supervision's journal records as
|
|
27
|
+
versioned opaque records and never decides reuse eligibility, freshness or
|
|
28
|
+
operation meaning. The durable schema is at version 3, which rejects replacement
|
|
29
|
+
of immutable records through primary keys, secondary unique keys and SQLite row
|
|
30
|
+
identity aliases. Existing version 1 and version 2 durable files, and files at
|
|
31
|
+
any other unsupported version, are explicitly rejected; no migration is
|
|
32
|
+
provided. The separate legacy Store schema is unchanged. See the
|
|
21
33
|
[package map](../../docs/package-map.md) and the
|
|
22
34
|
[durable History evidence record](../../docs/validation/m3-durable-history-2026-09-27.md).
|
|
@@ -1,3 +1,3 @@
|
|
|
1
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.alpha.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.alpha.js';
|
|
2
|
+
export { AttemptConflictError, AttemptStateError, DuplicateRowError, FingerprintAlgorithmMismatchError, HistoryBusyError, HistoryClockError, HistoryIntegrityError, HistorySchemaError, InvalidStorePatchError, JournalConflictError, JournalVersionError, MissingRowError, StaleWriterError, createMemoryStore, openDurableHistory } from './history.shared.alpha.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, IJournalAddress, IJournalCommit, IJournalDeclaration, IJournalFormat, IJournalQuery, IJournalRecord, IJournalWrite, IOperation, IOperationJournal, IPromotionQuery, IPromotionRecord, IPromotionRequest, IRecoveryOutcome, IResultVerification, IScopedSubject, ISelectedFact, ISelectedFingerprintRequest, ISelectedFingerprintResolution, ISelectedNode, ISelectedReadRequest, ISha256Capability, ISqliteCapability, ISqliteConnection, ISqliteOpenOptions, ISqliteRow, ISqliteRunResult, ISqliteStatement, ISqliteSynchronousResult, ISqliteValue, IStageRequest, IValueProjectionDescriptor, IValueProjectionFact, IValueProjectionMember, IValueProjectionTraversal, IVersionedRecord, IVersionedSubject, IWriterAcquisition, IWriterAcquisitionRequest, IWriterContention, IWriterLease, IWriterRenewal, Identity, MemoryStoreOptions, Outcome, Path, RecordedRead, ResultKey, Store, StoreMetadata, Subject, SubjectPatch, SubjectRow } from './history.shared.alpha.js';
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
* Result History & Publication. This entry exposes the existing row Store,
|
|
3
3
|
* its memory adapter and compatibility schema unchanged, the exact
|
|
4
4
|
* completed-result reading ports, and the project-private alpha durable
|
|
5
|
-
* authority that owns attempts, the single logical writer, atomic publication
|
|
6
|
-
*
|
|
5
|
+
* authority that owns attempts, the single logical writer, atomic publication,
|
|
6
|
+
* acceptance records, environment namespaces, recorded promotions and Run
|
|
7
|
+
* Supervision's opaque operation journal. It never decides candidate validity
|
|
8
|
+
* or freshness and never interprets journal records.
|
|
7
9
|
* @packageDocumentation
|
|
8
10
|
*/
|
|
9
11
|
|
|
@@ -108,6 +110,21 @@ export declare interface GenerationRow {
|
|
|
108
110
|
/** Retained lifecycle states interpreted by repository and claim, not by storage. @public */
|
|
109
111
|
export declare type GenerationState = 'claimed' | 'current' | 'superseded' | 'abandoned';
|
|
110
112
|
|
|
113
|
+
/**
|
|
114
|
+
* A History-owned SQLite operation exhausted Machine's bounded busy wait.
|
|
115
|
+
* The exact host failure is retained as `cause`, so callers can distinguish
|
|
116
|
+
* contention from corruption or a stale writer without losing host detail.
|
|
117
|
+
* History wraps only failures raised at its SQLite capability boundary, never
|
|
118
|
+
* an application callback that happened to throw a Machine busy error.
|
|
119
|
+
* @alpha
|
|
120
|
+
*/
|
|
121
|
+
export declare class HistoryBusyError extends Error {
|
|
122
|
+
/** The exact Machine failure that History received. */
|
|
123
|
+
readonly cause: SqliteBusyError;
|
|
124
|
+
/** Create History's boundary failure while retaining the original host error. */
|
|
125
|
+
constructor(message: string, cause: SqliteBusyError);
|
|
126
|
+
}
|
|
127
|
+
|
|
111
128
|
/**
|
|
112
129
|
* The injected clock failed to produce a nonnegative safe-integer epoch
|
|
113
130
|
* millisecond reading, so the time-dependent operation was refused unchanged.
|
|
@@ -158,6 +175,8 @@ export declare interface IAcceptanceRecord {
|
|
|
158
175
|
readonly acceptanceId: number;
|
|
159
176
|
/** The accepted exact result. */
|
|
160
177
|
readonly reference: ICompletedResultReference;
|
|
178
|
+
/** The environment namespace whose verification recorded this acceptance. */
|
|
179
|
+
readonly environment: string;
|
|
161
180
|
/** The writer fence under which the acceptance was recorded. */
|
|
162
181
|
readonly fence: number;
|
|
163
182
|
/** Resolution's acceptance evidence, decoded and frozen. */
|
|
@@ -178,8 +197,22 @@ export declare interface IAcceptanceRequest {
|
|
|
178
197
|
readonly reference: ICompletedResultReference;
|
|
179
198
|
/** Resolution's versioned acceptance evidence. */
|
|
180
199
|
readonly evidence: IVersionedRecord;
|
|
181
|
-
/**
|
|
200
|
+
/**
|
|
201
|
+
* Exact completed results the current verification followed. Each must be
|
|
202
|
+
* admissible in the accepting environment: published there, or named by a
|
|
203
|
+
* promotion into it.
|
|
204
|
+
*/
|
|
182
205
|
readonly dependencies: readonly ICompletedResultReference[];
|
|
206
|
+
/**
|
|
207
|
+
* The environment, within the result's analysis, whose current verification
|
|
208
|
+
* accepted the result. It is always explicit and never inferred from the
|
|
209
|
+
* reference: the caller names its own run environment. It may be the
|
|
210
|
+
* environment that published the result, or another environment into which
|
|
211
|
+
* a recorded promotion admits the result. The acceptance then belongs to
|
|
212
|
+
* that environment's namespace alone and never satisfies a lookup in any
|
|
213
|
+
* other environment.
|
|
214
|
+
*/
|
|
215
|
+
readonly environment: string;
|
|
183
216
|
}
|
|
184
217
|
|
|
185
218
|
/** @alpha A path segment whose kind follows the container's operation semantics. */
|
|
@@ -371,6 +404,17 @@ export declare type Identity = {
|
|
|
371
404
|
* larger fence. A host reading that is not a nonnegative safe integer fails
|
|
372
405
|
* the operation without any change. This is a local single-file policy, not a
|
|
373
406
|
* distributed-time or liveness guarantee.
|
|
407
|
+
*
|
|
408
|
+
* Storage contention: every mutation, including acquisition, is one IMMEDIATE
|
|
409
|
+
* SQLite transaction. When another connection, possibly in another process,
|
|
410
|
+
* holds SQLite's write lock past the host's bounded busy wait, nothing
|
|
411
|
+
* changes. Acquisition and renewal, the lease operations a waiter repeats,
|
|
412
|
+
* report it as their `contended` outcome ({@link IWriterContention}), so
|
|
413
|
+
* contention is never mistaken for ownership or staleness (PUB-005). Any other
|
|
414
|
+
* History-owned SQLite operation, including opening and reads, fails with
|
|
415
|
+
* `HistoryBusyError` whose cause is the exact Machine `SqliteBusyError`.
|
|
416
|
+
* Callback-thrown failures retain their identity and do not become contention
|
|
417
|
+
* outcomes. Whether to try again is always the caller's policy, never History's.
|
|
374
418
|
* @alpha
|
|
375
419
|
*/
|
|
376
420
|
export declare interface IDurableHistory {
|
|
@@ -378,11 +422,20 @@ export declare interface IDurableHistory {
|
|
|
378
422
|
readonly logicalStore: string;
|
|
379
423
|
/** Exact selected reads over completed results, answered from their generated index. */
|
|
380
424
|
readonly reader: ICompletedResultReader & ICompletedNavigationReader;
|
|
381
|
-
/**
|
|
425
|
+
/**
|
|
426
|
+
* Acquire the single logical writer, or report the observed unexpired
|
|
427
|
+
* holder, or report storage contention with the recorded writer. Any other
|
|
428
|
+
* failure, such as damaged storage or an unusable clock, is thrown.
|
|
429
|
+
*/
|
|
382
430
|
acquireWriter(request: IWriterAcquisitionRequest): IWriterAcquisition;
|
|
383
|
-
/**
|
|
384
|
-
|
|
385
|
-
|
|
431
|
+
/**
|
|
432
|
+
* Extend a still-valid lease, or report storage contention, which leaves the
|
|
433
|
+
* lease as it was. A stale or expired lease is rejected with
|
|
434
|
+
* `StaleWriterError`. Only the expiry changes: the durable fence is left as
|
|
435
|
+
* it is, never rewritten from the presented lease.
|
|
436
|
+
*/
|
|
437
|
+
renewWriter(lease: IWriterLease, leaseMilliseconds: number): IWriterRenewal;
|
|
438
|
+
/** End a still-valid lease; the durable fence is left as it is, so the next grant still advances it. */
|
|
386
439
|
releaseWriter(lease: IWriterLease): void;
|
|
387
440
|
/** Inspect the recorded holder, if any, without granting authority. */
|
|
388
441
|
currentWriter(): IWriterLease | undefined;
|
|
@@ -405,9 +458,17 @@ export declare interface IDurableHistory {
|
|
|
405
458
|
abandonAttempt(lease: IWriterLease, request: IAbandonRequest): IAttemptRecord;
|
|
406
459
|
/** Report what durably happened to one identified execution, read-only. */
|
|
407
460
|
recoverAttempt(request: IAttemptRequest): IRecoveryOutcome;
|
|
408
|
-
/**
|
|
461
|
+
/**
|
|
462
|
+
* Completed results admissible for one scoped subject and version, latest
|
|
463
|
+
* publication first: those published in the subject's environment and those
|
|
464
|
+
* a recorded promotion admits into it. A promoted result keeps its own exact
|
|
465
|
+
* reference and envelope scope; nothing from any other environment appears.
|
|
466
|
+
*/
|
|
409
467
|
findCandidates(subject: IVersionedSubject): readonly ICompletedEnvelope[];
|
|
410
|
-
/**
|
|
468
|
+
/**
|
|
469
|
+
* The scoped subject's latest publication in its own environment, if any;
|
|
470
|
+
* never rewound by acceptance and never moved by a promotion.
|
|
471
|
+
*/
|
|
411
472
|
readCurrent(subject: IScopedSubject): ICompletedResultReference | undefined;
|
|
412
473
|
/** Read one exact result's metadata without loading its payload. */
|
|
413
474
|
readEnvelope(reference: ICompletedResultReference): ICompletedEnvelope;
|
|
@@ -415,8 +476,25 @@ export declare interface IDurableHistory {
|
|
|
415
476
|
verifyResult(reference: ICompletedResultReference): IResultVerification;
|
|
416
477
|
/** Record a current acceptance of an existing result without touching it or the current pointer. */
|
|
417
478
|
recordAcceptance(lease: IWriterLease, request: IAcceptanceRequest): IAcceptanceRecord;
|
|
418
|
-
/**
|
|
419
|
-
|
|
479
|
+
/**
|
|
480
|
+
* Acceptance records naming one exact result that were recorded in the
|
|
481
|
+
* named environment, in record order. The environment is always explicit:
|
|
482
|
+
* the publishing environment, or one a promotion admits the result into.
|
|
483
|
+
*/
|
|
484
|
+
readAcceptances(reference: ICompletedResultReference, environment: string): readonly IAcceptanceRecord[];
|
|
485
|
+
/**
|
|
486
|
+
* In one commit, record a promotion that admits exact results of other
|
|
487
|
+
* environments into the target environment. Nothing already recorded changes.
|
|
488
|
+
*/
|
|
489
|
+
promoteResults(lease: IWriterLease, request: IPromotionRequest): IPromotionRecord;
|
|
490
|
+
/** Promotion records into one environment, in record order. */
|
|
491
|
+
readPromotions(query: IPromotionQuery): readonly IPromotionRecord[];
|
|
492
|
+
/**
|
|
493
|
+
* Open Run Supervision's operation journal over this store, bound to the
|
|
494
|
+
* declared record formats and versions. The port shares this authority's
|
|
495
|
+
* connection, writer lease and lifetime.
|
|
496
|
+
*/
|
|
497
|
+
openJournal(declaration: IJournalDeclaration): IOperationJournal;
|
|
420
498
|
/** Release the SQLite file; later calls fail. */
|
|
421
499
|
close(): void;
|
|
422
500
|
}
|
|
@@ -445,7 +523,10 @@ export declare interface IDurableHistoryOptions {
|
|
|
445
523
|
* The analysis and environment that scope every subject, attempt and result
|
|
446
524
|
* within one logical store. The same subject text in another analysis or
|
|
447
525
|
* environment is a different scoped subject (RES-001/002). Both are complete
|
|
448
|
-
* opaque non-empty strings compared by exact equality.
|
|
526
|
+
* opaque non-empty strings compared by exact equality. An environment is a
|
|
527
|
+
* namespace within one store (RUN-017): a trial and a production run of the
|
|
528
|
+
* same analysis use different environments of the same file, selected per
|
|
529
|
+
* call rather than process-wide.
|
|
449
530
|
* @alpha
|
|
450
531
|
*/
|
|
451
532
|
export declare interface IHistoryScope {
|
|
@@ -455,14 +536,198 @@ export declare interface IHistoryScope {
|
|
|
455
536
|
readonly environment: string;
|
|
456
537
|
}
|
|
457
538
|
|
|
539
|
+
/**
|
|
540
|
+
* Locates one journal record: its environment namespace, owner-named
|
|
541
|
+
* collection and owner-defined key. The record's identity is exactly this
|
|
542
|
+
* address; its format tag may change between revisions only by
|
|
543
|
+
* compare-and-set.
|
|
544
|
+
* @alpha
|
|
545
|
+
*/
|
|
546
|
+
export declare interface IJournalAddress extends IHistoryScope {
|
|
547
|
+
/** The owner-named non-empty collection, such as Supervision's operations. */
|
|
548
|
+
readonly collection: string;
|
|
549
|
+
/** The owner-defined non-empty key, unique within the namespace and collection. */
|
|
550
|
+
readonly key: string;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
/**
|
|
554
|
+
* One atomic journal commit in one environment namespace: every write lands
|
|
555
|
+
* in the same transaction, or none does.
|
|
556
|
+
* @alpha
|
|
557
|
+
*/
|
|
558
|
+
export declare interface IJournalCommit extends IHistoryScope {
|
|
559
|
+
/** At least one write, each collection and key pair at most once. */
|
|
560
|
+
readonly writes: readonly IJournalWrite[];
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* The formats a journal port is bound to. A stored record of an undeclared
|
|
565
|
+
* format or version is refused rather than returned or overwritten, so a
|
|
566
|
+
* caller never acts on, or clobbers, a record it does not understand.
|
|
567
|
+
* @alpha
|
|
568
|
+
*/
|
|
569
|
+
export declare interface IJournalDeclaration {
|
|
570
|
+
/** At least one declared format, each format named once. */
|
|
571
|
+
readonly formats: readonly IJournalFormat[];
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* One owner-defined journal record format and the exact format versions a
|
|
576
|
+
* journal port can read and write. A format is only a record's version tag:
|
|
577
|
+
* it never identifies a record or its collection. History compares the tag
|
|
578
|
+
* and versions for exact equality and never interprets the content.
|
|
579
|
+
* @alpha
|
|
580
|
+
*/
|
|
581
|
+
export declare interface IJournalFormat {
|
|
582
|
+
/** The owner-defined non-empty format identity. */
|
|
583
|
+
readonly format: string;
|
|
584
|
+
/** The positive safe-integer versions of that format this port understands. */
|
|
585
|
+
readonly versions: readonly number[];
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
/**
|
|
589
|
+
* Selects every record of one collection in one environment namespace.
|
|
590
|
+
* @alpha
|
|
591
|
+
*/
|
|
592
|
+
export declare interface IJournalQuery extends IHistoryScope {
|
|
593
|
+
/** The owner-named collection to list. */
|
|
594
|
+
readonly collection: string;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* One immutable revision of a journal record. Revisions of an address start
|
|
599
|
+
* at 1 and increase by one per committed write; earlier revisions are retained
|
|
600
|
+
* and never rewritten.
|
|
601
|
+
* @alpha
|
|
602
|
+
*/
|
|
603
|
+
export declare interface IJournalRecord extends IHistoryScope {
|
|
604
|
+
/** The owner-named collection. */
|
|
605
|
+
readonly collection: string;
|
|
606
|
+
/** The owner-defined key. */
|
|
607
|
+
readonly key: string;
|
|
608
|
+
/** This revision's number within its address, starting at 1. */
|
|
609
|
+
readonly revision: number;
|
|
610
|
+
/** Store-wide never-reused journal write identity, increasing in commit order. */
|
|
611
|
+
readonly sequence: number;
|
|
612
|
+
/** The writer fence under which this revision was committed. */
|
|
613
|
+
readonly fence: number;
|
|
614
|
+
/** The owner-defined record, decoded and frozen, with this revision's version tag. */
|
|
615
|
+
readonly record: IVersionedRecord;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
/**
|
|
619
|
+
* One compare-and-set write of a journal commit. The expected revision is the
|
|
620
|
+
* revision the caller last read at this address; `0` asserts that the key has
|
|
621
|
+
* never been written in the collection, under any format. The record's
|
|
622
|
+
* format and version are its version tag and must be declared by the port.
|
|
623
|
+
* @alpha
|
|
624
|
+
*/
|
|
625
|
+
export declare interface IJournalWrite {
|
|
626
|
+
/** The owner-named non-empty collection. */
|
|
627
|
+
readonly collection: string;
|
|
628
|
+
/** The owner-defined non-empty key. */
|
|
629
|
+
readonly key: string;
|
|
630
|
+
/** The current revision the write replaces, or `0` for a new key. */
|
|
631
|
+
readonly expectedRevision: number;
|
|
632
|
+
/** The new owner-defined record. */
|
|
633
|
+
readonly record: IVersionedRecord;
|
|
634
|
+
}
|
|
635
|
+
|
|
458
636
|
/** A patch attempted to modify an immutable address or managed CAS version. @public */
|
|
459
637
|
export declare class InvalidStorePatchError extends Error {
|
|
460
638
|
/** Identify a structurally forbidden patch before any columns are changed. @public */
|
|
461
639
|
constructor(message?: string);
|
|
462
640
|
}
|
|
463
641
|
|
|
464
|
-
/**
|
|
465
|
-
|
|
642
|
+
/**
|
|
643
|
+
* A supported observation operation with its own fact meaning. `container-kind`
|
|
644
|
+
* answers record, array or scalar without consuming any container member or
|
|
645
|
+
* scalar content; ordinary scalar reads still retain their literal values.
|
|
646
|
+
* @alpha
|
|
647
|
+
*/
|
|
648
|
+
export declare type IOperation = 'value' | 'own' | 'membership' | 'length' | 'keys' | 'container-kind';
|
|
649
|
+
|
|
650
|
+
/**
|
|
651
|
+
* Run Supervision's operation journal, stored by History (RUN-011/012). It
|
|
652
|
+
* keeps owner-defined operation and deferral records, such as an intent
|
|
653
|
+
* committed before a send or a "not before" deferral, atomically and under
|
|
654
|
+
* writer fencing, without interpreting them: History owns only namespacing,
|
|
655
|
+
* collections, revisions, fencing and the declared-version check. A commit
|
|
656
|
+
* needs the current writer lease and checks holder, fence and unexpired lease
|
|
657
|
+
* in the same transaction as its compare-and-set checks and writes; reads
|
|
658
|
+
* need no lease and never see an uncommitted write.
|
|
659
|
+
* @alpha
|
|
660
|
+
*/
|
|
661
|
+
export declare interface IOperationJournal {
|
|
662
|
+
/** The frozen formats and versions this port was opened with. */
|
|
663
|
+
readonly formats: readonly IJournalFormat[];
|
|
664
|
+
/**
|
|
665
|
+
* Commit every write in one transaction. The whole commit is refused,
|
|
666
|
+
* unchanged, for a stale lease, an undeclared format or version, a current
|
|
667
|
+
* revision whose stored format or version this port does not understand
|
|
668
|
+
* (checked first, since such a caller cannot have read it), or an expected
|
|
669
|
+
* revision that is not the address's current revision.
|
|
670
|
+
*/
|
|
671
|
+
commit(lease: IWriterLease, request: IJournalCommit): readonly IJournalRecord[];
|
|
672
|
+
/** The current revision at one address, or undefined if the key was never written there. */
|
|
673
|
+
read(address: IJournalAddress): IJournalRecord | undefined;
|
|
674
|
+
/** The current revision of every key in one collection, in order of first write. */
|
|
675
|
+
list(query: IJournalQuery): readonly IJournalRecord[];
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
/**
|
|
679
|
+
* Selects promotion records into one target environment, optionally only
|
|
680
|
+
* those naming one exact result.
|
|
681
|
+
* @alpha
|
|
682
|
+
*/
|
|
683
|
+
export declare interface IPromotionQuery {
|
|
684
|
+
/** The analysis and environment whose admitting promotions to read. */
|
|
685
|
+
readonly target: IHistoryScope;
|
|
686
|
+
/** When present, only promotions that name this exact result. */
|
|
687
|
+
readonly reference?: ICompletedResultReference;
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
/**
|
|
691
|
+
* One immutable promotion record. It admits the named results as candidates,
|
|
692
|
+
* dependencies and acceptance targets in its target environment and changes
|
|
693
|
+
* nothing else: each result keeps its exact reference, envelope, provenance
|
|
694
|
+
* and acceptances, and no current head moves in any environment. The target
|
|
695
|
+
* environment's later verifications record their own acceptances.
|
|
696
|
+
* @alpha
|
|
697
|
+
*/
|
|
698
|
+
export declare interface IPromotionRecord {
|
|
699
|
+
/** Store-wide never-reused promotion identity, increasing in record order. */
|
|
700
|
+
readonly promotionId: number;
|
|
701
|
+
/** The analysis and environment the results were admitted into. */
|
|
702
|
+
readonly target: IHistoryScope;
|
|
703
|
+
/** The writer fence under which the promotion was recorded. */
|
|
704
|
+
readonly fence: number;
|
|
705
|
+
/** The promoter's evidence, decoded and frozen. */
|
|
706
|
+
readonly evidence: IVersionedRecord;
|
|
707
|
+
/** The admitted exact results, each in its own publishing scope, in recorded order. */
|
|
708
|
+
readonly references: readonly ICompletedResultReference[];
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
/**
|
|
712
|
+
* Asks History to admit exact completed results of other environments into
|
|
713
|
+
* one target environment of the same analysis (RUN-017). A trial result
|
|
714
|
+
* satisfies a production lookup only through such a recorded promotion. The
|
|
715
|
+
* target names where the results are admitted; each reference keeps naming
|
|
716
|
+
* its own publishing environment. The evidence is the promoter's versioned
|
|
717
|
+
* record of who promoted what and why; History stores it opaquely.
|
|
718
|
+
* @alpha
|
|
719
|
+
*/
|
|
720
|
+
export declare interface IPromotionRequest {
|
|
721
|
+
/** The analysis and environment the results are admitted into. */
|
|
722
|
+
readonly target: IHistoryScope;
|
|
723
|
+
/**
|
|
724
|
+
* Distinct exact completed results of the target's analysis, none published
|
|
725
|
+
* in the target environment, in the promoter's order.
|
|
726
|
+
*/
|
|
727
|
+
readonly references: readonly ICompletedResultReference[];
|
|
728
|
+
/** The promoter's versioned evidence for this promotion. */
|
|
729
|
+
readonly evidence: IVersionedRecord;
|
|
730
|
+
}
|
|
466
731
|
|
|
467
732
|
/**
|
|
468
733
|
* Read-only recovery of one identified execution. Recovery reports what
|
|
@@ -566,7 +831,8 @@ export declare type ISelectedFingerprintResolution = {
|
|
|
566
831
|
* a lazy view, never a whole-object observation, so no member, identity or
|
|
567
832
|
* serialized subtree is implied. Array length is carried so a view need not ask
|
|
568
833
|
* again, but it becomes observation evidence only when a consumer reads it.
|
|
569
|
-
*
|
|
834
|
+
* Shape envelopes are never placed inside {@link ISelectedFact.fact}; Tracking
|
|
835
|
+
* may separately observe the bounded `container-kind` discriminant.
|
|
570
836
|
* @alpha
|
|
571
837
|
*/
|
|
572
838
|
export declare type ISelectedNode =
|
|
@@ -628,21 +894,23 @@ declare interface ISnapshotCapability {
|
|
|
628
894
|
* directory, a missing parent directory, a file that is not a SQLite database,
|
|
629
895
|
* or a location that cannot hold a persistent write-ahead-logged database,
|
|
630
896
|
* including `:memory:` and the empty path. Opening never silently weakens the
|
|
631
|
-
* host's durable configuration.
|
|
897
|
+
* host's durable configuration. Processes that open one new store at the same
|
|
898
|
+
* time all succeed within the bounded busy wait or fail with `SqliteBusyError`.
|
|
632
899
|
* @alpha
|
|
633
900
|
*/
|
|
634
901
|
export declare interface ISqliteCapability {
|
|
635
902
|
/** Open or create the database file at `location` and return its owned connection. */
|
|
636
|
-
openSqlite(location: string): ISqliteConnection;
|
|
903
|
+
openSqlite(location: string, options?: ISqliteOpenOptions): ISqliteConnection;
|
|
637
904
|
}
|
|
638
905
|
|
|
639
906
|
/**
|
|
640
907
|
* An open connection to one persistent local SQLite database file. The caller
|
|
641
908
|
* that opened it owns it and must close it. The host selects durable
|
|
642
|
-
* configuration for every connection:
|
|
909
|
+
* configuration for every connection: selected persistent journaling, FULL synchronous
|
|
643
910
|
* commits, enforced foreign keys and a bounded wait on a locked database.
|
|
644
911
|
* Callers supply every SQL statement and schema; the connection has no
|
|
645
|
-
* knowledge of what the tables mean.
|
|
912
|
+
* knowledge of what the tables mean. A statement, exec or transaction that
|
|
913
|
+
* cannot get a lock within the bounded wait fails with `SqliteBusyError`.
|
|
646
914
|
*
|
|
647
915
|
* Transactions are synchronous, top-level and IMMEDIATE: the write lock is
|
|
648
916
|
* taken before the callback runs, the callback's writes commit together when
|
|
@@ -677,6 +945,18 @@ export declare interface ISqliteConnection {
|
|
|
677
945
|
close(): void;
|
|
678
946
|
}
|
|
679
947
|
|
|
948
|
+
/** Host journal selection for dedicated storage; schema and retention remain caller-owned. @alpha */
|
|
949
|
+
export declare interface ISqliteOpenOptions {
|
|
950
|
+
/**
|
|
951
|
+
* WAL is the default. DELETE uses rollback journaling with FULL synchronous
|
|
952
|
+
* commits, allowing side-effect-free readers but permitting reader/writer
|
|
953
|
+
* contention. DELETE refuses existing WAL files instead of changing them.
|
|
954
|
+
* Cooperative owners must keep the pathname and journal layout stable from
|
|
955
|
+
* preflight through opening and for the lifetime of every handle.
|
|
956
|
+
*/
|
|
957
|
+
readonly journalMode: 'wal' | 'delete';
|
|
958
|
+
}
|
|
959
|
+
|
|
680
960
|
/**
|
|
681
961
|
* One result row keyed by result column name. Rows are transport data owned by
|
|
682
962
|
* the caller; they carry no driver type, prototype behavior or live link to
|
|
@@ -836,7 +1116,7 @@ export declare interface IVersionedSubject extends IScopedSubject {
|
|
|
836
1116
|
/**
|
|
837
1117
|
* The outcome of asking for the single logical writer. `held` reports an
|
|
838
1118
|
* observed unexpired holder, not a failed compare-and-swap (PUB-005), and
|
|
839
|
-
* grants nothing.
|
|
1119
|
+
* grants nothing; `contended` reports that storage was too busy to decide.
|
|
840
1120
|
* @alpha
|
|
841
1121
|
*/
|
|
842
1122
|
export declare type IWriterAcquisition = {
|
|
@@ -851,7 +1131,7 @@ export declare type IWriterAcquisition = {
|
|
|
851
1131
|
readonly holder: string;
|
|
852
1132
|
/** When that holder's lease expires, in History's clock domain. */
|
|
853
1133
|
readonly expiresAt: number;
|
|
854
|
-
};
|
|
1134
|
+
} | IWriterContention;
|
|
855
1135
|
|
|
856
1136
|
/** A request for the writer lease. @alpha */
|
|
857
1137
|
export declare interface IWriterAcquisitionRequest {
|
|
@@ -861,6 +1141,28 @@ export declare interface IWriterAcquisitionRequest {
|
|
|
861
1141
|
readonly leaseMilliseconds: number;
|
|
862
1142
|
}
|
|
863
1143
|
|
|
1144
|
+
/**
|
|
1145
|
+
* Storage contention on a lease operation: another connection, possibly in
|
|
1146
|
+
* another process, held SQLite's write lock past the host's bounded busy wait,
|
|
1147
|
+
* so History could not decide and changed nothing, not even the clock
|
|
1148
|
+
* high-water. It is a fact about storage, never about ownership (PUB-005): it
|
|
1149
|
+
* neither grants nor refuses, and whether to try again is the caller's policy.
|
|
1150
|
+
* @alpha
|
|
1151
|
+
*/
|
|
1152
|
+
export declare interface IWriterContention {
|
|
1153
|
+
/** History could not take SQLite's write lock in time. */
|
|
1154
|
+
readonly kind: 'contended';
|
|
1155
|
+
/**
|
|
1156
|
+
* The writer recorded at that moment, read without the write lock: its
|
|
1157
|
+
* holder, fence and expiry as stored, whether or not the lease has expired.
|
|
1158
|
+
* Undefined when no holder is recorded, or when that read was itself busy;
|
|
1159
|
+
* History never guesses a holder.
|
|
1160
|
+
*/
|
|
1161
|
+
readonly writer: IWriterLease | undefined;
|
|
1162
|
+
/** The host's diagnostic of the contention; it carries no stored values. */
|
|
1163
|
+
readonly detail: string;
|
|
1164
|
+
}
|
|
1165
|
+
|
|
864
1166
|
/**
|
|
865
1167
|
* Proof of current single-logical-writer ownership. The holder is an opaque
|
|
866
1168
|
* caller identity; the fence is the store-wide token issued at acquisition,
|
|
@@ -879,6 +1181,46 @@ export declare interface IWriterLease {
|
|
|
879
1181
|
readonly expiresAt: number;
|
|
880
1182
|
}
|
|
881
1183
|
|
|
1184
|
+
/**
|
|
1185
|
+
* The outcome of renewing a lease the caller holds: `renewed` with the later
|
|
1186
|
+
* expiry, or `contended` when storage was too busy to decide, in which case
|
|
1187
|
+
* the lease is exactly as it was and is neither renewed nor refused. A stale
|
|
1188
|
+
* or expired lease is not an outcome but a refusal (`StaleWriterError`).
|
|
1189
|
+
* @alpha
|
|
1190
|
+
*/
|
|
1191
|
+
export declare type IWriterRenewal = {
|
|
1192
|
+
/** The lease was extended. */
|
|
1193
|
+
readonly kind: 'renewed';
|
|
1194
|
+
/** The same holder and fence with the new expiry. */
|
|
1195
|
+
readonly lease: IWriterLease;
|
|
1196
|
+
} | IWriterContention;
|
|
1197
|
+
|
|
1198
|
+
/**
|
|
1199
|
+
* A journal commit's compare-and-set expectation does not hold: the presented
|
|
1200
|
+
* expected revision is not the key's current revision (a new-key expectation
|
|
1201
|
+
* met an existing key, or an update met a later or absent revision). The
|
|
1202
|
+
* whole commit was rolled back unchanged; the caller must re-read before
|
|
1203
|
+
* deciding again.
|
|
1204
|
+
* @alpha
|
|
1205
|
+
*/
|
|
1206
|
+
export declare class JournalConflictError extends Error {
|
|
1207
|
+
/** Create a compare-and-set rejection with a diagnostic message. */
|
|
1208
|
+
constructor(message: string);
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
/**
|
|
1212
|
+
* A journal record's format or format version is not one the journal port
|
|
1213
|
+
* declared. On a write the record is refused; on a read or list the stored
|
|
1214
|
+
* record is refused rather than returned; a commit over a current revision of
|
|
1215
|
+
* an undeclared version is refused rather than overwriting it. History never
|
|
1216
|
+
* interprets or converts the content of another format version.
|
|
1217
|
+
* @alpha
|
|
1218
|
+
*/
|
|
1219
|
+
export declare class JournalVersionError extends Error {
|
|
1220
|
+
/** Create an undeclared-version refusal with a diagnostic message. */
|
|
1221
|
+
constructor(message: string);
|
|
1222
|
+
}
|
|
1223
|
+
|
|
882
1224
|
/** Options for the isolated, non-durable test backend. @public */
|
|
883
1225
|
export declare interface MemoryStoreOptions {
|
|
884
1226
|
/** Metadata compatibility identifier; the initial store format uses sha256. */
|
|
@@ -956,6 +1298,23 @@ export declare type ResultKey = {
|
|
|
956
1298
|
subjectHash: string;
|
|
957
1299
|
};
|
|
958
1300
|
|
|
1301
|
+
/**
|
|
1302
|
+
* The SQLite capability gave up waiting for another connection, possibly in
|
|
1303
|
+
* another process, to release a lock it needs. A host raises it, instead of
|
|
1304
|
+
* any driver-specific error, when its bounded busy wait is exhausted while
|
|
1305
|
+
* opening a store or running a statement or transaction. The failed operation
|
|
1306
|
+
* had no effect, so the caller may retry it or report contention to its own
|
|
1307
|
+
* caller; telling a busy store apart from a broken one is the purpose of this
|
|
1308
|
+
* type. Hosts never use it for corruption, misuse or other failures.
|
|
1309
|
+
* @alpha
|
|
1310
|
+
*/
|
|
1311
|
+
declare class SqliteBusyError extends Error {
|
|
1312
|
+
/** How long, in milliseconds, the host waited before giving up. */
|
|
1313
|
+
readonly waitedMilliseconds: number;
|
|
1314
|
+
/** Create a busy-exhaustion failure that records the wait that was spent. */
|
|
1315
|
+
constructor(message: string, waitedMilliseconds: number, options?: ErrorOptions);
|
|
1316
|
+
}
|
|
1317
|
+
|
|
959
1318
|
/**
|
|
960
1319
|
* A presented writer lease no longer matches the durable holder, fence or
|
|
961
1320
|
* unexpired lease, so the mutation was rejected with no change other than the
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
* Result History & Publication. This entry exposes the existing row Store,
|
|
3
3
|
* its memory adapter and compatibility schema unchanged, the exact
|
|
4
4
|
* completed-result reading ports, and the project-private alpha durable
|
|
5
|
-
* authority that owns attempts, the single logical writer, atomic publication
|
|
6
|
-
*
|
|
5
|
+
* authority that owns attempts, the single logical writer, atomic publication,
|
|
6
|
+
* acceptance records, environment namespaces, recorded promotions and Run
|
|
7
|
+
* Supervision's opaque operation journal. It never decides candidate validity
|
|
8
|
+
* or freshness and never interprets journal records.
|
|
7
9
|
* @packageDocumentation
|
|
8
10
|
*/
|
|
9
11
|
|
|
@@ -92,6 +94,8 @@ export declare interface GenerationRow {
|
|
|
92
94
|
/** Retained lifecycle states interpreted by repository and claim, not by storage. @public */
|
|
93
95
|
export declare type GenerationState = 'claimed' | 'current' | 'superseded' | 'abandoned';
|
|
94
96
|
|
|
97
|
+
/* Excluded from this release type: HistoryBusyError */
|
|
98
|
+
|
|
95
99
|
/* Excluded from this release type: HistoryClockError */
|
|
96
100
|
|
|
97
101
|
/* Excluded from this release type: HistoryIntegrityError */
|
|
@@ -153,6 +157,20 @@ export declare type Identity = {
|
|
|
153
157
|
|
|
154
158
|
/* Excluded from this release type: IHistoryScope */
|
|
155
159
|
|
|
160
|
+
/* Excluded from this release type: IJournalAddress */
|
|
161
|
+
|
|
162
|
+
/* Excluded from this release type: IJournalCommit */
|
|
163
|
+
|
|
164
|
+
/* Excluded from this release type: IJournalDeclaration */
|
|
165
|
+
|
|
166
|
+
/* Excluded from this release type: IJournalFormat */
|
|
167
|
+
|
|
168
|
+
/* Excluded from this release type: IJournalQuery */
|
|
169
|
+
|
|
170
|
+
/* Excluded from this release type: IJournalRecord */
|
|
171
|
+
|
|
172
|
+
/* Excluded from this release type: IJournalWrite */
|
|
173
|
+
|
|
156
174
|
/** A patch attempted to modify an immutable address or managed CAS version. @public */
|
|
157
175
|
export declare class InvalidStorePatchError extends Error {
|
|
158
176
|
/** Identify a structurally forbidden patch before any columns are changed. @public */
|
|
@@ -161,6 +179,14 @@ export declare class InvalidStorePatchError extends Error {
|
|
|
161
179
|
|
|
162
180
|
/* Excluded from this release type: IOperation */
|
|
163
181
|
|
|
182
|
+
/* Excluded from this release type: IOperationJournal */
|
|
183
|
+
|
|
184
|
+
/* Excluded from this release type: IPromotionQuery */
|
|
185
|
+
|
|
186
|
+
/* Excluded from this release type: IPromotionRecord */
|
|
187
|
+
|
|
188
|
+
/* Excluded from this release type: IPromotionRequest */
|
|
189
|
+
|
|
164
190
|
/* Excluded from this release type: IRecoveryOutcome */
|
|
165
191
|
|
|
166
192
|
/* Excluded from this release type: IResultVerification */
|
|
@@ -199,6 +225,8 @@ declare interface ISnapshotCapability {
|
|
|
199
225
|
|
|
200
226
|
/* Excluded from this release type: ISqliteConnection */
|
|
201
227
|
|
|
228
|
+
/* Excluded from this release type: ISqliteOpenOptions */
|
|
229
|
+
|
|
202
230
|
/* Excluded from this release type: ISqliteRow */
|
|
203
231
|
|
|
204
232
|
/* Excluded from this release type: ISqliteRunResult */
|
|
@@ -227,8 +255,16 @@ declare interface ISnapshotCapability {
|
|
|
227
255
|
|
|
228
256
|
/* Excluded from this release type: IWriterAcquisitionRequest */
|
|
229
257
|
|
|
258
|
+
/* Excluded from this release type: IWriterContention */
|
|
259
|
+
|
|
230
260
|
/* Excluded from this release type: IWriterLease */
|
|
231
261
|
|
|
262
|
+
/* Excluded from this release type: IWriterRenewal */
|
|
263
|
+
|
|
264
|
+
/* Excluded from this release type: JournalConflictError */
|
|
265
|
+
|
|
266
|
+
/* Excluded from this release type: JournalVersionError */
|
|
267
|
+
|
|
232
268
|
/** Options for the isolated, non-durable test backend. @public */
|
|
233
269
|
export declare interface MemoryStoreOptions {
|
|
234
270
|
/** Metadata compatibility identifier; the initial store format uses sha256. */
|
|
@@ -300,6 +336,8 @@ export declare type ResultKey = {
|
|
|
300
336
|
subjectHash: string;
|
|
301
337
|
};
|
|
302
338
|
|
|
339
|
+
/* Excluded from this release type: SqliteBusyError */
|
|
340
|
+
|
|
303
341
|
/* Excluded from this release type: StaleWriterError */
|
|
304
342
|
|
|
305
343
|
/**
|