@inerrata-corporation/errata 2.0.2-dev.538 → 2.0.2-dev.540
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 +1 -1
- package/errata.mjs +122 -3
- package/package.json +1 -1
- package/pass-worker.mjs +1 -1
package/consolidate-worker.mjs
CHANGED
|
@@ -15614,7 +15614,7 @@ function openDatabase(path) {
|
|
|
15614
15614
|
return db.prepare(`PRAGMA ${key}`).get();
|
|
15615
15615
|
},
|
|
15616
15616
|
transaction(fn) {
|
|
15617
|
-
db.exec("BEGIN");
|
|
15617
|
+
db.exec("BEGIN IMMEDIATE");
|
|
15618
15618
|
try {
|
|
15619
15619
|
const r = fn();
|
|
15620
15620
|
db.exec("COMMIT");
|
package/errata.mjs
CHANGED
|
@@ -16434,7 +16434,7 @@ function openDatabase(path2) {
|
|
|
16434
16434
|
return db.prepare(`PRAGMA ${key}`).get();
|
|
16435
16435
|
},
|
|
16436
16436
|
transaction(fn) {
|
|
16437
|
-
db.exec("BEGIN");
|
|
16437
|
+
db.exec("BEGIN IMMEDIATE");
|
|
16438
16438
|
try {
|
|
16439
16439
|
const r = fn();
|
|
16440
16440
|
db.exec("COMMIT");
|
|
@@ -21991,6 +21991,23 @@ var init_mechanism_liveness = __esm({
|
|
|
21991
21991
|
// it is declared fed-by-liveness so the row exists and the pass is watched.
|
|
21992
21992
|
fed: { labels: ["File"], attr: "relPath", minFraction: 0.9 },
|
|
21993
21993
|
effectCounter: "reaped"
|
|
21994
|
+
},
|
|
21995
|
+
{
|
|
21996
|
+
id: "liveness-watch",
|
|
21997
|
+
what: "the daemon-side schedule of this very verdict \u2014 alarms when a mechanism stops working",
|
|
21998
|
+
// The watcher is itself a row: a probe that only runs when a human remembers
|
|
21999
|
+
// is how the original six defects shipped, and a scheduled watch that
|
|
22000
|
+
// silently stops running is the same failure one level up. Its `invoked …
|
|
22001
|
+
// ago` column is the reading that matters.
|
|
22002
|
+
pass: "liveness-watch",
|
|
22003
|
+
// It reads the pass LEDGER, not a node attribute; minFraction 0 makes the
|
|
22004
|
+
// fed gate structurally unfailable (the same "field written at all" bar as
|
|
22005
|
+
// revisit-sweep) so this row can only ever alarm on invocation.
|
|
22006
|
+
fed: { labels: ["Problem"], attr: "revisitReason", minFraction: 0 },
|
|
22007
|
+
// Alarms ARE its state transitions; zero on a healthy store, so the steady
|
|
22008
|
+
// reading is IDLE — correct, and it declares no backlog on purpose.
|
|
22009
|
+
effectCounter: "alarms",
|
|
22010
|
+
note: "steady-state IDLE is healthy; the row exists for its invocation age"
|
|
21994
22011
|
}
|
|
21995
22012
|
];
|
|
21996
22013
|
COLUMN_INPUTS = {
|
|
@@ -52540,6 +52557,50 @@ function appendPassLedger(configDir, kind, durationMs, counts) {
|
|
|
52540
52557
|
} catch {
|
|
52541
52558
|
}
|
|
52542
52559
|
}
|
|
52560
|
+
function readPassLedger(configDir) {
|
|
52561
|
+
const path2 = passLedgerPath(configDir);
|
|
52562
|
+
if (!existsSync15(path2)) return [];
|
|
52563
|
+
try {
|
|
52564
|
+
return readFileSync13(path2, "utf8").split("\n").filter(Boolean).map((l) => JSON.parse(l)).filter(
|
|
52565
|
+
(e) => typeof e?.ts === "number" && typeof e?.kind === "string" && typeof e?.durationMs === "number"
|
|
52566
|
+
).map((e) => ({ ...e, counts: e.counts ?? {} }));
|
|
52567
|
+
} catch {
|
|
52568
|
+
return [];
|
|
52569
|
+
}
|
|
52570
|
+
}
|
|
52571
|
+
function summarizePassLedger(configDir) {
|
|
52572
|
+
const out2 = /* @__PURE__ */ new Map();
|
|
52573
|
+
const firstTs = /* @__PURE__ */ new Map();
|
|
52574
|
+
for (const e of readPassLedger(configDir)) {
|
|
52575
|
+
const s = out2.get(e.kind) ?? {
|
|
52576
|
+
kind: e.kind,
|
|
52577
|
+
runs: 0,
|
|
52578
|
+
firstTs: Number.POSITIVE_INFINITY,
|
|
52579
|
+
lastTs: 0,
|
|
52580
|
+
lastDurationMs: 0,
|
|
52581
|
+
totals: {},
|
|
52582
|
+
firstTotals: {},
|
|
52583
|
+
lastTotals: {}
|
|
52584
|
+
};
|
|
52585
|
+
s.runs++;
|
|
52586
|
+
if (e.ts >= s.lastTs) {
|
|
52587
|
+
s.lastTs = e.ts;
|
|
52588
|
+
s.lastDurationMs = e.durationMs;
|
|
52589
|
+
s.lastTotals = { ...e.counts };
|
|
52590
|
+
}
|
|
52591
|
+
const seen = firstTs.get(e.kind);
|
|
52592
|
+
if (seen === void 0 || e.ts < seen) {
|
|
52593
|
+
firstTs.set(e.kind, e.ts);
|
|
52594
|
+
s.firstTs = e.ts;
|
|
52595
|
+
s.firstTotals = { ...e.counts };
|
|
52596
|
+
}
|
|
52597
|
+
for (const [k, v] of Object.entries(e.counts)) {
|
|
52598
|
+
if (typeof v === "number") s.totals[k] = (s.totals[k] ?? 0) + v;
|
|
52599
|
+
}
|
|
52600
|
+
out2.set(e.kind, s);
|
|
52601
|
+
}
|
|
52602
|
+
return out2;
|
|
52603
|
+
}
|
|
52543
52604
|
|
|
52544
52605
|
// src/episode.ts
|
|
52545
52606
|
init_src();
|
|
@@ -54129,7 +54190,8 @@ var TITLES = {
|
|
|
54129
54190
|
"problem-resolved": "Errata \xB7 resolved \u2713",
|
|
54130
54191
|
"hotspot-problem": "Errata \xB7 high-impact problem",
|
|
54131
54192
|
"index-started": "Errata \xB7 indexing\u2026",
|
|
54132
|
-
"index-completed": "Errata \xB7 index ready \u2713"
|
|
54193
|
+
"index-completed": "Errata \xB7 index ready \u2713",
|
|
54194
|
+
"mechanism-stalled": "Errata \xB7 a mechanism is not working"
|
|
54133
54195
|
};
|
|
54134
54196
|
var lastFired = /* @__PURE__ */ new Map();
|
|
54135
54197
|
var THROTTLE_MS = 3e4;
|
|
@@ -54177,6 +54239,54 @@ function maybeFlushDigests() {
|
|
|
54177
54239
|
}
|
|
54178
54240
|
}
|
|
54179
54241
|
|
|
54242
|
+
// src/liveness-watch.ts
|
|
54243
|
+
init_src5();
|
|
54244
|
+
var LIVENESS_WATCH_INTERVAL_MS = 60 * 60 * 1e3;
|
|
54245
|
+
var ALARM_RENOTIFY_MS = 24 * 60 * 60 * 1e3;
|
|
54246
|
+
function createLivenessWatch(deps) {
|
|
54247
|
+
let lastRunAt = 0;
|
|
54248
|
+
const lastAlarmedAt = /* @__PURE__ */ new Map();
|
|
54249
|
+
return {
|
|
54250
|
+
maybeRun(nowMs = Date.now()) {
|
|
54251
|
+
if (nowMs - lastRunAt < LIVENESS_WATCH_INTERVAL_MS) return null;
|
|
54252
|
+
lastRunAt = nowMs;
|
|
54253
|
+
try {
|
|
54254
|
+
const started2 = Date.now();
|
|
54255
|
+
const invocations = /* @__PURE__ */ new Map();
|
|
54256
|
+
for (const [kind, s] of summarizePassLedger(deps.configDir)) {
|
|
54257
|
+
invocations.set(kind, {
|
|
54258
|
+
lastTs: s.lastTs,
|
|
54259
|
+
firstTs: s.firstTs,
|
|
54260
|
+
runs: s.runs,
|
|
54261
|
+
totals: s.totals,
|
|
54262
|
+
firstTotals: s.firstTotals,
|
|
54263
|
+
lastTotals: s.lastTotals
|
|
54264
|
+
});
|
|
54265
|
+
}
|
|
54266
|
+
const rows = evaluateMechanisms(deps.store, invocations);
|
|
54267
|
+
const bad = rows.filter((r) => hasStarvedMechanism([r]));
|
|
54268
|
+
appendPassLedger(deps.configDir, "liveness-watch", Date.now() - started2, {
|
|
54269
|
+
mechanisms: rows.length,
|
|
54270
|
+
alarms: bad.length
|
|
54271
|
+
});
|
|
54272
|
+
if (bad.length > 0) {
|
|
54273
|
+
const lines = formatMechanismStatus(rows, nowMs);
|
|
54274
|
+
for (const r of bad) {
|
|
54275
|
+
const at = lastAlarmedAt.get(r.id) ?? 0;
|
|
54276
|
+
if (nowMs - at < ALARM_RENOTIFY_MS) continue;
|
|
54277
|
+
lastAlarmedAt.set(r.id, nowMs);
|
|
54278
|
+
const line = lines.find((l) => l.includes(r.id)) ?? `${r.verdict} ${r.id}`;
|
|
54279
|
+
deps.onAlarm(r.id, `${line.trim()} \u2014 ${r.what}`);
|
|
54280
|
+
}
|
|
54281
|
+
}
|
|
54282
|
+
return rows;
|
|
54283
|
+
} catch {
|
|
54284
|
+
return null;
|
|
54285
|
+
}
|
|
54286
|
+
}
|
|
54287
|
+
};
|
|
54288
|
+
}
|
|
54289
|
+
|
|
54180
54290
|
// src/loop-lag.ts
|
|
54181
54291
|
var HEARTBEAT_MS = 500;
|
|
54182
54292
|
var currentPass = "idle";
|
|
@@ -54206,7 +54316,7 @@ function startLoopLagMonitor(thresholdMs = 1e3) {
|
|
|
54206
54316
|
}
|
|
54207
54317
|
|
|
54208
54318
|
// src/engine.ts
|
|
54209
|
-
var DAEMON_VERSION = true ? "2.0.2-dev.
|
|
54319
|
+
var DAEMON_VERSION = true ? "2.0.2-dev.540" : "2.0.0-alpha.0";
|
|
54210
54320
|
var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
|
|
54211
54321
|
var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
|
|
54212
54322
|
var GIT_OP_MUTE_MS = 4e3;
|
|
@@ -54529,6 +54639,14 @@ function createWorkspaceEngine(opts) {
|
|
|
54529
54639
|
});
|
|
54530
54640
|
}
|
|
54531
54641
|
const workingFiles = createWorkingFileState();
|
|
54642
|
+
const livenessWatch = createLivenessWatch({
|
|
54643
|
+
configDir: paths.configDir,
|
|
54644
|
+
store,
|
|
54645
|
+
onAlarm: (id, line) => {
|
|
54646
|
+
console.warn(`[errata] mechanism not working: ${line}`);
|
|
54647
|
+
notifyEvent("mechanism-stalled", line, { key: id });
|
|
54648
|
+
}
|
|
54649
|
+
});
|
|
54532
54650
|
const intents = createIntentState();
|
|
54533
54651
|
const toolRuns = createToolRunState();
|
|
54534
54652
|
let ctxRefreshTimer = null;
|
|
@@ -55661,6 +55779,7 @@ function createWorkspaceEngine(opts) {
|
|
|
55661
55779
|
if (report.revisitsCleared > 0 || report.fixCandidatesSettled > 0 || report.designResolved > 0) {
|
|
55662
55780
|
refreshContextNow();
|
|
55663
55781
|
}
|
|
55782
|
+
livenessWatch.maybeRun();
|
|
55664
55783
|
return report;
|
|
55665
55784
|
},
|
|
55666
55785
|
async nightly() {
|
package/package.json
CHANGED
package/pass-worker.mjs
CHANGED
|
@@ -15471,7 +15471,7 @@ function openDatabase(path) {
|
|
|
15471
15471
|
return db.prepare(`PRAGMA ${key}`).get();
|
|
15472
15472
|
},
|
|
15473
15473
|
transaction(fn) {
|
|
15474
|
-
db.exec("BEGIN");
|
|
15474
|
+
db.exec("BEGIN IMMEDIATE");
|
|
15475
15475
|
try {
|
|
15476
15476
|
const r = fn();
|
|
15477
15477
|
db.exec("COMMIT");
|