@inerrata-corporation/errata 2.0.2-dev.597 → 2.0.2-dev.606

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 +224 -23
  2. package/package.json +1 -1
package/errata.mjs CHANGED
@@ -19598,9 +19598,9 @@ function searchByIntent(store, intent, opts) {
19598
19598
  if (denom === 0) return [];
19599
19599
  const hits = [];
19600
19600
  for (const { node: node2, matched } of candidates) {
19601
- let num2 = 0;
19602
- for (const t of matched) num2 += idf(t);
19603
- const coverage = num2 / denom;
19601
+ let num3 = 0;
19602
+ for (const t of matched) num3 += idf(t);
19603
+ const coverage = num3 / denom;
19604
19604
  if (coverage < minCoverage) continue;
19605
19605
  hits.push({ node: node2, coverage, matched });
19606
19606
  }
@@ -20904,18 +20904,18 @@ function triageOf(l2, q, mathOpts) {
20904
20904
  for (const e of l2.outEdges(triageId, [...ROUTE_EDGE_TYPES])) {
20905
20905
  const perContext = e.attrs["perContext"] ?? {};
20906
20906
  const counts = {};
20907
- for (const [bucket, num2] of Object.entries(perContext)) {
20907
+ for (const [bucket, num3] of Object.entries(perContext)) {
20908
20908
  counts[bucket] = {
20909
- seen: seen[bucket] ?? num2.confirmed,
20909
+ seen: seen[bucket] ?? num3.confirmed,
20910
20910
  // denominator ≥ numerator
20911
- confirmed: num2.confirmed,
20911
+ confirmed: num3.confirmed,
20912
20912
  // Cloud-merged routes carry a distinct-uploader count; local routes count
20913
20913
  // their session contributors.
20914
- independent: num2.independent ?? num2.contributors?.length ?? 0,
20914
+ independent: num3.independent ?? num3.contributors?.length ?? 0,
20915
20915
  // Discounted-in-trust-ramp subset (T3-weighting): the cloud-authoritative
20916
20916
  // corpus count when present, else the local inferred-only contributor count
20917
20917
  // (ambient-paired diagnoses whose binding the daemon guessed).
20918
- inferredIndependent: num2.inferredIndependent ?? num2.inferredContributors?.length ?? 0
20918
+ inferredIndependent: num3.inferredIndependent ?? num3.inferredContributors?.length ?? 0
20919
20919
  };
20920
20920
  }
20921
20921
  const post = triagePosterior(counts, buckets, mathOpts);
@@ -22060,6 +22060,37 @@ var init_mechanism_liveness = __esm({
22060
22060
  effectCounter: "corroboratedEdges",
22061
22061
  note: "expected STARVED until VS-corroboration-rate lands \u2014 the channel is genuinely starved"
22062
22062
  },
22063
+ {
22064
+ id: "wm-reinforce-exposure",
22065
+ what: "labels each paraphrase re-derivation with the prior's exposure (shown/evicted/unshown)",
22066
+ // The producer runs inside capture's fold path (reinforceSameAnchorProblem),
22067
+ // but capture cannot count it without threading the fold verdict up through
22068
+ // ingestDesignProblem — so the WM-JOIN reading is the observable: the
22069
+ // wm-calibration pass reads the stamped counters as levels every tick.
22070
+ pass: "wm-calibration",
22071
+ // Conditional stamp, rare by design (a paraphrase fold is a few-per-day
22072
+ // event) — the bar is "the field is written at all", the revisit-sweep
22073
+ // precedent. Zero everywhere = the outcome site never fired, which was
22074
+ // this store's measured state on 2026-08-09, day one of WM-labels.
22075
+ fed: { labels: ["Problem"], attr: "lastReinforceExposure", minFraction: 0 },
22076
+ // A LEVEL, not an increment: nonzero once any node ever carried an outcome.
22077
+ effectCounter: "reinforcedNodes",
22078
+ note: "levels ride the wm-calibration row; expect no-effect until outcome data accrues"
22079
+ },
22080
+ {
22081
+ id: "wm-leaned-exposure",
22082
+ what: "classifies a leaned-cite's exposure at outcome time (the display-confounded cell)",
22083
+ // CAPTURE parses the cite and classifies against the render stamps — the
22084
+ // gate's input is `lastShownAtSeq`, the render ledger's seq stamp.
22085
+ pass: "capture",
22086
+ fed: {
22087
+ labels: ["Problem", "Solution", "RootCause", "Pattern"],
22088
+ attr: "lastShownAtSeq",
22089
+ minFraction: 5e-3
22090
+ },
22091
+ effectCounter: "exposureOutcomes",
22092
+ note: "0 with live render stamps = no lean-cites parsed, not a broken classifier"
22093
+ },
22063
22094
  {
22064
22095
  id: "liveness-watch",
22065
22096
  what: "the daemon-side schedule of this very verdict \u2014 alarms when a mechanism stops working",
@@ -22084,6 +22115,57 @@ var init_mechanism_liveness = __esm({
22084
22115
  }
22085
22116
  });
22086
22117
 
22118
+ // ../../packages/local-graph/src/wm-calibration.ts
22119
+ function wmCalibrationCells(store) {
22120
+ const cells = {
22121
+ shownNodes: 0,
22122
+ shownImpressions: 0,
22123
+ evictedNodes: 0,
22124
+ evictedImpressions: 0,
22125
+ reinforceShown: 0,
22126
+ reinforceEvicted: 0,
22127
+ reinforceUnshown: 0,
22128
+ reinforcedNodes: 0
22129
+ };
22130
+ for (const label of WM_CALIBRATION_LABELS) {
22131
+ for (const n of store.findNodesByLabel(label)) {
22132
+ const shown = num(n.attrs["shownCount"]);
22133
+ const evicted = num(n.attrs["evictedCount"]);
22134
+ if (shown > 0) {
22135
+ cells.shownNodes++;
22136
+ cells.shownImpressions += shown;
22137
+ }
22138
+ if (evicted > 0) {
22139
+ cells.evictedNodes++;
22140
+ cells.evictedImpressions += evicted;
22141
+ }
22142
+ const rs = num(n.attrs["reinforceShownCount"]);
22143
+ const re = num(n.attrs["reinforceEvictedCount"]);
22144
+ const ru = num(n.attrs["reinforceUnshownCount"]);
22145
+ cells.reinforceShown += rs;
22146
+ cells.reinforceEvicted += re;
22147
+ cells.reinforceUnshown += ru;
22148
+ if (rs + re + ru > 0) cells.reinforcedNodes++;
22149
+ }
22150
+ }
22151
+ return cells;
22152
+ }
22153
+ var WM_CALIBRATION_LABELS, num;
22154
+ var init_wm_calibration = __esm({
22155
+ "../../packages/local-graph/src/wm-calibration.ts"() {
22156
+ "use strict";
22157
+ WM_CALIBRATION_LABELS = [
22158
+ "Problem",
22159
+ "Solution",
22160
+ "RootCause",
22161
+ "Pattern",
22162
+ "Technique",
22163
+ "AntiPattern"
22164
+ ];
22165
+ num = (v) => typeof v === "number" && Number.isFinite(v) ? v : 0;
22166
+ }
22167
+ });
22168
+
22087
22169
  // ../../packages/local-graph/src/index.ts
22088
22170
  var src_exports2 = {};
22089
22171
  __export(src_exports2, {
@@ -22107,6 +22189,7 @@ __export(src_exports2, {
22107
22189
  STALL_MIN_RUNS: () => STALL_MIN_RUNS,
22108
22190
  STALL_MIN_SPAN_MS: () => STALL_MIN_SPAN_MS,
22109
22191
  SqliteGraphStore: () => SqliteGraphStore,
22192
+ WM_CALIBRATION_LABELS: () => WM_CALIBRATION_LABELS,
22110
22193
  addDependency: () => addDependency,
22111
22194
  aggregateClaimConfidence: () => aggregateClaimConfidence,
22112
22195
  anchorProblemToDiff: () => anchorProblemToDiff,
@@ -22218,7 +22301,8 @@ __export(src_exports2, {
22218
22301
  toolNodeId: () => toolNodeId,
22219
22302
  toolPriorsFor: () => toolPriorsFor,
22220
22303
  triageOf: () => triageOf,
22221
- walk: () => walk
22304
+ walk: () => walk,
22305
+ wmCalibrationCells: () => wmCalibrationCells
22222
22306
  });
22223
22307
  var init_src5 = __esm({
22224
22308
  "../../packages/local-graph/src/index.ts"() {
@@ -22243,6 +22327,7 @@ var init_src5 = __esm({
22243
22327
  init_tools();
22244
22328
  init_principle_sync();
22245
22329
  init_mechanism_liveness();
22330
+ init_wm_calibration();
22246
22331
  }
22247
22332
  });
22248
22333
 
@@ -22941,10 +23026,10 @@ function pathsFor(node2) {
22941
23026
  return globs.length > 0 ? globs : ["**/*"];
22942
23027
  }
22943
23028
  function confidenceOf(n) {
22944
- return num(n.attrs["cloudConfidence"], num(n.attrs["claimConfidence"], n.extractionConfidence));
23029
+ return num2(n.attrs["cloudConfidence"], num2(n.attrs["claimConfidence"], n.extractionConfidence));
22945
23030
  }
22946
23031
  function contributorsOf(n) {
22947
- return Math.max(num(n.attrs["cloudContributors"], 0), num(n.attrs["contributorCount"], 1));
23032
+ return Math.max(num2(n.attrs["cloudContributors"], 0), num2(n.attrs["contributorCount"], 1));
22948
23033
  }
22949
23034
  function slugFor(n) {
22950
23035
  const kebab = n.description.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40);
@@ -22975,12 +23060,12 @@ _Collective principle \xB7 confidence ${conf.toFixed(2)} \xB7 ${contrib} contrib
22975
23060
  };
22976
23061
  });
22977
23062
  }
22978
- var num, LANG_GLOBS;
23063
+ var num2, LANG_GLOBS;
22979
23064
  var init_select_durable_memory = __esm({
22980
23065
  "../../packages/context-writer/src/select-durable-memory.ts"() {
22981
23066
  "use strict";
22982
23067
  init_src2();
22983
- num = (v, d = 0) => typeof v === "number" && Number.isFinite(v) ? v : d;
23068
+ num2 = (v, d = 0) => typeof v === "number" && Number.isFinite(v) ? v : d;
22984
23069
  LANG_GLOBS = {
22985
23070
  typescript: ["**/*.ts", "**/*.tsx"],
22986
23071
  javascript: ["**/*.js", "**/*.jsx"],
@@ -27308,10 +27393,80 @@ function buildSymbolLexicon(store, summariesByBodyHash2) {
27308
27393
  }
27309
27394
  return lex;
27310
27395
  }
27311
- function generalizeSymbols(text, lexicon, level = 1) {
27396
+ function buildFileLexicon(store) {
27397
+ const byKey = /* @__PURE__ */ new Map();
27398
+ const byBasename = /* @__PURE__ */ new Map();
27399
+ const basenameCount = /* @__PURE__ */ new Map();
27400
+ const entries = [];
27401
+ for (const n of store.findNodesByLabel("File")) {
27402
+ const relPath = typeof n.attrs["relPath"] === "string" && n.attrs["relPath"].length > 0 ? n.attrs["relPath"] : n.description;
27403
+ if (!relPath) continue;
27404
+ const basename5 = relPath.split("/").pop();
27405
+ if (!basename5.includes(".")) continue;
27406
+ entries.push({ relPath, basename: basename5 });
27407
+ basenameCount.set(basename5, (basenameCount.get(basename5) ?? 0) + 1);
27408
+ }
27409
+ for (const { relPath, basename: basename5 } of entries) {
27410
+ const entry = { relPath };
27411
+ if (relPath !== basename5) byKey.set(relPath, entry);
27412
+ const conventional = CONVENTION_FILENAMES.has(basename5) || (basenameCount.get(basename5) ?? 0) >= CONVENTION_BASENAME_MIN_FILES;
27413
+ if (!conventional && !byKey.has(basename5)) byKey.set(basename5, entry);
27414
+ const list = byBasename.get(basename5);
27415
+ if (list) list.push(entry);
27416
+ else byBasename.set(basename5, [entry]);
27417
+ }
27418
+ return { byKey, byBasename };
27419
+ }
27420
+ function resolveFileToken(token, lexicon) {
27421
+ const exact = lexicon.byKey.get(token);
27422
+ if (exact) return exact;
27423
+ if (!token.includes("/")) return null;
27424
+ const basename5 = token.split("/").pop();
27425
+ for (const entry of lexicon.byBasename.get(basename5) ?? []) {
27426
+ if (entry.relPath === token || entry.relPath.endsWith(`/${token}`)) return entry;
27427
+ }
27428
+ return null;
27429
+ }
27430
+ function internalFilesFor(description, lexicon) {
27431
+ const out2 = [];
27432
+ const seen = /* @__PURE__ */ new Set();
27433
+ for (const m of description.matchAll(FILE_TOKEN_RE)) {
27434
+ const tok = m[0];
27435
+ if (seen.has(tok)) continue;
27436
+ seen.add(tok);
27437
+ if (resolveFileToken(tok, lexicon)) out2.push(tok);
27438
+ }
27439
+ return out2;
27440
+ }
27441
+ function fileRolePhrase(relPath, level = 1) {
27442
+ if (level !== 1) return "a file";
27443
+ if (/\.(test|spec)\.|__tests__\/|(?:^|\/)e2e\//.test(relPath)) return "a test file";
27444
+ if (/(?:^|\/)scripts?\//.test(relPath)) return "a script";
27445
+ if (/\.md$/i.test(relPath)) return "a documentation file";
27446
+ if (/\.(json|ya?ml|toml|env)$/i.test(relPath)) return "a config file";
27447
+ return "a source file";
27448
+ }
27449
+ function generalizeSymbols(text, lexicon, level = 1, fileLexicon) {
27450
+ let out2 = text;
27451
+ if (fileLexicon) {
27452
+ const files = [];
27453
+ const seenFiles = /* @__PURE__ */ new Set();
27454
+ for (const m of out2.matchAll(FILE_TOKEN_RE)) {
27455
+ const tok = m[0];
27456
+ if (seenFiles.has(tok)) continue;
27457
+ seenFiles.add(tok);
27458
+ const entry = resolveFileToken(tok, fileLexicon);
27459
+ if (entry) files.push([tok, entry]);
27460
+ }
27461
+ files.sort((a, b) => b[0].length - a[0].length);
27462
+ for (const [tok, entry] of files) {
27463
+ const re = new RegExp(`(?<![\\w$/\\\\.-])${escapeRe4(tok)}(?![\\w$-])`, "g");
27464
+ out2 = out2.replace(re, fileRolePhrase(entry.relPath, level));
27465
+ }
27466
+ }
27312
27467
  const present = [];
27313
27468
  const seen = /* @__PURE__ */ new Set();
27314
- for (const m of text.matchAll(TOKEN_RE3)) {
27469
+ for (const m of out2.matchAll(TOKEN_RE3)) {
27315
27470
  const tok = m[0];
27316
27471
  if (!seen.has(tok) && lexicon.has(tok)) {
27317
27472
  seen.add(tok);
@@ -27319,7 +27474,6 @@ function generalizeSymbols(text, lexicon, level = 1) {
27319
27474
  }
27320
27475
  }
27321
27476
  present.sort((a, b) => b.length - a.length);
27322
- let out2 = text;
27323
27477
  for (const key of present) {
27324
27478
  const entry = lexicon.get(key);
27325
27479
  const phrase = level === 1 && entry.summary ? entry.summary : KIND_PHRASE[entry.kind][level === 1 ? "l1" : "l2"];
@@ -27328,7 +27482,7 @@ function generalizeSymbols(text, lexicon, level = 1) {
27328
27482
  }
27329
27483
  return generalize(out2, { level }).text;
27330
27484
  }
27331
- var SYMBOL_LABELS2, KIND_PHRASE, RE_RESERVED2, escapeRe4, TOKEN_RE3;
27485
+ var SYMBOL_LABELS2, KIND_PHRASE, RE_RESERVED2, escapeRe4, CONVENTION_FILENAMES, CONVENTION_BASENAME_MIN_FILES, FILE_TOKEN_RE, TOKEN_RE3;
27332
27486
  var init_generalize_graph = __esm({
27333
27487
  "src/generalize-graph.ts"() {
27334
27488
  "use strict";
@@ -27350,6 +27504,34 @@ var init_generalize_graph = __esm({
27350
27504
  };
27351
27505
  RE_RESERVED2 = /[.*+?^${}()|[\]\\]/g;
27352
27506
  escapeRe4 = (s) => s.replace(RE_RESERVED2, "\\$&");
27507
+ CONVENTION_FILENAMES = /* @__PURE__ */ new Set([
27508
+ "package.json",
27509
+ "package-lock.json",
27510
+ "pnpm-lock.yaml",
27511
+ "pnpm-workspace.yaml",
27512
+ "yarn.lock",
27513
+ "tsconfig.json",
27514
+ "tsconfig.base.json",
27515
+ "turbo.json",
27516
+ "README.md",
27517
+ "LICENSE",
27518
+ "CHANGELOG.md",
27519
+ "CONTRIBUTING.md",
27520
+ // agent-config conventions — as cross-repo universal as README.md by 2026
27521
+ "AGENTS.md",
27522
+ "CLAUDE.md",
27523
+ "Dockerfile",
27524
+ "docker-compose.yml",
27525
+ ".gitignore",
27526
+ ".env",
27527
+ ".env.example",
27528
+ "index.ts",
27529
+ "index.js",
27530
+ "index.tsx",
27531
+ "index.mjs"
27532
+ ]);
27533
+ CONVENTION_BASENAME_MIN_FILES = 3;
27534
+ FILE_TOKEN_RE = /(?:[A-Za-z0-9_.-]+\/)*[A-Za-z0-9_-][A-Za-z0-9_.-]*\.[A-Za-z0-9]+/g;
27353
27535
  TOKEN_RE3 = /[A-Za-z_$][A-Za-z0-9_$]*(?:\.[A-Za-z_$][A-Za-z0-9_$]*)*/g;
27354
27536
  }
27355
27537
  });
@@ -32422,7 +32604,7 @@ async function Module2(moduleArg = {}) {
32422
32604
  _fd_close.sig = "ii";
32423
32605
  var INT53_MAX = 9007199254740992;
32424
32606
  var INT53_MIN = -9007199254740992;
32425
- var bigintToI53Checked = /* @__PURE__ */ __name((num2) => num2 < INT53_MIN || num2 > INT53_MAX ? NaN : Number(num2), "bigintToI53Checked");
32607
+ var bigintToI53Checked = /* @__PURE__ */ __name((num3) => num3 < INT53_MIN || num3 > INT53_MAX ? NaN : Number(num3), "bigintToI53Checked");
32426
32608
  function _fd_seek(fd, offset, whence, newOffset) {
32427
32609
  offset = bigintToI53Checked(offset);
32428
32610
  return 70;
@@ -32440,7 +32622,7 @@ async function Module2(moduleArg = {}) {
32440
32622
  }
32441
32623
  }, "printChar");
32442
32624
  var _fd_write = /* @__PURE__ */ __name((fd, iov, iovcnt, pnum) => {
32443
- var num2 = 0;
32625
+ var num3 = 0;
32444
32626
  for (var i2 = 0; i2 < iovcnt; i2++) {
32445
32627
  var ptr = LE_HEAP_LOAD_U32((iov >> 2) * 4);
32446
32628
  var len = LE_HEAP_LOAD_U32((iov + 4 >> 2) * 4);
@@ -32448,9 +32630,9 @@ async function Module2(moduleArg = {}) {
32448
32630
  for (var j = 0; j < len; j++) {
32449
32631
  printChar(fd, HEAPU8[ptr + j]);
32450
32632
  }
32451
- num2 += len;
32633
+ num3 += len;
32452
32634
  }
32453
- LE_HEAP_STORE_U32((pnum >> 2) * 4, num2);
32635
+ LE_HEAP_STORE_U32((pnum >> 2) * 4, num3);
32454
32636
  return 0;
32455
32637
  }, "_fd_write");
32456
32638
  _fd_write.sig = "iippp";
@@ -54462,7 +54644,7 @@ function startLoopLagMonitor(thresholdMs = 1e3) {
54462
54644
  }
54463
54645
 
54464
54646
  // src/engine.ts
54465
- var DAEMON_VERSION = true ? "2.0.2-dev.597" : "2.0.0-alpha.0";
54647
+ var DAEMON_VERSION = true ? "2.0.2-dev.606" : "2.0.0-alpha.0";
54466
54648
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
54467
54649
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
54468
54650
  var GIT_OP_MUTE_MS = 4e3;
@@ -55727,6 +55909,9 @@ function createWorkspaceEngine(opts) {
55727
55909
  exposureShown,
55728
55910
  exposureEvicted,
55729
55911
  exposureUnshown,
55912
+ // The sum, so one liveness effectCounter sees an outcome regardless of
55913
+ // which cell it landed in (WM-join).
55914
+ exposureOutcomes: exposureShown + exposureEvicted + exposureUnshown,
55730
55915
  touchedFileTurns,
55731
55916
  touchedToolTurns,
55732
55917
  // Seam diagnostic: sessions holding tool-run records at harvest time.
@@ -56004,6 +56189,16 @@ function createWorkspaceEngine(opts) {
56004
56189
  if (report.revisitsCleared > 0 || report.fixCandidatesSettled > 0 || report.designResolved > 0) {
56005
56190
  refreshContextNow();
56006
56191
  }
56192
+ try {
56193
+ const t0 = Date.now();
56194
+ appendPassLedger(
56195
+ paths.configDir,
56196
+ "wm-calibration",
56197
+ Date.now() - t0,
56198
+ wmCalibrationCells(store)
56199
+ );
56200
+ } catch {
56201
+ }
56007
56202
  livenessWatch.maybeRun();
56008
56203
  return report;
56009
56204
  },
@@ -56781,10 +56976,16 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
56781
56976
  };
56782
56977
  const symbolIndex = opts.workspaceRoot ? publicSymbolIndex(store, opts.workspaceRoot) : null;
56783
56978
  const ownLexicon = buildSymbolLexicon(store);
56979
+ const fileLexicon = buildFileLexicon(store);
56784
56980
  const shareable = (n) => {
56785
56981
  const preserved = symbolIndex ? preservedSymbolsFor(n.description, symbolIndex) : [];
56786
56982
  const shippedText = generalize(n.description, { level }).text;
56787
- const internal = internalSymbolsFor(shippedText, (t) => ownLexicon.has(t), symbolIndex);
56983
+ const internalSyms = internalSymbolsFor(shippedText, (t) => ownLexicon.has(t), symbolIndex);
56984
+ const internalFiles = internalFilesFor(shippedText, fileLexicon);
56985
+ const internal = [.../* @__PURE__ */ new Set([...internalFiles, ...internalSyms])].slice(
56986
+ 0,
56987
+ PRESERVED_SYMBOLS_CAP
56988
+ );
56788
56989
  return {
56789
56990
  ...n,
56790
56991
  description: shippedText,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.2-dev.597",
3
+ "version": "2.0.2-dev.606",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {