@inventarch/graph 0.0.0-stage → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/LANGUAGE.md +56 -0
  2. package/LICENSE +202 -0
  3. package/NOTICE +4 -0
  4. package/README.md +4 -2
  5. package/SPEC.md +53 -0
  6. package/dist/coordinate.d.ts +14 -0
  7. package/dist/coordinate.d.ts.map +1 -0
  8. package/dist/coordinate.js +48 -0
  9. package/dist/coordinate.js.map +1 -0
  10. package/dist/diagnostics.d.ts +12 -0
  11. package/dist/diagnostics.d.ts.map +1 -0
  12. package/dist/diagnostics.js +24 -0
  13. package/dist/diagnostics.js.map +1 -0
  14. package/dist/immutable.d.ts +6 -0
  15. package/dist/immutable.d.ts.map +1 -0
  16. package/dist/immutable.js +53 -0
  17. package/dist/immutable.js.map +1 -0
  18. package/dist/index.d.ts +18 -0
  19. package/dist/index.d.ts.map +1 -0
  20. package/dist/index.js +10 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/load.d.ts +6 -0
  23. package/dist/load.d.ts.map +1 -0
  24. package/dist/load.js +320 -0
  25. package/dist/load.js.map +1 -0
  26. package/dist/paths.d.ts +5 -0
  27. package/dist/paths.d.ts.map +1 -0
  28. package/dist/paths.js +28 -0
  29. package/dist/paths.js.map +1 -0
  30. package/dist/queries.d.ts +19 -0
  31. package/dist/queries.d.ts.map +1 -0
  32. package/dist/queries.js +70 -0
  33. package/dist/queries.js.map +1 -0
  34. package/dist/resolve.d.ts +12 -0
  35. package/dist/resolve.d.ts.map +1 -0
  36. package/dist/resolve.js +17 -0
  37. package/dist/resolve.js.map +1 -0
  38. package/dist/revision.d.ts +16 -0
  39. package/dist/revision.d.ts.map +1 -0
  40. package/dist/revision.js +58 -0
  41. package/dist/revision.js.map +1 -0
  42. package/dist/text.d.ts +16 -0
  43. package/dist/text.d.ts.map +1 -0
  44. package/dist/text.js +99 -0
  45. package/dist/text.js.map +1 -0
  46. package/dist/traverse.d.ts +39 -0
  47. package/dist/traverse.d.ts.map +1 -0
  48. package/dist/traverse.js +107 -0
  49. package/dist/traverse.js.map +1 -0
  50. package/dist/types.d.ts +112 -0
  51. package/dist/types.d.ts.map +1 -0
  52. package/dist/types.js +2 -0
  53. package/dist/types.js.map +1 -0
  54. package/package.json +92 -3
package/LANGUAGE.md ADDED
@@ -0,0 +1,56 @@
1
+ # Public IA language
2
+
3
+ IA records declare typed identities, fields and relationships. Owning canonical schemas define the structural contract; language syntax and reference resolution preserve those declarations.
4
+
5
+ The selected vocabulary below is shared by this release. Use `ia vocabulary --json` for its attributed catalogue and `ia vocabulary --schema` for canonical field schemas. `ia validate` reports structural and evaluated evidence separately. An admitted declaration does not establish semantic quality or grant execution authority.
6
+
7
+ Spec source locators do not load documents. Resource capture and disclosure require explicit selection, matching pins and a host-owned disclosure boundary. Model, operation, evaluator and authority callbacks belong to the application host.
8
+
9
+ | Word | Owner | Meaning |
10
+ | --- | --- | --- |
11
+ | @agent | agent-system | Names a participant and the vocabulary to which its governance applies. It does not grant host permissions. |
12
+ | @agent-profile | agent-composition-system | Composes an agent, capabilities, optional mandate/voice/delegates and installed execution contracts. |
13
+ | @artifact-set | taxonomy | Defines a closed grouping of artifact genres. |
14
+ | @authoring-guide | authoring-system | Associates a vocabulary owner and schema with an authoring reference and usage guidance. |
15
+ | @axis | taxonomy | Defines a closed coordinate axis for selection. |
16
+ | @capability | agent-composition-system | Groups operations, procedures, templates, checks and included capabilities with declared execution bounds. |
17
+ | @cardinality | taxonomy | Defines relationship multiplicity constraints. |
18
+ | @case | compliance-system | Declares scenario inputs, expected behavior and evaluator attribution. A declaration is not an observed test result. |
19
+ | @category | taxonomy | Defines a closed concept classification used by record shapes and contextual selection. |
20
+ | @check | compliance-system | Names a check implementation and scope. Declaring an implementation name does not install or execute it. |
21
+ | @contract | compliance-system | Names versioned requirements that may be adopted by other records. Requirements need explicit evaluation evidence. |
22
+ | @convention | governance-system | Declares a convention in the shared governance shape. |
23
+ | @decision | work-system | Represents a choice that is needed or has been made: the question, options and decider, and once made, the choice and rationale. |
24
+ | @dimension | taxonomy | Defines a supported record dimension used by conditions and lookup. |
25
+ | @distribution | workspace-system | Declares root records from which a distributable closure is selected. |
26
+ | @execution-binding | agent-composition-system | Connects a native target to a host-installed entry or operation descriptor. |
27
+ | @harness | agent-composition-system | Composes profiles and execution bindings in a workspace under a host contract. |
28
+ | @hook | hook-authoring-system | Represents a host event, tool/path selection and guard message. Registration and executing a guard require a host adapter. |
29
+ | @improvement | learning-system | Represents a proposed change, review metadata and publication metadata. It does not authorize or apply the proposal. |
30
+ | @intent-shape | taxonomy | Defines a request framing and its retrieval defaults. |
31
+ | @kind | taxonomy | Defines a closed semantic role for records; lowering determines the role of each registered word. |
32
+ | @lane | taxonomy | Defines a retrieval lane associated with record kinds. |
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. |
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
+ | @move | taxonomy | Defines the closed classification of an agent action or activity. |
37
+ | @observation | learning-system | Represents an attributed evidence account with interpretation and retention metadata. Evidence claims are not verified by field typing. |
38
+ | @operation | authoring-system | Binds a declared operation to an implementation/input/output/effect contract; the host installs implementations. |
39
+ | @phase | taxonomy | Defines a cognitive phase coordinate: orient, plan, act or learn. |
40
+ | @placement | taxonomy | Defines source authority and reach metadata. |
41
+ | @plan | work-system | Represents an arrangement of milestones toward an intent; it heads the work hierarchy and has no parent. Plans do not nest. |
42
+ | @playbook | governance-system | Represents a procedure as phase/primitive cells. Cell delivery is generic; the authored method belongs to its author. |
43
+ | @predicate | taxonomy | Defines a directed relationship and its inverse spelling. |
44
+ | @primitive | taxonomy | Defines a cognitive primitive coordinate; a cell is selected using its phase and primitive. |
45
+ | @principle | governance-system | Declares a governing rationale in the shared governance shape. |
46
+ | @run | session-system | Represents a governed run identity, declared phase, status and owner. Declaration does not start execution. |
47
+ | @schema | floor | Declares the structural contract for exactly one registered discriminator. |
48
+ | @spec | work-system | Represents a maintained specification with explicit status and at most one same-word supersession. Contents and document membership belong to its author; a source locator does not load a body or prove semantic quality. |
49
+ | @system | floor | Registers vocabulary, direct system dependencies, a local steward and consent for relationships. |
50
+ | @task | work-system | Represents one owner's action toward exactly one milestone. Whether it is ready to start is computed by a work evaluator, never stored on the record. |
51
+ | @template | template-system | Represents bounded rendering inputs and output structure. Rendering does not publish or install output. |
52
+ | @value-type | taxonomy | Defines the field types that schemas may require. |
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. |
55
+
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/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,4 @@
1
+ InventArch
2
+ Copyright (c) 2026 InventArch contributors
3
+
4
+ Licensed under the Apache License, Version 2.0. See LICENSE.
package/README.md CHANGED
@@ -1,3 +1,5 @@
1
- # Temporary Holding Version
1
+ # @inventarch/graph
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The pure graph layer consumes compiled IA records and an explicit registry. [SPEC.md](SPEC.md) owns behavior and implementation status. The package provides immutable graph construction, reach/phase authority resolution, occurrence and relationship indexes, a derived typed field-reference index kept apart from the edges, revision hashing, and coordinate/dimension validation. Conditions, selectors, variant and cell selection, and scoped breadth-first traversal consume those products. search(graph, text, scope) ranks decoded content using BM25 with scope-local statistics.
4
+
5
+ The package depends on @inventarch/language and uses node:crypto only for deterministic SHA-256. It performs no filesystem I/O, clock reads, source parsing, cache publication or model/tool execution. Decoded prose search is implemented here; IA lexical analysis stays in language.
package/SPEC.md ADDED
@@ -0,0 +1,53 @@
1
+ # Graph specification
2
+
3
+ Bounded traversal extension (Workbench): optional `maxNodes`/`maxEdges` retain normal authority, scope, direction and condition behavior while bounding emitted records and edge examination. A bounded result reports `truncated`; callers must not describe it as a complete graph. Calls without limits preserve the original contract.
4
+
5
+ Status: G01–G11 implemented under the graph plan. Shared concepts: graph/matrix design. Pure Node-compatible package depending only on @inventarch/language; no filesystem, clock, default registry or source-text lexer. Task-delivery paragraphs below retain historical counts and next steps; current readiness covers the completed downstream consumers.
6
+
7
+ ## Construction and revision
8
+
9
+ G01. `load(records, registry, options)` returns an immutable Graph containing source diagnostics. Options explicitly supply revision sources, language version, kernel digest, view location and optional phase. A revision source has path, text and Location. `revisionOf` SHA-256 hashes sorted canonical source paths/raw text/placement/provenance, stable registry serialization, language version and kernel digest. Any byte or semantic input change affects the revision. Location/phase identify a view and do not change corpus revision. Duplicate source paths and inconsistent caller-supplied registration/identity/placement are TypeErrors, not authored syntax diagnostics.
10
+
11
+ G02. Graph snapshots all inputs and exposes read-only collection views backed by inaccessible copies; casting a ReadonlyMap to Map must not make mutation possible. Nested record/schema/registry arrays and objects are frozen copies. `serialize(graph)` has total stable ordering independent of source, record and map insertion order. Object keys sort by code point, maps by serialized key, sets by serialized value. Source text is revision input, never re-lexed here. SHA-256 uses the pure deterministic node:crypto hash API.
12
+
13
+ G03. Canonical reach/location roots are corpus-relative paths using language canonicalPath with an empty-root sentinel. Above-root traversal or absolute roots are usage errors. Empty reach covers every location; a nonempty reach covers itself and segment-boundary descendants only. Validate each record's placement kind/band pair. Provenance never determines authority.
14
+
15
+ ## Authority and indexes
16
+
17
+ G04. Filter occurrences by reach and optional phase before authority. For phase applicability, any selector group without a phase term admits every phase; otherwise the record admits the union of its groups' phase values. No selectors or an omitted phase imposes no phase filter. At each identity the unique highest-band applicable occurrence wins. A highest-band tie refuses every tied participant with IDENTITY-TIE and admits no lower fallback. Differing overlapping reaches do not break ties. Retain all source occurrences, explicit shadows and ties separately; nodes is a winners-only identity map. Out-of-reach/phase occurrences remain inspectable but unindexed.
18
+
19
+ G05. Build byName, byDiscriminator, byKind, bySystem, byCategory and byLane postings from winners; category comes from the registration and lane from the validated kernel kind mapping (contract@authority maps authority). Index cells at phase/primitive, selector axis/value groups and all condition terms from cells/edges/variants/requirements. Classification is an optional single head artifact-set field, a scalar/string closed value. Severity is an optional single governance.severity scalar/string closed value. Unknown, malformed or repeated dimension declarations refuse that record with DIMENSION-UNKNOWN. Provenance is the compiled loader-supplied value. Prose/gloss fields never supply routing coordinates.
20
+
21
+ G06. Resolve every authored edge through language.resolveTarget against winners, including formerly dangling edges. Normalize inverse direction into active endpoints; retain author identity, typed reference, fragment, condition subject (the author), spans and source assertions. A missing endpoint is null: ordinary edges remain under out[author], inverse edges under in[author]. Both forms remain in dangling and a byDanglingReference index. More than one candidate refuses the edge with TARGET-AMBIGUOUS; zero retains it with TARGET-MISSING warning. Resolve API reports these graph codes without candidate-order selection.
22
+
23
+ G06a. Derive `references`, a typed field-reference index beside the edges, from every typed ref value a winner holds in its head or sections, list items and nested fields included. Each `FieldReference` carries `from` (the holder), `to` (the resolved winner), `field` (the compiler's field path: `head.steward`, `composition.mandate`, `binding.target`, or the bare section name for a section-level item), the authored `reference` and the holder's source span. Targets resolve through the same resolve API as edges; an unresolved or ambiguous ref is omitted without a graph diagnostic, because compliance reports it (IA-COMP-FIELD-REF-MISSING). The `relationships` section is skipped by name, so a consent-refused assertion never reappears as a reference, and a ref inside the span of an edge the compiler already lowered (a floor `@system` `discriminators` entry's `ground`) is skipped, so no authored ref is both an edge and a reference. A field reference carries no predicate and is never consent-, cardinality- or COMP-checked; `edges`, `in`, `out`, `dangling`, diagnostics and revision are unchanged by it. `referencedBy` keys `references` by target. Ordering is total over from, field, to, source path/line and the serialized reference, independent of input order; equal entries are stored once.
24
+
25
+ G07. Check both word owners' consent on each resolved edge in active direction, reporting only the first refusing side as EDGE-UNCONSENTED. The exact unconditioned, fragmentless system-to-registered-schema ground assertion generated by registration bypasses ledgers as specified by language S07; no other ground edge is exempt. Store equivalent unconditioned edges once, retaining every source assertion. Conditioned edges also key by condition subject, because equal terms authored on different records may see different dimensions. Sort edges by endpoints/predicate/fragment/condition/author/source for a total order.
26
+
27
+ G07a. Reuse language S07a's fixed incoming whole-schema citation permission when an edge resolves across inputs. Pass the actual logical target endpoint's fragment to consent, preserving inverse references on the other endpoint. The source ledger remains required; missing/ambiguous targets retain their existing outcomes. No additional ground or authority exemption is introduced.
28
+
29
+ A fragment still addresses the originally referenced record after inverse normalization. Edges therefore retain fragmentEndpoint (from for an inverse assertion, to for an outbound assertion), preventing an inverse fragment from being misapplied to its author.
30
+
31
+ ## Coordinates and queries
32
+
33
+ G08. A graph coordinate is a partial mapping of closed routing axes plus severity/provenance to values. validateCoordinate canonicalizes case-insensitive values using language tables and rejects unknown names/values as COORDINATE-VALUE-UNKNOWN. Public query methods reject invalid coordinates with a typed GraphUsageError. Missing routing axes cannot satisfy conditions. Conditions read severity as max(subject severity, request severity), provenance from the subject, and artifact-set from its classification; other axes come from the request. Selector terms, including artifact-set, match the request. No default dimensions are invented.
34
+
35
+ G09. selectors(record, coordinate) reports matched, neutral or disqualified. Groups are OR; terms within a group are AND. A fully supplied matching group establishes matched with its maximum term count. No selectors or an uncontradicted group with missing values yields neutral; all groups contradicted by at least one supplied value yields disqualified. This affects retrieval, never parses a meaning gloss. variants selects the highest-specificity applicable clause in each key family; equal maxima report VARIANT-AMBIGUOUS and select none for that family. A conditional exact cell that does not apply cannot suppress a valid primary fallback. Cell selection returns exact, primary or absent for one record/coordinate.
36
+
37
+ G10. traverse(graph, options) performs breadth-first traversal from a declared start list. follow verbs use the exact language table and imply direction; direction is consulted only if follow is absent. Depth is an integer 0..8, otherwise TRAVERSAL-INVALID. Unknown verb is VERB-UNKNOWN. Scope is an allowed identity set and prunes starts, endpoints and traversal; an out-of-scope intermediary cannot expose its descendants. A filter prunes nodes by kind/discriminator/system using typed data. Missing starts yield no walk. Cycles terminate. With a coordinate, false conditions go to gated and are not crossed/returned as followed; without one, conditioned edges may be traversed with their conditions retained. Expose dangling separately. Nodes order by depth/identity, via by from/predicate/direction/target, edges by G07's total order.
38
+
39
+ G11. search(graph, text, scope?) is graph-owned BM25 over decoded names, field/item text, references and semantic products without indexing the same body text twice. Preserve donor NFKC/lowercase/NFD mark removal, Unicode letter/digit tokens of 2..64 characters, donor stopwords, k1=1.2 and b=.75. Query terms deduplicate. Statistics N/df/average length are computed over the allowed scope, never hidden records. Return positive scores sorted descending then identity. Text tokenization is over decoded prose/query strings, not IA source syntax. Expose no mutable postings.
40
+
41
+ ## Diagnostics, evidence and boundaries
42
+
43
+ Graph source codes use IA-GRAPH-IDENTITY-TIE, TARGET-MISSING, TARGET-AMBIGUOUS, EDGE-UNCONSENTED and DIMENSION-UNKNOWN. Query errors use IA-GRAPH-COORDINATE-VALUE-UNKNOWN, VERB-UNKNOWN, TRAVERSAL-INVALID and VARIANT-AMBIGUOUS; root normalization uses SCOPE-INVALID. Source diagnostic shape matches language with the graph namespace; errors refuse their stated subject, warnings retain evidence. Fragments are retained but compliance owns existence. Graph performs no scenario execution, caching, scope-token issuance, ranking into runtime packets or model/tool dispatch. Public evidence must distinguish these boundaries.
44
+
45
+ Each task records native success/refusal, permutation/immutability and public-consumer evidence here. Native taxonomy/system records, the authoring playbook, law and check provide the normal path; overlays and malformed coordinates provide adversarial cases. Central exact-cell/primary examples use separate records to avoid double-delivery. Raising severity uses an advisory fixture, because a blocking subject is already blocking without a request override.
46
+
47
+ Task 1 delivered: public revision, root/reach and coordinate/dimension APIs; internal immutable snapshots and stable typed collection serialization. 39 graph tests cover native inputs, source/registry/placement/provenance/kernel/version revision changes, mutation resistance, invalid coordinates and scope escape variants. Workspace tests/typecheck/build passed; graph load/index/query tasks remain pending.
48
+
49
+ Task 2 delivered: immutable graph load, winner-only indexes with retained occurrences/shadows/ties, active-direction relationships, dangling references and consent rechecks. 57 graph tests and the complete 1401-test workspace suite pass, with typecheck/build/kernel check. Native graph: 153 records, 26 structural grounds, zero diagnostics. Contextual queries and text search remain pending.
50
+
51
+ Task 3 delivered: conditions, selectors, variants, cell selection and breadth-first traversal. Traversal defaults to depth 1 and both directions when follow is absent; an explicit empty follow list crosses no edges. Via entries describe shortest-path hops, while followed edges retain cycles without revisiting nodes. Scope and typed filters prune before any edge emission, including gated edges. Query results are immutable. 86 graph tests and 1430 workspace tests/45 files pass with typecheck/build/kernel check.
52
+
53
+ Task 4 delivered: immutable decoded-text postings and scoped BM25. The name is indexed once using displayName, along with the discriminator, nested compiled field/item/list/reference values and semantic text not already represented at its source line. Field keys and source syntax are not lexed. Search results preserve query-term order, deduplicate terms and exclude nonexistent scope identities from statistics. 92 graph tests; 1440 workspace tests/47 files, typecheck/build, native/kernel and dependency checks pass. The emitted-declaration/built-runtime consumer admits all 153 native nodes and exercises exact cells, variants, inverse gating, scoped search and immutable views. Graph G01–G11 are delivered; scenario execution, scoped capability tokens, caches and runtime packet assembly retain their downstream owners.
@@ -0,0 +1,14 @@
1
+ import type { ArtifactSet, CompiledRecord, ConditionAxis, KernelSeverity, Provenance } from '@inventarch/language';
2
+ import type { GraphDiagnostic } from './diagnostics.js';
3
+ export type Coordinate = Readonly<Partial<Record<ConditionAxis, string>>>;
4
+ export interface Dimensions {
5
+ readonly provenance: Provenance;
6
+ readonly severity?: KernelSeverity;
7
+ readonly artifactSet?: ArtifactSet;
8
+ }
9
+ export declare function validateCoordinate(input: Readonly<Record<string, unknown>>): Coordinate;
10
+ export declare function dimensionsOf(record: CompiledRecord): {
11
+ dimensions: Dimensions;
12
+ diagnostics: readonly GraphDiagnostic[];
13
+ };
14
+ //# sourceMappingURL=coordinate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coordinate.d.ts","sourceRoot":"","sources":["../src/coordinate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EAEX,cAAc,EACd,aAAa,EACb,cAAc,EACd,UAAU,EACX,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;AAC1E,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,QAAQ,CAAC,EAAE,cAAc,CAAC;IACnC,QAAQ,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC;CACpC;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,UAAU,CAoBvF;AACD,wBAAgB,YAAY,CAAC,MAAM,EAAE,cAAc,GAAG;IACpD,UAAU,EAAE,UAAU,CAAC;IACvB,WAAW,EAAE,SAAS,eAAe,EAAE,CAAC;CACzC,CAmCA"}
@@ -0,0 +1,48 @@
1
+ import { ARTIFACT_SETS, CONDITION_AXES, SEVERITIES, canonicalValue, valuesFor } from '@inventarch/language';
2
+ import { GraphUsageError, graphDiagnostic } from './diagnostics.js';
3
+ export function validateCoordinate(input) {
4
+ if (input === null || typeof input !== 'object' || Array.isArray(input))
5
+ throw new GraphUsageError('IA-GRAPH-COORDINATE-VALUE-UNKNOWN', 'Coordinate must be an axis/value object');
6
+ const output = {};
7
+ for (const [name, value] of Object.entries(input)) {
8
+ if (valuesFor(name) === undefined)
9
+ throw new GraphUsageError('IA-GRAPH-COORDINATE-VALUE-UNKNOWN', `Unknown coordinate axis '${name}'; admitted: ${CONDITION_AXES.join(', ')}`);
10
+ if (value === undefined)
11
+ continue;
12
+ const canonical = typeof value === 'string' ? canonicalValue(name, value) : undefined;
13
+ if (canonical === undefined)
14
+ throw new GraphUsageError('IA-GRAPH-COORDINATE-VALUE-UNKNOWN', `Unknown ${name} value '${String(value)}'; admitted: ${valuesFor(name).join(', ')}`);
15
+ output[name] = canonical;
16
+ }
17
+ return Object.freeze(output);
18
+ }
19
+ export function dimensionsOf(record) {
20
+ const diagnostics = [];
21
+ const read = (fields, key, domain) => {
22
+ const matched = fields.filter((f) => f.key === key);
23
+ if (matched.length === 0)
24
+ return undefined;
25
+ const value = matched[0].value;
26
+ const canonical = matched.length === 1 && (value.kind === 'scalar' || value.kind === 'string')
27
+ ? domain.find((v) => v.toLowerCase() === value.text.toLowerCase())
28
+ : undefined;
29
+ if (canonical === undefined)
30
+ diagnostics.push(graphDiagnostic('IA-GRAPH-DIMENSION-UNKNOWN', record.source.path, matched[0].span.line, `${record.identity}: ${key} must occur once as one of ${domain.join(', ')}`));
31
+ return canonical;
32
+ };
33
+ const governance = record.sections
34
+ .filter((s) => s.name === 'governance')
35
+ .flatMap((s) => s.fields)
36
+ .filter((f) => 'key' in f);
37
+ const severity = read(governance, 'severity', SEVERITIES);
38
+ const artifactSet = read(record.head, 'artifact-set', ARTIFACT_SETS);
39
+ return {
40
+ dimensions: Object.freeze({
41
+ provenance: record.provenance,
42
+ ...(severity === undefined ? {} : { severity }),
43
+ ...(artifactSet === undefined ? {} : { artifactSet }),
44
+ }),
45
+ diagnostics,
46
+ };
47
+ }
48
+ //# sourceMappingURL=coordinate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coordinate.js","sourceRoot":"","sources":["../src/coordinate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,UAAU,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAS5G,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AASpE,MAAM,UAAU,kBAAkB,CAAC,KAAwC;IACzE,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACrE,MAAM,IAAI,eAAe,CAAC,mCAAmC,EAAE,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C,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC;YAC/C,GAAG,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC;SACtD,CAAC;QACF,WAAW;KACZ,CAAC;AACJ,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { Diagnostic } from '@inventarch/language';
2
+ export declare const GRAPH_CODES: readonly ["IA-GRAPH-IDENTITY-TIE", "IA-GRAPH-TARGET-MISSING", "IA-GRAPH-TARGET-AMBIGUOUS", "IA-GRAPH-EDGE-UNCONSENTED", "IA-GRAPH-DIMENSION-UNKNOWN", "IA-GRAPH-COORDINATE-VALUE-UNKNOWN", "IA-GRAPH-VERB-UNKNOWN", "IA-GRAPH-TRAVERSAL-INVALID", "IA-GRAPH-VARIANT-AMBIGUOUS", "IA-GRAPH-SCOPE-INVALID"];
3
+ export type GraphCode = (typeof GRAPH_CODES)[number];
4
+ export interface GraphDiagnostic extends Omit<Diagnostic, 'code'> {
5
+ readonly code: GraphCode;
6
+ }
7
+ export declare class GraphUsageError extends Error {
8
+ readonly code: GraphCode;
9
+ constructor(code: GraphCode, message: string);
10
+ }
11
+ export declare function graphDiagnostic(code: GraphCode, path: string, line: number, message: string, warning?: boolean): GraphDiagnostic;
12
+ //# sourceMappingURL=diagnostics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,eAAO,MAAM,WAAW,2SAWd,CAAC;AACX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AACrD,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC;IAC/D,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;CAC1B;AACD,qBAAa,eAAgB,SAAQ,KAAK;IAEtC,QAAQ,CAAC,IAAI,EAAE,SAAS;gBAAf,IAAI,EAAE,SAAS,EACxB,OAAO,EAAE,MAAM;CAKlB;AACD,wBAAgB,eAAe,CAC7B,IAAI,EAAE,SAAS,EACf,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,OAAO,UAAQ,GACd,eAAe,CAEjB"}
@@ -0,0 +1,24 @@
1
+ export const GRAPH_CODES = [
2
+ 'IA-GRAPH-IDENTITY-TIE',
3
+ 'IA-GRAPH-TARGET-MISSING',
4
+ 'IA-GRAPH-TARGET-AMBIGUOUS',
5
+ 'IA-GRAPH-EDGE-UNCONSENTED',
6
+ 'IA-GRAPH-DIMENSION-UNKNOWN',
7
+ 'IA-GRAPH-COORDINATE-VALUE-UNKNOWN',
8
+ 'IA-GRAPH-VERB-UNKNOWN',
9
+ 'IA-GRAPH-TRAVERSAL-INVALID',
10
+ 'IA-GRAPH-VARIANT-AMBIGUOUS',
11
+ 'IA-GRAPH-SCOPE-INVALID',
12
+ ];
13
+ export class GraphUsageError extends Error {
14
+ code;
15
+ constructor(code, message) {
16
+ super(message);
17
+ this.code = code;
18
+ this.name = 'GraphUsageError';
19
+ }
20
+ }
21
+ export function graphDiagnostic(code, path, line, message, warning = false) {
22
+ return { code, path, line, severity: warning ? 'warning' : 'error', message: `${path}:${line}: ${message}` };
23
+ }
24
+ //# sourceMappingURL=diagnostics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnostics.js","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,uBAAuB;IACvB,yBAAyB;IACzB,2BAA2B;IAC3B,2BAA2B;IAC3B,4BAA4B;IAC5B,mCAAmC;IACnC,uBAAuB;IACvB,4BAA4B;IAC5B,4BAA4B;IAC5B,wBAAwB;CAChB,CAAC;AAKX,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAE7B;IADX,YACW,IAAe,EACxB,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;QAHN,SAAI,GAAJ,IAAI,CAAW;QAIxB,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AACD,MAAM,UAAU,eAAe,CAC7B,IAAe,EACf,IAAY,EACZ,IAAY,EACZ,OAAe,EACf,OAAO,GAAG,KAAK;IAEf,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,IAAI,IAAI,IAAI,KAAK,OAAO,EAAE,EAAE,CAAC;AAC/G,CAAC"}
@@ -0,0 +1,6 @@
1
+ /** Read-only views with inaccessible backing storage; Object.freeze(Map) alone is insufficient. */
2
+ export declare function readonlyMap<K, V>(entries: Iterable<readonly [K, V]>): ReadonlyMap<K, V>;
3
+ export declare function readonlySet<T>(values: Iterable<T>): ReadonlySet<T>;
4
+ /** Only structured record data belongs here: no Date, function, resource or class instances. */
5
+ export declare function snapshot<T>(value: T): T;
6
+ //# sourceMappingURL=immutable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"immutable.d.ts","sourceRoot":"","sources":["../src/immutable.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,wBAAgB,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAoBvF;AACD,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAmBlE;AACD,gGAAgG;AAChG,wBAAgB,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAOvC"}
@@ -0,0 +1,53 @@
1
+ /** Read-only views with inaccessible backing storage; Object.freeze(Map) alone is insufficient. */
2
+ export function readonlyMap(entries) {
3
+ const backing = new Map(entries);
4
+ const view = Object.create(Map.prototype);
5
+ Object.defineProperties(view, {
6
+ size: { get: () => backing.size },
7
+ get: { value: (key) => backing.get(key) },
8
+ has: { value: (key) => backing.has(key) },
9
+ entries: { value: () => backing.entries() },
10
+ keys: { value: () => backing.keys() },
11
+ values: { value: () => backing.values() },
12
+ [Symbol.iterator]: { value: () => backing.entries() },
13
+ forEach: {
14
+ value: (callback, thisArg) => backing.forEach((value, key) => callback.call(thisArg, value, key, view)),
15
+ },
16
+ set: { value: undefined },
17
+ delete: { value: undefined },
18
+ clear: { value: undefined },
19
+ });
20
+ return Object.freeze(view);
21
+ }
22
+ export function readonlySet(values) {
23
+ const backing = new Set(values);
24
+ const view = Object.create(Set.prototype);
25
+ Object.defineProperties(view, {
26
+ size: { get: () => backing.size },
27
+ has: { value: (value) => backing.has(value) },
28
+ entries: { value: () => backing.entries() },
29
+ keys: { value: () => backing.keys() },
30
+ values: { value: () => backing.values() },
31
+ [Symbol.iterator]: { value: () => backing.values() },
32
+ forEach: {
33
+ value: (callback, thisArg) => backing.forEach((value) => callback.call(thisArg, value, value, view)),
34
+ },
35
+ add: { value: undefined },
36
+ delete: { value: undefined },
37
+ clear: { value: undefined },
38
+ });
39
+ return Object.freeze(view);
40
+ }
41
+ /** Only structured record data belongs here: no Date, function, resource or class instances. */
42
+ export function snapshot(value) {
43
+ if (value instanceof Map)
44
+ return readonlyMap([...value].map(([k, v]) => [snapshot(k), snapshot(v)]));
45
+ if (value instanceof Set)
46
+ return readonlySet([...value].map(snapshot));
47
+ if (Array.isArray(value))
48
+ return Object.freeze(value.map(snapshot));
49
+ if (value !== null && typeof value === 'object')
50
+ return Object.freeze(Object.fromEntries(Object.entries(value).map(([k, v]) => [k, snapshot(v)])));
51
+ return value;
52
+ }
53
+ //#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ches } from './paths.js';
4
+ export { stableSerialize, revisionOf } from './revision.js';
5
+ export type { RevisionInputs, RevisionSource } from './revision.js';
6
+ export { validateCoordinate, dimensionsOf } from './coordinate.js';
7
+ export type { Coordinate, Dimensions } from './coordinate.js';
8
+ export { load, serialize } from './load.js';
9
+ export { resolve } from './resolve.js';
10
+ export type { Resolution } from './resolve.js';
11
+ export type { CellRef, CellSelection, Edge, EdgeAssertion, FieldReference, Graph, LoadOptions, Node, Occurrence, Shadow, Tie, } from './types.js';
12
+ export { cell, conditionHolds, effectiveSeverity, selectors, variants } from './queries.js';
13
+ export type { SelectorMatch, VariantSelection } from './queries.js';
14
+ export { traverse } from './traverse.js';
15
+ export type { Traversal, TraverseOptions, Via, WalkNode } from './traverse.js';
16
+ export { fold, tokenize, search } from './text.js';
17
+ export type { TextIndex, SearchHit } from './text.js';
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAChE,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC5D,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACnE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,YAAY,EACV,OAAO,EACP,aAAa,EACb,IAAI,EACJ,aAAa,EACb,cAAc,EACd,KAAK,EACL,WAAW,EACX,IAAI,EACJ,UAAU,EACV,MAAM,EACN,GAAG,GACJ,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,iBAAiB,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC5F,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnD,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ export { GRAPH_CODES, GraphUsageError } from './diagnostics.js';
2
+ export { canonicalRoot, reaches } from './paths.js';
3
+ export { stableSerialize, revisionOf } from './revision.js';
4
+ export { validateCoordinate, dimensionsOf } from './coordinate.js';
5
+ export { load, serialize } from './load.js';
6
+ export { resolve } from './resolve.js';
7
+ export { cell, conditionHolds, effectiveSeverity, selectors, variants } from './queries.js';
8
+ export { traverse } from './traverse.js';
9
+ export { fold, tokenize, search } from './text.js';
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEhE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE5D,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEnE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAevC,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,iBAAiB,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE5F,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC"}
package/dist/load.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ import type { CompiledRecord, FrozenRegistry } from '@inventarch/language';
2
+ import type { Edge, Graph, LoadOptions } from './types.js';
3
+ export declare const edgeOrder: (a: Edge, b: Edge) => number;
4
+ export declare function load(records: readonly CompiledRecord[], registry: FrozenRegistry, options: LoadOptions): Graph;
5
+ export declare function serialize(graph: Graph): string;
6
+ //# sourceMappingURL=load.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../src/load.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAGV,cAAc,EAEd,cAAc,EAEf,MAAM,sBAAsB,CAAC;AAS9B,OAAO,KAAK,EAAW,IAAI,EAAkB,KAAK,EAAE,WAAW,EAAiC,MAAM,YAAY,CAAC;AAEnH,eAAO,MAAM,SAAS,GAAI,GAAG,IAAI,EAAE,GAAG,IAAI,KAAG,MASd,CAAC;AAChC,wBAAgB,IAAI,CAAC,OAAO,EAAE,SAAS,cAAc,EAAE,EAAE,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,WAAW,GAAG,KAAK,CAgS9G;AAkFD,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAE9C"}