@inerrata-corporation/errata 2.0.0-dev.29 → 2.0.0-dev.31
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/errata.mjs +116 -38
- package/package.json +1 -1
- package/pass-worker.mjs +64 -43
package/errata.mjs
CHANGED
|
@@ -20569,6 +20569,7 @@ var init_env_paths = __esm({
|
|
|
20569
20569
|
// src/paths.ts
|
|
20570
20570
|
var paths_exports = {};
|
|
20571
20571
|
__export(paths_exports, {
|
|
20572
|
+
daemonLogPath: () => daemonLogPath,
|
|
20572
20573
|
ensureDir: () => ensureDir,
|
|
20573
20574
|
ensureParent: () => ensureParent,
|
|
20574
20575
|
globalConfigPath: () => globalConfigPath,
|
|
@@ -20587,6 +20588,10 @@ function globalDir() {
|
|
|
20587
20588
|
function globalConfigPath() {
|
|
20588
20589
|
return process.env["ERRATA_CONFIG_PATH"] ?? join3(globalDir(), "config.json");
|
|
20589
20590
|
}
|
|
20591
|
+
function daemonLogPath() {
|
|
20592
|
+
mkdirSync3(globalDir(), { recursive: true });
|
|
20593
|
+
return join3(globalDir(), "daemon.log");
|
|
20594
|
+
}
|
|
20590
20595
|
function globalDaemonLock() {
|
|
20591
20596
|
return process.env["ERRATA_DAEMON_LOCK"] ?? join3(globalDir(), "daemon.lock");
|
|
20592
20597
|
}
|
|
@@ -25876,7 +25881,9 @@ async function incrementalReindex(store, rootPath, workspaceId2, changedAbsPaths
|
|
|
25876
25881
|
});
|
|
25877
25882
|
}
|
|
25878
25883
|
const after = /* @__PURE__ */ new Map();
|
|
25884
|
+
let parsedFiles = 0;
|
|
25879
25885
|
for (const rel of changedRelPaths) {
|
|
25886
|
+
if (parsedFiles++ > 0) await new Promise((r2) => setImmediate(r2));
|
|
25880
25887
|
const abs = join6(rootPath, ...rel.split("/"));
|
|
25881
25888
|
const ext = extname(abs).toLowerCase();
|
|
25882
25889
|
const provider = providers.find((p) => p.fileExtensions.includes(ext));
|
|
@@ -26200,8 +26207,8 @@ async function runIndexer(store, opts) {
|
|
|
26200
26207
|
if (reExports.length > 0) reExportsByFile.set(f.relPath, reExports);
|
|
26201
26208
|
report.filesParsed++;
|
|
26202
26209
|
report.byLanguage[f.provider.id] = (report.byLanguage[f.provider.id] ?? 0) + 1;
|
|
26203
|
-
if (report.filesParsed % 250 === 0) {
|
|
26204
|
-
|
|
26210
|
+
if (report.filesParsed % 250 === 0) perf(`parse @ ${report.filesParsed}/${files.length}`);
|
|
26211
|
+
if (report.filesParsed % 25 === 0) {
|
|
26205
26212
|
await new Promise((r) => setImmediate(r));
|
|
26206
26213
|
}
|
|
26207
26214
|
}
|
|
@@ -26363,7 +26370,12 @@ async function runIndexer(store, opts) {
|
|
|
26363
26370
|
const pendingEdges = [];
|
|
26364
26371
|
perf("index-build (exports/imports/workspace-pkgs/re-export-fixpoint)");
|
|
26365
26372
|
const providerByRel = new Map(files.map((x) => [x.relPath, x.provider]));
|
|
26373
|
+
let emittedFiles = 0;
|
|
26366
26374
|
for (const [relPath, symbols] of symbolsByFile) {
|
|
26375
|
+
if (emittedFiles > 0 && emittedFiles % 50 === 0) {
|
|
26376
|
+
await new Promise((r) => setImmediate(r));
|
|
26377
|
+
}
|
|
26378
|
+
emittedFiles++;
|
|
26367
26379
|
store.transaction(() => {
|
|
26368
26380
|
const fileId = fileNodeId(opts.workspaceId, relPath);
|
|
26369
26381
|
const langProvider = providerByRel.get(relPath);
|
|
@@ -26558,6 +26570,7 @@ async function runIndexer(store, opts) {
|
|
|
26558
26570
|
if (pendingEdges.length > 0) {
|
|
26559
26571
|
const EDGE_BATCH = 5e3;
|
|
26560
26572
|
for (let ei = 0; ei < pendingEdges.length; ei += EDGE_BATCH) {
|
|
26573
|
+
if (ei > 0) await new Promise((r) => setImmediate(r));
|
|
26561
26574
|
const slice = pendingEdges.slice(ei, ei + EDGE_BATCH);
|
|
26562
26575
|
store.transaction(() => {
|
|
26563
26576
|
for (const e of slice) {
|
|
@@ -37111,7 +37124,7 @@ var init_report_render = __esm({
|
|
|
37111
37124
|
|
|
37112
37125
|
// src/cli.ts
|
|
37113
37126
|
init_src5();
|
|
37114
|
-
import { existsSync as existsSync19, readFileSync as readFileSync18 } from "node:fs";
|
|
37127
|
+
import { closeSync as closeSync2, existsSync as existsSync19, openSync as openSync2, readFileSync as readFileSync18, renameSync as renameSync3, statSync as statSync5 } from "node:fs";
|
|
37115
37128
|
import { join as join22 } from "node:path";
|
|
37116
37129
|
import { spawn as spawn3 } from "node:child_process";
|
|
37117
37130
|
|
|
@@ -40277,6 +40290,12 @@ var PassWorker = class {
|
|
|
40277
40290
|
snapshot(opts) {
|
|
40278
40291
|
return this.call("snapshot", opts);
|
|
40279
40292
|
}
|
|
40293
|
+
/** Run an fs/git incremental reindex on the worker — `incrementalReindex`
|
|
40294
|
+
* embeds a full-workspace `runIndexer` (cross-file re-resolution), which held
|
|
40295
|
+
* the main loop ~30s+ per saved file when run inline (HZ-reindex-offload). */
|
|
40296
|
+
reindex(opts) {
|
|
40297
|
+
return this.call("reindex", opts);
|
|
40298
|
+
}
|
|
40280
40299
|
call(kind, payload) {
|
|
40281
40300
|
if (this.stopped) return Promise.reject(new Error("pass worker stopped"));
|
|
40282
40301
|
this.ensureWorker();
|
|
@@ -41327,8 +41346,36 @@ function maybeFlushDigests() {
|
|
|
41327
41346
|
}
|
|
41328
41347
|
}
|
|
41329
41348
|
|
|
41349
|
+
// src/loop-lag.ts
|
|
41350
|
+
var HEARTBEAT_MS = 500;
|
|
41351
|
+
var currentPass = "idle";
|
|
41352
|
+
var started = false;
|
|
41353
|
+
function markPass(name2) {
|
|
41354
|
+
const prev = currentPass;
|
|
41355
|
+
currentPass = name2;
|
|
41356
|
+
return () => {
|
|
41357
|
+
currentPass = prev;
|
|
41358
|
+
};
|
|
41359
|
+
}
|
|
41360
|
+
function startLoopLagMonitor(thresholdMs = 1e3) {
|
|
41361
|
+
if (started) return;
|
|
41362
|
+
started = true;
|
|
41363
|
+
let last = Date.now();
|
|
41364
|
+
const timer = setInterval(() => {
|
|
41365
|
+
const now = Date.now();
|
|
41366
|
+
const lag = now - last - HEARTBEAT_MS;
|
|
41367
|
+
if (lag > thresholdMs) {
|
|
41368
|
+
console.warn(
|
|
41369
|
+
`[loop-lag] ${(/* @__PURE__ */ new Date()).toISOString()} event loop held ~${(lag / 1e3).toFixed(1)}s during "${currentPass}"`
|
|
41370
|
+
);
|
|
41371
|
+
}
|
|
41372
|
+
last = now;
|
|
41373
|
+
}, HEARTBEAT_MS);
|
|
41374
|
+
timer.unref();
|
|
41375
|
+
}
|
|
41376
|
+
|
|
41330
41377
|
// src/engine.ts
|
|
41331
|
-
var DAEMON_VERSION = true ? "2.0.0-dev.
|
|
41378
|
+
var DAEMON_VERSION = true ? "2.0.0-dev.31" : "2.0.0-alpha.0";
|
|
41332
41379
|
var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
|
|
41333
41380
|
var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
|
|
41334
41381
|
var GIT_OP_MUTE_MS = 4e3;
|
|
@@ -41450,6 +41497,36 @@ function createWorkspaceEngine(opts) {
|
|
|
41450
41497
|
watcher.on("add", onFs("fs.add"));
|
|
41451
41498
|
watcher.on("change", onFs("fs.change"));
|
|
41452
41499
|
watcher.on("unlink", onFs("fs.unlink"));
|
|
41500
|
+
const auditIdentity = (t, e) => {
|
|
41501
|
+
appendIdentityAudit(identityAuditPath, e, JSON.stringify({ t, ...e }) + "\n");
|
|
41502
|
+
};
|
|
41503
|
+
const runReindexPass = async (passName, changed, t, declaredRenames) => {
|
|
41504
|
+
if (passWorker) {
|
|
41505
|
+
try {
|
|
41506
|
+
const { identityEvaluations, ...r } = await passWorker.reindex({
|
|
41507
|
+
changedAbsPaths: changed,
|
|
41508
|
+
t,
|
|
41509
|
+
...declaredRenames !== void 0 ? { declaredRenames } : {}
|
|
41510
|
+
});
|
|
41511
|
+
for (const e of identityEvaluations) auditIdentity(t, e);
|
|
41512
|
+
return r;
|
|
41513
|
+
} catch (err2) {
|
|
41514
|
+
console.warn(
|
|
41515
|
+
"[errata] reindex worker unavailable, running inline:",
|
|
41516
|
+
err2 instanceof Error ? err2.message : err2
|
|
41517
|
+
);
|
|
41518
|
+
}
|
|
41519
|
+
}
|
|
41520
|
+
const done = markPass(passName);
|
|
41521
|
+
try {
|
|
41522
|
+
return await incrementalReindex(store, opts.workspaceRoot, profile.id, changed, t, {
|
|
41523
|
+
onIdentityEvaluate: (e) => auditIdentity(t, e),
|
|
41524
|
+
...declaredRenames !== void 0 ? { declaredRenames } : {}
|
|
41525
|
+
});
|
|
41526
|
+
} finally {
|
|
41527
|
+
done();
|
|
41528
|
+
}
|
|
41529
|
+
};
|
|
41453
41530
|
const dirty = /* @__PURE__ */ new Set();
|
|
41454
41531
|
let gitOpMuteUntil = 0;
|
|
41455
41532
|
const scheduleFlush = () => {
|
|
@@ -41461,12 +41538,12 @@ function createWorkspaceEngine(opts) {
|
|
|
41461
41538
|
const t = Date.now();
|
|
41462
41539
|
const relChanged = changed.map((p) => relative6(opts.workspaceRoot, p).split(sep4).join("/"));
|
|
41463
41540
|
const causal = causalBuffer.correlate(relChanged, t) ?? void 0;
|
|
41464
|
-
void
|
|
41465
|
-
|
|
41466
|
-
|
|
41467
|
-
|
|
41468
|
-
|
|
41469
|
-
|
|
41541
|
+
void runReindexPass(
|
|
41542
|
+
`fs-reindex:${profile.name} (${changed.length} files)`,
|
|
41543
|
+
changed,
|
|
41544
|
+
t,
|
|
41545
|
+
causal?.declaredRenames
|
|
41546
|
+
).then((r) => {
|
|
41470
41547
|
if (r.filesReindexed > 0) {
|
|
41471
41548
|
console.log(
|
|
41472
41549
|
`[errata] incremental reindex: ${r.filesReindexed} file(s), +${r.nodesEmitted} nodes / +${r.edgesEmitted} edges`
|
|
@@ -41525,7 +41602,12 @@ function createWorkspaceEngine(opts) {
|
|
|
41525
41602
|
if (srcPaths.length > 0) {
|
|
41526
41603
|
const abs = srcPaths.map((p) => join19(opts.workspaceRoot, p));
|
|
41527
41604
|
try {
|
|
41528
|
-
const r = await
|
|
41605
|
+
const r = await runReindexPass(
|
|
41606
|
+
`git-reindex:${profile.name} (${abs.length} files)`,
|
|
41607
|
+
abs,
|
|
41608
|
+
t,
|
|
41609
|
+
declaredRenames
|
|
41610
|
+
);
|
|
41529
41611
|
if (r.filesReindexed > 0) {
|
|
41530
41612
|
const epId = recordEpisode(store, profile.id, t, r.delta, void 0);
|
|
41531
41613
|
if (epId) {
|
|
@@ -41605,6 +41687,7 @@ function createWorkspaceEngine(opts) {
|
|
|
41605
41687
|
skills: readSkillManifest(paths.skillsManifest)
|
|
41606
41688
|
};
|
|
41607
41689
|
const prebuilt = passWorker ? await passWorker.snapshot(snapOpts).catch(() => null) : null;
|
|
41690
|
+
const doneRender = prebuilt ? null : markPass(`context-render-inline:${profile.name}`);
|
|
41608
41691
|
const { body: body2, snapshot } = assembleAgentContext({
|
|
41609
41692
|
store,
|
|
41610
41693
|
...snapOpts,
|
|
@@ -41612,6 +41695,7 @@ function createWorkspaceEngine(opts) {
|
|
|
41612
41695
|
...elicit ? { edgeElicitation: { instruction: PRIOR_TAG_INSTRUCTION } } : {},
|
|
41613
41696
|
...prebuilt ? { snapshot: prebuilt } : {}
|
|
41614
41697
|
});
|
|
41698
|
+
doneRender?.();
|
|
41615
41699
|
const target = join19(opts.workspaceRoot, "AGENTS.md");
|
|
41616
41700
|
writeManagedBlock(target, { body: body2 });
|
|
41617
41701
|
if (elicit) {
|
|
@@ -41791,6 +41875,14 @@ function createWorkspaceEngine(opts) {
|
|
|
41791
41875
|
const sessionThreads = /* @__PURE__ */ new Map();
|
|
41792
41876
|
const harvestTexts = async (sessionId, items) => {
|
|
41793
41877
|
if (items.length === 0) return;
|
|
41878
|
+
const doneHarvest = markPass(`turn-harvest:${profile.name} (${items.length} turns)`);
|
|
41879
|
+
try {
|
|
41880
|
+
await harvestTextsInner(sessionId, items);
|
|
41881
|
+
} finally {
|
|
41882
|
+
doneHarvest();
|
|
41883
|
+
}
|
|
41884
|
+
};
|
|
41885
|
+
const harvestTextsInner = async (sessionId, items) => {
|
|
41794
41886
|
let minted = 0;
|
|
41795
41887
|
let resolved = 0;
|
|
41796
41888
|
let abstracted = 0;
|
|
@@ -43094,32 +43186,6 @@ var ConsolidateWorker = class {
|
|
|
43094
43186
|
}
|
|
43095
43187
|
};
|
|
43096
43188
|
|
|
43097
|
-
// src/loop-lag.ts
|
|
43098
|
-
var HEARTBEAT_MS = 500;
|
|
43099
|
-
var currentPass = "idle";
|
|
43100
|
-
var started = false;
|
|
43101
|
-
function markPass(name2) {
|
|
43102
|
-
const prev = currentPass;
|
|
43103
|
-
currentPass = name2;
|
|
43104
|
-
return () => {
|
|
43105
|
-
currentPass = prev;
|
|
43106
|
-
};
|
|
43107
|
-
}
|
|
43108
|
-
function startLoopLagMonitor(thresholdMs = 1e3) {
|
|
43109
|
-
if (started) return;
|
|
43110
|
-
started = true;
|
|
43111
|
-
let last = Date.now();
|
|
43112
|
-
const timer = setInterval(() => {
|
|
43113
|
-
const now = Date.now();
|
|
43114
|
-
const lag = now - last - HEARTBEAT_MS;
|
|
43115
|
-
if (lag > thresholdMs) {
|
|
43116
|
-
console.warn(`[loop-lag] event loop held ~${(lag / 1e3).toFixed(1)}s during "${currentPass}"`);
|
|
43117
|
-
}
|
|
43118
|
-
last = now;
|
|
43119
|
-
}, HEARTBEAT_MS);
|
|
43120
|
-
timer.unref();
|
|
43121
|
-
}
|
|
43122
|
-
|
|
43123
43189
|
// src/multi.ts
|
|
43124
43190
|
init_paths();
|
|
43125
43191
|
|
|
@@ -44334,6 +44400,7 @@ async function cmdStart() {
|
|
|
44334
44400
|
const up = await waitForDaemon(globalDaemonLock(), 12e3);
|
|
44335
44401
|
if (up) {
|
|
44336
44402
|
console.log(` daemon: running \xB7 pid ${up.pid} \xB7 ${up.webUiUrl ?? "(running)"}`);
|
|
44403
|
+
console.log(` logs: ${daemonLogPath()}`);
|
|
44337
44404
|
console.log(` watch it: errata dash \xB7 check it: errata status`);
|
|
44338
44405
|
} else {
|
|
44339
44406
|
console.log(` \u26A0 daemon did not come up within 12s.`);
|
|
@@ -45309,12 +45376,23 @@ function selfArgv(sub) {
|
|
|
45309
45376
|
}
|
|
45310
45377
|
function spawnDaemonDetached() {
|
|
45311
45378
|
const { cmd: cmd2, args: args2 } = selfArgv("dash");
|
|
45379
|
+
let out2 = "ignore";
|
|
45380
|
+
try {
|
|
45381
|
+
const logPath = daemonLogPath();
|
|
45382
|
+
try {
|
|
45383
|
+
if (statSync5(logPath).size > 5 * 1024 * 1024) renameSync3(logPath, `${logPath}.1`);
|
|
45384
|
+
} catch {
|
|
45385
|
+
}
|
|
45386
|
+
out2 = openSync2(logPath, "a");
|
|
45387
|
+
} catch {
|
|
45388
|
+
}
|
|
45312
45389
|
spawn3(cmd2, args2, {
|
|
45313
45390
|
detached: true,
|
|
45314
|
-
stdio: "ignore",
|
|
45391
|
+
stdio: ["ignore", out2, out2],
|
|
45315
45392
|
windowsHide: true,
|
|
45316
45393
|
cwd: ROOT
|
|
45317
45394
|
}).unref();
|
|
45395
|
+
if (out2 !== "ignore") closeSync2(out2);
|
|
45318
45396
|
}
|
|
45319
45397
|
function ensureSingletonRunning() {
|
|
45320
45398
|
try {
|
package/package.json
CHANGED
package/pass-worker.mjs
CHANGED
|
@@ -15395,7 +15395,7 @@ var init_identity2 = __esm({
|
|
|
15395
15395
|
// ../../packages/indexer/src/pipeline.ts
|
|
15396
15396
|
import { appendFileSync, readFileSync, statSync } from "node:fs";
|
|
15397
15397
|
import { readdir } from "node:fs/promises";
|
|
15398
|
-
import { extname, join
|
|
15398
|
+
import { extname, join, relative, sep } from "node:path";
|
|
15399
15399
|
import { createHash as createHash2 } from "node:crypto";
|
|
15400
15400
|
import { execFileSync } from "node:child_process";
|
|
15401
15401
|
function nowTs() {
|
|
@@ -15511,7 +15511,7 @@ async function incrementalReindex(store2, rootPath, workspaceId, changedAbsPaths
|
|
|
15511
15511
|
for (const rel of [...changedRelPaths]) {
|
|
15512
15512
|
let h;
|
|
15513
15513
|
try {
|
|
15514
|
-
h = createHash2("sha256").update(readFileSync(
|
|
15514
|
+
h = createHash2("sha256").update(readFileSync(join(rootPath, rel))).digest("hex");
|
|
15515
15515
|
} catch {
|
|
15516
15516
|
continue;
|
|
15517
15517
|
}
|
|
@@ -15555,8 +15555,10 @@ async function incrementalReindex(store2, rootPath, workspaceId, changedAbsPaths
|
|
|
15555
15555
|
});
|
|
15556
15556
|
}
|
|
15557
15557
|
const after = /* @__PURE__ */ new Map();
|
|
15558
|
+
let parsedFiles = 0;
|
|
15558
15559
|
for (const rel of changedRelPaths) {
|
|
15559
|
-
|
|
15560
|
+
if (parsedFiles++ > 0) await new Promise((r2) => setImmediate(r2));
|
|
15561
|
+
const abs = join(rootPath, ...rel.split("/"));
|
|
15560
15562
|
const ext = extname(abs).toLowerCase();
|
|
15561
15563
|
const provider = providers.find((p) => p.fileExtensions.includes(ext));
|
|
15562
15564
|
if (!provider) continue;
|
|
@@ -15879,8 +15881,8 @@ async function runIndexer(store2, opts) {
|
|
|
15879
15881
|
if (reExports.length > 0) reExportsByFile.set(f.relPath, reExports);
|
|
15880
15882
|
report.filesParsed++;
|
|
15881
15883
|
report.byLanguage[f.provider.id] = (report.byLanguage[f.provider.id] ?? 0) + 1;
|
|
15882
|
-
if (report.filesParsed % 250 === 0) {
|
|
15883
|
-
|
|
15884
|
+
if (report.filesParsed % 250 === 0) perf(`parse @ ${report.filesParsed}/${files.length}`);
|
|
15885
|
+
if (report.filesParsed % 25 === 0) {
|
|
15884
15886
|
await new Promise((r) => setImmediate(r));
|
|
15885
15887
|
}
|
|
15886
15888
|
}
|
|
@@ -16042,7 +16044,12 @@ async function runIndexer(store2, opts) {
|
|
|
16042
16044
|
const pendingEdges = [];
|
|
16043
16045
|
perf("index-build (exports/imports/workspace-pkgs/re-export-fixpoint)");
|
|
16044
16046
|
const providerByRel = new Map(files.map((x) => [x.relPath, x.provider]));
|
|
16047
|
+
let emittedFiles = 0;
|
|
16045
16048
|
for (const [relPath, symbols] of symbolsByFile) {
|
|
16049
|
+
if (emittedFiles > 0 && emittedFiles % 50 === 0) {
|
|
16050
|
+
await new Promise((r) => setImmediate(r));
|
|
16051
|
+
}
|
|
16052
|
+
emittedFiles++;
|
|
16046
16053
|
store2.transaction(() => {
|
|
16047
16054
|
const fileId = fileNodeId(opts.workspaceId, relPath);
|
|
16048
16055
|
const langProvider = providerByRel.get(relPath);
|
|
@@ -16237,6 +16244,7 @@ async function runIndexer(store2, opts) {
|
|
|
16237
16244
|
if (pendingEdges.length > 0) {
|
|
16238
16245
|
const EDGE_BATCH = 5e3;
|
|
16239
16246
|
for (let ei = 0; ei < pendingEdges.length; ei += EDGE_BATCH) {
|
|
16247
|
+
if (ei > 0) await new Promise((r) => setImmediate(r));
|
|
16240
16248
|
const slice = pendingEdges.slice(ei, ei + EDGE_BATCH);
|
|
16241
16249
|
store2.transaction(() => {
|
|
16242
16250
|
for (const e of slice) {
|
|
@@ -16290,7 +16298,7 @@ async function scan(root, current, ignores, providers, out2) {
|
|
|
16290
16298
|
for (const ent of entries) {
|
|
16291
16299
|
if (ignores.has(ent.name)) continue;
|
|
16292
16300
|
if (ent.name.startsWith(".") && ent.name !== ".") continue;
|
|
16293
|
-
const abs =
|
|
16301
|
+
const abs = join(current, ent.name);
|
|
16294
16302
|
if (ent.isDirectory()) {
|
|
16295
16303
|
await scan(root, abs, ignores, providers, out2);
|
|
16296
16304
|
} else if (ent.isFile()) {
|
|
@@ -16336,7 +16344,7 @@ function gitListFiles(root, ignores, providers) {
|
|
|
16336
16344
|
if (segs.some((s) => ignores.has(s) || s.startsWith(".") && s.length > 1)) {
|
|
16337
16345
|
continue;
|
|
16338
16346
|
}
|
|
16339
|
-
const abs =
|
|
16347
|
+
const abs = join(root, rel);
|
|
16340
16348
|
let size;
|
|
16341
16349
|
try {
|
|
16342
16350
|
size = statSync(abs).size;
|
|
@@ -20721,42 +20729,42 @@ ${JSON.stringify(symbolNames, null, 2)}`);
|
|
|
20721
20729
|
|
|
20722
20730
|
// ../../packages/indexer/src/languages/tree-sitter-loader.ts
|
|
20723
20731
|
import { fileURLToPath } from "node:url";
|
|
20724
|
-
import { dirname
|
|
20732
|
+
import { dirname, join as join2 } from "node:path";
|
|
20725
20733
|
import { existsSync, readdirSync } from "node:fs";
|
|
20726
20734
|
import { createRequire } from "node:module";
|
|
20727
20735
|
function entryDir() {
|
|
20728
20736
|
try {
|
|
20729
20737
|
const url2 = import.meta?.url;
|
|
20730
20738
|
if (typeof url2 === "string" && url2.length > 0) {
|
|
20731
|
-
return
|
|
20739
|
+
return dirname(fileURLToPath(url2));
|
|
20732
20740
|
}
|
|
20733
20741
|
} catch {
|
|
20734
20742
|
}
|
|
20735
|
-
return
|
|
20743
|
+
return dirname(process.execPath);
|
|
20736
20744
|
}
|
|
20737
20745
|
function findWasmDir() {
|
|
20738
20746
|
const here = entryDir();
|
|
20739
|
-
const seaWasm =
|
|
20740
|
-
if (existsSync(
|
|
20747
|
+
const seaWasm = join2(here, "resources", "wasm");
|
|
20748
|
+
if (existsSync(join2(seaWasm, "tree-sitter-typescript.wasm"))) return seaWasm;
|
|
20741
20749
|
let dir = here;
|
|
20742
20750
|
for (let i2 = 0; i2 < 6; i2++) {
|
|
20743
|
-
const flat =
|
|
20751
|
+
const flat = join2(
|
|
20744
20752
|
dir,
|
|
20745
20753
|
"node_modules",
|
|
20746
20754
|
"@vscode",
|
|
20747
20755
|
"tree-sitter-wasm",
|
|
20748
20756
|
"wasm"
|
|
20749
20757
|
);
|
|
20750
|
-
if (existsSync(
|
|
20751
|
-
dir =
|
|
20758
|
+
if (existsSync(join2(flat, "tree-sitter-typescript.wasm"))) return flat;
|
|
20759
|
+
dir = dirname(dir);
|
|
20752
20760
|
}
|
|
20753
20761
|
let root = here;
|
|
20754
20762
|
for (let i2 = 0; i2 < 6; i2++) {
|
|
20755
|
-
const pnpmDir =
|
|
20763
|
+
const pnpmDir = join2(root, "node_modules", ".pnpm");
|
|
20756
20764
|
if (existsSync(pnpmDir)) {
|
|
20757
20765
|
for (const entry of readdirSync(pnpmDir)) {
|
|
20758
20766
|
if (entry.startsWith("@vscode+tree-sitter-wasm@")) {
|
|
20759
|
-
const candidate =
|
|
20767
|
+
const candidate = join2(
|
|
20760
20768
|
pnpmDir,
|
|
20761
20769
|
entry,
|
|
20762
20770
|
"node_modules",
|
|
@@ -20764,13 +20772,13 @@ function findWasmDir() {
|
|
|
20764
20772
|
"tree-sitter-wasm",
|
|
20765
20773
|
"wasm"
|
|
20766
20774
|
);
|
|
20767
|
-
if (existsSync(
|
|
20775
|
+
if (existsSync(join2(candidate, "tree-sitter-typescript.wasm"))) {
|
|
20768
20776
|
return candidate;
|
|
20769
20777
|
}
|
|
20770
20778
|
}
|
|
20771
20779
|
}
|
|
20772
20780
|
}
|
|
20773
|
-
root =
|
|
20781
|
+
root = dirname(root);
|
|
20774
20782
|
}
|
|
20775
20783
|
throw new Error(
|
|
20776
20784
|
"@vscode/tree-sitter-wasm grammar files not found \u2014 is the package installed?"
|
|
@@ -20778,33 +20786,33 @@ function findWasmDir() {
|
|
|
20778
20786
|
}
|
|
20779
20787
|
function findRuntimeDir() {
|
|
20780
20788
|
const here = entryDir();
|
|
20781
|
-
const seaRuntime =
|
|
20782
|
-
if (existsSync(
|
|
20789
|
+
const seaRuntime = join2(here, "resources", "wasm");
|
|
20790
|
+
if (existsSync(join2(seaRuntime, "web-tree-sitter.wasm"))) return seaRuntime;
|
|
20783
20791
|
let dir = here;
|
|
20784
20792
|
for (let i2 = 0; i2 < 6; i2++) {
|
|
20785
|
-
const flat =
|
|
20786
|
-
if (existsSync(
|
|
20787
|
-
dir =
|
|
20793
|
+
const flat = join2(dir, "node_modules", "web-tree-sitter");
|
|
20794
|
+
if (existsSync(join2(flat, "web-tree-sitter.wasm"))) return flat;
|
|
20795
|
+
dir = dirname(dir);
|
|
20788
20796
|
}
|
|
20789
20797
|
let root = here;
|
|
20790
20798
|
for (let i2 = 0; i2 < 6; i2++) {
|
|
20791
|
-
const pnpmDir =
|
|
20799
|
+
const pnpmDir = join2(root, "node_modules", ".pnpm");
|
|
20792
20800
|
if (existsSync(pnpmDir)) {
|
|
20793
20801
|
for (const entry of readdirSync(pnpmDir)) {
|
|
20794
20802
|
if (entry.startsWith("web-tree-sitter@")) {
|
|
20795
|
-
const candidate =
|
|
20803
|
+
const candidate = join2(
|
|
20796
20804
|
pnpmDir,
|
|
20797
20805
|
entry,
|
|
20798
20806
|
"node_modules",
|
|
20799
20807
|
"web-tree-sitter"
|
|
20800
20808
|
);
|
|
20801
|
-
if (existsSync(
|
|
20809
|
+
if (existsSync(join2(candidate, "web-tree-sitter.wasm"))) {
|
|
20802
20810
|
return candidate;
|
|
20803
20811
|
}
|
|
20804
20812
|
}
|
|
20805
20813
|
}
|
|
20806
20814
|
}
|
|
20807
|
-
root =
|
|
20815
|
+
root = dirname(root);
|
|
20808
20816
|
}
|
|
20809
20817
|
throw new Error("web-tree-sitter runtime WASM not found");
|
|
20810
20818
|
}
|
|
@@ -20815,7 +20823,7 @@ async function loadWebTreeSitter() {
|
|
|
20815
20823
|
void err2;
|
|
20816
20824
|
}
|
|
20817
20825
|
const here = entryDir();
|
|
20818
|
-
const seaResourceBase =
|
|
20826
|
+
const seaResourceBase = join2(here, "resources", "_resolve.js");
|
|
20819
20827
|
const resourceRequire = createRequire(seaResourceBase);
|
|
20820
20828
|
return resourceRequire("web-tree-sitter");
|
|
20821
20829
|
}
|
|
@@ -20830,9 +20838,9 @@ async function ensureTreeSitterReady() {
|
|
|
20830
20838
|
await Parser2.init({
|
|
20831
20839
|
locateFile: (name2) => {
|
|
20832
20840
|
if (name2 === "tree-sitter.wasm" || name2 === "web-tree-sitter.wasm") {
|
|
20833
|
-
return
|
|
20841
|
+
return join2(runtime, name2);
|
|
20834
20842
|
}
|
|
20835
|
-
return
|
|
20843
|
+
return join2(grammars, name2);
|
|
20836
20844
|
}
|
|
20837
20845
|
});
|
|
20838
20846
|
})();
|
|
@@ -20844,7 +20852,7 @@ async function loadGrammar(name2) {
|
|
|
20844
20852
|
if (cached2) return cached2;
|
|
20845
20853
|
if (!languageClass) throw new Error("tree-sitter not initialized");
|
|
20846
20854
|
const grammars = findWasmDir();
|
|
20847
|
-
const lang = await languageClass.load(
|
|
20855
|
+
const lang = await languageClass.load(join2(grammars, `${name2}.wasm`));
|
|
20848
20856
|
grammarCache.set(name2, lang);
|
|
20849
20857
|
return lang;
|
|
20850
20858
|
}
|
|
@@ -25707,6 +25715,9 @@ function fileOf(store2, nodeId) {
|
|
|
25707
25715
|
// ../../packages/context-writer/src/select-durable-memory.ts
|
|
25708
25716
|
init_src2();
|
|
25709
25717
|
|
|
25718
|
+
// src/pass-worker.ts
|
|
25719
|
+
init_src3();
|
|
25720
|
+
|
|
25710
25721
|
// ../../node_modules/.pnpm/env-paths@3.0.0/node_modules/env-paths/index.js
|
|
25711
25722
|
import os from "node:os";
|
|
25712
25723
|
import process3 from "node:process";
|
|
@@ -25715,24 +25726,24 @@ var tmpdir = os.tmpdir();
|
|
|
25715
25726
|
var { env } = process3;
|
|
25716
25727
|
|
|
25717
25728
|
// src/paths.ts
|
|
25718
|
-
import { dirname, join } from "node:path";
|
|
25729
|
+
import { dirname as dirname2, join as join3 } from "node:path";
|
|
25719
25730
|
function workspaceDir(workspaceRoot) {
|
|
25720
|
-
return
|
|
25731
|
+
return join3(workspaceRoot, ".errata");
|
|
25721
25732
|
}
|
|
25722
25733
|
function workspacePaths(root) {
|
|
25723
25734
|
const dir = workspaceDir(root);
|
|
25724
25735
|
return {
|
|
25725
25736
|
root,
|
|
25726
25737
|
configDir: dir,
|
|
25727
|
-
workspaceJson:
|
|
25728
|
-
eventLog:
|
|
25729
|
-
castalia:
|
|
25730
|
-
reviewQueue:
|
|
25731
|
-
outbox:
|
|
25732
|
-
daemonLock:
|
|
25733
|
-
identityAudit:
|
|
25734
|
-
skillsDir:
|
|
25735
|
-
skillsManifest:
|
|
25738
|
+
workspaceJson: join3(dir, "workspace.json"),
|
|
25739
|
+
eventLog: join3(dir, "eventlog.sqlite"),
|
|
25740
|
+
castalia: join3(dir, "castalia.db"),
|
|
25741
|
+
reviewQueue: join3(dir, "review-queue.json"),
|
|
25742
|
+
outbox: join3(dir, "outbox"),
|
|
25743
|
+
daemonLock: join3(dir, "daemon.lock"),
|
|
25744
|
+
identityAudit: join3(dir, "identity-audit.log"),
|
|
25745
|
+
skillsDir: join3(dir, "skills"),
|
|
25746
|
+
skillsManifest: join3(dir, "skills.json")
|
|
25736
25747
|
};
|
|
25737
25748
|
}
|
|
25738
25749
|
|
|
@@ -25851,10 +25862,20 @@ function runPass(msg) {
|
|
|
25851
25862
|
...p.skills !== void 0 ? { skills: p.skills } : {}
|
|
25852
25863
|
});
|
|
25853
25864
|
}
|
|
25865
|
+
case "reindex":
|
|
25866
|
+
return runReindex(msg.payload);
|
|
25854
25867
|
default:
|
|
25855
25868
|
throw new Error(`pass-worker: unknown pass "${msg.kind}"`);
|
|
25856
25869
|
}
|
|
25857
25870
|
}
|
|
25871
|
+
async function runReindex(p) {
|
|
25872
|
+
const identityEvaluations = [];
|
|
25873
|
+
const r = await incrementalReindex(store, init2.workspaceRoot, init2.workspaceId, p.changedAbsPaths, p.t, {
|
|
25874
|
+
onIdentityEvaluate: (e) => identityEvaluations.push(e),
|
|
25875
|
+
...p.declaredRenames !== void 0 ? { declaredRenames: p.declaredRenames } : {}
|
|
25876
|
+
});
|
|
25877
|
+
return { ...r, identityEvaluations };
|
|
25878
|
+
}
|
|
25858
25879
|
function runNightly() {
|
|
25859
25880
|
const report = runNightlyPipeline(store);
|
|
25860
25881
|
let merged = 0;
|