@inerrata-corporation/errata 2.0.2-dev.81 → 2.0.2-dev.95

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.
@@ -15194,7 +15194,10 @@ var init_edge_rules = __esm({
15194
15194
  // NOT ruled here — the type pre-exists with broader extractor senses, and a
15195
15195
  // new rule on an old type would reject legitimate live flows (reject-never-flip
15196
15196
  // cuts both ways: only rule types you introduce or senses that are documented).
15197
- CONCERNS: { from: ["Problem", "Solution", "RootCause", "Claim", "Pattern"], to: ["Tool"] },
15197
+ // `Component` joined the target set with OM-agent-anchors: an agent-named
15198
+ // component ("React Router") is the same knowledge→named-unit anchor shape as
15199
+ // a Tool — the knowledge is ABOUT it, not dependent on it.
15200
+ CONCERNS: { from: ["Problem", "Solution", "RootCause", "Claim", "Pattern"], to: ["Tool", "Component"] },
15198
15201
  OPERATES_ON: { from: ["Algorithm"], to: ["DataStructure"] },
15199
15202
  INVOLVES: { from: ["Problem", "Solution"], to: ["DataStructure"] },
15200
15203
  // ── Taxonomy (Track 4 Stream C: MITRE CWE `ChildOf` → `Weakness —IS_A→ Weakness`) ──
package/errata.mjs CHANGED
@@ -15369,7 +15369,10 @@ var init_edge_rules = __esm({
15369
15369
  // NOT ruled here — the type pre-exists with broader extractor senses, and a
15370
15370
  // new rule on an old type would reject legitimate live flows (reject-never-flip
15371
15371
  // cuts both ways: only rule types you introduce or senses that are documented).
15372
- CONCERNS: { from: ["Problem", "Solution", "RootCause", "Claim", "Pattern"], to: ["Tool"] },
15372
+ // `Component` joined the target set with OM-agent-anchors: an agent-named
15373
+ // component ("React Router") is the same knowledge→named-unit anchor shape as
15374
+ // a Tool — the knowledge is ABOUT it, not dependent on it.
15375
+ CONCERNS: { from: ["Problem", "Solution", "RootCause", "Claim", "Pattern"], to: ["Tool", "Component"] },
15373
15376
  OPERATES_ON: { from: ["Algorithm"], to: ["DataStructure"] },
15374
15377
  INVOLVES: { from: ["Problem", "Solution"], to: ["DataStructure"] },
15375
15378
  // ── Taxonomy (Track 4 Stream C: MITRE CWE `ChildOf` → `Weakness —IS_A→ Weakness`) ──
@@ -18342,6 +18345,55 @@ function mintDomainNode(store, name2, ts) {
18342
18345
  }
18343
18346
  return id;
18344
18347
  }
18348
+ function mintCitedPackageNode(store, ref, ts) {
18349
+ const cleaned = ref.replace(/\s+/g, " ").trim();
18350
+ const slash = /^([a-z0-9-]+)\/(.+)$/i.exec(cleaned);
18351
+ const hasEco = slash != null && !cleaned.startsWith("@");
18352
+ const name2 = (hasEco ? slash[2] : cleaned).trim();
18353
+ const nameLc = name2.toLowerCase();
18354
+ const existing = store.findNodesByLabel("Package").find((n) => String(n.attrs["name"] ?? "").toLowerCase() === nameLc);
18355
+ if (existing) return existing.id;
18356
+ let eco = hasEco ? slash[1].toLowerCase() : "";
18357
+ if (!eco && cleaned.startsWith("@")) eco = "npm";
18358
+ if (!eco) {
18359
+ const counts = /* @__PURE__ */ new Map();
18360
+ for (const p of store.findNodesByLabel("Package")) {
18361
+ const e = String(p.attrs["ecosystem"] ?? "").toLowerCase();
18362
+ if (e) counts.set(e, (counts.get(e) ?? 0) + 1);
18363
+ }
18364
+ eco = [...counts.entries()].sort((a, b) => b[1] - a[1])[0]?.[0] ?? "npm";
18365
+ }
18366
+ const purlName = eco === "npm" ? nameLc : name2;
18367
+ const purl = `pkg:${eco}/${purlName}`;
18368
+ if (!store.getNode(purl)) {
18369
+ store.mergeNode(
18370
+ buildNode(purl, "Package", name2, ts, {
18371
+ purl,
18372
+ name: name2,
18373
+ ecosystem: eco,
18374
+ resolved: false,
18375
+ // agent-cited, no lockfile resolution
18376
+ source: "convo",
18377
+ provisional: true
18378
+ })
18379
+ );
18380
+ }
18381
+ return purl;
18382
+ }
18383
+ function mintComponentNode(store, name2, ts) {
18384
+ const display = name2.replace(/\s+/g, " ").trim();
18385
+ const slug2 = display.toLowerCase();
18386
+ if (!store.getNode(slug2)) {
18387
+ store.mergeNode(
18388
+ buildNode(slug2, "Component", display, ts, {
18389
+ name: display,
18390
+ source: "convo",
18391
+ provisional: true
18392
+ })
18393
+ );
18394
+ }
18395
+ return slug2;
18396
+ }
18345
18397
  function resolveFileNode(store, path2, workspaceId2) {
18346
18398
  const want = path2.trim().replace(/^\.?\//, "");
18347
18399
  for (const n of store.findNodesByLabel("File")) {
@@ -20792,6 +20844,8 @@ __export(src_exports2, {
20792
20844
  matchSymbolsInText: () => matchSymbolsInText,
20793
20845
  mergeCloudCounts: () => mergeCloudCounts,
20794
20846
  mergeDuplicateProblems: () => mergeDuplicateProblems,
20847
+ mintCitedPackageNode: () => mintCitedPackageNode,
20848
+ mintComponentNode: () => mintComponentNode,
20795
20849
  mintDomainNode: () => mintDomainNode,
20796
20850
  mintPatternNode: () => mintPatternNode,
20797
20851
  openGraphStore: () => openGraphStore,
@@ -25156,6 +25210,11 @@ function linkBullet(ref) {
25156
25210
  ` \xB7 ${TAG_EXAMPLE.domain()} \u2014 name the ABSTRACT AREA it's about (e.g. (domain: Observability),`,
25157
25211
  " (domain: Community Detection)). An abstract problem with no code anchor NEEDS this or it's",
25158
25212
  " an invisible island: the Domain is the topic other problems in the area cluster on. Title Case.",
25213
+ ` \xB7 ${TAG_EXAMPLE.package()} \u2014 the PUBLIC PACKAGE the problem is about, even when this`,
25214
+ " workspace doesn't depend on it (e.g. (package: chokidar), (package: pypi/requests)) \u2014 a",
25215
+ " public-registry anchor lets the knowledge cross to the collective; internal names stay private.",
25216
+ ` \xB7 ${TAG_EXAMPLE.component()} \u2014 the framework/product-level UNIT it concerns when it's not a`,
25217
+ " package or a language (e.g. (component: React Router), (component: V8 Isolate)).",
25159
25218
  ` \xB7 (aids:[${ref}],\u2026) \u2014 your FIX could also help these other, even unrelated, problems.`,
25160
25219
  " A hypothesis, not a claim \u2014 it's recorded as may-resolve and checked by whoever tries it.",
25161
25220
  ` \xB7 when your fix relates to a PRIOR solution you were primed with (a problem's`,
@@ -25227,6 +25286,12 @@ var init_agent_signals = __esm({
25227
25286
  // DOMAIN — the abstract area a problem is about; the concept layer an
25228
25287
  // anchor-less problem clusters on. Mints/resolves a Domain by name.
25229
25288
  domain: () => `(domain: The Area)`,
25289
+ // PACKAGE/COMPONENT — agent-named public anchors (OM-agent-anchors): the
25290
+ // package a problem is ABOUT (even when not a dependency) and the
25291
+ // framework/product-level unit it concerns. Public spine anchors → the
25292
+ // knowledge can cross to the collective.
25293
+ package: () => `(package: the-package-name)`,
25294
+ component: () => `(component: The Component)`,
25230
25295
  aids: (ref) => `(aids:[${ref}])`
25231
25296
  };
25232
25297
  GLOSS = {
@@ -37370,7 +37435,7 @@ var init_mcp = __esm({
37370
37435
  },
37371
37436
  {
37372
37437
  name: "errata.why",
37373
- 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}]}.",
37374
37439
  inputSchema: {
37375
37440
  type: "object",
37376
37441
  properties: {
@@ -37385,7 +37450,26 @@ var init_mcp = __esm({
37385
37450
  if (!id) return unresolved(args2);
37386
37451
  const maxHops = Math.max(1, Math.min(8, Number(args2["maxHops"] ?? 4)));
37387
37452
  const limit = Math.max(1, Math.min(100, Number(args2["limit"] ?? 30)));
37388
- 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
+ }
37389
37473
  }
37390
37474
  },
37391
37475
  {
@@ -49625,6 +49709,8 @@ var ALTERNATIVE_PREFIX = /^\s*alternative:(?:#([a-z][\w-]{0,63}))?\s*/i;
49625
49709
  var INSTANCE_PREFIX = /^\s*instance:\s*/i;
49626
49710
  var PATTERN_RE = /\(\s*pattern:\s*([^()\n]{3,}?)\s*\)/gi;
49627
49711
  var DOMAIN_RE = /\(\s*domain:\s*([^()\n]{3,}?)\s*\)/gi;
49712
+ var PACKAGE_RE = /\(\s*package:\s*([^()\n]{2,}?)\s*\)/gi;
49713
+ var COMPONENT_RE = /\(\s*component:\s*([^()\n]{2,}?)\s*\)/gi;
49628
49714
  var CAUSE_TEXT_MIN = 8;
49629
49715
  var FLAG_RE = /\[([!?])(?:#([a-z][\w-]{0,63})\s+)?\s*([^\]\n]{8,}?)\s*(?:@\s*([^\s\]]+?)(?::(\d+))?\s*)?\]/g;
49630
49716
  var CONSTRAINT_MIN = 8;
@@ -49820,6 +49906,18 @@ function parseInlineTags(text) {
49820
49906
  const raw3 = dm[1].replace(/\s+/g, " ").trim();
49821
49907
  if (raw3.length >= 3) out2.push({ kind: "domain", domainText: raw3, sentence: sfield });
49822
49908
  }
49909
+ PACKAGE_RE.lastIndex = 0;
49910
+ let pk;
49911
+ while ((pk = PACKAGE_RE.exec(sentence)) !== null) {
49912
+ const raw3 = pk[1].replace(/\s+/g, " ").trim();
49913
+ if (raw3.length >= 2) out2.push({ kind: "package", packageText: raw3, sentence: sfield });
49914
+ }
49915
+ COMPONENT_RE.lastIndex = 0;
49916
+ let cm;
49917
+ while ((cm = COMPONENT_RE.exec(sentence)) !== null) {
49918
+ const raw3 = cm[1].replace(/\s+/g, " ").trim();
49919
+ if (raw3.length >= 2) out2.push({ kind: "component", componentText: raw3, sentence: sfield });
49920
+ }
49823
49921
  CONSTRAINT_RE.lastIndex = 0;
49824
49922
  let c;
49825
49923
  while ((c = CONSTRAINT_RE.exec(sentence)) !== null) {
@@ -49854,7 +49952,12 @@ var LABEL_PAIR = {
49854
49952
  // EDGE_RULES-clean by construction: CONCERNS allows exactly these sources.
49855
49953
  "Problem>Tool": "CONCERNS",
49856
49954
  "Solution>Tool": "CONCERNS",
49857
- "RootCause>Tool": "CONCERNS"
49955
+ "RootCause>Tool": "CONCERNS",
49956
+ // Agent-named component anchors (OM-agent-anchors): a Component is a
49957
+ // framework/product-level unit the knowledge is ABOUT — CONCERNS, like Tool.
49958
+ "Problem>Component": "CONCERNS",
49959
+ "Solution>Component": "CONCERNS",
49960
+ "RootCause>Component": "CONCERNS"
49858
49961
  };
49859
49962
  var STACK_GROUNDING_EDGES = ["WRITTEN_IN", "DEPENDS_ON", "OCCURS_IN"];
49860
49963
  var TIEBREAK = [
@@ -49953,7 +50056,7 @@ function harvestInlineTags(store, text, opts) {
49953
50056
  const source = opts.sourceId ? store.getNode(opts.sourceId) : null;
49954
50057
  const mintPriors = opts.mintPriors ?? true;
49955
50058
  const touched = opts.sessionTouchedIds ?? /* @__PURE__ */ new Set();
49956
- const plan = { priorEdges: 0, problems: [], fixes: [], triages: [], attempts: [], unresolvedFixes: [], transfers: [], solutionLinks: [], instances: [], patterns: [], domains: [], refutes: [], corroborations: [] };
50059
+ const plan = { priorEdges: 0, problems: [], fixes: [], triages: [], attempts: [], unresolvedFixes: [], transfers: [], solutionLinks: [], instances: [], patterns: [], domains: [], packages: [], components: [], refutes: [], corroborations: [] };
49957
50060
  const tags = parseInlineTags(text);
49958
50061
  const symptomSeqs = tags.filter((t) => (t.kind === "problem" || t.kind === "todo" || t.kind === "constraint") && t.statement).map((t) => ({ seq: t.seq ?? -1, statement: t.statement, threadId: t.threadId })).sort((a, b) => a.seq - b.seq);
49959
50062
  const bindSymptom = (seq, threadId) => {
@@ -50093,6 +50196,16 @@ function harvestInlineTags(store, text, opts) {
50093
50196
  ...tag.threadId ? { threadId: tag.threadId } : {},
50094
50197
  evidence: b.evidence
50095
50198
  });
50199
+ } else if (tag.kind === "package" || tag.kind === "component") {
50200
+ const b = bindSymptom(tag.seq, tag.threadId);
50201
+ const bound = {
50202
+ ...b.statement ? { boundStatement: b.statement } : {},
50203
+ ...b.problemId ? { problemId: b.problemId } : {},
50204
+ ...tag.threadId ? { threadId: tag.threadId } : {},
50205
+ evidence: b.evidence
50206
+ };
50207
+ if (tag.kind === "package") plan.packages.push({ packageText: tag.packageText, ...bound });
50208
+ else plan.components.push({ componentText: tag.componentText, ...bound });
50096
50209
  } else if (tag.kind === "attempt" || tag.kind === "failure") {
50097
50210
  for (const h of tag.refuteHandles ?? []) {
50098
50211
  const nodeId = resolveHandle(store, h, opts.handleMap);
@@ -51695,7 +51808,7 @@ function startLoopLagMonitor(thresholdMs = 1e3) {
51695
51808
  }
51696
51809
 
51697
51810
  // src/engine.ts
51698
- var DAEMON_VERSION = true ? "2.0.2-dev.81" : "2.0.0-alpha.0";
51811
+ var DAEMON_VERSION = true ? "2.0.2-dev.95" : "2.0.0-alpha.0";
51699
51812
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
51700
51813
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
51701
51814
  var GIT_OP_MUTE_MS = 4e3;
@@ -52529,6 +52642,20 @@ function createWorkspaceEngine(opts) {
52529
52642
  if (domainId === pid) continue;
52530
52643
  mintCiteEdge(pid, domainId, "PERTAIN_TO", d.evidence === "witnessed" ? 0.4 : 0.3, { domainCite: true, evidence: d.evidence });
52531
52644
  }
52645
+ for (const p of plan.packages) {
52646
+ const pid = bindPid(p);
52647
+ if (!pid) continue;
52648
+ const pkgId = mintCitedPackageNode(store, p.packageText, t);
52649
+ if (pkgId === pid) continue;
52650
+ mintCiteEdge(pid, pkgId, "DEPENDS_ON", p.evidence === "witnessed" ? 0.4 : 0.3, { packageCite: true, evidence: p.evidence });
52651
+ }
52652
+ for (const cpt of plan.components) {
52653
+ const pid = bindPid(cpt);
52654
+ if (!pid) continue;
52655
+ const componentId = mintComponentNode(store, cpt.componentText, t);
52656
+ if (componentId === pid) continue;
52657
+ mintCiteEdge(pid, componentId, "CONCERNS", cpt.evidence === "witnessed" ? 0.4 : 0.3, { componentCite: true, evidence: cpt.evidence });
52658
+ }
52532
52659
  for (const inst of plan.instances) {
52533
52660
  const pid = bindPid(inst);
52534
52661
  if (!pid) continue;
@@ -53391,8 +53518,8 @@ function noveltyAgainst(node2, neighbors, opts = {}) {
53391
53518
  // src/instance-ingest.ts
53392
53519
  var INSTANCE_LABELS = ["Problem", "Solution", "RootCause"];
53393
53520
  var INSTANCE_EDGES = ["CAUSED_BY", "SOLVED_BY"];
53394
- var ANCHOR_EDGES = ["OCCURS_IN", "DEPENDS_ON", "PERTAIN_TO"];
53395
- var ANCHOR_TARGET_LABELS = ["Language", "Package", "Domain"];
53521
+ var ANCHOR_EDGES = ["OCCURS_IN", "DEPENDS_ON", "PERTAIN_TO", "CONCERNS"];
53522
+ var ANCHOR_TARGET_LABELS = ["Language", "Package", "Domain", "Component"];
53396
53523
  function stripCodebaseScope(scope) {
53397
53524
  const s = { ...scope ?? {} };
53398
53525
  delete s["codebase"];
@@ -53427,7 +53554,11 @@ function shareableContext(n, wireId) {
53427
53554
  embedding: [],
53428
53555
  attrs,
53429
53556
  ...n.label === "Package" ? { anchorVisibility: "public" } : {},
53430
- ...n.label === "Language" && langAnchor(n) ? { anchorVisibility: "public", anchor: langAnchor(n) } : {}
53557
+ ...n.label === "Language" && langAnchor(n) ? { anchorVisibility: "public", anchor: langAnchor(n) } : {},
53558
+ // A Component stub claims itself by slug (OM-agent-anchors) — the door
53559
+ // confirms only against an EXISTING public Component of that slug, so an
53560
+ // org-internal component name never crosses (fails closed to org).
53561
+ ...n.label === "Component" ? { anchorVisibility: "public", anchor: `component:${wireId}` } : {}
53431
53562
  };
53432
53563
  }
53433
53564
  function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [], opts = {}) {
@@ -53488,15 +53619,18 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
53488
53619
  if (e.type === "OCCURS_IN" && t.label !== "Language") continue;
53489
53620
  if (e.type === "DEPENDS_ON" && t.label !== "Package") continue;
53490
53621
  if (e.type === "PERTAIN_TO" && t.label !== "Domain") continue;
53491
- if (t.label === "Package" && opts.includePackages !== true) continue;
53622
+ if (e.type === "CONCERNS" && t.label !== "Component") continue;
53623
+ if ((t.label === "Package" || t.label === "Component") && opts.includePackages !== true) continue;
53492
53624
  if (ignored(t.description) || ignored(String(t.attrs["name"] ?? ""))) continue;
53493
53625
  targets.push({ e, t, wireId: wireContextId(t) });
53494
53626
  }
53495
53627
  if (targets.length === 0) continue;
53496
53628
  const shipped = shippedById.get(sourceId);
53497
53629
  if (shipped) {
53498
- const anchors = (label) => targets.filter((x) => x.t.label === label).map((x) => label === "Language" ? langAnchor(x.t) : x.wireId).filter((a) => a != null).sort();
53499
- const anchor = anchors("Package")[0] ?? anchors("Language")[0];
53630
+ const anchors = (label) => targets.filter((x) => x.t.label === label).map(
53631
+ (x) => label === "Language" ? langAnchor(x.t) : label === "Component" ? `component:${x.wireId}` : x.wireId
53632
+ ).filter((a) => a != null).sort();
53633
+ const anchor = anchors("Package")[0] ?? anchors("Component")[0] ?? anchors("Language")[0];
53500
53634
  if (anchor) {
53501
53635
  shipped.anchorVisibility = "public";
53502
53636
  shipped.anchor = anchor;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.2-dev.81",
3
+ "version": "2.0.2-dev.95",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {
package/pass-worker.mjs CHANGED
@@ -15049,7 +15049,10 @@ var init_edge_rules = __esm({
15049
15049
  // NOT ruled here — the type pre-exists with broader extractor senses, and a
15050
15050
  // new rule on an old type would reject legitimate live flows (reject-never-flip
15051
15051
  // cuts both ways: only rule types you introduce or senses that are documented).
15052
- CONCERNS: { from: ["Problem", "Solution", "RootCause", "Claim", "Pattern"], to: ["Tool"] },
15052
+ // `Component` joined the target set with OM-agent-anchors: an agent-named
15053
+ // component ("React Router") is the same knowledge→named-unit anchor shape as
15054
+ // a Tool — the knowledge is ABOUT it, not dependent on it.
15055
+ CONCERNS: { from: ["Problem", "Solution", "RootCause", "Claim", "Pattern"], to: ["Tool", "Component"] },
15053
15056
  OPERATES_ON: { from: ["Algorithm"], to: ["DataStructure"] },
15054
15057
  INVOLVES: { from: ["Problem", "Solution"], to: ["DataStructure"] },
15055
15058
  // ── Taxonomy (Track 4 Stream C: MITRE CWE `ChildOf` → `Weakness —IS_A→ Weakness`) ──