@microdelta/history 0.1.0 → 0.2.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 (40) hide show
  1. package/README.md +14 -3
  2. package/dist/api/history.alpha.d.ts +2 -2
  3. package/dist/api/history.root.raw.alpha.d.ts +332 -19
  4. package/dist/api/history.root.raw.beta.d.ts +34 -2
  5. package/dist/api/history.root.raw.public.d.ts +34 -2
  6. package/dist/api/history.root.raw.untrimmed.d.ts +332 -19
  7. package/dist/api/history.shared.alpha.d.ts +328 -17
  8. package/dist/api/history.shared.beta.d.ts +30 -0
  9. package/dist/api/history.shared.public.d.ts +30 -0
  10. package/dist/api/history.shared.untrimmed.d.ts +328 -17
  11. package/dist/api/history.untrimmed.d.ts +2 -2
  12. package/dist/src/durable/contracts.d.ts +290 -17
  13. package/dist/src/durable/contracts.d.ts.map +1 -1
  14. package/dist/src/durable/errors.d.ts +26 -1
  15. package/dist/src/durable/errors.d.ts.map +1 -1
  16. package/dist/src/durable/errors.js +32 -1
  17. package/dist/src/durable/errors.js.map +1 -1
  18. package/dist/src/durable/index.d.ts.map +1 -1
  19. package/dist/src/durable/index.js +275 -95
  20. package/dist/src/durable/index.js.map +1 -1
  21. package/dist/src/durable/journal.d.ts +53 -0
  22. package/dist/src/durable/journal.d.ts.map +1 -0
  23. package/dist/src/durable/journal.js +174 -0
  24. package/dist/src/durable/journal.js.map +1 -0
  25. package/dist/src/durable/records.d.ts +40 -0
  26. package/dist/src/durable/records.d.ts.map +1 -0
  27. package/dist/src/durable/records.js +74 -0
  28. package/dist/src/durable/records.js.map +1 -0
  29. package/dist/src/durable/schema.d.ts +13 -4
  30. package/dist/src/durable/schema.d.ts.map +1 -1
  31. package/dist/src/durable/schema.js +74 -5
  32. package/dist/src/durable/schema.js.map +1 -1
  33. package/dist/src/durable/selected-index.d.ts.map +1 -1
  34. package/dist/src/durable/selected-index.js +3 -1
  35. package/dist/src/durable/selected-index.js.map +1 -1
  36. package/dist/src/index.d.ts +6 -4
  37. package/dist/src/index.d.ts.map +1 -1
  38. package/dist/src/index.js +5 -3
  39. package/dist/src/index.js.map +1 -1
  40. package/package.json +3 -3
package/README.md CHANGED
@@ -14,9 +14,20 @@ 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 as a versioned opaque record and never decides
20
- reuse eligibility or freshness. See the
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 2. Files at any other
29
+ version, including version 1 files written before environment-scoped
30
+ acceptances, promotions and the journal existed, are rejected by version; stored
31
+ data is never migrated by guessing. See the
21
32
  [package map](../../docs/package-map.md) and the
22
33
  [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, 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, 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
- * and acceptance records. It never decides candidate validity or freshness.
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
 
@@ -158,6 +160,8 @@ export declare interface IAcceptanceRecord {
158
160
  readonly acceptanceId: number;
159
161
  /** The accepted exact result. */
160
162
  readonly reference: ICompletedResultReference;
163
+ /** The environment namespace whose verification recorded this acceptance. */
164
+ readonly environment: string;
161
165
  /** The writer fence under which the acceptance was recorded. */
162
166
  readonly fence: number;
163
167
  /** Resolution's acceptance evidence, decoded and frozen. */
@@ -178,8 +182,22 @@ export declare interface IAcceptanceRequest {
178
182
  readonly reference: ICompletedResultReference;
179
183
  /** Resolution's versioned acceptance evidence. */
180
184
  readonly evidence: IVersionedRecord;
181
- /** Exact completed results the current verification followed. */
185
+ /**
186
+ * Exact completed results the current verification followed. Each must be
187
+ * admissible in the accepting environment: published there, or named by a
188
+ * promotion into it.
189
+ */
182
190
  readonly dependencies: readonly ICompletedResultReference[];
191
+ /**
192
+ * The environment, within the result's analysis, whose current verification
193
+ * accepted the result. It is always explicit and never inferred from the
194
+ * reference: the caller names its own run environment. It may be the
195
+ * environment that published the result, or another environment into which
196
+ * a recorded promotion admits the result. The acceptance then belongs to
197
+ * that environment's namespace alone and never satisfies a lookup in any
198
+ * other environment.
199
+ */
200
+ readonly environment: string;
183
201
  }
184
202
 
185
203
  /** @alpha A path segment whose kind follows the container's operation semantics. */
@@ -371,6 +389,15 @@ export declare type Identity = {
371
389
  * larger fence. A host reading that is not a nonnegative safe integer fails
372
390
  * the operation without any change. This is a local single-file policy, not a
373
391
  * distributed-time or liveness guarantee.
392
+ *
393
+ * Storage contention: every mutation, including acquisition, is one IMMEDIATE
394
+ * SQLite transaction. When another connection, possibly in another process,
395
+ * holds SQLite's write lock past the host's bounded busy wait, nothing
396
+ * changes. Acquisition and renewal, the lease operations a waiter repeats,
397
+ * report it as their `contended` outcome ({@link IWriterContention}), so
398
+ * contention is never mistaken for ownership or staleness (PUB-005). Any other
399
+ * operation fails with Machine's `SqliteBusyError`. Whether to try again is
400
+ * always the caller's policy, never History's.
374
401
  * @alpha
375
402
  */
376
403
  export declare interface IDurableHistory {
@@ -378,11 +405,20 @@ export declare interface IDurableHistory {
378
405
  readonly logicalStore: string;
379
406
  /** Exact selected reads over completed results, answered from their generated index. */
380
407
  readonly reader: ICompletedResultReader & ICompletedNavigationReader;
381
- /** Acquire the single logical writer, or report the observed unexpired holder. */
408
+ /**
409
+ * Acquire the single logical writer, or report the observed unexpired
410
+ * holder, or report storage contention with the recorded writer. Any other
411
+ * failure, such as damaged storage or an unusable clock, is thrown.
412
+ */
382
413
  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. */
414
+ /**
415
+ * Extend a still-valid lease, or report storage contention, which leaves the
416
+ * lease as it was. A stale or expired lease is rejected with
417
+ * `StaleWriterError`. Only the expiry changes: the durable fence is left as
418
+ * it is, never rewritten from the presented lease.
419
+ */
420
+ renewWriter(lease: IWriterLease, leaseMilliseconds: number): IWriterRenewal;
421
+ /** End a still-valid lease; the durable fence is left as it is, so the next grant still advances it. */
386
422
  releaseWriter(lease: IWriterLease): void;
387
423
  /** Inspect the recorded holder, if any, without granting authority. */
388
424
  currentWriter(): IWriterLease | undefined;
@@ -405,9 +441,17 @@ export declare interface IDurableHistory {
405
441
  abandonAttempt(lease: IWriterLease, request: IAbandonRequest): IAttemptRecord;
406
442
  /** Report what durably happened to one identified execution, read-only. */
407
443
  recoverAttempt(request: IAttemptRequest): IRecoveryOutcome;
408
- /** Completed results for one scoped subject and version, latest publication first. */
444
+ /**
445
+ * Completed results admissible for one scoped subject and version, latest
446
+ * publication first: those published in the subject's environment and those
447
+ * a recorded promotion admits into it. A promoted result keeps its own exact
448
+ * reference and envelope scope; nothing from any other environment appears.
449
+ */
409
450
  findCandidates(subject: IVersionedSubject): readonly ICompletedEnvelope[];
410
- /** The scoped subject's latest publication, if any; never rewound by acceptance. */
451
+ /**
452
+ * The scoped subject's latest publication in its own environment, if any;
453
+ * never rewound by acceptance and never moved by a promotion.
454
+ */
411
455
  readCurrent(subject: IScopedSubject): ICompletedResultReference | undefined;
412
456
  /** Read one exact result's metadata without loading its payload. */
413
457
  readEnvelope(reference: ICompletedResultReference): ICompletedEnvelope;
@@ -415,8 +459,25 @@ export declare interface IDurableHistory {
415
459
  verifyResult(reference: ICompletedResultReference): IResultVerification;
416
460
  /** Record a current acceptance of an existing result without touching it or the current pointer. */
417
461
  recordAcceptance(lease: IWriterLease, request: IAcceptanceRequest): IAcceptanceRecord;
418
- /** Acceptance records naming one exact result, in record order. */
419
- readAcceptances(reference: ICompletedResultReference): readonly IAcceptanceRecord[];
462
+ /**
463
+ * Acceptance records naming one exact result that were recorded in the
464
+ * named environment, in record order. The environment is always explicit:
465
+ * the publishing environment, or one a promotion admits the result into.
466
+ */
467
+ readAcceptances(reference: ICompletedResultReference, environment: string): readonly IAcceptanceRecord[];
468
+ /**
469
+ * In one commit, record a promotion that admits exact results of other
470
+ * environments into the target environment. Nothing already recorded changes.
471
+ */
472
+ promoteResults(lease: IWriterLease, request: IPromotionRequest): IPromotionRecord;
473
+ /** Promotion records into one environment, in record order. */
474
+ readPromotions(query: IPromotionQuery): readonly IPromotionRecord[];
475
+ /**
476
+ * Open Run Supervision's operation journal over this store, bound to the
477
+ * declared record formats and versions. The port shares this authority's
478
+ * connection, writer lease and lifetime.
479
+ */
480
+ openJournal(declaration: IJournalDeclaration): IOperationJournal;
420
481
  /** Release the SQLite file; later calls fail. */
421
482
  close(): void;
422
483
  }
@@ -445,7 +506,10 @@ export declare interface IDurableHistoryOptions {
445
506
  * The analysis and environment that scope every subject, attempt and result
446
507
  * within one logical store. The same subject text in another analysis or
447
508
  * environment is a different scoped subject (RES-001/002). Both are complete
448
- * opaque non-empty strings compared by exact equality.
509
+ * opaque non-empty strings compared by exact equality. An environment is a
510
+ * namespace within one store (RUN-017): a trial and a production run of the
511
+ * same analysis use different environments of the same file, selected per
512
+ * call rather than process-wide.
449
513
  * @alpha
450
514
  */
451
515
  export declare interface IHistoryScope {
@@ -455,14 +519,198 @@ export declare interface IHistoryScope {
455
519
  readonly environment: string;
456
520
  }
457
521
 
522
+ /**
523
+ * Locates one journal record: its environment namespace, owner-named
524
+ * collection and owner-defined key. The record's identity is exactly this
525
+ * address; its format tag may change between revisions only by
526
+ * compare-and-set.
527
+ * @alpha
528
+ */
529
+ export declare interface IJournalAddress extends IHistoryScope {
530
+ /** The owner-named non-empty collection, such as Supervision's operations. */
531
+ readonly collection: string;
532
+ /** The owner-defined non-empty key, unique within the namespace and collection. */
533
+ readonly key: string;
534
+ }
535
+
536
+ /**
537
+ * One atomic journal commit in one environment namespace: every write lands
538
+ * in the same transaction, or none does.
539
+ * @alpha
540
+ */
541
+ export declare interface IJournalCommit extends IHistoryScope {
542
+ /** At least one write, each collection and key pair at most once. */
543
+ readonly writes: readonly IJournalWrite[];
544
+ }
545
+
546
+ /**
547
+ * The formats a journal port is bound to. A stored record of an undeclared
548
+ * format or version is refused rather than returned or overwritten, so a
549
+ * caller never acts on, or clobbers, a record it does not understand.
550
+ * @alpha
551
+ */
552
+ export declare interface IJournalDeclaration {
553
+ /** At least one declared format, each format named once. */
554
+ readonly formats: readonly IJournalFormat[];
555
+ }
556
+
557
+ /**
558
+ * One owner-defined journal record format and the exact format versions a
559
+ * journal port can read and write. A format is only a record's version tag:
560
+ * it never identifies a record or its collection. History compares the tag
561
+ * and versions for exact equality and never interprets the content.
562
+ * @alpha
563
+ */
564
+ export declare interface IJournalFormat {
565
+ /** The owner-defined non-empty format identity. */
566
+ readonly format: string;
567
+ /** The positive safe-integer versions of that format this port understands. */
568
+ readonly versions: readonly number[];
569
+ }
570
+
571
+ /**
572
+ * Selects every record of one collection in one environment namespace.
573
+ * @alpha
574
+ */
575
+ export declare interface IJournalQuery extends IHistoryScope {
576
+ /** The owner-named collection to list. */
577
+ readonly collection: string;
578
+ }
579
+
580
+ /**
581
+ * One immutable revision of a journal record. Revisions of an address start
582
+ * at 1 and increase by one per committed write; earlier revisions are retained
583
+ * and never rewritten.
584
+ * @alpha
585
+ */
586
+ export declare interface IJournalRecord extends IHistoryScope {
587
+ /** The owner-named collection. */
588
+ readonly collection: string;
589
+ /** The owner-defined key. */
590
+ readonly key: string;
591
+ /** This revision's number within its address, starting at 1. */
592
+ readonly revision: number;
593
+ /** Store-wide never-reused journal write identity, increasing in commit order. */
594
+ readonly sequence: number;
595
+ /** The writer fence under which this revision was committed. */
596
+ readonly fence: number;
597
+ /** The owner-defined record, decoded and frozen, with this revision's version tag. */
598
+ readonly record: IVersionedRecord;
599
+ }
600
+
601
+ /**
602
+ * One compare-and-set write of a journal commit. The expected revision is the
603
+ * revision the caller last read at this address; `0` asserts that the key has
604
+ * never been written in the collection, under any format. The record's
605
+ * format and version are its version tag and must be declared by the port.
606
+ * @alpha
607
+ */
608
+ export declare interface IJournalWrite {
609
+ /** The owner-named non-empty collection. */
610
+ readonly collection: string;
611
+ /** The owner-defined non-empty key. */
612
+ readonly key: string;
613
+ /** The current revision the write replaces, or `0` for a new key. */
614
+ readonly expectedRevision: number;
615
+ /** The new owner-defined record. */
616
+ readonly record: IVersionedRecord;
617
+ }
618
+
458
619
  /** A patch attempted to modify an immutable address or managed CAS version. @public */
459
620
  export declare class InvalidStorePatchError extends Error {
460
621
  /** Identify a structurally forbidden patch before any columns are changed. @public */
461
622
  constructor(message?: string);
462
623
  }
463
624
 
464
- /** @alpha A supported JavaScript observation operation with its own fact meaning. */
465
- export declare type IOperation = 'value' | 'own' | 'membership' | 'length' | 'keys';
625
+ /**
626
+ * A supported observation operation with its own fact meaning. `container-kind`
627
+ * answers record, array or scalar without consuming any container member or
628
+ * scalar content; ordinary scalar reads still retain their literal values.
629
+ * @alpha
630
+ */
631
+ export declare type IOperation = 'value' | 'own' | 'membership' | 'length' | 'keys' | 'container-kind';
632
+
633
+ /**
634
+ * Run Supervision's operation journal, stored by History (RUN-011/012). It
635
+ * keeps owner-defined operation and deferral records, such as an intent
636
+ * committed before a send or a "not before" deferral, atomically and under
637
+ * writer fencing, without interpreting them: History owns only namespacing,
638
+ * collections, revisions, fencing and the declared-version check. A commit
639
+ * needs the current writer lease and checks holder, fence and unexpired lease
640
+ * in the same transaction as its compare-and-set checks and writes; reads
641
+ * need no lease and never see an uncommitted write.
642
+ * @alpha
643
+ */
644
+ export declare interface IOperationJournal {
645
+ /** The frozen formats and versions this port was opened with. */
646
+ readonly formats: readonly IJournalFormat[];
647
+ /**
648
+ * Commit every write in one transaction. The whole commit is refused,
649
+ * unchanged, for a stale lease, an undeclared format or version, a current
650
+ * revision whose stored format or version this port does not understand
651
+ * (checked first, since such a caller cannot have read it), or an expected
652
+ * revision that is not the address's current revision.
653
+ */
654
+ commit(lease: IWriterLease, request: IJournalCommit): readonly IJournalRecord[];
655
+ /** The current revision at one address, or undefined if the key was never written there. */
656
+ read(address: IJournalAddress): IJournalRecord | undefined;
657
+ /** The current revision of every key in one collection, in order of first write. */
658
+ list(query: IJournalQuery): readonly IJournalRecord[];
659
+ }
660
+
661
+ /**
662
+ * Selects promotion records into one target environment, optionally only
663
+ * those naming one exact result.
664
+ * @alpha
665
+ */
666
+ export declare interface IPromotionQuery {
667
+ /** The analysis and environment whose admitting promotions to read. */
668
+ readonly target: IHistoryScope;
669
+ /** When present, only promotions that name this exact result. */
670
+ readonly reference?: ICompletedResultReference;
671
+ }
672
+
673
+ /**
674
+ * One immutable promotion record. It admits the named results as candidates,
675
+ * dependencies and acceptance targets in its target environment and changes
676
+ * nothing else: each result keeps its exact reference, envelope, provenance
677
+ * and acceptances, and no current head moves in any environment. The target
678
+ * environment's later verifications record their own acceptances.
679
+ * @alpha
680
+ */
681
+ export declare interface IPromotionRecord {
682
+ /** Store-wide never-reused promotion identity, increasing in record order. */
683
+ readonly promotionId: number;
684
+ /** The analysis and environment the results were admitted into. */
685
+ readonly target: IHistoryScope;
686
+ /** The writer fence under which the promotion was recorded. */
687
+ readonly fence: number;
688
+ /** The promoter's evidence, decoded and frozen. */
689
+ readonly evidence: IVersionedRecord;
690
+ /** The admitted exact results, each in its own publishing scope, in recorded order. */
691
+ readonly references: readonly ICompletedResultReference[];
692
+ }
693
+
694
+ /**
695
+ * Asks History to admit exact completed results of other environments into
696
+ * one target environment of the same analysis (RUN-017). A trial result
697
+ * satisfies a production lookup only through such a recorded promotion. The
698
+ * target names where the results are admitted; each reference keeps naming
699
+ * its own publishing environment. The evidence is the promoter's versioned
700
+ * record of who promoted what and why; History stores it opaquely.
701
+ * @alpha
702
+ */
703
+ export declare interface IPromotionRequest {
704
+ /** The analysis and environment the results are admitted into. */
705
+ readonly target: IHistoryScope;
706
+ /**
707
+ * Distinct exact completed results of the target's analysis, none published
708
+ * in the target environment, in the promoter's order.
709
+ */
710
+ readonly references: readonly ICompletedResultReference[];
711
+ /** The promoter's versioned evidence for this promotion. */
712
+ readonly evidence: IVersionedRecord;
713
+ }
466
714
 
467
715
  /**
468
716
  * Read-only recovery of one identified execution. Recovery reports what
@@ -566,7 +814,8 @@ export declare type ISelectedFingerprintResolution = {
566
814
  * a lazy view, never a whole-object observation, so no member, identity or
567
815
  * serialized subtree is implied. Array length is carried so a view need not ask
568
816
  * again, but it becomes observation evidence only when a consumer reads it.
569
- * Shapes are never placed inside {@link ISelectedFact.fact}.
817
+ * Shape envelopes are never placed inside {@link ISelectedFact.fact}; Tracking
818
+ * may separately observe the bounded `container-kind` discriminant.
570
819
  * @alpha
571
820
  */
572
821
  export declare type ISelectedNode =
@@ -628,7 +877,8 @@ declare interface ISnapshotCapability {
628
877
  * directory, a missing parent directory, a file that is not a SQLite database,
629
878
  * or a location that cannot hold a persistent write-ahead-logged database,
630
879
  * including `:memory:` and the empty path. Opening never silently weakens the
631
- * host's durable configuration.
880
+ * host's durable configuration. Processes that open one new store at the same
881
+ * time all succeed within the bounded busy wait or fail with `SqliteBusyError`.
632
882
  * @alpha
633
883
  */
634
884
  export declare interface ISqliteCapability {
@@ -642,7 +892,8 @@ export declare interface ISqliteCapability {
642
892
  * configuration for every connection: write-ahead logging, FULL synchronous
643
893
  * commits, enforced foreign keys and a bounded wait on a locked database.
644
894
  * Callers supply every SQL statement and schema; the connection has no
645
- * knowledge of what the tables mean.
895
+ * knowledge of what the tables mean. A statement, exec or transaction that
896
+ * cannot get a lock within the bounded wait fails with `SqliteBusyError`.
646
897
  *
647
898
  * Transactions are synchronous, top-level and IMMEDIATE: the write lock is
648
899
  * taken before the callback runs, the callback's writes commit together when
@@ -836,7 +1087,7 @@ export declare interface IVersionedSubject extends IScopedSubject {
836
1087
  /**
837
1088
  * The outcome of asking for the single logical writer. `held` reports an
838
1089
  * observed unexpired holder, not a failed compare-and-swap (PUB-005), and
839
- * grants nothing.
1090
+ * grants nothing; `contended` reports that storage was too busy to decide.
840
1091
  * @alpha
841
1092
  */
842
1093
  export declare type IWriterAcquisition = {
@@ -851,7 +1102,7 @@ export declare type IWriterAcquisition = {
851
1102
  readonly holder: string;
852
1103
  /** When that holder's lease expires, in History's clock domain. */
853
1104
  readonly expiresAt: number;
854
- };
1105
+ } | IWriterContention;
855
1106
 
856
1107
  /** A request for the writer lease. @alpha */
857
1108
  export declare interface IWriterAcquisitionRequest {
@@ -861,6 +1112,28 @@ export declare interface IWriterAcquisitionRequest {
861
1112
  readonly leaseMilliseconds: number;
862
1113
  }
863
1114
 
1115
+ /**
1116
+ * Storage contention on a lease operation: another connection, possibly in
1117
+ * another process, held SQLite's write lock past the host's bounded busy wait,
1118
+ * so History could not decide and changed nothing, not even the clock
1119
+ * high-water. It is a fact about storage, never about ownership (PUB-005): it
1120
+ * neither grants nor refuses, and whether to try again is the caller's policy.
1121
+ * @alpha
1122
+ */
1123
+ export declare interface IWriterContention {
1124
+ /** History could not take SQLite's write lock in time. */
1125
+ readonly kind: 'contended';
1126
+ /**
1127
+ * The writer recorded at that moment, read without the write lock: its
1128
+ * holder, fence and expiry as stored, whether or not the lease has expired.
1129
+ * Undefined when no holder is recorded, or when that read was itself busy;
1130
+ * History never guesses a holder.
1131
+ */
1132
+ readonly writer: IWriterLease | undefined;
1133
+ /** The host's diagnostic of the contention; it carries no stored values. */
1134
+ readonly detail: string;
1135
+ }
1136
+
864
1137
  /**
865
1138
  * Proof of current single-logical-writer ownership. The holder is an opaque
866
1139
  * caller identity; the fence is the store-wide token issued at acquisition,
@@ -879,6 +1152,46 @@ export declare interface IWriterLease {
879
1152
  readonly expiresAt: number;
880
1153
  }
881
1154
 
1155
+ /**
1156
+ * The outcome of renewing a lease the caller holds: `renewed` with the later
1157
+ * expiry, or `contended` when storage was too busy to decide, in which case
1158
+ * the lease is exactly as it was and is neither renewed nor refused. A stale
1159
+ * or expired lease is not an outcome but a refusal (`StaleWriterError`).
1160
+ * @alpha
1161
+ */
1162
+ export declare type IWriterRenewal = {
1163
+ /** The lease was extended. */
1164
+ readonly kind: 'renewed';
1165
+ /** The same holder and fence with the new expiry. */
1166
+ readonly lease: IWriterLease;
1167
+ } | IWriterContention;
1168
+
1169
+ /**
1170
+ * A journal commit's compare-and-set expectation does not hold: the presented
1171
+ * expected revision is not the key's current revision (a new-key expectation
1172
+ * met an existing key, or an update met a later or absent revision). The
1173
+ * whole commit was rolled back unchanged; the caller must re-read before
1174
+ * deciding again.
1175
+ * @alpha
1176
+ */
1177
+ export declare class JournalConflictError extends Error {
1178
+ /** Create a compare-and-set rejection with a diagnostic message. */
1179
+ constructor(message: string);
1180
+ }
1181
+
1182
+ /**
1183
+ * A journal record's format or format version is not one the journal port
1184
+ * declared. On a write the record is refused; on a read or list the stored
1185
+ * record is refused rather than returned; a commit over a current revision of
1186
+ * an undeclared version is refused rather than overwriting it. History never
1187
+ * interprets or converts the content of another format version.
1188
+ * @alpha
1189
+ */
1190
+ export declare class JournalVersionError extends Error {
1191
+ /** Create an undeclared-version refusal with a diagnostic message. */
1192
+ constructor(message: string);
1193
+ }
1194
+
882
1195
  /** Options for the isolated, non-durable test backend. @public */
883
1196
  export declare interface MemoryStoreOptions {
884
1197
  /** Metadata compatibility identifier; the initial store format uses sha256. */
@@ -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
- * and acceptance records. It never decides candidate validity or freshness.
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
 
@@ -153,6 +155,20 @@ export declare type Identity = {
153
155
 
154
156
  /* Excluded from this release type: IHistoryScope */
155
157
 
158
+ /* Excluded from this release type: IJournalAddress */
159
+
160
+ /* Excluded from this release type: IJournalCommit */
161
+
162
+ /* Excluded from this release type: IJournalDeclaration */
163
+
164
+ /* Excluded from this release type: IJournalFormat */
165
+
166
+ /* Excluded from this release type: IJournalQuery */
167
+
168
+ /* Excluded from this release type: IJournalRecord */
169
+
170
+ /* Excluded from this release type: IJournalWrite */
171
+
156
172
  /** A patch attempted to modify an immutable address or managed CAS version. @public */
157
173
  export declare class InvalidStorePatchError extends Error {
158
174
  /** Identify a structurally forbidden patch before any columns are changed. @public */
@@ -161,6 +177,14 @@ export declare class InvalidStorePatchError extends Error {
161
177
 
162
178
  /* Excluded from this release type: IOperation */
163
179
 
180
+ /* Excluded from this release type: IOperationJournal */
181
+
182
+ /* Excluded from this release type: IPromotionQuery */
183
+
184
+ /* Excluded from this release type: IPromotionRecord */
185
+
186
+ /* Excluded from this release type: IPromotionRequest */
187
+
164
188
  /* Excluded from this release type: IRecoveryOutcome */
165
189
 
166
190
  /* Excluded from this release type: IResultVerification */
@@ -227,8 +251,16 @@ declare interface ISnapshotCapability {
227
251
 
228
252
  /* Excluded from this release type: IWriterAcquisitionRequest */
229
253
 
254
+ /* Excluded from this release type: IWriterContention */
255
+
230
256
  /* Excluded from this release type: IWriterLease */
231
257
 
258
+ /* Excluded from this release type: IWriterRenewal */
259
+
260
+ /* Excluded from this release type: JournalConflictError */
261
+
262
+ /* Excluded from this release type: JournalVersionError */
263
+
232
264
  /** Options for the isolated, non-durable test backend. @public */
233
265
  export declare interface MemoryStoreOptions {
234
266
  /** Metadata compatibility identifier; the initial store format uses sha256. */
@@ -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
- * and acceptance records. It never decides candidate validity or freshness.
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
 
@@ -153,6 +155,20 @@ export declare type Identity = {
153
155
 
154
156
  /* Excluded from this release type: IHistoryScope */
155
157
 
158
+ /* Excluded from this release type: IJournalAddress */
159
+
160
+ /* Excluded from this release type: IJournalCommit */
161
+
162
+ /* Excluded from this release type: IJournalDeclaration */
163
+
164
+ /* Excluded from this release type: IJournalFormat */
165
+
166
+ /* Excluded from this release type: IJournalQuery */
167
+
168
+ /* Excluded from this release type: IJournalRecord */
169
+
170
+ /* Excluded from this release type: IJournalWrite */
171
+
156
172
  /** A patch attempted to modify an immutable address or managed CAS version. @public */
157
173
  export declare class InvalidStorePatchError extends Error {
158
174
  /** Identify a structurally forbidden patch before any columns are changed. @public */
@@ -161,6 +177,14 @@ export declare class InvalidStorePatchError extends Error {
161
177
 
162
178
  /* Excluded from this release type: IOperation */
163
179
 
180
+ /* Excluded from this release type: IOperationJournal */
181
+
182
+ /* Excluded from this release type: IPromotionQuery */
183
+
184
+ /* Excluded from this release type: IPromotionRecord */
185
+
186
+ /* Excluded from this release type: IPromotionRequest */
187
+
164
188
  /* Excluded from this release type: IRecoveryOutcome */
165
189
 
166
190
  /* Excluded from this release type: IResultVerification */
@@ -227,8 +251,16 @@ declare interface ISnapshotCapability {
227
251
 
228
252
  /* Excluded from this release type: IWriterAcquisitionRequest */
229
253
 
254
+ /* Excluded from this release type: IWriterContention */
255
+
230
256
  /* Excluded from this release type: IWriterLease */
231
257
 
258
+ /* Excluded from this release type: IWriterRenewal */
259
+
260
+ /* Excluded from this release type: JournalConflictError */
261
+
262
+ /* Excluded from this release type: JournalVersionError */
263
+
232
264
  /** Options for the isolated, non-durable test backend. @public */
233
265
  export declare interface MemoryStoreOptions {
234
266
  /** Metadata compatibility identifier; the initial store format uses sha256. */