@quolu/lattice 0.108.0 → 0.110.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 (47) hide show
  1. package/bin/lattice.mjs +2 -2
  2. package/docs/schemas/lattice.plan_create_input.v6.schema.json +384 -0
  3. package/docs/schemas/lattice.plan_revise_input.v1.schema.json +3 -0
  4. package/docs/schemas/lattice.todo_witness_draft.v2.schema.json +14 -2
  5. package/docs/schemas/lattice.todo_witness_set.v6.schema.json +482 -0
  6. package/package.json +3 -1
  7. package/sensor/dist/bin/lattice-sensor.js +76 -0
  8. package/sensor/dist/graph/anchor-resolve.d.ts +90 -0
  9. package/sensor/dist/graph/anchor-resolve.d.ts.map +1 -0
  10. package/sensor/dist/graph/anchor-resolve.js +132 -0
  11. package/sensor/dist/graph/anchor-resolve.js.map +1 -0
  12. package/sensor/dist/graph/touched-symbols.d.ts +42 -0
  13. package/sensor/dist/graph/touched-symbols.d.ts.map +1 -0
  14. package/sensor/dist/graph/touched-symbols.js +80 -0
  15. package/sensor/dist/graph/touched-symbols.js.map +1 -0
  16. package/src/cli-help.mjs +28 -6
  17. package/src/cli-refusal-guidance.mjs +3 -0
  18. package/src/function-split-verify.mjs +396 -0
  19. package/src/plan-backchain.mjs +18 -7
  20. package/src/plan-revise.mjs +26 -12
  21. package/src/plan-scope-review.mjs +1 -1
  22. package/src/project-cli.mjs +23 -3
  23. package/src/runtime-front-end.mjs +8 -3
  24. package/src/seam-apply.mjs +2 -2
  25. package/src/sensor-cli.mjs +82 -1
  26. package/src/sensor-resolve.mjs +116 -0
  27. package/src/sensor-touched.mjs +76 -0
  28. package/src/todo-authoring-input.mjs +1 -0
  29. package/src/todo-cli.mjs +303 -27
  30. package/src/todo-contracts.mjs +118 -4
  31. package/src/todo-declaration.mjs +165 -0
  32. package/src/todo-function-split.mjs +234 -0
  33. package/src/todo-gantt-html-independence.mjs +2 -2
  34. package/src/todo-gantt-html-shared.mjs +4 -1
  35. package/src/todo-gantt-html.mjs +4 -2
  36. package/src/todo-independence-authoritative-observation.mjs +26 -23
  37. package/src/todo-independence-contracts.mjs +17 -4
  38. package/src/todo-independence.mjs +4 -1
  39. package/src/todo-judgment.mjs +141 -0
  40. package/src/todo-relation-store.mjs +294 -0
  41. package/src/todo-revision.mjs +5 -5
  42. package/src/todo-split-labels.mjs +26 -0
  43. package/src/todo-split-start.mjs +100 -0
  44. package/src/todo-split-store.mjs +100 -0
  45. package/src/todo-store-view.mjs +3 -2
  46. package/src/todo-store.mjs +31 -14
  47. package/src/witness-scaffold.mjs +23 -15
@@ -0,0 +1,482 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://github.com/kitepon/Lattice/blob/main/docs/schemas/lattice.todo_witness_set.v6.schema.json",
4
+ "title": "lattice.todo_witness_set.v6",
5
+ "description": "Per-ToDo boundary declaration compiled into a recorded independence judgement (ADR 0127). v6 is v5 plus optional read_anchors: the functions a ToDo reads inside a file it lists under reads (ADR 0204). It is written only when a ToDo declares such functions, so plans that do not use reads stay v5.",
6
+ "$comment": "Runtime validation additionally enforces canonical JSON+LF bytes, the self-digest rule, unique line_id values per ToDo, and closed line anchor shapes. concern_anchors is stripped before run-request synthesis; lines is preserved because it participates in scheduling. v1-v4 declarations remain valid input without lines, and adding lines to an old schema is rejected rather than reinterpreted. read_anchors has the shape of concern_anchors but sits inside a path of the same ToDo's reads; like concern_anchors it is stripped before run-request synthesis, and an older schema cannot carry it.",
7
+ "type": "object",
8
+ "additionalProperties": false,
9
+ "required": [
10
+ "schema",
11
+ "project_id",
12
+ "plan_key",
13
+ "capacity",
14
+ "sensor_query_set",
15
+ "manual_witness",
16
+ "witness_set_digest"
17
+ ],
18
+ "properties": {
19
+ "schema": {
20
+ "const": "lattice.todo_witness_set.v6"
21
+ },
22
+ "project_id": {
23
+ "$ref": "#/$defs/identifier"
24
+ },
25
+ "plan_key": {
26
+ "$ref": "#/$defs/identifier"
27
+ },
28
+ "capacity": {
29
+ "type": "object",
30
+ "additionalProperties": false,
31
+ "required": [
32
+ "executors"
33
+ ],
34
+ "properties": {
35
+ "executors": {
36
+ "type": "integer",
37
+ "minimum": 1
38
+ }
39
+ }
40
+ },
41
+ "sensor_query_set": {
42
+ "type": "object",
43
+ "additionalProperties": false,
44
+ "required": [
45
+ "queries"
46
+ ],
47
+ "description": "Sensor queries backing the declarations. Exactly one query must have operation 'status'.",
48
+ "properties": {
49
+ "queries": {
50
+ "type": "array",
51
+ "maxItems": 256,
52
+ "items": {
53
+ "type": "object",
54
+ "additionalProperties": false,
55
+ "required": [
56
+ "id",
57
+ "operation"
58
+ ],
59
+ "properties": {
60
+ "id": {
61
+ "$ref": "#/$defs/identifier"
62
+ },
63
+ "operation": {
64
+ "enum": [
65
+ "status",
66
+ "query",
67
+ "callers",
68
+ "callees",
69
+ "impact",
70
+ "affected"
71
+ ]
72
+ },
73
+ "target": {
74
+ "type": "string",
75
+ "minLength": 1
76
+ }
77
+ }
78
+ }
79
+ }
80
+ }
81
+ },
82
+ "manual_witness": {
83
+ "type": "object",
84
+ "minProperties": 1,
85
+ "maxProperties": 256,
86
+ "description": "Keyed by task_id of the plan. Keys must be a subset of the plan's tasks.",
87
+ "propertyNames": {
88
+ "$ref": "#/$defs/identifier"
89
+ },
90
+ "additionalProperties": {
91
+ "$ref": "#/$defs/witness"
92
+ }
93
+ },
94
+ "witness_set_digest": {
95
+ "$ref": "#/$defs/digest"
96
+ }
97
+ },
98
+ "$defs": {
99
+ "identifier": {
100
+ "type": "string",
101
+ "pattern": "^[0-9A-Za-z][0-9A-Za-z._-]{0,127}$"
102
+ },
103
+ "digest": {
104
+ "type": "string",
105
+ "pattern": "^[0-9a-f]{64}$"
106
+ },
107
+ "repoRelativePath": {
108
+ "type": "string",
109
+ "minLength": 1,
110
+ "maxLength": 1024,
111
+ "description": "Repo-relative path. Absolute paths, backslashes and '..' traversal are rejected. A trailing '/' declares a directory prefix and is accepted only under 'writes'."
112
+ },
113
+ "lineAnchor": {
114
+ "oneOf": [
115
+ {
116
+ "type": "object",
117
+ "additionalProperties": false,
118
+ "required": [
119
+ "kind",
120
+ "path"
121
+ ],
122
+ "properties": {
123
+ "kind": {
124
+ "const": "path"
125
+ },
126
+ "path": {
127
+ "$ref": "#/$defs/repoRelativePath"
128
+ }
129
+ }
130
+ },
131
+ {
132
+ "type": "object",
133
+ "additionalProperties": false,
134
+ "required": [
135
+ "kind",
136
+ "name",
137
+ "path"
138
+ ],
139
+ "properties": {
140
+ "kind": {
141
+ "const": "symbol"
142
+ },
143
+ "name": {
144
+ "type": "string",
145
+ "minLength": 1,
146
+ "maxLength": 1024
147
+ },
148
+ "path": {
149
+ "$ref": "#/$defs/repoRelativePath"
150
+ }
151
+ }
152
+ }
153
+ ]
154
+ },
155
+ "line": {
156
+ "type": "object",
157
+ "additionalProperties": false,
158
+ "required": [
159
+ "line_id",
160
+ "role",
161
+ "anchors"
162
+ ],
163
+ "properties": {
164
+ "line_id": {
165
+ "$ref": "#/$defs/identifier"
166
+ },
167
+ "role": {
168
+ "enum": [
169
+ "reads",
170
+ "writes"
171
+ ]
172
+ },
173
+ "anchors": {
174
+ "type": "array",
175
+ "minItems": 1,
176
+ "maxItems": 256,
177
+ "items": {
178
+ "$ref": "#/$defs/lineAnchor"
179
+ }
180
+ }
181
+ }
182
+ },
183
+ "witness": {
184
+ "type": "object",
185
+ "additionalProperties": false,
186
+ "required": [
187
+ "owns",
188
+ "reads",
189
+ "writes",
190
+ "resources",
191
+ "state_effects",
192
+ "sensor_provenance",
193
+ "affected_tests",
194
+ "unknowns"
195
+ ],
196
+ "properties": {
197
+ "owns": {
198
+ "type": "array",
199
+ "maxItems": 256,
200
+ "description": "Symbols and paths this ToDo claims ownership of. Every entry needs a covering sensor query or it compiles to a sensor_unbound unknown. An entry may additionally declare creates: true for a path this ToDo will bring into existence.",
201
+ "items": {
202
+ "type": "object",
203
+ "additionalProperties": false,
204
+ "required": [
205
+ "kind",
206
+ "target"
207
+ ],
208
+ "properties": {
209
+ "kind": {
210
+ "enum": [
211
+ "symbol",
212
+ "path"
213
+ ]
214
+ },
215
+ "target": {
216
+ "type": "string",
217
+ "minLength": 1,
218
+ "maxLength": 1024
219
+ },
220
+ "creates": {
221
+ "const": true,
222
+ "description": "Optional. Declares that this path does not exist yet and that this ToDo creates it. Only valid when kind is path — existence is a filesystem fact and a symbol has none of its own. Only the value true is accepted: false would be a second spelling of an existing path. Omitted is the default."
223
+ }
224
+ }
225
+ }
226
+ },
227
+ "reads": {
228
+ "type": "array",
229
+ "maxItems": 256,
230
+ "items": {
231
+ "$ref": "#/$defs/repoRelativePath"
232
+ }
233
+ },
234
+ "writes": {
235
+ "type": "array",
236
+ "maxItems": 256,
237
+ "items": {
238
+ "$ref": "#/$defs/repoRelativePath"
239
+ }
240
+ },
241
+ "resources": {
242
+ "type": "array",
243
+ "maxItems": 256,
244
+ "description": "Shared resource ids. A resource with no matching state_effect entry is treated as a shared resource of unknown direction and becomes a conflict.",
245
+ "items": {
246
+ "$ref": "#/$defs/identifier"
247
+ }
248
+ },
249
+ "state_effects": {
250
+ "type": "array",
251
+ "maxItems": 256,
252
+ "items": {
253
+ "type": "object",
254
+ "additionalProperties": false,
255
+ "required": [
256
+ "resource_id",
257
+ "kind"
258
+ ],
259
+ "properties": {
260
+ "resource_id": {
261
+ "$ref": "#/$defs/identifier"
262
+ },
263
+ "kind": {
264
+ "enum": [
265
+ "state",
266
+ "schema",
267
+ "invariant",
268
+ "effect",
269
+ "external_effect"
270
+ ]
271
+ }
272
+ }
273
+ }
274
+ },
275
+ "sensor_provenance": {
276
+ "type": "object",
277
+ "additionalProperties": false,
278
+ "required": [
279
+ "queries"
280
+ ],
281
+ "properties": {
282
+ "queries": {
283
+ "type": "array",
284
+ "maxItems": 256,
285
+ "items": {
286
+ "type": "object",
287
+ "additionalProperties": false,
288
+ "required": [
289
+ "query_id",
290
+ "expect"
291
+ ],
292
+ "properties": {
293
+ "query_id": {
294
+ "$ref": "#/$defs/identifier"
295
+ },
296
+ "expect": {
297
+ "oneOf": [
298
+ {
299
+ "type": "object",
300
+ "additionalProperties": false,
301
+ "required": [
302
+ "kind",
303
+ "name",
304
+ "path"
305
+ ],
306
+ "properties": {
307
+ "kind": {
308
+ "const": "symbol"
309
+ },
310
+ "name": {
311
+ "type": "string",
312
+ "minLength": 1
313
+ },
314
+ "path": {
315
+ "$ref": "#/$defs/repoRelativePath"
316
+ }
317
+ }
318
+ },
319
+ {
320
+ "type": "object",
321
+ "additionalProperties": false,
322
+ "required": [
323
+ "kind",
324
+ "path"
325
+ ],
326
+ "properties": {
327
+ "kind": {
328
+ "enum": [
329
+ "path",
330
+ "affected"
331
+ ]
332
+ },
333
+ "path": {
334
+ "$ref": "#/$defs/repoRelativePath"
335
+ }
336
+ }
337
+ }
338
+ ]
339
+ }
340
+ }
341
+ }
342
+ }
343
+ }
344
+ },
345
+ "affected_tests": {
346
+ "type": "array",
347
+ "maxItems": 256,
348
+ "description": "Declared affected tests. Compared exactly against fresh sensor observation; any drift fails the compile rather than being narrowed.",
349
+ "items": {
350
+ "$ref": "#/$defs/repoRelativePath"
351
+ }
352
+ },
353
+ "unknowns": {
354
+ "type": "array",
355
+ "maxItems": 256,
356
+ "description": "Explicitly declared residual unknowns. Recorded, never rounded away.",
357
+ "items": {
358
+ "type": "object",
359
+ "additionalProperties": false,
360
+ "required": [
361
+ "kind",
362
+ "ref"
363
+ ],
364
+ "properties": {
365
+ "kind": {
366
+ "$ref": "#/$defs/identifier"
367
+ },
368
+ "ref": {
369
+ "type": "string",
370
+ "minLength": 1
371
+ }
372
+ }
373
+ }
374
+ },
375
+ "lines": {
376
+ "type": "array",
377
+ "maxItems": 256,
378
+ "description": "Optional semantic lines read or written by this ToDo. line_id values must be unique within the ToDo.",
379
+ "items": {
380
+ "$ref": "#/$defs/line"
381
+ }
382
+ },
383
+ "concern_anchors": {
384
+ "type": "array",
385
+ "maxItems": 256,
386
+ "description": "Optional. Which named symbols inside an owned-but-contested resource are this ToDo's concern. Consumed only when binding seam candidates; it can never create, remove or alter a conflict, so a dishonest declaration degrades the proposal without touching the judgement. Declared symbols must resolve through the sensor with an exact name and path match, must live inside the declared resource, and must not overlap another ToDo's declaration for the same resource; any breach yields a typed unknown instead of a proposal.",
387
+ "items": {
388
+ "type": "object",
389
+ "additionalProperties": false,
390
+ "required": [
391
+ "within",
392
+ "symbols"
393
+ ],
394
+ "properties": {
395
+ "within": {
396
+ "type": "object",
397
+ "additionalProperties": false,
398
+ "required": [
399
+ "kind",
400
+ "target"
401
+ ],
402
+ "description": "The contested resource. Must be a resource this same ToDo claims under 'owns'.",
403
+ "properties": {
404
+ "kind": {
405
+ "enum": [
406
+ "symbol",
407
+ "path"
408
+ ]
409
+ },
410
+ "target": {
411
+ "type": "string",
412
+ "minLength": 1,
413
+ "maxLength": 1024
414
+ }
415
+ }
416
+ },
417
+ "symbols": {
418
+ "type": "array",
419
+ "minItems": 1,
420
+ "maxItems": 256,
421
+ "description": "Symbol names owned by this ToDo inside the resource. Strictly sorted and unique.",
422
+ "items": {
423
+ "type": "string",
424
+ "minLength": 1,
425
+ "maxLength": 1024
426
+ }
427
+ }
428
+ }
429
+ }
430
+ },
431
+ "read_anchors": {
432
+ "type": "array",
433
+ "maxItems": 256,
434
+ "description": "Optional. Which named functions inside a file this ToDo reads (listed under reads) it depends on; ADR 0204. Stripped before run-request synthesis. Symbols strictly sorted and unique.",
435
+ "items": {
436
+ "type": "object",
437
+ "additionalProperties": false,
438
+ "required": [
439
+ "within",
440
+ "symbols"
441
+ ],
442
+ "properties": {
443
+ "within": {
444
+ "type": "object",
445
+ "additionalProperties": false,
446
+ "required": [
447
+ "kind",
448
+ "target"
449
+ ],
450
+ "description": "A path this same ToDo lists under 'reads'.",
451
+ "properties": {
452
+ "kind": {
453
+ "enum": [
454
+ "symbol",
455
+ "path"
456
+ ]
457
+ },
458
+ "target": {
459
+ "type": "string",
460
+ "minLength": 1,
461
+ "maxLength": 1024
462
+ }
463
+ }
464
+ },
465
+ "symbols": {
466
+ "type": "array",
467
+ "minItems": 1,
468
+ "maxItems": 256,
469
+ "description": "Symbol names owned by this ToDo inside the resource. Strictly sorted and unique.",
470
+ "items": {
471
+ "type": "string",
472
+ "minLength": 1,
473
+ "maxLength": 1024
474
+ }
475
+ }
476
+ }
477
+ }
478
+ }
479
+ }
480
+ }
481
+ }
482
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quolu/lattice",
3
- "version": "0.108.0",
3
+ "version": "0.110.0",
4
4
  "description": "Schedulability compiler for multi-agent development: observe real code boundaries, refactor the conflicting seam, recompile the plan for parallel execution",
5
5
  "author": {
6
6
  "name": "Quo / クオ at kitepon.dev",
@@ -30,6 +30,7 @@
30
30
  "docs/schemas/lattice.plan_create_input.v3.schema.json",
31
31
  "docs/schemas/lattice.plan_create_input.v4.schema.json",
32
32
  "docs/schemas/lattice.plan_create_input.v5.schema.json",
33
+ "docs/schemas/lattice.plan_create_input.v6.schema.json",
33
34
  "docs/schemas/lattice.plan_revise_input.v1.schema.json",
34
35
  "docs/schemas/lattice.plan_scope_review.v1.schema.json",
35
36
  "docs/schemas/lattice.plan_backchain.v1.schema.json",
@@ -42,6 +43,7 @@
42
43
  "docs/schemas/lattice.todo_structure_set.v1.schema.json",
43
44
  "docs/schemas/lattice.todo_witness_draft.v2.schema.json",
44
45
  "docs/schemas/lattice.todo_witness_set.v5.schema.json",
46
+ "docs/schemas/lattice.todo_witness_set.v6.schema.json",
45
47
  "docs/schemas/lattice.todo_structure_realization.v1.schema.json",
46
48
  "docs/schemas/lattice.todo_structure_binding.v1.schema.json",
47
49
  "docs/schemas/lattice.run_request.v1.schema.json",
@@ -1650,6 +1650,82 @@ function main() {
1650
1650
  process.exit(1);
1651
1651
  }
1652
1652
  });
1653
+ /**
1654
+ * lattice sensor resolve — `{path, symbol}` anchors → line spans (ADR 0204 Resolve, a3). JSON in on stdin, JSON out.
1655
+ *
1656
+ * stdin: {"anchors":[{"path","symbol"}],"names":["identifier"],"related":false} (all optional). The contract stays at this CLI boundary like `file-nodes`:
1657
+ * Lattice never reads the index database itself. An anchor that does not resolve is an answer (`unresolved` with the
1658
+ * nearest names), not a failure: exit 0.
1659
+ */
1660
+ program
1661
+ .command('resolve')
1662
+ .description('Resolve path#symbol anchors to line spans (JSON on stdin and stdout)')
1663
+ .option('-p, --path <path>', 'Project path')
1664
+ .action(async (options) => {
1665
+ const projectPath = resolveProjectPath(options.path);
1666
+ try {
1667
+ if (!(0, directory_1.isInitialized)(projectPath)) {
1668
+ error(`LatticeSensor not initialized in ${projectPath}`);
1669
+ process.exit(1);
1670
+ }
1671
+ const chunks = [];
1672
+ for await (const chunk of process.stdin)
1673
+ chunks.push(chunk);
1674
+ const request = JSON.parse(Buffer.concat(chunks).toString('utf8'));
1675
+ const anchors = request.anchors ?? [];
1676
+ const names = request.names ?? [];
1677
+ if (!Array.isArray(anchors) || !anchors.every((a) => a && typeof a.path === 'string' && typeof a.symbol === 'string')
1678
+ || !Array.isArray(names) || !names.every((n) => typeof n === 'string')) {
1679
+ error('resolve expects {"anchors"?:[{"path":string,"symbol":string}],"names"?:string[],"related"?:boolean} on stdin');
1680
+ process.exit(2);
1681
+ }
1682
+ const { default: LatticeSensor } = await loadLatticeSensor();
1683
+ const cg = await LatticeSensor.open(projectPath);
1684
+ const { resolveAnchors, lookupNames } = await Promise.resolve().then(() => __importStar(require('../graph/anchor-resolve')));
1685
+ const result = resolveAnchors(cg, anchors, { related: request.related === true });
1686
+ console.log(JSON.stringify({ schema: 'lattice.sensor_resolve.v1', ...result, named: lookupNames(cg, names) }));
1687
+ cg.destroy();
1688
+ }
1689
+ catch (err) {
1690
+ error(`resolve failed: ${err instanceof Error ? err.message : String(err)}`);
1691
+ process.exit(1);
1692
+ }
1693
+ });
1694
+ /**
1695
+ * lattice sensor touched — changed hunks → symbols (ADR 0204 Touched, a6). JSON in on stdin, JSON out.
1696
+ * stdin: {"files":[{"path","old_path","status","hunks":[{"old_start","old_count","new_start","new_count"}]}]}; the index must be the
1697
+ * one of the range END (Lattice's `sensor-touched.mjs` arranges that). What no symbol holds comes back in `unattributed`.
1698
+ */
1699
+ program
1700
+ .command('touched')
1701
+ .description('Map diff hunks to the symbols they changed (JSON on stdin and stdout)')
1702
+ .option('-p, --path <path>', 'Project path')
1703
+ .action(async (options) => {
1704
+ const projectPath = resolveProjectPath(options.path);
1705
+ try {
1706
+ if (!(0, directory_1.isInitialized)(projectPath)) {
1707
+ error(`LatticeSensor not initialized in ${projectPath}`);
1708
+ process.exit(1);
1709
+ }
1710
+ const chunks = [];
1711
+ for await (const chunk of process.stdin)
1712
+ chunks.push(chunk);
1713
+ const request = JSON.parse(Buffer.concat(chunks).toString('utf8'));
1714
+ if (!Array.isArray(request.files)) {
1715
+ error('touched expects {"files":[{"path","old_path","status","hunks":[...]}]} on stdin');
1716
+ process.exit(2);
1717
+ }
1718
+ const { default: LatticeSensor } = await loadLatticeSensor();
1719
+ const cg = await LatticeSensor.open(projectPath);
1720
+ const { touchedSymbols } = await Promise.resolve().then(() => __importStar(require('../graph/touched-symbols')));
1721
+ console.log(JSON.stringify({ schema: 'lattice.sensor_touched.v1', ...touchedSymbols(cg, request.files) }));
1722
+ cg.destroy();
1723
+ }
1724
+ catch (err) {
1725
+ error(`touched failed: ${err instanceof Error ? err.message : String(err)}`);
1726
+ process.exit(1);
1727
+ }
1728
+ });
1653
1729
  /**
1654
1730
  * lattice sensor files [path]
1655
1731
  */
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Anchor resolution — `{path, symbol}` → the line span(s) of that symbol in that file (ADR 0204 Resolve, a3).
3
+ *
4
+ * Deterministic, no AI. Unlike `lookupSymbolNodes` (a name typed by a human, anywhere in the project) this answers one
5
+ * question: "in THIS file, which definition does this written chain name?". Matching is exact on a boundary-aligned
6
+ * chain; a miss never degrades to a fuzzy hit, it answers the nearest names so the caller can correct the typo.
7
+ */
8
+ import type { Node } from '../types';
9
+ export interface ResolvedSpan {
10
+ path: string;
11
+ symbol: string;
12
+ /** The extractor's own chain, written with `.` (`Bar.baz`), so a caller can write it back. */
13
+ qualified: string;
14
+ kind: string;
15
+ startLine: number;
16
+ endLine: number;
17
+ /** Only when asked for: direct callers/callees from the graph (information and freshness, never a conflict by itself). */
18
+ related?: {
19
+ callers: RelatedNode[];
20
+ callees: RelatedNode[];
21
+ truncated: boolean;
22
+ };
23
+ }
24
+ export interface RelatedNode {
25
+ path: string;
26
+ symbol: string;
27
+ kind: string;
28
+ startLine: number;
29
+ endLine: number;
30
+ }
31
+ export interface UnresolvedAnchor {
32
+ path: string;
33
+ symbol: string;
34
+ reason: 'file_not_indexed' | 'symbol_not_found' | 'symbol_empty' | 'path_invalid';
35
+ /** Closest names inside the same file (empty when the file is not indexed). */
36
+ nearest: Array<Omit<ResolvedSpan, 'path' | 'symbol'> & {
37
+ symbol: string;
38
+ }>;
39
+ /** Exact-name definitions in other files: the usual cause of a wrong path. */
40
+ elsewhere: Array<{
41
+ path: string;
42
+ symbol: string;
43
+ kind: string;
44
+ startLine: number;
45
+ endLine: number;
46
+ }>;
47
+ }
48
+ export interface AnchorResolution {
49
+ resolved: ResolvedSpan[];
50
+ unresolved: UnresolvedAnchor[];
51
+ /** A written chain that names more than one distinct definition in its file (the caller must disclose it). */
52
+ ambiguous: Array<{
53
+ path: string;
54
+ symbol: string;
55
+ names: string[];
56
+ }>;
57
+ }
58
+ /** The slice of LatticeSensor a resolution needs; keeps this module testable without an index. */
59
+ export interface AnchorResolveHost {
60
+ getNodesInFile(filePath: string): Node[];
61
+ getNodesByName(name: string): Node[];
62
+ getCallers?(nodeId: string, maxDepth?: number): Array<{
63
+ node: Node;
64
+ }>;
65
+ getCallees?(nodeId: string, maxDepth?: number): Array<{
66
+ node: Node;
67
+ }>;
68
+ }
69
+ export declare function resolveAnchors(host: AnchorResolveHost, anchors: Array<{
70
+ path: string;
71
+ symbol: string;
72
+ }>, options?: {
73
+ related?: boolean;
74
+ }): AnchorResolution;
75
+ export interface NamedDefinitions {
76
+ name: string;
77
+ /** Exact-name definitions across the project (at most {@link NAME_DEFINITION_LIMIT}); empty when none or too common. */
78
+ definitions: Array<{
79
+ path: string;
80
+ symbol: string;
81
+ kind: string;
82
+ startLine: number;
83
+ endLine: number;
84
+ }>;
85
+ /** More definitions than the limit: the name is too common to propose, the caller names the file itself. */
86
+ tooCommon: boolean;
87
+ }
88
+ /** Seed fallback (2b): which graph symbols does a bare identifier name? Exact name only, never fuzzy. */
89
+ export declare function lookupNames(host: AnchorResolveHost, names: string[]): NamedDefinitions[];
90
+ //# sourceMappingURL=anchor-resolve.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anchor-resolve.d.ts","sourceRoot":"","sources":["../../src/graph/anchor-resolve.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAKrC,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,8FAA8F;IAC9F,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,0HAA0H;IAC1H,OAAO,CAAC,EAAE;QAAE,OAAO,EAAE,WAAW,EAAE,CAAC;QAAC,OAAO,EAAE,WAAW,EAAE,CAAC;QAAC,SAAS,EAAE,OAAO,CAAA;KAAE,CAAC;CAClF;AAED,MAAM,WAAW,WAAW;IAAG,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE;AAE/G,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,kBA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