@inerrata-corporation/errata 2.0.2-dev.85 → 2.0.2-dev.99

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 +42 -7
  2. package/package.json +1 -1
package/errata.mjs CHANGED
@@ -37435,7 +37435,7 @@ var init_mcp = __esm({
37435
37435
  },
37436
37436
  {
37437
37437
  name: "errata.why",
37438
- description: "Causal/resolution neighborhood along the causal edge families (CAUSED_BY, MANIFESTS_AS, FIXED_BY, SOLVED_BY, \u2026), walked in both directions. For a Problem this surfaces its root causes AND solutions; for a Solution, the problems it resolves. Ranked by accumulated conductance. Pass nodeId or qname. Returns {seedId, nodes:[{id,label,description,hops,edgeType,relevance}]}.",
37438
+ description: "Causal/resolution neighborhood along the causal edge families (CAUSED_BY, MANIFESTS_AS, FIXED_BY, SOLVED_BY, \u2026), walked in both directions. For a Problem this surfaces its root causes AND solutions; for a Solution, the problems it resolves. Merges the machine-wide shared store's triage layer (cause chains from inline `<-` diagnoses land there, keyed by the same content-derived problem id). Ranked by accumulated conductance. Pass nodeId or qname. Returns {seedId, nodes:[{id,label,description,hops,edgeType,relevance}]}.",
37439
37439
  inputSchema: {
37440
37440
  type: "object",
37441
37441
  properties: {
@@ -37450,7 +37450,26 @@ var init_mcp = __esm({
37450
37450
  if (!id) return unresolved(args2);
37451
37451
  const maxHops = Math.max(1, Math.min(8, Number(args2["maxHops"] ?? 4)));
37452
37452
  const limit = Math.max(1, Math.min(100, Number(args2["limit"] ?? 30)));
37453
- return { found: true, ...causalChain(store, { seedId: id, direction: "both", maxHops, limit }) };
37453
+ const local = causalChain(store, { seedId: id, direction: "both", maxHops, limit });
37454
+ try {
37455
+ const path2 = sharedStorePath();
37456
+ if (!existsSync10(path2)) return { found: true, ...local };
37457
+ const shared = openGraphStore({ path: path2 });
37458
+ try {
37459
+ if (!shared.getNode(id)) return { found: true, ...local };
37460
+ const l2 = causalChain(shared, { seedId: id, direction: "both", maxHops, limit });
37461
+ const seen = new Set(local.nodes.map((n) => n.id));
37462
+ const merged = [
37463
+ ...local.nodes,
37464
+ ...l2.nodes.filter((n) => !seen.has(n.id)).map((n) => ({ ...n, store: "shared" }))
37465
+ ].sort((a, b) => (b.relevance ?? 0) - (a.relevance ?? 0)).slice(0, limit);
37466
+ return { found: true, seedId: local.seedId, nodes: merged };
37467
+ } finally {
37468
+ shared.close();
37469
+ }
37470
+ } catch {
37471
+ return { found: true, ...local };
37472
+ }
37454
37473
  }
37455
37474
  },
37456
37475
  {
@@ -50721,7 +50740,9 @@ function generalizeRouteForSync(edge2, level) {
50721
50740
  navFailures: 0
50722
50741
  };
50723
50742
  }
50724
- function buildTriageIngest(shared, daemonVersion, ignorePatterns = [], level = 2) {
50743
+ function buildTriageIngest(shared, daemonVersion, ignorePatterns = [], level = 2, opts = {}) {
50744
+ const lang = opts.primaryLanguage?.trim().toLowerCase();
50745
+ const claim = lang ? { anchorVisibility: "public", anchor: `lang:${lang}` } : {};
50725
50746
  const nodes = [];
50726
50747
  const edges = [];
50727
50748
  const seenIds = /* @__PURE__ */ new Set();
@@ -50734,7 +50755,8 @@ function buildTriageIngest(shared, daemonVersion, ignorePatterns = [], level = 2
50734
50755
  ...n,
50735
50756
  description: generalize(n.description, { level }).text,
50736
50757
  embedding: [],
50737
- attrs: { scope: {} }
50758
+ attrs: { scope: {} },
50759
+ ...claim
50738
50760
  });
50739
50761
  };
50740
50762
  for (const tri of shared.findNodesByLabel("Triage")) {
@@ -50750,7 +50772,8 @@ function buildTriageIngest(shared, daemonVersion, ignorePatterns = [], level = 2
50750
50772
  attrs: {
50751
50773
  ...statement ? { statement: generalize(statement, { level }).text } : {},
50752
50774
  ...tri.attrs["perContextSeen"] ? { perContextSeen: tri.attrs["perContextSeen"] } : {}
50753
- }
50775
+ },
50776
+ ...claim
50754
50777
  });
50755
50778
  }
50756
50779
  for (const tb of shared.inEdges(tri.id, ["TRIAGED_BY"])) {
@@ -51789,7 +51812,7 @@ function startLoopLagMonitor(thresholdMs = 1e3) {
51789
51812
  }
51790
51813
 
51791
51814
  // src/engine.ts
51792
- var DAEMON_VERSION = true ? "2.0.2-dev.85" : "2.0.0-alpha.0";
51815
+ var DAEMON_VERSION = true ? "2.0.2-dev.99" : "2.0.0-alpha.0";
51793
51816
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
51794
51817
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
51795
51818
  var GIT_OP_MUTE_MS = 4e3;
@@ -54772,7 +54795,19 @@ async function startMultiDaemon(opts = {}) {
54772
54795
  async syncTriagePublic() {
54773
54796
  if (!loadConfig().consent.sync) return { uploaded: 0, skipped: "consent-off" };
54774
54797
  const ignore = loadClaimIgnorePatterns(globalDir());
54775
- const payload = buildTriageIngest(sharedStore, DAEMON_VERSION, ignore);
54798
+ const langCounts = /* @__PURE__ */ new Map();
54799
+ for (const r of records) {
54800
+ for (const l of r.engine.profile.languages ?? []) {
54801
+ const k = String(l).trim().toLowerCase();
54802
+ if (k) langCounts.set(k, (langCounts.get(k) ?? 0) + 1);
54803
+ }
54804
+ }
54805
+ const primaryLanguage = [...langCounts.entries()].sort(
54806
+ (a, b) => b[1] - a[1] || (a[0] < b[0] ? -1 : 1)
54807
+ )[0]?.[0];
54808
+ const payload = buildTriageIngest(sharedStore, DAEMON_VERSION, ignore, 2, {
54809
+ ...primaryLanguage ? { primaryLanguage } : {}
54810
+ });
54776
54811
  if (!payload) return { uploaded: 0 };
54777
54812
  const res = await cloudNow().ingest(payload);
54778
54813
  return { uploaded: res.accepted };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.2-dev.85",
3
+ "version": "2.0.2-dev.99",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {