@inerrata-corporation/errata 2.0.0-dev.30 → 2.0.0-dev.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.
- package/consolidate-worker.mjs +7 -1
- package/errata.mjs +705 -37
- package/package.json +1 -1
- package/pass-worker.mjs +76 -45
package/package.json
CHANGED
package/pass-worker.mjs
CHANGED
|
@@ -25,7 +25,7 @@ function isTestRelPath(relPath) {
|
|
|
25
25
|
function isTestScopeQname(qname) {
|
|
26
26
|
return TEST_SCOPE_RE.test(qname);
|
|
27
27
|
}
|
|
28
|
-
var SEMANTIC_NODE_LABELS, CONTEXT_NODE_LABELS, CODE_NODE_LABELS, ALL_NODE_LABELS, STRUCTURAL_EDGES, CAUSAL_EDGES, RESOLUTION_EDGES, CONCEPTUAL_EDGES, EVIDENCE_EDGES, CODE_EDGES, BRIDGE_EDGES, IDENTITY_EDGES, JUSTIFICATION_EDGES, BELIEF_EDGES, ABSTRACTION_EDGES, DECOMPOSITION_EDGES, TAXONOMY_EDGES, TRIAGE_EDGES, GIT_EDGES, ALL_EDGE_TYPES, PAGERANK_EXCLUSIONS, EDGE_WEIGHT, CAUSAL_PROTECT_EDGES, VALIDATION_SOURCES, PROBLEM_RESOLUTION, DRIFT_KIND, TEST_PATH_RE, TEST_SCOPE_RE;
|
|
28
|
+
var SEMANTIC_NODE_LABELS, CONTEXT_NODE_LABELS, CODE_NODE_LABELS, ALL_NODE_LABELS, STRUCTURAL_EDGES, CAUSAL_EDGES, RESOLUTION_EDGES, CONCEPTUAL_EDGES, EVIDENCE_EDGES, CODE_EDGES, BRIDGE_EDGES, IDENTITY_EDGES, JUSTIFICATION_EDGES, BELIEF_EDGES, ABSTRACTION_EDGES, DECOMPOSITION_EDGES, TRANSFER_EDGES, TAXONOMY_EDGES, TRIAGE_EDGES, GIT_EDGES, ALL_EDGE_TYPES, PAGERANK_EXCLUSIONS, EDGE_WEIGHT, CAUSAL_PROTECT_EDGES, VALIDATION_SOURCES, PROBLEM_RESOLUTION, DRIFT_KIND, TEST_PATH_RE, TEST_SCOPE_RE;
|
|
29
29
|
var init_castalia = __esm({
|
|
30
30
|
"../../packages/shared/src/castalia.ts"() {
|
|
31
31
|
"use strict";
|
|
@@ -175,6 +175,7 @@ var init_castalia = __esm({
|
|
|
175
175
|
BELIEF_EDGES = ["CORROBORATES"];
|
|
176
176
|
ABSTRACTION_EDGES = ["GENERALIZES", "DERIVED_FROM"];
|
|
177
177
|
DECOMPOSITION_EDGES = ["SPLIT_INTO"];
|
|
178
|
+
TRANSFER_EDGES = ["MAY_RESOLVE"];
|
|
178
179
|
TAXONOMY_EDGES = ["IS_A"];
|
|
179
180
|
TRIAGE_EDGES = ["TRIAGED_BY", "CONFIRMS", "INDICATES", "ROUTES_TO"];
|
|
180
181
|
GIT_EDGES = ["POINTS_AT", "PARENT", "AUTHORED_BY"];
|
|
@@ -189,6 +190,7 @@ var init_castalia = __esm({
|
|
|
189
190
|
...IDENTITY_EDGES,
|
|
190
191
|
...JUSTIFICATION_EDGES,
|
|
191
192
|
...BELIEF_EDGES,
|
|
193
|
+
...TRANSFER_EDGES,
|
|
192
194
|
...ABSTRACTION_EDGES,
|
|
193
195
|
...DECOMPOSITION_EDGES,
|
|
194
196
|
...TAXONOMY_EDGES,
|
|
@@ -315,6 +317,10 @@ var init_castalia = __esm({
|
|
|
315
317
|
INDICATES: 0.4,
|
|
316
318
|
ROUTES_TO: 1,
|
|
317
319
|
TRIAGED_BY: 0,
|
|
320
|
+
// Transfer — a witnessed could-aid hypothesis (Solution → Problem). Discounted like
|
|
321
|
+
// INDICATES: real signal, but a candidate must not form a hub; promotion mints the
|
|
322
|
+
// full-weight SOLVED_BY/MITIGATES instead of upgrading this edge.
|
|
323
|
+
MAY_RESOLVE: 0.3,
|
|
318
324
|
// Git — topology/authorship, weightless (not domain signal-flow)
|
|
319
325
|
POINTS_AT: 0,
|
|
320
326
|
PARENT: 0,
|
|
@@ -15395,7 +15401,7 @@ var init_identity2 = __esm({
|
|
|
15395
15401
|
// ../../packages/indexer/src/pipeline.ts
|
|
15396
15402
|
import { appendFileSync, readFileSync, statSync } from "node:fs";
|
|
15397
15403
|
import { readdir } from "node:fs/promises";
|
|
15398
|
-
import { extname, join
|
|
15404
|
+
import { extname, join, relative, sep } from "node:path";
|
|
15399
15405
|
import { createHash as createHash2 } from "node:crypto";
|
|
15400
15406
|
import { execFileSync } from "node:child_process";
|
|
15401
15407
|
function nowTs() {
|
|
@@ -15511,7 +15517,7 @@ async function incrementalReindex(store2, rootPath, workspaceId, changedAbsPaths
|
|
|
15511
15517
|
for (const rel of [...changedRelPaths]) {
|
|
15512
15518
|
let h;
|
|
15513
15519
|
try {
|
|
15514
|
-
h = createHash2("sha256").update(readFileSync(
|
|
15520
|
+
h = createHash2("sha256").update(readFileSync(join(rootPath, rel))).digest("hex");
|
|
15515
15521
|
} catch {
|
|
15516
15522
|
continue;
|
|
15517
15523
|
}
|
|
@@ -15558,7 +15564,7 @@ async function incrementalReindex(store2, rootPath, workspaceId, changedAbsPaths
|
|
|
15558
15564
|
let parsedFiles = 0;
|
|
15559
15565
|
for (const rel of changedRelPaths) {
|
|
15560
15566
|
if (parsedFiles++ > 0) await new Promise((r2) => setImmediate(r2));
|
|
15561
|
-
const abs =
|
|
15567
|
+
const abs = join(rootPath, ...rel.split("/"));
|
|
15562
15568
|
const ext = extname(abs).toLowerCase();
|
|
15563
15569
|
const provider = providers.find((p) => p.fileExtensions.includes(ext));
|
|
15564
15570
|
if (!provider) continue;
|
|
@@ -15881,8 +15887,8 @@ async function runIndexer(store2, opts) {
|
|
|
15881
15887
|
if (reExports.length > 0) reExportsByFile.set(f.relPath, reExports);
|
|
15882
15888
|
report.filesParsed++;
|
|
15883
15889
|
report.byLanguage[f.provider.id] = (report.byLanguage[f.provider.id] ?? 0) + 1;
|
|
15884
|
-
if (report.filesParsed % 250 === 0) {
|
|
15885
|
-
|
|
15890
|
+
if (report.filesParsed % 250 === 0) perf(`parse @ ${report.filesParsed}/${files.length}`);
|
|
15891
|
+
if (report.filesParsed % 25 === 0) {
|
|
15886
15892
|
await new Promise((r) => setImmediate(r));
|
|
15887
15893
|
}
|
|
15888
15894
|
}
|
|
@@ -16044,7 +16050,12 @@ async function runIndexer(store2, opts) {
|
|
|
16044
16050
|
const pendingEdges = [];
|
|
16045
16051
|
perf("index-build (exports/imports/workspace-pkgs/re-export-fixpoint)");
|
|
16046
16052
|
const providerByRel = new Map(files.map((x) => [x.relPath, x.provider]));
|
|
16053
|
+
let emittedFiles = 0;
|
|
16047
16054
|
for (const [relPath, symbols] of symbolsByFile) {
|
|
16055
|
+
if (emittedFiles > 0 && emittedFiles % 50 === 0) {
|
|
16056
|
+
await new Promise((r) => setImmediate(r));
|
|
16057
|
+
}
|
|
16058
|
+
emittedFiles++;
|
|
16048
16059
|
store2.transaction(() => {
|
|
16049
16060
|
const fileId = fileNodeId(opts.workspaceId, relPath);
|
|
16050
16061
|
const langProvider = providerByRel.get(relPath);
|
|
@@ -16239,6 +16250,7 @@ async function runIndexer(store2, opts) {
|
|
|
16239
16250
|
if (pendingEdges.length > 0) {
|
|
16240
16251
|
const EDGE_BATCH = 5e3;
|
|
16241
16252
|
for (let ei = 0; ei < pendingEdges.length; ei += EDGE_BATCH) {
|
|
16253
|
+
if (ei > 0) await new Promise((r) => setImmediate(r));
|
|
16242
16254
|
const slice = pendingEdges.slice(ei, ei + EDGE_BATCH);
|
|
16243
16255
|
store2.transaction(() => {
|
|
16244
16256
|
for (const e of slice) {
|
|
@@ -16292,7 +16304,7 @@ async function scan(root, current, ignores, providers, out2) {
|
|
|
16292
16304
|
for (const ent of entries) {
|
|
16293
16305
|
if (ignores.has(ent.name)) continue;
|
|
16294
16306
|
if (ent.name.startsWith(".") && ent.name !== ".") continue;
|
|
16295
|
-
const abs =
|
|
16307
|
+
const abs = join(current, ent.name);
|
|
16296
16308
|
if (ent.isDirectory()) {
|
|
16297
16309
|
await scan(root, abs, ignores, providers, out2);
|
|
16298
16310
|
} else if (ent.isFile()) {
|
|
@@ -16338,7 +16350,7 @@ function gitListFiles(root, ignores, providers) {
|
|
|
16338
16350
|
if (segs.some((s) => ignores.has(s) || s.startsWith(".") && s.length > 1)) {
|
|
16339
16351
|
continue;
|
|
16340
16352
|
}
|
|
16341
|
-
const abs =
|
|
16353
|
+
const abs = join(root, rel);
|
|
16342
16354
|
let size;
|
|
16343
16355
|
try {
|
|
16344
16356
|
size = statSync(abs).size;
|
|
@@ -20723,42 +20735,42 @@ ${JSON.stringify(symbolNames, null, 2)}`);
|
|
|
20723
20735
|
|
|
20724
20736
|
// ../../packages/indexer/src/languages/tree-sitter-loader.ts
|
|
20725
20737
|
import { fileURLToPath } from "node:url";
|
|
20726
|
-
import { dirname
|
|
20738
|
+
import { dirname, join as join2 } from "node:path";
|
|
20727
20739
|
import { existsSync, readdirSync } from "node:fs";
|
|
20728
20740
|
import { createRequire } from "node:module";
|
|
20729
20741
|
function entryDir() {
|
|
20730
20742
|
try {
|
|
20731
20743
|
const url2 = import.meta?.url;
|
|
20732
20744
|
if (typeof url2 === "string" && url2.length > 0) {
|
|
20733
|
-
return
|
|
20745
|
+
return dirname(fileURLToPath(url2));
|
|
20734
20746
|
}
|
|
20735
20747
|
} catch {
|
|
20736
20748
|
}
|
|
20737
|
-
return
|
|
20749
|
+
return dirname(process.execPath);
|
|
20738
20750
|
}
|
|
20739
20751
|
function findWasmDir() {
|
|
20740
20752
|
const here = entryDir();
|
|
20741
|
-
const seaWasm =
|
|
20742
|
-
if (existsSync(
|
|
20753
|
+
const seaWasm = join2(here, "resources", "wasm");
|
|
20754
|
+
if (existsSync(join2(seaWasm, "tree-sitter-typescript.wasm"))) return seaWasm;
|
|
20743
20755
|
let dir = here;
|
|
20744
20756
|
for (let i2 = 0; i2 < 6; i2++) {
|
|
20745
|
-
const flat =
|
|
20757
|
+
const flat = join2(
|
|
20746
20758
|
dir,
|
|
20747
20759
|
"node_modules",
|
|
20748
20760
|
"@vscode",
|
|
20749
20761
|
"tree-sitter-wasm",
|
|
20750
20762
|
"wasm"
|
|
20751
20763
|
);
|
|
20752
|
-
if (existsSync(
|
|
20753
|
-
dir =
|
|
20764
|
+
if (existsSync(join2(flat, "tree-sitter-typescript.wasm"))) return flat;
|
|
20765
|
+
dir = dirname(dir);
|
|
20754
20766
|
}
|
|
20755
20767
|
let root = here;
|
|
20756
20768
|
for (let i2 = 0; i2 < 6; i2++) {
|
|
20757
|
-
const pnpmDir =
|
|
20769
|
+
const pnpmDir = join2(root, "node_modules", ".pnpm");
|
|
20758
20770
|
if (existsSync(pnpmDir)) {
|
|
20759
20771
|
for (const entry of readdirSync(pnpmDir)) {
|
|
20760
20772
|
if (entry.startsWith("@vscode+tree-sitter-wasm@")) {
|
|
20761
|
-
const candidate =
|
|
20773
|
+
const candidate = join2(
|
|
20762
20774
|
pnpmDir,
|
|
20763
20775
|
entry,
|
|
20764
20776
|
"node_modules",
|
|
@@ -20766,13 +20778,13 @@ function findWasmDir() {
|
|
|
20766
20778
|
"tree-sitter-wasm",
|
|
20767
20779
|
"wasm"
|
|
20768
20780
|
);
|
|
20769
|
-
if (existsSync(
|
|
20781
|
+
if (existsSync(join2(candidate, "tree-sitter-typescript.wasm"))) {
|
|
20770
20782
|
return candidate;
|
|
20771
20783
|
}
|
|
20772
20784
|
}
|
|
20773
20785
|
}
|
|
20774
20786
|
}
|
|
20775
|
-
root =
|
|
20787
|
+
root = dirname(root);
|
|
20776
20788
|
}
|
|
20777
20789
|
throw new Error(
|
|
20778
20790
|
"@vscode/tree-sitter-wasm grammar files not found \u2014 is the package installed?"
|
|
@@ -20780,33 +20792,33 @@ function findWasmDir() {
|
|
|
20780
20792
|
}
|
|
20781
20793
|
function findRuntimeDir() {
|
|
20782
20794
|
const here = entryDir();
|
|
20783
|
-
const seaRuntime =
|
|
20784
|
-
if (existsSync(
|
|
20795
|
+
const seaRuntime = join2(here, "resources", "wasm");
|
|
20796
|
+
if (existsSync(join2(seaRuntime, "web-tree-sitter.wasm"))) return seaRuntime;
|
|
20785
20797
|
let dir = here;
|
|
20786
20798
|
for (let i2 = 0; i2 < 6; i2++) {
|
|
20787
|
-
const flat =
|
|
20788
|
-
if (existsSync(
|
|
20789
|
-
dir =
|
|
20799
|
+
const flat = join2(dir, "node_modules", "web-tree-sitter");
|
|
20800
|
+
if (existsSync(join2(flat, "web-tree-sitter.wasm"))) return flat;
|
|
20801
|
+
dir = dirname(dir);
|
|
20790
20802
|
}
|
|
20791
20803
|
let root = here;
|
|
20792
20804
|
for (let i2 = 0; i2 < 6; i2++) {
|
|
20793
|
-
const pnpmDir =
|
|
20805
|
+
const pnpmDir = join2(root, "node_modules", ".pnpm");
|
|
20794
20806
|
if (existsSync(pnpmDir)) {
|
|
20795
20807
|
for (const entry of readdirSync(pnpmDir)) {
|
|
20796
20808
|
if (entry.startsWith("web-tree-sitter@")) {
|
|
20797
|
-
const candidate =
|
|
20809
|
+
const candidate = join2(
|
|
20798
20810
|
pnpmDir,
|
|
20799
20811
|
entry,
|
|
20800
20812
|
"node_modules",
|
|
20801
20813
|
"web-tree-sitter"
|
|
20802
20814
|
);
|
|
20803
|
-
if (existsSync(
|
|
20815
|
+
if (existsSync(join2(candidate, "web-tree-sitter.wasm"))) {
|
|
20804
20816
|
return candidate;
|
|
20805
20817
|
}
|
|
20806
20818
|
}
|
|
20807
20819
|
}
|
|
20808
20820
|
}
|
|
20809
|
-
root =
|
|
20821
|
+
root = dirname(root);
|
|
20810
20822
|
}
|
|
20811
20823
|
throw new Error("web-tree-sitter runtime WASM not found");
|
|
20812
20824
|
}
|
|
@@ -20817,7 +20829,7 @@ async function loadWebTreeSitter() {
|
|
|
20817
20829
|
void err2;
|
|
20818
20830
|
}
|
|
20819
20831
|
const here = entryDir();
|
|
20820
|
-
const seaResourceBase =
|
|
20832
|
+
const seaResourceBase = join2(here, "resources", "_resolve.js");
|
|
20821
20833
|
const resourceRequire = createRequire(seaResourceBase);
|
|
20822
20834
|
return resourceRequire("web-tree-sitter");
|
|
20823
20835
|
}
|
|
@@ -20832,9 +20844,9 @@ async function ensureTreeSitterReady() {
|
|
|
20832
20844
|
await Parser2.init({
|
|
20833
20845
|
locateFile: (name2) => {
|
|
20834
20846
|
if (name2 === "tree-sitter.wasm" || name2 === "web-tree-sitter.wasm") {
|
|
20835
|
-
return
|
|
20847
|
+
return join2(runtime, name2);
|
|
20836
20848
|
}
|
|
20837
|
-
return
|
|
20849
|
+
return join2(grammars, name2);
|
|
20838
20850
|
}
|
|
20839
20851
|
});
|
|
20840
20852
|
})();
|
|
@@ -20846,7 +20858,7 @@ async function loadGrammar(name2) {
|
|
|
20846
20858
|
if (cached2) return cached2;
|
|
20847
20859
|
if (!languageClass) throw new Error("tree-sitter not initialized");
|
|
20848
20860
|
const grammars = findWasmDir();
|
|
20849
|
-
const lang = await languageClass.load(
|
|
20861
|
+
const lang = await languageClass.load(join2(grammars, `${name2}.wasm`));
|
|
20850
20862
|
grammarCache.set(name2, lang);
|
|
20851
20863
|
return lang;
|
|
20852
20864
|
}
|
|
@@ -24856,12 +24868,14 @@ function resolveDesignProblems(store2, t) {
|
|
|
24856
24868
|
if (!p.id.startsWith("dprob_")) continue;
|
|
24857
24869
|
if (p.attrs["resolvedAt"]) continue;
|
|
24858
24870
|
let symName = "";
|
|
24871
|
+
let symRelPath;
|
|
24859
24872
|
let edited = false;
|
|
24860
24873
|
for (const e of store2.outEdges(p.id, ["ANCHORED_AT"])) {
|
|
24861
24874
|
const sym = store2.getNode(e.to);
|
|
24862
24875
|
if (sym && sym.lastUpdatedAt > p.createdAt) {
|
|
24863
24876
|
edited = true;
|
|
24864
24877
|
symName = sym.description;
|
|
24878
|
+
symRelPath = sym.attrs["relPath"] ?? void 0;
|
|
24865
24879
|
break;
|
|
24866
24880
|
}
|
|
24867
24881
|
}
|
|
@@ -24871,7 +24885,11 @@ function resolveDesignProblems(store2, t) {
|
|
|
24871
24885
|
store2.mergeNode(
|
|
24872
24886
|
buildNode(solId, "Solution", `addressed by an edit to ${symName}`, t, {
|
|
24873
24887
|
source: "convo",
|
|
24874
|
-
provisional: false
|
|
24888
|
+
provisional: false,
|
|
24889
|
+
// AC-resolution-attrs: the resolving symbol/file as STRUCTURED data, not
|
|
24890
|
+
// just prose — the F2 join key downstream backfills and the viz read.
|
|
24891
|
+
resolvedSymbols: [symName],
|
|
24892
|
+
...symRelPath ? { resolvedRelPath: symRelPath } : {}
|
|
24875
24893
|
})
|
|
24876
24894
|
);
|
|
24877
24895
|
mergeEdge(store2, p.id, solId, "SOLVED_BY", t);
|
|
@@ -25709,6 +25727,9 @@ function fileOf(store2, nodeId) {
|
|
|
25709
25727
|
// ../../packages/context-writer/src/select-durable-memory.ts
|
|
25710
25728
|
init_src2();
|
|
25711
25729
|
|
|
25730
|
+
// src/pass-worker.ts
|
|
25731
|
+
init_src3();
|
|
25732
|
+
|
|
25712
25733
|
// ../../node_modules/.pnpm/env-paths@3.0.0/node_modules/env-paths/index.js
|
|
25713
25734
|
import os from "node:os";
|
|
25714
25735
|
import process3 from "node:process";
|
|
@@ -25717,24 +25738,24 @@ var tmpdir = os.tmpdir();
|
|
|
25717
25738
|
var { env } = process3;
|
|
25718
25739
|
|
|
25719
25740
|
// src/paths.ts
|
|
25720
|
-
import { dirname, join } from "node:path";
|
|
25741
|
+
import { dirname as dirname2, join as join3 } from "node:path";
|
|
25721
25742
|
function workspaceDir(workspaceRoot) {
|
|
25722
|
-
return
|
|
25743
|
+
return join3(workspaceRoot, ".errata");
|
|
25723
25744
|
}
|
|
25724
25745
|
function workspacePaths(root) {
|
|
25725
25746
|
const dir = workspaceDir(root);
|
|
25726
25747
|
return {
|
|
25727
25748
|
root,
|
|
25728
25749
|
configDir: dir,
|
|
25729
|
-
workspaceJson:
|
|
25730
|
-
eventLog:
|
|
25731
|
-
castalia:
|
|
25732
|
-
reviewQueue:
|
|
25733
|
-
outbox:
|
|
25734
|
-
daemonLock:
|
|
25735
|
-
identityAudit:
|
|
25736
|
-
skillsDir:
|
|
25737
|
-
skillsManifest:
|
|
25750
|
+
workspaceJson: join3(dir, "workspace.json"),
|
|
25751
|
+
eventLog: join3(dir, "eventlog.sqlite"),
|
|
25752
|
+
castalia: join3(dir, "castalia.db"),
|
|
25753
|
+
reviewQueue: join3(dir, "review-queue.json"),
|
|
25754
|
+
outbox: join3(dir, "outbox"),
|
|
25755
|
+
daemonLock: join3(dir, "daemon.lock"),
|
|
25756
|
+
identityAudit: join3(dir, "identity-audit.log"),
|
|
25757
|
+
skillsDir: join3(dir, "skills"),
|
|
25758
|
+
skillsManifest: join3(dir, "skills.json")
|
|
25738
25759
|
};
|
|
25739
25760
|
}
|
|
25740
25761
|
|
|
@@ -25853,10 +25874,20 @@ function runPass(msg) {
|
|
|
25853
25874
|
...p.skills !== void 0 ? { skills: p.skills } : {}
|
|
25854
25875
|
});
|
|
25855
25876
|
}
|
|
25877
|
+
case "reindex":
|
|
25878
|
+
return runReindex(msg.payload);
|
|
25856
25879
|
default:
|
|
25857
25880
|
throw new Error(`pass-worker: unknown pass "${msg.kind}"`);
|
|
25858
25881
|
}
|
|
25859
25882
|
}
|
|
25883
|
+
async function runReindex(p) {
|
|
25884
|
+
const identityEvaluations = [];
|
|
25885
|
+
const r = await incrementalReindex(store, init2.workspaceRoot, init2.workspaceId, p.changedAbsPaths, p.t, {
|
|
25886
|
+
onIdentityEvaluate: (e) => identityEvaluations.push(e),
|
|
25887
|
+
...p.declaredRenames !== void 0 ? { declaredRenames: p.declaredRenames } : {}
|
|
25888
|
+
});
|
|
25889
|
+
return { ...r, identityEvaluations };
|
|
25890
|
+
}
|
|
25860
25891
|
function runNightly() {
|
|
25861
25892
|
const report = runNightlyPipeline(store);
|
|
25862
25893
|
let merged = 0;
|