@beehexa/hexasync-template-index 2608.20.18 → 2608.20.32

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 (57) hide show
  1. package/dist/checkpoints.d.ts +47 -0
  2. package/dist/checkpoints.d.ts.map +1 -0
  3. package/dist/checkpoints.js +59 -0
  4. package/dist/checkpoints.js.map +1 -0
  5. package/dist/cursorContext.d.ts +204 -0
  6. package/dist/cursorContext.d.ts.map +1 -0
  7. package/dist/cursorContext.js +479 -0
  8. package/dist/cursorContext.js.map +1 -0
  9. package/dist/detectors.d.ts +103 -0
  10. package/dist/detectors.d.ts.map +1 -0
  11. package/dist/detectors.js +104 -0
  12. package/dist/detectors.js.map +1 -0
  13. package/dist/discovery.d.ts +249 -0
  14. package/dist/discovery.d.ts.map +1 -0
  15. package/dist/discovery.js +455 -0
  16. package/dist/discovery.js.map +1 -0
  17. package/dist/effectiveGraph.d.ts +251 -0
  18. package/dist/effectiveGraph.d.ts.map +1 -0
  19. package/dist/effectiveGraph.js +559 -0
  20. package/dist/effectiveGraph.js.map +1 -0
  21. package/dist/failures.d.ts +50 -0
  22. package/dist/failures.d.ts.map +1 -0
  23. package/dist/failures.js +125 -0
  24. package/dist/failures.js.map +1 -0
  25. package/dist/graph.d.ts +47 -0
  26. package/dist/graph.d.ts.map +1 -0
  27. package/dist/graph.js +230 -0
  28. package/dist/graph.js.map +1 -0
  29. package/dist/index.d.ts +21 -0
  30. package/dist/index.d.ts.map +1 -0
  31. package/dist/index.js +38 -0
  32. package/dist/index.js.map +1 -0
  33. package/dist/queries.d.ts +102 -0
  34. package/dist/queries.d.ts.map +1 -0
  35. package/dist/queries.js +469 -0
  36. package/dist/queries.js.map +1 -0
  37. package/dist/ranges.d.ts +104 -0
  38. package/dist/ranges.d.ts.map +1 -0
  39. package/dist/ranges.js +411 -0
  40. package/dist/ranges.js.map +1 -0
  41. package/dist/resolveField.d.ts +125 -0
  42. package/dist/resolveField.d.ts.map +1 -0
  43. package/dist/resolveField.js +234 -0
  44. package/dist/resolveField.js.map +1 -0
  45. package/dist/tier1Service.d.ts +96 -0
  46. package/dist/tier1Service.d.ts.map +1 -0
  47. package/dist/tier1Service.js +194 -0
  48. package/dist/tier1Service.js.map +1 -0
  49. package/dist/tier2Service.d.ts +195 -0
  50. package/dist/tier2Service.d.ts.map +1 -0
  51. package/dist/tier2Service.js +642 -0
  52. package/dist/tier2Service.js.map +1 -0
  53. package/dist/yamlScalar.d.ts +17 -0
  54. package/dist/yamlScalar.d.ts.map +1 -0
  55. package/dist/yamlScalar.js +101 -0
  56. package/dist/yamlScalar.js.map +1 -0
  57. package/package.json +4 -4
package/dist/ranges.js ADDED
@@ -0,0 +1,411 @@
1
+ /**
2
+ * Where a component physically sits in its file (Story 3.4 AC 2).
3
+ *
4
+ * Computed ON DEMAND rather than carried on every component. A range is only ever wanted for the
5
+ * handful of components a developer looks at — a hover, a go-to-definition, a rename preview —
6
+ * while building one for all 273 would mean a second full parse of every worklist file at build
7
+ * time, which is the exact cost Story 3.1 spent the epic removing.
8
+ *
9
+ * The text comes from the graph's own prefetched `sources`, so this reads nothing.
10
+ *
11
+ * Looks the collection up DIRECTLY rather than walking every node and inspecting its ancestors.
12
+ * The first version did the latter and silently returned nothing for every map-keyed collection,
13
+ * because it reached for `.range` on a `Pair` — which is not a Node and has none. That is the
14
+ * whole of `objectAssociations`, so go-to-definition had nowhere to go for precisely the
15
+ * components this epic had just taught the graph to see.
16
+ */
17
+ import { parseDocument, isScalar, isSeq, isMap, } from 'yaml';
18
+ import { normalizeComponentKey } from '@beehexa/hexasync-template-compose';
19
+ /**
20
+ * Where each line begins, so a position is a BINARY SEARCH and not a scan from the top of the file.
21
+ *
22
+ * ⛔ Measured, after causing it. `positionAt` walked from offset 0 on every call, which is invisible for the handful of
23
+ * positions a hover asks for and quadratic the moment a caller asks for many: adding `StepRange.paths` took one real
24
+ * 32KB pusher from **7.8 ms to 54 ms** — 226 paths × two positions × a 32KB scan each — and blew two corpus wall-clock
25
+ * budgets that had nothing to do with the feature.
26
+ *
27
+ * Built once per call and threaded through the loops rather than memoised: the text is a string, so a WeakMap cannot
28
+ * key it, and a strong cache in a module bundled into the extension host would retain every file ever ranged.
29
+ */
30
+ function lineStarts(text) {
31
+ const starts = [0];
32
+ for (let at = text.indexOf('\n'); at !== -1; at = text.indexOf('\n', at + 1)) {
33
+ starts.push(at + 1);
34
+ }
35
+ return starts;
36
+ }
37
+ const positionIn = (starts, offset) => {
38
+ // The last line whose start is at or before `offset`. `lo` lands on it, which is why the loop needs no equality case.
39
+ let lo = 0;
40
+ let hi = starts.length - 1;
41
+ while (lo < hi) {
42
+ const mid = (lo + hi + 1) >> 1;
43
+ if (starts[mid] <= offset)
44
+ lo = mid;
45
+ else
46
+ hi = mid - 1;
47
+ }
48
+ return { line: lo, column: offset - starts[lo] };
49
+ };
50
+ const rangeOf = (node) => {
51
+ const range = node?.range;
52
+ return range ? [range[0], range[1]] : undefined;
53
+ };
54
+ /**
55
+ * The range of one component within a file's text.
56
+ *
57
+ * Matched on the component's own identity — its `id`/`key` inside the named collection — rather
58
+ * than on a positional index. A file's components are not necessarily in the same order as the
59
+ * project's merged view of them, and an index taken from one and applied to the other is the
60
+ * defect this epic already had to fix once in the cursor path.
61
+ *
62
+ * When a file declares the same identity twice, the LAST one wins, because that is what the
63
+ * merge does — navigating to the entry that was overridden would point at text with no effect.
64
+ */
65
+ export function findComponentRange(text, collection, id) {
66
+ let doc;
67
+ try {
68
+ doc = parseDocument(text, { keepSourceTokens: true });
69
+ }
70
+ catch {
71
+ return undefined;
72
+ }
73
+ // `parseDocument` COLLECTS errors rather than throwing, so the catch above is not the guard it
74
+ // looks like. A file mid-keystroke parses into something partial, and a range read off it can
75
+ // point anywhere; saying "no range" beats pointing a hover at the wrong line.
76
+ if (!doc || doc.errors.length > 0 || !isMap(doc.contents))
77
+ return undefined;
78
+ const node = doc.contents.get(collection, true);
79
+ if (!node)
80
+ return undefined;
81
+ let found;
82
+ // Array form: `collection: [ {id: X}, … ]`.
83
+ if (isSeq(node)) {
84
+ for (const item of node.items) {
85
+ if (!isMap(item))
86
+ continue;
87
+ const identity = normalizeComponentKey(item.get('id') ?? item.get('key'));
88
+ // Normalised the same way the graph keys components, so a quoted id is findable by its bare
89
+ // spelling and a `!`-removal directive is not mistaken for a declaration.
90
+ if (!identity || identity.removes || identity.id !== id)
91
+ continue;
92
+ const itemRange = rangeOf(item);
93
+ // Widened LEFT to include the `- ` list marker, which the item's own range starts after. A
94
+ // "select this component" action built on the unwidened range dropped the marker and produced
95
+ // a fragment that is not a list item.
96
+ found = itemRange
97
+ ? [markerStart(text, itemRange[0]), itemRange[1]]
98
+ : found; // keep scanning: last wins
99
+ }
100
+ return found ? toRange(text, found) : undefined;
101
+ }
102
+ // Map form: `collection: { X: … }` — the component IS the pair's value, keyed by its id.
103
+ if (isMap(node)) {
104
+ for (const pair of node.items) {
105
+ if (!isScalar(pair.key) || String(pair.key.value) !== id)
106
+ continue;
107
+ // A `Pair` is not a Node and has no range of its own. The component spans from where its
108
+ // KEY starts to where its VALUE ends, which is what a reader would select.
109
+ const keyRange = rangeOf(pair.key);
110
+ const valueRange = rangeOf(pair.value);
111
+ if (!keyRange)
112
+ continue;
113
+ found = [keyRange[0], valueRange ? valueRange[1] : keyRange[1]];
114
+ }
115
+ return found ? toRange(text, found) : undefined;
116
+ }
117
+ return undefined;
118
+ }
119
+ /** The key `findComponentRanges` maps by — the same identity pair `getComponent` is asked for. */
120
+ export const componentRangeKey = (collection, id) => `${collection}\u0000${id}`;
121
+ /**
122
+ * EVERY component's range in a file, from ONE parse (Phase 3 Story 3.2 AC 3).
123
+ *
124
+ * `findComponentRange` above parses the whole document to answer for one component, which is right for
125
+ * the one-off lookups it was written for — a hover, a go-to-definition. It is quadratic for a caller
126
+ * that wants them all: `getComponent` cached per component, so an outline of a 40-component file paid
127
+ * 40 full parses of that file.
128
+ *
129
+ * Measured, which is why this exists. Story 3.2's outline came in at **p95 313 ms, worst project
130
+ * 1,161 ms** against a 200 ms budget, and the workspace query at 561 ms. The epic's own contingency note
131
+ * says a missed budget is answered with a different strategy and never a relaxed number, because
132
+ * counter-metric C1 makes responsiveness non-negotiable. This is that strategy: parse once, look up N
133
+ * times.
134
+ *
135
+ * Deliberately shares `collectRanges` with the single-component function rather than reimplementing the
136
+ * item walk. The list-marker widening and the `trimEnd` correction below were each found by a failing
137
+ * test, and a second copy of that logic would not have inherited either.
138
+ */
139
+ export function findComponentRanges(text) {
140
+ const found = new Map();
141
+ let doc;
142
+ try {
143
+ doc = parseDocument(text, { keepSourceTokens: true });
144
+ }
145
+ catch {
146
+ return found;
147
+ }
148
+ // Same guard as the single lookup, and for the same reason: a partial parse yields ranges that can
149
+ // point anywhere, and an outline of confidently wrong ranges is worse than no outline.
150
+ if (!doc || doc.errors.length > 0 || !isMap(doc.contents))
151
+ return found;
152
+ // Hoisted for the same reason the step walk hoists it: this loop produces one range per component — 273 of them in
153
+ // the measurement above — and a per-range scan from the top of the file is quadratic in exactly the case this
154
+ // function was written to make fast.
155
+ const starts = lineStarts(text);
156
+ for (const pair of doc.contents.items) {
157
+ if (!isScalar(pair.key))
158
+ continue;
159
+ const collection = String(pair.key.value);
160
+ const node = pair.value;
161
+ if (!node)
162
+ continue;
163
+ for (const [id, offsets] of collectRanges(text, node)) {
164
+ found.set(componentRangeKey(collection, id), toRange(text, offsets, starts));
165
+ }
166
+ }
167
+ return found;
168
+ }
169
+ /**
170
+ * Each component of one collection node, by id, as raw offsets.
171
+ *
172
+ * The shared half of both range functions. Two shapes occur — a sequence of `{id}` maps, and a map
173
+ * keyed by id — and the LAST declaration of an identity wins, because that is what the merge does:
174
+ * navigating to an entry that was overridden would point at text with no effect.
175
+ */
176
+ function collectRanges(text, node) {
177
+ const found = new Map();
178
+ if (isSeq(node)) {
179
+ for (const item of node.items) {
180
+ if (!isMap(item))
181
+ continue;
182
+ const identity = normalizeComponentKey(item.get('id') ?? item.get('key'));
183
+ if (!identity || identity.removes)
184
+ continue;
185
+ const itemRange = rangeOf(item);
186
+ // Widened LEFT to include the `- ` list marker, which the item's own range starts after.
187
+ if (itemRange)
188
+ found.set(identity.id, [markerStart(text, itemRange[0]), itemRange[1]]);
189
+ }
190
+ return found;
191
+ }
192
+ if (isMap(node)) {
193
+ for (const pair of node.items) {
194
+ if (!isScalar(pair.key))
195
+ continue;
196
+ // A `Pair` is not a Node and has no range of its own. The component spans from where its KEY
197
+ // starts to where its VALUE ends, which is what a reader would select.
198
+ const keyRange = rangeOf(pair.key);
199
+ if (!keyRange)
200
+ continue;
201
+ const valueRange = rangeOf(pair.value);
202
+ found.set(String(pair.key.value), [
203
+ keyRange[0],
204
+ valueRange ? valueRange[1] : keyRange[1],
205
+ ]);
206
+ }
207
+ }
208
+ return found;
209
+ }
210
+ /**
211
+ * Offsets → a range. `starts` is optional so a one-off caller stays a one-liner and a LOOP can hoist it.
212
+ *
213
+ * Every caller that produces more than one range passes it, which is the difference between linear and quadratic —
214
+ * see `lineStarts`.
215
+ */
216
+ const toRange = (text, [start, end], starts = lineStarts(text)) => ({
217
+ start: positionIn(starts, start),
218
+ end: positionIn(starts, trimEnd(text, start, end)),
219
+ });
220
+ /**
221
+ * Pull an end offset back off trailing whitespace.
222
+ *
223
+ * `node.range[1]` for a block-collection member sits AFTER the newline that ends it, so on
224
+ * `objects:\n - id: ONE\n name: one\n - id: TWO\n` the range for ONE ended at line 3 column 0
225
+ * — which is TWO's own line. Any consumer asking "which component contains this position" got the
226
+ * wrong answer at every boundary, and two adjacent components' ranges touched.
227
+ */
228
+ function trimEnd(text, start, end) {
229
+ let at = Math.min(end, text.length);
230
+ while (at > start && /\s/.test(text[at - 1]))
231
+ at--;
232
+ return at;
233
+ }
234
+ /**
235
+ * The offset of the `-` that opens this list item, or the item's own start.
236
+ *
237
+ * A sequence item's range begins at its first key, so the `- ` marker sits outside it. Walks back
238
+ * over spaces only — if anything else is there, this is not a block sequence item and the original
239
+ * offset is right.
240
+ */
241
+ function markerStart(text, itemStart) {
242
+ let at = itemStart - 1;
243
+ while (at >= 0 && (text[at] === ' ' || text[at] === '\t'))
244
+ at--;
245
+ return at >= 0 && text[at] === '-' ? at : itemStart;
246
+ }
247
+ /** The key `findStepRanges` maps by — a stage and a step key, which is how a flow node identifies itself. */
248
+ export const stepRangeKey = (stage, stepKey) => `${stage}\u0000${stepKey}`;
249
+ /** The key `stepPathKey` builds and `StepRange.paths` maps by — a dot-joined path of authored keys. */
250
+ export const stepPathKey = (path) => path.join('.');
251
+ /**
252
+ * Every authored key path inside one step, dot-joined.
253
+ *
254
+ * Iterative over an explicit work list, and guarded by node IDENTITY rather than by depth. A YAML alias makes a
255
+ * document cyclic with the parser this package already uses —
256
+ *
257
+ * ```yaml
258
+ * next: &loop
259
+ * if: "x"
260
+ * then: *loop
261
+ * ```
262
+ *
263
+ * — and `yaml` resolves an alias to the SAME node object, so a walk that trusted the shape to be a tree would not
264
+ * terminate. Both route resolvers in `hexasync-template-worker-flow` learned this the hard way (an uncatchable V8
265
+ * fatal, exit 134, in a package bundled into the extension host), and they guard it exactly this way.
266
+ */
267
+ function pathRangesIn(text, step, starts) {
268
+ const found = new Map();
269
+ const seen = new WeakSet();
270
+ const pending = [
271
+ { map: step, path: [] },
272
+ ];
273
+ while (pending.length > 0) {
274
+ const { map, path } = pending.pop();
275
+ if (seen.has(map))
276
+ continue;
277
+ seen.add(map);
278
+ for (const pair of map.items) {
279
+ if (!isScalar(pair.key))
280
+ continue;
281
+ const here = [...path, String(pair.key.value)];
282
+ const keyOffsets = rangeOf(pair.key);
283
+ if (keyOffsets) {
284
+ // Start at the key, end at the value where there is one — so `sourceText` is the whole `if: "…"` rather than
285
+ // the key alone, while the caret still lands on the key.
286
+ const end = rangeOf(pair.value)?.[1] ?? keyOffsets[1];
287
+ const start = keyOffsets[0];
288
+ // LAST wins, as everywhere else in this file: an earlier declaration of the same key was overridden, so
289
+ // pointing at it would point at text with no effect.
290
+ found.set(stepPathKey(here), {
291
+ path: here,
292
+ range: toRange(text, [start, Math.max(start, end)], starts),
293
+ sourceText: text.slice(start, trimEnd(text, start, Math.max(start, end))),
294
+ });
295
+ }
296
+ if (isMap(pair.value))
297
+ pending.push({ map: pair.value, path: here });
298
+ }
299
+ }
300
+ return found;
301
+ }
302
+ /**
303
+ * EVERY step's range inside ONE component, from ONE parse (Story 4.5, AC-4b).
304
+ *
305
+ * The producer AC-4b was waiting for. `workerFlow` takes a `locate` callback and carries whatever it returns; until now
306
+ * nothing could answer it, because the machinery above stops at the component and a flow node is a step *inside* one.
307
+ * Story 4.1 predicted this as "new plumbing, not a port", and it is.
308
+ *
309
+ * ### Why it lives here rather than in the extension
310
+ *
311
+ * AD-3 and NFR-4 forbid a CORE package from opening a file, and this opens none: like `findComponentRange` above, it is
312
+ * given the text — the extension reads it from the graph's own prefetched `sources`. What the rule forbids is the
313
+ * READING, which stays in the adapter. Parsing here reuses the `markerStart` widening and the `trimEnd` correction,
314
+ * each of which was found by a failing test, and spares the extension a `yaml` dependency it does not have today — one
315
+ * that would land in the web bundle the AD-3 gate exists to keep small.
316
+ *
317
+ * ### Stage-agnostic, deliberately
318
+ *
319
+ * It does not know what a stage is called. Every sequence-valued property of the component is walked and every item
320
+ * carrying a `key` scalar recorded under it. `WORKER_STAGES` lives in the flow package, one layer UP, so importing the
321
+ * list would invert the dependency — and a hardcoded copy would go stale the next time a stage is added, a drift this
322
+ * feature has already had to fix once. Properties that merely happen to hold keyed items cost nothing: the map is
323
+ * queried by a stage name the flow model already believes in, so an entry nobody asks for is never read.
324
+ *
325
+ * ONE level deep, which is what keeps that generality safe — a step's own nested arrays (`responseFilters`,
326
+ * `transformations`) sit INSIDE the step item, not beside it, so their keys can never be mistaken for a step's.
327
+ */
328
+ export function findStepRanges(text, collection, id) {
329
+ const found = new Map();
330
+ let doc;
331
+ try {
332
+ doc = parseDocument(text, { keepSourceTokens: true });
333
+ }
334
+ catch {
335
+ return found;
336
+ }
337
+ // The same guard as both functions above, for the same reason: a file mid-keystroke yields ranges that can point
338
+ // anywhere, and a node claiming a confidently wrong location is worse than one honestly claiming none.
339
+ if (!doc || doc.errors.length > 0 || !isMap(doc.contents))
340
+ return found;
341
+ const collectionNode = doc.contents.get(collection, true);
342
+ if (!collectionNode)
343
+ return found;
344
+ const component = componentNode(collectionNode, id);
345
+ if (!component)
346
+ return found;
347
+ // Hoisted: one index for every range this call produces — a step's own, and every path inside it.
348
+ const starts = lineStarts(text);
349
+ for (const property of component.items) {
350
+ if (!isScalar(property.key))
351
+ continue;
352
+ const stage = String(property.key.value);
353
+ const steps = property.value;
354
+ if (!steps || !isSeq(steps))
355
+ continue;
356
+ for (const item of steps.items) {
357
+ if (!isMap(item))
358
+ continue;
359
+ const key = item.get('key');
360
+ // A step without a scalar key is not addressable, and `workerFlow` drops it too — so a range for it could never
361
+ // be asked for. Coerced through `String` because YAML reads a bare `2` as a number, as the flow model also does.
362
+ if (key === undefined || key === null || typeof key === 'object')
363
+ continue;
364
+ const offsets = rangeOf(item);
365
+ if (!offsets)
366
+ continue;
367
+ const start = markerStart(text, offsets[0]);
368
+ // LAST wins, matching every other function in this file and for the same reason: an earlier declaration of the
369
+ // same key was overridden, so pointing at it would point at text with no effect.
370
+ found.set(stepRangeKey(stage, String(key)), {
371
+ range: toRange(text, [start, offsets[1]], starts),
372
+ // `trimEnd` for the TEXT as well as the range, or a block step's slice carries the blank line that follows it.
373
+ sourceText: text.slice(start, trimEnd(text, start, offsets[1])),
374
+ // Built in the SAME pass, for the reason the flow model gives for producing its nodes and edges together: two
375
+ // passes are how a path ends up locatable in one and not the other, and the failure is invisible until someone
376
+ // clicks. A step's own shape is small, so this costs a walk over the pairs already parsed.
377
+ paths: pathRangesIn(text, item, starts),
378
+ });
379
+ }
380
+ }
381
+ return found;
382
+ }
383
+ /**
384
+ * The map node for one component of a collection, in either of the two shapes.
385
+ *
386
+ * Split out rather than folded into the loop above: `collectRanges` answers "where is each component", this answers
387
+ * "which node IS this component" — the same two shapes, a different question. LAST declaration wins here as well.
388
+ */
389
+ function componentNode(collectionNode, id) {
390
+ let found;
391
+ if (isSeq(collectionNode)) {
392
+ for (const item of collectionNode.items) {
393
+ if (!isMap(item))
394
+ continue;
395
+ const identity = normalizeComponentKey(item.get('id') ?? item.get('key'));
396
+ if (!identity || identity.removes || identity.id !== id)
397
+ continue;
398
+ found = item;
399
+ }
400
+ return found;
401
+ }
402
+ if (isMap(collectionNode)) {
403
+ for (const pair of collectionNode.items) {
404
+ if (!isScalar(pair.key) || String(pair.key.value) !== id)
405
+ continue;
406
+ found = isMap(pair.value) ? pair.value : undefined;
407
+ }
408
+ }
409
+ return found;
410
+ }
411
+ //# sourceMappingURL=ranges.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ranges.js","sourceRoot":"","sources":["../src/ranges.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,aAAa,EACb,QAAQ,EACR,KAAK,EACL,KAAK,GAGN,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAM3E;;;;;;;;;;GAUG;AACH,SAAS,UAAU,CAAC,IAAY;IAC9B,MAAM,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;IACnB,KACE,IAAI,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAC3B,EAAE,KAAK,CAAC,CAAC,EACT,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,GAAG,CAAC,CAAC,EAC/B,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;IACtB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,GAAG,CAAC,MAAyB,EAAE,MAAc,EAAE,EAAE;IAC/D,sHAAsH;IACtH,IAAI,EAAE,GAAG,CAAC,CAAC;IACX,IAAI,EAAE,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,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AE,CAAC;YACxC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;gBAAE,SAAS;YAC3B,MAAM,QAAQ,GAAG,qBAAqB,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;YAC1E,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,OAAO,IAAI,QAAQ,CAAC,EAAE,KAAK,EAAE;gBAAE,SAAS;YAClE,KAAK,GAAG,IAAI,CAAC;QACf,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,KAAK,CAAC,cAAc,CAAC,EAAE,CAAC;QAC1B,KAAK,MAAM,IAAI,IAAI,cAAc,CAAC,KAAK,EAAE,CAAC;YACxC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE;gBAAE,SAAS;YACnE,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;QACrD,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,125 @@
1
+ /**
2
+ * Point-wise value resolution — one field, on demand (FR-45, Story 3.3).
3
+ *
4
+ * Explaining a single field must not cost a whole-project substitution pass. A hover over one
5
+ * `url:` should not resolve 273 components, and a project that takes 650 ms to compose cannot
6
+ * afford to do it per cursor movement.
7
+ *
8
+ * It REUSES the composer's `resolveVariablePool` / `substituteVariables` rather than
9
+ * reimplementing them. Two answers to "what does this variable resolve to" is one answer too
10
+ * many: the editor explaining a field and the composer producing output have to agree, and the
11
+ * only way to guarantee that is one implementation. In particular the longest-key-first rule —
12
+ * without which `**Id**` corrupts `**ProductId**` — is the composer's, not a copy of it.
13
+ */
14
+ import { type TemplateOccurrence } from '@beehexa/hexasync-template-model';
15
+ import { resolveVariablePool } from '@beehexa/hexasync-template-compose';
16
+ export interface ResolvedField {
17
+ /** The value with every resolvable compose-time token substituted. */
18
+ readonly value: string;
19
+ /** True when nothing needed substituting. */
20
+ readonly literal: boolean;
21
+ /** Compose-time tokens that contributed, with what each resolved to. */
22
+ readonly contributed: readonly {
23
+ key: string;
24
+ value: string;
25
+ }[];
26
+ /**
27
+ * Compose-time tokens with no definition in the pool.
28
+ *
29
+ * Reported, never silently left in the string: returning the raw text as though it were the
30
+ * value is how a `**Missing**` reaches production looking like a deliberate literal.
31
+ */
32
+ readonly unresolved: readonly string[];
33
+ /**
34
+ * Runtime occurrences, untouched.
35
+ *
36
+ * Carried so a caller can SHOW them without ever trying to resolve them — the composer never
37
+ * owned `{{ … }}`, and reporting it as unresolved would be reporting on the wrong layer.
38
+ */
39
+ readonly runtime: readonly TemplateOccurrence[];
40
+ }
41
+ /** A pool prepared once and reused across fields. */
42
+ export type PreparedPool = ReturnType<typeof resolveVariablePool>;
43
+ export declare function preparePool(variables: Record<string, unknown>): PreparedPool;
44
+ /**
45
+ * Resolve one field's value against a project's pool.
46
+ *
47
+ * `pool` is prepared by the caller so a burst of fields shares one preparation — the transitive
48
+ * pass over the pool is O(keys²) and doing it per field would dominate everything else.
49
+ */
50
+ export declare function resolveFieldValue(raw: unknown, pool: PreparedPool, variables: Record<string, unknown>): ResolvedField;
51
+ /**
52
+ * A resolver bound to one project's pool, with a cache.
53
+ *
54
+ * Keyed by PROJECT and pool GENERATION, not by identity: the same field asked twice while
55
+ * nothing changed must not repeat the work, and the cache must vanish the moment
56
+ * `variables.yaml` moves — which is what Story 3.6's invalidation drops.
57
+ */
58
+ export declare class FieldResolver {
59
+ #private;
60
+ private readonly variables;
61
+ /** Bumped by the owner whenever the pool changes; part of every cache key. */
62
+ readonly generation: number;
63
+ /**
64
+ * The project this resolver belongs to, also part of the key (Story 3.3 AC 3).
65
+ *
66
+ * Two projects genuinely can share a generation number — nothing in the type system stops a
67
+ * caller numbering its own — and `**BaseUrl**` resolves to a different host in each. That the
68
+ * current owner happens to hand out a service-global counter makes the collision unreachable
69
+ * today by accident, not by design, and an accident is not a cache key.
70
+ */
71
+ readonly projectId: string;
72
+ /**
73
+ * Upper bound on the SHARED store, as a backstop against unbounded growth.
74
+ *
75
+ * Generous, because evicting a live project's entries costs a recompute rather than
76
+ * correctness, and the entries are small. The precise rule is `#evictSuperseded`'s
77
+ * generation check; this only catches what that cannot see.
78
+ */
79
+ readonly maxEntries: number;
80
+ constructor(variables: Record<string, unknown>,
81
+ /** Bumped by the owner whenever the pool changes; part of every cache key. */
82
+ generation: number,
83
+ /**
84
+ * The project this resolver belongs to, also part of the key (Story 3.3 AC 3).
85
+ *
86
+ * Two projects genuinely can share a generation number — nothing in the type system stops a
87
+ * caller numbering its own — and `**BaseUrl**` resolves to a different host in each. That the
88
+ * current owner happens to hand out a service-global counter makes the collision unreachable
89
+ * today by accident, not by design, and an accident is not a cache key.
90
+ */
91
+ projectId?: string,
92
+ /**
93
+ * A cache store, optionally SHARED with other resolvers.
94
+ *
95
+ * The default is private to this resolver, and with a private store the composite key below
96
+ * is decorative — the instance already implies its project and generation. That was the state
97
+ * this class shipped in, and a test asserting the key "worked" passed with the key reduced to
98
+ * the raw value, which is no assertion at all.
99
+ *
100
+ * A shared store is what makes the key load-bearing, and is what Story 3.3 AC 3 describes
101
+ * when it asks for a cache "keyed by project and pool generation": one store, many projects,
102
+ * entries that must not be served across them.
103
+ */
104
+ store?: Map<string, ResolvedField>,
105
+ /**
106
+ * Upper bound on the SHARED store, as a backstop against unbounded growth.
107
+ *
108
+ * Generous, because evicting a live project's entries costs a recompute rather than
109
+ * correctness, and the entries are small. The precise rule is `#evictSuperseded`'s
110
+ * generation check; this only catches what that cannot see.
111
+ */
112
+ maxEntries?: number);
113
+ resolve(raw: unknown): ResolvedField;
114
+ /**
115
+ * Forget everything this resolver cached.
116
+ *
117
+ * The invalidation hook Story 3.6 AC 2's second clause describes and nothing provided. Scoped to
118
+ * this project, so a shared store goes on serving the others.
119
+ */
120
+ invalidate(): void;
121
+ /** How many distinct values are cached — exposed so caching is testable. Counts the whole
122
+ * store, which may be shared with other projects' resolvers. */
123
+ get cacheSize(): number;
124
+ }
125
+ //# sourceMappingURL=resolveField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveField.d.ts","sourceRoot":"","sources":["../src/resolveField.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,mBAAmB,EAEpB,MAAM,oCAAoC,CAAC;AAE5C,MAAM,WAAW,aAAa;IAC5B,sEAAsE;IACtE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,6CAA6C;IAC7C,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,wEAAwE;IACxE,QAAQ,CAAC,WAAW,EAAE,SAAS;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAChE;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,EAAE,SAAS,kBAAkB,EAAE,CAAC;CACjD;AAED,qDAAqD;AACrD,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAElE,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY,CAE5E;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,YAAY,EAClB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACjC,aAAa,CA+Ff;AAED;;;;;;GAMG;AACH,qBAAa,aAAa;;IAKtB,OAAO,CAAC,QAA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