@davidorex/pi-context 0.26.0 → 0.28.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 (123) hide show
  1. package/CHANGELOG.md +69 -15
  2. package/README.md +71 -18
  3. package/dist/block-api.d.ts +165 -18
  4. package/dist/block-api.d.ts.map +1 -1
  5. package/dist/block-api.js +800 -57
  6. package/dist/block-api.js.map +1 -1
  7. package/dist/citation-rot-scanner.d.ts +80 -0
  8. package/dist/citation-rot-scanner.d.ts.map +1 -0
  9. package/dist/citation-rot-scanner.js +421 -0
  10. package/dist/citation-rot-scanner.js.map +1 -0
  11. package/dist/content-hash.d.ts +25 -0
  12. package/dist/content-hash.d.ts.map +1 -0
  13. package/dist/content-hash.js +62 -0
  14. package/dist/content-hash.js.map +1 -0
  15. package/dist/context-dir.d.ts +126 -1
  16. package/dist/context-dir.d.ts.map +1 -1
  17. package/dist/context-dir.js +208 -4
  18. package/dist/context-dir.js.map +1 -1
  19. package/dist/context-registry.d.ts +122 -0
  20. package/dist/context-registry.d.ts.map +1 -0
  21. package/dist/context-registry.js +189 -0
  22. package/dist/context-registry.js.map +1 -0
  23. package/dist/context-sdk.d.ts +179 -12
  24. package/dist/context-sdk.d.ts.map +1 -1
  25. package/dist/context-sdk.js +536 -101
  26. package/dist/context-sdk.js.map +1 -1
  27. package/dist/context.d.ts +222 -4
  28. package/dist/context.d.ts.map +1 -1
  29. package/dist/context.js +244 -56
  30. package/dist/context.js.map +1 -1
  31. package/dist/git-env.d.ts +2 -0
  32. package/dist/git-env.d.ts.map +1 -0
  33. package/dist/git-env.js +29 -0
  34. package/dist/git-env.js.map +1 -0
  35. package/dist/index.d.ts +124 -2
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +440 -1125
  38. package/dist/index.js.map +1 -1
  39. package/dist/lens-view.d.ts.map +1 -1
  40. package/dist/lens-view.js +5 -3
  41. package/dist/lens-view.js.map +1 -1
  42. package/dist/migration-registry-loader.d.ts +121 -0
  43. package/dist/migration-registry-loader.d.ts.map +1 -0
  44. package/dist/migration-registry-loader.js +309 -0
  45. package/dist/migration-registry-loader.js.map +1 -0
  46. package/dist/migrations-store.d.ts +141 -0
  47. package/dist/migrations-store.d.ts.map +1 -0
  48. package/dist/migrations-store.js +206 -0
  49. package/dist/migrations-store.js.map +1 -0
  50. package/dist/object-store.d.ts +26 -0
  51. package/dist/object-store.d.ts.map +1 -0
  52. package/dist/object-store.js +104 -0
  53. package/dist/object-store.js.map +1 -0
  54. package/dist/ops-registry.d.ts +44 -0
  55. package/dist/ops-registry.d.ts.map +1 -0
  56. package/dist/ops-registry.js +1223 -0
  57. package/dist/ops-registry.js.map +1 -0
  58. package/dist/orientation.d.ts +16 -0
  59. package/dist/orientation.d.ts.map +1 -0
  60. package/dist/orientation.js +49 -0
  61. package/dist/orientation.js.map +1 -0
  62. package/dist/promote-item.d.ts +28 -0
  63. package/dist/promote-item.d.ts.map +1 -0
  64. package/dist/promote-item.js +257 -0
  65. package/dist/promote-item.js.map +1 -0
  66. package/dist/read-element.d.ts +129 -0
  67. package/dist/read-element.d.ts.map +1 -0
  68. package/dist/read-element.js +296 -0
  69. package/dist/read-element.js.map +1 -0
  70. package/dist/rename-canonical-id.d.ts.map +1 -1
  71. package/dist/rename-canonical-id.js +22 -13
  72. package/dist/rename-canonical-id.js.map +1 -1
  73. package/dist/roadmap-plan.d.ts.map +1 -1
  74. package/dist/roadmap-plan.js +23 -13
  75. package/dist/roadmap-plan.js.map +1 -1
  76. package/dist/schema-validator.d.ts +1 -0
  77. package/dist/schema-validator.d.ts.map +1 -1
  78. package/dist/schema-validator.js +7 -3
  79. package/dist/schema-validator.js.map +1 -1
  80. package/dist/schema-write.d.ts +78 -4
  81. package/dist/schema-write.d.ts.map +1 -1
  82. package/dist/schema-write.js +297 -34
  83. package/dist/schema-write.js.map +1 -1
  84. package/dist/status-vocab.d.ts +1 -0
  85. package/dist/status-vocab.d.ts.map +1 -1
  86. package/dist/status-vocab.js +4 -0
  87. package/dist/status-vocab.js.map +1 -1
  88. package/dist/truncate.d.ts +34 -0
  89. package/dist/truncate.d.ts.map +1 -0
  90. package/dist/truncate.js +85 -0
  91. package/dist/truncate.js.map +1 -0
  92. package/dist/write-schema-migration-tool.d.ts +46 -0
  93. package/dist/write-schema-migration-tool.d.ts.map +1 -0
  94. package/dist/write-schema-migration-tool.js +115 -0
  95. package/dist/write-schema-migration-tool.js.map +1 -0
  96. package/package.json +35 -2
  97. package/samples/blocks/work-orders.json +3 -0
  98. package/samples/conception.json +22 -3
  99. package/samples/migrations.json +133 -0
  100. package/samples/schemas/context-contracts.schema.json +19 -4
  101. package/samples/schemas/conventions.schema.json +68 -12
  102. package/samples/schemas/decisions.schema.json +125 -28
  103. package/samples/schemas/features.schema.json +140 -26
  104. package/samples/schemas/framework-gaps.schema.json +171 -26
  105. package/samples/schemas/issues.schema.json +86 -13
  106. package/samples/schemas/layer-plans.schema.json +195 -35
  107. package/samples/schemas/phase.schema.json +18 -3
  108. package/samples/schemas/rationale.schema.json +37 -7
  109. package/samples/schemas/requirements.schema.json +77 -10
  110. package/samples/schemas/research.schema.json +169 -36
  111. package/samples/schemas/spec-reviews.schema.json +88 -18
  112. package/samples/schemas/story.schema.json +18 -3
  113. package/samples/schemas/tasks.schema.json +66 -10
  114. package/samples/schemas/verification.schema.json +70 -12
  115. package/samples/schemas/work-orders.schema.json +195 -0
  116. package/schemas/bootstrap.schema.json +18 -6
  117. package/schemas/config.schema.json +58 -26
  118. package/schemas/context-registry.schema.json +46 -0
  119. package/schemas/migrations.schema.json +123 -0
  120. package/schemas/relations.schema.json +41 -10
  121. package/skill-narrative.md +42 -21
  122. package/skills/pi-context/SKILL.md +159 -65
  123. package/skills/pi-context/references/bundled-resources.md +7 -2
@@ -0,0 +1,189 @@
1
+ /**
2
+ * context-registry — project-root substrate registry read / write surface for
3
+ * `<cwd>/.pi-context-registry.json`.
4
+ *
5
+ * The registry is a PROJECT-ROOT file (tracked in git, like `.pi-context.json`),
6
+ * NOT substrate-relative: it enumerates EVERY known substrate by its immutable
7
+ * content-addressed `substrate_id` (`^sub-[0-9a-f]{16}$`), mapping each to its
8
+ * on-disk directory + alias list. This is the substrate-locator layer the
9
+ * Cycle-8 F2 resolver consumes to resolve a foreign `<substrate_id>:<oid>` /
10
+ * `<alias>:<refname>` locator to a directory, and the surface the Phase-H
11
+ * migration registers each legacy substrate into.
12
+ *
13
+ * Distinct from the `.pi-context.json` bootstrap pointer: the pointer names the
14
+ * single ACTIVE substrate dir; this registry enumerates all of them. The
15
+ * SoT-drift invariant in `validateContext` (context-sdk.ts) requires the active
16
+ * `config.substrate_id` to have an entry here whose `dir` resolves to the active
17
+ * substrate.
18
+ *
19
+ * Mirrors `migrations-store.ts` atomic discipline one-for-one:
20
+ * - `loadRegistry` reads + JSON-parses + AJV-validates via `validateFromFile`
21
+ * against the bundled `context-registry.schema.json`; returns null when the
22
+ * file is absent (a pre-write project with no registry is a normal state,
23
+ * NOT an error).
24
+ * - `writeRegistry` delegates whole-file writes to block-api's atomic
25
+ * `writeTypedFile` (tmp + rename + schema-validate), so a failed write
26
+ * leaves the prior file byte-identical and a malformed registry never lands.
27
+ * - `registerSubstrate` wraps a load-or-empty → JSON deep-clone → upsert →
28
+ * write pattern (idempotent: re-registering the same substrate_id with the
29
+ * same dir is a no-op rewrite; a changed dir/aliases overwrites the entry).
30
+ *
31
+ * A small per-cwd cache (keyed by absolute cwd, invalidated on mtime change and
32
+ * proactively on write) mirrors the migrations-store cache so read-after-write
33
+ * within a process is consistent without restart.
34
+ */
35
+ import fs from "node:fs";
36
+ import path from "node:path";
37
+ import { fileURLToPath } from "node:url";
38
+ import { writeTypedFile } from "./block-api.js";
39
+ import { validateFromFile } from "./schema-validator.js";
40
+ /**
41
+ * Resolve the bundled context-registry schema file. Mirrors
42
+ * `bundledMigrationsSchemaPath` in migrations-store.ts — schemas live one
43
+ * directory up from both `src/` (under tsx --test) and `dist/` (after tsc).
44
+ */
45
+ function bundledRegistrySchemaPath() {
46
+ const here = path.dirname(fileURLToPath(import.meta.url));
47
+ return path.resolve(here, "..", "schemas", "context-registry.schema.json");
48
+ }
49
+ /**
50
+ * Project-root path of the substrate registry. PROJECT-ROOT, not substrate-dir-
51
+ * relative (contrast `migrationsPath`, which resolves through the active
52
+ * substrate dir). The registry enumerates substrates above any single
53
+ * substrate, so it must live at a fixed root location independent of which
54
+ * substrate the bootstrap pointer currently names.
55
+ */
56
+ export function contextRegistryPath(cwd) {
57
+ return path.join(cwd, ".pi-context-registry.json");
58
+ }
59
+ /**
60
+ * Current `version` emitted into newly-created `.pi-context-registry.json`
61
+ * files. Tracks the `version` field of context-registry.schema.json itself.
62
+ */
63
+ export const REGISTRY_FILE_VERSION = "1.0.0";
64
+ const registryCache = new Map();
65
+ /**
66
+ * Drop the cached registry for `cwd` so the next `loadRegistry(cwd)` re-reads
67
+ * from disk. Called internally by `writeRegistry`; exported for callers that
68
+ * mutate the file out-of-band (e.g. tests / the orchestrator seed).
69
+ */
70
+ export function invalidateRegistry(cwd) {
71
+ registryCache.delete(path.resolve(cwd));
72
+ }
73
+ /**
74
+ * Load + AJV-validate the project-root registry. Returns null when the file is
75
+ * absent (a project with no registry yet — a normal pre-write condition, NOT an
76
+ * error). Throws on read / parse / schema failure. Caches by absolute cwd keyed
77
+ * on file mtime.
78
+ */
79
+ export function loadRegistry(cwd) {
80
+ const p = contextRegistryPath(cwd);
81
+ if (!fs.existsSync(p))
82
+ return null;
83
+ const mtime = fs.statSync(p).mtimeMs;
84
+ const key = path.resolve(cwd);
85
+ const cached = registryCache.get(key);
86
+ if (cached && cached.mtimeMs === mtime) {
87
+ return cached.file;
88
+ }
89
+ let raw;
90
+ try {
91
+ raw = fs.readFileSync(p, "utf-8");
92
+ }
93
+ catch (err) {
94
+ throw new Error(`loadRegistry: failed to read ${p}: ${err instanceof Error ? err.message : String(err)}`);
95
+ }
96
+ let data;
97
+ try {
98
+ data = JSON.parse(raw);
99
+ }
100
+ catch (err) {
101
+ throw new Error(`loadRegistry: invalid JSON in ${p}: ${err instanceof Error ? err.message : String(err)}`);
102
+ }
103
+ validateFromFile(bundledRegistrySchemaPath(), data, `.pi-context-registry.json (${p})`);
104
+ const file = data;
105
+ registryCache.set(key, { file, mtimeMs: mtime });
106
+ return file;
107
+ }
108
+ /**
109
+ * Atomic, AJV-validated whole-file write of `.pi-context-registry.json`.
110
+ * Delegates to block-api's `writeTypedFile` against the bundled registry schema
111
+ * (tmp + rename; a failed write leaves the prior file byte-identical). `ctx` is
112
+ * accepted for call-site parity with the rest of the substrate write surface;
113
+ * the registry schema declares no envelope author fields so stamping is a
114
+ * structural no-op today. Invalidates the per-cwd cache after the write so the
115
+ * next `loadRegistry(cwd)` reads the fresh file.
116
+ */
117
+ export function writeRegistry(cwd, file, ctx) {
118
+ writeTypedFile(contextRegistryPath(cwd), bundledRegistrySchemaPath(), file, ctx, ".pi-context-registry.json");
119
+ invalidateRegistry(cwd);
120
+ }
121
+ /**
122
+ * Compose an initial empty registry shape — used by `registerSubstrate` when no
123
+ * registry exists on disk. Centralised so the `version` token is sourced from
124
+ * one place.
125
+ */
126
+ function emptyRegistry() {
127
+ return { version: REGISTRY_FILE_VERSION, substrates: {} };
128
+ }
129
+ /**
130
+ * Deep-clone via JSON round-trip. Sufficient for RegistryFile shapes (no Date /
131
+ * Map / undefined values per the schema). Matches the migrations-store
132
+ * load-clone-mutate-write precedent.
133
+ */
134
+ function clone(value) {
135
+ return JSON.parse(JSON.stringify(value));
136
+ }
137
+ /**
138
+ * Upsert a substrate's registry entry. Load-or-empty → clone → set
139
+ * `substrates[substrate_id] = { dir, aliases }` → atomic write. Idempotent:
140
+ * re-registering the same substrate_id with the same dir + aliases produces a
141
+ * byte-identical file; a changed dir (e.g. a renamed substrate directory) or a
142
+ * changed alias list overwrites the prior entry in place. `aliases` defaults to
143
+ * `[]` when omitted (Cycle 4 registers with empty aliases; the Phase-H
144
+ * migration populates the legacy `project:` alias).
145
+ *
146
+ * Does NOT validate that `substrate_id` matches `^sub-[0-9a-f]{16}$` here — the
147
+ * schema's `propertyNames` pattern enforces that at the write boundary (an
148
+ * out-of-shape key fails `writeTypedFile`'s AJV validation, leaving the prior
149
+ * file intact).
150
+ */
151
+ export function registerSubstrate(cwd, substrate_id, dir, aliases = [], ctx) {
152
+ const current = loadRegistry(cwd) ?? emptyRegistry();
153
+ const next = clone(current);
154
+ next.substrates[substrate_id] = { dir, aliases };
155
+ writeRegistry(cwd, next, ctx);
156
+ }
157
+ /**
158
+ * Resolve a substrate_id to its registered directory string (as stored — i.e.
159
+ * project-root-relative, the caller resolves against cwd when an absolute path
160
+ * is needed). Returns null on miss (substrate_id not registered, or no registry
161
+ * file at all) — never throws on a clean miss, mirroring the F2 resolver's
162
+ * expectation of a null-or-hit lookup.
163
+ */
164
+ export function resolveSubstrateDir(cwd, substrate_id) {
165
+ const reg = loadRegistry(cwd);
166
+ if (reg === null)
167
+ return null;
168
+ const entry = reg.substrates[substrate_id];
169
+ return entry ? entry.dir : null;
170
+ }
171
+ /**
172
+ * Resolve an alias to the substrate_id that declares it. Scans every entry's
173
+ * `aliases[]` for an exact string match and returns the owning substrate_id.
174
+ * Returns null on miss (alias unregistered, or no registry file) — never throws
175
+ * on a clean miss. First-match wins if (by misconfiguration) two substrates
176
+ * claim the same alias; the registry does not enforce alias uniqueness this
177
+ * cycle.
178
+ */
179
+ export function resolveAlias(cwd, alias) {
180
+ const reg = loadRegistry(cwd);
181
+ if (reg === null)
182
+ return null;
183
+ for (const [substrate_id, entry] of Object.entries(reg.substrates)) {
184
+ if (entry.aliases.includes(alias))
185
+ return substrate_id;
186
+ }
187
+ return null;
188
+ }
189
+ //# sourceMappingURL=context-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-registry.js","sourceRoot":"","sources":["../src/context-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,EAAE,MAAM,SAAS,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9B,KAAK,MAAM,CAAC,YAAY,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;QACpE,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC;YAAE,OAAO,YAAY,CAAC;IACxD,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC"}
@@ -3,8 +3,9 @@
3
3
  * and derived metrics. Computes everything dynamically from filesystem
4
4
  * and git — no cache, no stale data.
5
5
  */
6
- import { type ConfigBlock } from "./context.js";
7
- export { type BlockKindDecl, type CompositionMember, type ConfigBlock, type ContextData, type CurationSuggestion, displayName, type Edge, edgesForLens, groupByLens, type HierarchyDecl, type InvariantDecl, type ItemRecord, type LayerDecl, type LensSpec, listUncategorized, loadConfig, loadContext, loadRelations, type RelationTypeDecl, type StatusBucket, type SubstrateValidationIssue, type SubstrateValidationResult, synthesizeFromField, validateRelations, walkDescendants, } from "./context.js";
6
+ import { type ConfigBlock, type Edge, type EdgeEndpoint, type RawEndpoint } from "./context.js";
7
+ import type { DispatchContext } from "./dispatch-context.js";
8
+ export { type BlockKindDecl, type CompositionMember, type ConfigBlock, type ContextData, type CurationSuggestion, displayName, type Edge, type EdgeEndpoint, edgesForLens, endpointBin, endpointIdentity, endpointKey, groupByLens, type HierarchyDecl, type InvariantDecl, type ItemRecord, type LayerDecl, type LensSpec, listUncategorized, loadConfig, loadContext, loadRelations, type NormalizedEndpoint, normalizeEndpoint, type RawEndpoint, type RelationTypeDecl, type StatusBucket, type SubstrateValidationIssue, type SubstrateValidationResult, synthesizeFromField, validateRelations, walkDescendants, } from "./context.js";
8
9
  export interface BlockInfo {
9
10
  name: string;
10
11
  hasSchema: boolean;
@@ -246,15 +247,20 @@ export interface BlockPage {
246
247
  /**
247
248
  * Read a single item from ONE named block by its id, or null if absent.
248
249
  * Block-scoped (no cross-substrate idIndex, no prefix-vs-block invariant — that is resolveItemById).
249
- * Reuses filterBlockItems(id eq) so it inherits readBlock + discoverArrayKey + edge semantics
250
- * (missing block / multiple top-level arrays THROW; no-array block or id-not-found null). FGAP-045.
250
+ * Reads the block then routes id-resolution through the shared addressInto primitive
251
+ * (id matches `.id` or `.canonical_id`), so block-item lookup uses the same element
252
+ * addressing as every other read surface. Missing block / multiple top-level arrays
253
+ * THROW (readBlock + discoverArrayKey via addressInto); no-array block or id-not-found → null. FGAP-045.
251
254
  */
252
255
  export declare function readBlockItem(cwd: string, blockName: string, id: string): unknown | null;
253
256
  /**
254
- * Paginate a block's items. Reuses readBlock + discoverArrayKey. Returns the FULL count as `total`
255
- * (not the page length) and `hasMore = offset + limit < total`. No-array block → {items:[],total:0,
256
- * hasMore:false}; offset total empty items with correct total. Missing block / multiple top-level
257
- * arrays propagate the throw (consistent with filterBlockItems). FGAP-045.
257
+ * Paginate a block's items. Reads the block, discovers its single top-level array,
258
+ * then routes the slice/total/hasMore math through the shared `pageArray` primitive
259
+ * (ONE pagination implementation serializeForRead uses the same). Returns the FULL
260
+ * count as `total` (not the page length) and `hasMore = offset + limit < total`.
261
+ * No-array block → {items:[],total:0,hasMore:false}; offset ≥ total → empty items
262
+ * with correct total. Missing block / multiple top-level arrays propagate the throw
263
+ * (consistent with filterBlockItems). FGAP-045.
258
264
  */
259
265
  export declare function readBlockPage(cwd: string, blockName: string, opts?: {
260
266
  offset?: number;
@@ -276,9 +282,11 @@ export interface JoinResult {
276
282
  /**
277
283
  * Cross-block join (FGAP-043, HYBRID). Mode = exactly one of relationType (edge) XOR
278
284
  * leftField+rightField (field). Returns one JoinResult per left item (after leftPredicate),
279
- * right always an array. Edge mode is DEC-0013-native (relations.json); field mode joins on a
280
- * shared field value (legacy inline-FK + arbitrary shared fields). Reuses filterBlockItems /
281
- * readBlock / discoverArrayKey / loadRelations / buildIdIndex.
285
+ * right always an array. Edge mode is DEC-0013-native (relations.json); field mode is a
286
+ * DEPRECATED backward-compat path that joins on a shared field value (formerly inline-FK,
287
+ * now arbitrary shared fields). NO validation uses field mode — cross-block validation is
288
+ * edge-only since DEC-0036; field mode here is a query convenience, not a reference surface.
289
+ * Reuses filterBlockItems / readBlock / discoverArrayKey / loadRelations / buildIdIndex.
282
290
  */
283
291
  export declare function joinBlocks(cwd: string, spec: JoinSpec): JoinResult[];
284
292
  /**
@@ -288,10 +296,49 @@ export declare function joinBlocks(cwd: string, spec: JoinSpec): JoinResult[];
288
296
  * (e.g., a per-item macro inlining a related decision by ID).
289
297
  */
290
298
  export interface ItemLocation {
299
+ /**
300
+ * The item's refname — its top-level string `id`. Exposed on the locator so
301
+ * iteration over a {@link SubstrateIndex.items} list can recover the key
302
+ * without re-deriving it from `item.id` (the value is identical: `id` is set
303
+ * to `item.id` at index-build time). Lookup maps (`byRefname`) key on this
304
+ * same value.
305
+ */
306
+ id: string;
291
307
  block: string;
292
308
  arrayKey: string;
293
309
  item: Record<string, unknown>;
294
310
  }
311
+ /**
312
+ * Split-surface index over a single substrate's id-bearing items (Cycle 7 /
313
+ * Phase F1). Replaces the prior `Map<refname, ItemLocation>` return of
314
+ * {@link buildIdIndex}/{@link buildIdIndexForDir} by separating the two roles
315
+ * that the single Map previously served:
316
+ *
317
+ * - `byRefname` — point-lookup map keyed by refname (`item.id`). First-writer-
318
+ * wins on refname collision across blocks (one entry per distinct refname),
319
+ * exactly as the prior Map. This is the lookup surface every `.get`/`.has`
320
+ * consumer reads.
321
+ * - `items` — the iteration surface: ONE entry per id-bearing item, in scan
322
+ * order. Whole-index `for…of` consumers iterate this so a future dual-keyed
323
+ * lookup map (F2's oid keys) cannot inflate iteration (anti-double-count).
324
+ * - `byOid` — point-lookup map keyed by an item's string `oid`, ONE entry per
325
+ * item that HAS a string `oid`. Populated here but DORMANT this cycle —
326
+ * no F1 consumer reads it; it is the seam Cycle-8/F2 fills with cross-
327
+ * substrate (oid-keyed) resolution. Near-empty on current real data (most
328
+ * items are unstamped). First-writer-wins on oid collision, mirroring
329
+ * `byRefname`'s collision discipline.
330
+ *
331
+ * `dir` is the scanned substrate directory; `substrate_id` is `config.substrate_id`
332
+ * when the config declares one (undefined otherwise — absence does NOT throw,
333
+ * so a pre-identity substrate still indexes cleanly).
334
+ */
335
+ export interface SubstrateIndex {
336
+ substrate_id?: string;
337
+ dir: string;
338
+ byRefname: Map<string, ItemLocation>;
339
+ byOid: Map<string, ItemLocation>;
340
+ items: ItemLocation[];
341
+ }
295
342
  /**
296
343
  * Look up the block expected to host an ID based on its prefix, driven by
297
344
  * the config registry.
@@ -332,7 +379,21 @@ export declare function expectedBlockForId(id: string, cfg: ConfigBlock | null):
332
379
  * (no overwrite) — duplicate entries are intentionally ignored to keep
333
380
  * the resolver deterministic without allocating warning channels here.
334
381
  */
335
- export declare function buildIdIndex(cwd: string): Map<string, ItemLocation>;
382
+ export declare function buildIdIndex(cwd: string): SubstrateIndex;
383
+ /**
384
+ * Build the item-id → location index for an ARBITRARY substrate directory
385
+ * (the dir-targeted twin of `buildIdIndex`, which resolves the active pointer
386
+ * dir). Used by the relation porcelain to index a FOREIGN substrate (resolved
387
+ * via the registry from a `<alias>:` selector) as well as the active substrate.
388
+ *
389
+ * `substrateDir` is the absolute substrate directory to scan; `cfg` is that
390
+ * dir's config (drives the prefix-vs-block invariant via `expectedBlockForId`),
391
+ * passed by the caller so this function performs no pointer resolution. Reads
392
+ * each block file via `readBlockForDir` so the version-aware validation hook
393
+ * fires identically to the active-dir path. Same first-writer-wins collision
394
+ * semantics + prefix-invariant throw as `buildIdIndex`.
395
+ */
396
+ export declare function buildIdIndexForDir(substrateDir: string, _cwd: string, cfg: ConfigBlock | null): SubstrateIndex;
336
397
  /**
337
398
  * One-off lookup — builds the full index then performs a single get.
338
399
  * Callers performing multiple lookups in one render pass should call
@@ -371,6 +432,112 @@ export declare function resolveItemById(cwd: string, id: string): ItemLocation |
371
432
  * Closes part of the FGAP-026 phase 2 query-surface gap (TASK-035).
372
433
  */
373
434
  export declare function resolveItemsByIds(cwd: string, ids: string[]): Map<string, ItemLocation | null>;
435
+ /**
436
+ * Resolve one friendly relation selector to a structured `EdgeEndpoint`:
437
+ * - `<alias>:<refname>` (alias is a registered substrate alias) → FOREIGN item
438
+ * `{kind:"item", substrate_id, oid, refname}` (oid from the foreign index;
439
+ * when the foreign refname does not resolve, oid is left as the refname so the
440
+ * endpoint round-trips — Cycle 8 resolves foreign endpoints, this cycle only
441
+ * forms them; an unresolved foreign endpoint validates as a sentinel).
442
+ * - a selector matching a declared lens bin → `{kind:"lens_bin", bin}`.
443
+ * - a bare `refname` → SAME-substrate item `{kind:"item", oid, refname}` (oid
444
+ * from the active index; falls back to refname when unresolved so an
445
+ * edge to a not-yet-filed item is still expressible).
446
+ *
447
+ * NOTE: the `<alias>:` branch is tried first so an alias-prefixed selector is
448
+ * never misread as a bare refname containing a colon.
449
+ */
450
+ export declare function resolveRelationSelector(cwd: string, selector: string): EdgeEndpoint;
451
+ /**
452
+ * Friendly-selector relation append (Cycle 5 porcelain). Resolves `parent` /
453
+ * `child` STRING selectors to structured `EdgeEndpoint`s via
454
+ * `resolveRelationSelector`, then delegates to the raw `appendRelation` plumbing
455
+ * (atomic, AJV-validated, exact-duplicate no-op — same deferred-integrity
456
+ * semantics). Keeps the string param surface its callers (the append-relation
457
+ * Pi tool + the orchestrator CLI) already expose.
458
+ *
459
+ * Returns `{ appended, edge }` where `edge` is the RESOLVED structured edge
460
+ * actually written (so callers can report / dry-run-validate the structured
461
+ * form).
462
+ */
463
+ export declare function appendRelationByRef(cwd: string, rel: {
464
+ parent: string;
465
+ child: string;
466
+ relation_type: string;
467
+ ordinal?: number;
468
+ }, ctx?: DispatchContext): {
469
+ appended: boolean;
470
+ edge: Edge;
471
+ };
472
+ /**
473
+ * Classification of an endpoint by {@link resolveRef}:
474
+ * - `active` — an item resolved in the ACTIVE substrate index (the
475
+ * same-substrate refname/oid path, byte-identical pass to today).
476
+ * - `foreign` — an item resolved in a REGISTERED foreign substrate's index
477
+ * (via a structured `substrate_id` locator or a legacy
478
+ * `<alias>:<refname>` string whose alias is registered).
479
+ * - `dangling` — a located endpoint (active or foreign) whose key was NOT
480
+ * found in the relevant index (the "does not resolve" outcome),
481
+ * OR a foreign substrate whose index build threw (degraded to
482
+ * dangling rather than crashing validation).
483
+ * - `unregistered` — a locator naming a substrate_id / alias that the project-root
484
+ * registry does NOT carry (the foreign substrate is not yet
485
+ * registered — the pre-Phase-H state of the 30 `project:` strings).
486
+ */
487
+ export type ResolveStatus = "active" | "foreign" | "dangling" | "unregistered";
488
+ /**
489
+ * The result of {@link resolveRef}. `endpointKind` discriminates item endpoints
490
+ * (the resolution surface) from lens_bin endpoints (always `active`, never an
491
+ * item lookup). `loc` is the resolved {@link ItemLocation} for `active`/`foreign`
492
+ * item endpoints (absent for `dangling`/`unregistered`/lens_bin). `substrate_id`
493
+ * is the resolved foreign substrate_id when known (structured locator, or an
494
+ * alias that resolved); `oid`/`refname` carry the parsed/structured lookup keys.
495
+ */
496
+ export interface ResolvedRef {
497
+ status: ResolveStatus;
498
+ endpointKind: "item" | "lens_bin";
499
+ substrate_id?: string;
500
+ oid?: string;
501
+ refname?: string;
502
+ loc?: ItemLocation;
503
+ }
504
+ /**
505
+ * Classify a single edge endpoint (legacy string OR structured) into one of the
506
+ * four {@link ResolveStatus} values — the load-bearing F2 resolver wired into
507
+ * `validateContext`'s edge loop + the `validateRelations` `resolve?` hook.
508
+ *
509
+ * Algorithm (the locked Cycle-8 design):
510
+ * 1. A structured `{kind:"lens_bin"}` endpoint → `{status:"active",
511
+ * endpointKind:"lens_bin"}` with NO item lookup (a lens_bin never routes
512
+ * through item resolution — the corruption-risk surface, Constraint 4).
513
+ * 2. An item endpoint WITH A LOCATOR — a structured `substrate_id`, OR a STRING
514
+ * of the form `<alias>:<refname>` whose `<alias>` prefix is a REGISTERED
515
+ * alias — resolves against the named FOREIGN substrate: substrate_id/alias
516
+ * NOT in the registry → `unregistered`; registered → build (cached) the
517
+ * foreign index → look up by `oid` (structured locator carrying an oid) else
518
+ * by `refname` in `byOid`/`byRefname` → found `foreign` / absent `dangling`.
519
+ * A foreign-index build that throws → `dangling` (never a crash).
520
+ * 3. An item endpoint with NO locator — a bare oid or a bare refname (a string
521
+ * with no `:` alias-prefix) — resolves against the ACTIVE index ONLY → found
522
+ * `active` / absent `dangling`.
523
+ *
524
+ * The alias-string parse is ATTEMPTED FIRST on any string containing a `:`
525
+ * (mirroring `resolveRelationSelector`): the `<x>` in `<x>:<y>` is treated as an
526
+ * alias candidate, so such a string is an aliased-item locator (step 2), NOT a
527
+ * bare refname (step 3). If `<x>` is NOT a registered alias → `unregistered`. So
528
+ * today's `project:FGAP-153` (the `project` alias is not registered until Phase H)
529
+ * → `unregistered`. The real 30 are therefore `unregistered` pre-H and flip to
530
+ * `foreign` once Phase H registers the `project` alias (the count/total stay
531
+ * unchanged at reclassification — see the note in `validateContext`).
532
+ *
533
+ * `opts.activeIndex` lets the caller pass a pre-built active index (built once per
534
+ * validation pass); `opts.foreignCache` memoizes foreign indices per substrate_id
535
+ * within the pass (so N edges into one foreign substrate build its index ONCE).
536
+ */
537
+ export declare function resolveRef(cwd: string, ref: RawEndpoint, opts?: {
538
+ activeIndex?: SubstrateIndex;
539
+ foreignCache?: Map<string, SubstrateIndex>;
540
+ }): ResolvedRef;
374
541
  export interface ContextValidationIssue {
375
542
  severity: "error" | "warning";
376
543
  message: string;
@@ -1 +1 @@
1
- {"version":3,"file":"context-sdk.d.ts","sourceRoot":"","sources":["../src/context-sdk.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,EACN,KAAK,WAAW,EAOhB,MAAM,cAAc,CAAC;AAOtB,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,WAAW,EACX,KAAK,IAAI,EACT,YAAY,EACZ,WAAW,EACX,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,iBAAiB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