@inerrata-corporation/errata 2.0.6-dev.2602 → 2.0.6-dev.2611
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 +63 -25
- package/package.json +1 -1
- package/pass-worker.mjs +7 -0
package/errata.mjs
CHANGED
|
@@ -76032,6 +76032,10 @@ var PassWorker = class {
|
|
|
76032
76032
|
reindex(opts) {
|
|
76033
76033
|
return this.call("reindex", opts);
|
|
76034
76034
|
}
|
|
76035
|
+
/** Run a full-scope `runIndexer` on the worker (workspace wake, `errata reindex`). */
|
|
76036
|
+
fullIndex(opts) {
|
|
76037
|
+
return this.call("fullIndex", opts);
|
|
76038
|
+
}
|
|
76035
76039
|
call(kind, payload) {
|
|
76036
76040
|
if (this.stopped) return Promise.reject(new Error("pass worker stopped"));
|
|
76037
76041
|
return withHeavyPassSlot(`${kind}:${this.init.workspaceId}`, async () => {
|
|
@@ -78417,7 +78421,7 @@ function createWatchBreaker(deps) {
|
|
|
78417
78421
|
}
|
|
78418
78422
|
|
|
78419
78423
|
// src/engine.ts
|
|
78420
|
-
var DAEMON_VERSION = true ? "2.0.6-dev.
|
|
78424
|
+
var DAEMON_VERSION = true ? "2.0.6-dev.2611" : "2.0.0-alpha.0";
|
|
78421
78425
|
var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
|
|
78422
78426
|
var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
|
|
78423
78427
|
var GIT_OP_MUTE_MS = 4e3;
|
|
@@ -79035,6 +79039,33 @@ function createWorkspaceEngine(opts) {
|
|
|
79035
79039
|
intentRemoteInFlight = false;
|
|
79036
79040
|
});
|
|
79037
79041
|
};
|
|
79042
|
+
const runFullIndex = async (clean) => {
|
|
79043
|
+
if (passWorker) {
|
|
79044
|
+
try {
|
|
79045
|
+
return await passWorker.fullIndex({ clean });
|
|
79046
|
+
} catch (err2) {
|
|
79047
|
+
if (isWorkerOom(err2)) {
|
|
79048
|
+
console.warn("[errata] full-reindex worker hit its heap ceiling \u2014 pass skipped");
|
|
79049
|
+
throw new Error("full reindex skipped: pass worker hit its heap ceiling");
|
|
79050
|
+
}
|
|
79051
|
+
console.warn(
|
|
79052
|
+
"[errata] full-reindex worker unavailable, running inline:",
|
|
79053
|
+
err2 instanceof Error ? err2.message : err2
|
|
79054
|
+
);
|
|
79055
|
+
}
|
|
79056
|
+
}
|
|
79057
|
+
const done = markPass(`reindex-inline:${profile.name}`);
|
|
79058
|
+
try {
|
|
79059
|
+
return await runIndexer(store, {
|
|
79060
|
+
workspaceId: profile.id,
|
|
79061
|
+
rootPath: opts.workspaceRoot,
|
|
79062
|
+
providers: defaultProviders(),
|
|
79063
|
+
clean
|
|
79064
|
+
});
|
|
79065
|
+
} finally {
|
|
79066
|
+
done();
|
|
79067
|
+
}
|
|
79068
|
+
};
|
|
79038
79069
|
const runNightly = async () => {
|
|
79039
79070
|
if (passWorker) {
|
|
79040
79071
|
try {
|
|
@@ -80518,8 +80549,10 @@ B: ${b}`,
|
|
|
80518
80549
|
return report;
|
|
80519
80550
|
},
|
|
80520
80551
|
async embedSettled() {
|
|
80552
|
+
const yieldLoop = () => new Promise((r) => setImmediate(r));
|
|
80521
80553
|
try {
|
|
80522
80554
|
const sem = await embedSemanticNodes(store);
|
|
80555
|
+
await yieldLoop();
|
|
80523
80556
|
if (sem.embedded > 0) {
|
|
80524
80557
|
console.log(`[errata] embedded ${sem.embedded} semantic node(s)`);
|
|
80525
80558
|
}
|
|
@@ -80532,6 +80565,7 @@ B: ${b}`,
|
|
|
80532
80565
|
if (e.merged > 0 || (e.nearMissMarked ?? 0) > 0) {
|
|
80533
80566
|
console.log(`[errata] dedup: merged ${e.merged} paraphrased problem(s) across ${e.clusters} cluster(s), parked ${e.nearMissMarked ?? 0} near-miss nomination(s)${parkWmRaw === null ? " (first full sweep)" : ""}`);
|
|
80534
80567
|
}
|
|
80568
|
+
await yieldLoop();
|
|
80535
80569
|
if (sem.embedded > 0) {
|
|
80536
80570
|
const cb = bindCanonicalNeighbors(store, { ts: Date.now() });
|
|
80537
80571
|
if (cb.bound > 0) {
|
|
@@ -80539,11 +80573,13 @@ B: ${b}`,
|
|
|
80539
80573
|
}
|
|
80540
80574
|
refreshContextNow();
|
|
80541
80575
|
}
|
|
80576
|
+
await yieldLoop();
|
|
80542
80577
|
const rg = bindResolvedRegressions(store, { ts: Date.now() });
|
|
80543
80578
|
if (rg.bound > 0) {
|
|
80544
80579
|
console.warn(`[errata] REGRESSION: bound ${rg.bound} open problem(s) to resolved predecessors${rg.full ? " (first full sweep)" : ""}`);
|
|
80545
80580
|
refreshContextNow();
|
|
80546
80581
|
}
|
|
80582
|
+
await yieldLoop();
|
|
80547
80583
|
const fjStart = Date.now();
|
|
80548
80584
|
const fj = await resolveFoldCandidates(store, {
|
|
80549
80585
|
ts: fjStart,
|
|
@@ -80578,12 +80614,7 @@ B: ${b}`,
|
|
|
80578
80614
|
if (!reindexOpts?.quiet) {
|
|
80579
80615
|
notifyEvent("index-started", `Indexing ${profile.name}\u2026`, { key: profile.id });
|
|
80580
80616
|
}
|
|
80581
|
-
const r = await
|
|
80582
|
-
workspaceId: profile.id,
|
|
80583
|
-
rootPath: opts.workspaceRoot,
|
|
80584
|
-
providers: defaultProviders(),
|
|
80585
|
-
clean: reindexOpts?.clean ?? false
|
|
80586
|
-
});
|
|
80617
|
+
const r = await runFullIndex(reindexOpts?.clean ?? false);
|
|
80587
80618
|
const { report: nightly, localSkills } = await runNightly();
|
|
80588
80619
|
let embeddedCodeNodes = 0;
|
|
80589
80620
|
let embedMs = 0;
|
|
@@ -81929,7 +81960,7 @@ function compareVersions(a, b) {
|
|
|
81929
81960
|
}
|
|
81930
81961
|
return 0;
|
|
81931
81962
|
}
|
|
81932
|
-
async function
|
|
81963
|
+
async function lookupPublished(channel, timeoutMs = 4e3) {
|
|
81933
81964
|
const ctrl = new AbortController();
|
|
81934
81965
|
const timer = setTimeout(() => ctrl.abort(), timeoutMs);
|
|
81935
81966
|
try {
|
|
@@ -81937,17 +81968,23 @@ async function latestPublished(channel, timeoutMs = 4e3) {
|
|
|
81937
81968
|
headers: { accept: "application/vnd.npm.install-v1+json" },
|
|
81938
81969
|
signal: ctrl.signal
|
|
81939
81970
|
});
|
|
81940
|
-
if (!res.ok) return
|
|
81971
|
+
if (!res.ok) return { error: `http ${res.status}` };
|
|
81941
81972
|
const body2 = await res.json();
|
|
81942
|
-
|
|
81973
|
+
const version2 = body2["dist-tags"]?.[channel];
|
|
81974
|
+
return version2 ? { version: version2 } : { error: "no-tag" };
|
|
81943
81975
|
} catch {
|
|
81944
|
-
return
|
|
81976
|
+
return { error: ctrl.signal.aborted ? "timeout" : "unreachable" };
|
|
81945
81977
|
} finally {
|
|
81946
81978
|
clearTimeout(timer);
|
|
81947
81979
|
}
|
|
81948
81980
|
}
|
|
81949
|
-
async function checkForUpdate(channel) {
|
|
81950
|
-
|
|
81981
|
+
async function checkForUpdate(channel, opts = {}) {
|
|
81982
|
+
let lookup = { error: "unreachable" };
|
|
81983
|
+
for (let i2 = 0; i2 < Math.max(1, opts.attempts ?? 1); i2++) {
|
|
81984
|
+
lookup = await lookupPublished(channel, opts.timeoutMs ?? 4e3);
|
|
81985
|
+
if ("version" in lookup || lookup.error !== "timeout" && lookup.error !== "unreachable") break;
|
|
81986
|
+
}
|
|
81987
|
+
const latest = "version" in lookup ? lookup.version : null;
|
|
81951
81988
|
const direction = latest === null ? 0 : compareVersions(latest, DAEMON_VERSION);
|
|
81952
81989
|
return {
|
|
81953
81990
|
current: DAEMON_VERSION,
|
|
@@ -81955,7 +81992,8 @@ async function checkForUpdate(channel) {
|
|
|
81955
81992
|
// `compareVersions` returns 0 for unparseable input, so an unrecognizable tag
|
|
81956
81993
|
// is treated as "nothing to do" rather than gambling on a direction.
|
|
81957
81994
|
updateAvailable: latest !== null && direction > 0,
|
|
81958
|
-
downgradeAvailable: latest !== null && direction < 0
|
|
81995
|
+
downgradeAvailable: latest !== null && direction < 0,
|
|
81996
|
+
..."error" in lookup ? { lookupError: lookup.error } : {}
|
|
81959
81997
|
};
|
|
81960
81998
|
}
|
|
81961
81999
|
function pendingFromServerVerdict(latest, channel, current = DAEMON_VERSION) {
|
|
@@ -88023,10 +88061,11 @@ async function cmdUpdate(args2) {
|
|
|
88023
88061
|
saveConfig({ ...cfg, updateChannel: channel });
|
|
88024
88062
|
console.log(`update channel set to '${channel}'`);
|
|
88025
88063
|
}
|
|
88026
|
-
const status = await checkForUpdate(channel);
|
|
88064
|
+
const status = await checkForUpdate(channel, { timeoutMs: 15e3, attempts: 2 });
|
|
88027
88065
|
if (status.latest === null) {
|
|
88066
|
+
const why = status.lookupError;
|
|
88028
88067
|
console.log(
|
|
88029
|
-
`no published build found on channel '${channel}' (
|
|
88068
|
+
why === "no-tag" ? `no published build found on channel '${channel}'. current: ${status.current}` : why === "timeout" ? `the npm registry did not answer within 15s (tried twice), so channel '${channel}' could not be checked; nothing was changed. Retry, or check your network. current: ${status.current}` : `could not reach the npm registry (${why ?? "unreachable"}), so channel '${channel}' could not be checked; nothing was changed. current: ${status.current}`
|
|
88030
88069
|
);
|
|
88031
88070
|
return;
|
|
88032
88071
|
}
|
|
@@ -89835,7 +89874,7 @@ async function cmdDash(args2) {
|
|
|
89835
89874
|
let triggerConsolidation = () => {
|
|
89836
89875
|
};
|
|
89837
89876
|
const runBoundaryFlush = (reason) => {
|
|
89838
|
-
|
|
89877
|
+
return handle2.sessionBoundaryFlush().then((r) => {
|
|
89839
89878
|
if (r.skipped) return;
|
|
89840
89879
|
if (r.uploaded > 0 || r.written > 0 || r.pruned > 0) {
|
|
89841
89880
|
console.log(
|
|
@@ -89869,16 +89908,15 @@ async function cmdDash(args2) {
|
|
|
89869
89908
|
if (quiesceTimer) clearTimeout(quiesceTimer);
|
|
89870
89909
|
quiesceTimer = setTimeout(() => {
|
|
89871
89910
|
quiesceTimer = null;
|
|
89872
|
-
|
|
89873
|
-
runSemanticPass("quiescent");
|
|
89874
|
-
triggerConsolidation(false);
|
|
89911
|
+
settleThenConsolidate("quiescent", false);
|
|
89875
89912
|
}, QUIESCENCE_MS);
|
|
89876
89913
|
};
|
|
89877
|
-
|
|
89878
|
-
runBoundaryFlush(
|
|
89879
|
-
runSemanticPass(
|
|
89880
|
-
triggerConsolidation(
|
|
89881
|
-
}
|
|
89914
|
+
const settleThenConsolidate = (reason, force) => {
|
|
89915
|
+
const flushed = runBoundaryFlush(reason);
|
|
89916
|
+
setImmediate(() => runSemanticPass(reason));
|
|
89917
|
+
void flushed.finally(() => triggerConsolidation(force));
|
|
89918
|
+
};
|
|
89919
|
+
handle2.onSessionBoundary(() => settleThenConsolidate("session-end", true));
|
|
89882
89920
|
let ticking = false;
|
|
89883
89921
|
const interval = setInterval(() => {
|
|
89884
89922
|
if (ticking) return;
|
package/package.json
CHANGED
package/pass-worker.mjs
CHANGED
|
@@ -27544,6 +27544,13 @@ function runPass(msg) {
|
|
|
27544
27544
|
}
|
|
27545
27545
|
case "reindex":
|
|
27546
27546
|
return runReindex(msg.payload);
|
|
27547
|
+
case "fullIndex":
|
|
27548
|
+
return runIndexer(store, {
|
|
27549
|
+
workspaceId: init2.workspaceId,
|
|
27550
|
+
rootPath: init2.workspaceRoot,
|
|
27551
|
+
providers: defaultProviders(),
|
|
27552
|
+
clean: msg.payload?.clean ?? false
|
|
27553
|
+
});
|
|
27547
27554
|
default:
|
|
27548
27555
|
throw new Error(`pass-worker: unknown pass "${msg.kind}"`);
|
|
27549
27556
|
}
|