@inerrata-corporation/errata 2.0.6-dev.2568 → 2.0.6-dev.2571

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.
Files changed (2) hide show
  1. package/errata.mjs +136 -108
  2. package/package.json +1 -1
package/errata.mjs CHANGED
@@ -20549,6 +20549,7 @@ function upgradeAnchorHints(store, workspaceId2, ts) {
20549
20549
  let upgraded = 0;
20550
20550
  let standing = 0;
20551
20551
  let unresolvable = 0;
20552
+ let blocked = 0;
20552
20553
  const filesByPath = /* @__PURE__ */ new Map();
20553
20554
  for (const f of store.findNodesByLabel("File")) {
20554
20555
  if (f.attrs["workspaceId"] && f.attrs["workspaceId"] !== workspaceId2) continue;
@@ -20571,9 +20572,11 @@ function upgradeAnchorHints(store, workspaceId2, ts) {
20571
20572
  consumeAnchorHint(store, p, ts);
20572
20573
  upgraded++;
20573
20574
  standing--;
20575
+ } else {
20576
+ blocked++;
20574
20577
  }
20575
20578
  }
20576
- return { upgraded, standing, unresolvable };
20579
+ return { upgraded, standing, unresolvable, blocked };
20577
20580
  }
20578
20581
  function resolveDesignProblemByStatement(store, statement, fixNote, t) {
20579
20582
  const problemId = identityId({ kind: "DesignProblem", statement });
@@ -23699,10 +23702,14 @@ var init_mechanism_liveness = __esm({
23699
23702
  // "the field exists at all", the revisit-sweep precedent.
23700
23703
  fed: { labels: ["Problem"], attr: "anchorHint", minFraction: 0 },
23701
23704
  effectCounter: "anchorHintsUpgraded",
23702
- // The standing hints ARE the queue — without the gauge, "found nothing"
23703
- // and "runs forever against work it can never clear" read identically.
23704
- backlogCounter: "anchorHintsStanding",
23705
- note: "drains as hinted files change; contentChangedAt is forward-only so the backlog moves with real edits"
23705
+ // The gauge is the work the mechanism CAN act on and didn't: hints whose file
23706
+ // changed after the hint yet never upgraded. `anchorHintsStanding` also
23707
+ // counts hints still waiting for their file to be edited — a queue that
23708
+ // drains on the user's schedule, which read STUCK over any quiet stretch
23709
+ // (2026-09-23: 71 standing, none edited, toasted daily). Standing stays in
23710
+ // the ledger as information; it just cannot declare a stall.
23711
+ backlogCounter: "anchorHintsBlocked",
23712
+ note: "a hint upgrades when its file is next edited; stuck means an edited file's hint failed to anchor"
23706
23713
  },
23707
23714
  {
23708
23715
  id: "fold-candidate-resolve",
@@ -71039,12 +71046,12 @@ var init_report_render = __esm({
71039
71046
 
71040
71047
  // src/cli.ts
71041
71048
  init_src6();
71042
- import { closeSync as closeSync2, existsSync as existsSync34, openSync as openSync2, readFileSync as readFileSync33, renameSync as renameSync4, statSync as statSync8 } from "node:fs";
71043
- import { join as join38, resolve as pathResolve2 } from "node:path";
71049
+ import { closeSync as closeSync2, existsSync as existsSync34, openSync as openSync2, readFileSync as readFileSync34, renameSync as renameSync4, statSync as statSync8 } from "node:fs";
71050
+ import { join as join39, resolve as pathResolve2 } from "node:path";
71044
71051
  import { spawn as spawn3 } from "node:child_process";
71045
71052
 
71046
71053
  // src/daemon.ts
71047
- import { existsSync as existsSync26, writeFileSync as writeFileSync21 } from "node:fs";
71054
+ import { existsSync as existsSync26, writeFileSync as writeFileSync22 } from "node:fs";
71048
71055
 
71049
71056
  // ../../node_modules/.pnpm/@hono+node-server@1.19.11_hono@4.12.8/node_modules/@hono/node-server/dist/index.mjs
71050
71057
  import { createServer as createServerHTTP } from "http";
@@ -71624,8 +71631,8 @@ init_config();
71624
71631
 
71625
71632
  // src/engine.ts
71626
71633
  import { execFileSync as execFileSync4 } from "node:child_process";
71627
- import { existsSync as existsSync25, statSync as statSync7, appendFileSync as appendFileSync4, readdirSync as readdirSync10, renameSync as renameSync3, readFileSync as readFileSync25, writeFileSync as writeFileSync20 } from "node:fs";
71628
- import { join as join30, relative as relative6, sep as sep4 } from "node:path";
71634
+ import { existsSync as existsSync25, statSync as statSync7, appendFileSync as appendFileSync4, readdirSync as readdirSync10, renameSync as renameSync3, readFileSync as readFileSync26, writeFileSync as writeFileSync21 } from "node:fs";
71635
+ import { join as join31, relative as relative6, sep as sep4 } from "node:path";
71629
71636
 
71630
71637
  // ../../node_modules/.pnpm/chokidar@4.0.3/node_modules/chokidar/esm/index.js
71631
71638
  import { stat as statcb } from "fs";
@@ -78076,6 +78083,8 @@ function maybeFlushDigests() {
78076
78083
 
78077
78084
  // src/liveness-watch.ts
78078
78085
  init_src5();
78086
+ import { readFileSync as readFileSync25, writeFileSync as writeFileSync20 } from "node:fs";
78087
+ import { join as join30 } from "node:path";
78079
78088
 
78080
78089
  // src/loop-lag.ts
78081
78090
  var HEARTBEAT_MS = 500;
@@ -78198,9 +78207,26 @@ function watchCensusLine(c = watchCensus(), now = Date.now()) {
78198
78207
  // src/liveness-watch.ts
78199
78208
  var LIVENESS_WATCH_INTERVAL_MS = 60 * 60 * 1e3;
78200
78209
  var ALARM_RENOTIFY_MS = 24 * 60 * 60 * 1e3;
78210
+ function alarmStatePath(configDir) {
78211
+ return join30(configDir, "liveness-alarms.json");
78212
+ }
78213
+ function loadAlarmState(configDir) {
78214
+ try {
78215
+ const raw2 = JSON.parse(readFileSync25(alarmStatePath(configDir), "utf8"));
78216
+ return new Map(Object.entries(raw2).filter((e) => typeof e[1] === "number"));
78217
+ } catch {
78218
+ return /* @__PURE__ */ new Map();
78219
+ }
78220
+ }
78221
+ function saveAlarmState(configDir, state) {
78222
+ try {
78223
+ writeFileSync20(alarmStatePath(configDir), JSON.stringify(Object.fromEntries(state)));
78224
+ } catch {
78225
+ }
78226
+ }
78201
78227
  function createLivenessWatch(deps) {
78202
78228
  let lastRunAt = 0;
78203
- const lastAlarmedAt = /* @__PURE__ */ new Map();
78229
+ const lastAlarmedAt = loadAlarmState(deps.configDir);
78204
78230
  return {
78205
78231
  maybeRun(nowMs = Date.now()) {
78206
78232
  if (nowMs - lastRunAt < LIVENESS_WATCH_INTERVAL_MS) return null;
@@ -78249,6 +78275,7 @@ function createLivenessWatch(deps) {
78249
78275
  const at = lastAlarmedAt.get(r.id) ?? 0;
78250
78276
  if (nowMs - at < ALARM_RENOTIFY_MS) continue;
78251
78277
  lastAlarmedAt.set(r.id, nowMs);
78278
+ saveAlarmState(deps.configDir, lastAlarmedAt);
78252
78279
  const line = lines.find((l) => l.includes(r.id)) ?? `${r.verdict} ${r.id}`;
78253
78280
  deps.onAlarm(r.id, `${line.trim()} \u2014 ${r.what}`);
78254
78281
  }
@@ -78362,7 +78389,7 @@ function createWatchBreaker(deps) {
78362
78389
  }
78363
78390
 
78364
78391
  // src/engine.ts
78365
- var DAEMON_VERSION = true ? "2.0.6-dev.2568" : "2.0.0-alpha.0";
78392
+ var DAEMON_VERSION = true ? "2.0.6-dev.2571" : "2.0.0-alpha.0";
78366
78393
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
78367
78394
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
78368
78395
  var GIT_OP_MUTE_MS = 4e3;
@@ -78383,7 +78410,7 @@ function appendIdentityAudit(path2, record2, line) {
78383
78410
  var yieldToLoop = () => new Promise((r) => setImmediate(r));
78384
78411
  function loadTurnCursors(path2) {
78385
78412
  try {
78386
- const raw2 = JSON.parse(readFileSync25(path2, "utf8"));
78413
+ const raw2 = JSON.parse(readFileSync26(path2, "utf8"));
78387
78414
  return new Map(
78388
78415
  Object.entries(raw2).map(([k, v]) => [k, typeof v === "string" ? v : String(v?.uuid ?? "")])
78389
78416
  );
@@ -78393,7 +78420,7 @@ function loadTurnCursors(path2) {
78393
78420
  }
78394
78421
  function loadTurnOffsets(path2) {
78395
78422
  try {
78396
- const raw2 = JSON.parse(readFileSync25(path2, "utf8"));
78423
+ const raw2 = JSON.parse(readFileSync26(path2, "utf8"));
78397
78424
  const out2 = /* @__PURE__ */ new Map();
78398
78425
  for (const [k, v] of Object.entries(raw2)) {
78399
78426
  const off = typeof v === "object" && v !== null ? v.offset : void 0;
@@ -78409,7 +78436,7 @@ function saveTurnCursors(path2, cursors, offsets) {
78409
78436
  const merged = {};
78410
78437
  for (const [k, uuid3] of cursors) merged[k] = { uuid: uuid3, offset: offsets.get(k) ?? 0 };
78411
78438
  for (const [k, offset] of offsets) if (!merged[k]) merged[k] = { uuid: "", offset };
78412
- writeFileSync20(path2, JSON.stringify(merged), "utf8");
78439
+ writeFileSync21(path2, JSON.stringify(merged), "utf8");
78413
78440
  } catch {
78414
78441
  }
78415
78442
  }
@@ -78431,7 +78458,7 @@ function gitSourceWatchTargets(root) {
78431
78458
  ["-C", root, "ls-files", "--others", "--ignored", "--exclude-standard", "--directory", "-z"],
78432
78459
  { encoding: "utf8", maxBuffer: 256 * 1024 * 1024, windowsHide: true, stdio: ["ignore", "pipe", "ignore"] }
78433
78460
  );
78434
- ignoredDirs = igOut.split("\0").filter(Boolean).map((d) => d.replace(/\/+$/, "")).filter((d) => !IGNORED_PATH.test(join30(root, d) + sep4));
78461
+ ignoredDirs = igOut.split("\0").filter(Boolean).map((d) => d.replace(/\/+$/, "")).filter((d) => !IGNORED_PATH.test(join31(root, d) + sep4));
78435
78462
  } catch {
78436
78463
  }
78437
78464
  const hasIgnoredChild = (dir) => ignoredDirs.some((ig) => ig.startsWith(dir + "/"));
@@ -78443,19 +78470,19 @@ function gitSourceWatchTargets(root) {
78443
78470
  if (!f.startsWith(prefix)) continue;
78444
78471
  const rest2 = f.slice(prefix.length);
78445
78472
  if (rest2.includes("/")) children.add(dir === "" ? rest2.slice(0, rest2.indexOf("/")) : dir + "/" + rest2.slice(0, rest2.indexOf("/")));
78446
- else targets.add(join30(root, f));
78473
+ else targets.add(join31(root, f));
78447
78474
  }
78448
78475
  for (const c of children) {
78449
- if (IGNORED_PATH.test(join30(root, c) + sep4)) continue;
78476
+ if (IGNORED_PATH.test(join31(root, c) + sep4)) continue;
78450
78477
  if (hasIgnoredChild(c)) addUnder(c);
78451
- else targets.add(join30(root, c));
78478
+ else targets.add(join31(root, c));
78452
78479
  }
78453
78480
  };
78454
78481
  addUnder("");
78455
78482
  if (targets.size > 0) return [...targets];
78456
78483
  } catch {
78457
78484
  }
78458
- return readdirSync10(root, { withFileTypes: true }).filter((e) => e.isDirectory() && !IGNORED_PATH.test(join30(root, String(e.name)) + sep4)).map((e) => join30(root, String(e.name)));
78485
+ return readdirSync10(root, { withFileTypes: true }).filter((e) => e.isDirectory() && !IGNORED_PATH.test(join31(root, String(e.name)) + sep4)).map((e) => join31(root, String(e.name)));
78459
78486
  }
78460
78487
  function createWorkspaceEngine(opts) {
78461
78488
  const paths = workspacePaths(opts.workspaceRoot);
@@ -78649,7 +78676,7 @@ function createWorkspaceEngine(opts) {
78649
78676
  const srcPaths = diff.changedPaths.filter((p) => /\.(ts|tsx|js|jsx|mjs|cjs|py)$/i.test(p));
78650
78677
  let episodeId2;
78651
78678
  if (srcPaths.length > 0) {
78652
- const abs = srcPaths.map((p) => join30(opts.workspaceRoot, p));
78679
+ const abs = srcPaths.map((p) => join31(opts.workspaceRoot, p));
78653
78680
  try {
78654
78681
  const r = await runReindexPass(
78655
78682
  `git-reindex:${profile.name} (${abs.length} files)`,
@@ -78685,7 +78712,7 @@ function createWorkspaceEngine(opts) {
78685
78712
  `[errata] git: ${ev.kind} ${ev.newSha.slice(0, 7)} by ${meta3.authorName} \u2014 ${diff.changedPaths.length} file(s), ${diff.renames.length} rename(s)`
78686
78713
  );
78687
78714
  };
78688
- const gitDir = join30(opts.workspaceRoot, ".git");
78715
+ const gitDir = join31(opts.workspaceRoot, ".git");
78689
78716
  if (existsSync25(gitDir)) {
78690
78717
  stopGit = startGitSensor(gitDir, (ev) => {
78691
78718
  void handleGitEvent(ev).catch((err2) => {
@@ -78867,10 +78894,10 @@ function createWorkspaceEngine(opts) {
78867
78894
  console.warn("[errata] render ledger failed:", err2.message?.slice(0, 120));
78868
78895
  }
78869
78896
  writeContextFile(opts.workspaceRoot, body2);
78870
- const target = join30(opts.workspaceRoot, "AGENTS.md");
78897
+ const target = join31(opts.workspaceRoot, "AGENTS.md");
78871
78898
  writeManagedBlock(target, { body: AGENTS_POINTER_BODY, stable: true, force: true });
78872
78899
  if (elicit) {
78873
- writePrimingHandles(join30(paths.configDir, "priming-handles.json"), [
78900
+ writePrimingHandles(join31(paths.configDir, "priming-handles.json"), [
78874
78901
  ...snapshot.recentProblems.map((r) => r.node),
78875
78902
  // Resolved-band handles: the ✓ problem AND its Solution are citable
78876
78903
  // (a fix tag on an already-resolved problem no-ops idempotently; the
@@ -79182,7 +79209,7 @@ function createWorkspaceEngine(opts) {
79182
79209
  resultSummary: { exitCode: e.exitCode ?? 1, errorTokens: e.errorTokens }
79183
79210
  });
79184
79211
  };
79185
- const turnCursorPath = join30(paths.configDir, "turn-cursors.json");
79212
+ const turnCursorPath = join31(paths.configDir, "turn-cursors.json");
79186
79213
  const lastTurnUuid = loadTurnCursors(turnCursorPath);
79187
79214
  const turnOffset = loadTurnOffsets(turnCursorPath);
79188
79215
  const readLosses = { parseFailures: 0, ioFailures: 0, bytesUnreachable: 0, sliceGuardHits: 0 };
@@ -79237,7 +79264,7 @@ function createWorkspaceEngine(opts) {
79237
79264
  let processedTurns = 0;
79238
79265
  const seqAtStart = store.currentIngestSeq();
79239
79266
  const elicit = isEdgeElicitationEnabled();
79240
- const handleMap = elicit ? readPrimingHandles(join30(paths.configDir, "priming-handles.json")) : {};
79267
+ const handleMap = elicit ? readPrimingHandles(join31(paths.configDir, "priming-handles.json")) : {};
79241
79268
  const wsRoot = (opts.workspaceRoot ?? "").replace(/\\/g, "/");
79242
79269
  const toRel = (abs) => {
79243
79270
  const p = abs.replace(/\\/g, "/");
@@ -79529,10 +79556,10 @@ function createWorkspaceEngine(opts) {
79529
79556
  let enclosing = {};
79530
79557
  if (p.location?.line !== void 0) {
79531
79558
  try {
79532
- const headSha = readGitRefState(join30(opts.workspaceRoot, ".git")).sha ?? void 0;
79559
+ const headSha = readGitRefState(join31(opts.workspaceRoot, ".git")).sha ?? void 0;
79533
79560
  enclosing = {
79534
79561
  line: p.location.line,
79535
- fileText: readFileSync25(join30(opts.workspaceRoot, anchorPath), "utf8"),
79562
+ fileText: readFileSync26(join31(opts.workspaceRoot, anchorPath), "utf8"),
79536
79563
  ...headSha ? { headSha } : {}
79537
79564
  };
79538
79565
  } catch {
@@ -80290,7 +80317,7 @@ B: ${b}`,
80290
80317
  try {
80291
80318
  const inputs = emitInputsFromManifest(paths.configDir, paths.skillsManifest);
80292
80319
  emitAndProjectSkills(opts.workspaceRoot, inputs);
80293
- writePrimingHandles(join30(paths.configDir, "priming-handles.json"), skillHandleNodes(inputs));
80320
+ writePrimingHandles(join31(paths.configDir, "priming-handles.json"), skillHandleNodes(inputs));
80294
80321
  } catch (err2) {
80295
80322
  console.warn("[skills] agent-skills projection failed (non-fatal):", err2 instanceof Error ? err2.message : err2);
80296
80323
  }
@@ -80382,7 +80409,7 @@ B: ${b}`,
80382
80409
  semanticMaintenance() {
80383
80410
  const seqBefore = store.currentIngestSeq();
80384
80411
  const report = runSemanticMaintenance(store);
80385
- let hintUpgrade = { upgraded: 0, standing: 0, unresolvable: 0 };
80412
+ let hintUpgrade = { upgraded: 0, standing: 0, unresolvable: 0, blocked: 0 };
80386
80413
  try {
80387
80414
  hintUpgrade = upgradeAnchorHints(store, profile.id, Date.now());
80388
80415
  } catch {
@@ -80400,7 +80427,8 @@ B: ${b}`,
80400
80427
  seqAdvanced: store.currentIngestSeq() - seqBefore,
80401
80428
  anchorHintsUpgraded: hintUpgrade.upgraded,
80402
80429
  anchorHintsStanding: hintUpgrade.standing,
80403
- anchorHintsUnresolvable: hintUpgrade.unresolvable
80430
+ anchorHintsUnresolvable: hintUpgrade.unresolvable,
80431
+ anchorHintsBlocked: hintUpgrade.blocked
80404
80432
  });
80405
80433
  if (report.revisitsCleared > 0 || report.fixCandidatesSettled > 0 || report.designResolved > 0) {
80406
80434
  refreshContextNow();
@@ -80677,7 +80705,7 @@ async function startDaemon(opts) {
80677
80705
  reviewUrl: () => webUiUrl + "/review"
80678
80706
  });
80679
80707
  const writeLockFile = (url2) => {
80680
- writeFileSync21(
80708
+ writeFileSync22(
80681
80709
  engine.paths.daemonLock,
80682
80710
  JSON.stringify({ pid: process.pid, webUiUrl: url2, startedAt: Date.now() }),
80683
80711
  "utf8"
@@ -80742,7 +80770,7 @@ init_identity2();
80742
80770
  // src/multi.ts
80743
80771
  init_dist();
80744
80772
  init_src5();
80745
- import { existsSync as existsSync32, readFileSync as readFileSync31, unlinkSync as unlinkSync3, writeFileSync as writeFileSync23 } from "node:fs";
80773
+ import { existsSync as existsSync32, readFileSync as readFileSync32, unlinkSync as unlinkSync3, writeFileSync as writeFileSync24 } from "node:fs";
80746
80774
  import { resolve as pathResolve } from "node:path";
80747
80775
 
80748
80776
  // src/principle-sync.ts
@@ -80771,8 +80799,8 @@ init_reconcile();
80771
80799
 
80772
80800
  // src/lockfile-auto.ts
80773
80801
  init_src();
80774
- import { existsSync as existsSync27, readFileSync as readFileSync26 } from "node:fs";
80775
- import { join as join31 } from "node:path";
80802
+ import { existsSync as existsSync27, readFileSync as readFileSync27 } from "node:fs";
80803
+ import { join as join32 } from "node:path";
80776
80804
 
80777
80805
  // src/package-index.ts
80778
80806
  init_src();
@@ -80921,11 +80949,11 @@ function runLockfilePass(opts) {
80921
80949
  { file: "package-lock.json", parse: parsePackageLockJson }
80922
80950
  ];
80923
80951
  for (const c of candidates) {
80924
- const p = join31(opts.root, c.file);
80952
+ const p = join32(opts.root, c.file);
80925
80953
  if (!existsSync27(p)) continue;
80926
80954
  let sbom;
80927
80955
  try {
80928
- sbom = c.parse(readFileSync26(p, "utf8"));
80956
+ sbom = c.parse(readFileSync27(p, "utf8"));
80929
80957
  } catch {
80930
80958
  continue;
80931
80959
  }
@@ -80985,8 +81013,8 @@ function noveltyAgainst(node2, neighbors, opts = {}) {
80985
81013
  init_profile2();
80986
81014
 
80987
81015
  // src/public-symbols.ts
80988
- import { readFileSync as readFileSync27, readdirSync as readdirSync11, existsSync as existsSync28 } from "node:fs";
80989
- import { join as join32 } from "node:path";
81016
+ import { readFileSync as readFileSync28, readdirSync as readdirSync11, existsSync as existsSync28 } from "node:fs";
81017
+ import { join as join33 } from "node:path";
80990
81018
  var HEAD_BYTES = 8 * 1024;
80991
81019
  var INDEX_TTL_MS = 10 * 60 * 1e3;
80992
81020
  var MIN_SYMBOL_LEN = 4;
@@ -81019,20 +81047,20 @@ function bindingNames(clause) {
81019
81047
  function internalPackageNames(workspaceRoot) {
81020
81048
  const names = /* @__PURE__ */ new Set();
81021
81049
  const tryRead = (dir) => {
81022
- const pj = join32(dir, "package.json");
81050
+ const pj = join33(dir, "package.json");
81023
81051
  if (!existsSync28(pj)) return;
81024
81052
  try {
81025
- const name2 = JSON.parse(readFileSync27(pj, "utf8")).name;
81053
+ const name2 = JSON.parse(readFileSync28(pj, "utf8")).name;
81026
81054
  if (typeof name2 === "string" && name2.length > 0) names.add(name2);
81027
81055
  } catch {
81028
81056
  }
81029
81057
  };
81030
81058
  tryRead(workspaceRoot);
81031
81059
  for (const group of ["packages", "apps"]) {
81032
- const groupDir = join32(workspaceRoot, group);
81060
+ const groupDir = join33(workspaceRoot, group);
81033
81061
  if (!existsSync28(groupDir)) continue;
81034
81062
  try {
81035
- for (const entry of readdirSync11(groupDir)) tryRead(join32(groupDir, entry));
81063
+ for (const entry of readdirSync11(groupDir)) tryRead(join33(groupDir, entry));
81036
81064
  } catch {
81037
81065
  }
81038
81066
  }
@@ -81045,7 +81073,7 @@ function publicSymbolIndex(store, workspaceRoot, deps = {}) {
81045
81073
  if (cached2 && now - cached2.builtAt < INDEX_TTL_MS) return cached2;
81046
81074
  const readHead = deps.readHead ?? ((absPath) => {
81047
81075
  try {
81048
- return readFileSync27(absPath, "utf8").slice(0, HEAD_BYTES);
81076
+ return readFileSync28(absPath, "utf8").slice(0, HEAD_BYTES);
81049
81077
  } catch {
81050
81078
  return "";
81051
81079
  }
@@ -81065,7 +81093,7 @@ function publicSymbolIndex(store, workspaceRoot, deps = {}) {
81065
81093
  }
81066
81094
  const symbols = /* @__PURE__ */ new Set();
81067
81095
  for (const rel of files) {
81068
- const head2 = readHead(join32(workspaceRoot, rel));
81096
+ const head2 = readHead(join33(workspaceRoot, rel));
81069
81097
  if (!head2) continue;
81070
81098
  for (const re of [NAMED_IMPORT_RE, REQUIRE_RE]) {
81071
81099
  re.lastIndex = 0;
@@ -81783,7 +81811,7 @@ function cloudTargetDrift(daemon, shell2) {
81783
81811
  }
81784
81812
 
81785
81813
  // src/lock.ts
81786
- import { existsSync as existsSync29, readFileSync as readFileSync28 } from "node:fs";
81814
+ import { existsSync as existsSync29, readFileSync as readFileSync29 } from "node:fs";
81787
81815
  function daemonLockPayload(lock) {
81788
81816
  return JSON.stringify({
81789
81817
  pid: lock.pid,
@@ -81823,7 +81851,7 @@ function isProcessAlive(pid) {
81823
81851
  function readDaemonLock(lockPath) {
81824
81852
  if (!existsSync29(lockPath)) return null;
81825
81853
  try {
81826
- const lock = JSON.parse(readFileSync28(lockPath, "utf8"));
81854
+ const lock = JSON.parse(readFileSync29(lockPath, "utf8"));
81827
81855
  return typeof lock.pid === "number" ? lock : null;
81828
81856
  } catch {
81829
81857
  return null;
@@ -82341,8 +82369,8 @@ async function hydrateProject(opts) {
82341
82369
  init_src7();
82342
82370
  init_src();
82343
82371
  import { execFile as execFile3 } from "node:child_process";
82344
- import { readFileSync as readFileSync30 } from "node:fs";
82345
- import { join as join34 } from "node:path";
82372
+ import { readFileSync as readFileSync31 } from "node:fs";
82373
+ import { join as join35 } from "node:path";
82346
82374
  import { promisify } from "node:util";
82347
82375
 
82348
82376
  // src/history-walk.ts
@@ -82564,8 +82592,8 @@ function narrative(unit, group) {
82564
82592
 
82565
82593
  // src/history-bundle.ts
82566
82594
  import { execFile as execFile2 } from "node:child_process";
82567
- import { readFileSync as readFileSync29 } from "node:fs";
82568
- import { join as join33 } from "node:path";
82595
+ import { readFileSync as readFileSync30 } from "node:fs";
82596
+ import { join as join34 } from "node:path";
82569
82597
 
82570
82598
  // ../../packages/privacy/src/patterns/credentials.ts
82571
82599
  var CREDENTIAL_PATTERNS = [
@@ -83347,7 +83375,7 @@ function pathAllowedByFloor(path2) {
83347
83375
  function loadRepoIgnore(root, extraPatterns = []) {
83348
83376
  let source = "";
83349
83377
  try {
83350
- source = readFileSync29(join33(root, ".errataignore"), "utf8");
83378
+ source = readFileSync30(join34(root, ".errataignore"), "utf8");
83351
83379
  } catch {
83352
83380
  source = "";
83353
83381
  }
@@ -83762,7 +83790,7 @@ async function defaultGit(root, args2) {
83762
83790
  function readIgnoreLines(root, profile) {
83763
83791
  let lines = [];
83764
83792
  try {
83765
- lines = readFileSync30(join34(root, ".errataignore"), "utf8").split("\n");
83793
+ lines = readFileSync31(join35(root, ".errataignore"), "utf8").split("\n");
83766
83794
  } catch {
83767
83795
  }
83768
83796
  return [...lines, ...profile.ignoreExtra ?? []].map((l) => l.trim()).filter((l) => l && !l.startsWith("#"));
@@ -84091,8 +84119,8 @@ async function startHistoryStage(root, input, client, walk10 = {}) {
84091
84119
  init_cloud_auth();
84092
84120
  import { createHash as createHash15 } from "node:crypto";
84093
84121
  import { execFileSync as execFileSync5 } from "node:child_process";
84094
- import { existsSync as existsSync30, writeFileSync as writeFileSync22 } from "node:fs";
84095
- import { join as join35 } from "node:path";
84122
+ import { existsSync as existsSync30, writeFileSync as writeFileSync23 } from "node:fs";
84123
+ import { join as join36 } from "node:path";
84096
84124
 
84097
84125
  // src/device-poll.ts
84098
84126
  var THROTTLED_POLL_MIN_WAIT_MS = 11e3;
@@ -84524,9 +84552,9 @@ function applyLinkDecision(root, profile, config2, decision, now = Date.now) {
84524
84552
  delete nextProfile.projectLinkDisabled;
84525
84553
  let wroteIgnore = false;
84526
84554
  if (decision.writeIgnoreStarter !== false) {
84527
- const target = join35(root, ".errataignore");
84555
+ const target = join36(root, ".errataignore");
84528
84556
  if (!existsSync30(target)) {
84529
- writeFileSync22(target, IGNORE_STARTER, "utf8");
84557
+ writeFileSync23(target, IGNORE_STARTER, "utf8");
84530
84558
  wroteIgnore = true;
84531
84559
  }
84532
84560
  }
@@ -84540,11 +84568,11 @@ init_registry();
84540
84568
  // src/adopt.ts
84541
84569
  init_git_remote();
84542
84570
  import { existsSync as existsSync31 } from "node:fs";
84543
- import { dirname as dirname12, join as join36 } from "node:path";
84571
+ import { dirname as dirname12, join as join37 } from "node:path";
84544
84572
  function findGitRoot(absPath) {
84545
84573
  let dir = absPath;
84546
84574
  for (let depth = 0; depth < 64; depth++) {
84547
- if (existsSync31(join36(dir, ".git"))) return dir;
84575
+ if (existsSync31(join37(dir, ".git"))) return dir;
84548
84576
  const parent = dirname12(dir);
84549
84577
  if (parent === dir) return null;
84550
84578
  dir = parent;
@@ -85162,7 +85190,7 @@ async function startMultiDaemon(opts = {}) {
85162
85190
  records.push(rec);
85163
85191
  void ambientLinkAll();
85164
85192
  try {
85165
- writeFileSync23(
85193
+ writeFileSync24(
85166
85194
  rec.engine.paths.daemonLock,
85167
85195
  daemonLockPayload({
85168
85196
  pid: process.pid,
@@ -85481,7 +85509,7 @@ async function startMultiDaemon(opts = {}) {
85481
85509
  baseUrl = `http://127.0.0.1:${port}`;
85482
85510
  try {
85483
85511
  ensureDir(globalDir());
85484
- writeFileSync23(
85512
+ writeFileSync24(
85485
85513
  lockPath,
85486
85514
  daemonLockPayload({ pid: process.pid, webUiUrl: baseUrl, processStartedAt: PROCESS_STARTED_AT, entry: SELF_ENTRY, version: DAEMON_VERSION }),
85487
85515
  "utf8"
@@ -85490,7 +85518,7 @@ async function startMultiDaemon(opts = {}) {
85490
85518
  }
85491
85519
  for (const r of records) {
85492
85520
  try {
85493
- writeFileSync23(
85521
+ writeFileSync24(
85494
85522
  r.engine.paths.daemonLock,
85495
85523
  daemonLockPayload({
85496
85524
  pid: process.pid,
@@ -86360,7 +86388,7 @@ async function startMultiDaemon(opts = {}) {
86360
86388
  clearInterval(anchorPull);
86361
86389
  clearTimeout(codexWakeBoot);
86362
86390
  try {
86363
- const cur = readFileSync31(lockPath, "utf8");
86391
+ const cur = readFileSync32(lockPath, "utf8");
86364
86392
  if (JSON.parse(cur).pid === process.pid) unlinkSync3(lockPath);
86365
86393
  } catch {
86366
86394
  }
@@ -86985,9 +87013,9 @@ function buildCodexHooksToml(port, options) {
86985
87013
  }
86986
87014
 
86987
87015
  // src/codex-hooks.ts
86988
- import { existsSync as existsSync33, mkdirSync as mkdirSync9, readFileSync as readFileSync32, writeFileSync as writeFileSync24 } from "node:fs";
87016
+ import { existsSync as existsSync33, mkdirSync as mkdirSync9, readFileSync as readFileSync33, writeFileSync as writeFileSync25 } from "node:fs";
86989
87017
  import { homedir as homedir7 } from "node:os";
86990
- import { join as join37 } from "node:path";
87018
+ import { join as join38 } from "node:path";
86991
87019
 
86992
87020
  // src/codex-hook-relay.ts
86993
87021
  var CODEX_RELAY_SOURCE = String.raw`// errata-managed: regenerated by errata install-hooks codex
@@ -87027,8 +87055,8 @@ try {
87027
87055
  `;
87028
87056
 
87029
87057
  // src/codex-hooks.ts
87030
- function hasCodexConfig(root, codexHome = process.env["CODEX_HOME"] || join37(homedir7(), ".codex")) {
87031
- return existsSync33(join37(root, ".codex")) || existsSync33(codexHome);
87058
+ function hasCodexConfig(root, codexHome = process.env["CODEX_HOME"] || join38(homedir7(), ".codex")) {
87059
+ return existsSync33(join38(root, ".codex")) || existsSync33(codexHome);
87032
87060
  }
87033
87061
  function replaceCodexHooks(existing, block) {
87034
87062
  const begin = existing.indexOf(CODEX_HOOKS_BEGIN);
@@ -87044,14 +87072,14 @@ function replaceCodexHooks(existing, block) {
87044
87072
  return existing.trimEnd() + (existing.trim() ? "\n\n" : "") + block;
87045
87073
  }
87046
87074
  function writeCodexHooks(root, port, nodePath = process.execPath) {
87047
- const dir = join37(root, ".codex");
87048
- const file2 = join37(dir, "config.toml");
87049
- const relay = join37(dir, "hooks", "errata-relay.mjs");
87075
+ const dir = join38(root, ".codex");
87076
+ const file2 = join38(dir, "config.toml");
87077
+ const relay = join38(dir, "hooks", "errata-relay.mjs");
87050
87078
  const block = buildCodexHooksToml(port, { nodePath, relayPath: relay });
87051
- const final = replaceCodexHooks(existsSync33(file2) ? readFileSync32(file2, "utf8") : "", block);
87052
- mkdirSync9(join37(dir, "hooks"), { recursive: true });
87053
- writeFileSync24(relay, CODEX_RELAY_SOURCE, "utf8");
87054
- writeFileSync24(file2, final, "utf8");
87079
+ const final = replaceCodexHooks(existsSync33(file2) ? readFileSync33(file2, "utf8") : "", block);
87080
+ mkdirSync9(join38(dir, "hooks"), { recursive: true });
87081
+ writeFileSync25(relay, CODEX_RELAY_SOURCE, "utf8");
87082
+ writeFileSync25(file2, final, "utf8");
87055
87083
  return file2;
87056
87084
  }
87057
87085
 
@@ -87461,13 +87489,13 @@ async function cmdInit() {
87461
87489
  console.log("");
87462
87490
  console.log("installing harness hooks...");
87463
87491
  const { existsSync: existsSync35 } = await import("node:fs");
87464
- const { join: join39 } = await import("node:path");
87492
+ const { join: join40 } = await import("node:path");
87465
87493
  try {
87466
87494
  await installClaudeHooks(port);
87467
87495
  } catch (err2) {
87468
87496
  console.warn(` \u26A0\uFE0F Claude hook install failed: ${err2 instanceof Error ? err2.message : err2}`);
87469
87497
  }
87470
- if (existsSync35(join39(ROOT, ".cursor"))) {
87498
+ if (existsSync35(join40(ROOT, ".cursor"))) {
87471
87499
  try {
87472
87500
  await installCursorMcpConfig();
87473
87501
  } catch (err2) {
@@ -88570,7 +88598,7 @@ async function cmdReview() {
88570
88598
  console.log("(review queue empty)");
88571
88599
  return;
88572
88600
  }
88573
- const queue = JSON.parse(readFileSync33(paths.reviewQueue, "utf8"));
88601
+ const queue = JSON.parse(readFileSync34(paths.reviewQueue, "utf8"));
88574
88602
  if (queue.length === 0) {
88575
88603
  console.log("(review queue empty)");
88576
88604
  return;
@@ -89280,7 +89308,7 @@ async function gatherReportData(generatedAt) {
89280
89308
  };
89281
89309
  }
89282
89310
  async function cmdReport(args2) {
89283
- const { mkdirSync: mkdirSync10, writeFileSync: writeFileSync25 } = await import("node:fs");
89311
+ const { mkdirSync: mkdirSync10, writeFileSync: writeFileSync26 } = await import("node:fs");
89284
89312
  const { renderReport: renderReport2 } = await Promise.resolve().then(() => (init_report_render(), report_render_exports));
89285
89313
  const includeFutureVerbs = args2.includes("--future-verbs");
89286
89314
  const now = /* @__PURE__ */ new Date();
@@ -89293,8 +89321,8 @@ async function cmdReport(args2) {
89293
89321
  const outDir = workspacePaths(ROOT).configDir;
89294
89322
  mkdirSync10(outDir, { recursive: true });
89295
89323
  const files = renderReport2(data, { includeFutureVerbs });
89296
- for (const f of files) writeFileSync25(join38(outDir, f.name), f.html, "utf8");
89297
- const indexPath = join38(outDir, "report.html");
89324
+ for (const f of files) writeFileSync26(join39(outDir, f.name), f.html, "utf8");
89325
+ const indexPath = join39(outDir, "report.html");
89298
89326
  console.log(`report \u2192 ${indexPath}`);
89299
89327
  console.log(
89300
89328
  ` ${data.repos.length} repo(s) \xB7 ${files.length} file(s) \xB7 ${data.rollup.nodes.toLocaleString("en-US")} nodes`
@@ -89414,24 +89442,24 @@ async function cmdInstallHooks(args2) {
89414
89442
  }
89415
89443
  }
89416
89444
  async function installOpencodePlugin(port) {
89417
- const { mkdirSync: mkdirSync10, existsSync: existsSync35, readFileSync: readFileSync34, writeFileSync: writeFileSync25 } = await import("node:fs");
89418
- const { join: join39 } = await import("node:path");
89419
- const dir = join39(ROOT, ".opencode", "plugin");
89445
+ const { mkdirSync: mkdirSync10, existsSync: existsSync35, readFileSync: readFileSync35, writeFileSync: writeFileSync26 } = await import("node:fs");
89446
+ const { join: join40 } = await import("node:path");
89447
+ const dir = join40(ROOT, ".opencode", "plugin");
89420
89448
  if (!existsSync35(dir)) mkdirSync10(dir, { recursive: true });
89421
- const file2 = join39(dir, "inerrata.js");
89449
+ const file2 = join40(dir, "inerrata.js");
89422
89450
  if (existsSync35(file2)) {
89423
- const head2 = readFileSync34(file2, "utf8").split("\n")[0] ?? "";
89451
+ const head2 = readFileSync35(file2, "utf8").split("\n")[0] ?? "";
89424
89452
  if (head2.trim() !== OPENCODE_PLUGIN_MARKER) {
89425
89453
  console.error(`refusing to overwrite ${file2}: not an errata-managed plugin (line 1 lacks the marker)`);
89426
89454
  process.exit(2);
89427
89455
  }
89428
89456
  }
89429
- writeFileSync25(file2, buildOpencodePluginSource(port, { version: DAEMON_VERSION }), "utf8");
89430
- const cfgFile = join39(ROOT, "opencode.json");
89457
+ writeFileSync26(file2, buildOpencodePluginSource(port, { version: DAEMON_VERSION }), "utf8");
89458
+ const cfgFile = join40(ROOT, "opencode.json");
89431
89459
  let cfg = { $schema: "https://opencode.ai/config.json" };
89432
89460
  if (existsSync35(cfgFile)) {
89433
89461
  try {
89434
- cfg = JSON.parse(readFileSync34(cfgFile, "utf8"));
89462
+ cfg = JSON.parse(readFileSync35(cfgFile, "utf8"));
89435
89463
  } catch {
89436
89464
  console.error(`refusing to touch invalid JSON at ${cfgFile} \u2014 fix it and re-run`);
89437
89465
  process.exit(2);
@@ -89442,7 +89470,7 @@ async function installOpencodePlugin(port) {
89442
89470
  if (!hadErrata) {
89443
89471
  const inv = errataMcpInvocation();
89444
89472
  cfg.mcp["errata"] = { type: "local", command: [inv.command, ...inv.args] };
89445
- writeFileSync25(cfgFile, JSON.stringify(cfg, null, 2) + "\n", "utf8");
89473
+ writeFileSync26(cfgFile, JSON.stringify(cfg, null, 2) + "\n", "utf8");
89446
89474
  }
89447
89475
  console.log(`installed OpenCode plugin \u2192 ${file2}`);
89448
89476
  if (hadErrata) console.log(` mcp.errata already present in ${cfgFile} \u2014 left untouched`);
@@ -89462,15 +89490,15 @@ function errataMcpInvocation() {
89462
89490
  return { command: cmd2, args: args2 };
89463
89491
  }
89464
89492
  async function installClaudeHooks(port) {
89465
- const { mkdirSync: mkdirSync10, existsSync: existsSync35, readFileSync: readFileSync34, writeFileSync: writeFileSync25 } = await import("node:fs");
89466
- const { join: join39 } = await import("node:path");
89467
- const dir = join39(ROOT, ".claude");
89493
+ const { mkdirSync: mkdirSync10, existsSync: existsSync35, readFileSync: readFileSync35, writeFileSync: writeFileSync26 } = await import("node:fs");
89494
+ const { join: join40 } = await import("node:path");
89495
+ const dir = join40(ROOT, ".claude");
89468
89496
  if (!existsSync35(dir)) mkdirSync10(dir, { recursive: true });
89469
- const file2 = join39(dir, "settings.json");
89497
+ const file2 = join40(dir, "settings.json");
89470
89498
  let settings = {};
89471
89499
  if (existsSync35(file2)) {
89472
89500
  try {
89473
- settings = JSON.parse(readFileSync34(file2, "utf8"));
89501
+ settings = JSON.parse(readFileSync35(file2, "utf8"));
89474
89502
  } catch {
89475
89503
  console.error(`refusing to overwrite invalid JSON at ${file2}`);
89476
89504
  process.exit(2);
@@ -89516,10 +89544,10 @@ async function installClaudeHooks(port) {
89516
89544
  dropErrata(list);
89517
89545
  list.push({ hooks: [{ type: "command", command: injectCmd }] });
89518
89546
  }
89519
- writeFileSync25(file2, JSON.stringify(settings, null, 2) + "\n", "utf8");
89547
+ writeFileSync26(file2, JSON.stringify(settings, null, 2) + "\n", "utf8");
89520
89548
  console.log(`installed Claude Code hooks \u2192 ${file2}`);
89521
89549
  await installClaudeMcpConfig();
89522
- const claudeMd = join39(ROOT, "CLAUDE.md");
89550
+ const claudeMd = join40(ROOT, "CLAUDE.md");
89523
89551
  const recall = writeManagedBlock(claudeMd, { body: RECALL_FIRST_BLOCK });
89524
89552
  if (recall.kind === "collision") {
89525
89553
  console.warn(
@@ -89531,15 +89559,15 @@ async function installClaudeHooks(port) {
89531
89559
  console.log(` endpoint: http://127.0.0.1:${port}/api/hook`);
89532
89560
  }
89533
89561
  async function installClaudeMcpConfig() {
89534
- const { mkdirSync: mkdirSync10, existsSync: existsSync35, readFileSync: readFileSync34, writeFileSync: writeFileSync25 } = await import("node:fs");
89535
- const { join: join39, dirname: dirname13 } = await import("node:path");
89536
- const file2 = join39(ROOT, ".mcp.json");
89562
+ const { mkdirSync: mkdirSync10, existsSync: existsSync35, readFileSync: readFileSync35, writeFileSync: writeFileSync26 } = await import("node:fs");
89563
+ const { join: join40, dirname: dirname13 } = await import("node:path");
89564
+ const file2 = join40(ROOT, ".mcp.json");
89537
89565
  const dir = dirname13(file2);
89538
89566
  if (!existsSync35(dir)) mkdirSync10(dir, { recursive: true });
89539
89567
  let cfg = {};
89540
89568
  if (existsSync35(file2)) {
89541
89569
  try {
89542
- cfg = JSON.parse(readFileSync34(file2, "utf8"));
89570
+ cfg = JSON.parse(readFileSync35(file2, "utf8"));
89543
89571
  } catch {
89544
89572
  console.error(`refusing to overwrite invalid JSON at ${file2}`);
89545
89573
  process.exit(2);
@@ -89547,21 +89575,21 @@ async function installClaudeMcpConfig() {
89547
89575
  }
89548
89576
  cfg.mcpServers ??= {};
89549
89577
  cfg.mcpServers["errata"] = errataMcpInvocation();
89550
- writeFileSync25(file2, JSON.stringify(cfg, null, 2) + "\n", "utf8");
89578
+ writeFileSync26(file2, JSON.stringify(cfg, null, 2) + "\n", "utf8");
89551
89579
  console.log(`installed Claude Code MCP server config \u2192 ${file2}`);
89552
89580
  console.log(` Claude Code will spawn \`errata mcp\` on workspace open.`);
89553
89581
  console.log(` Tools: errata.search / locate / neighbors / callers_of / what_uses / show / similar`);
89554
89582
  }
89555
89583
  async function installCursorMcpConfig() {
89556
- const { mkdirSync: mkdirSync10, existsSync: existsSync35, readFileSync: readFileSync34, writeFileSync: writeFileSync25 } = await import("node:fs");
89557
- const { join: join39 } = await import("node:path");
89558
- const dir = join39(ROOT, ".cursor");
89584
+ const { mkdirSync: mkdirSync10, existsSync: existsSync35, readFileSync: readFileSync35, writeFileSync: writeFileSync26 } = await import("node:fs");
89585
+ const { join: join40 } = await import("node:path");
89586
+ const dir = join40(ROOT, ".cursor");
89559
89587
  if (!existsSync35(dir)) mkdirSync10(dir, { recursive: true });
89560
- const file2 = join39(dir, "mcp.json");
89588
+ const file2 = join40(dir, "mcp.json");
89561
89589
  let cfg = {};
89562
89590
  if (existsSync35(file2)) {
89563
89591
  try {
89564
- cfg = JSON.parse(readFileSync34(file2, "utf8"));
89592
+ cfg = JSON.parse(readFileSync35(file2, "utf8"));
89565
89593
  } catch {
89566
89594
  console.error(`refusing to overwrite invalid JSON at ${file2}`);
89567
89595
  process.exit(2);
@@ -89569,7 +89597,7 @@ async function installCursorMcpConfig() {
89569
89597
  }
89570
89598
  cfg.mcpServers ??= {};
89571
89599
  cfg.mcpServers["errata"] = errataMcpInvocation();
89572
- writeFileSync25(file2, JSON.stringify(cfg, null, 2) + "\n", "utf8");
89600
+ writeFileSync26(file2, JSON.stringify(cfg, null, 2) + "\n", "utf8");
89573
89601
  console.log(`installed Cursor MCP server config \u2192 ${file2}`);
89574
89602
  console.log(` Cursor will spawn \`errata mcp\` on workspace open.`);
89575
89603
  console.log(` Tools: errata.search / locate / neighbors / callers_of / what_uses`);
@@ -89921,7 +89949,7 @@ async function cmdDash(args2) {
89921
89949
  await yieldToLoop2();
89922
89950
  try {
89923
89951
  const items = selectDurableMemory(handle2.sharedStore, r.engine.profile);
89924
- const res = bleedRules(join38(r.root, ".claude", "rules"), items);
89952
+ const res = bleedRules(join39(r.root, ".claude", "rules"), items);
89925
89953
  if (res.written || res.pruned) {
89926
89954
  console.log(
89927
89955
  `[rules:${r.entry.name}] ${res.written} collective principle(s) \u2192 .claude/rules` + (res.pruned ? `, ${res.pruned} pruned` : "")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.6-dev.2568",
3
+ "version": "2.0.6-dev.2571",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {