@inerrata-corporation/errata 2.0.17-dev.3564 → 2.0.17-dev.3576

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.17-dev.3564",
3
+ "version": "2.0.17-dev.3576",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {
package/pass-worker.mjs CHANGED
@@ -27547,20 +27547,13 @@ var STATEMENT_PATH_RE = new RegExp(
27547
27547
  String.raw`(?:[\w.+-]+\/)+[\w.+-]+\.(?:${anchorableExtensionAlternation()})`,
27548
27548
  "g"
27549
27549
  );
27550
- function repairLegacyAnchorsFromStatement(store2, ts) {
27551
- const report = {
27552
- repaired: [],
27553
- retiredGuesses: 0,
27554
- noPathNamed: 0,
27555
- pathUnknown: 0,
27556
- alreadyCorrect: 0
27557
- };
27550
+ function filePathResolver(store2) {
27558
27551
  const byPath = /* @__PURE__ */ new Map();
27559
27552
  for (const f of store2.findNodesByLabel("File")) {
27560
27553
  const path = String(f.attrs["relPath"] ?? f.description ?? "");
27561
27554
  if (path) byPath.set(path, { id: f.id, path });
27562
27555
  }
27563
- const resolvePath = (named) => {
27556
+ return (named) => {
27564
27557
  const exact = byPath.get(named);
27565
27558
  if (exact) return exact;
27566
27559
  const hits = [...byPath.values()].filter(
@@ -27568,6 +27561,40 @@ function repairLegacyAnchorsFromStatement(store2, ts) {
27568
27561
  );
27569
27562
  return hits.length === 1 ? hits[0] : null;
27570
27563
  };
27564
+ }
27565
+ function statementTarget(statement, resolvePath) {
27566
+ for (const m of statement.matchAll(STATEMENT_PATH_RE)) {
27567
+ const f = resolvePath(m[0]);
27568
+ if (f) return f;
27569
+ }
27570
+ return null;
27571
+ }
27572
+ function restatedAnchor(problemId, fileId, restatedFrom, ts) {
27573
+ return {
27574
+ id: `edge_${digest({ from: problemId, type: "ANCHORED_AT", to: fileId })}`.slice(0, 24),
27575
+ from: problemId,
27576
+ to: fileId,
27577
+ type: "ANCHORED_AT",
27578
+ // Same confidence a capture-time anchor enters at: the source is the
27579
+ // agent's own statement either way, only the moment of reading differs.
27580
+ confidence: 0.4,
27581
+ extractionSource: "agent-observed",
27582
+ createdAt: ts,
27583
+ lastSeenAt: ts,
27584
+ navSuccesses: 0,
27585
+ navFailures: 0,
27586
+ attrs: { anchorProvenance: "restated", restatedFrom, restatedAt: ts }
27587
+ };
27588
+ }
27589
+ function repairLegacyAnchorsFromStatement(store2, ts) {
27590
+ const report = {
27591
+ repaired: [],
27592
+ retiredGuesses: 0,
27593
+ noPathNamed: 0,
27594
+ pathUnknown: 0,
27595
+ alreadyCorrect: 0
27596
+ };
27597
+ const resolvePath = filePathResolver(store2);
27571
27598
  for (const p of store2.findNodesByLabel("Problem")) {
27572
27599
  try {
27573
27600
  const anchors = store2.outEdges(p.id, ["ANCHORED_AT"]);
@@ -27607,25 +27634,7 @@ function repairLegacyAnchorsFromStatement(store2, ts) {
27607
27634
  report.pathUnknown++;
27608
27635
  continue;
27609
27636
  }
27610
- store2.mergeEdge({
27611
- id: `edge_${digest({ from: p.id, type: "ANCHORED_AT", to: target.id })}`.slice(0, 24),
27612
- from: p.id,
27613
- to: target.id,
27614
- type: "ANCHORED_AT",
27615
- // Same confidence a capture-time anchor enters at: the source is the
27616
- // agent's own statement either way, only the moment of reading differs.
27617
- confidence: 0.4,
27618
- extractionSource: "agent-observed",
27619
- createdAt: ts,
27620
- lastSeenAt: ts,
27621
- navSuccesses: 0,
27622
- navFailures: 0,
27623
- attrs: {
27624
- anchorProvenance: "restated",
27625
- restatedFrom: guessedPaths[0] ?? "",
27626
- restatedAt: ts
27627
- }
27628
- });
27637
+ store2.mergeEdge(restatedAnchor(p.id, target.id, guessedPaths[0] ?? "", ts));
27629
27638
  for (const e of legacy) {
27630
27639
  if (e.to !== target.id) store2.closeEdge(e.id, ts);
27631
27640
  }
@@ -27645,23 +27654,35 @@ function backfillLegacyAnchors(store2, ts) {
27645
27654
  const report = {
27646
27655
  demotedEdges: 0,
27647
27656
  demotedProblems: 0,
27657
+ restatedProblems: 0,
27648
27658
  labeledEdges: 0,
27649
27659
  suspects: []
27650
27660
  };
27661
+ let resolvePath;
27651
27662
  for (const p of store2.findNodesByLabel("Problem")) {
27652
- const legacy = store2.outEdges(p.id, ["ANCHORED_AT"]).filter((e) => isLegacyAnchor(e.attrs));
27653
- if (legacy.length === 0) continue;
27654
27663
  const resolved = p.attrs["resolvedAt"] !== void 0;
27664
+ const legacy = store2.outEdges(p.id, ["ANCHORED_AT"]).filter((e) => isLegacyAnchor(e.attrs) || !resolved && e.attrs?.["anchorProvenance"] === "legacy");
27665
+ if (legacy.length === 0) continue;
27655
27666
  try {
27656
27667
  if (!resolved) {
27657
- for (const e of legacy) {
27668
+ resolvePath ??= filePathResolver(store2);
27669
+ const target = statementTarget(String(p.description ?? ""), resolvePath);
27670
+ if (target) {
27671
+ const guessed = store2.getNode(legacy[0].to);
27672
+ store2.mergeEdge(
27673
+ restatedAnchor(p.id, target.id, String(guessed?.attrs["relPath"] ?? guessed?.description ?? ""), ts)
27674
+ );
27675
+ report.restatedProblems++;
27676
+ }
27677
+ const retired = legacy.filter((e) => !(target && e.to === target.id));
27678
+ for (const e of retired) {
27658
27679
  const file2 = store2.getNode(e.to);
27659
27680
  const path = String(file2?.attrs["relPath"] ?? file2?.description ?? "");
27660
27681
  if (path) recordAnchorHint(store2, p.id, path, "legacy", ts);
27661
- store2.deleteEdge(e.id);
27682
+ store2.closeEdge(e.id, ts);
27662
27683
  report.demotedEdges++;
27663
27684
  }
27664
- report.demotedProblems++;
27685
+ if (retired.length > 0) report.demotedProblems++;
27665
27686
  continue;
27666
27687
  }
27667
27688
  for (const e of legacy) {
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "errata-minimap",
3
+ "version": "0.1.0",
4
+ "author": { "name": "inErrata", "url": "https://inerrata.ai" },
5
+ "description": "Side pane: an errata graph minimap of the latest burst neighborhood that entered the agent's context.",
6
+ "types": "./types/index.d.ts"
7
+ }
@@ -0,0 +1 @@
1
+ { "modules": ["./register.tsx"] }