@inerrata-corporation/errata 2.0.14-dev.3228 → 2.0.14-dev.3236

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 +521 -527
  2. package/package.json +1 -1
package/errata.mjs CHANGED
@@ -22636,14 +22636,14 @@ function localMoving(nodeIds, g) {
22636
22636
  return community;
22637
22637
  }
22638
22638
  function refineConnectivity(community, g) {
22639
- const members2 = /* @__PURE__ */ new Map();
22639
+ const members = /* @__PURE__ */ new Map();
22640
22640
  for (const [id, c] of community) {
22641
- const l = members2.get(c) ?? [];
22641
+ const l = members.get(c) ?? [];
22642
22642
  l.push(id);
22643
- members2.set(c, l);
22643
+ members.set(c, l);
22644
22644
  }
22645
22645
  const refined = /* @__PURE__ */ new Map();
22646
- for (const [, group] of members2) {
22646
+ for (const [, group] of members) {
22647
22647
  const inGroup = new Set(group);
22648
22648
  const seen = /* @__PURE__ */ new Set();
22649
22649
  for (const start2 of [...group].sort()) {
@@ -23562,7 +23562,7 @@ function sharedScope(l2, memberIds) {
23562
23562
  const versionRange = shared("versionRange");
23563
23563
  return { ...lang ? { lang } : {}, ...versionRange ? { versionRange } : {} };
23564
23564
  }
23565
- function buildCandidate(id, ts, members2, contexts, originMachine, scope) {
23565
+ function buildCandidate(id, ts, members, contexts, originMachine, scope) {
23566
23566
  return {
23567
23567
  id,
23568
23568
  label: "Claim",
@@ -23588,7 +23588,7 @@ function buildCandidate(id, ts, members2, contexts, originMachine, scope) {
23588
23588
  pendingDistillation: true,
23589
23589
  // membership is the unit of truth — the harness validates its fence against
23590
23590
  // this set (P3 / C3) and may only phrase, never alter, it.
23591
- members: members2,
23591
+ members,
23592
23592
  memberContexts: contexts,
23593
23593
  distinctContexts: contexts.length,
23594
23594
  // standard Claim envelope so it crystallizes/syncs unchanged once distilled
@@ -23660,14 +23660,14 @@ function induceAbstractions(l2, opts) {
23660
23660
  }
23661
23661
  const comm = detectCommunitiesLeiden({ nodeIds: [...ids], adj }, { protect });
23662
23662
  report.communities = comm.count;
23663
- const members2 = /* @__PURE__ */ new Map();
23663
+ const members = /* @__PURE__ */ new Map();
23664
23664
  for (const [id, c] of comm.community) {
23665
- const l = members2.get(c) ?? [];
23665
+ const l = members.get(c) ?? [];
23666
23666
  l.push(id);
23667
- members2.set(c, l);
23667
+ members.set(c, l);
23668
23668
  }
23669
23669
  l2.transaction(() => {
23670
- for (const mem of members2.values()) {
23670
+ for (const mem of members.values()) {
23671
23671
  if (opts.touched && !mem.some((id) => opts.touched.has(id))) continue;
23672
23672
  if (mem.length < K) {
23673
23673
  report.skippedSmall++;
@@ -23709,14 +23709,14 @@ function pendingAbstractions(l2) {
23709
23709
  if (Number(n.attrs["abstractionLevel"] ?? ABSTRACTION_LEVEL.CONCRETE) < ABSTRACTION_LEVEL.PRINCIPLE) continue;
23710
23710
  if (n.attrs["provisional"] !== true) continue;
23711
23711
  const memberIds = Array.isArray(n.attrs["members"]) ? n.attrs["members"] : [];
23712
- const members2 = memberIds.map((id) => {
23712
+ const members = memberIds.map((id) => {
23713
23713
  const m = l2.getNode(id);
23714
23714
  return m ? { id: m.id, label: m.label, description: m.description } : { id, label: "?", description: "(member missing)" };
23715
23715
  });
23716
23716
  out2.push({
23717
23717
  candidate: n.id,
23718
23718
  distinctContexts: Number(n.attrs["distinctContexts"] ?? 0),
23719
- members: members2
23719
+ members
23720
23720
  });
23721
23721
  }
23722
23722
  return out2;
@@ -23746,10 +23746,10 @@ function applyAbstractionFence(l2, fence, ts) {
23746
23746
  if (node2.attrs["provisional"] !== true) {
23747
23747
  return { applied: false, principleId: fence.candidate, reason: "candidate already distilled" };
23748
23748
  }
23749
- const members2 = Array.isArray(node2.attrs["members"]) ? node2.attrs["members"] : [];
23750
- const want = new Set(members2);
23749
+ const members = Array.isArray(node2.attrs["members"]) ? node2.attrs["members"] : [];
23750
+ const want = new Set(members);
23751
23751
  const got = new Set(fence.covers);
23752
- const missing = members2.filter((id) => !got.has(id));
23752
+ const missing = members.filter((id) => !got.has(id));
23753
23753
  const invented = fence.covers.filter((id) => !want.has(id));
23754
23754
  if (missing.length > 0 || invented.length > 0) {
23755
23755
  return {
@@ -23780,10 +23780,10 @@ function revisitContradictedPrinciples(l2, ts) {
23780
23780
  for (const n of l2.findNodesByLabel("Claim")) {
23781
23781
  if (Number(n.attrs["abstractionLevel"] ?? ABSTRACTION_LEVEL.CONCRETE) < ABSTRACTION_LEVEL.PRINCIPLE) continue;
23782
23782
  if (n.attrs["revisit"] === true) continue;
23783
- const members2 = Array.isArray(n.attrs["members"]) ? n.attrs["members"] : [];
23784
- const memberSet = new Set(members2);
23783
+ const members = Array.isArray(n.attrs["members"]) ? n.attrs["members"] : [];
23784
+ const memberSet = new Set(members);
23785
23785
  let reason = "";
23786
- for (const id of members2) {
23786
+ for (const id of members) {
23787
23787
  const m = l2.getNode(id);
23788
23788
  if (!m) {
23789
23789
  reason = `member ${id} was removed`;
@@ -23874,14 +23874,14 @@ function detectLocalCommunities(store, opts = {}) {
23874
23874
  }
23875
23875
  }
23876
23876
  const comm = detectCommunitiesLeiden({ nodeIds: [...ids], adj }, { protect });
23877
- const members2 = /* @__PURE__ */ new Map();
23877
+ const members = /* @__PURE__ */ new Map();
23878
23878
  for (const [id, c] of comm.community) {
23879
- const l = members2.get(c) ?? [];
23879
+ const l = members.get(c) ?? [];
23880
23880
  l.push(id);
23881
- members2.set(c, l);
23881
+ members.set(c, l);
23882
23882
  }
23883
23883
  store.transaction(() => {
23884
- for (const [cid, mem] of members2) {
23884
+ for (const [cid, mem] of members) {
23885
23885
  const qualifies = mem.length >= minSize;
23886
23886
  let hasLocal = false;
23887
23887
  let hasCloud = false;
@@ -30904,8 +30904,8 @@ var init_generalizer = __esm({
30904
30904
  function layerOf(kind) {
30905
30905
  return kind === "Technique" ? "technique" : kind === "AntiPattern" ? "antipattern" : "pattern";
30906
30906
  }
30907
- function motifTitle(members2, layer, instanceCount) {
30908
- const top = [...members2].sort(
30907
+ function motifTitle(members, layer, instanceCount) {
30908
+ const top = [...members].sort(
30909
30909
  (a, b) => b.extractionConfidence - a.extractionConfidence
30910
30910
  )[0];
30911
30911
  return `${layer} \xD7${instanceCount} (exemplar): ${top?.description ?? "recurring problem cluster"}`;
@@ -30934,17 +30934,17 @@ function promoteMotifs(store, t) {
30934
30934
  let techniques = 0;
30935
30935
  let antipatterns = 0;
30936
30936
  store.transaction(() => {
30937
- for (const [cid, members2] of byCommunity) {
30938
- const instances = members2.filter((m) => m.label === "Problem");
30939
- const instanceCount = instances.length || members2.length;
30937
+ for (const [cid, members] of byCommunity) {
30938
+ const instances = members.filter((m) => m.label === "Problem");
30939
+ const instanceCount = instances.length || members.length;
30940
30940
  const motifId = `motif_${cid}`;
30941
30941
  const existing = store.getNode(motifId);
30942
30942
  const d = motifDecision({
30943
- instances: members2.map((m) => ({
30943
+ instances: members.map((m) => ({
30944
30944
  confidence: m.extractionConfidence,
30945
30945
  failed: false
30946
30946
  })),
30947
- memberCount: members2.length,
30947
+ memberCount: members.length,
30948
30948
  instanceCount,
30949
30949
  priorSurvivedRuns: existing?.attrs["survivedRuns"] ?? 0
30950
30950
  });
@@ -30956,7 +30956,7 @@ function promoteMotifs(store, t) {
30956
30956
  label: kind,
30957
30957
  // Refresh the deterministic title every run (exemplar/count/kind drift),
30958
30958
  // but never clobber a distilled one — a distillation pass owns it then.
30959
- description: existing?.attrs["titleDistilled"] === true ? existing.description : motifTitle(members2, layerOf(kind), instanceCount),
30959
+ description: existing?.attrs["titleDistilled"] === true ? existing.description : motifTitle(members, layerOf(kind), instanceCount),
30960
30960
  extractionConfidence: d.motifConfidence,
30961
30961
  extractionSource: "bko-inferred",
30962
30962
  embedding: existing?.embedding ?? [],
@@ -30975,7 +30975,7 @@ function promoteMotifs(store, t) {
30975
30975
  communityId: cid,
30976
30976
  survivedRuns: d.survivedRuns,
30977
30977
  motifConfidence: d.motifConfidence,
30978
- memberCount: members2.length,
30978
+ memberCount: members.length,
30979
30979
  instanceCount,
30980
30980
  promoted: d.promoted
30981
30981
  }
@@ -31996,47 +31996,43 @@ var init_recall_card = __esm({
31996
31996
  });
31997
31997
 
31998
31998
  // src/recall-signal.ts
31999
+ import { existsSync as existsSync7, readFileSync as readFileSync5, writeFileSync as writeFileSync6 } from "node:fs";
32000
+ import { join as join7 } from "node:path";
31999
32001
  function live(n) {
32000
32002
  return n != null && n.validTo == null && historyReadPolicy(n, { mode: "passive" }).allow;
32001
32003
  }
32002
32004
  function isPlaceholderFix(n) {
32003
32005
  return n.label === "Solution" && (n.description ?? "").startsWith(AUTO_MINT_PREFIX);
32004
32006
  }
32005
- function causalChains(store, problems, scoreOf) {
32006
- const best = (ids) => ids.sort((a, b) => scoreOf(b.id) - scoreOf(a.id))[0];
32007
+ function causalChains(store, problems) {
32008
+ const newest = (nodes) => nodes.sort((a, b) => b.lastUpdatedAt - a.lastUpdatedAt)[0];
32007
32009
  const chains = [];
32008
32010
  for (const problem of problems) {
32009
- const causes = store.outEdges(problem.id, ["CAUSED_BY"]).map((e) => store.getNode(e.to)).filter((n) => live(n) && n.label === "RootCause");
32010
- const fixes = store.outEdges(problem.id, ["SOLVED_BY"]).map((e) => store.getNode(e.to)).filter((n) => live(n) && n.label === "Solution" && !isPlaceholderFix(n));
32011
- const cause = best(causes);
32012
- const fix = best(fixes);
32011
+ const cause = newest(
32012
+ store.outEdges(problem.id, ["CAUSED_BY"]).map((e) => store.getNode(e.to)).filter((n) => live(n) && n.label === "RootCause")
32013
+ );
32014
+ const fix = newest(
32015
+ store.outEdges(problem.id, ["SOLVED_BY"]).map((e) => store.getNode(e.to)).filter((n) => live(n) && n.label === "Solution" && !isPlaceholderFix(n))
32016
+ );
32013
32017
  if (cause || fix) chains.push({ problem, ...cause ? { cause } : {}, ...fix ? { fix } : {} });
32014
32018
  }
32015
32019
  return chains;
32016
32020
  }
32017
- function members(c) {
32018
- return [c.problem, c.cause, c.fix].filter((n) => n != null);
32019
- }
32020
- function pickChain(chains, scoreOf) {
32021
- const mean = (c) => {
32022
- const m = members(c);
32023
- return m.reduce((s, n) => s + scoreOf(n.id), 0) / m.length;
32024
- };
32025
- return chains.filter((c) => scoreOf(c.problem.id) > 0).sort((a, b) => members(b).length - members(a).length || mean(b) - mean(a))[0];
32026
- }
32027
32021
  function item(n) {
32028
32022
  return { label: n.label, text: n.description ?? "" };
32029
32023
  }
32030
- function signalCard(headline, ranked, chains, chainScores = /* @__PURE__ */ new Map()) {
32031
- if (ranked.length === 0 && chains.length === 0) return null;
32032
- const score2 = new Map([...chainScores, ...ranked.map((r) => [r.id, r.score])]);
32033
- const scoreOf = (id) => score2.get(id) ?? 0;
32034
- const chain2 = pickChain(chains, scoreOf);
32035
- const inChain = new Set(chain2 ? members(chain2).map((n) => n.id) : []);
32036
- const single = ranked.find((r) => r.score > 0 && !inChain.has(r.id))?.node;
32024
+ function deliveredPrior(n) {
32025
+ return { id: n.id, label: n.label, text: n.description ?? "" };
32026
+ }
32027
+ function deliveredCard(store, headline, delivered) {
32028
+ if (delivered.length === 0) return null;
32029
+ const problems = delivered.filter((d) => d.label === "Problem").map((d) => store.getNode(d.id)).filter((n) => live(n));
32030
+ const chain2 = causalChains(store, problems)[0];
32031
+ const inChain = new Set(chain2 ? [chain2.problem.id, chain2.cause?.id, chain2.fix?.id] : []);
32032
+ const single = delivered.find((d) => !inChain.has(d.id));
32037
32033
  return {
32038
32034
  headline,
32039
- items: ranked.map((r) => item(r.node)),
32035
+ items: delivered.map((d) => ({ label: d.label, text: d.text })),
32040
32036
  ...chain2 ? {
32041
32037
  chain: {
32042
32038
  problem: item(chain2.problem),
@@ -32044,19 +32040,43 @@ function signalCard(headline, ranked, chains, chainScores = /* @__PURE__ */ new
32044
32040
  ...chain2.fix ? { fix: item(chain2.fix) } : {}
32045
32041
  }
32046
32042
  } : {},
32047
- ...single ? { single: item(single) } : {}
32043
+ ...single ? { single: { label: single.label, text: single.text } } : {}
32048
32044
  };
32049
32045
  }
32050
- function promptPool(store, limit = 150) {
32051
- const problems = [...openProblems(store)].sort((a, b) => b.lastUpdatedAt - a.lastUpdatedAt).slice(0, limit);
32052
- const ids = new Set(problems.map((p) => p.id));
32053
- for (const p of problems) {
32054
- for (const e of store.outEdges(p.id, ["CAUSED_BY", "SOLVED_BY"])) {
32055
- const n = store.getNode(e.to);
32056
- if (live(n) && !isPlaceholderFix(n)) ids.add(n.id);
32057
- }
32046
+ function clipIntent(text, width = 48) {
32047
+ const flat = text.replace(/\s+/g, " ").trim();
32048
+ return flat.length > width ? `${flat.slice(0, width - 1)}\u2026` : flat;
32049
+ }
32050
+ function contextCard(store, snapshot) {
32051
+ const seen = /* @__PURE__ */ new Set();
32052
+ const delivered = [];
32053
+ const add = (n) => {
32054
+ if (!n.id || seen.has(n.id)) return;
32055
+ seen.add(n.id);
32056
+ delivered.push(deliveredPrior(n));
32057
+ };
32058
+ for (const h of snapshot.statedIntent?.hits ?? []) add(h);
32059
+ for (const h of snapshot.statedIntent?.remoteHits ?? []) add(h);
32060
+ for (const p of snapshot.workingFile?.priors?.openProblems ?? []) add({ ...p, label: "Problem" });
32061
+ for (const r of snapshot.recentProblems) add(r.node);
32062
+ for (const n of snapshot.remote ?? []) add(n);
32063
+ for (const m of snapshot.motifs) add(m);
32064
+ const count = plural(delivered.length, "prior");
32065
+ const intent = snapshot.statedIntent?.text;
32066
+ return deliveredCard(store, intent ? `${count} for \u201C${clipIntent(intent)}\u201D` : `${count} in context`, delivered);
32067
+ }
32068
+ function writeContextCard(root, hash2, card) {
32069
+ writeFileSync6(join7(root, ".errata", CONTEXT_CARD_FILE), JSON.stringify({ hash: hash2, card }));
32070
+ }
32071
+ function readContextCard(root, hash2) {
32072
+ const path2 = join7(root, ".errata", CONTEXT_CARD_FILE);
32073
+ if (!existsSync7(path2)) return null;
32074
+ try {
32075
+ const saved = JSON.parse(readFileSync5(path2, "utf8"));
32076
+ return saved.hash === hash2 ? saved.card ?? null : null;
32077
+ } catch {
32078
+ return null;
32058
32079
  }
32059
- return { problems, ids: [...ids] };
32060
32080
  }
32061
32081
  function openProblems(store, now = Date.now()) {
32062
32082
  const hit = openProblemsCache.get(store);
@@ -32065,60 +32085,34 @@ function openProblems(store, now = Date.now()) {
32065
32085
  openProblemsCache.set(store, { at: now, nodes });
32066
32086
  return nodes;
32067
32087
  }
32068
- async function promptRecallCard(store, prompt) {
32069
- const { problems, ids } = promptPool(store);
32070
- if (ids.length === 0) return null;
32071
- const ranked = await rankForText(store, prompt.slice(0, 2e3), ids);
32072
- const matched = promptMatches(ranked);
32073
- if (matched.length === 0) return null;
32074
- const score2 = new Map(ranked.map((r) => [r.id, r.score]));
32075
- const matchedIds = new Set(matched.map((r) => r.id));
32076
- const chains = causalChains(store, problems.filter((p) => matchedIds.has(p.id)), (id) => score2.get(id) ?? 0);
32077
- const verb = matched.length === 1 ? "matches" : "match";
32078
- const card = signalCard(`${plural(matched.length, "prior")} ${verb} this prompt`, matched, chains, score2);
32079
- return card && { ...card, moreWhere: "matching" };
32080
- }
32081
- function promptMatches(ranked, sigmas = 3.5) {
32082
- const sims = ranked.map((r) => r.components.semantic ?? 0);
32083
- if (sims.length < 3) return [...ranked];
32084
- const median = (xs) => {
32085
- const s = [...xs].sort((a, b) => a - b);
32086
- const m = s.length >> 1;
32087
- return s.length % 2 ? s[m] : (s[m - 1] + s[m]) / 2;
32088
- };
32089
- const center = median(sims);
32090
- const sigma = 1.4826 * median(sims.map((x) => Math.abs(x - center)));
32091
- if (sigma === 0) return [];
32092
- return ranked.map((r, i2) => ({ r, sim: sims[i2] })).filter((x) => x.sim >= center + sigmas * sigma).sort((a, b) => b.sim - a.sim || b.r.score - a.r.score).map((x) => x.r);
32093
- }
32094
32088
  function openProblemCount(store) {
32095
32089
  return openProblems(store).length;
32096
32090
  }
32097
- var OPEN_PROBLEMS_TTL_MS, openProblemsCache;
32091
+ var CONTEXT_CARD_FILE, OPEN_PROBLEMS_TTL_MS, openProblemsCache;
32098
32092
  var init_recall_signal = __esm({
32099
32093
  "src/recall-signal.ts"() {
32100
32094
  "use strict";
32101
32095
  init_src5();
32102
32096
  init_src();
32103
- init_src8();
32104
32097
  init_recall_card();
32098
+ CONTEXT_CARD_FILE = "context-card.json";
32105
32099
  OPEN_PROBLEMS_TTL_MS = 6e4;
32106
32100
  openProblemsCache = /* @__PURE__ */ new WeakMap();
32107
32101
  }
32108
32102
  });
32109
32103
 
32110
32104
  // src/review.ts
32111
- import { existsSync as existsSync7, readFileSync as readFileSync5, writeFileSync as writeFileSync6 } from "node:fs";
32105
+ import { existsSync as existsSync8, readFileSync as readFileSync6, writeFileSync as writeFileSync7 } from "node:fs";
32112
32106
  function loadReviewQueue(paths) {
32113
- if (!existsSync7(paths.reviewQueue)) return [];
32107
+ if (!existsSync8(paths.reviewQueue)) return [];
32114
32108
  try {
32115
- return JSON.parse(readFileSync5(paths.reviewQueue, "utf8"));
32109
+ return JSON.parse(readFileSync6(paths.reviewQueue, "utf8"));
32116
32110
  } catch {
32117
32111
  return [];
32118
32112
  }
32119
32113
  }
32120
32114
  function saveReviewQueue(paths, queue) {
32121
- writeFileSync6(paths.reviewQueue, JSON.stringify(queue, null, 2), "utf8");
32115
+ writeFileSync7(paths.reviewQueue, JSON.stringify(queue, null, 2), "utf8");
32122
32116
  }
32123
32117
  function addProposal(paths, store, node2, reason, surprise) {
32124
32118
  const queue = loadReviewQueue(paths);
@@ -32188,14 +32182,14 @@ var init_consent = __esm({
32188
32182
  });
32189
32183
 
32190
32184
  // src/git-remote.ts
32191
- import { existsSync as existsSync8, readFileSync as readFileSync6, statSync } from "node:fs";
32192
- import { isAbsolute as isAbsolute2, join as join7, resolve } from "node:path";
32185
+ import { existsSync as existsSync9, readFileSync as readFileSync7, statSync } from "node:fs";
32186
+ import { isAbsolute as isAbsolute2, join as join8, resolve } from "node:path";
32193
32187
  function resolveGitDir(root) {
32194
- const dotGit = join7(root, ".git");
32188
+ const dotGit = join8(root, ".git");
32195
32189
  try {
32196
32190
  const st = statSync(dotGit);
32197
32191
  if (st.isDirectory()) return dotGit;
32198
- const m = /^gitdir:\s*(.+?)\s*$/m.exec(readFileSync6(dotGit, "utf8"));
32192
+ const m = /^gitdir:\s*(.+?)\s*$/m.exec(readFileSync7(dotGit, "utf8"));
32199
32193
  if (!m) return null;
32200
32194
  const dir = m[1];
32201
32195
  return isAbsolute2(dir) ? dir : resolve(root, dir);
@@ -32204,22 +32198,22 @@ function resolveGitDir(root) {
32204
32198
  }
32205
32199
  }
32206
32200
  function gitConfigPath(gitDir) {
32207
- const commondirFile = join7(gitDir, "commondir");
32208
- if (existsSync8(commondirFile)) {
32209
- const common = readFileSync6(commondirFile, "utf8").trim();
32201
+ const commondirFile = join8(gitDir, "commondir");
32202
+ if (existsSync9(commondirFile)) {
32203
+ const common = readFileSync7(commondirFile, "utf8").trim();
32210
32204
  const commonDir = isAbsolute2(common) ? common : resolve(gitDir, common);
32211
- return join7(commonDir, "config");
32205
+ return join8(commonDir, "config");
32212
32206
  }
32213
- return join7(gitDir, "config");
32207
+ return join8(gitDir, "config");
32214
32208
  }
32215
32209
  function readRemotes(root) {
32216
32210
  const gitDir = resolveGitDir(root);
32217
32211
  if (!gitDir) return [];
32218
32212
  const cfgPath = gitConfigPath(gitDir);
32219
- if (!existsSync8(cfgPath)) return [];
32213
+ if (!existsSync9(cfgPath)) return [];
32220
32214
  let txt;
32221
32215
  try {
32222
- txt = readFileSync6(cfgPath, "utf8");
32216
+ txt = readFileSync7(cfgPath, "utf8");
32223
32217
  } catch {
32224
32218
  return [];
32225
32219
  }
@@ -32245,9 +32239,9 @@ var init_git_remote = __esm({
32245
32239
  });
32246
32240
 
32247
32241
  // src/profile.ts
32248
- import { existsSync as existsSync9, readFileSync as readFileSync7, writeFileSync as writeFileSync7 } from "node:fs";
32242
+ import { existsSync as existsSync10, readFileSync as readFileSync8, writeFileSync as writeFileSync8 } from "node:fs";
32249
32243
  import { createHash as createHash5 } from "node:crypto";
32250
- import { join as join8 } from "node:path";
32244
+ import { join as join9 } from "node:path";
32251
32245
  function workspaceId(root) {
32252
32246
  return "wp_" + createHash5("sha256").update(root).digest("hex").slice(0, 12);
32253
32247
  }
@@ -32270,13 +32264,13 @@ function refreshRepoLocator(root, profile) {
32270
32264
  }
32271
32265
  function loadProfile(root) {
32272
32266
  const p = workspacePaths(root);
32273
- if (!existsSync9(p.workspaceJson)) return null;
32274
- return JSON.parse(readFileSync7(p.workspaceJson, "utf8"));
32267
+ if (!existsSync10(p.workspaceJson)) return null;
32268
+ return JSON.parse(readFileSync8(p.workspaceJson, "utf8"));
32275
32269
  }
32276
32270
  function saveProfile(root, profile) {
32277
32271
  const p = workspacePaths(root);
32278
32272
  ensureDir(p.configDir);
32279
- writeFileSync7(p.workspaceJson, JSON.stringify(profile, null, 2), "utf8");
32273
+ writeFileSync8(p.workspaceJson, JSON.stringify(profile, null, 2), "utf8");
32280
32274
  }
32281
32275
  function autodetectProfile(root) {
32282
32276
  const id = workspaceId(root);
@@ -32284,13 +32278,13 @@ function autodetectProfile(root) {
32284
32278
  const p = emptyProfile(id, name2);
32285
32279
  const locator = detectRepoLocator(root);
32286
32280
  if (locator) p.repoLocator = locator;
32287
- const pkgPath = join8(root, "package.json");
32288
- if (existsSync9(pkgPath)) {
32281
+ const pkgPath = join9(root, "package.json");
32282
+ if (existsSync10(pkgPath)) {
32289
32283
  try {
32290
- const pkg = JSON.parse(readFileSync7(pkgPath, "utf8"));
32284
+ const pkg = JSON.parse(readFileSync8(pkgPath, "utf8"));
32291
32285
  const deps = { ...pkg.dependencies ?? {}, ...pkg.devDependencies ?? {} };
32292
32286
  p.languages.push("javascript");
32293
- if (existsSync9(join8(root, "tsconfig.json")) || deps["typescript"]) {
32287
+ if (existsSync10(join9(root, "tsconfig.json")) || deps["typescript"]) {
32294
32288
  p.languages.push("typescript");
32295
32289
  }
32296
32290
  const nodeVer = pkg.engines?.node?.trim();
@@ -32311,10 +32305,10 @@ function autodetectProfile(root) {
32311
32305
  } catch {
32312
32306
  }
32313
32307
  }
32314
- const pyproject = join8(root, "pyproject.toml");
32315
- if (existsSync9(pyproject)) {
32308
+ const pyproject = join9(root, "pyproject.toml");
32309
+ if (existsSync10(pyproject)) {
32316
32310
  try {
32317
- const txt = readFileSync7(pyproject, "utf8");
32311
+ const txt = readFileSync8(pyproject, "utf8");
32318
32312
  const py = /python\s*=\s*"([^"]+)"/.exec(txt)?.[1];
32319
32313
  p.languages.push("python");
32320
32314
  p.stack.push(`python@${py ?? "3"}`);
@@ -32325,16 +32319,16 @@ function autodetectProfile(root) {
32325
32319
  } catch {
32326
32320
  }
32327
32321
  }
32328
- const reqs = join8(root, "requirements.txt");
32329
- if (existsSync9(reqs)) {
32322
+ const reqs = join9(root, "requirements.txt");
32323
+ if (existsSync10(reqs)) {
32330
32324
  if (!p.languages.includes("python")) p.languages.push("python");
32331
32325
  if (!p.stack.includes("python@3")) p.stack.push("python@3");
32332
32326
  }
32333
- if (existsSync9(join8(root, "go.mod"))) {
32327
+ if (existsSync10(join9(root, "go.mod"))) {
32334
32328
  p.languages.push("go");
32335
32329
  p.stack.push("go");
32336
32330
  }
32337
- if (existsSync9(join8(root, "Cargo.toml"))) {
32331
+ if (existsSync10(join9(root, "Cargo.toml"))) {
32338
32332
  p.languages.push("rust");
32339
32333
  p.stack.push("rust");
32340
32334
  }
@@ -32439,12 +32433,12 @@ var init_identity2 = __esm({
32439
32433
  });
32440
32434
 
32441
32435
  // src/checkout-root.ts
32442
- import { existsSync as existsSync10, readFileSync as readFileSync8 } from "node:fs";
32443
- import { basename as basename2, dirname as dirname6, isAbsolute as isAbsolute3, join as join9, resolve as resolve2 } from "node:path";
32436
+ import { existsSync as existsSync11, readFileSync as readFileSync9 } from "node:fs";
32437
+ import { basename as basename2, dirname as dirname6, isAbsolute as isAbsolute3, join as join10, resolve as resolve2 } from "node:path";
32444
32438
  function nearestGitRoot(dir) {
32445
32439
  let cur = resolve2(dir);
32446
32440
  for (; ; ) {
32447
- if (existsSync10(join9(cur, ".git"))) return cur;
32441
+ if (existsSync11(join10(cur, ".git"))) return cur;
32448
32442
  const parent = dirname6(cur);
32449
32443
  if (parent === cur) return null;
32450
32444
  cur = parent;
@@ -32452,19 +32446,19 @@ function nearestGitRoot(dir) {
32452
32446
  }
32453
32447
  function mainCheckoutOfWorktree(root) {
32454
32448
  const gitDir = resolveGitDir(root);
32455
- if (!gitDir || gitDir === join9(root, ".git")) return null;
32456
- const commondirFile = join9(gitDir, "commondir");
32457
- if (!existsSync10(commondirFile)) return null;
32449
+ if (!gitDir || gitDir === join10(root, ".git")) return null;
32450
+ const commondirFile = join10(gitDir, "commondir");
32451
+ if (!existsSync11(commondirFile)) return null;
32458
32452
  let common;
32459
32453
  try {
32460
- common = readFileSync8(commondirFile, "utf8").trim();
32454
+ common = readFileSync9(commondirFile, "utf8").trim();
32461
32455
  } catch {
32462
32456
  return null;
32463
32457
  }
32464
32458
  const commonDir = resolve2(isAbsolute3(common) ? common : resolve2(gitDir, common));
32465
32459
  if (basename2(commonDir) !== ".git") return null;
32466
32460
  const main2 = dirname6(commonDir);
32467
- return existsSync10(join9(main2, ".git")) ? main2 : null;
32461
+ return existsSync11(join10(main2, ".git")) ? main2 : null;
32468
32462
  }
32469
32463
  function checkoutRootOf(cwd) {
32470
32464
  const root = nearestGitRoot(cwd);
@@ -32482,16 +32476,16 @@ var init_checkout_root = __esm({
32482
32476
  });
32483
32477
 
32484
32478
  // src/registry.ts
32485
- import { existsSync as existsSync11, readFileSync as readFileSync9, writeFileSync as writeFileSync8 } from "node:fs";
32486
- import { join as join10 } from "node:path";
32479
+ import { existsSync as existsSync12, readFileSync as readFileSync10, writeFileSync as writeFileSync9 } from "node:fs";
32480
+ import { join as join11 } from "node:path";
32487
32481
  function registryPath() {
32488
- return process.env["ERRATA_REGISTRY_PATH"] ?? join10(globalDir(), "workspaces.json");
32482
+ return process.env["ERRATA_REGISTRY_PATH"] ?? join11(globalDir(), "workspaces.json");
32489
32483
  }
32490
32484
  function read() {
32491
32485
  const p = registryPath();
32492
- if (!existsSync11(p)) return { version: 1, workspaces: {} };
32486
+ if (!existsSync12(p)) return { version: 1, workspaces: {} };
32493
32487
  try {
32494
- const parsed = JSON.parse(readFileSync9(p, "utf8"));
32488
+ const parsed = JSON.parse(readFileSync10(p, "utf8"));
32495
32489
  return { version: 1, workspaces: parsed.workspaces ?? {} };
32496
32490
  } catch {
32497
32491
  return { version: 1, workspaces: {} };
@@ -32499,9 +32493,9 @@ function read() {
32499
32493
  }
32500
32494
  function registryCorrupt() {
32501
32495
  const p = registryPath();
32502
- if (!existsSync11(p)) return false;
32496
+ if (!existsSync12(p)) return false;
32503
32497
  try {
32504
- JSON.parse(readFileSync9(p, "utf8"));
32498
+ JSON.parse(readFileSync10(p, "utf8"));
32505
32499
  return false;
32506
32500
  } catch {
32507
32501
  return true;
@@ -32509,7 +32503,7 @@ function registryCorrupt() {
32509
32503
  }
32510
32504
  function write(reg) {
32511
32505
  ensureDir(globalDir());
32512
- writeFileSync8(registryPath(), JSON.stringify(reg, null, 2), "utf8");
32506
+ writeFileSync9(registryPath(), JSON.stringify(reg, null, 2), "utf8");
32513
32507
  }
32514
32508
  function registerWorkspace(profile, root, now = Date.now()) {
32515
32509
  if (isLinkedWorktree(root)) return;
@@ -32554,7 +32548,7 @@ function pruneMissingWorkspaces() {
32554
32548
  const reg = read();
32555
32549
  const removed = [];
32556
32550
  for (const [id, entry] of Object.entries(reg.workspaces)) {
32557
- if (!existsSync11(entry.path)) {
32551
+ if (!existsSync12(entry.path)) {
32558
32552
  removed.push(entry);
32559
32553
  delete reg.workspaces[id];
32560
32554
  }
@@ -32563,13 +32557,13 @@ function pruneMissingWorkspaces() {
32563
32557
  return removed;
32564
32558
  }
32565
32559
  function workspaceStatus(entry) {
32566
- const missing = !existsSync11(entry.path);
32560
+ const missing = !existsSync12(entry.path);
32567
32561
  const lockPath = workspacePaths(entry.path).daemonLock;
32568
32562
  let running = false;
32569
32563
  let webUiUrl = null;
32570
- if (existsSync11(lockPath)) {
32564
+ if (existsSync12(lockPath)) {
32571
32565
  try {
32572
- const lock = JSON.parse(readFileSync9(lockPath, "utf8"));
32566
+ const lock = JSON.parse(readFileSync10(lockPath, "utf8"));
32573
32567
  if (lock.pid && lock.webUiUrl && pidAlive(lock.pid)) {
32574
32568
  running = true;
32575
32569
  webUiUrl = lock.webUiUrl;
@@ -33894,22 +33888,22 @@ var init_dual_augment = __esm({
33894
33888
 
33895
33889
  // ../../packages/indexer/src/parse-cache.ts
33896
33890
  import { createHash as createHash6 } from "node:crypto";
33897
- import { existsSync as existsSync12, mkdirSync as mkdirSync6, readFileSync as readFileSync10, readdirSync as readdirSync2, rmSync as rmSync2, statSync as statSync2, writeFileSync as writeFileSync9 } from "node:fs";
33891
+ import { existsSync as existsSync13, mkdirSync as mkdirSync6, readFileSync as readFileSync11, readdirSync as readdirSync2, rmSync as rmSync2, statSync as statSync2, writeFileSync as writeFileSync10 } from "node:fs";
33898
33892
  import { homedir as homedir3 } from "node:os";
33899
- import { join as join11 } from "node:path";
33893
+ import { join as join12 } from "node:path";
33900
33894
  function parseCacheDir() {
33901
- return process.env["ERRATA_PARSE_CACHE"] ?? join11(homedir3(), ".errata", "parse-cache");
33895
+ return process.env["ERRATA_PARSE_CACHE"] ?? join12(homedir3(), ".errata", "parse-cache");
33902
33896
  }
33903
33897
  function parseCacheKey(source, providerId) {
33904
33898
  return createHash6("sha256").update(`${PARSE_CACHE_VERSION}:${providerId}:${source}`).digest("hex");
33905
33899
  }
33906
33900
  function entryPath(dir, key) {
33907
- return join11(dir, key.slice(0, 2), `${key.slice(2)}.json`);
33901
+ return join12(dir, key.slice(0, 2), `${key.slice(2)}.json`);
33908
33902
  }
33909
33903
  function readParseCache(dir, key) {
33910
33904
  const file2 = entryPath(dir, key);
33911
33905
  try {
33912
- const raw2 = readFileSync10(file2, "utf8");
33906
+ const raw2 = readFileSync11(file2, "utf8");
33913
33907
  const parsed = JSON.parse(raw2);
33914
33908
  if (parsed.v !== PARSE_CACHE_VERSION || !Array.isArray(parsed.symbols)) return null;
33915
33909
  return { symbols: parsed.symbols, reExports: parsed.reExports ?? [] };
@@ -33928,8 +33922,8 @@ function writeParseCache(dir, key, providerId, value) {
33928
33922
  const body2 = JSON.stringify(envelope);
33929
33923
  if (body2.length > MAX_ENTRY_BYTES) return;
33930
33924
  const file2 = entryPath(dir, key);
33931
- mkdirSync6(join11(dir, key.slice(0, 2)), { recursive: true });
33932
- writeFileSync9(file2, body2);
33925
+ mkdirSync6(join12(dir, key.slice(0, 2)), { recursive: true });
33926
+ writeFileSync10(file2, body2);
33933
33927
  } catch {
33934
33928
  }
33935
33929
  }
@@ -33938,9 +33932,9 @@ function sweepParseCacheOnce(dir, now = Date.now()) {
33938
33932
  sweptThisProcess = true;
33939
33933
  let removed = 0;
33940
33934
  try {
33941
- if (!existsSync12(dir)) return 0;
33935
+ if (!existsSync13(dir)) return 0;
33942
33936
  for (const bucket of readdirSync2(dir)) {
33943
- const bucketDir = join11(dir, bucket);
33937
+ const bucketDir = join12(dir, bucket);
33944
33938
  let names;
33945
33939
  try {
33946
33940
  names = readdirSync2(bucketDir);
@@ -33948,7 +33942,7 @@ function sweepParseCacheOnce(dir, now = Date.now()) {
33948
33942
  continue;
33949
33943
  }
33950
33944
  for (const name2 of names) {
33951
- const file2 = join11(bucketDir, name2);
33945
+ const file2 = join12(bucketDir, name2);
33952
33946
  try {
33953
33947
  if (now - statSync2(file2).mtimeMs > ENTRY_TTL_MS) {
33954
33948
  rmSync2(file2, { force: true });
@@ -34196,9 +34190,9 @@ var init_identity3 = __esm({
34196
34190
  });
34197
34191
 
34198
34192
  // ../../packages/indexer/src/pipeline.ts
34199
- import { appendFileSync, readFileSync as readFileSync11, statSync as statSync3 } from "node:fs";
34193
+ import { appendFileSync, readFileSync as readFileSync12, statSync as statSync3 } from "node:fs";
34200
34194
  import { readdir } from "node:fs/promises";
34201
- import { extname, join as join12, relative as relative2, sep } from "node:path";
34195
+ import { extname, join as join13, relative as relative2, sep } from "node:path";
34202
34196
  import { createHash as createHash7 } from "node:crypto";
34203
34197
  import { execFileSync } from "node:child_process";
34204
34198
  function nowTs() {
@@ -34336,7 +34330,7 @@ async function incrementalReindex(store, rootPath, workspaceId2, changedAbsPaths
34336
34330
  for (const rel of [...changedRelPaths]) {
34337
34331
  let h;
34338
34332
  try {
34339
- h = createHash7("sha256").update(readFileSync11(join12(rootPath, rel))).digest("hex");
34333
+ h = createHash7("sha256").update(readFileSync12(join13(rootPath, rel))).digest("hex");
34340
34334
  } catch {
34341
34335
  continue;
34342
34336
  }
@@ -34385,13 +34379,13 @@ async function incrementalReindex(store, rootPath, workspaceId2, changedAbsPaths
34385
34379
  let parsedFiles = 0;
34386
34380
  for (const rel of changedRelPaths) {
34387
34381
  if (parsedFiles++ > 0) await new Promise((r2) => setImmediate(r2));
34388
- const abs = join12(rootPath, ...rel.split("/"));
34382
+ const abs = join13(rootPath, ...rel.split("/"));
34389
34383
  const ext = extname(abs).toLowerCase();
34390
34384
  const provider = providers.find((p) => p.fileExtensions.includes(ext));
34391
34385
  if (!provider) continue;
34392
34386
  let symbols;
34393
34387
  try {
34394
- symbols = provider.extractSymbols(readFileSync11(abs, "utf8"), abs);
34388
+ symbols = provider.extractSymbols(readFileSync12(abs, "utf8"), abs);
34395
34389
  } catch {
34396
34390
  continue;
34397
34391
  }
@@ -34711,7 +34705,7 @@ async function runIndexer(store, opts) {
34711
34705
  report.filesSkipped++;
34712
34706
  continue;
34713
34707
  }
34714
- source = readFileSync11(f.absPath, "utf8");
34708
+ source = readFileSync12(f.absPath, "utf8");
34715
34709
  } catch {
34716
34710
  report.filesSkipped++;
34717
34711
  continue;
@@ -34783,7 +34777,7 @@ async function runIndexer(store, opts) {
34783
34777
  const depth = fileNode.relPath.split("/").length;
34784
34778
  if (depth !== 3) continue;
34785
34779
  try {
34786
- const pkg = JSON.parse(readFileSync11(fileNode.absPath, "utf8"));
34780
+ const pkg = JSON.parse(readFileSync12(fileNode.absPath, "utf8"));
34787
34781
  if (!pkg.name) continue;
34788
34782
  const pkgDir = fileNode.relPath.replace(/\/package\.json$/, "");
34789
34783
  const candidates = [
@@ -35171,7 +35165,7 @@ async function scan(root, current, ignores, providers, out2) {
35171
35165
  for (const ent of entries) {
35172
35166
  if (ignores.has(ent.name)) continue;
35173
35167
  if (ent.name.startsWith(".") && ent.name !== ".") continue;
35174
- const abs = join12(current, ent.name);
35168
+ const abs = join13(current, ent.name);
35175
35169
  if (ent.isDirectory()) {
35176
35170
  await scan(root, abs, ignores, providers, out2);
35177
35171
  } else if (ent.isFile()) {
@@ -35230,7 +35224,7 @@ function gitListFiles(root, ignores, providers) {
35230
35224
  if (rels === null) return null;
35231
35225
  const out2 = [];
35232
35226
  for (const rel of rels) {
35233
- const abs = join12(root, rel);
35227
+ const abs = join13(root, rel);
35234
35228
  let size;
35235
35229
  let mtimeMs;
35236
35230
  try {
@@ -35259,7 +35253,7 @@ function upsertFile(store, id, f, workspaceId2, skip) {
35259
35253
  if (existing && fileUnchanged(existing.attrs, f, skip)) return;
35260
35254
  let contentHash;
35261
35255
  try {
35262
- contentHash = createHash7("sha256").update(readFileSync11(f.absPath)).digest("hex");
35256
+ contentHash = createHash7("sha256").update(readFileSync12(f.absPath)).digest("hex");
35263
35257
  } catch {
35264
35258
  }
35265
35259
  const carried = { ...existing?.attrs ?? {} };
@@ -39642,8 +39636,8 @@ ${JSON.stringify(symbolNames, null, 2)}`);
39642
39636
 
39643
39637
  // ../../packages/indexer/src/languages/tree-sitter-loader.ts
39644
39638
  import { fileURLToPath } from "node:url";
39645
- import { dirname as dirname7, join as join13 } from "node:path";
39646
- import { existsSync as existsSync13, readdirSync as readdirSync3 } from "node:fs";
39639
+ import { dirname as dirname7, join as join14 } from "node:path";
39640
+ import { existsSync as existsSync14, readdirSync as readdirSync3 } from "node:fs";
39647
39641
  import { createRequire as createRequire2 } from "node:module";
39648
39642
  function entryDir() {
39649
39643
  try {
@@ -39657,27 +39651,27 @@ function entryDir() {
39657
39651
  }
39658
39652
  function findWasmDir() {
39659
39653
  const here = entryDir();
39660
- const seaWasm = join13(here, "resources", "wasm");
39661
- if (existsSync13(join13(seaWasm, "tree-sitter-typescript.wasm"))) return seaWasm;
39654
+ const seaWasm = join14(here, "resources", "wasm");
39655
+ if (existsSync14(join14(seaWasm, "tree-sitter-typescript.wasm"))) return seaWasm;
39662
39656
  let dir = here;
39663
39657
  for (let i2 = 0; i2 < 6; i2++) {
39664
- const flat = join13(
39658
+ const flat = join14(
39665
39659
  dir,
39666
39660
  "node_modules",
39667
39661
  "@vscode",
39668
39662
  "tree-sitter-wasm",
39669
39663
  "wasm"
39670
39664
  );
39671
- if (existsSync13(join13(flat, "tree-sitter-typescript.wasm"))) return flat;
39665
+ if (existsSync14(join14(flat, "tree-sitter-typescript.wasm"))) return flat;
39672
39666
  dir = dirname7(dir);
39673
39667
  }
39674
39668
  let root = here;
39675
39669
  for (let i2 = 0; i2 < 6; i2++) {
39676
- const pnpmDir = join13(root, "node_modules", ".pnpm");
39677
- if (existsSync13(pnpmDir)) {
39670
+ const pnpmDir = join14(root, "node_modules", ".pnpm");
39671
+ if (existsSync14(pnpmDir)) {
39678
39672
  for (const entry of readdirSync3(pnpmDir)) {
39679
39673
  if (entry.startsWith("@vscode+tree-sitter-wasm@")) {
39680
- const candidate = join13(
39674
+ const candidate = join14(
39681
39675
  pnpmDir,
39682
39676
  entry,
39683
39677
  "node_modules",
@@ -39685,7 +39679,7 @@ function findWasmDir() {
39685
39679
  "tree-sitter-wasm",
39686
39680
  "wasm"
39687
39681
  );
39688
- if (existsSync13(join13(candidate, "tree-sitter-typescript.wasm"))) {
39682
+ if (existsSync14(join14(candidate, "tree-sitter-typescript.wasm"))) {
39689
39683
  return candidate;
39690
39684
  }
39691
39685
  }
@@ -39699,27 +39693,27 @@ function findWasmDir() {
39699
39693
  }
39700
39694
  function findRuntimeDir() {
39701
39695
  const here = entryDir();
39702
- const seaRuntime = join13(here, "resources", "wasm");
39703
- if (existsSync13(join13(seaRuntime, "web-tree-sitter.wasm"))) return seaRuntime;
39696
+ const seaRuntime = join14(here, "resources", "wasm");
39697
+ if (existsSync14(join14(seaRuntime, "web-tree-sitter.wasm"))) return seaRuntime;
39704
39698
  let dir = here;
39705
39699
  for (let i2 = 0; i2 < 6; i2++) {
39706
- const flat = join13(dir, "node_modules", "web-tree-sitter");
39707
- if (existsSync13(join13(flat, "web-tree-sitter.wasm"))) return flat;
39700
+ const flat = join14(dir, "node_modules", "web-tree-sitter");
39701
+ if (existsSync14(join14(flat, "web-tree-sitter.wasm"))) return flat;
39708
39702
  dir = dirname7(dir);
39709
39703
  }
39710
39704
  let root = here;
39711
39705
  for (let i2 = 0; i2 < 6; i2++) {
39712
- const pnpmDir = join13(root, "node_modules", ".pnpm");
39713
- if (existsSync13(pnpmDir)) {
39706
+ const pnpmDir = join14(root, "node_modules", ".pnpm");
39707
+ if (existsSync14(pnpmDir)) {
39714
39708
  for (const entry of readdirSync3(pnpmDir)) {
39715
39709
  if (entry.startsWith("web-tree-sitter@")) {
39716
- const candidate = join13(
39710
+ const candidate = join14(
39717
39711
  pnpmDir,
39718
39712
  entry,
39719
39713
  "node_modules",
39720
39714
  "web-tree-sitter"
39721
39715
  );
39722
- if (existsSync13(join13(candidate, "web-tree-sitter.wasm"))) {
39716
+ if (existsSync14(join14(candidate, "web-tree-sitter.wasm"))) {
39723
39717
  return candidate;
39724
39718
  }
39725
39719
  }
@@ -39736,7 +39730,7 @@ async function loadWebTreeSitter() {
39736
39730
  void err2;
39737
39731
  }
39738
39732
  const here = entryDir();
39739
- const seaResourceBase = join13(here, "resources", "_resolve.js");
39733
+ const seaResourceBase = join14(here, "resources", "_resolve.js");
39740
39734
  const resourceRequire = createRequire2(seaResourceBase);
39741
39735
  return resourceRequire("web-tree-sitter");
39742
39736
  }
@@ -39751,9 +39745,9 @@ async function ensureTreeSitterReady() {
39751
39745
  await Parser2.init({
39752
39746
  locateFile: (name2) => {
39753
39747
  if (name2 === "tree-sitter.wasm" || name2 === "web-tree-sitter.wasm") {
39754
- return join13(runtime, name2);
39748
+ return join14(runtime, name2);
39755
39749
  }
39756
- return join13(grammars, name2);
39750
+ return join14(grammars, name2);
39757
39751
  }
39758
39752
  });
39759
39753
  })();
@@ -39765,7 +39759,7 @@ async function loadGrammar(name2) {
39765
39759
  if (cached2) return cached2;
39766
39760
  if (!languageClass) throw new Error("tree-sitter not initialized");
39767
39761
  const grammars = findWasmDir();
39768
- const lang = await languageClass.load(join13(grammars, `${name2}.wasm`));
39762
+ const lang = await languageClass.load(join14(grammars, `${name2}.wasm`));
39769
39763
  grammarCache.set(name2, lang);
39770
39764
  return lang;
39771
39765
  }
@@ -42670,7 +42664,7 @@ var init_src11 = __esm({
42670
42664
  // src/reconcile.ts
42671
42665
  import { execFileSync as execFileSync2 } from "node:child_process";
42672
42666
  import { readdirSync as readdirSync4, statSync as statSync4 } from "node:fs";
42673
- import { join as join14, relative as relative3, sep as sep2 } from "node:path";
42667
+ import { join as join15, relative as relative3, sep as sep2 } from "node:path";
42674
42668
  function indexerWouldScan(rel) {
42675
42669
  for (const seg of rel.split(/[\\/]/)) {
42676
42670
  if (seg.length === 0) continue;
@@ -42693,7 +42687,7 @@ function gitSourceFiles(root) {
42693
42687
  const out2 = [];
42694
42688
  for (const rel of stdout.split("\0")) {
42695
42689
  if (!rel || !SOURCE_RE.test(rel) || !indexerWouldScan(rel)) continue;
42696
- const abs = join14(root, rel);
42690
+ const abs = join15(root, rel);
42697
42691
  if (IGNORED.test(abs)) continue;
42698
42692
  out2.push(abs);
42699
42693
  }
@@ -42708,7 +42702,7 @@ function* walkSource(dir) {
42708
42702
  }
42709
42703
  for (const e of entries) {
42710
42704
  const name2 = String(e.name);
42711
- const full = join14(dir, name2);
42705
+ const full = join15(dir, name2);
42712
42706
  if (IGNORED.test(full)) continue;
42713
42707
  if (!indexerWouldScan(name2)) continue;
42714
42708
  if (e.isDirectory()) yield* walkSource(full);
@@ -42858,7 +42852,7 @@ __export(mcp_exports, {
42858
42852
  runTool: () => runTool,
42859
42853
  searchGraph: () => searchGraph
42860
42854
  });
42861
- import { existsSync as existsSync14, readFileSync as readFileSync12 } from "node:fs";
42855
+ import { existsSync as existsSync15, readFileSync as readFileSync13 } from "node:fs";
42862
42856
  import { resolve as resolve3 } from "node:path";
42863
42857
  function collectEnrichmentPulls(store, opts = {}) {
42864
42858
  const pending = store.findNodesByLabel("Solution").filter((s) => s.attrs["enrichmentPending"] === true).filter((s) => !opts.onlyUnsurfaced || s.attrs["enrichmentSurfaced"] !== true);
@@ -42895,7 +42889,7 @@ function takeEnrichmentNudge(store) {
42895
42889
  ` + items;
42896
42890
  }
42897
42891
  function takeDiscriminatorNudge(path2) {
42898
- if (!path2 || !existsSync14(path2)) return null;
42892
+ if (!path2 || !existsSync15(path2)) return null;
42899
42893
  let shared;
42900
42894
  try {
42901
42895
  shared = openGraphStore({ path: path2 });
@@ -43026,10 +43020,10 @@ function showNode(store, node2, maxLines) {
43026
43020
  if (!relPath) return { found: false, reason: "no file owner for node" };
43027
43021
  const workspaceRoot = process.cwd();
43028
43022
  const absPath = resolve3(workspaceRoot, relPath);
43029
- if (!existsSync14(absPath)) {
43023
+ if (!existsSync15(absPath)) {
43030
43024
  return { found: false, reason: `file not found on disk: ${absPath}` };
43031
43025
  }
43032
- const source = readFileSync12(absPath, "utf8");
43026
+ const source = readFileSync13(absPath, "utf8");
43033
43027
  const attrs = node2.attrs;
43034
43028
  let startByte = attrs["bodyStartByte"] ?? attrs["startByte"];
43035
43029
  let endByte = attrs["bodyEndByte"] ?? attrs["endByte"];
@@ -43786,7 +43780,7 @@ var init_mcp = __esm({
43786
43780
  const local = causalChain(store, { seedId: id, direction: "both", maxHops, limit });
43787
43781
  try {
43788
43782
  const path2 = sharedStorePath();
43789
- if (!existsSync14(path2)) return { found: true, ...local };
43783
+ if (!existsSync15(path2)) return { found: true, ...local };
43790
43784
  const shared = openGraphStore({ path: path2 });
43791
43785
  try {
43792
43786
  if (!shared.getNode(id)) return { found: true, ...local };
@@ -44387,7 +44381,7 @@ var init_mcp = __esm({
44387
44381
  inputSchema: { type: "object", properties: {} },
44388
44382
  handler: () => {
44389
44383
  const path2 = sharedStorePath();
44390
- if (!existsSync14(path2)) return { count: 0, pending: [] };
44384
+ if (!existsSync15(path2)) return { count: 0, pending: [] };
44391
44385
  const shared = openGraphStore({ path: path2 });
44392
44386
  try {
44393
44387
  const pending = pendingAbstractions(shared);
@@ -44415,7 +44409,7 @@ var init_mcp = __esm({
44415
44409
  },
44416
44410
  handler: (args2) => {
44417
44411
  const path2 = sharedStorePath();
44418
- if (!existsSync14(path2)) return { count: 0, pending: [] };
44412
+ if (!existsSync15(path2)) return { count: 0, pending: [] };
44419
44413
  const shared = openGraphStore({ path: path2 });
44420
44414
  try {
44421
44415
  const pending = pendingDiscriminators(shared, {
@@ -44459,7 +44453,7 @@ var init_mcp = __esm({
44459
44453
  },
44460
44454
  handler: (args2) => {
44461
44455
  const path2 = sharedStorePath();
44462
- if (!existsSync14(path2)) return { count: 0, routes: [] };
44456
+ if (!existsSync15(path2)) return { count: 0, routes: [] };
44463
44457
  const shared = openGraphStore({ path: path2 });
44464
44458
  try {
44465
44459
  const result = triageOf(shared, {
@@ -44844,8 +44838,8 @@ __export(vfile_exports, {
44844
44838
  resolvePath: () => resolvePath,
44845
44839
  segmentsOf: () => segmentsOf
44846
44840
  });
44847
- import { writeFileSync as writeFileSync10 } from "node:fs";
44848
- import { join as join15, resolve as resolve4, sep as sep3 } from "node:path";
44841
+ import { writeFileSync as writeFileSync11 } from "node:fs";
44842
+ import { join as join16, resolve as resolve4, sep as sep3 } from "node:path";
44849
44843
  function segmentsOf(rawPath) {
44850
44844
  let p = rawPath.replace(/\\/g, "/");
44851
44845
  p = p.replace(/^.*\.errata\/g\//, "").replace(/^\/?g\//, "").replace(/^\/+/, "");
@@ -44919,14 +44913,14 @@ async function renderVFile(rawPath, store, ctx = {}) {
44919
44913
  }
44920
44914
  async function materializeVFile(rawPath, workspaceRoot, store, ctx = {}) {
44921
44915
  const segs = segmentsOf(rawPath);
44922
- const gRoot = join15(workspaceRoot, ".errata", "g");
44916
+ const gRoot = join16(workspaceRoot, ".errata", "g");
44923
44917
  const abs = resolve4(gRoot, ...segs.length ? segs : ["index"]);
44924
44918
  if (abs !== gRoot && !abs.startsWith(gRoot + sep3)) {
44925
44919
  throw new Error(`refusing to materialize outside .errata/g: ${rawPath}`);
44926
44920
  }
44927
44921
  const text = await renderVFile(rawPath, store, ctx);
44928
44922
  ensureParent(abs);
44929
- writeFileSync10(abs, text, "utf8");
44923
+ writeFileSync11(abs, text, "utf8");
44930
44924
  return abs;
44931
44925
  }
44932
44926
  async function materializeOverview(workspaceRoot, store, ctx = {}) {
@@ -52346,25 +52340,25 @@ var init_tool_index = __esm({
52346
52340
 
52347
52341
  // src/outbox.ts
52348
52342
  import {
52349
- existsSync as existsSync15,
52343
+ existsSync as existsSync16,
52350
52344
  readdirSync as readdirSync5,
52351
- readFileSync as readFileSync13,
52345
+ readFileSync as readFileSync14,
52352
52346
  renameSync,
52353
52347
  unlinkSync,
52354
- writeFileSync as writeFileSync11
52348
+ writeFileSync as writeFileSync12
52355
52349
  } from "node:fs";
52356
- import { join as join16 } from "node:path";
52350
+ import { join as join17 } from "node:path";
52357
52351
  import { createHash as createHash15 } from "node:crypto";
52358
52352
  function enqueueOutbox(paths, payload) {
52359
52353
  ensureDir(paths.outbox);
52360
52354
  const id = createHash15("sha256").update(JSON.stringify(payload)).digest("hex").slice(0, 16);
52361
- const file2 = join16(paths.outbox, `${Date.now()}-${id}.json`);
52362
- writeFileSync11(file2, JSON.stringify(payload, null, 2), "utf8");
52355
+ const file2 = join17(paths.outbox, `${Date.now()}-${id}.json`);
52356
+ writeFileSync12(file2, JSON.stringify(payload, null, 2), "utf8");
52363
52357
  return file2;
52364
52358
  }
52365
52359
  async function flushOutbox(paths, client, store) {
52366
52360
  ensureDir(paths.outbox);
52367
- const entries = existsSync15(paths.outbox) ? readdirSync5(paths.outbox) : [];
52361
+ const entries = existsSync16(paths.outbox) ? readdirSync5(paths.outbox) : [];
52368
52362
  let uploaded = 0;
52369
52363
  let failed = 0;
52370
52364
  const quarantine = (abs, reason) => {
@@ -52375,10 +52369,10 @@ async function flushOutbox(paths, client, store) {
52375
52369
  }
52376
52370
  };
52377
52371
  for (const f of entries.filter((e) => e.endsWith(".json")).sort()) {
52378
- const abs = join16(paths.outbox, f);
52372
+ const abs = join17(paths.outbox, f);
52379
52373
  let payload;
52380
52374
  try {
52381
- payload = JSON.parse(readFileSync13(abs, "utf8"));
52375
+ payload = JSON.parse(readFileSync14(abs, "utf8"));
52382
52376
  } catch {
52383
52377
  failed++;
52384
52378
  quarantine(abs, "unparseable JSON");
@@ -52423,7 +52417,7 @@ async function flushOutbox(paths, client, store) {
52423
52417
  }
52424
52418
  }
52425
52419
  }
52426
- const remainingFiles = existsSync15(paths.outbox) ? readdirSync5(paths.outbox).filter((e) => e.endsWith(".json")) : [];
52420
+ const remainingFiles = existsSync16(paths.outbox) ? readdirSync5(paths.outbox).filter((e) => e.endsWith(".json")) : [];
52427
52421
  return { uploaded, failed, remaining: remainingFiles.length };
52428
52422
  }
52429
52423
  var init_outbox = __esm({
@@ -52562,31 +52556,26 @@ function fileRecall(store, relPath) {
52562
52556
  priors.constraints.sort(byRank);
52563
52557
  priors.related.sort(byRank);
52564
52558
  const lines = [];
52565
- for (const p of priors.openProblems.slice(0, 3)) {
52559
+ const shownProblems = priors.openProblems.slice(0, 3);
52560
+ const shownConstraints = priors.constraints.slice(0, 2);
52561
+ const shownRelated = priors.related.slice(0, 4);
52562
+ for (const p of shownProblems) {
52566
52563
  const hasCause = store.outEdges(p.id, ["CAUSED_BY"]).some((e) => store.getNode(e.to)?.label === "RootCause");
52567
52564
  const causeCue = hasCause ? "" : ` \xB7 ${TAG_EXAMPLE.triageMint()} to diagnose its cause`;
52568
52565
  lines.push(
52569
52566
  recallLine(p, `${TAG_EXAMPLE.fix(p.id)} if you resolved it \xB7 ${TAG_EXAMPLE.prior(p.id)} to cite${causeCue}`)
52570
52567
  );
52571
52568
  }
52572
- for (const c of priors.constraints.slice(0, 2)) {
52569
+ for (const c of shownConstraints) {
52573
52570
  lines.push(recallLine(c, `design tension \u2014 hold it, don't "fix" it \xB7 ${TAG_EXAMPLE.prior(c.id)} to cite`));
52574
52571
  }
52575
- for (const n of priors.related.slice(0, 4)) {
52572
+ for (const n of shownRelated) {
52576
52573
  lines.push(recallLine(n, `cite with ${TAG_EXAMPLE.prior(n.id)}`));
52577
52574
  }
52578
52575
  const total = pool.length;
52579
- const headline = `${plural(total, "prior")} on ${relPath.split("/").slice(-2).join("/")}`;
52580
- const chainProblems = [...priors.openProblems, ...priors.resolvedProblems];
52581
- const scoreOf = new Map(ranked.map((r) => [r.id, r.score]));
52582
- const missing = /* @__PURE__ */ new Set();
52583
- for (const p of chainProblems) {
52584
- if (!scoreOf.has(p.id)) missing.add(p.id);
52585
- for (const e of store.outEdges(p.id, ["CAUSED_BY", "SOLVED_BY"])) if (!scoreOf.has(e.to)) missing.add(e.to);
52586
- }
52587
- for (const r of rankByRelevance(store, priors.file.id, [...missing])) scoreOf.set(r.id, r.score);
52588
- const chains = causalChains(store, chainProblems, (id) => scoreOf.get(id) ?? 0);
52589
- const card = signalCard(headline, ranked, chains, scoreOf) ?? { headline, items: [] };
52576
+ const shown = [...shownProblems, ...shownConstraints, ...shownRelated].map(deliveredPrior);
52577
+ const headline = `${plural(shown.length, "prior")} on ${relPath.split("/").slice(-2).join("/")}`;
52578
+ const card = deliveredCard(store, headline, shown) ?? { headline, items: [] };
52590
52579
  return {
52591
52580
  context: `errata \u2014 ${total} prior(s) recorded on this file (act only if relevant):
52592
52581
  ${lines.join("\n")}
@@ -52975,30 +52964,28 @@ function buildWebUi(deps) {
52975
52964
  return c.json({});
52976
52965
  }
52977
52966
  const sid = String(body2["session_id"] ?? "");
52978
- const prompt = typeof body2["prompt"] === "string" ? body2["prompt"] : "";
52979
52967
  const hookEvent = String(body2["hook_event_name"] ?? "UserPromptSubmit");
52980
- if (sid && recallCardEnabled() && (hookEvent === "UserPromptSubmit" || hookEvent === "SessionStart")) {
52981
- const since = Date.now();
52968
+ const atPrompt = hookEvent === "UserPromptSubmit" || hookEvent === "SessionStart";
52969
+ if (sid && recallCardEnabled() && atPrompt) {
52982
52970
  setImmediate(() => {
52983
52971
  try {
52984
52972
  rememberOpenCount(sid, openProblemCount(deps.store));
52985
52973
  } catch {
52986
52974
  }
52987
- if (!prompt.trim()) return;
52988
- promptRecallCard(deps.store, prompt).then((card) => {
52989
- if (card) rememberCard(sid, card, Date.now(), since);
52990
- }).catch(() => {
52991
- });
52992
52975
  });
52993
52976
  }
52994
52977
  const block = readContextFileWithHash(deps.paths.root);
52995
52978
  const decision = decideContextInject({
52996
- event: String(body2["hook_event_name"] ?? "UserPromptSubmit"),
52979
+ event: hookEvent,
52997
52980
  source: String(body2["source"] ?? ""),
52998
- sessionId: String(body2["session_id"] ?? ""),
52981
+ sessionId: sid,
52999
52982
  block,
53000
52983
  lastInjectedHash
53001
52984
  });
52985
+ if (sid && block && recallCardEnabled() && (decision || atPrompt)) {
52986
+ const card = readContextCard(deps.paths.root, block.hash);
52987
+ if (card) rememberCard(sid, card);
52988
+ }
53002
52989
  if (!decision) return c.json({});
53003
52990
  return c.json({
53004
52991
  hookSpecificOutput: {
@@ -72038,27 +72025,27 @@ __export(witness_ledger_exports, {
72038
72025
  summarizeWitnessLedger: () => summarizeWitnessLedger,
72039
72026
  witnessLedgerPath: () => witnessLedgerPath
72040
72027
  });
72041
- import { appendFileSync as appendFileSync3, existsSync as existsSync24, readFileSync as readFileSync26, writeFileSync as writeFileSync19 } from "node:fs";
72042
- import { join as join32 } from "node:path";
72028
+ import { appendFileSync as appendFileSync3, existsSync as existsSync25, readFileSync as readFileSync27, writeFileSync as writeFileSync20 } from "node:fs";
72029
+ import { join as join33 } from "node:path";
72043
72030
  function witnessLedgerPath(configDir) {
72044
- return join32(configDir, "witness-ledger.jsonl");
72031
+ return join33(configDir, "witness-ledger.jsonl");
72045
72032
  }
72046
72033
  function appendWitnessLedger(configDir, entry) {
72047
72034
  const path2 = witnessLedgerPath(configDir);
72048
72035
  try {
72049
72036
  appendFileSync3(path2, JSON.stringify(entry) + "\n");
72050
- const lines = readFileSync26(path2, "utf8").split("\n").filter(Boolean);
72037
+ const lines = readFileSync27(path2, "utf8").split("\n").filter(Boolean);
72051
72038
  if (lines.length > LEDGER_MAX_LINES) {
72052
- writeFileSync19(path2, lines.slice(-Math.floor(LEDGER_MAX_LINES / 2)).join("\n") + "\n");
72039
+ writeFileSync20(path2, lines.slice(-Math.floor(LEDGER_MAX_LINES / 2)).join("\n") + "\n");
72053
72040
  }
72054
72041
  } catch {
72055
72042
  }
72056
72043
  }
72057
72044
  function readWitnessLedger(configDir) {
72058
72045
  const path2 = witnessLedgerPath(configDir);
72059
- if (!existsSync24(path2)) return [];
72046
+ if (!existsSync25(path2)) return [];
72060
72047
  try {
72061
- return readFileSync26(path2, "utf8").split("\n").filter(Boolean).map((l) => JSON.parse(l)).filter((e) => typeof e.ts === "number" && typeof e.channel === "string");
72048
+ return readFileSync27(path2, "utf8").split("\n").filter(Boolean).map((l) => JSON.parse(l)).filter((e) => typeof e.ts === "number" && typeof e.channel === "string");
72062
72049
  } catch {
72063
72050
  return [];
72064
72051
  }
@@ -72497,12 +72484,12 @@ var init_report_render = __esm({
72497
72484
 
72498
72485
  // src/cli.ts
72499
72486
  init_src6();
72500
- import { closeSync as closeSync2, existsSync as existsSync35, openSync as openSync2, readFileSync as readFileSync36, renameSync as renameSync4, statSync as statSync10 } from "node:fs";
72501
- import { join as join43, resolve as pathResolve2 } from "node:path";
72487
+ import { closeSync as closeSync2, existsSync as existsSync36, openSync as openSync2, readFileSync as readFileSync37, renameSync as renameSync4, statSync as statSync10 } from "node:fs";
72488
+ import { join as join44, resolve as pathResolve2 } from "node:path";
72502
72489
  import { spawn as spawn5 } from "node:child_process";
72503
72490
 
72504
72491
  // src/daemon.ts
72505
- import { existsSync as existsSync26, writeFileSync as writeFileSync22 } from "node:fs";
72492
+ import { existsSync as existsSync27, writeFileSync as writeFileSync23 } from "node:fs";
72506
72493
 
72507
72494
  // ../../node_modules/.pnpm/@hono+node-server@1.19.11_hono@4.12.8/node_modules/@hono/node-server/dist/index.mjs
72508
72495
  import { createServer as createServerHTTP } from "http";
@@ -73082,13 +73069,13 @@ init_config();
73082
73069
 
73083
73070
  // src/engine.ts
73084
73071
  import { execFileSync as execFileSync4 } from "node:child_process";
73085
- import { existsSync as existsSync25, statSync as statSync8, appendFileSync as appendFileSync4, readdirSync as readdirSync10, renameSync as renameSync3, readFileSync as readFileSync28, writeFileSync as writeFileSync21 } from "node:fs";
73086
- import { basename as basename7, join as join34, relative as relative6, sep as sep4 } from "node:path";
73072
+ import { existsSync as existsSync26, statSync as statSync8, appendFileSync as appendFileSync4, readdirSync as readdirSync10, renameSync as renameSync3, readFileSync as readFileSync29, writeFileSync as writeFileSync22 } from "node:fs";
73073
+ import { basename as basename7, join as join35, relative as relative6, sep as sep4 } from "node:path";
73087
73074
 
73088
73075
  // src/source-watcher.ts
73089
73076
  import { EventEmitter as EventEmitter2 } from "node:events";
73090
73077
  import { statSync as statSync5, watch as watch2 } from "node:fs";
73091
- import { join as join19 } from "node:path";
73078
+ import { join as join20 } from "node:path";
73092
73079
 
73093
73080
  // ../../node_modules/.pnpm/chokidar@4.0.3/node_modules/chokidar/esm/index.js
73094
73081
  import { stat as statcb } from "fs";
@@ -74821,7 +74808,7 @@ var NativeSourceWatcher = class extends EventEmitter2 {
74821
74808
  }
74822
74809
  try {
74823
74810
  const h = watch2(target, { recursive: isDir, persistent: true }, (event, name2) => {
74824
- const path2 = isDir ? name2 ? join19(target, name2.toString()) : null : target;
74811
+ const path2 = isDir ? name2 ? join20(target, name2.toString()) : null : target;
74825
74812
  if (!path2) return;
74826
74813
  this.emit("raw", event, path2, { watchedPath: target });
74827
74814
  if (!this.ignored(path2)) this.schedule(path2, event === "rename");
@@ -75121,13 +75108,14 @@ async function chat(req) {
75121
75108
  // src/engine.ts
75122
75109
  init_src11();
75123
75110
  init_src6();
75111
+ init_recall_signal();
75124
75112
  init_src8();
75125
75113
  init_review2();
75126
75114
 
75127
75115
  // src/turn.ts
75128
75116
  init_checkout_root();
75129
- import { closeSync, existsSync as existsSync16, fstatSync, openSync, readdirSync as readdirSync6, readSync, realpathSync, statSync as statSync6 } from "node:fs";
75130
- import { basename as basename5, delimiter, dirname as dirname10, join as join20, normalize as normalize3 } from "node:path";
75117
+ import { closeSync, existsSync as existsSync17, fstatSync, openSync, readdirSync as readdirSync6, readSync, realpathSync, statSync as statSync6 } from "node:fs";
75118
+ import { basename as basename5, delimiter, dirname as dirname10, join as join21, normalize as normalize3 } from "node:path";
75131
75119
  import { homedir as homedir4 } from "node:os";
75132
75120
  import { createHash as createHash16 } from "node:crypto";
75133
75121
  function completeJsonlPrefix(buf) {
@@ -75515,11 +75503,11 @@ function turnsSince(turns, mark) {
75515
75503
  return at >= 0 ? turns.slice(at + 1) : turns;
75516
75504
  }
75517
75505
  function claudeProjectDir(cwd, home = homedir4()) {
75518
- return join20(home, ".claude", "projects", cwd.replace(/[\\/:.]/g, "-"));
75506
+ return join21(home, ".claude", "projects", cwd.replace(/[\\/:.]/g, "-"));
75519
75507
  }
75520
75508
  function recentTranscripts(cwd, opts = {}) {
75521
75509
  const dir = claudeProjectDir(cwd, opts.home ?? homedir4());
75522
- if (!existsSync16(dir)) return [];
75510
+ if (!existsSync17(dir)) return [];
75523
75511
  let names;
75524
75512
  try {
75525
75513
  names = readdirSync6(dir);
@@ -75530,7 +75518,7 @@ function recentTranscripts(cwd, opts = {}) {
75530
75518
  const refs = [];
75531
75519
  for (const name2 of names) {
75532
75520
  if (!name2.endsWith(".jsonl")) continue;
75533
- const path2 = join20(dir, name2);
75521
+ const path2 = join21(dir, name2);
75534
75522
  let mtimeMs;
75535
75523
  try {
75536
75524
  mtimeMs = statSync6(path2).mtimeMs;
@@ -75545,8 +75533,8 @@ function recentTranscripts(cwd, opts = {}) {
75545
75533
  }
75546
75534
  function subagentTranscripts(mainTranscriptPath, sessionId) {
75547
75535
  if (!mainTranscriptPath || !sessionId) return [];
75548
- const dir = join20(dirname10(mainTranscriptPath), sessionId, "subagents");
75549
- if (!existsSync16(dir)) return [];
75536
+ const dir = join21(dirname10(mainTranscriptPath), sessionId, "subagents");
75537
+ if (!existsSync17(dir)) return [];
75550
75538
  let names;
75551
75539
  try {
75552
75540
  names = readdirSync6(dir);
@@ -75556,7 +75544,7 @@ function subagentTranscripts(mainTranscriptPath, sessionId) {
75556
75544
  const refs = [];
75557
75545
  for (const name2 of names) {
75558
75546
  if (!name2.endsWith(".jsonl")) continue;
75559
- const path2 = join20(dir, name2);
75547
+ const path2 = join21(dir, name2);
75560
75548
  let mtimeMs;
75561
75549
  try {
75562
75550
  mtimeMs = statSync6(path2).mtimeMs;
@@ -75575,8 +75563,8 @@ function splitPathList(value, sep5 = delimiter) {
75575
75563
  function codexSessionRoots(env2 = process.env, home = homedir4()) {
75576
75564
  const roots = /* @__PURE__ */ new Set();
75577
75565
  for (const d of splitPathList(env2["ERRATA_CODEX_SESSIONS_DIRS"])) roots.add(d);
75578
- if (env2["CODEX_HOME"]) roots.add(join20(env2["CODEX_HOME"], "sessions"));
75579
- roots.add(join20(home, ".codex", "sessions"));
75566
+ if (env2["CODEX_HOME"]) roots.add(join21(env2["CODEX_HOME"], "sessions"));
75567
+ roots.add(join21(home, ".codex", "sessions"));
75580
75568
  return [...roots];
75581
75569
  }
75582
75570
  function readCodexRolloutIdentity(path2) {
@@ -75630,7 +75618,7 @@ function codexRolloutsForCwd(cwd, opts = {}) {
75630
75618
  const owner = checkoutRootOf(cwd);
75631
75619
  const owners = /* @__PURE__ */ new Map();
75632
75620
  for (const root of codexSessionRoots(opts.env, opts.home)) {
75633
- if (!existsSync16(root)) {
75621
+ if (!existsSync17(root)) {
75634
75622
  codexRolloutActivity.delete(root);
75635
75623
  continue;
75636
75624
  }
@@ -75648,7 +75636,7 @@ function codexRolloutsForCwd(cwd, opts = {}) {
75648
75636
  continue;
75649
75637
  }
75650
75638
  for (const name2 of names) {
75651
- const full = join20(dir, name2);
75639
+ const full = join21(dir, name2);
75652
75640
  let st;
75653
75641
  try {
75654
75642
  st = statSync6(full);
@@ -75690,8 +75678,8 @@ function codexRolloutsForCwd(cwd, opts = {}) {
75690
75678
  function geminiSessionRoots(env2 = process.env, home = homedir4()) {
75691
75679
  const roots = /* @__PURE__ */ new Set();
75692
75680
  for (const d of splitPathList(env2["ERRATA_GEMINI_SESSIONS_DIRS"])) roots.add(d);
75693
- if (env2["GEMINI_CLI_HOME"]) roots.add(join20(env2["GEMINI_CLI_HOME"], ".gemini", "tmp"));
75694
- roots.add(join20(home, ".gemini", "tmp"));
75681
+ if (env2["GEMINI_CLI_HOME"]) roots.add(join21(env2["GEMINI_CLI_HOME"], ".gemini", "tmp"));
75682
+ roots.add(join21(home, ".gemini", "tmp"));
75695
75683
  return [...roots];
75696
75684
  }
75697
75685
  function geminiProjectHash(cwd) {
@@ -75731,7 +75719,7 @@ function geminiTranscriptsForCwd(cwd, opts = {}) {
75731
75719
  const hashes = geminiHashesFor(cwd);
75732
75720
  const out2 = [];
75733
75721
  for (const root of geminiSessionRoots(opts.env, opts.home)) {
75734
- if (!existsSync16(root)) continue;
75722
+ if (!existsSync17(root)) continue;
75735
75723
  let slugs;
75736
75724
  try {
75737
75725
  slugs = readdirSync6(root);
@@ -75739,7 +75727,7 @@ function geminiTranscriptsForCwd(cwd, opts = {}) {
75739
75727
  continue;
75740
75728
  }
75741
75729
  for (const slug2 of slugs) {
75742
- const chats = join20(root, slug2, "chats");
75730
+ const chats = join21(root, slug2, "chats");
75743
75731
  let names;
75744
75732
  try {
75745
75733
  names = readdirSync6(chats);
@@ -75748,7 +75736,7 @@ function geminiTranscriptsForCwd(cwd, opts = {}) {
75748
75736
  }
75749
75737
  for (const name2 of names) {
75750
75738
  if (!name2.startsWith("session-") || !name2.endsWith(".jsonl")) continue;
75751
- const full = join20(chats, name2);
75739
+ const full = join21(chats, name2);
75752
75740
  let st;
75753
75741
  try {
75754
75742
  st = statSync6(full);
@@ -75768,8 +75756,8 @@ function geminiTranscriptsForCwd(cwd, opts = {}) {
75768
75756
  function opencodeSessionRoots(env2 = process.env, home = homedir4()) {
75769
75757
  const roots = /* @__PURE__ */ new Set();
75770
75758
  for (const d of splitPathList(env2["ERRATA_OPENCODE_SESSIONS_DIRS"])) roots.add(d);
75771
- if (env2["XDG_DATA_HOME"]) roots.add(join20(env2["XDG_DATA_HOME"], "opencode", "errata"));
75772
- roots.add(join20(home, ".local", "share", "opencode", "errata"));
75759
+ if (env2["XDG_DATA_HOME"]) roots.add(join21(env2["XDG_DATA_HOME"], "opencode", "errata"));
75760
+ roots.add(join21(home, ".local", "share", "opencode", "errata"));
75773
75761
  return [...roots];
75774
75762
  }
75775
75763
  function readOpencodeTranscriptDirectory(path2) {
@@ -75802,7 +75790,7 @@ function opencodeTranscriptsForCwd(cwd, opts = {}) {
75802
75790
  }
75803
75791
  const out2 = [];
75804
75792
  for (const root of opencodeSessionRoots(opts.env, opts.home)) {
75805
- if (!existsSync16(root)) continue;
75793
+ if (!existsSync17(root)) continue;
75806
75794
  let names;
75807
75795
  try {
75808
75796
  names = readdirSync6(root);
@@ -75811,7 +75799,7 @@ function opencodeTranscriptsForCwd(cwd, opts = {}) {
75811
75799
  }
75812
75800
  for (const name2 of names) {
75813
75801
  if (!name2.endsWith(".jsonl")) continue;
75814
- const full = join20(root, name2);
75802
+ const full = join21(root, name2);
75815
75803
  let st;
75816
75804
  try {
75817
75805
  st = statSync6(full);
@@ -75834,7 +75822,7 @@ init_src2();
75834
75822
  init_agent_signals();
75835
75823
  init_tool_index();
75836
75824
  init_src5();
75837
- import { readFileSync as readFileSync14, writeFileSync as writeFileSync12 } from "node:fs";
75825
+ import { readFileSync as readFileSync15, writeFileSync as writeFileSync13 } from "node:fs";
75838
75826
  var NEG = /n['']t|\b(?:not|never|no|none|neither|nor|unrelated|irrelevant|would|might|could|if)\b/i;
75839
75827
  var CITE_GROUP_RE = /\(((?:[^()\n]|\([^()\n]*\)){1,200})\)/g;
75840
75828
  var HANDLE_RE = /\[([a-z0-9][\w-]{0,80})\]|((?:pat|sol|drc|dcause|dfix|dprob|prob|claim|err)_[0-9a-f]{6,})/gi;
@@ -76523,13 +76511,13 @@ function writePrimingHandles(path2, nodes, now = Date.now()) {
76523
76511
  entries.sort((a, b) => (b[1].seenAt ?? 0) - (a[1].seenAt ?? 0));
76524
76512
  entries.length = HANDLE_MAP_MAX;
76525
76513
  }
76526
- writeFileSync12(path2, JSON.stringify(Object.fromEntries(entries)));
76514
+ writeFileSync13(path2, JSON.stringify(Object.fromEntries(entries)));
76527
76515
  } catch {
76528
76516
  }
76529
76517
  }
76530
76518
  function readPrimingHandles(path2) {
76531
76519
  try {
76532
- return JSON.parse(readFileSync14(path2, "utf8"));
76520
+ return JSON.parse(readFileSync15(path2, "utf8"));
76533
76521
  } catch {
76534
76522
  return {};
76535
76523
  }
@@ -77004,8 +76992,8 @@ ${conversation}` }]
77004
76992
  // src/constraint-backfill.ts
77005
76993
  init_src5();
77006
76994
  init_src2();
77007
- import { existsSync as existsSync17, readFileSync as readFileSync15, readdirSync as readdirSync7, writeFileSync as writeFileSync13 } from "node:fs";
77008
- import { join as join21 } from "node:path";
76995
+ import { existsSync as existsSync18, readFileSync as readFileSync16, readdirSync as readdirSync7, writeFileSync as writeFileSync14 } from "node:fs";
76996
+ import { join as join22 } from "node:path";
77009
76997
  import { homedir as homedir5 } from "node:os";
77010
76998
  var BACKFILL_VERSION = 1;
77011
76999
  var EMPTY = {
@@ -77019,13 +77007,13 @@ var EMPTY = {
77019
77007
  recoverable: 0
77020
77008
  };
77021
77009
  function markerPath(configDir) {
77022
- return join21(configDir, "constraint-backfill.json");
77010
+ return join22(configDir, "constraint-backfill.json");
77023
77011
  }
77024
77012
  function alreadyDone(configDir) {
77025
77013
  const p = markerPath(configDir);
77026
- if (!existsSync17(p)) return false;
77014
+ if (!existsSync18(p)) return false;
77027
77015
  try {
77028
- const raw2 = JSON.parse(readFileSync15(p, "utf8"));
77016
+ const raw2 = JSON.parse(readFileSync16(p, "utf8"));
77029
77017
  return raw2?.version === BACKFILL_VERSION;
77030
77018
  } catch {
77031
77019
  return false;
@@ -77035,7 +77023,7 @@ function replay(root) {
77035
77023
  const statements = /* @__PURE__ */ new Set();
77036
77024
  const citedByFix = /* @__PURE__ */ new Set();
77037
77025
  const dir = claudeProjectDir(root, homedir5());
77038
- if (!existsSync17(dir)) return { statements, citedByFix };
77026
+ if (!existsSync18(dir)) return { statements, citedByFix };
77039
77027
  let names;
77040
77028
  try {
77041
77029
  names = readdirSync7(dir).filter((n) => n.endsWith(".jsonl"));
@@ -77045,7 +77033,7 @@ function replay(root) {
77045
77033
  for (const f of names) {
77046
77034
  let lines;
77047
77035
  try {
77048
- lines = readFileSync15(join21(dir, f), "utf8").split("\n");
77036
+ lines = readFileSync16(join22(dir, f), "utf8").split("\n");
77049
77037
  } catch {
77050
77038
  continue;
77051
77039
  }
@@ -77159,7 +77147,7 @@ function backfillConstraintKind(store, opts) {
77159
77147
  }
77160
77148
  });
77161
77149
  try {
77162
- writeFileSync13(
77150
+ writeFileSync14(
77163
77151
  markerPath(opts.configDir),
77164
77152
  JSON.stringify({ version: BACKFILL_VERSION, at: opts.now, ...report, cloudTwins: report.cloudTwins.length }, null, 2),
77165
77153
  "utf8"
@@ -77172,8 +77160,8 @@ function backfillConstraintKind(store, opts) {
77172
77160
  // src/edge-repair.ts
77173
77161
  init_src();
77174
77162
  init_src5();
77175
- import { existsSync as existsSync18, readFileSync as readFileSync16, writeFileSync as writeFileSync14 } from "node:fs";
77176
- import { join as join22 } from "node:path";
77163
+ import { existsSync as existsSync19, readFileSync as readFileSync17, writeFileSync as writeFileSync15 } from "node:fs";
77164
+ import { join as join23 } from "node:path";
77177
77165
  function citeEdgeId(from, type, to) {
77178
77166
  return `edge_${digest({ from, type, to })}`.slice(0, 24);
77179
77167
  }
@@ -77188,13 +77176,13 @@ var EMPTY2 = {
77188
77176
  byType: {}
77189
77177
  };
77190
77178
  function markerPath2(configDir) {
77191
- return join22(configDir, "edge-repair.json");
77179
+ return join23(configDir, "edge-repair.json");
77192
77180
  }
77193
77181
  function alreadyDone2(configDir) {
77194
77182
  const p = markerPath2(configDir);
77195
- if (!existsSync18(p)) return false;
77183
+ if (!existsSync19(p)) return false;
77196
77184
  try {
77197
- return JSON.parse(readFileSync16(p, "utf8"))?.version === EDGE_REPAIR_VERSION;
77185
+ return JSON.parse(readFileSync17(p, "utf8"))?.version === EDGE_REPAIR_VERSION;
77198
77186
  } catch {
77199
77187
  return false;
77200
77188
  }
@@ -77243,7 +77231,7 @@ function repairInvalidEdges(store, opts) {
77243
77231
  });
77244
77232
  store.pruneEdgeRejections(opts.now - REJECTION_RETENTION_MS);
77245
77233
  try {
77246
- writeFileSync14(
77234
+ writeFileSync15(
77247
77235
  markerPath2(opts.configDir),
77248
77236
  JSON.stringify({ version: EDGE_REPAIR_VERSION, at: opts.now, ...report }, null, 2),
77249
77237
  "utf8"
@@ -77257,8 +77245,8 @@ function repairInvalidEdges(store, opts) {
77257
77245
  init_reconcile();
77258
77246
 
77259
77247
  // src/pass-ledger.ts
77260
- import { appendFileSync as appendFileSync2, existsSync as existsSync19, readFileSync as readFileSync17, writeFileSync as writeFileSync15 } from "node:fs";
77261
- import { join as join23 } from "node:path";
77248
+ import { appendFileSync as appendFileSync2, existsSync as existsSync20, readFileSync as readFileSync18, writeFileSync as writeFileSync16 } from "node:fs";
77249
+ import { join as join24 } from "node:path";
77262
77250
 
77263
77251
  // src/isolate-census.ts
77264
77252
  var live2 = 0;
@@ -77281,7 +77269,7 @@ var PER_KIND_MAX = 100;
77281
77269
  var TRIM_EVERY = 50;
77282
77270
  var appendsSinceTrim = /* @__PURE__ */ new Map();
77283
77271
  function passLedgerPath(configDir) {
77284
- return join23(configDir, "pass-ledger.jsonl");
77272
+ return join24(configDir, "pass-ledger.jsonl");
77285
77273
  }
77286
77274
  function appendPassLedger(configDir, kind, durationMs, counts) {
77287
77275
  const path2 = passLedgerPath(configDir);
@@ -77310,7 +77298,7 @@ function appendPassLedger(configDir, kind, durationMs, counts) {
77310
77298
  return;
77311
77299
  }
77312
77300
  appendsSinceTrim.set(path2, 0);
77313
- const lines = readFileSync17(path2, "utf8").split("\n").filter(Boolean);
77301
+ const lines = readFileSync18(path2, "utf8").split("\n").filter(Boolean);
77314
77302
  const keptByKind = /* @__PURE__ */ new Map();
77315
77303
  const kept = [];
77316
77304
  for (let i2 = lines.length - 1; i2 >= 0; i2--) {
@@ -77326,16 +77314,16 @@ function appendPassLedger(configDir, kind, durationMs, counts) {
77326
77314
  kept.push(lines[i2]);
77327
77315
  }
77328
77316
  if (kept.length < lines.length) {
77329
- writeFileSync15(path2, kept.reverse().join("\n") + "\n");
77317
+ writeFileSync16(path2, kept.reverse().join("\n") + "\n");
77330
77318
  }
77331
77319
  } catch {
77332
77320
  }
77333
77321
  }
77334
77322
  function readPassLedger(configDir) {
77335
77323
  const path2 = passLedgerPath(configDir);
77336
- if (!existsSync19(path2)) return [];
77324
+ if (!existsSync20(path2)) return [];
77337
77325
  try {
77338
- return readFileSync17(path2, "utf8").split("\n").filter(Boolean).map((l) => JSON.parse(l)).filter(
77326
+ return readFileSync18(path2, "utf8").split("\n").filter(Boolean).map((l) => JSON.parse(l)).filter(
77339
77327
  (e) => typeof e?.ts === "number" && typeof e?.kind === "string" && typeof e?.durationMs === "number"
77340
77328
  ).map((e) => ({ ...e, counts: e.counts ?? {} }));
77341
77329
  } catch {
@@ -77707,11 +77695,11 @@ init_outbox();
77707
77695
  init_src10();
77708
77696
  init_src();
77709
77697
  init_src2();
77710
- import { readFileSync as readFileSync18 } from "node:fs";
77711
- import { join as join24 } from "node:path";
77698
+ import { readFileSync as readFileSync19 } from "node:fs";
77699
+ import { join as join25 } from "node:path";
77712
77700
  function loadClaimIgnorePatterns(workspaceRoot) {
77713
77701
  try {
77714
- return readFileSync18(join24(workspaceRoot, ".errataignore"), "utf8").split(/\r?\n/).map((l) => l.trim()).filter((l) => l.length > 0 && !l.startsWith("#")).map((l) => l.toLowerCase());
77702
+ return readFileSync19(join25(workspaceRoot, ".errataignore"), "utf8").split(/\r?\n/).map((l) => l.trim()).filter((l) => l.length > 0 && !l.startsWith("#")).map((l) => l.toLowerCase());
77715
77703
  } catch {
77716
77704
  return [];
77717
77705
  }
@@ -78089,9 +78077,9 @@ async function pullCloudTriage(shared, cloud, profile, limit = 50) {
78089
78077
  // src/retrieval-stack.ts
78090
78078
  init_src();
78091
78079
  import { execFileSync as execFileSync3 } from "node:child_process";
78092
- import { existsSync as existsSync20, readFileSync as readFileSync19, statSync as statSync7 } from "node:fs";
78080
+ import { existsSync as existsSync21, readFileSync as readFileSync20, statSync as statSync7 } from "node:fs";
78093
78081
  import { homedir as homedir6 } from "node:os";
78094
- import { join as join25 } from "node:path";
78082
+ import { join as join26 } from "node:path";
78095
78083
  var RETRIEVAL_STACK_CAP = 24;
78096
78084
  var MANIFEST_SCAN_CAP = 400;
78097
78085
  var RUNTIME_TOKENS = /* @__PURE__ */ new Set([
@@ -78381,51 +78369,51 @@ function mavenGroupIsSelfDisclosing(name2, selfTokens) {
78381
78369
  function loadRegistryPolicy(root, env2 = process.env, repoLocator) {
78382
78370
  const read2 = (p) => {
78383
78371
  try {
78384
- return readFileSync19(p, "utf8");
78372
+ return readFileSync20(p, "utf8");
78385
78373
  } catch {
78386
78374
  return null;
78387
78375
  }
78388
78376
  };
78389
78377
  const texts = (...paths) => paths.map(read2).filter((t) => t !== null);
78390
78378
  const home = homedir6();
78391
- const npm = parseNpmrcPolicy(texts(join25(root, ".npmrc"), join25(home, ".npmrc")));
78379
+ const npm = parseNpmrcPolicy(texts(join26(root, ".npmrc"), join26(home, ".npmrc")));
78392
78380
  const blocked = /* @__PURE__ */ new Set();
78393
78381
  if (!npm.defaultPublic) blocked.add("npm");
78394
78382
  if (pypiIndexIsPrivate(
78395
78383
  texts(
78396
- join25(root, "pip.conf"),
78397
- join25(root, "pip.ini"),
78398
- join25(root, "pyproject.toml"),
78399
- join25(root, "requirements.txt"),
78400
- join25(home, ".pip", "pip.conf"),
78401
- join25(home, ".config", "pip", "pip.conf"),
78402
- join25(env2["APPDATA"] ?? home, "pip", "pip.ini")
78384
+ join26(root, "pip.conf"),
78385
+ join26(root, "pip.ini"),
78386
+ join26(root, "pyproject.toml"),
78387
+ join26(root, "requirements.txt"),
78388
+ join26(home, ".pip", "pip.conf"),
78389
+ join26(home, ".config", "pip", "pip.conf"),
78390
+ join26(env2["APPDATA"] ?? home, "pip", "pip.ini")
78403
78391
  )
78404
78392
  )) {
78405
78393
  blocked.add("pypi");
78406
78394
  }
78407
78395
  if (cargoRegistryIsPrivate(
78408
78396
  texts(
78409
- join25(root, ".cargo", "config.toml"),
78410
- join25(root, ".cargo", "config"),
78411
- join25(home, ".cargo", "config.toml"),
78412
- join25(home, ".cargo", "config")
78397
+ join26(root, ".cargo", "config.toml"),
78398
+ join26(root, ".cargo", "config"),
78399
+ join26(home, ".cargo", "config.toml"),
78400
+ join26(home, ".cargo", "config")
78413
78401
  )
78414
78402
  )) {
78415
78403
  blocked.add("cargo");
78416
78404
  }
78417
78405
  if (nugetSourcesArePrivate(
78418
78406
  texts(
78419
- join25(root, "NuGet.config"),
78420
- join25(root, "nuget.config"),
78421
- join25(root, "NuGet.Config"),
78422
- join25(env2["APPDATA"] ?? home, "NuGet", "NuGet.Config"),
78423
- join25(home, ".nuget", "NuGet", "NuGet.Config")
78407
+ join26(root, "NuGet.config"),
78408
+ join26(root, "nuget.config"),
78409
+ join26(root, "NuGet.Config"),
78410
+ join26(env2["APPDATA"] ?? home, "NuGet", "NuGet.Config"),
78411
+ join26(home, ".nuget", "NuGet", "NuGet.Config")
78424
78412
  )
78425
78413
  )) {
78426
78414
  blocked.add("nuget");
78427
78415
  }
78428
- const goEnvFile = env2["GOENV"] ?? join25(env2["APPDATA"] ?? join25(home, ".config"), "go", "env");
78416
+ const goEnvFile = env2["GOENV"] ?? join26(env2["APPDATA"] ?? join26(home, ".config"), "go", "env");
78429
78417
  const goEnvText = read2(goEnvFile) ?? "";
78430
78418
  const fromFile = ["GOPRIVATE", "GONOSUMDB", "GONOSUMCHECK"].map(
78431
78419
  (k) => new RegExp(`^${k}=(.*)$`, "m").exec(goEnvText)?.[1]
@@ -78436,10 +78424,10 @@ function loadRegistryPolicy(root, env2 = process.env, repoLocator) {
78436
78424
  env2["GONOSUMCHECK"],
78437
78425
  ...fromFile
78438
78426
  ]);
78439
- const gemfiles = texts(join25(root, "Gemfile"));
78427
+ const gemfiles = texts(join26(root, "Gemfile"));
78440
78428
  if (gemSourceIsPrivate(gemfiles)) blocked.add("gem");
78441
78429
  if (mavenReposArePrivate(
78442
- texts(join25(root, "pom.xml"), join25(home, ".m2", "settings.xml"))
78430
+ texts(join26(root, "pom.xml"), join26(home, ".m2", "settings.xml"))
78443
78431
  )) {
78444
78432
  blocked.add("maven");
78445
78433
  }
@@ -78606,8 +78594,8 @@ function readDirectDependencies(root) {
78606
78594
  const familiesSeen = /* @__PURE__ */ new Set();
78607
78595
  for (const c of LOCKFILES) {
78608
78596
  if (familiesSeen.has(c.family)) continue;
78609
- const p = join25(root, c.file);
78610
- if (!existsSync20(p)) continue;
78597
+ const p = join26(root, c.file);
78598
+ if (!existsSync21(p)) continue;
78611
78599
  try {
78612
78600
  const s = statSync7(p);
78613
78601
  stamps.push(`${c.file}:${s.mtimeMs}:${s.size}`);
@@ -78627,7 +78615,7 @@ function readDirectDependencies(root) {
78627
78615
  const direct = [];
78628
78616
  for (const { c, path: path2 } of found) {
78629
78617
  try {
78630
- direct.push(...c.parse(readFileSync19(path2, "utf8")).direct ?? []);
78618
+ direct.push(...c.parse(readFileSync20(path2, "utf8")).direct ?? []);
78631
78619
  } catch {
78632
78620
  }
78633
78621
  }
@@ -78670,14 +78658,14 @@ function manifestPaths(root) {
78670
78658
  "project.godot"
78671
78659
  ];
78672
78660
  return {
78673
- paths: ROOT_MANIFESTS.filter((f) => existsSync20(join25(root, f))),
78661
+ paths: ROOT_MANIFESTS.filter((f) => existsSync21(join26(root, f))),
78674
78662
  tracked: false,
78675
78663
  truncated: false
78676
78664
  };
78677
78665
  }
78678
78666
  var WORKSPACE_MARKERS = ["pnpm-workspace.yaml", "lerna.json", "go.work", "settings.gradle", "settings.gradle.kts"];
78679
78667
  function rootDeclaresWorkspace(root, texts) {
78680
- if (WORKSPACE_MARKERS.some((f) => existsSync20(join25(root, f)))) return true;
78668
+ if (WORKSPACE_MARKERS.some((f) => existsSync21(join26(root, f)))) return true;
78681
78669
  return /"workspaces"\s*:/.test(texts.get("package.json") ?? "") || /<modules>/.test(texts.get("pom.xml") ?? "") || /^\s*\[workspace\]/m.test(texts.get("Cargo.toml") ?? "");
78682
78670
  }
78683
78671
  var EMPTY_SCAN = { deps: [], self: [], complete: true };
@@ -78691,11 +78679,11 @@ function scanManifests(root) {
78691
78679
  const texts = /* @__PURE__ */ new Map();
78692
78680
  const stamps = [];
78693
78681
  for (const rel of paths) {
78694
- const abs = join25(root, rel);
78682
+ const abs = join26(root, rel);
78695
78683
  try {
78696
78684
  const s = statSync7(abs);
78697
78685
  stamps.push(`${rel}:${s.mtimeMs}:${s.size}`);
78698
- texts.set(rel, readFileSync19(abs, "utf8"));
78686
+ texts.set(rel, readFileSync20(abs, "utf8"));
78699
78687
  } catch {
78700
78688
  }
78701
78689
  }
@@ -78724,22 +78712,22 @@ function readManifestDependencies(root) {
78724
78712
  }
78725
78713
 
78726
78714
  // src/git-sensor.ts
78727
- import { existsSync as existsSync21, readFileSync as readFileSync20, watch as fsWatch } from "node:fs";
78728
- import { join as join26 } from "node:path";
78715
+ import { existsSync as existsSync22, readFileSync as readFileSync21, watch as fsWatch } from "node:fs";
78716
+ import { join as join27 } from "node:path";
78729
78717
  function readFirstLine(path2) {
78730
78718
  try {
78731
- return readFileSync20(path2, "utf8").split(/\r?\n/, 1)[0].trim();
78719
+ return readFileSync21(path2, "utf8").split(/\r?\n/, 1)[0].trim();
78732
78720
  } catch {
78733
78721
  return null;
78734
78722
  }
78735
78723
  }
78736
78724
  function readGitRefState(gitDir) {
78737
- const head2 = readFirstLine(join26(gitDir, "HEAD"));
78725
+ const head2 = readFirstLine(join27(gitDir, "HEAD"));
78738
78726
  const m = head2 ? /^ref:\s*refs\/heads\/(.+)$/.exec(head2) : null;
78739
78727
  const branch = m ? m[1] : null;
78740
78728
  let sha2 = null;
78741
78729
  if (branch) {
78742
- sha2 = readFirstLine(join26(gitDir, "refs", "heads", branch));
78730
+ sha2 = readFirstLine(join27(gitDir, "refs", "heads", branch));
78743
78731
  if (!sha2) sha2 = shaFromPackedRefs(gitDir, `refs/heads/${branch}`);
78744
78732
  } else if (head2 && /^[0-9a-f]{7,40}$/i.test(head2)) {
78745
78733
  sha2 = head2;
@@ -78747,13 +78735,13 @@ function readGitRefState(gitDir) {
78747
78735
  return {
78748
78736
  branch,
78749
78737
  sha: sha2,
78750
- mergeHeadExists: existsSync21(join26(gitDir, "MERGE_HEAD")),
78751
- origHeadExists: existsSync21(join26(gitDir, "ORIG_HEAD"))
78738
+ mergeHeadExists: existsSync22(join27(gitDir, "MERGE_HEAD")),
78739
+ origHeadExists: existsSync22(join27(gitDir, "ORIG_HEAD"))
78752
78740
  };
78753
78741
  }
78754
78742
  function shaFromPackedRefs(gitDir, ref) {
78755
78743
  try {
78756
- for (const line of readFileSync20(join26(gitDir, "packed-refs"), "utf8").split(/\r?\n/)) {
78744
+ for (const line of readFileSync21(join27(gitDir, "packed-refs"), "utf8").split(/\r?\n/)) {
78757
78745
  const [sha2, name2] = line.split(/\s+/);
78758
78746
  if (name2 === ref && sha2) return sha2;
78759
78747
  }
@@ -78787,7 +78775,7 @@ function startGitSensor(gitDir, onEvent, opts = {}) {
78787
78775
  const settle = () => {
78788
78776
  if (timer) clearTimeout(timer);
78789
78777
  timer = setTimeout(() => {
78790
- if (existsSync21(join26(gitDir, "index.lock"))) {
78778
+ if (existsSync22(join27(gitDir, "index.lock"))) {
78791
78779
  settle();
78792
78780
  return;
78793
78781
  }
@@ -78798,7 +78786,7 @@ function startGitSensor(gitDir, onEvent, opts = {}) {
78798
78786
  }, debounceMs);
78799
78787
  };
78800
78788
  for (const sub of ["HEAD", "logs/HEAD", "MERGE_HEAD", "ORIG_HEAD"]) {
78801
- const p = join26(gitDir, sub);
78789
+ const p = join27(gitDir, sub);
78802
78790
  try {
78803
78791
  watchers.push(fsWatch(p, settle));
78804
78792
  } catch {
@@ -79022,8 +79010,8 @@ var TelemetryRecorder = class {
79022
79010
  };
79023
79011
 
79024
79012
  // src/file-activity.ts
79025
- import { readFileSync as readFileSync22 } from "node:fs";
79026
- import { join as join28 } from "node:path";
79013
+ import { readFileSync as readFileSync23 } from "node:fs";
79014
+ import { join as join29 } from "node:path";
79027
79015
  import { createHash as createHash17 } from "node:crypto";
79028
79016
 
79029
79017
  // ../../packages/privacy/src/patterns/credentials.ts
@@ -79775,8 +79763,8 @@ init_git_remote();
79775
79763
  // src/history-bundle.ts
79776
79764
  init_src();
79777
79765
  import { execFile as execFile2 } from "node:child_process";
79778
- import { readFileSync as readFileSync21 } from "node:fs";
79779
- import { join as join27 } from "node:path";
79766
+ import { readFileSync as readFileSync22 } from "node:fs";
79767
+ import { join as join28 } from "node:path";
79780
79768
  var DEFAULT_MAX_TOKENS = 6e3;
79781
79769
  var FILE_LIST_CAP = 60;
79782
79770
  var DIFF_FILE_CAP = 40;
@@ -79811,7 +79799,7 @@ function pathAllowedByFloor(path2) {
79811
79799
  function loadRepoIgnore(root, extraPatterns = []) {
79812
79800
  let source = "";
79813
79801
  try {
79814
- source = readFileSync21(join27(root, ".errataignore"), "utf8");
79802
+ source = readFileSync22(join28(root, ".errataignore"), "utf8");
79815
79803
  } catch {
79816
79804
  source = "";
79817
79805
  }
@@ -80104,7 +80092,7 @@ function readActivityBranch(root) {
80104
80092
  try {
80105
80093
  const gitDir = resolveGitDir(root);
80106
80094
  if (!gitDir) return null;
80107
- const head2 = readFileSync22(join28(gitDir, "HEAD"), "utf8").trim();
80095
+ const head2 = readFileSync23(join29(gitDir, "HEAD"), "utf8").trim();
80108
80096
  const branch = head2.startsWith("ref: refs/heads/") ? head2.slice(16) : /^[a-f0-9]{40,64}$/i.test(head2) ? "HEAD" : null;
80109
80097
  return branch && branch.length <= 256 && !/[\x00-\x1f\x7f]/.test(branch) ? branch : null;
80110
80098
  } catch {
@@ -80261,21 +80249,21 @@ var FileActivityReporter = class {
80261
80249
 
80262
80250
  // src/skills.ts
80263
80251
  import {
80264
- existsSync as existsSync22,
80252
+ existsSync as existsSync23,
80265
80253
  mkdirSync as mkdirSync7,
80266
- readFileSync as readFileSync23,
80254
+ readFileSync as readFileSync24,
80267
80255
  readdirSync as readdirSync8,
80268
80256
  unlinkSync as unlinkSync2,
80269
- writeFileSync as writeFileSync16
80257
+ writeFileSync as writeFileSync17
80270
80258
  } from "node:fs";
80271
- import { basename as basename6, join as join29 } from "node:path";
80259
+ import { basename as basename6, join as join30 } from "node:path";
80272
80260
  function skillFileName(id) {
80273
80261
  return `${id.replace(/[^A-Za-z0-9_.-]/g, "_")}.md`;
80274
80262
  }
80275
80263
  function readSkillManifest(manifestPath) {
80276
- if (!existsSync22(manifestPath)) return [];
80264
+ if (!existsSync23(manifestPath)) return [];
80277
80265
  try {
80278
- const parsed = JSON.parse(readFileSync23(manifestPath, "utf8"));
80266
+ const parsed = JSON.parse(readFileSync24(manifestPath, "utf8"));
80279
80267
  return (parsed.skills ?? []).map((s) => ({
80280
80268
  title: s.title ?? "",
80281
80269
  layer: s.layer ?? "technique",
@@ -80299,7 +80287,7 @@ async function syncSkills(paths, client, seed, pins = [], techSeed) {
80299
80287
  for (const s of res.skills) {
80300
80288
  const fileName = skillFileName(s.id);
80301
80289
  keep.add(fileName);
80302
- writeFileSync16(join29(paths.skillsDir, fileName), s.markdown, "utf8");
80290
+ writeFileSync17(join30(paths.skillsDir, fileName), s.markdown, "utf8");
80303
80291
  rows.push({
80304
80292
  id: s.id,
80305
80293
  title: s.title,
@@ -80312,7 +80300,7 @@ async function syncSkills(paths, client, seed, pins = [], techSeed) {
80312
80300
  const fileName = skillFileName(p.id);
80313
80301
  if (keep.has(fileName)) continue;
80314
80302
  keep.add(fileName);
80315
- writeFileSync16(join29(paths.skillsDir, fileName), p.markdown, "utf8");
80303
+ writeFileSync17(join30(paths.skillsDir, fileName), p.markdown, "utf8");
80316
80304
  rows.push({
80317
80305
  id: p.id,
80318
80306
  title: p.title,
@@ -80326,13 +80314,13 @@ async function syncSkills(paths, client, seed, pins = [], techSeed) {
80326
80314
  if (!f.endsWith(".md")) continue;
80327
80315
  if (keep.has(basename6(f))) continue;
80328
80316
  try {
80329
- unlinkSync2(join29(paths.skillsDir, f));
80317
+ unlinkSync2(join30(paths.skillsDir, f));
80330
80318
  pruned++;
80331
80319
  } catch {
80332
80320
  }
80333
80321
  }
80334
80322
  rows.sort((a, b) => a.id.localeCompare(b.id));
80335
- writeFileSync16(
80323
+ writeFileSync17(
80336
80324
  paths.skillsManifest,
80337
80325
  JSON.stringify({ generatedAt: Date.now(), skills: rows }, null, 2),
80338
80326
  "utf8"
@@ -80344,22 +80332,22 @@ async function syncSkills(paths, client, seed, pins = [], techSeed) {
80344
80332
  init_src2();
80345
80333
  import {
80346
80334
  cpSync,
80347
- existsSync as existsSync23,
80335
+ existsSync as existsSync24,
80348
80336
  lstatSync,
80349
80337
  mkdirSync as mkdirSync8,
80350
- readFileSync as readFileSync24,
80338
+ readFileSync as readFileSync25,
80351
80339
  readdirSync as readdirSync9,
80352
80340
  rmSync as rmSync3,
80353
80341
  symlinkSync,
80354
- writeFileSync as writeFileSync17
80342
+ writeFileSync as writeFileSync18
80355
80343
  } from "node:fs";
80356
- import { join as join30 } from "node:path";
80344
+ import { join as join31 } from "node:path";
80357
80345
  var SKILL_NS = "errata-";
80358
80346
  var HARNESS_SKILL_DIRS = [
80359
- { configDir: ".claude", skillsDir: join30(".claude", "skills") },
80347
+ { configDir: ".claude", skillsDir: join31(".claude", "skills") },
80360
80348
  // Cursor adopted the standard; its exact project dir is still moving — kept
80361
80349
  // best-effort and gated on `.cursor/` presence so we never create it blind.
80362
- { configDir: ".cursor", skillsDir: join30(".cursor", "skills") }
80350
+ { configDir: ".cursor", skillsDir: join31(".cursor", "skills") }
80363
80351
  ];
80364
80352
  function skillSlug(title, id) {
80365
80353
  const base = title.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || id.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "skill";
@@ -80404,12 +80392,12 @@ function skillCiteHandle(s) {
80404
80392
  return priorHandle({ id: s.id, description: s.title });
80405
80393
  }
80406
80394
  function reconcileNamespaced(dir, keep) {
80407
- if (!existsSync23(dir)) return 0;
80395
+ if (!existsSync24(dir)) return 0;
80408
80396
  let pruned = 0;
80409
80397
  for (const name2 of readdirSync9(dir)) {
80410
80398
  if (!name2.startsWith(SKILL_NS) || keep.has(name2)) continue;
80411
80399
  try {
80412
- rmSync3(join30(dir, name2), { recursive: true, force: true });
80400
+ rmSync3(join31(dir, name2), { recursive: true, force: true });
80413
80401
  pruned++;
80414
80402
  } catch {
80415
80403
  }
@@ -80418,7 +80406,7 @@ function reconcileNamespaced(dir, keep) {
80418
80406
  }
80419
80407
  function linkOrCopy(linkPath, target) {
80420
80408
  try {
80421
- if (existsSync23(linkPath) || safeLstat(linkPath)) rmSync3(linkPath, { recursive: true, force: true });
80409
+ if (existsSync24(linkPath) || safeLstat(linkPath)) rmSync3(linkPath, { recursive: true, force: true });
80422
80410
  } catch {
80423
80411
  }
80424
80412
  try {
@@ -80439,7 +80427,7 @@ function safeLstat(p) {
80439
80427
  }
80440
80428
  }
80441
80429
  function emitAndProjectSkills(root, skills) {
80442
- const agentsSkillsDir = join30(root, ".agents", "skills");
80430
+ const agentsSkillsDir = join31(root, ".agents", "skills");
80443
80431
  mkdirSync8(agentsSkillsDir, { recursive: true });
80444
80432
  const slugs = [];
80445
80433
  const keep = /* @__PURE__ */ new Set();
@@ -80447,7 +80435,7 @@ function emitAndProjectSkills(root, skills) {
80447
80435
  for (const s of skills) {
80448
80436
  let body2;
80449
80437
  try {
80450
- body2 = readFileSync24(s.bodyPath, "utf8");
80438
+ body2 = readFileSync25(s.bodyPath, "utf8");
80451
80439
  } catch {
80452
80440
  continue;
80453
80441
  }
@@ -80456,9 +80444,9 @@ function emitAndProjectSkills(root, skills) {
80456
80444
  keep.add(slug2);
80457
80445
  slugs.push(slug2);
80458
80446
  const description = deriveDescription(s.title, s.layer, body2);
80459
- mkdirSync8(join30(agentsSkillsDir, slug2), { recursive: true });
80460
- writeFileSync17(
80461
- join30(agentsSkillsDir, slug2, "SKILL.md"),
80447
+ mkdirSync8(join31(agentsSkillsDir, slug2), { recursive: true });
80448
+ writeFileSync18(
80449
+ join31(agentsSkillsDir, slug2, "SKILL.md"),
80462
80450
  renderSkillMd(slug2, description, body2, skillCiteHandle(s)),
80463
80451
  "utf8"
80464
80452
  );
@@ -80467,11 +80455,11 @@ function emitAndProjectSkills(root, skills) {
80467
80455
  reconcileNamespaced(agentsSkillsDir, keep);
80468
80456
  let projected = 0;
80469
80457
  for (const h of HARNESS_SKILL_DIRS) {
80470
- if (!existsSync23(join30(root, h.configDir))) continue;
80471
- const dir = join30(root, h.skillsDir);
80458
+ if (!existsSync24(join31(root, h.configDir))) continue;
80459
+ const dir = join31(root, h.skillsDir);
80472
80460
  mkdirSync8(dir, { recursive: true });
80473
80461
  for (const slug2 of slugs) {
80474
- linkOrCopy(join30(dir, slug2), join30(agentsSkillsDir, slug2));
80462
+ linkOrCopy(join31(dir, slug2), join31(agentsSkillsDir, slug2));
80475
80463
  projected++;
80476
80464
  }
80477
80465
  reconcileNamespaced(dir, keep);
@@ -80480,15 +80468,15 @@ function emitAndProjectSkills(root, skills) {
80480
80468
  return { slugs, emitted, projected };
80481
80469
  }
80482
80470
  function emitInputsFromManifest(erretaDir, manifestPath) {
80483
- if (!existsSync23(manifestPath)) return [];
80471
+ if (!existsSync24(manifestPath)) return [];
80484
80472
  try {
80485
- const parsed = JSON.parse(readFileSync24(manifestPath, "utf8"));
80473
+ const parsed = JSON.parse(readFileSync25(manifestPath, "utf8"));
80486
80474
  return (parsed.skills ?? []).filter((s) => Boolean(s.id && s.file)).map((s) => ({
80487
80475
  id: s.id,
80488
80476
  title: s.title ?? s.id,
80489
80477
  layer: s.layer ?? "technique",
80490
80478
  confidence: s.confidence ?? 0,
80491
- bodyPath: join30(erretaDir, s.file)
80479
+ bodyPath: join31(erretaDir, s.file)
80492
80480
  }));
80493
80481
  } catch {
80494
80482
  return [];
@@ -80502,17 +80490,17 @@ var GITIGNORE_LINES = [
80502
80490
  ".cursor/skills/errata-*/"
80503
80491
  ];
80504
80492
  function ensureSkillGitignore(root) {
80505
- const path2 = join30(root, ".gitignore");
80493
+ const path2 = join31(root, ".gitignore");
80506
80494
  let current = "";
80507
80495
  try {
80508
- current = existsSync23(path2) ? readFileSync24(path2, "utf8") : "";
80496
+ current = existsSync24(path2) ? readFileSync25(path2, "utf8") : "";
80509
80497
  } catch {
80510
80498
  return;
80511
80499
  }
80512
80500
  if (current.includes(GITIGNORE_MARK)) return;
80513
80501
  const prefix = current.length > 0 && !current.endsWith("\n") ? "\n" : "";
80514
80502
  try {
80515
- writeFileSync17(path2, `${current}${prefix}
80503
+ writeFileSync18(path2, `${current}${prefix}
80516
80504
  ${GITIGNORE_LINES.join("\n")}
80517
80505
  `, "utf8");
80518
80506
  } catch {
@@ -80608,18 +80596,18 @@ init_paths();
80608
80596
  init_profile2();
80609
80597
 
80610
80598
  // src/witness-queue.ts
80611
- import { readFileSync as readFileSync25, renameSync as renameSync2, writeFileSync as writeFileSync18 } from "node:fs";
80612
- import { dirname as dirname11, join as join31 } from "node:path";
80599
+ import { readFileSync as readFileSync26, renameSync as renameSync2, writeFileSync as writeFileSync19 } from "node:fs";
80600
+ import { dirname as dirname11, join as join32 } from "node:path";
80613
80601
  var WITNESS_QUEUE_CAP = 500;
80614
80602
  var WITNESS_TTL_MS = 14 * 24 * 60 * 60 * 1e3;
80615
80603
  var WITNESS_MAX_ATTEMPTS = 5;
80616
80604
  function witnessQueuePath(workspaceConfigDir) {
80617
- return join31(workspaceConfigDir, "witness-queue.json");
80605
+ return join32(workspaceConfigDir, "witness-queue.json");
80618
80606
  }
80619
80607
  function loadWitnessQueueWithLosses(path2) {
80620
80608
  let raw2;
80621
80609
  try {
80622
- raw2 = JSON.parse(readFileSync25(path2, "utf8"));
80610
+ raw2 = JSON.parse(readFileSync26(path2, "utf8"));
80623
80611
  } catch (err2) {
80624
80612
  const absent = err2?.code === "ENOENT";
80625
80613
  return { queue: [], fileUnreadable: !absent, malformedEntries: 0 };
@@ -80632,8 +80620,8 @@ function loadWitnessQueueWithLosses(path2) {
80632
80620
  }
80633
80621
  function saveWitnessQueue(path2, queue) {
80634
80622
  try {
80635
- const tmp = join31(dirname11(path2), `.${Date.now()}.witness-queue.tmp`);
80636
- writeFileSync18(tmp, JSON.stringify(queue), "utf8");
80623
+ const tmp = join32(dirname11(path2), `.${Date.now()}.witness-queue.tmp`);
80624
+ writeFileSync19(tmp, JSON.stringify(queue), "utf8");
80637
80625
  renameSync2(tmp, path2);
80638
80626
  } catch {
80639
80627
  }
@@ -80940,8 +80928,8 @@ function maybeFlushDigests() {
80940
80928
 
80941
80929
  // src/liveness-watch.ts
80942
80930
  init_src5();
80943
- import { readFileSync as readFileSync27, writeFileSync as writeFileSync20 } from "node:fs";
80944
- import { join as join33 } from "node:path";
80931
+ import { readFileSync as readFileSync28, writeFileSync as writeFileSync21 } from "node:fs";
80932
+ import { join as join34 } from "node:path";
80945
80933
 
80946
80934
  // src/loop-lag.ts
80947
80935
  var HEARTBEAT_MS = 500;
@@ -81072,11 +81060,11 @@ function watchCensusLine(c = watchCensus(), now = Date.now()) {
81072
81060
  var LIVENESS_WATCH_INTERVAL_MS = 60 * 60 * 1e3;
81073
81061
  var ALARM_RENOTIFY_MS = 24 * 60 * 60 * 1e3;
81074
81062
  function alarmStatePath(configDir) {
81075
- return join33(configDir, "liveness-alarms.json");
81063
+ return join34(configDir, "liveness-alarms.json");
81076
81064
  }
81077
81065
  function loadAlarmState(configDir) {
81078
81066
  try {
81079
- const raw2 = JSON.parse(readFileSync27(alarmStatePath(configDir), "utf8"));
81067
+ const raw2 = JSON.parse(readFileSync28(alarmStatePath(configDir), "utf8"));
81080
81068
  return new Map(Object.entries(raw2).filter((e) => typeof e[1] === "number"));
81081
81069
  } catch {
81082
81070
  return /* @__PURE__ */ new Map();
@@ -81084,7 +81072,7 @@ function loadAlarmState(configDir) {
81084
81072
  }
81085
81073
  function saveAlarmState(configDir, state) {
81086
81074
  try {
81087
- writeFileSync20(alarmStatePath(configDir), JSON.stringify(Object.fromEntries(state)));
81075
+ writeFileSync21(alarmStatePath(configDir), JSON.stringify(Object.fromEntries(state)));
81088
81076
  } catch {
81089
81077
  }
81090
81078
  }
@@ -81253,7 +81241,7 @@ function createWatchBreaker(deps) {
81253
81241
  }
81254
81242
 
81255
81243
  // src/engine.ts
81256
- var DAEMON_VERSION = true ? "2.0.14-dev.3228" : "2.0.0-alpha.0";
81244
+ var DAEMON_VERSION = true ? "2.0.14-dev.3236" : "2.0.0-alpha.0";
81257
81245
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
81258
81246
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
81259
81247
  var GIT_OP_MUTE_MS = 4e3;
@@ -81265,7 +81253,7 @@ var CODEX_SWEEP_LOOKBACK_MS = 10 * 6e4;
81265
81253
  function appendIdentityAudit(path2, record2, line) {
81266
81254
  if (!record2.accepted && record2.score <= 0) return;
81267
81255
  try {
81268
- if (existsSync25(path2) && statSync8(path2).size >= IDENTITY_AUDIT_MAX_BYTES) {
81256
+ if (existsSync26(path2) && statSync8(path2).size >= IDENTITY_AUDIT_MAX_BYTES) {
81269
81257
  renameSync3(path2, `${path2}.1`);
81270
81258
  }
81271
81259
  appendFileSync4(path2, line);
@@ -81275,7 +81263,7 @@ function appendIdentityAudit(path2, record2, line) {
81275
81263
  var yieldToLoop = () => new Promise((r) => setImmediate(r));
81276
81264
  function loadTurnCursors(path2) {
81277
81265
  try {
81278
- const raw2 = JSON.parse(readFileSync28(path2, "utf8"));
81266
+ const raw2 = JSON.parse(readFileSync29(path2, "utf8"));
81279
81267
  return new Map(
81280
81268
  Object.entries(raw2).map(([k, v]) => [k, typeof v === "string" ? v : String(v?.uuid ?? "")])
81281
81269
  );
@@ -81285,7 +81273,7 @@ function loadTurnCursors(path2) {
81285
81273
  }
81286
81274
  function loadTurnOffsets(path2) {
81287
81275
  try {
81288
- const raw2 = JSON.parse(readFileSync28(path2, "utf8"));
81276
+ const raw2 = JSON.parse(readFileSync29(path2, "utf8"));
81289
81277
  const out2 = /* @__PURE__ */ new Map();
81290
81278
  for (const [k, v] of Object.entries(raw2)) {
81291
81279
  const off = typeof v === "object" && v !== null ? v.offset : void 0;
@@ -81301,7 +81289,7 @@ function saveTurnCursors(path2, cursors, offsets) {
81301
81289
  const merged = {};
81302
81290
  for (const [k, uuid3] of cursors) merged[k] = { uuid: uuid3, offset: offsets.get(k) ?? 0 };
81303
81291
  for (const [k, offset] of offsets) if (!merged[k]) merged[k] = { uuid: "", offset };
81304
- writeFileSync21(path2, JSON.stringify(merged), "utf8");
81292
+ writeFileSync22(path2, JSON.stringify(merged), "utf8");
81305
81293
  } catch {
81306
81294
  }
81307
81295
  }
@@ -81323,7 +81311,7 @@ function gitSourceWatchTargets(root) {
81323
81311
  ["-C", root, "ls-files", "--others", "--ignored", "--exclude-standard", "--directory", "-z"],
81324
81312
  { encoding: "utf8", maxBuffer: 256 * 1024 * 1024, windowsHide: true, stdio: ["ignore", "pipe", "ignore"] }
81325
81313
  );
81326
- ignoredDirs = igOut.split("\0").filter(Boolean).map((d) => d.replace(/\/+$/, "")).filter((d) => !IGNORED_PATH.test(join34(root, d) + sep4));
81314
+ ignoredDirs = igOut.split("\0").filter(Boolean).map((d) => d.replace(/\/+$/, "")).filter((d) => !IGNORED_PATH.test(join35(root, d) + sep4));
81327
81315
  } catch {
81328
81316
  }
81329
81317
  const hasIgnoredChild = (dir) => ignoredDirs.some((ig) => ig.startsWith(dir + "/"));
@@ -81335,19 +81323,19 @@ function gitSourceWatchTargets(root) {
81335
81323
  if (!f.startsWith(prefix)) continue;
81336
81324
  const rest2 = f.slice(prefix.length);
81337
81325
  if (rest2.includes("/")) children.add(dir === "" ? rest2.slice(0, rest2.indexOf("/")) : dir + "/" + rest2.slice(0, rest2.indexOf("/")));
81338
- else targets.add(join34(root, f));
81326
+ else targets.add(join35(root, f));
81339
81327
  }
81340
81328
  for (const c of children) {
81341
- if (IGNORED_PATH.test(join34(root, c) + sep4)) continue;
81329
+ if (IGNORED_PATH.test(join35(root, c) + sep4)) continue;
81342
81330
  if (hasIgnoredChild(c)) addUnder(c);
81343
- else targets.add(join34(root, c));
81331
+ else targets.add(join35(root, c));
81344
81332
  }
81345
81333
  };
81346
81334
  addUnder("");
81347
81335
  if (targets.size > 0) return [...targets];
81348
81336
  } catch {
81349
81337
  }
81350
- return readdirSync10(root, { withFileTypes: true }).filter((e) => e.isDirectory() && !IGNORED_PATH.test(join34(root, String(e.name)) + sep4)).map((e) => join34(root, String(e.name)));
81338
+ return readdirSync10(root, { withFileTypes: true }).filter((e) => e.isDirectory() && !IGNORED_PATH.test(join35(root, String(e.name)) + sep4)).map((e) => join35(root, String(e.name)));
81351
81339
  }
81352
81340
  function createWorkspaceEngine(opts) {
81353
81341
  const paths = workspacePaths(opts.workspaceRoot);
@@ -81553,7 +81541,7 @@ function createWorkspaceEngine(opts) {
81553
81541
  const srcPaths = diff.changedPaths.filter((p) => /\.(ts|tsx|js|jsx|mjs|cjs|py)$/i.test(p));
81554
81542
  let episodeId2;
81555
81543
  if (srcPaths.length > 0) {
81556
- const abs = srcPaths.map((p) => join34(opts.workspaceRoot, p));
81544
+ const abs = srcPaths.map((p) => join35(opts.workspaceRoot, p));
81557
81545
  try {
81558
81546
  const r = await runReindexPass(
81559
81547
  `git-reindex:${profile.name} (${abs.length} files)`,
@@ -81589,8 +81577,8 @@ function createWorkspaceEngine(opts) {
81589
81577
  `[errata] git: ${ev.kind} ${ev.newSha.slice(0, 7)} by ${meta3.authorName} \u2014 ${diff.changedPaths.length} file(s), ${diff.renames.length} rename(s)`
81590
81578
  );
81591
81579
  };
81592
- const gitDir = join34(opts.workspaceRoot, ".git");
81593
- if (existsSync25(gitDir)) {
81580
+ const gitDir = join35(opts.workspaceRoot, ".git");
81581
+ if (existsSync26(gitDir)) {
81594
81582
  stopGit = startGitSensor(gitDir, (ev) => {
81595
81583
  void handleGitEvent(ev).catch((err2) => {
81596
81584
  console.warn("[errata] git event handler failed:", err2);
@@ -81709,7 +81697,7 @@ function createWorkspaceEngine(opts) {
81709
81697
  const elicit = isEdgeElicitationEnabled();
81710
81698
  const snapOpts = {
81711
81699
  profile,
81712
- atCommit: readGitRefState(join34(opts.workspaceRoot, ".git")).sha ?? void 0,
81700
+ atCommit: readGitRefState(join35(opts.workspaceRoot, ".git")).sha ?? void 0,
81713
81701
  reviewCount: pendingCount(paths),
81714
81702
  reviewUiUrl: opts.reviewUrl(),
81715
81703
  workingFile: workingFiles.mostRecent() ?? void 0,
@@ -81723,7 +81711,7 @@ function createWorkspaceEngine(opts) {
81723
81711
  );
81724
81712
  return null;
81725
81713
  }) : null;
81726
- if (snapOpts.atCommit !== (readGitRefState(join34(opts.workspaceRoot, ".git")).sha ?? void 0)) {
81714
+ if (snapOpts.atCommit !== (readGitRefState(join35(opts.workspaceRoot, ".git")).sha ?? void 0)) {
81727
81715
  contextDirty = true;
81728
81716
  return;
81729
81717
  }
@@ -81776,10 +81764,16 @@ function createWorkspaceEngine(opts) {
81776
81764
  console.warn("[errata] render ledger failed:", err2.message?.slice(0, 120));
81777
81765
  }
81778
81766
  writeContextFile(opts.workspaceRoot, body2);
81779
- const target = join34(opts.workspaceRoot, "AGENTS.md");
81767
+ try {
81768
+ const written = readContextFileWithHash(opts.workspaceRoot);
81769
+ if (written) writeContextCard(opts.workspaceRoot, written.hash, contextCard(store, snapshot));
81770
+ } catch (err2) {
81771
+ console.warn("[errata] context card failed:", err2.message?.slice(0, 120));
81772
+ }
81773
+ const target = join35(opts.workspaceRoot, "AGENTS.md");
81780
81774
  writeManagedBlock(target, { body: AGENTS_POINTER_BODY, stable: true, force: true });
81781
81775
  if (elicit) {
81782
- writePrimingHandles(join34(paths.configDir, "priming-handles.json"), [
81776
+ writePrimingHandles(join35(paths.configDir, "priming-handles.json"), [
81783
81777
  ...snapshot.recentProblems.map((r) => r.node),
81784
81778
  // Resolved-band handles: the ✓ problem AND its Solution are citable
81785
81779
  // (a fix tag on an already-resolved problem no-ops idempotently; the
@@ -82121,7 +82115,7 @@ function createWorkspaceEngine(opts) {
82121
82115
  resultSummary: { exitCode: e.exitCode ?? 1, errorTokens: e.errorTokens }
82122
82116
  });
82123
82117
  };
82124
- const turnCursorPath = join34(paths.configDir, "turn-cursors.json");
82118
+ const turnCursorPath = join35(paths.configDir, "turn-cursors.json");
82125
82119
  const lastTurnUuid = loadTurnCursors(turnCursorPath);
82126
82120
  const turnOffset = loadTurnOffsets(turnCursorPath);
82127
82121
  const readLosses = { parseFailures: 0, ioFailures: 0, bytesUnreachable: 0, sliceGuardHits: 0 };
@@ -82179,7 +82173,7 @@ function createWorkspaceEngine(opts) {
82179
82173
  let processedTurns = 0;
82180
82174
  const seqAtStart = store.currentIngestSeq();
82181
82175
  const elicit = isEdgeElicitationEnabled();
82182
- const handleMap = elicit ? readPrimingHandles(join34(paths.configDir, "priming-handles.json")) : {};
82176
+ const handleMap = elicit ? readPrimingHandles(join35(paths.configDir, "priming-handles.json")) : {};
82183
82177
  const wsRoot = (opts.workspaceRoot ?? "").replace(/\\/g, "/");
82184
82178
  const toRel = (abs) => {
82185
82179
  const p = abs.replace(/\\/g, "/");
@@ -82476,10 +82470,10 @@ function createWorkspaceEngine(opts) {
82476
82470
  let enclosing = {};
82477
82471
  if (p.location?.line !== void 0) {
82478
82472
  try {
82479
- const headSha = readGitRefState(join34(opts.workspaceRoot, ".git")).sha ?? void 0;
82473
+ const headSha = readGitRefState(join35(opts.workspaceRoot, ".git")).sha ?? void 0;
82480
82474
  enclosing = {
82481
82475
  line: p.location.line,
82482
- fileText: readFileSync28(join34(opts.workspaceRoot, anchorPath), "utf8"),
82476
+ fileText: readFileSync29(join35(opts.workspaceRoot, anchorPath), "utf8"),
82483
82477
  ...headSha ? { headSha } : {}
82484
82478
  };
82485
82479
  } catch {
@@ -83278,7 +83272,7 @@ B: ${b}`,
83278
83272
  try {
83279
83273
  const inputs = emitInputsFromManifest(paths.configDir, paths.skillsManifest);
83280
83274
  emitAndProjectSkills(opts.workspaceRoot, inputs);
83281
- writePrimingHandles(join34(paths.configDir, "priming-handles.json"), skillHandleNodes(inputs));
83275
+ writePrimingHandles(join35(paths.configDir, "priming-handles.json"), skillHandleNodes(inputs));
83282
83276
  } catch (err2) {
83283
83277
  console.warn("[skills] agent-skills projection failed (non-fatal):", err2 instanceof Error ? err2.message : err2);
83284
83278
  }
@@ -83585,7 +83579,7 @@ B: ${b}`,
83585
83579
  console.log(
83586
83580
  "[errata] sync skipped \u2014 cloud sync consent is off (enable with `errata consent sync on`)"
83587
83581
  );
83588
- const pending = existsSync25(paths.outbox) ? readdirSync10(paths.outbox).filter((f) => f.endsWith(".json")).length : 0;
83582
+ const pending = existsSync26(paths.outbox) ? readdirSync10(paths.outbox).filter((f) => f.endsWith(".json")).length : 0;
83589
83583
  return { uploaded: 0, failed: 0, remaining: pending };
83590
83584
  }
83591
83585
  const onDisk = loadProfile(opts.workspaceRoot);
@@ -83593,7 +83587,7 @@ B: ${b}`,
83593
83587
  console.log(
83594
83588
  "[errata] sync held \u2014 this repo is already on errata in another workspace; run `errata link` to join it or create your own project"
83595
83589
  );
83596
- const pending = existsSync25(paths.outbox) ? readdirSync10(paths.outbox).filter((f) => f.endsWith(".json")).length : 0;
83590
+ const pending = existsSync26(paths.outbox) ? readdirSync10(paths.outbox).filter((f) => f.endsWith(".json")).length : 0;
83597
83591
  return { uploaded: 0, failed: 0, remaining: pending };
83598
83592
  }
83599
83593
  try {
@@ -83686,7 +83680,7 @@ async function startDaemon(opts) {
83686
83680
  reviewUrl: () => webUiUrl + "/review"
83687
83681
  });
83688
83682
  const writeLockFile = (url2) => {
83689
- writeFileSync22(
83683
+ writeFileSync23(
83690
83684
  engine.paths.daemonLock,
83691
83685
  JSON.stringify({ pid: process.pid, webUiUrl: url2, startedAt: Date.now() }),
83692
83686
  "utf8"
@@ -83729,7 +83723,7 @@ async function startDaemon(opts) {
83729
83723
  );
83730
83724
  await engine.stop();
83731
83725
  try {
83732
- if (existsSync26(engine.paths.daemonLock)) {
83726
+ if (existsSync27(engine.paths.daemonLock)) {
83733
83727
  }
83734
83728
  } catch {
83735
83729
  }
@@ -83930,7 +83924,7 @@ function instanceReceiptSequence(n) {
83930
83924
  // src/multi.ts
83931
83925
  init_dist();
83932
83926
  init_src5();
83933
- import { existsSync as existsSync32, readFileSync as readFileSync33, unlinkSync as unlinkSync3, writeFileSync as writeFileSync24 } from "node:fs";
83927
+ import { existsSync as existsSync33, readFileSync as readFileSync34, unlinkSync as unlinkSync3, writeFileSync as writeFileSync25 } from "node:fs";
83934
83928
  import { resolve as pathResolve } from "node:path";
83935
83929
 
83936
83930
  // src/principle-sync.ts
@@ -83959,8 +83953,8 @@ init_reconcile();
83959
83953
 
83960
83954
  // src/lockfile-auto.ts
83961
83955
  init_src();
83962
- import { existsSync as existsSync27, readFileSync as readFileSync29 } from "node:fs";
83963
- import { join as join35 } from "node:path";
83956
+ import { existsSync as existsSync28, readFileSync as readFileSync30 } from "node:fs";
83957
+ import { join as join36 } from "node:path";
83964
83958
 
83965
83959
  // src/package-index.ts
83966
83960
  init_src();
@@ -84109,11 +84103,11 @@ function runLockfilePass(opts) {
84109
84103
  { file: "package-lock.json", parse: parsePackageLockJson }
84110
84104
  ];
84111
84105
  for (const c of candidates) {
84112
- const p = join35(opts.root, c.file);
84113
- if (!existsSync27(p)) continue;
84106
+ const p = join36(opts.root, c.file);
84107
+ if (!existsSync28(p)) continue;
84114
84108
  let sbom;
84115
84109
  try {
84116
- sbom = c.parse(readFileSync29(p, "utf8"));
84110
+ sbom = c.parse(readFileSync30(p, "utf8"));
84117
84111
  } catch {
84118
84112
  continue;
84119
84113
  }
@@ -84173,8 +84167,8 @@ function noveltyAgainst(node2, neighbors, opts = {}) {
84173
84167
  init_profile2();
84174
84168
 
84175
84169
  // src/public-symbols.ts
84176
- import { readFileSync as readFileSync30, readdirSync as readdirSync11, existsSync as existsSync28 } from "node:fs";
84177
- import { join as join36 } from "node:path";
84170
+ import { readFileSync as readFileSync31, readdirSync as readdirSync11, existsSync as existsSync29 } from "node:fs";
84171
+ import { join as join37 } from "node:path";
84178
84172
  var HEAD_BYTES = 8 * 1024;
84179
84173
  var INDEX_TTL_MS = 10 * 60 * 1e3;
84180
84174
  var MIN_SYMBOL_LEN = 4;
@@ -84207,20 +84201,20 @@ function bindingNames(clause) {
84207
84201
  function internalPackageNames(workspaceRoot) {
84208
84202
  const names = /* @__PURE__ */ new Set();
84209
84203
  const tryRead = (dir) => {
84210
- const pj = join36(dir, "package.json");
84211
- if (!existsSync28(pj)) return;
84204
+ const pj = join37(dir, "package.json");
84205
+ if (!existsSync29(pj)) return;
84212
84206
  try {
84213
- const name2 = JSON.parse(readFileSync30(pj, "utf8")).name;
84207
+ const name2 = JSON.parse(readFileSync31(pj, "utf8")).name;
84214
84208
  if (typeof name2 === "string" && name2.length > 0) names.add(name2);
84215
84209
  } catch {
84216
84210
  }
84217
84211
  };
84218
84212
  tryRead(workspaceRoot);
84219
84213
  for (const group of ["packages", "apps"]) {
84220
- const groupDir = join36(workspaceRoot, group);
84221
- if (!existsSync28(groupDir)) continue;
84214
+ const groupDir = join37(workspaceRoot, group);
84215
+ if (!existsSync29(groupDir)) continue;
84222
84216
  try {
84223
- for (const entry of readdirSync11(groupDir)) tryRead(join36(groupDir, entry));
84217
+ for (const entry of readdirSync11(groupDir)) tryRead(join37(groupDir, entry));
84224
84218
  } catch {
84225
84219
  }
84226
84220
  }
@@ -84239,7 +84233,7 @@ function publicSymbolIndex(store, workspaceRoot, deps = {}) {
84239
84233
  }
84240
84234
  const readHead = deps.readHead ?? ((absPath) => {
84241
84235
  try {
84242
- return readFileSync30(absPath, "utf8").slice(0, HEAD_BYTES);
84236
+ return readFileSync31(absPath, "utf8").slice(0, HEAD_BYTES);
84243
84237
  } catch {
84244
84238
  return "";
84245
84239
  }
@@ -84259,7 +84253,7 @@ function publicSymbolIndex(store, workspaceRoot, deps = {}) {
84259
84253
  }
84260
84254
  const symbols = /* @__PURE__ */ new Set();
84261
84255
  for (const rel of files) {
84262
- const head2 = readHead(join36(workspaceRoot, rel));
84256
+ const head2 = readHead(join37(workspaceRoot, rel));
84263
84257
  if (!head2) continue;
84264
84258
  for (const re of [NAMED_IMPORT_RE, REQUIRE_RE]) {
84265
84259
  re.lastIndex = 0;
@@ -85058,7 +85052,7 @@ function cloudTargetDrift(daemon, shell2) {
85058
85052
  }
85059
85053
 
85060
85054
  // src/lock.ts
85061
- import { existsSync as existsSync29, readFileSync as readFileSync31 } from "node:fs";
85055
+ import { existsSync as existsSync30, readFileSync as readFileSync32 } from "node:fs";
85062
85056
  function daemonLockPayload(lock) {
85063
85057
  return JSON.stringify({
85064
85058
  pid: lock.pid,
@@ -85096,9 +85090,9 @@ function isProcessAlive(pid) {
85096
85090
  }
85097
85091
  }
85098
85092
  function readDaemonLock(lockPath) {
85099
- if (!existsSync29(lockPath)) return null;
85093
+ if (!existsSync30(lockPath)) return null;
85100
85094
  try {
85101
- const lock = JSON.parse(readFileSync31(lockPath, "utf8"));
85095
+ const lock = JSON.parse(readFileSync32(lockPath, "utf8"));
85102
85096
  return typeof lock.pid === "number" ? lock : null;
85103
85097
  } catch {
85104
85098
  return null;
@@ -85812,8 +85806,8 @@ async function syncHistoryRevisionPage(opts) {
85812
85806
  init_src7();
85813
85807
  init_src();
85814
85808
  import { execFile as execFile5 } from "node:child_process";
85815
- import { readFileSync as readFileSync32 } from "node:fs";
85816
- import { join as join37 } from "node:path";
85809
+ import { readFileSync as readFileSync33 } from "node:fs";
85810
+ import { join as join38 } from "node:path";
85817
85811
  import { promisify as promisify3 } from "node:util";
85818
85812
 
85819
85813
  // src/history-walk.ts
@@ -86136,8 +86130,8 @@ function narrative(unit, group) {
86136
86130
  }
86137
86131
  function narrativeSources(unit, group) {
86138
86132
  if (!group || group.length === 0) return [{ commitSha: unit.sha, text: message(unit).trim() }].filter((s) => s.text.length > 0);
86139
- const members2 = group.filter((g) => g.groupSha === (unit.groupSha ?? unit.sha)).sort((a, b) => a.subIndex - b.subIndex);
86140
- const source = members2.length > 0 ? members2 : [...group].sort((a, b) => a.subIndex - b.subIndex);
86133
+ const members = group.filter((g) => g.groupSha === (unit.groupSha ?? unit.sha)).sort((a, b) => a.subIndex - b.subIndex);
86134
+ const source = members.length > 0 ? members : [...group].sort((a, b) => a.subIndex - b.subIndex);
86141
86135
  return source.map((member) => ({ commitSha: member.sha, text: message(member).trim() })).filter((s) => s.text.length > 0);
86142
86136
  }
86143
86137
 
@@ -86360,7 +86354,7 @@ async function defaultGit(root, args2) {
86360
86354
  function readIgnoreLines(root, profile) {
86361
86355
  let lines = [];
86362
86356
  try {
86363
- lines = readFileSync32(join37(root, ".errataignore"), "utf8").split("\n");
86357
+ lines = readFileSync33(join38(root, ".errataignore"), "utf8").split("\n");
86364
86358
  } catch {
86365
86359
  }
86366
86360
  return [...lines, ...profile.ignoreExtra ?? []].map((l) => l.trim()).filter((l) => l && !l.startsWith("#"));
@@ -86790,8 +86784,8 @@ async function startHistoryStage(root, input, client, walk11 = {}) {
86790
86784
  init_cloud_auth();
86791
86785
  import { createHash as createHash19 } from "node:crypto";
86792
86786
  import { execFileSync as execFileSync5 } from "node:child_process";
86793
- import { existsSync as existsSync30, writeFileSync as writeFileSync23 } from "node:fs";
86794
- import { join as join38 } from "node:path";
86787
+ import { existsSync as existsSync31, writeFileSync as writeFileSync24 } from "node:fs";
86788
+ import { join as join39 } from "node:path";
86795
86789
 
86796
86790
  // src/device-poll.ts
86797
86791
  var THROTTLED_POLL_MIN_WAIT_MS = 11e3;
@@ -87249,9 +87243,9 @@ function applyLinkDecision(root, profile, config2, decision, now = Date.now) {
87249
87243
  delete nextProfile.projectLinkHold;
87250
87244
  let wroteIgnore = false;
87251
87245
  if (decision.writeIgnoreStarter !== false) {
87252
- const target = join38(root, ".errataignore");
87253
- if (!existsSync30(target)) {
87254
- writeFileSync23(target, IGNORE_STARTER, "utf8");
87246
+ const target = join39(root, ".errataignore");
87247
+ if (!existsSync31(target)) {
87248
+ writeFileSync24(target, IGNORE_STARTER, "utf8");
87255
87249
  wroteIgnore = true;
87256
87250
  }
87257
87251
  }
@@ -87264,12 +87258,12 @@ init_registry();
87264
87258
 
87265
87259
  // src/adopt.ts
87266
87260
  init_git_remote();
87267
- import { existsSync as existsSync31 } from "node:fs";
87268
- import { dirname as dirname12, join as join39 } from "node:path";
87261
+ import { existsSync as existsSync32 } from "node:fs";
87262
+ import { dirname as dirname12, join as join40 } from "node:path";
87269
87263
  function findGitRoot(absPath) {
87270
87264
  let dir = absPath;
87271
87265
  for (let depth = 0; depth < 64; depth++) {
87272
- if (existsSync31(join39(dir, ".git"))) return dir;
87266
+ if (existsSync32(join40(dir, ".git"))) return dir;
87273
87267
  const parent = dirname12(dir);
87274
87268
  if (parent === dir) return null;
87275
87269
  dir = parent;
@@ -87962,7 +87956,7 @@ async function startMultiDaemon(opts = {}) {
87962
87956
  records.push(rec);
87963
87957
  void ambientLinkAll();
87964
87958
  try {
87965
- writeFileSync24(
87959
+ writeFileSync25(
87966
87960
  rec.engine.paths.daemonLock,
87967
87961
  daemonLockPayload({
87968
87962
  pid: process.pid,
@@ -88248,7 +88242,7 @@ async function startMultiDaemon(opts = {}) {
88248
88242
  lastActiveAt = Math.max(lastActiveAt, rec.engine.lastActivityAt());
88249
88243
  } catch {
88250
88244
  }
88251
- const reason = retireDecision({ exists: existsSync32(rec.root), lastActiveAt, now });
88245
+ const reason = retireDecision({ exists: existsSync33(rec.root), lastActiveAt, now });
88252
88246
  if (reason) void retireWorkspace(rec, reason);
88253
88247
  }
88254
88248
  };
@@ -88319,7 +88313,7 @@ async function startMultiDaemon(opts = {}) {
88319
88313
  baseUrl = `http://127.0.0.1:${port}`;
88320
88314
  try {
88321
88315
  ensureDir(globalDir());
88322
- writeFileSync24(
88316
+ writeFileSync25(
88323
88317
  lockPath,
88324
88318
  daemonLockPayload({ pid: process.pid, webUiUrl: baseUrl, processStartedAt: PROCESS_STARTED_AT, entry: SELF_ENTRY, version: DAEMON_VERSION }),
88325
88319
  "utf8"
@@ -88328,7 +88322,7 @@ async function startMultiDaemon(opts = {}) {
88328
88322
  }
88329
88323
  for (const r of records) {
88330
88324
  try {
88331
- writeFileSync24(
88325
+ writeFileSync25(
88332
88326
  r.engine.paths.daemonLock,
88333
88327
  daemonLockPayload({
88334
88328
  pid: process.pid,
@@ -89300,7 +89294,7 @@ async function startMultiDaemon(opts = {}) {
89300
89294
  clearInterval(anchorPull);
89301
89295
  clearTimeout(codexWakeBoot);
89302
89296
  try {
89303
- const cur = readFileSync33(lockPath, "utf8");
89297
+ const cur = readFileSync34(lockPath, "utf8");
89304
89298
  if (JSON.parse(cur).pid === process.pid) unlinkSync3(lockPath);
89305
89299
  } catch {
89306
89300
  }
@@ -89723,7 +89717,7 @@ import { spawnSync } from "node:child_process";
89723
89717
 
89724
89718
  // src/codex-runtime.ts
89725
89719
  import { readdirSync as readdirSync12, statSync as statSync9 } from "node:fs";
89726
- import { join as join40 } from "node:path";
89720
+ import { join as join41 } from "node:path";
89727
89721
  function resolveCodexExecutable(options = {}) {
89728
89722
  const platform = options.platform ?? process.platform;
89729
89723
  const env2 = options.env ?? process.env;
@@ -89738,13 +89732,13 @@ function resolveCodexExecutable(options = {}) {
89738
89732
  };
89739
89733
  for (const dir of (env2["PATH"] ?? env2["Path"] ?? "").split(";")) {
89740
89734
  if (!dir.trim()) continue;
89741
- const path2 = join40(dir.trim().replace(/^"|"$/g, ""), "codex.exe");
89735
+ const path2 = join41(dir.trim().replace(/^"|"$/g, ""), "codex.exe");
89742
89736
  if (fileTime(path2) !== null) return path2;
89743
89737
  }
89744
89738
  if (!env2["LOCALAPPDATA"]) return "codex";
89745
- const root = join40(env2["LOCALAPPDATA"], "OpenAI", "Codex", "bin");
89739
+ const root = join41(env2["LOCALAPPDATA"], "OpenAI", "Codex", "bin");
89746
89740
  try {
89747
- const candidates = readdirSync12(root, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => join40(root, entry.name, "codex.exe")).map((path2) => ({ path: path2, mtime: fileTime(path2) })).filter((candidate) => candidate.mtime !== null).sort((a, b) => b.mtime - a.mtime || a.path.localeCompare(b.path));
89741
+ const candidates = readdirSync12(root, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => join41(root, entry.name, "codex.exe")).map((path2) => ({ path: path2, mtime: fileTime(path2) })).filter((candidate) => candidate.mtime !== null).sort((a, b) => b.mtime - a.mtime || a.path.localeCompare(b.path));
89748
89742
  return candidates[0]?.path ?? "codex";
89749
89743
  } catch {
89750
89744
  return "codex";
@@ -89863,9 +89857,9 @@ import { spawn as spawn4 } from "node:child_process";
89863
89857
  import { createInterface } from "node:readline";
89864
89858
 
89865
89859
  // src/codex-hooks.ts
89866
- import { existsSync as existsSync33, mkdirSync as mkdirSync9, readFileSync as readFileSync34, writeFileSync as writeFileSync25 } from "node:fs";
89860
+ import { existsSync as existsSync34, mkdirSync as mkdirSync9, readFileSync as readFileSync35, writeFileSync as writeFileSync26 } from "node:fs";
89867
89861
  import { homedir as homedir7 } from "node:os";
89868
- import { join as join41 } from "node:path";
89862
+ import { join as join42 } from "node:path";
89869
89863
 
89870
89864
  // src/hook-commands.ts
89871
89865
  function hookCurlCommand(port, path2 = "/api/hook") {
@@ -89944,8 +89938,8 @@ try {
89944
89938
 
89945
89939
  // src/codex-hooks.ts
89946
89940
  var CODEX_HOOK_REVIEW_HELP = "Codex desktop: Settings > Hooks, select this project, expand each event and Trust the Errata hook. CLI users can use /hooks.";
89947
- function hasCodexConfig(root, codexHome = process.env["CODEX_HOME"] || join41(homedir7(), ".codex")) {
89948
- return existsSync33(join41(root, ".codex")) || existsSync33(codexHome);
89941
+ function hasCodexConfig(root, codexHome = process.env["CODEX_HOME"] || join42(homedir7(), ".codex")) {
89942
+ return existsSync34(join42(root, ".codex")) || existsSync34(codexHome);
89949
89943
  }
89950
89944
  function replaceCodexHooks(existing, block) {
89951
89945
  const begin = existing.indexOf(CODEX_HOOKS_BEGIN);
@@ -89961,14 +89955,14 @@ function replaceCodexHooks(existing, block) {
89961
89955
  return existing.trimEnd() + (existing.trim() ? "\n\n" : "") + block;
89962
89956
  }
89963
89957
  function writeCodexHooks(root, port, nodePath = process.execPath) {
89964
- const dir = join41(root, ".codex");
89965
- const file2 = join41(dir, "config.toml");
89966
- const relay = join41(dir, "hooks", "errata-relay.mjs");
89958
+ const dir = join42(root, ".codex");
89959
+ const file2 = join42(dir, "config.toml");
89960
+ const relay = join42(dir, "hooks", "errata-relay.mjs");
89967
89961
  const block = buildCodexHooksToml(port, { nodePath, relayPath: relay });
89968
- const final = replaceCodexHooks(existsSync33(file2) ? readFileSync34(file2, "utf8") : "", block);
89969
- mkdirSync9(join41(dir, "hooks"), { recursive: true });
89970
- writeFileSync25(relay, CODEX_RELAY_SOURCE, "utf8");
89971
- writeFileSync25(file2, final, "utf8");
89962
+ const final = replaceCodexHooks(existsSync34(file2) ? readFileSync35(file2, "utf8") : "", block);
89963
+ mkdirSync9(join42(dir, "hooks"), { recursive: true });
89964
+ writeFileSync26(relay, CODEX_RELAY_SOURCE, "utf8");
89965
+ writeFileSync26(file2, final, "utf8");
89972
89966
  return file2;
89973
89967
  }
89974
89968
 
@@ -90135,9 +90129,9 @@ function consolidationGapMs(lastPassMs, policy) {
90135
90129
  }
90136
90130
 
90137
90131
  // src/claude-statusline.ts
90138
- import { existsSync as existsSync34, mkdirSync as mkdirSync10, readFileSync as readFileSync35, writeFileSync as writeFileSync26 } from "node:fs";
90132
+ import { existsSync as existsSync35, mkdirSync as mkdirSync10, readFileSync as readFileSync36, writeFileSync as writeFileSync27 } from "node:fs";
90139
90133
  import { homedir as homedir8 } from "node:os";
90140
- import { dirname as dirname13, join as join42 } from "node:path";
90134
+ import { dirname as dirname13, join as join43 } from "node:path";
90141
90135
  var STATUSLINE_RELAY_SOURCE = String.raw`// errata-managed: regenerated by errata init / install-hooks claude
90142
90136
  import { readFileSync } from 'node:fs';
90143
90137
 
@@ -90170,8 +90164,8 @@ function removeProjectStatusLine(settings) {
90170
90164
  return true;
90171
90165
  }
90172
90166
  function userClaudeSettingsPath() {
90173
- const base = process.env["CLAUDE_CONFIG_DIR"] ?? join42(homedir8(), ".claude");
90174
- return join42(base, "settings.json");
90167
+ const base = process.env["CLAUDE_CONFIG_DIR"] ?? join43(homedir8(), ".claude");
90168
+ return join43(base, "settings.json");
90175
90169
  }
90176
90170
  function ensureUserStatusLine(opts) {
90177
90171
  const env2 = opts.env ?? process.env;
@@ -90179,9 +90173,9 @@ function ensureUserStatusLine(opts) {
90179
90173
  if (off === "0" || off === "off" || off === "false" || off === "no") return "disabled";
90180
90174
  const settingsPath = opts.userSettingsPath ?? userClaudeSettingsPath();
90181
90175
  let settings = {};
90182
- if (existsSync34(settingsPath)) {
90176
+ if (existsSync35(settingsPath)) {
90183
90177
  try {
90184
- const parsed = JSON.parse(readFileSync35(settingsPath, "utf8"));
90178
+ const parsed = JSON.parse(readFileSync36(settingsPath, "utf8"));
90185
90179
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return "unreadable";
90186
90180
  settings = parsed;
90187
90181
  } catch {
@@ -90189,16 +90183,16 @@ function ensureUserStatusLine(opts) {
90189
90183
  }
90190
90184
  }
90191
90185
  if (settings["statusLine"] !== void 0 && !isErrataStatusLine(settings["statusLine"])) return "kept-own";
90192
- const relay = join42(opts.relayDir, STATUSLINE_RELAY_FILE);
90186
+ const relay = join43(opts.relayDir, STATUSLINE_RELAY_FILE);
90193
90187
  mkdirSync10(opts.relayDir, { recursive: true });
90194
- if (!existsSync34(relay) || readFileSync35(relay, "utf8") !== STATUSLINE_RELAY_SOURCE) {
90195
- writeFileSync26(relay, STATUSLINE_RELAY_SOURCE, "utf8");
90188
+ if (!existsSync35(relay) || readFileSync36(relay, "utf8") !== STATUSLINE_RELAY_SOURCE) {
90189
+ writeFileSync27(relay, STATUSLINE_RELAY_SOURCE, "utf8");
90196
90190
  }
90197
90191
  const next = buildStatusLine(opts.port, opts.nodePath ?? process.execPath, relay);
90198
90192
  if (JSON.stringify(settings["statusLine"]) === JSON.stringify(next)) return "unchanged";
90199
90193
  settings["statusLine"] = next;
90200
90194
  mkdirSync10(dirname13(settingsPath), { recursive: true });
90201
- writeFileSync26(settingsPath, JSON.stringify(settings, null, 2) + "\n", "utf8");
90195
+ writeFileSync27(settingsPath, JSON.stringify(settings, null, 2) + "\n", "utf8");
90202
90196
  return "installed";
90203
90197
  }
90204
90198
  function describeStatusLineOutcome(outcome) {
@@ -90621,14 +90615,14 @@ async function cmdInit() {
90621
90615
  if (!skipHooks) {
90622
90616
  console.log("");
90623
90617
  console.log("installing harness hooks...");
90624
- const { existsSync: existsSync36 } = await import("node:fs");
90625
- const { join: join44 } = await import("node:path");
90618
+ const { existsSync: existsSync37 } = await import("node:fs");
90619
+ const { join: join45 } = await import("node:path");
90626
90620
  try {
90627
90621
  await installClaudeHooks(port);
90628
90622
  } catch (err2) {
90629
90623
  console.warn(` \u26A0\uFE0F Claude hook install failed: ${err2 instanceof Error ? err2.message : err2}`);
90630
90624
  }
90631
- if (existsSync36(join44(ROOT, ".cursor"))) {
90625
+ if (existsSync37(join45(ROOT, ".cursor"))) {
90632
90626
  try {
90633
90627
  await installCursorMcpConfig();
90634
90628
  } catch (err2) {
@@ -90818,9 +90812,9 @@ async function cmdStatus() {
90818
90812
  console.log(` stack: ${profile.stack.join(", ") || "(none)"}`);
90819
90813
  console.log(` languages: ${profile.languages.join(", ") || "(none)"}`);
90820
90814
  }
90821
- console.log(` graph db: ${existsSync35(paths.castalia) ? "yes" : "no"} (${paths.castalia})`);
90822
- console.log(` event log: ${existsSync35(paths.eventLog) ? "yes" : "no"} (${paths.eventLog})`);
90823
- if (existsSync35(paths.castalia)) {
90815
+ console.log(` graph db: ${existsSync36(paths.castalia) ? "yes" : "no"} (${paths.castalia})`);
90816
+ console.log(` event log: ${existsSync36(paths.eventLog) ? "yes" : "no"} (${paths.eventLog})`);
90817
+ if (existsSync36(paths.castalia)) {
90824
90818
  try {
90825
90819
  const { openGraphStore: openGraphStore2 } = await Promise.resolve().then(() => (init_src5(), src_exports2));
90826
90820
  const store = openGraphStore2({ path: paths.castalia });
@@ -91788,11 +91782,11 @@ async function cmdInstallationProfile(args2) {
91788
91782
  }
91789
91783
  async function cmdReview() {
91790
91784
  const paths = workspacePaths(ROOT);
91791
- if (!existsSync35(paths.reviewQueue)) {
91785
+ if (!existsSync36(paths.reviewQueue)) {
91792
91786
  console.log("(review queue empty)");
91793
91787
  return;
91794
91788
  }
91795
- const queue = JSON.parse(readFileSync36(paths.reviewQueue, "utf8"));
91789
+ const queue = JSON.parse(readFileSync37(paths.reviewQueue, "utf8"));
91796
91790
  if (queue.length === 0) {
91797
91791
  console.log("(review queue empty)");
91798
91792
  return;
@@ -92463,7 +92457,7 @@ async function gatherRepo(store, ws) {
92463
92457
  };
92464
92458
  }
92465
92459
  async function gatherReportData(generatedAt) {
92466
- const { existsSync: existsSync36 } = await import("node:fs");
92460
+ const { existsSync: existsSync37 } = await import("node:fs");
92467
92461
  const { openGraphStore: openGraphStore2 } = await Promise.resolve().then(() => (init_src5(), src_exports2));
92468
92462
  const cfg = loadConfig();
92469
92463
  const outbound = cfg.consent.sync ? "auto" : "off";
@@ -92471,7 +92465,7 @@ async function gatherReportData(generatedAt) {
92471
92465
  for (const ws of listWorkspaces()) {
92472
92466
  if (ws.missing) continue;
92473
92467
  const dbPath = workspacePaths(ws.path).castalia;
92474
- if (!existsSync36(dbPath)) continue;
92468
+ if (!existsSync37(dbPath)) continue;
92475
92469
  let store = null;
92476
92470
  try {
92477
92471
  store = openGraphStore2({ path: dbPath });
@@ -92502,7 +92496,7 @@ async function gatherReportData(generatedAt) {
92502
92496
  };
92503
92497
  }
92504
92498
  async function cmdReport(args2) {
92505
- const { mkdirSync: mkdirSync11, writeFileSync: writeFileSync27 } = await import("node:fs");
92499
+ const { mkdirSync: mkdirSync11, writeFileSync: writeFileSync28 } = await import("node:fs");
92506
92500
  const { renderReport: renderReport2 } = await Promise.resolve().then(() => (init_report_render(), report_render_exports));
92507
92501
  const includeFutureVerbs = args2.includes("--future-verbs");
92508
92502
  const now = /* @__PURE__ */ new Date();
@@ -92515,8 +92509,8 @@ async function cmdReport(args2) {
92515
92509
  const outDir = workspacePaths(ROOT).configDir;
92516
92510
  mkdirSync11(outDir, { recursive: true });
92517
92511
  const files = renderReport2(data, { includeFutureVerbs });
92518
- for (const f of files) writeFileSync27(join43(outDir, f.name), f.html, "utf8");
92519
- const indexPath = join43(outDir, "report.html");
92512
+ for (const f of files) writeFileSync28(join44(outDir, f.name), f.html, "utf8");
92513
+ const indexPath = join44(outDir, "report.html");
92520
92514
  console.log(`report \u2192 ${indexPath}`);
92521
92515
  console.log(
92522
92516
  ` ${data.repos.length} repo(s) \xB7 ${files.length} file(s) \xB7 ${data.rollup.nodes.toLocaleString("en-US")} nodes`
@@ -92636,24 +92630,24 @@ async function cmdInstallHooks(args2) {
92636
92630
  }
92637
92631
  }
92638
92632
  async function installOpencodePlugin(port) {
92639
- const { mkdirSync: mkdirSync11, existsSync: existsSync36, readFileSync: readFileSync37, writeFileSync: writeFileSync27 } = await import("node:fs");
92640
- const { join: join44 } = await import("node:path");
92641
- const dir = join44(ROOT, ".opencode", "plugin");
92642
- if (!existsSync36(dir)) mkdirSync11(dir, { recursive: true });
92643
- const file2 = join44(dir, "inerrata.js");
92644
- if (existsSync36(file2)) {
92645
- const head2 = readFileSync37(file2, "utf8").split("\n")[0] ?? "";
92633
+ const { mkdirSync: mkdirSync11, existsSync: existsSync37, readFileSync: readFileSync38, writeFileSync: writeFileSync28 } = await import("node:fs");
92634
+ const { join: join45 } = await import("node:path");
92635
+ const dir = join45(ROOT, ".opencode", "plugin");
92636
+ if (!existsSync37(dir)) mkdirSync11(dir, { recursive: true });
92637
+ const file2 = join45(dir, "inerrata.js");
92638
+ if (existsSync37(file2)) {
92639
+ const head2 = readFileSync38(file2, "utf8").split("\n")[0] ?? "";
92646
92640
  if (head2.trim() !== OPENCODE_PLUGIN_MARKER) {
92647
92641
  console.error(`refusing to overwrite ${file2}: not an errata-managed plugin (line 1 lacks the marker)`);
92648
92642
  process.exit(2);
92649
92643
  }
92650
92644
  }
92651
- writeFileSync27(file2, buildOpencodePluginSource(port, { version: DAEMON_VERSION }), "utf8");
92652
- const cfgFile = join44(ROOT, "opencode.json");
92645
+ writeFileSync28(file2, buildOpencodePluginSource(port, { version: DAEMON_VERSION }), "utf8");
92646
+ const cfgFile = join45(ROOT, "opencode.json");
92653
92647
  let cfg = { $schema: "https://opencode.ai/config.json" };
92654
- if (existsSync36(cfgFile)) {
92648
+ if (existsSync37(cfgFile)) {
92655
92649
  try {
92656
- cfg = JSON.parse(readFileSync37(cfgFile, "utf8"));
92650
+ cfg = JSON.parse(readFileSync38(cfgFile, "utf8"));
92657
92651
  } catch {
92658
92652
  console.error(`refusing to touch invalid JSON at ${cfgFile} \u2014 fix it and re-run`);
92659
92653
  process.exit(2);
@@ -92664,7 +92658,7 @@ async function installOpencodePlugin(port) {
92664
92658
  if (!hadErrata) {
92665
92659
  const inv = errataMcpInvocation();
92666
92660
  cfg.mcp["errata"] = { type: "local", command: [inv.command, ...inv.args] };
92667
- writeFileSync27(cfgFile, JSON.stringify(cfg, null, 2) + "\n", "utf8");
92661
+ writeFileSync28(cfgFile, JSON.stringify(cfg, null, 2) + "\n", "utf8");
92668
92662
  }
92669
92663
  console.log(`installed OpenCode plugin \u2192 ${file2}`);
92670
92664
  if (hadErrata) console.log(` mcp.errata already present in ${cfgFile} \u2014 left untouched`);
@@ -92691,15 +92685,15 @@ function ensureStatusLine(port) {
92691
92685
  }
92692
92686
  }
92693
92687
  async function installClaudeHooks(port) {
92694
- const { mkdirSync: mkdirSync11, existsSync: existsSync36, readFileSync: readFileSync37, writeFileSync: writeFileSync27 } = await import("node:fs");
92695
- const { join: join44 } = await import("node:path");
92696
- const dir = join44(ROOT, ".claude");
92697
- if (!existsSync36(dir)) mkdirSync11(dir, { recursive: true });
92698
- const file2 = join44(dir, "settings.json");
92688
+ const { mkdirSync: mkdirSync11, existsSync: existsSync37, readFileSync: readFileSync38, writeFileSync: writeFileSync28 } = await import("node:fs");
92689
+ const { join: join45 } = await import("node:path");
92690
+ const dir = join45(ROOT, ".claude");
92691
+ if (!existsSync37(dir)) mkdirSync11(dir, { recursive: true });
92692
+ const file2 = join45(dir, "settings.json");
92699
92693
  let settings = {};
92700
- if (existsSync36(file2)) {
92694
+ if (existsSync37(file2)) {
92701
92695
  try {
92702
- settings = JSON.parse(readFileSync37(file2, "utf8"));
92696
+ settings = JSON.parse(readFileSync38(file2, "utf8"));
92703
92697
  } catch {
92704
92698
  console.error(`refusing to overwrite invalid JSON at ${file2}`);
92705
92699
  process.exit(2);
@@ -92747,11 +92741,11 @@ async function installClaudeHooks(port) {
92747
92741
  list.push({ hooks: [{ type: "command", command: injectCmd }] });
92748
92742
  }
92749
92743
  removeProjectStatusLine(settings);
92750
- writeFileSync27(file2, JSON.stringify(settings, null, 2) + "\n", "utf8");
92744
+ writeFileSync28(file2, JSON.stringify(settings, null, 2) + "\n", "utf8");
92751
92745
  console.log(`installed Claude Code hooks \u2192 ${file2}`);
92752
92746
  console.log(` ${ensureStatusLine(port)}`);
92753
92747
  await installClaudeMcpConfig();
92754
- const claudeMd = join44(ROOT, "CLAUDE.md");
92748
+ const claudeMd = join45(ROOT, "CLAUDE.md");
92755
92749
  const recall = writeManagedBlock(claudeMd, { body: RECALL_FIRST_BLOCK });
92756
92750
  if (recall.kind === "collision") {
92757
92751
  console.warn(
@@ -92763,15 +92757,15 @@ async function installClaudeHooks(port) {
92763
92757
  console.log(` endpoint: http://127.0.0.1:${port}/api/hook`);
92764
92758
  }
92765
92759
  async function installClaudeMcpConfig() {
92766
- const { mkdirSync: mkdirSync11, existsSync: existsSync36, readFileSync: readFileSync37, writeFileSync: writeFileSync27 } = await import("node:fs");
92767
- const { join: join44, dirname: dirname14 } = await import("node:path");
92768
- const file2 = join44(ROOT, ".mcp.json");
92760
+ const { mkdirSync: mkdirSync11, existsSync: existsSync37, readFileSync: readFileSync38, writeFileSync: writeFileSync28 } = await import("node:fs");
92761
+ const { join: join45, dirname: dirname14 } = await import("node:path");
92762
+ const file2 = join45(ROOT, ".mcp.json");
92769
92763
  const dir = dirname14(file2);
92770
- if (!existsSync36(dir)) mkdirSync11(dir, { recursive: true });
92764
+ if (!existsSync37(dir)) mkdirSync11(dir, { recursive: true });
92771
92765
  let cfg = {};
92772
- if (existsSync36(file2)) {
92766
+ if (existsSync37(file2)) {
92773
92767
  try {
92774
- cfg = JSON.parse(readFileSync37(file2, "utf8"));
92768
+ cfg = JSON.parse(readFileSync38(file2, "utf8"));
92775
92769
  } catch {
92776
92770
  console.error(`refusing to overwrite invalid JSON at ${file2}`);
92777
92771
  process.exit(2);
@@ -92779,21 +92773,21 @@ async function installClaudeMcpConfig() {
92779
92773
  }
92780
92774
  cfg.mcpServers ??= {};
92781
92775
  cfg.mcpServers["errata"] = errataMcpInvocation();
92782
- writeFileSync27(file2, JSON.stringify(cfg, null, 2) + "\n", "utf8");
92776
+ writeFileSync28(file2, JSON.stringify(cfg, null, 2) + "\n", "utf8");
92783
92777
  console.log(`installed Claude Code MCP server config \u2192 ${file2}`);
92784
92778
  console.log(` Claude Code will spawn \`errata mcp\` on workspace open.`);
92785
92779
  console.log(` Tools: errata.search / locate / neighbors / callers_of / what_uses / show / similar`);
92786
92780
  }
92787
92781
  async function installCursorMcpConfig() {
92788
- const { mkdirSync: mkdirSync11, existsSync: existsSync36, readFileSync: readFileSync37, writeFileSync: writeFileSync27 } = await import("node:fs");
92789
- const { join: join44 } = await import("node:path");
92790
- const dir = join44(ROOT, ".cursor");
92791
- if (!existsSync36(dir)) mkdirSync11(dir, { recursive: true });
92792
- const file2 = join44(dir, "mcp.json");
92782
+ const { mkdirSync: mkdirSync11, existsSync: existsSync37, readFileSync: readFileSync38, writeFileSync: writeFileSync28 } = await import("node:fs");
92783
+ const { join: join45 } = await import("node:path");
92784
+ const dir = join45(ROOT, ".cursor");
92785
+ if (!existsSync37(dir)) mkdirSync11(dir, { recursive: true });
92786
+ const file2 = join45(dir, "mcp.json");
92793
92787
  let cfg = {};
92794
- if (existsSync36(file2)) {
92788
+ if (existsSync37(file2)) {
92795
92789
  try {
92796
- cfg = JSON.parse(readFileSync37(file2, "utf8"));
92790
+ cfg = JSON.parse(readFileSync38(file2, "utf8"));
92797
92791
  } catch {
92798
92792
  console.error(`refusing to overwrite invalid JSON at ${file2}`);
92799
92793
  process.exit(2);
@@ -92801,7 +92795,7 @@ async function installCursorMcpConfig() {
92801
92795
  }
92802
92796
  cfg.mcpServers ??= {};
92803
92797
  cfg.mcpServers["errata"] = errataMcpInvocation();
92804
- writeFileSync27(file2, JSON.stringify(cfg, null, 2) + "\n", "utf8");
92798
+ writeFileSync28(file2, JSON.stringify(cfg, null, 2) + "\n", "utf8");
92805
92799
  console.log(`installed Cursor MCP server config \u2192 ${file2}`);
92806
92800
  console.log(` Cursor will spawn \`errata mcp\` on workspace open.`);
92807
92801
  console.log(` Tools: errata.search / locate / neighbors / callers_of / what_uses`);
@@ -92812,7 +92806,7 @@ async function installCodexHooks(port) {
92812
92806
  const gitRoot = nearestGitRoot(process.cwd());
92813
92807
  const hookRoot = gitRoot && mainCheckoutOfWorktree(gitRoot) ? gitRoot : ROOT;
92814
92808
  const file2 = writeCodexHooks(hookRoot, port);
92815
- const instructions = writeManagedBlock(join43(hookRoot, "AGENTS.md"), {
92809
+ const instructions = writeManagedBlock(join44(hookRoot, "AGENTS.md"), {
92816
92810
  body: AGENTS_POINTER_BODY,
92817
92811
  stable: true
92818
92812
  });
@@ -93216,9 +93210,9 @@ async function cmdDash(args2) {
93216
93210
  await yieldToLoop2();
93217
93211
  try {
93218
93212
  const items = selectDurableMemory(handle2.sharedStore, r.engine.profile, {
93219
- atCommit: readGitRefState(join43(r.root, ".git")).sha ?? void 0
93213
+ atCommit: readGitRefState(join44(r.root, ".git")).sha ?? void 0
93220
93214
  });
93221
- const res = bleedRules(join43(r.root, ".claude", "rules"), items);
93215
+ const res = bleedRules(join44(r.root, ".claude", "rules"), items);
93222
93216
  if (res.written || res.pruned) {
93223
93217
  console.log(
93224
93218
  `[rules:${r.entry.name}] ${res.written} collective principle(s) \u2192 .claude/rules` + (res.pruned ? `, ${res.pruned} pruned` : "")