@inventarch/db 1.1.0 → 1.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.
package/LANGUAGE.md CHANGED
@@ -31,7 +31,7 @@ Spec source locators do not load documents. Resource capture and disclosure requ
31
31
  | @kind | taxonomy | Defines a closed semantic role for records; lowering determines the role of each registered word. |
32
32
  | @lane | taxonomy | Defines a retrieval lane associated with record kinds. |
33
33
  | @law | governance-system | Declares a rule with severity. Structural admission cannot establish the truth or suitability of its prose. |
34
- | @mandate | agent-system | States bounded authority and conditions for a participant. Host authorization remains independent. |
34
+ | @mandate | agent-system | States bounded authority and conditions for a participant. Host authorization remains independent. An authority section names the participant it binds, the closed moves it allows, the workspaces it scopes, the words it excludes and the paths it covers. |
35
35
  | @milestone | work-system | Represents an outcome with an exit criterion inside exactly one plan; it names a condition, not the work toward it. |
36
36
  | @move | taxonomy | Defines the closed classification of an agent action or activity. |
37
37
  | @observation | learning-system | Represents an attributed evidence account with interpretation and retention metadata. Evidence claims are not verified by field typing. |
@@ -51,6 +51,6 @@ Spec source locators do not load documents. Resource capture and disclosure requ
51
51
  | @template | template-system | Represents bounded rendering inputs and output structure. Rendering does not publish or install output. |
52
52
  | @value-type | taxonomy | Defines the field types that schemas may require. |
53
53
  | @voice | agent-composition-system | Declares communication attributes separate from authority and procedure. |
54
- | @workspace | workspace-system | Groups systems into an explicit work boundary; relationships can describe dependencies between boundaries. |
54
+ | @workspace | workspace-system | Groups systems into an explicit work boundary; relationships can describe dependencies between boundaries. Its sources name the roots and placement bands its records are captured from, and its steward the agent that directs it by default. |
55
55
 
56
56
  This guide describes the selected structural vocabulary. Private expert procedures, live provider behavior and unobserved platform qualification are separate from the installed public contract.
package/README.md CHANGED
@@ -2,11 +2,17 @@
2
2
 
3
3
  Filesystem composition of language, graph and compliance. [SPEC.md](SPEC.md) owns admitted views, revisions, read scopes and the disposable cache.
4
4
 
5
- Use `open(workspacePath)` to discover `.ia/src`, then `resolveScope({root, phase})` and pass its `token` as `within` to `snapshot`, `records`, `get`, `referencedBy`, `resolve`, `search` and `traverse`. Runtime consumers must use tokens. Unscoped methods and independent scope issuance are privileged host inspection. A child scope intersects physical occurrences; changing its effective registry refuses. Identity allowlists only narrow. `report` and `refused` expose root-view admission evidence to the privileged host.
5
+ Use `open(workspacePath)` to discover `.ia/src`, then `resolveScope({root, phase})` and pass its `token` as `within` to `snapshot`, `records`, `get`, `referencedBy`, `directedView`, `resolveSeat`, `resolve`, `search` and `traverse`. Runtime consumers must use tokens. Unscoped methods and independent scope issuance are privileged host inspection. A child scope intersects physical occurrences; changing its effective registry refuses. Identity allowlists only narrow. `report` and `refused` expose root-view admission evidence to the privileged host. A snapshot's `membership` gives each of its records one `{identity, root, band, digest}` row: the source root it was captured under (the longest root that a `@workspace` admitted at the workspace root declares in `sources`, else its system folder), its band and its per-record digest (SPEC D02a). Every scope gives an occurrence the same row. `directedView(identity)` lists the identity's declared edge rows, the derived inverses of its counterparts' declarations (read from its side in the kernel spelling, such as `governed-by` at the target, with the record that declared them) and its typed field references both ways, rows whose counterpart is outside the scope pruned (SPEC D09, graph G06b). `resolveSeat(path)` resolves a workspace-relative path to the seat it is declared at, `by` naming the rule: the `@system` of the system folder holding it (`system`), else the `@workspace` declaring the longest `sources` root containing it (`root`), else, for a path in no `.ia` tree, the repository's own `@workspace` (`repository`); with no seat, `unknown` reads `undeclared`, or `outside` for a path that is absolute or escapes the workspace. Its `claimants` are the records whose `covers` or `hook.paths` selections select the path (a `@check`'s prose `check.scope` claims nothing), band descending then identity, each with the matching fields and selections (SPEC D02b, graph G06c). A scope prunes the seat and the claimants like a search.
6
6
 
7
7
  `refresh()` rebuilds and verifies stable inputs before replacing the state. A failed refresh preserves the previous view. A source change stales existing scopes even if those bytes are subsequently restored. `close()` refuses future reads. Cached root graphs are always verified against a fresh build; corrupt or forged payloads are replaced, equal bytes are not rewritten, and unavailable cache storage leaves in-memory reads usable with a warning. Set `cache:false` for a fully read-only open.
8
8
 
9
- The package writes no authored source. An explicit `floor` wins; otherwise an existing local floor directory is authoritative as a whole, and an absent local directory uses the language's generated source embed. Higher systems are never implicit. Paths escaping the workspace, source aliases and invalid UTF-8 refuse by name. Per-source `locations` supply explicit placement/provenance overrides. No historical retention or source writer is implemented.
9
+ A handle also retains the previous admitted root snapshot: the most recent one whose revision differs from the current revision, so opening or refreshing at an unchanged revision keeps it (SPEC D08). `previousRevision` names it. `staleness(identity)` compares the identity's current membership digest with the previous one's and answers `unchanged`, `changed`, `new` (every current identity while no previous snapshot is retained) or `removed`; `readiness(identity, digest)` answers `current`, `previous` or `unknown` for a digest observed earlier, such as an `@observation`'s `subject-revision`. Both take the same `within`, `root`, `phase` and `revision` bindings as `get`, answer about the record `get` returns, and refuse an identity outside the scope with `IA-DB-OUT-OF-SCOPE`. Only root snapshots are retained: when a narrower root or phase reads an occurrence other than the root one, `staleness` is undefined and `readiness` answers only `current` or `unknown`. The pair persists between processes as the capture pair `ia capture` writes through `writeCapture(root, text)`: `.ia/work/snapshot/current.json` and `previous.json`, `ia-snapshot-1` documents (SPEC D08a). Every disk handle, whatever its cache setting, seeds its previous snapshot from that pair the first time it is asked, never on open or refresh, and never writes it; `capturedRevision` names the revision of the capture at `current.json`. A file that is no capture, or one behind a link, is ignored and every read stays usable. A refresh rotates the pair in memory without reading the capture pair, so a handle that lived through an edit reports it whether or not it was captured, and `capturedRevision` is read again when next asked. `writeCapture` counts the records against the prior capture by digest, rotates the prior `current.json` into `previous.json` on a revision change, writes nothing until its checks pass (a link, a `.ia/work` or snapshot directory that is not a directory, a snapshot path that is not a regular file) and leaves the pair it found when a write fails.
10
+
11
+ `inertDeclarations(options)` names the declarations the capture reads that declare nothing, each with its record, field, value, path, line and reason: a `composition.sources` entry that names no root, and a path selection the dialect reads as none (SPEC D02b). They are not admission findings.
12
+
13
+ An adopted mount bound in `.ia/workspace.json` has its sources labelled `.ia/adopted/<id>/<revision>/…`, under which no file exists; `adoptedBindings(root)` returns each binding `{id, path, revision, tree}` with that label as `tree`, so a host reads the mount's other files from `path`. `sourceTree(path)` names the tree a source path belongs to: '' for the workspace's own `.ia/src`, else the directory above its `.ia/src`, or the label of an adopted mount (SPEC D02a).
14
+
15
+ The package writes no authored source. An explicit `floor` wins; otherwise an existing local floor directory is authoritative as a whole, and an absent local directory uses the language's generated source embed. Higher systems are never implicit. Paths escaping the workspace, source aliases and invalid UTF-8 refuse by name. Per-source `locations` supply explicit placement/provenance overrides. No source writer, and no retention beyond the current and previous root snapshots, is implemented.
10
16
 
11
17
  `preview([{path,text}])` validates an in-memory draft against the current source snapshot through the same admission pipeline. It returns base/candidate revisions, admitted records and full refusal/report evidence without mutating files, caches, scopes or the handle. It is a privileged authoring-host API; callers must check current source freshness before using its result. Floor edits and malformed/aliased draft paths refuse.
12
18
  # Editor snapshots
@@ -15,6 +21,6 @@ Installed native distributions are discovered through `.ia/distributions/active.
15
21
 
16
22
  Activation identity and its monotonic counter participate in view/source revisions, including editor overlays and draft previews. Rollback therefore cannot revive prior scopes. The host-only `candidateInstallation` option selects a verified staged pointer for admission; explicit `null` captures authored/bound sources without an installation. Editor metadata reports installed sources and generated installation state as read-only. Matching authored system declarations may override installed authority only under the locked provider/version contract and ordinary whole-tree admission.
17
23
 
18
- `@inventarch/db/editor` provides `EditorDatabase` and immutable `EditorSnapshot` readers. Overlay buffers (including explicit deletion) reuse normal discovery, registry, graph and admission rules without writing source/cache files. Reads preserve the existing location/phase/scope restrictions. Captures expose saved/dirty/source-origin/version metadata; embedded sources remain read-only. Failed refresh retains the last reader; hosts must surface unavailability and refuse stale actions. See the colocated spec and editor tests.
24
+ `@inventarch/db/editor` provides `EditorDatabase` and immutable `EditorSnapshot` readers. Overlay buffers (including explicit deletion) reuse normal discovery, registry, graph and admission rules without writing source/cache files. Reads preserve the existing location/phase/scope restrictions. Editor readers retain no previous snapshot: `previousRevision` is undefined, `staleness` reads `new` for every current identity and `readiness` never answers `previous`. Captures expose saved/dirty/source-origin/version metadata; embedded sources remain read-only. Failed refresh retains the last reader; hosts must surface unavailability and refuse stale actions. See the colocated spec and editor tests.
19
25
 
20
26
  `@inventarch/db/descriptors` compiles OS09 domain, storage and app descriptor resources against a host-built trusted registry without I/O or code execution; see [its SPEC](src/descriptors/SPEC.md).
package/SPEC.md CHANGED
@@ -16,9 +16,9 @@ Generation membership enumerates selected bundle IDs/archive digests and source
16
16
 
17
17
  The application owns archive acquisition, bounded solving and mutation. The database owns no network or installation writes. Restore-required, lock-drift, corrupt-state and pending-recovery remain named operational refusals; a fresh read never silently ignores a selected installation. Filesystem and fault-injection tests must establish M3–M5 behavior before these planned contracts are reported delivered.
18
18
 
19
- Local binding adapter (2026-09-18): when `InputOptions.adopted` is absent, `readInputs` loads optional `.ia/workspace.json`: `{ "version": 1, "adopted": [{ "id": "foundation", "path": "vendor/foundation", "revision": "<sha256>" }] }`. This closed host-data format supports at most 16 bindings and 64 KiB of UTF-8 JSON. Each path is a canonical portable directory inside the current workspace and outside its `.ia` tree; absolute paths, parent traversal, duplicate IDs/directories and aliases refuse. Only the selected directory's physical `.ia/src` sources are captured, with package artifacts excluded and no recursive binding expansion. Its floor is excluded: the workspace still selects exactly one explicit/local/embedded floor. The revision uses the existing `AdoptedSource` digest of the ordered exact `{path,text}` list. Missing roots, malformed configuration or changed pinned bytes fail the capture; they never silently drop a dependency. Explicit `adopted` captures, including `[]`, replace automatic bindings. Disk/editor refresh rereads the manifest and dependency bytes; failed refresh retains internal evidence while the host marks it unavailable. Read-only adopted placement, membership, admission and stale-action semantics remain unchanged; this manifest grants no writable system or model disclosure.
19
+ Local binding adapter (2026-09-18): when `InputOptions.adopted` is absent, `readInputs` loads optional `.ia/workspace.json`: `{ "version": 1, "adopted": [{ "id": "foundation", "path": "vendor/foundation", "revision": "<sha256>" }] }`. This closed host-data format supports at most 16 bindings and 64 KiB of UTF-8 JSON. Each path is a canonical portable directory inside the current workspace and outside its `.ia` tree; absolute paths, parent traversal, duplicate IDs/directories and aliases refuse. Only the selected directory's physical `.ia/src` sources are captured, with package artifacts excluded and no recursive binding expansion. Its floor is excluded: the workspace still selects exactly one explicit/local/embedded floor. The revision uses the existing `AdoptedSource` digest of the ordered exact `{path,text}` list. Missing roots, malformed configuration or changed pinned bytes fail the capture; they never silently drop a dependency. Bindings are validated and read in manifest order, each read before the next is validated, so the first faulty binding answers with its own fault, a read-time one (a link, a missing tree, a changed pin) included, as the frozen Door routes and `ia scope` report it. Explicit `adopted` captures, including `[]`, replace automatic bindings. Disk/editor refresh rereads the manifest and dependency bytes; failed refresh retains internal evidence while the host marks it unavailable. Read-only adopted placement, membership, admission and stale-action semantics remain unchanged; this manifest grants no writable system or model disclosure. An adopted mount's sources carry the path `.ia/adopted/<id>/<revision>/<path>`, a label under which no file exists. `adoptedBindings(root)` (2026-10-07) returns the manifest's bindings, frozen, each `{id, path, revision, tree}` with `tree` that label, validated as discovery validates them (the same IA-DB-ROOT-INVALID, IA-DB-SOURCE-UNAVAILABLE and IA-DB-PATH-UNSAFE refusals) without reading or verifying the bound sources, and [] without a manifest, so a host can read a mount's other files, such as the documents `ia read` returns, from its bound directory; those files are outside the revision pin.
20
20
 
21
- Editor extension contract (2026-09-18): `/editor` owns cache-free captured-input readers, versioned unsaved overlays (including local floor buffers), deleted-source reconciliation and privileged source/registry/occurrence inspection. Reads share the existing scope, admission and view implementation; every refresh retires the previous reader. Source metadata identifies embedded/explicit floor as virtual read-only, and local sources by placement/provenance. Existing `Handle.preview` retains its non-floor draft contract. No filesystem writes occur in editor capture or preview. Candidate/baseline comparison preserves unrelated pre-existing failures while refusing new errors or loss of admitted records.
21
+ Editor extension contract (2026-09-18): `/editor` owns cache-free captured-input readers, versioned unsaved overlays (including local floor buffers), deleted-source reconciliation and privileged source/registry/occurrence inspection. Reads share the existing scope, admission and view implementation; every refresh retires the previous reader. An editor reader retains no previous snapshot (D08). Source metadata identifies embedded/explicit floor as virtual read-only, and local sources by placement/provenance. Existing `Handle.preview` retains its non-floor draft contract. No filesystem writes occur in editor capture or preview. Candidate/baseline comparison preserves unrelated pre-existing failures while refusing new errors or loss of admitted records.
22
22
 
23
23
  Implementation contract for database plan. Depends on @inventarch/language, @inventarch/graph and @inventarch/compliance. Node filesystem adapter; source parsing and semantic decoding stay in language, graph owns all adjacency/postings, compliance alone constructs verdicts.
24
24
 
@@ -26,23 +26,31 @@ D01. open(root, options) reads a canonical existing workspace directory and its
26
26
 
27
27
  D02. Default authored sources use band100, empty reach and workspace provenance. Local or embedded .ia/src/floor sources use floor10/bootstrap. Explicit per-source Location overrides supply other closed placement/provenance values and canonical reach; validate kind/band consistency. options.floor is an explicit array of canonical floor path/text sources, replacing local/default floor. Without it, an existing local floor directory is authoritative as a whole, including when empty; only an absent directory selects language.KERNEL_SOURCES. Report embedded origin as virtual bootstrap input. Copy/freeze inputs and options so caller mutation cannot change a published view.
28
28
 
29
+ D02a. Capture membership (position-and-projection row 3). `Snapshot.membership` holds one frozen row `{identity, root, band, digest}` per record in `records`, in the same identity order: `band` is the record's placement band and `digest` its graph G13 per-record digest. The capture declares roots once, from the `@workspace` records the root view (location '', no phase) admits: each `composition.sources` entry spelled `<root> @<placement>` declares that root at that placement, read relative to the tree holding the declaring record (the directory above its `.ia/src`, which the exported `sourceTree(path)` names: '' for the workspace's own tree, a package's or an installed store's directory, and an adopted mount's `.ia/adopted/<id>/<revision>` label), so an adopted or installed `@workspace` speaks only for its own mount. An entry that does not parse, names an unknown placement, or is absolute or escapes that tree declares nothing (`inertDeclarations` names it, D02b), and so does a `@workspace` the root view does not admit (one whose reach excludes the root). A record's `root` is the longest declared root at the record's own placement that contains its source path; the record is then a member of every `@workspace` declaring that root. That is composition, not an edge row or a field index. Any other record keeps its system seat: the `systemMember` system folder of its path, whether local, package, adopted (`.ia/adopted/<id>/<revision>/…`) or installed (`.ia/distributions/store/<archive>/…`). A record under `.ia/src/floor/` is rooted at `.ia/src/floor`, and any other record outside every system folder (the generated installation workspace) at its source directory, so floor records read `.ia/src/floor` at band 10 unless a workspace declares a root containing them at `@floor`. Each view's rows come from its admitted winners: shadowed, tied, blocked, refused and inactive (out-of-reach or out-of-phase) occurrences, and records admission removed, are not admitted records and have no row. A row depends only on its occurrence and the capture's declared roots, so every view admitting an occurrence gives it the same row: a scope narrowed by identities, root or phase prunes rows and never re-roots one, although a narrower root or phase can admit another occurrence of an identity, whose row is its own. The input model cannot express two cases: an adopted closure named by locator (`<distribution-id>@<digest>`, design row 8) is not a path, so such a `sources` entry declares no root and adopted and installed records keep their system seats; and nothing seats a record by anything but its path and placement. Membership and per-record digests are not revision inputs, so workspace revisions are unchanged. The runtime Door's MACHINE_PROTOCOL version 1 `records` operation omits `membership`.
30
+
31
+ D02b. Location seat (position-and-projection row 17). `resolveSeat(path, options)` on every reader returns a frozen `SeatResolution` `{path, seat?, by?, claimants, unknown?}`. `path` is canonicalized as a scope root with `\` read as `/`; an absolute path, or one escaping the workspace, comes back as supplied with `unknown: 'outside'` and no claimants. Otherwise the seat is the first that applies, and `by` names which: `system`, the admitted `@system` of the system folder that holds the path or is the path, as `systemMember` reads local, package, adopted and installed folders, and the floor's `@system` for `.ia/src/floor`; `root`, the `@workspace` declaring the longest D02a root that contains the path, at any placement, ties by workspace identity; `repository`, for a path with no `.ia` segment, the repository's own `@workspace`. The capture decides that workspace once, from the root view, as the one admitted `@workspace` in the repository's `.ia/src` tree that declares a root, else the only `@workspace` there; none or several decide none. With no seat, `unknown` is `undeclared`. `claimants` are graph G06c's claimants of the path, whatever the seat: each record whose `authority.covers`, `subject.covers`, `work.covers` or `hook.paths` selection selects it (a `@check`'s prose `check.scope` claims nothing), with every matching field and selection, band descending then identity ascending; the graph indexes the selections once per load, so claimants are read from that index, never from the records, and the seat from the graph's name and discriminator indexes and the capture's declared roots. `options` bind as `get` binds them (CLOSED, STALE, SCOPE-UNAVAILABLE, SCOPE-MISMATCH), and a scope prunes as search and resolution do (D09): a seat or claimant outside it is absent, so the path takes the next seat that applies. `inertDeclarations(options)` on every reader names, as frozen `{identity, field, value, path, line, reason}` values ordered by path, line and identity and pruned to the scope, each declaration the capture reads that declares nothing: a `composition.sources` entry of an admitted `@workspace` that names no root (D02a), and a claimant selection the dialect reads as none (graph `isSelection`), which selects no path, so a host can say so where it is authored; neither is a report finding, so admission, snapshots and the Door are unchanged. The resolution reads the view's graph and the capture's declared roots only; it adds no snapshot field, no cache payload beyond the graph's G06c index and no revision input, and the frozen Door routes and `ia scope` do not call it. `tests/seat.test.ts` pins the exit evidence (`.ia/src/systems/work-system/records/work.ia` seats at work-system with the fixture `@mandate` that covers it), each seat rule and the root tie-break, how the repository's own `@workspace` is chosen, outside paths, claimant order across bands and fields, scope binding and a scope pruning each seat rule, and the editor reader's unsaved overlays.
32
+
29
33
  D03. A source snapshot includes all selected source bytes, paths, placement/provenance and discovered system folders. A derived revision-only input carries the folder inventory, floor origin and admission-policy version so empty-folder changes also change the revision; it is never parsed or exposed as an authored record. A view selects sources by reach before building its registry, compiles them independently through language, and delegates authority/phase and external resolution to graph. Never pass all shadowed external occurrences to the compiler as an ambiguous pool. Preserve language section11.2: any language error refuses every record in that file; healthy other files remain independent. Compiled preview siblings are never promoted to admission. Whole-tree requirement ids remain unique without a band exception under language S09. Before authority can hide duplicates, collect distinct physical requirement occurrences from error-free compilation at every distinct declared reach (and the requested location), using each location's registry. Deduplicate the same source occurrence across views, then invoke the shared language collision helper; every participating file is refused. This finite context set covers all registry visibility changes without inventing a second requirement parser.
30
34
 
31
35
  D04. Compliance validates candidate schemas and system joins. A malformed system folder or missing steward refuses that join, its owned words and dependent systems; preserve the root finding. Foreign instances, invalid schemas, selectors, variants and unknown check runners are not readable admitted nodes. A schema assessment that remains not-evaluated cannot establish instance admission. Rebuild graph relationships after removing refused nodes until admission stabilizes; retain failed/unavailable assessments as admission evidence without turning earlier candidate passes into final claims. Coverage/adoption failures remain report evidence and do not erase an otherwise structurally valid contract/workspace declaration. The public snapshot identifies admitted system order and refused subjects separately from candidate vocabulary; private graph registry data is not exposed as admission proof.
32
36
 
33
37
  D05. The root view revision is the handle's whole-source generation stamp; graph revisions additionally include the effective view registry. Every selected source participates even when unreachable in a view. Refresh fully rereads and rebuilds; system/schema changes always rebuild everything. Verify source discovery/bytes are stable before publishing a new snapshot, retry a bounded three times on concurrent changes, then SOURCE-CHANGED. Publication swaps the complete immutable state; failed refresh preserves the previous state. Source errors produce attributable partial admission, not silent success.
34
38
 
35
- D06. The derived .ia/.iadb/graph.json stores a format tag, revision and deterministic serialized root graph. Always build/validate fresh and compare the complete payload before accepting a cached artifact; a matching stamp alone is insufficient. Equal bytes are not rewritten. Changed/corrupt/foreign bytes are replaced atomically through a unique same-directory temporary file. Recheck containment immediately before access/publication. Cache I/O failures produce CACHE-UNAVAILABLE and leave the valid in-memory snapshot usable; no authored file is touched. This version saves redundant writes, not parsing work. Fresh/cached/refreshed graphs are byte-equal for equal inputs.
39
+ D06. The derived .ia/.iadb/graph.json stores a format tag, revision and deterministic serialized root graph. Always build/validate fresh and compare the complete payload before accepting a cached artifact; a matching stamp alone is insufficient. Equal bytes are not rewritten. Changed/corrupt/foreign bytes are replaced atomically through a unique same-directory temporary file. Recheck containment immediately before access/publication. Cache I/O failures produce CACHE-UNAVAILABLE and leave the valid in-memory snapshot usable; no authored file is touched. This version saves redundant writes, not parsing work. Fresh/cached/refreshed graphs are byte-equal for equal inputs. `cache.state` and `cache.observations` report this file alone; the D08 retained pair is the capture pair of D08a, never a cache file.
36
40
 
37
41
  D07. resolveScope issues an opaque unguessable token bound privately to its issuing handle, canonical root, optional phase (wildcard when omitted), view revision and source generation. The initial occurrence boundary includes every reachable candidate occurrence before phase selection; an optional identity allowlist only intersects it. A child root is the same or a segment-boundary descendant. Its occurrence boundary intersects the parent's and its admitted identities include only winners whose actual occurrence is in that boundary. A new winner with the same identity cannot widen it. A child may change phase but never add occurrences. Omitted child bindings inherit; explicit phase:null requests a wildcard. Refuse narrowing with SCOPE-MISMATCH if the effective registry differs from the parent: a read token cannot authorize new vocabulary/schema interpretation. A privileged host may issue an independent root token for that view. Explicit requested revision must agree with the inherited token when narrowing.
38
42
 
39
- D08. Every read carrying a token validates issuer, open state, generation and explicit root/phase/revision assertions. Omitted bindings inherit. Unknown/forged/other-handle tokens are SCOPE-UNAVAILABLE; incompatible bindings or a wider child root SCOPE-MISMATCH; changed generation STALE (a token never revives after refresh to different inputs and back); closed handle CLOSED. No historical retain API is implemented; stale tokens never read current bytes under an old stamp. Scope grants reading only. Tokens are not transferable between processes without the later owning transport retaining their issuing handle.
43
+ D08. Every read carrying a token validates issuer, open state, generation and explicit root/phase/revision assertions. Omitted bindings inherit. Unknown/forged/other-handle tokens are SCOPE-UNAVAILABLE; incompatible bindings or a wider child root SCOPE-MISMATCH; changed generation STALE (a token never revives after refresh to different inputs and back); closed handle CLOSED. Stale tokens never read current bytes under an old stamp. Scope grants reading only. Tokens are not transferable between processes without the later owning transport retaining their issuing handle.
44
+
45
+ D08 retention (position-and-projection row 20), apart from scope validation: a handle retains two admitted root snapshots, seeded from the capture pair of D08a (location '', no phase), each as its revision and D02a membership rows: the current one, and `previous`, the most recent admitted root snapshot whose revision differs from the current one. Only a revision change rotates. A refresh, or a new handle, that finds the revision last retained as current keeps the existing previous, so a plain open or refresh at an unchanged revision never wipes the comparison that staleness and readiness depend on; a revision change, even one that alters no record text, rotates that current into previous; a failed refresh rotates nothing. `previousRevision` names the previous snapshot, undefined while none is retained. `staleness(identity, options)` and `readiness(identity, digest, options)` bind `options` exactly as `get` does (CLOSED, STALE, SCOPE-UNAVAILABLE, SCOPE-MISMATCH, and OUT-OF-SCOPE for an identity outside the scope's allowed identities) and take the current digest from the view `get` reads, so their current side is the record `get` returns. Only root snapshots are retained, so the previous side is the identity's digest in the previous root snapshot, and it applies only while the selected view's digest is the identity's current root digest, as it always is for a root read. `staleness` answers `unchanged` when the two sides are equal, `changed` when not, `new` when only the current side has a digest (so every current identity reads `new` while no previous snapshot is retained), `removed` when only the previous side does, undefined when neither does. `readiness` answers `current` when `digest` equals the current side, else `previous` when it equals the previous side, else `unknown`: digest equality, never an order. When a narrower root or phase selects a digest other than the current root one, including a record only one of the two views holds (for example a phase-shadowed or tied occurrence, or one only a narrower root reaches), the retained root snapshots describe a different occurrence: `staleness` is undefined and `readiness` answers `current` for the selected record's own digest, else `unknown`. A scope admits only identities its view holds, so a read through a scope token never reports `removed`. The previous snapshot persists between processes as the capture pair of D08a, the one retained pair, which only `ia capture` writes: every disk handle, whatever its cache setting, seeds its pair from it, and no handle writes it. A handle reads the pair the first time it is asked for `previousRevision`, `capturedRevision`, `staleness` or `readiness`, never on open or refresh, so a read that never asks (every frozen Door route) opens no capture file. The seed is the capture at `current.json` and, when it is a capture at another revision, the one at `previous.json`; with no readable `current.json`, a capture at `previous.json` alone. The handle rotates that seed against its own root snapshot: at the captured revision `previous` is the capture at `previous.json`, at another revision it is the capture at `current.json`. A `current.json` that names the fresh revision with other membership rows is not this workspace's capture at that revision, so the pair seeds nothing; a capture at another revision cannot be rebuilt from the fresh inputs, so it is trusted as written. A link or junction on the way, an entry that is not a regular file, and a file that is no capture (not JSON, another format, a malformed revision or membership row) are ignored, never followed, and leave every read usable. `capturedRevision` names the revision of the capture at `current.json`, undefined when there is none or it is not trusted; a capture at another revision than `revision` is stale. A refresh rotates the pair its handle holds in memory without reading the capture pair: at a changed revision the root snapshot it held becomes `previous`, and at an unchanged one it keeps the previous side it held, still unread until asked, so however often a handle refreshes it holds one pair. `capturedRevision` is read again the next time it is asked after a refresh, as `ia capture` may have run, so a handle that lived through an edit reports the edit as changed whether or not it was captured. The cache-free editor reader retains nothing: `previousRevision` and `capturedRevision` are undefined, every current identity reads `new`, and `readiness` never answers `previous`. Retention is not a revision input and adds no snapshot field, so workspace revisions, snapshots and the Door's MACHINE_PROTOCOL version 1 output are unchanged.
46
+
47
+ D08a. The capture pair (position-and-projection §5 and rows 3 and 20). `writeCapture(root, text)` writes `text`, an `ia-snapshot-1` document (`CAPTURE_FORMAT`: one JSON object whose `format` is `ia-snapshot-1`, whose `revision` is a 64-hex workspace revision and whose `membership` holds D02a rows, each exactly `{identity, root, band, digest}` with a closed band and a 64-hex digest, identities unique), to `.ia/work/snapshot/current.json` (`CAPTURE_CURRENT`), keeps `.ia/work/snapshot/previous.json` (`CAPTURE_PREVIOUS`) as D08 rotates its pair, and returns `{prior, ignored, previous, rotated, changed, unchanged, added, removed}`; any other `text` throws a TypeError before anything is touched. Its counts follow `staleness` against the prior capture at `current.json`: an equal digest is unchanged, another changed, a row the prior lacks added, and a prior row with none now removed; with no readable prior capture every row is added, and `ignored` says why an existing `current.json` was not taken as one. A capture at a new revision makes the prior `current.json` the new `previous.json`, renamed, so byte for byte; one at an unchanged revision keeps `previous.json` while it holds a capture at another revision; with no readable prior capture, a `previous.json` at another revision is kept as the most recent capture there is; a `previous.json` at the new revision, or one that is no capture, is moved aside before `current.json` is written and removed after; and a `current.json` that already holds `text` is not rewritten. Nothing is written until every check passes: a link or junction on the way, an entry at `.ia`, `.ia/work` or `.ia/work/snapshot` that is not a directory, or an entry at either path that is not a regular file, refuses as PATH-UNSAFE; for an entry that is not a directory or not a regular file the error's optional `path` names it, and a link or junction is named in the message. The new bytes are staged first in a unique same-directory temporary file, flushed and owner-only; a rotation then moves `previous.json` aside, renames `current.json` to `previous.json` and the staged file to `current.json`, and a step that fails undoes the ones before it in reverse, so a failed write leaves the pair it found and only the error escapes (a process killed between two renames can leave the moved-aside file and `previous.json` holding what `current.json` held, which the next capture rotates again). Concurrent captures of one root are last-writer-wins. The pair is local working state under `.ia/work/`, never a source and never read by admission, and no handle writes it.
40
48
 
41
- D09. get, records, referencedBy, resolve, search and traverse honor the supplied token and view. get and referencedBy outside their allowed identities yield OUT-OF-SCOPE; referencedBy returns graph G06a typed field references naming the identity, pruned to holders in scope; lists/search/resolution prune and traversal cannot cross an excluded intermediary. Scope and typed traversal filters apply before emitting gated edges. A scoped snapshot exposes only allowed immutable nodes, its root/phase/view revision and admitted system order; it does not expose the private full graph/registry/indexes or unscoped diagnostics. All query products delegate to graph; db creates no second adjacency or text index. Unscoped reads are privileged host inspection, and runtime must always supply a token.
49
+ D09. get, records, referencedBy, directedView, resolveSeat, resolve, search and traverse honor the supplied token and view. get, referencedBy and directedView, like D08 staleness and readiness, yield OUT-OF-SCOPE outside their allowed identities; referencedBy returns graph G06a typed field references naming the identity, pruned to holders in scope; directedView returns the identity's graph G06b directed view (its declared edge rows, the derived inverses of its counterparts' declarations and its typed field references both ways, each row with `declaredOn`, its spelling or field path and `derived`), pruned the same way to rows whose counterpart is in scope (the declaring record is the identity or that counterpart, so a pruned scope never shows a row declared outside it). The view is the position-and-projection row 4 snapshot derivation: graph computes it on read from the view's admitted graph, so it is per revision and deterministic but is not stored in the cache payload or the D08a capture and is not a revision input. Row 4 places the derived view in the admitted snapshot, computed at capture and owned by db; this computes the same pure function of one revision where it is read, which a capture document need not carry. Dangling, ambiguous and consent-refused assertions stay admission findings (graph diagnostics in the report) with no row in it; lists/search/resolution, D02b seat resolution included, prune and traversal cannot cross an excluded intermediary. Scope and typed traversal filters apply before emitting gated edges. A scoped snapshot exposes only allowed immutable nodes, their D02a membership rows, its root/phase/view revision and admitted system order; it does not expose the private full graph/registry/indexes or unscoped diagnostics. All query products delegate to graph; db creates no second adjacency or text index. Unscoped reads are privileged host inspection, and runtime must always supply a token.
42
50
 
43
51
  D10. Reports retain source/graph/compliance namespaces and original attribution. Database operational errors use IA-DB-ROOT-INVALID, PATH-UNSAFE, SOURCE-UNAVAILABLE, SOURCE-CHANGED, SCOPE-UNAVAILABLE, SCOPE-MISMATCH, STALE, CLOSED, OUT-OF-SCOPE and CACHE-UNAVAILABLE. Errors are typed DbError values; cache observations are warnings. Kernel/fixture/adoption evidence stays explicitly not-evaluated when unavailable; opening a corpus does not execute conformance suites or prose cases.
44
52
 
45
- D11. Acceptance exercises the real five-system/floor corpus, a foreign record, missing schema restoration, view-specific vocabulary/authority, malformed siblings, source identity preservation under prose edits, cached payload forgery, byte/revision invalidation, scope narrowing across different occurrence winners, stale/closed/foreign tokens and built-package declaration/runtime consumers. No donor files are required. Source writers, historical retention, sessions and capability dispatch retain downstream owners.
53
+ D11. Acceptance exercises the real five-system/floor corpus, a foreign record, missing schema restoration, view-specific vocabulary/authority, malformed siblings, source identity preservation under prose edits, cached payload forgery, byte/revision invalidation, scope narrowing across different occurrence winners, stale/closed/foreign tokens and built-package declaration/runtime consumers. No donor files are required. Source writers, retention beyond the D08 current and previous root snapshots, sessions and capability dispatch retain downstream owners.
46
54
 
47
55
  Task1 delivered: immutable input discovery and explicit/local/embedded floor precedence, generated frozen kernel source export, package scaffold and operational error inventory. Thirteen tests cover default118-record floor, local holes, explicit overrides/caller mutation, exact CRLF/BOM bytes, empty folder fingerprints, invalid UTF-8, bad roots/bands/aliases, source junction refusal and the actual native tree. 1485 tests/52files pass with typecheck/build/kernel/dependency and full compliance fixture verification. Admission, handles/cache and scope APIs remain next.
48
56
 
package/dist/errors.d.ts CHANGED
@@ -2,6 +2,8 @@ export declare const DB_CODES: readonly ["IA-DB-ROOT-INVALID", "IA-DB-PATH-UNSAF
2
2
  export type DbCode = (typeof DB_CODES)[number];
3
3
  export declare class DbError extends Error {
4
4
  readonly code: DbCode;
5
- constructor(code: DbCode, message: string);
5
+ /** The root-relative path the error is about, when one entry is at fault; absent otherwise, as in 1.x. */
6
+ readonly path?: string;
7
+ constructor(code: DbCode, message: string, path?: string);
6
8
  }
7
9
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,oQAYX,CAAC;AACX,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;AAC/C,qBAAa,OAAQ,SAAQ,KAAK;IAE9B,QAAQ,CAAC,IAAI,EAAE,MAAM;gBAAZ,IAAI,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM;CAKlB"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,oQAYX,CAAC;AACX,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;AAC/C,qBAAa,OAAQ,SAAQ,KAAK;IAI9B,QAAQ,CAAC,IAAI,EAAE,MAAM;IAHvB,0GAA0G;IAC1G,SAAiB,IAAI,CAAC,EAAE,MAAM,CAAC;gBAEpB,IAAI,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,MAAM;CAMhB"}
package/dist/errors.js CHANGED
@@ -13,10 +13,12 @@ export const DB_CODES = [
13
13
  ];
14
14
  export class DbError extends Error {
15
15
  code;
16
- constructor(code, message) {
16
+ constructor(code, message, path) {
17
17
  super(`${code}: ${message}`);
18
18
  this.code = code;
19
19
  this.name = 'DbError';
20
+ if (path !== undefined)
21
+ this.path = path;
20
22
  }
21
23
  }
22
24
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,oBAAoB;IACpB,mBAAmB;IACnB,0BAA0B;IAC1B,sBAAsB;IACtB,yBAAyB;IACzB,sBAAsB;IACtB,aAAa;IACb,cAAc;IACd,oBAAoB;IACpB,yBAAyB;IACzB,qBAAqB;CACb,CAAC;AAEX,MAAM,OAAO,OAAQ,SAAQ,KAAK;IAErB;IADX,YACW,IAAY,EACrB,OAAe;QAEf,KAAK,CAAC,GAAG,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC;QAHpB,SAAI,GAAJ,IAAI,CAAQ;QAIrB,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC;IACxB,CAAC;CACF"}
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,oBAAoB;IACpB,mBAAmB;IACnB,0BAA0B;IAC1B,sBAAsB;IACtB,yBAAyB;IACzB,sBAAsB;IACtB,aAAa;IACb,cAAc;IACd,oBAAoB;IACpB,yBAAyB;IACzB,qBAAqB;CACb,CAAC;AAEX,MAAM,OAAO,OAAQ,SAAQ,KAAK;IAIrB;IADX,YACW,IAAY,EACrB,OAAe,EACf,IAAa;QAEb,KAAK,CAAC,GAAG,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC;QAJpB,SAAI,GAAJ,IAAI,CAAQ;QAKrB,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC;QACtB,IAAI,IAAI,KAAK,SAAS;YAAE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IAC3C,CAAC;CACF"}
package/dist/handle.d.ts CHANGED
@@ -1,8 +1,11 @@
1
1
  import type { EdgeReference, Phase } from '@inventarch/language';
2
- import type { FieldReference, Node, Resolution, SearchHit, Traversal, TraverseOptions } from '@inventarch/graph';
2
+ import type { DirectedRow, FieldReference, Node, Resolution, SearchHit, Traversal, TraverseOptions } from '@inventarch/graph';
3
3
  import type { Report } from '@inventarch/compliance';
4
4
  import type { CacheStatus } from './cache.js';
5
5
  import type { InputOptions, InputSnapshot } from './inputs.js';
6
+ import type { InertDeclaration, MembershipRow } from './membership.js';
7
+ import type { Readiness, RetainedSnapshot, Staleness } from './retention.js';
8
+ import type { SeatResolution } from './seat.js';
6
9
  import { viewBuilder } from './view.js';
7
10
  import type { RefusedRecord, View } from './view.js';
8
11
  import type { DraftChange, DraftPreview } from './preview.js';
@@ -30,6 +33,8 @@ export interface Snapshot {
30
33
  readonly phase?: Phase;
31
34
  readonly records: readonly Node[];
32
35
  readonly systems: readonly string[];
36
+ /** D02a capture membership: one row per record, in `records` order. */
37
+ readonly membership: readonly MembershipRow[];
33
38
  }
34
39
  export interface DatabaseTraversalOptions extends Omit<TraverseOptions, 'scope'>, ReadOptions {
35
40
  }
@@ -39,6 +44,23 @@ interface State {
39
44
  readonly rootView: View;
40
45
  readonly cache: CacheStatus;
41
46
  readonly views: Map<string, View>;
47
+ /** D08: the retained pair's previous side and the capture pair's current revision; absent in an editor reader. */
48
+ readonly retention?: Retention;
49
+ }
50
+ /**
51
+ * D08: each side is read on its first use, so a read that never asks (every frozen Door route) never opens the capture
52
+ * files, and a refresh hands the previous side on unread.
53
+ */
54
+ interface Retention {
55
+ /** The most recent admitted root snapshot whose revision differs from rootView's. */
56
+ readonly previous: () => RetainedSnapshot | undefined;
57
+ /** D08a: the revision of the capture at `.ia/work/snapshot/current.json`, when that file holds one. */
58
+ readonly captured: () => string | undefined;
59
+ }
60
+ /** D08: what a refresh rotates: the root snapshot a reader holds and its previous side, read on first use. */
61
+ interface Held {
62
+ readonly current: RetainedSnapshot;
63
+ readonly previous: () => RetainedSnapshot | undefined;
42
64
  }
43
65
  /** Internal observation seam: production supplies readInputs, tests can prove
44
66
  * the bounded retry and no-publication invariant with real captured inputs. */
@@ -49,6 +71,8 @@ export declare class Reader {
49
71
  readonly root: string;
50
72
  constructor(state: State, locations?: Readonly<Record<string, import('@inventarch/language').Location>>);
51
73
  protected get capturedInputs(): InputSnapshot;
74
+ /** D08: the root snapshot this reader holds and the previous side it retains, unread, as a refresh rotates them. */
75
+ protected get retention(): Held;
52
76
  protected replaceState(next: State): void;
53
77
  protected view(options: ReadOptions): View;
54
78
  resolveScope(options?: ScopeRequest): Scope;
@@ -62,9 +86,41 @@ export declare class Reader {
62
86
  records(options?: ReadOptions): readonly Node[];
63
87
  preview(changes: readonly DraftChange[]): DraftPreview;
64
88
  get(identity: string, options?: ReadOptions): Node | undefined;
89
+ /** D08: the revision of the retained previous root snapshot, when one is retained. */
90
+ get previousRevision(): string | undefined;
91
+ /**
92
+ * D08a: the revision of the capture `ia capture` last wrote, at `.ia/work/snapshot/current.json`; undefined when there
93
+ * is none or the file holds no capture this handle trusts. A capture at another revision than `revision` is stale.
94
+ */
95
+ get capturedRevision(): string | undefined;
96
+ /**
97
+ * D08: the digest of the record `get` returns against the previous root snapshot's. Undefined when neither side has
98
+ * one, or when the selected view reads an occurrence the root snapshots do not describe; every current identity is
99
+ * `new` while no previous snapshot is retained.
100
+ */
101
+ staleness(identity: string, options?: ReadOptions): Staleness | undefined;
102
+ /** D08 (position-and-projection row 20): which retained snapshot gives the record `get` returns an observed `digest`. */
103
+ readiness(identity: string, digest: string, options?: ReadOptions): Readiness;
65
104
  resolve(reference: EdgeReference, options?: ReadOptions): Resolution;
66
105
  /** Graph G06a typed field references naming `identity`, holders pruned to the scope. Derived, not edges: traverse never walks them. */
67
106
  referencedBy(identity: string, options?: ReadOptions): readonly FieldReference[];
107
+ /**
108
+ * Graph G06b directed view of `identity`: its declared edge rows, the derived inverses of its counterparts' declarations
109
+ * and its typed field references both ways, rows whose counterpart is outside the scope pruned (D09).
110
+ */
111
+ directedView(identity: string, options?: ReadOptions): readonly DirectedRow[];
112
+ /**
113
+ * D02b (position-and-projection row 17): the seat `path` is declared at, a @system or @workspace identity, and the
114
+ * graph G06c claimants whose path selections select it, records outside the scope treated as absent (D09).
115
+ */
116
+ resolveSeat(path: string, options?: ReadOptions): SeatResolution;
117
+ /**
118
+ * D02a and D02b: the declarations the capture reads that declare nothing, so a host can say so where they are
119
+ * authored: each `composition.sources` entry of an admitted @workspace that names no root, and each claimant
120
+ * selection (graph G06c) the dialect reads as none, ordered by path, line and identity, records outside the scope
121
+ * pruned. They are not report findings, so admission, the snapshot and the frozen Door routes are unchanged.
122
+ */
123
+ inertDeclarations(options?: ReadOptions): readonly InertDeclaration[];
68
124
  search(text: string, options?: ReadOptions): readonly SearchHit[];
69
125
  traverse(options: DatabaseTraversalOptions): Traversal;
70
126
  close(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"handle.d.ts","sourceRoot":"","sources":["../src/handle.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAEjE,OAAO,KAAK,EAAE,cAAc,EAA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,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,SAAS;IAIjF,OAAO,CAAC,SAAS,EAAE,aAAa,EAAE,OAAO,GAAE,WAAgB,GAAG,UAAU;IAYxE,uIAAuI;IACvI,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,SAAS,cAAc,EAAE;IAQpF;;;OAGG;IACH,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,SAAS,WAAW,EAAE;IAKjF;;;OAGG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,cAAc;IAIpE;;;;;OAKG;IACH,iBAAiB,CAAC,OAAO,GAAE,WAAgB,GAAG,SAAS,gBAAgB,EAAE;IAoBzE,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,SAAS,SAAS,EAAE;IAIrE,QAAQ,CAAC,OAAO,EAAE,wBAAwB,GAAG,SAAS;IAItD,KAAK,IAAI,IAAI;CAId;AACD,qBAAa,MAAO,SAAQ,MAAM;;gBAEpB,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB;IAqBnD,OAAO,IAAI,QAAQ;CAgBpB;AACD,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AACjD,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,MAAM,CAEpE"}
package/dist/handle.js CHANGED
@@ -1,10 +1,24 @@
1
1
  import { randomUUID } from 'node:crypto';
2
- import { canonicalRoot, reaches, resolve, search, stableSerialize, traverse } from '@inventarch/graph';
2
+ import { canonicalRoot, directedView, isSelection, reaches, resolve, search, stableSerialize, traverse, } from '@inventarch/graph';
3
3
  import { publishCache } from './cache.js';
4
4
  import { DbError } from './errors.js';
5
5
  import { inputOptions, readInputs } from './inputs.js';
6
+ import { inertSources } from './membership.js';
7
+ import { digestIn, readCapture, readinessOf, rotate, stalenessOf } from './retention.js';
8
+ import { seatOf } from './seat.js';
6
9
  import { occurrenceKey, viewBuilder } from './view.js';
7
10
  import { previewInputs } from './preview.js';
11
+ /** A thunk evaluated once, on its first call, which then releases what it computed from. */
12
+ function once(compute) {
13
+ let pending = compute, value;
14
+ return () => {
15
+ if (value === undefined) {
16
+ value = { result: pending() };
17
+ pending = undefined;
18
+ }
19
+ return value.result;
20
+ };
21
+ }
8
22
  function scopeRoot(value) {
9
23
  try {
10
24
  return canonicalRoot(value);
@@ -36,6 +50,7 @@ export function stableState(read, cache) {
36
50
  }
37
51
  throw new DbError('IA-DB-SOURCE-CHANGED', 'Source inputs changed during three consecutive snapshot attempts');
38
52
  }
53
+ const rootSnapshot = (state) => Object.freeze({ revision: state.rootView.graph.revision, membership: state.rootView.membership });
39
54
  /** Shared read engine for disk handles and cache-free editor snapshots. */
40
55
  export class Reader {
41
56
  root;
@@ -53,6 +68,18 @@ export class Reader {
53
68
  this.#assertOpen();
54
69
  return this.#state.inputs;
55
70
  }
71
+ /** D08: the root snapshot this reader holds and the previous side it retains, unread, as a refresh rotates them. */
72
+ get retention() {
73
+ this.#assertOpen();
74
+ return Object.freeze({
75
+ current: rootSnapshot(this.#state),
76
+ previous: this.#state.retention?.previous ?? (() => undefined),
77
+ });
78
+ }
79
+ /** D08: the previous side of the pair this handle retains. */
80
+ #previous() {
81
+ return this.#state.retention?.previous();
82
+ }
56
83
  replaceState(next) {
57
84
  this.#assertOpen();
58
85
  if (next.inputs.fingerprint !== this.#state.inputs.fingerprint)
@@ -95,6 +122,13 @@ export class Reader {
95
122
  }
96
123
  return { view: scope.view, allowed: scope.allowed };
97
124
  }
125
+ /** D09: the selection for a read about one identity, which must be inside the supplied scope. */
126
+ #admit(identity, options) {
127
+ const selection = this.#select(options);
128
+ if (selection.allowed !== undefined && !selection.allowed.has(identity))
129
+ throw new DbError('IA-DB-OUT-OF-SCOPE', 'Identity is outside the supplied scope');
130
+ return selection;
131
+ }
98
132
  resolveScope(options = {}) {
99
133
  this.#assertOpen();
100
134
  const parent = options.within === undefined ? undefined : this.#scope(options.within);
@@ -162,6 +196,11 @@ export class Reader {
162
196
  ...(view.graph.phase === undefined ? {} : { phase: view.graph.phase }),
163
197
  records: Object.freeze([...view.graph.nodes.values()].filter((node) => allowed === undefined || allowed.has(node.identity))),
164
198
  systems: view.admittedSystems,
199
+ // A row depends only on its occurrence and the capture's declared roots, so a narrowed scope prunes rows and
200
+ // never re-roots one.
201
+ membership: allowed === undefined
202
+ ? view.membership
203
+ : Object.freeze(view.membership.filter((row) => allowed.has(row.identity))),
165
204
  });
166
205
  }
167
206
  records(options = {}) {
@@ -172,10 +211,43 @@ export class Reader {
172
211
  return previewInputs(this.#state.inputs, this.revision, changes, this.#locations);
173
212
  }
174
213
  get(identity, options = {}) {
175
- const { view, allowed } = this.#select(options);
176
- if (allowed !== undefined && !allowed.has(identity))
177
- throw new DbError('IA-DB-OUT-OF-SCOPE', 'Identity is outside the supplied scope');
178
- return view.graph.nodes.get(identity);
214
+ return this.#admit(identity, options).view.graph.nodes.get(identity);
215
+ }
216
+ /** D08: the revision of the retained previous root snapshot, when one is retained. */
217
+ get previousRevision() {
218
+ this.#assertOpen();
219
+ return this.#previous()?.revision;
220
+ }
221
+ /**
222
+ * D08a: the revision of the capture `ia capture` last wrote, at `.ia/work/snapshot/current.json`; undefined when there
223
+ * is none or the file holds no capture this handle trusts. A capture at another revision than `revision` is stale.
224
+ */
225
+ get capturedRevision() {
226
+ this.#assertOpen();
227
+ return this.#state.retention?.captured();
228
+ }
229
+ /**
230
+ * D08: the identity's digest in the view `get` reads under `options` and, when that is also its current root digest
231
+ * (always for a root read), its digest in the previous root snapshot. Only root snapshots are retained, so a narrower
232
+ * root or phase that reads another digest, or a record only one of the two views holds, is not `rooted`.
233
+ */
234
+ #compared(identity, options) {
235
+ const now = this.#admit(identity, options).view.graph.nodes.get(identity)?.digest, rooted = now === this.#state.rootView.graph.nodes.get(identity)?.digest;
236
+ return { now, before: rooted ? digestIn(this.#previous(), identity) : undefined, rooted };
237
+ }
238
+ /**
239
+ * D08: the digest of the record `get` returns against the previous root snapshot's. Undefined when neither side has
240
+ * one, or when the selected view reads an occurrence the root snapshots do not describe; every current identity is
241
+ * `new` while no previous snapshot is retained.
242
+ */
243
+ staleness(identity, options = {}) {
244
+ const { now, before, rooted } = this.#compared(identity, options);
245
+ return rooted ? stalenessOf(now, before) : undefined;
246
+ }
247
+ /** D08 (position-and-projection row 20): which retained snapshot gives the record `get` returns an observed `digest`. */
248
+ readiness(identity, digest, options = {}) {
249
+ const { now, before } = this.#compared(identity, options);
250
+ return readinessOf(now, before, digest);
179
251
  }
180
252
  resolve(reference, options = {}) {
181
253
  const { view, allowed } = this.#select(options);
@@ -190,11 +262,50 @@ export class Reader {
190
262
  }
191
263
  /** Graph G06a typed field references naming `identity`, holders pruned to the scope. Derived, not edges: traverse never walks them. */
192
264
  referencedBy(identity, options = {}) {
193
- const { view, allowed } = this.#select(options);
194
- if (allowed !== undefined && !allowed.has(identity))
195
- throw new DbError('IA-DB-OUT-OF-SCOPE', 'Identity is outside the supplied scope');
265
+ const { view, allowed } = this.#admit(identity, options);
196
266
  return Object.freeze((view.graph.referencedBy.get(identity) ?? []).filter((reference) => allowed === undefined || allowed.has(reference.from)));
197
267
  }
268
+ /**
269
+ * Graph G06b directed view of `identity`: its declared edge rows, the derived inverses of its counterparts' declarations
270
+ * and its typed field references both ways, rows whose counterpart is outside the scope pruned (D09).
271
+ */
272
+ directedView(identity, options = {}) {
273
+ const { view, allowed } = this.#admit(identity, options);
274
+ const rows = directedView(view.graph, identity);
275
+ return allowed === undefined ? rows : Object.freeze(rows.filter((row) => allowed.has(row.counterpart)));
276
+ }
277
+ /**
278
+ * D02b (position-and-projection row 17): the seat `path` is declared at, a @system or @workspace identity, and the
279
+ * graph G06c claimants whose path selections select it, records outside the scope treated as absent (D09).
280
+ */
281
+ resolveSeat(path, options = {}) {
282
+ const { view, allowed } = this.#select(options);
283
+ return seatOf(view, path, allowed);
284
+ }
285
+ /**
286
+ * D02a and D02b: the declarations the capture reads that declare nothing, so a host can say so where they are
287
+ * authored: each `composition.sources` entry of an admitted @workspace that names no root, and each claimant
288
+ * selection (graph G06c) the dialect reads as none, ordered by path, line and identity, records outside the scope
289
+ * pruned. They are not report findings, so admission, the snapshot and the frozen Door routes are unchanged.
290
+ */
291
+ inertDeclarations(options = {}) {
292
+ const { view, allowed } = this.#select(options);
293
+ const selections = view.graph.claims
294
+ .filter((claim) => !isSelection(claim.selection))
295
+ .map((claim) => ({
296
+ identity: claim.from,
297
+ field: claim.field,
298
+ value: claim.selection,
299
+ path: claim.source.path,
300
+ line: claim.source.line,
301
+ reason: 'selects nothing: a selection is a workspace-relative path with no empty, . or .. segment',
302
+ }));
303
+ const order = (a, b) => (a < b ? -1 : a > b ? 1 : 0);
304
+ return Object.freeze([...inertSources(view.graph), ...selections]
305
+ .filter((declaration) => allowed === undefined || allowed.has(declaration.identity))
306
+ .sort((a, b) => order(a.path, b.path) || a.line - b.line || order(a.identity, b.identity))
307
+ .map((declaration) => Object.freeze(declaration)));
308
+ }
198
309
  search(text, options = {}) {
199
310
  const { view, allowed } = this.#select(options);
200
311
  return search(view.graph, text, allowed);
@@ -212,12 +323,29 @@ export class Handle extends Reader {
212
323
  #options;
213
324
  constructor(root, options = {}) {
214
325
  const selected = Object.freeze({ ...inputOptions(options), cache: options.cache ?? true });
215
- super(stableState(() => readInputs(root, selected), selected.cache), selected.locations);
326
+ const state = stableState(() => readInputs(root, selected), selected.cache), canonical = state.inputs.root, current = rootSnapshot(state), seed = once(() => readCapture(canonical, current));
327
+ // D08a: whatever the cache setting, the capture pair seeds the previous snapshot, the first time it is asked; the
328
+ // handle never writes it.
329
+ super({
330
+ ...state,
331
+ retention: {
332
+ previous: once(() => rotate(seed().prior, current).previous),
333
+ captured: () => seed().captured,
334
+ },
335
+ }, selected.locations);
216
336
  this.#options = selected;
217
337
  Object.freeze(this);
218
338
  }
219
339
  refresh() {
220
- this.replaceState(stableState(() => readInputs(this.root, this.#options), this.#options.cache));
340
+ const held = this.retention, next = stableState(() => readInputs(this.root, this.#options), this.#options.cache), root = next.inputs.root, current = rootSnapshot(next);
341
+ // D08 rotation (`rotate`) without reading the pair: a changed revision makes the held root snapshot previous, an
342
+ // unchanged one keeps the held previous side, still unread until asked, so no refresh lengthens what a handle holds.
343
+ // The capture pair's current revision is read again when asked, as `ia capture` may have run.
344
+ const before = held.current, previous = before.revision === current.revision ? held.previous : () => before;
345
+ this.replaceState({
346
+ ...next,
347
+ retention: { previous, captured: once(() => readCapture(root, current).captured) },
348
+ });
221
349
  return this.snapshot();
222
350
  }
223
351
  }
@@ -1 +1 @@
1
- {"version":3,"file":"handle.js","sourceRoot":"","sources":["../src/handle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGvG,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEvD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAEvD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAiD7C,SAAS,SAAS,CAAC,KAAa;IAC9B,IAAI,CAAC;QACH,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,OAAO,CAAC,sBAAsB,EAAE,wDAAwD,CAAC,CAAC;IACtG,CAAC;AACH,CAAC;AAED;+EAC+E;AAC/E,MAAM,UAAU,WAAW,CAAC,IAAyB,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