@quolu/lattice 0.32.0 → 0.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +11 -1
- package/README.md +11 -2
- package/bin/lattice.mjs +12 -1
- package/package.json +1 -1
- package/sensor/dist/bin/lattice-sensor.js +72 -4
- package/sensor/dist/db/migrations.d.ts +1 -1
- package/sensor/dist/db/migrations.d.ts.map +1 -1
- package/sensor/dist/db/migrations.js +42 -2
- package/sensor/dist/db/migrations.js.map +1 -1
- package/sensor/dist/db/queries.d.ts +18 -0
- package/sensor/dist/db/queries.d.ts.map +1 -1
- package/sensor/dist/db/queries.js +76 -9
- package/sensor/dist/db/queries.js.map +1 -1
- package/sensor/dist/db/schema.sql +10 -1
- package/sensor/dist/extraction/extraction-version.d.ts +1 -1
- package/sensor/dist/extraction/extraction-version.d.ts.map +1 -1
- package/sensor/dist/extraction/extraction-version.js +5 -1
- package/sensor/dist/extraction/extraction-version.js.map +1 -1
- package/sensor/dist/extraction/index.d.ts +2 -0
- package/sensor/dist/extraction/index.d.ts.map +1 -1
- package/sensor/dist/extraction/index.js +38 -3
- package/sensor/dist/extraction/index.js.map +1 -1
- package/sensor/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/sensor/dist/extraction/tree-sitter.js +89 -16
- package/sensor/dist/extraction/tree-sitter.js.map +1 -1
- package/sensor/dist/index.d.ts +8 -1
- package/sensor/dist/index.d.ts.map +1 -1
- package/sensor/dist/index.js +9 -0
- package/sensor/dist/index.js.map +1 -1
- package/sensor/dist/resolution/import-resolver.d.ts +11 -0
- package/sensor/dist/resolution/import-resolver.d.ts.map +1 -1
- package/sensor/dist/resolution/import-resolver.js +13 -5
- package/sensor/dist/resolution/import-resolver.js.map +1 -1
- package/sensor/dist/resolution/index.d.ts.map +1 -1
- package/sensor/dist/resolution/index.js +11 -0
- package/sensor/dist/resolution/index.js.map +1 -1
- package/sensor/dist/resolution/types.d.ts +4 -0
- package/sensor/dist/resolution/types.d.ts.map +1 -1
- package/sensor/dist/types.d.ts +22 -0
- package/sensor/dist/types.d.ts.map +1 -1
- package/src/artifact-contracts.mjs +3 -0
- package/src/cli-help.mjs +6 -0
- package/src/rc3-scripted-campaign.mjs +3 -1
- package/src/runtime-cli.mjs +280 -36
- package/src/runtime-contracts.mjs +1 -1
- package/src/runtime-control-store.mjs +24 -1
- package/src/runtime-decision-verifier.mjs +1 -1
- package/src/runtime-diff-observer.mjs +2 -2
- package/src/runtime-front-end.mjs +47 -13
- package/src/runtime-hold-recompile.mjs +31 -2
- package/src/runtime-io-sentinel.mjs +16 -9
- package/src/runtime-managed-supervisor.mjs +32 -3
- package/src/runtime-multi-epoch-store.mjs +2 -2
- package/src/runtime-projection.mjs +27 -0
- package/src/runtime-scripted-adapter-controller.mjs +22 -1
- package/src/runtime-seam-resolve.mjs +156 -13
- package/src/runtime-seam-treatment.mjs +2 -1
- package/src/seam-apply.mjs +101 -4
- package/src/seam-cost.mjs +322 -0
- package/src/seam-gate.mjs +146 -0
- package/src/seam-rewrite.mjs +102 -16
- package/src/seam-verification.mjs +26 -3
- package/src/sensor-adapter.mjs +6 -1
- package/src/todo-cli.mjs +55 -0
package/README.ja.md
CHANGED
|
@@ -47,12 +47,22 @@ planを再コンパイルします。共有面が共有でなくなるので、
|
|
|
47
47
|
|
|
48
48
|
| 条件 | 意味 |
|
|
49
49
|
|---|---|
|
|
50
|
-
| `behavior_equivalent` | 原pathの公開export
|
|
50
|
+
| `behavior_equivalent` | 原pathの公開export面が保たれ、移した先が残余面のsymbolへ束縛なしで言及していない(切断参照の網) |
|
|
51
51
|
| `focused_tests_passed` | 影響testが変換後のsourceで実際に通る |
|
|
52
52
|
| `sensor_fresh` | 構造索引を取り直し、新しい面を収載している |
|
|
53
53
|
| `overlap_reduced` | 対象の競合が消え、**かつ**plan全体の競合対が増えていない |
|
|
54
54
|
| `parallelism_improved` | 実行段階数が減っている |
|
|
55
55
|
|
|
56
|
+
### 実行段階の二段構え
|
|
57
|
+
|
|
58
|
+
計画時に完全な分断は原理的に得られません(動的dispatch・実行時に決まるpath・外部状態)。
|
|
59
|
+
そのため実行中は宣言でなく**実際に変更された資源**を観測し、宣言scope外への書き込みや
|
|
60
|
+
進行中の他工程のscopeとの重なりを実行時競合として挙げます。処置は「一方をholdして他方を
|
|
61
|
+
確定→再開」か「双方停止→seam変換→双方再開」の二択で、どちらも実storeに対する
|
|
62
|
+
integration testで一気通貫に検証済みです。切断の重さは`lattice run seam profile`
|
|
63
|
+
(計画時は`todo seam-profile`)が数えられる事実だけで投影し、機械変換の可否は「確実の門」が
|
|
64
|
+
typed理由つきで分類します——宣言を直せば通るのか、操作AIへ渡すべきなのかまで返します。
|
|
65
|
+
|
|
56
66
|
## 開発工場での位置づけ
|
|
57
67
|
|
|
58
68
|
Latticeは[dotagents開発工場](https://github.com/kitepon-rgb/dotagents)が管理する
|
package/README.md
CHANGED
|
@@ -62,7 +62,7 @@ A transform is adopted only when **all five** hold. One missing condition reject
|
|
|
62
62
|
|
|
63
63
|
| Condition | Meaning |
|
|
64
64
|
|---|---|
|
|
65
|
-
| `behavior_equivalent` | The original path's public export surface is preserved |
|
|
65
|
+
| `behavior_equivalent` | The original path's public export surface is preserved, and no moved code references a symbol that stayed behind without a binding (severed-reference net) |
|
|
66
66
|
| `focused_tests_passed` | The affected tests actually pass against the transformed source |
|
|
67
67
|
| `sensor_fresh` | The structure index was rebuilt and covers the new surfaces |
|
|
68
68
|
| `overlap_reduced` | The target conflict is gone **and** plan-wide conflict pairs did not increase |
|
|
@@ -77,7 +77,16 @@ carries a second stage at runtime.
|
|
|
77
77
|
While work executes, Lattice observes **what was actually changed**, not what was declared. When
|
|
78
78
|
it sees a task writing outside its declared scope, or into another running task's scope, it
|
|
79
79
|
raises a runtime conflict — and can either hold one side while the other commits, or transform
|
|
80
|
-
the seam and resume both.
|
|
80
|
+
the seam and resume both. Both treatments are exercised end-to-end against a live store in the
|
|
81
|
+
integration suite.
|
|
82
|
+
|
|
83
|
+
Two projection surfaces support that decision without scoring anyone. `lattice run seam profile`
|
|
84
|
+
(and `todo seam-profile` at plan time) reports the countable anatomy of a cut — cross references,
|
|
85
|
+
shared module state with read/write distinction, shared imports, cycles — with declared blind
|
|
86
|
+
spots, and never persists into any digested artifact. And every machine-transform rejection is
|
|
87
|
+
classified by a **certainty gate**: the machine only transforms what it can do with certainty,
|
|
88
|
+
and each refusal says whether fixing the declaration suffices or the seam should be handed to
|
|
89
|
+
the operating AI.
|
|
81
90
|
|
|
82
91
|
## Install
|
|
83
92
|
|
package/bin/lattice.mjs
CHANGED
|
@@ -90,7 +90,18 @@ if (help !== null) {
|
|
|
90
90
|
// typed契約(cli_error.v2+exit 1/2)の外へ漏れた例外=内部故障。opt-in時のみ観測を残す。
|
|
91
91
|
const { observeRuntimeError } = await import('../src/runtime-errors.mjs');
|
|
92
92
|
observeRuntimeError('LATTICE.CLI_INTERNAL_FAILED', { version: packageJson.version });
|
|
93
|
-
|
|
93
|
+
// **理由を捨てない。** 型名だけでは、何が起きたかを追う手段が無い——実際、seam解決の
|
|
94
|
+
// `witness_set_invalid`はAPIを直接叩くまで見えなかった。typed契約の外へ漏れたこと自体は
|
|
95
|
+
// 内部故障だが、漏れた中身は残す。
|
|
96
|
+
process.stderr.write(`${JSON.stringify({
|
|
97
|
+
schema: 'lattice.cli_error.v2', code: 'INTERNAL_FAILURE',
|
|
98
|
+
message: error?.constructor?.name ?? 'Error',
|
|
99
|
+
detail: {
|
|
100
|
+
reason: typeof error?.message === 'string' && error.message.length > 0
|
|
101
|
+
? error.message.slice(0, 2_048) : null,
|
|
102
|
+
error_detail: error?.detail ?? null,
|
|
103
|
+
},
|
|
104
|
+
})}\n`);
|
|
94
105
|
process.exitCode = 1;
|
|
95
106
|
}
|
|
96
107
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quolu/lattice",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.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",
|
|
@@ -1354,6 +1354,74 @@ function main() {
|
|
|
1354
1354
|
process.exit(1);
|
|
1355
1355
|
}
|
|
1356
1356
|
});
|
|
1357
|
+
/**
|
|
1358
|
+
* lattice sensor file-nodes <file> — one file's indexed symbols, machine-readable.
|
|
1359
|
+
*
|
|
1360
|
+
* Lattice's seam verification needs "which top-level symbols does this file own"
|
|
1361
|
+
* at extraction fidelity (module constants/variables included, regardless of the
|
|
1362
|
+
* value-ref name filter). Reading the DB directly from Lattice would couple it to
|
|
1363
|
+
* the schema, so the contract stays at this CLI boundary like every other read.
|
|
1364
|
+
*
|
|
1365
|
+
* `imports` lists the file's import statements (line extents), and
|
|
1366
|
+
* `import_bindings` the locally bound names with their binding form —
|
|
1367
|
+
* resolved bindings come from the import edges' metadata, unresolvable ones
|
|
1368
|
+
* (builtins etc.) from unresolved_refs. Rewrite tooling joins them by line,
|
|
1369
|
+
* so it never re-parses import text with its own grammar.
|
|
1370
|
+
*/
|
|
1371
|
+
program
|
|
1372
|
+
.command('file-nodes <file>')
|
|
1373
|
+
.description('List indexed symbols of one file (JSON only)')
|
|
1374
|
+
.option('-p, --path <path>', 'Project path')
|
|
1375
|
+
.action(async (file, options) => {
|
|
1376
|
+
const projectPath = resolveProjectPath(options.path);
|
|
1377
|
+
try {
|
|
1378
|
+
if (!(0, directory_1.isInitialized)(projectPath)) {
|
|
1379
|
+
error(`LatticeSensor not initialized in ${projectPath}`);
|
|
1380
|
+
process.exit(1);
|
|
1381
|
+
}
|
|
1382
|
+
const { default: LatticeSensor } = await loadLatticeSensor();
|
|
1383
|
+
const cg = await LatticeSensor.open(projectPath);
|
|
1384
|
+
const all = cg.getNodesInFile(file);
|
|
1385
|
+
const nodes = all
|
|
1386
|
+
.filter(n => n.kind !== 'file' && n.kind !== 'import')
|
|
1387
|
+
.map(n => ({
|
|
1388
|
+
name: n.name, kind: n.kind, startLine: n.startLine, endLine: n.endLine,
|
|
1389
|
+
extentStartLine: n.extentStartLine ?? n.startLine,
|
|
1390
|
+
isExported: n.isExported === true,
|
|
1391
|
+
}));
|
|
1392
|
+
const imports = all
|
|
1393
|
+
.filter(n => n.kind === 'import')
|
|
1394
|
+
.map(n => ({ name: n.name, startLine: n.startLine, endLine: n.endLine }));
|
|
1395
|
+
const importBindings = [];
|
|
1396
|
+
const fileNode = all.find(n => n.kind === 'file');
|
|
1397
|
+
for (const edge of fileNode ? cg.getOutgoingEdges(fileNode.id) : []) {
|
|
1398
|
+
if (edge.kind !== 'imports')
|
|
1399
|
+
continue;
|
|
1400
|
+
const meta = edge.metadata;
|
|
1401
|
+
if (typeof meta?.binding !== 'string' || typeof meta?.refName !== 'string')
|
|
1402
|
+
continue;
|
|
1403
|
+
importBindings.push({
|
|
1404
|
+
local: meta.refName, form: meta.binding,
|
|
1405
|
+
imported: typeof meta.importedName === 'string' ? meta.importedName : null,
|
|
1406
|
+
line: typeof edge.line === 'number' ? edge.line : null,
|
|
1407
|
+
});
|
|
1408
|
+
}
|
|
1409
|
+
for (const ref of cg.getImportBindingRefsForFile(file)) {
|
|
1410
|
+
if (ref.referenceKind !== 'imports' || typeof ref.bindingForm !== 'string')
|
|
1411
|
+
continue;
|
|
1412
|
+
importBindings.push({
|
|
1413
|
+
local: ref.referenceName, form: ref.bindingForm,
|
|
1414
|
+
imported: ref.importedName ?? null, line: ref.line,
|
|
1415
|
+
});
|
|
1416
|
+
}
|
|
1417
|
+
console.log(JSON.stringify({ filePath: file, nodes, imports, import_bindings: importBindings }));
|
|
1418
|
+
cg.destroy();
|
|
1419
|
+
}
|
|
1420
|
+
catch (err) {
|
|
1421
|
+
error(`file-nodes failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
1422
|
+
process.exit(1);
|
|
1423
|
+
}
|
|
1424
|
+
});
|
|
1357
1425
|
/**
|
|
1358
1426
|
* lattice sensor files [path]
|
|
1359
1427
|
*/
|
|
@@ -1732,7 +1800,7 @@ function main() {
|
|
|
1732
1800
|
for (const c of cg.getCallers(match.node.id)) {
|
|
1733
1801
|
if (!seen.has(c.node.id)) {
|
|
1734
1802
|
seen.add(c.node.id);
|
|
1735
|
-
allCallers.push({ name: c.node.name, kind: c.node.kind, filePath: c.node.filePath, startLine: c.node.startLine });
|
|
1803
|
+
allCallers.push({ name: c.node.name, kind: c.node.kind, filePath: c.node.filePath, startLine: c.node.startLine, edgeKind: c.edge.kind, valueRef: c.edge.metadata?.valueRef === true, valueWrite: c.edge.metadata?.write === true });
|
|
1736
1804
|
}
|
|
1737
1805
|
}
|
|
1738
1806
|
}
|
|
@@ -1741,7 +1809,7 @@ function main() {
|
|
|
1741
1809
|
for (const c of cg.getCallers(matches[0].node.id)) {
|
|
1742
1810
|
if (!seen.has(c.node.id)) {
|
|
1743
1811
|
seen.add(c.node.id);
|
|
1744
|
-
allCallers.push({ name: c.node.name, kind: c.node.kind, filePath: c.node.filePath, startLine: c.node.startLine });
|
|
1812
|
+
allCallers.push({ name: c.node.name, kind: c.node.kind, filePath: c.node.filePath, startLine: c.node.startLine, edgeKind: c.edge.kind, valueRef: c.edge.metadata?.valueRef === true, valueWrite: c.edge.metadata?.write === true });
|
|
1745
1813
|
}
|
|
1746
1814
|
}
|
|
1747
1815
|
}
|
|
@@ -1803,7 +1871,7 @@ function main() {
|
|
|
1803
1871
|
for (const c of cg.getCallees(match.node.id)) {
|
|
1804
1872
|
if (!seen.has(c.node.id)) {
|
|
1805
1873
|
seen.add(c.node.id);
|
|
1806
|
-
allCallees.push({ name: c.node.name, kind: c.node.kind, filePath: c.node.filePath, startLine: c.node.startLine });
|
|
1874
|
+
allCallees.push({ name: c.node.name, kind: c.node.kind, filePath: c.node.filePath, startLine: c.node.startLine, edgeKind: c.edge.kind, valueRef: c.edge.metadata?.valueRef === true, valueWrite: c.edge.metadata?.write === true });
|
|
1807
1875
|
}
|
|
1808
1876
|
}
|
|
1809
1877
|
}
|
|
@@ -1811,7 +1879,7 @@ function main() {
|
|
|
1811
1879
|
for (const c of cg.getCallees(matches[0].node.id)) {
|
|
1812
1880
|
if (!seen.has(c.node.id)) {
|
|
1813
1881
|
seen.add(c.node.id);
|
|
1814
|
-
allCallees.push({ name: c.node.name, kind: c.node.kind, filePath: c.node.filePath, startLine: c.node.startLine });
|
|
1882
|
+
allCallees.push({ name: c.node.name, kind: c.node.kind, filePath: c.node.filePath, startLine: c.node.startLine, edgeKind: c.edge.kind, valueRef: c.edge.metadata?.valueRef === true, valueWrite: c.edge.metadata?.write === true });
|
|
1815
1883
|
}
|
|
1816
1884
|
}
|
|
1817
1885
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrations.d.ts","sourceRoot":"","sources":["../../src/db/migrations.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;GAEG;AACH,eAAO,MAAM,sBAAsB,
|
|
1
|
+
{"version":3,"file":"migrations.d.ts","sourceRoot":"","sources":["../../src/db/migrations.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;GAEG;AACH,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC;;GAEG;AACH,UAAU,SAAS;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,EAAE,EAAE,CAAC,EAAE,EAAE,cAAc,KAAK,IAAI,CAAC;CAClC;AAyMD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,cAAc,GAAG,MAAM,CAU5D;AAiBD;;GAEG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAiB3E;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,cAAc,GAAG,OAAO,CAG1D;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,cAAc,GAAG,SAAS,EAAE,CAKpE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,EAAE,EAAE,cAAc,GACjB,KAAK,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC,CAU3E"}
|
|
@@ -14,7 +14,7 @@ exports.getMigrationHistory = getMigrationHistory;
|
|
|
14
14
|
/**
|
|
15
15
|
* Current schema version
|
|
16
16
|
*/
|
|
17
|
-
exports.CURRENT_SCHEMA_VERSION =
|
|
17
|
+
exports.CURRENT_SCHEMA_VERSION = 12;
|
|
18
18
|
/**
|
|
19
19
|
* All migrations in order
|
|
20
20
|
*
|
|
@@ -140,6 +140,40 @@ const migrations = [
|
|
|
140
140
|
`);
|
|
141
141
|
},
|
|
142
142
|
},
|
|
143
|
+
{
|
|
144
|
+
version: 12,
|
|
145
|
+
description: 'files.extraction_version — EXTRACTION_VERSION of the engine that wrote each row (DEFAULT 0 = pre-stamp). Sync re-extracts rows whose stamp differs from the running engine, so extractor upgrades heal incrementally instead of relying on a manual full re-index that the status hint merely recommends',
|
|
146
|
+
up: (db) => {
|
|
147
|
+
const cols = db.prepare('PRAGMA table_info(files)').all();
|
|
148
|
+
if (!cols.some((c) => c.name === 'extraction_version')) {
|
|
149
|
+
db.exec('ALTER TABLE files ADD COLUMN extraction_version INTEGER NOT NULL DEFAULT 0');
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
version: 11,
|
|
155
|
+
description: 'nodes.extent_start_line — first line including preceding decorators/attributes, so extent-based extraction does not orphan Python @decorators / Rust #[attributes] (startLine stays the declaration: it participates in node identity)',
|
|
156
|
+
up: (db) => {
|
|
157
|
+
const cols = db.prepare('PRAGMA table_info(nodes)').all();
|
|
158
|
+
if (!cols.some((c) => c.name === 'extent_start_line')) {
|
|
159
|
+
db.exec('ALTER TABLE nodes ADD COLUMN extent_start_line INTEGER');
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
version: 10,
|
|
165
|
+
description: 'Carry import binding shape (default/named/namespace + source-side name) on unresolved refs so resolved import edges can expose it — rewrite tooling reproduces the binding without re-parsing import text',
|
|
166
|
+
up: (db) => {
|
|
167
|
+
const cols = db.prepare('PRAGMA table_info(unresolved_refs)').all();
|
|
168
|
+
const hasColumn = (name) => cols.some((c) => c.name === name);
|
|
169
|
+
if (!hasColumn('binding_form')) {
|
|
170
|
+
db.exec('ALTER TABLE unresolved_refs ADD COLUMN binding_form TEXT');
|
|
171
|
+
}
|
|
172
|
+
if (!hasColumn('imported_name')) {
|
|
173
|
+
db.exec('ALTER TABLE unresolved_refs ADD COLUMN imported_name TEXT');
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
},
|
|
143
177
|
{
|
|
144
178
|
version: 9,
|
|
145
179
|
description: 'Persist resolution confidence and resolvedBy as their own edges columns (ADR 0048) — previously they only lived in edges.metadata JSON, invisible to index-level filtering/corroboration',
|
|
@@ -189,7 +223,13 @@ function getCurrentVersion(db) {
|
|
|
189
223
|
* Record a migration as applied
|
|
190
224
|
*/
|
|
191
225
|
function recordMigration(db, version, description) {
|
|
192
|
-
|
|
226
|
+
// OR REPLACE: re-running from an older recorded version (a migration history
|
|
227
|
+
// restored from backup, or a partially-reverted history) re-applies every
|
|
228
|
+
// migration above the gap. Migrations themselves are idempotent by contract;
|
|
229
|
+
// the RECORD write must be too, or the first version above the gap that is
|
|
230
|
+
// still recorded blows up on the UNIQUE constraint — first reachable once a
|
|
231
|
+
// v(N+1) exists above a reverted v(N), so it stayed latent until v10.
|
|
232
|
+
db.prepare('INSERT OR REPLACE INTO schema_versions (version, applied_at, description) VALUES (?, ?, ?)').run(version, Date.now(), description);
|
|
193
233
|
}
|
|
194
234
|
/**
|
|
195
235
|
* Run all pending migrations
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrations.js","sourceRoot":"","sources":["../../src/db/migrations.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;
|
|
1
|
+
{"version":3,"file":"migrations.js","sourceRoot":"","sources":["../../src/db/migrations.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AA4NH,8CAUC;AAoBD,sCAiBC;AAKD,wCAGC;AAKD,oDAKC;AAKD,kDAYC;AA1SD;;GAEG;AACU,QAAA,sBAAsB,GAAG,EAAE,CAAC;AAWzC;;;;;GAKG;AACH,MAAM,UAAU,GAAgB;IAC9B;QACE,OAAO,EAAE,CAAC;QACV,WAAW,EAAE,uEAAuE;QACpF,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE;YACT,EAAE,CAAC,IAAI,CAAC;;;;;;;;;;;OAWP,CAAC,CAAC;QACL,CAAC;KACF;IACD;QACE,OAAO,EAAE,CAAC;QACV,WAAW,EAAE,gFAAgF;QAC7F,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE;YACT,EAAE,CAAC,IAAI,CAAC;;OAEP,CAAC,CAAC;QACL,CAAC;KACF;IACD;QACE,OAAO,EAAE,CAAC;QACV,WAAW,EACT,sGAAsG;QACxG,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE;YACT,EAAE,CAAC,IAAI,CAAC;;;OAGP,CAAC,CAAC;QACL,CAAC;KACF;IACD;QACE,OAAO,EAAE,CAAC;QACV,WAAW,EACT,oHAAoH;QACtH,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE;YACT,EAAE,CAAC,IAAI,CAAC;;OAEP,CAAC,CAAC;QACL,CAAC;KACF;IACD;QACE,OAAO,EAAE,CAAC;QACV,WAAW,EACT,uGAAuG;QACzG,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE;YACT,2EAA2E;YAC3E,sEAAsE;YACtE,uE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CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,GAAG,OAAO,CAAC;SAClC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC;AAC3C,CAAC;AAED;;GAEG;AACH,SAAgB,mBAAmB,CACjC,EAAkB;IAElB,MAAM,IAAI,GAAG,EAAE;SACZ,OAAO,CAAC,+EAA+E,CAAC;SACxF,GAAG,EAAgF,CAAC;IAEvF,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QACxB,OAAO,EAAE,GAAG,CAAC,OAAO;QACpB,SAAS,EAAE,GAAG,CAAC,UAAU;QACzB,WAAW,EAAE,GAAG,CAAC,WAAW;KAC7B,CAAC,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -385,6 +385,14 @@ export declare class QueryBuilder {
|
|
|
385
385
|
* Insert or update a file record
|
|
386
386
|
*/
|
|
387
387
|
upsertFile(file: FileRecord): void;
|
|
388
|
+
/**
|
|
389
|
+
* Number of tracked files whose rows were written by an extractor other
|
|
390
|
+
* than the one now running. Zero means the whole index reflects current
|
|
391
|
+
* extraction semantics — the condition for advancing the global stamp.
|
|
392
|
+
*/
|
|
393
|
+
/** Paths of tracked files whose rows were written by a different extractor. */
|
|
394
|
+
getExtractionStalePaths(currentVersion: number): string[];
|
|
395
|
+
getExtractionStaleFileCount(currentVersion: number): number;
|
|
388
396
|
/**
|
|
389
397
|
* Delete a file record and its nodes
|
|
390
398
|
*/
|
|
@@ -461,6 +469,16 @@ export declare class QueryBuilder {
|
|
|
461
469
|
* Uses the idx_unresolved_file_path index for efficient lookup.
|
|
462
470
|
*/
|
|
463
471
|
getUnresolvedReferencesByFiles(filePaths: string[]): UnresolvedReference[];
|
|
472
|
+
/**
|
|
473
|
+
* Import-binding refs of one file, regardless of resolution status.
|
|
474
|
+
*
|
|
475
|
+
* Binding shape (default/named/namespace + alias source name) is an
|
|
476
|
+
* extraction fact. Resolution parks refs whose target never materializes
|
|
477
|
+
* (builtins, external packages) as `failed`, and the pending-only readers
|
|
478
|
+
* hide them — but the binding stays true. Rewrite tooling must see every
|
|
479
|
+
* bound local name, so this reader ignores `status` on purpose.
|
|
480
|
+
*/
|
|
481
|
+
getImportBindingRefsByFile(filePath: string): UnresolvedReference[];
|
|
464
482
|
/**
|
|
465
483
|
* Delete all unresolved references (after resolution)
|
|
466
484
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../src/db/queries.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAmB,MAAM,kBAAkB,CAAC;AACnE,OAAO,EACL,IAAI,EACJ,IAAI,EACJ,UAAU,EACV,mBAAmB,EACnB,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,aAAa,EACb,YAAY,EACb,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../src/db/queries.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAmB,MAAM,kBAAkB,CAAC;AACnE,OAAO,EACL,IAAI,EACJ,IAAI,EACJ,UAAU,EACV,mBAAmB,EACnB,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,aAAa,EACb,YAAY,EACb,MAAM,UAAU,CAAC;AAmPlB;;GAEG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,EAAE,CAAiB;IAM3B,OAAO,CAAC,iBAAiB,CAA0B;IAGnD,OAAO,CAAC,SAAS,CAAgC;IACjD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAQ;IAGrC,OAAO,CAAC,KAAK,CAmCN;IAMP,OAAO,CAAC,cAAc,CAA0B;IAChD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAAS;IASpD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,MAAM,GAAG,IAAI;IAM7C;;OAEG;IACH,cAAc,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IASxC;;OAEG;IACH,KAAK,IAAI,IAAI;CASd"}
|
|
@@ -107,6 +107,7 @@ function rowToNode(row) {
|
|
|
107
107
|
decorators: row.decorators ? (0, utils_1.safeJsonParse)(row.decorators, undefined) : undefined,
|
|
108
108
|
typeParameters: row.type_parameters ? (0, utils_1.safeJsonParse)(row.type_parameters, undefined) : undefined,
|
|
109
109
|
returnType: row.return_type ?? undefined,
|
|
110
|
+
extentStartLine: row.extent_start_line ?? undefined,
|
|
110
111
|
updatedAt: row.updated_at,
|
|
111
112
|
};
|
|
112
113
|
}
|
|
@@ -161,6 +162,7 @@ function rowToFileRecord(row) {
|
|
|
161
162
|
modifiedAt: row.modified_at,
|
|
162
163
|
indexedAt: row.indexed_at,
|
|
163
164
|
nodeCount: row.node_count,
|
|
165
|
+
extractionVersion: row.extraction_version ?? 0,
|
|
164
166
|
errors: row.errors ? (0, utils_1.safeJsonParse)(row.errors, undefined) : undefined,
|
|
165
167
|
};
|
|
166
168
|
}
|
|
@@ -252,13 +254,13 @@ class QueryBuilder {
|
|
|
252
254
|
start_line, end_line, start_column, end_column,
|
|
253
255
|
docstring, signature, visibility,
|
|
254
256
|
is_exported, is_async, is_static, is_abstract,
|
|
255
|
-
decorators, type_parameters, return_type, updated_at
|
|
257
|
+
decorators, type_parameters, return_type, extent_start_line, updated_at
|
|
256
258
|
) VALUES (
|
|
257
259
|
@id, @kind, @name, @qualifiedName, @filePath, @language,
|
|
258
260
|
@startLine, @endLine, @startColumn, @endColumn,
|
|
259
261
|
@docstring, @signature, @visibility,
|
|
260
262
|
@isExported, @isAsync, @isStatic, @isAbstract,
|
|
261
|
-
@decorators, @typeParameters, @returnType, @updatedAt
|
|
263
|
+
@decorators, @typeParameters, @returnType, @extentStartLine, @updatedAt
|
|
262
264
|
)
|
|
263
265
|
`);
|
|
264
266
|
}
|
|
@@ -299,6 +301,7 @@ class QueryBuilder {
|
|
|
299
301
|
decorators: node.decorators ? JSON.stringify(node.decorators) : null,
|
|
300
302
|
typeParameters: node.typeParameters ? JSON.stringify(node.typeParameters) : null,
|
|
301
303
|
returnType: node.returnType ?? null,
|
|
304
|
+
extentStartLine: node.extentStartLine ?? null,
|
|
302
305
|
updatedAt: node.updatedAt ?? Date.now(),
|
|
303
306
|
});
|
|
304
307
|
// Segment vocabulary rides the same write path (and transaction) so it can
|
|
@@ -370,6 +373,7 @@ class QueryBuilder {
|
|
|
370
373
|
node.decorators ? JSON.stringify(node.decorators) : null,
|
|
371
374
|
node.typeParameters ? JSON.stringify(node.typeParameters) : null,
|
|
372
375
|
node.returnType ?? null,
|
|
376
|
+
node.extentStartLine ?? null,
|
|
373
377
|
node.updatedAt ?? Date.now(),
|
|
374
378
|
]);
|
|
375
379
|
if (this.isSegmentableKind(node.kind))
|
|
@@ -380,8 +384,8 @@ class QueryBuilder {
|
|
|
380
384
|
start_line, end_line, start_column, end_column,
|
|
381
385
|
docstring, signature, visibility,
|
|
382
386
|
is_exported, is_async, is_static, is_abstract,
|
|
383
|
-
decorators, type_parameters, return_type, updated_at
|
|
384
|
-
) VALUES `, '(
|
|
387
|
+
decorators, type_parameters, return_type, extent_start_line, updated_at
|
|
388
|
+
) VALUES `, '(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)', rows);
|
|
385
389
|
this.runBatched('insertNameSegments', 'INSERT OR IGNORE INTO name_segment_vocab (segment, name) VALUES ', '(?,?)', segmentRows);
|
|
386
390
|
})();
|
|
387
391
|
}
|
|
@@ -460,6 +464,7 @@ class QueryBuilder {
|
|
|
460
464
|
decorators = @decorators,
|
|
461
465
|
type_parameters = @typeParameters,
|
|
462
466
|
return_type = @returnType,
|
|
467
|
+
extent_start_line = @extentStartLine,
|
|
463
468
|
updated_at = @updatedAt
|
|
464
469
|
WHERE id = @id
|
|
465
470
|
`);
|
|
@@ -492,6 +497,7 @@ class QueryBuilder {
|
|
|
492
497
|
decorators: node.decorators ? JSON.stringify(node.decorators) : null,
|
|
493
498
|
typeParameters: node.typeParameters ? JSON.stringify(node.typeParameters) : null,
|
|
494
499
|
returnType: node.returnType ?? null,
|
|
500
|
+
extentStartLine: node.extentStartLine ?? null,
|
|
495
501
|
updatedAt: node.updatedAt ?? Date.now(),
|
|
496
502
|
});
|
|
497
503
|
// updateNode is a second real write path to `nodes` — framework
|
|
@@ -1624,8 +1630,8 @@ class QueryBuilder {
|
|
|
1624
1630
|
upsertFile(file) {
|
|
1625
1631
|
if (!this.stmts.upsertFile) {
|
|
1626
1632
|
this.stmts.upsertFile = this.db.prepare(`
|
|
1627
|
-
INSERT INTO files (path, content_hash, language, size, modified_at, indexed_at, node_count, errors)
|
|
1628
|
-
VALUES (@path, @contentHash, @language, @size, @modifiedAt, @indexedAt, @nodeCount, @errors)
|
|
1633
|
+
INSERT INTO files (path, content_hash, language, size, modified_at, indexed_at, node_count, extraction_version, errors)
|
|
1634
|
+
VALUES (@path, @contentHash, @language, @size, @modifiedAt, @indexedAt, @nodeCount, @extractionVersion, @errors)
|
|
1629
1635
|
ON CONFLICT(path) DO UPDATE SET
|
|
1630
1636
|
content_hash = @contentHash,
|
|
1631
1637
|
language = @language,
|
|
@@ -1633,6 +1639,7 @@ class QueryBuilder {
|
|
|
1633
1639
|
modified_at = @modifiedAt,
|
|
1634
1640
|
indexed_at = @indexedAt,
|
|
1635
1641
|
node_count = @nodeCount,
|
|
1642
|
+
extraction_version = @extractionVersion,
|
|
1636
1643
|
errors = @errors
|
|
1637
1644
|
`);
|
|
1638
1645
|
}
|
|
@@ -1644,9 +1651,28 @@ class QueryBuilder {
|
|
|
1644
1651
|
modifiedAt: file.modifiedAt,
|
|
1645
1652
|
indexedAt: file.indexedAt,
|
|
1646
1653
|
nodeCount: file.nodeCount,
|
|
1654
|
+
extractionVersion: file.extractionVersion,
|
|
1647
1655
|
errors: file.errors ? JSON.stringify(file.errors) : null,
|
|
1648
1656
|
});
|
|
1649
1657
|
}
|
|
1658
|
+
/**
|
|
1659
|
+
* Number of tracked files whose rows were written by an extractor other
|
|
1660
|
+
* than the one now running. Zero means the whole index reflects current
|
|
1661
|
+
* extraction semantics — the condition for advancing the global stamp.
|
|
1662
|
+
*/
|
|
1663
|
+
/** Paths of tracked files whose rows were written by a different extractor. */
|
|
1664
|
+
getExtractionStalePaths(currentVersion) {
|
|
1665
|
+
const rows = this.db
|
|
1666
|
+
.prepare('SELECT path FROM files WHERE extraction_version != ? ORDER BY path')
|
|
1667
|
+
.all(currentVersion);
|
|
1668
|
+
return rows.map((row) => row.path);
|
|
1669
|
+
}
|
|
1670
|
+
getExtractionStaleFileCount(currentVersion) {
|
|
1671
|
+
const row = this.db
|
|
1672
|
+
.prepare('SELECT COUNT(*) AS stale FROM files WHERE extraction_version != ?')
|
|
1673
|
+
.get(currentVersion);
|
|
1674
|
+
return row.stale;
|
|
1675
|
+
}
|
|
1650
1676
|
/**
|
|
1651
1677
|
* Delete a file record and its nodes
|
|
1652
1678
|
*/
|
|
@@ -1708,8 +1734,8 @@ class QueryBuilder {
|
|
|
1708
1734
|
insertUnresolvedRef(ref) {
|
|
1709
1735
|
if (!this.stmts.insertUnresolved) {
|
|
1710
1736
|
this.stmts.insertUnresolved = this.db.prepare(`
|
|
1711
|
-
INSERT INTO unresolved_refs (from_node_id, reference_name, reference_kind, line, col, candidates, file_path, language)
|
|
1712
|
-
VALUES (@fromNodeId, @referenceName, @referenceKind, @line, @col, @candidates, @filePath, @language)
|
|
1737
|
+
INSERT INTO unresolved_refs (from_node_id, reference_name, reference_kind, line, col, candidates, file_path, language, binding_form, imported_name)
|
|
1738
|
+
VALUES (@fromNodeId, @referenceName, @referenceKind, @line, @col, @candidates, @filePath, @language, @bindingForm, @importedName)
|
|
1713
1739
|
`);
|
|
1714
1740
|
}
|
|
1715
1741
|
this.stmts.insertUnresolved.run({
|
|
@@ -1721,6 +1747,8 @@ class QueryBuilder {
|
|
|
1721
1747
|
candidates: ref.candidates ? JSON.stringify(ref.candidates) : null,
|
|
1722
1748
|
filePath: ref.filePath ?? '',
|
|
1723
1749
|
language: ref.language ?? 'unknown',
|
|
1750
|
+
bindingForm: ref.bindingForm ?? null,
|
|
1751
|
+
importedName: ref.importedName ?? null,
|
|
1724
1752
|
});
|
|
1725
1753
|
}
|
|
1726
1754
|
/**
|
|
@@ -1741,9 +1769,11 @@ class QueryBuilder {
|
|
|
1741
1769
|
ref.candidates ? JSON.stringify(ref.candidates) : null,
|
|
1742
1770
|
ref.filePath ?? '',
|
|
1743
1771
|
ref.language ?? 'unknown',
|
|
1772
|
+
ref.bindingForm ?? null,
|
|
1773
|
+
ref.importedName ?? null,
|
|
1744
1774
|
]);
|
|
1745
1775
|
}
|
|
1746
|
-
this.runBatched('insertUnresolvedRefs', 'INSERT INTO unresolved_refs (from_node_id, reference_name, reference_kind, line, col, candidates, file_path, language) VALUES ', '(
|
|
1776
|
+
this.runBatched('insertUnresolvedRefs', 'INSERT INTO unresolved_refs (from_node_id, reference_name, reference_kind, line, col, candidates, file_path, language, binding_form, imported_name) VALUES ', '(?,?,?,?,?,?,?,?,?,?)', rows);
|
|
1747
1777
|
});
|
|
1748
1778
|
insert();
|
|
1749
1779
|
}
|
|
@@ -1774,6 +1804,8 @@ class QueryBuilder {
|
|
|
1774
1804
|
filePath: row.file_path,
|
|
1775
1805
|
language: row.language,
|
|
1776
1806
|
rowId: row.id,
|
|
1807
|
+
bindingForm: (row.binding_form ?? undefined),
|
|
1808
|
+
importedName: row.imported_name ?? undefined,
|
|
1777
1809
|
}));
|
|
1778
1810
|
}
|
|
1779
1811
|
/**
|
|
@@ -1791,6 +1823,8 @@ class QueryBuilder {
|
|
|
1791
1823
|
filePath: row.file_path,
|
|
1792
1824
|
language: row.language,
|
|
1793
1825
|
rowId: row.id,
|
|
1826
|
+
bindingForm: (row.binding_form ?? undefined),
|
|
1827
|
+
importedName: row.imported_name ?? undefined,
|
|
1794
1828
|
}));
|
|
1795
1829
|
}
|
|
1796
1830
|
/**
|
|
@@ -1833,6 +1867,8 @@ class QueryBuilder {
|
|
|
1833
1867
|
filePath: row.file_path,
|
|
1834
1868
|
language: row.language,
|
|
1835
1869
|
rowId: row.id,
|
|
1870
|
+
bindingForm: (row.binding_form ?? undefined),
|
|
1871
|
+
importedName: row.imported_name ?? undefined,
|
|
1836
1872
|
}));
|
|
1837
1873
|
}
|
|
1838
1874
|
/**
|
|
@@ -1897,6 +1933,35 @@ class QueryBuilder {
|
|
|
1897
1933
|
filePath: row.file_path,
|
|
1898
1934
|
language: row.language,
|
|
1899
1935
|
rowId: row.id,
|
|
1936
|
+
bindingForm: (row.binding_form ?? undefined),
|
|
1937
|
+
importedName: row.imported_name ?? undefined,
|
|
1938
|
+
}));
|
|
1939
|
+
}
|
|
1940
|
+
/**
|
|
1941
|
+
* Import-binding refs of one file, regardless of resolution status.
|
|
1942
|
+
*
|
|
1943
|
+
* Binding shape (default/named/namespace + alias source name) is an
|
|
1944
|
+
* extraction fact. Resolution parks refs whose target never materializes
|
|
1945
|
+
* (builtins, external packages) as `failed`, and the pending-only readers
|
|
1946
|
+
* hide them — but the binding stays true. Rewrite tooling must see every
|
|
1947
|
+
* bound local name, so this reader ignores `status` on purpose.
|
|
1948
|
+
*/
|
|
1949
|
+
getImportBindingRefsByFile(filePath) {
|
|
1950
|
+
const rows = this.db
|
|
1951
|
+
.prepare("SELECT * FROM unresolved_refs WHERE file_path = ? AND reference_kind = 'imports' AND binding_form IS NOT NULL")
|
|
1952
|
+
.all(filePath);
|
|
1953
|
+
return rows.map((row) => ({
|
|
1954
|
+
fromNodeId: row.from_node_id,
|
|
1955
|
+
referenceName: row.reference_name,
|
|
1956
|
+
referenceKind: row.reference_kind,
|
|
1957
|
+
line: row.line,
|
|
1958
|
+
column: row.col,
|
|
1959
|
+
candidates: row.candidates ? (0, utils_1.safeJsonParse)(row.candidates, undefined) : undefined,
|
|
1960
|
+
filePath: row.file_path,
|
|
1961
|
+
language: row.language,
|
|
1962
|
+
rowId: row.id,
|
|
1963
|
+
bindingForm: (row.binding_form ?? undefined),
|
|
1964
|
+
importedName: row.imported_name ?? undefined,
|
|
1900
1965
|
}));
|
|
1901
1966
|
}
|
|
1902
1967
|
/**
|
|
@@ -2056,6 +2121,8 @@ class QueryBuilder {
|
|
|
2056
2121
|
filePath: row.file_path,
|
|
2057
2122
|
language: row.language,
|
|
2058
2123
|
rowId: row.id,
|
|
2124
|
+
bindingForm: (row.binding_form ?? undefined),
|
|
2125
|
+
importedName: row.imported_name ?? undefined,
|
|
2059
2126
|
}));
|
|
2060
2127
|
}
|
|
2061
2128
|
/**
|