@inerrata-corporation/errata 2.0.2-dev.982 → 2.0.2

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.2-dev.982",
3
+ "version": "2.0.2",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {
package/pass-worker.mjs CHANGED
@@ -212,7 +212,7 @@ var init_castalia = __esm({
212
212
  DECOMPOSITION_EDGES = ["SPLIT_INTO"];
213
213
  TRANSFER_EDGES = ["MAY_RESOLVE"];
214
214
  SOLUTION_STRUCTURE_EDGES = ["BUILDS_ON", "SUPERSEDES", "ALTERNATIVE_TO"];
215
- SUSPICION_EDGES = ["SUSPECTED_LINK"];
215
+ SUSPICION_EDGES = ["SUSPECTED_LINK", "REGRESSION_OF"];
216
216
  TAXONOMY_EDGES = ["IS_A"];
217
217
  TRIAGE_EDGES = ["TRIAGED_BY", "CONFIRMS", "INDICATES", "ROUTES_TO"];
218
218
  GIT_EDGES = ["POINTS_AT", "PARENT", "AUTHORED_BY"];
@@ -277,8 +277,10 @@ var init_castalia = __esm({
277
277
  "ALTERNATIVE_TO",
278
278
  // symmetric peer marker — weight would let alternatives inflate each other
279
279
  // NB: BUILDS_ON is NOT excluded — it flows extension→base so foundational solutions rank up.
280
- "SUSPECTED_LINK"
280
+ "SUSPECTED_LINK",
281
281
  // Somnus hypothesis (PLAN_SOMNUS_V2 §4) — never flows rank; navigation-invisible.
282
+ "REGRESSION_OF"
283
+ // recurrence marker (RG-recognize) — a question about a close, not signal-flow.
282
284
  ]);
283
285
  EDGE_WEIGHT = {
284
286
  // Causal — high signal
@@ -391,6 +393,7 @@ var init_castalia = __esm({
391
393
  ALTERNATIVE_TO: 0,
392
394
  // Suspicion — a hypothesis, weightless + PageRank-excluded (never flows rank / EIG).
393
395
  SUSPECTED_LINK: 0,
396
+ REGRESSION_OF: 0,
394
397
  // Git — topology/authorship, weightless (not domain signal-flow)
395
398
  POINTS_AT: 0,
396
399
  PARENT: 0,
@@ -421,6 +424,13 @@ var init_castalia = __esm({
421
424
  }
422
425
  });
423
426
 
427
+ // ../../packages/shared/src/graph-events.ts
428
+ var init_graph_events = __esm({
429
+ "../../packages/shared/src/graph-events.ts"() {
430
+ "use strict";
431
+ }
432
+ });
433
+
424
434
  // ../../packages/shared/src/canonical/hash.ts
425
435
  import { createHash } from "node:crypto";
426
436
  function sha256(input) {
@@ -15322,6 +15332,7 @@ var init_src = __esm({
15322
15332
  "../../packages/shared/src/index.ts"() {
15323
15333
  "use strict";
15324
15334
  init_castalia();
15335
+ init_graph_events();
15325
15336
  init_identity();
15326
15337
  init_wire();
15327
15338
  init_edge_rules();
@@ -24288,7 +24299,13 @@ var LOCAL_RULE_OVERRIDES = {
24288
24299
  // the cloud door's `to: [Solution]` rule is untouched. The `from` constraint
24289
24300
  // stays: the reversed (Solution)-FIXED_BY->(...) splash bug is the reason
24290
24301
  // this rule exists at all.
24291
- FIXED_BY: { from: EDGE_RULES["FIXED_BY"]?.from, to: ["Solution", "Episode"] }
24302
+ FIXED_BY: { from: EDGE_RULES["FIXED_BY"]?.from, to: ["Solution", "Episode"] },
24303
+ // RG-recognize: a NEW open Problem re-observing a RESOLVED one ("this is
24304
+ // back — the fix didn't hold"). Local-only for now: the instance drain's
24305
+ // INSTANCE_EDGES allowlist doesn't ship it, and the cloud door's matrix
24306
+ // doesn't know it — crossing the membrane is a deliberate later step, never
24307
+ // a side effect (the half-shipped-edge-type lesson).
24308
+ REGRESSION_OF: { from: ["Problem"], to: ["Problem"] }
24292
24309
  };
24293
24310
  function localEdgeViolation(fromLabel, type, toLabel) {
24294
24311
  if (type in LOCAL_RULE_OVERRIDES) {
@@ -25717,11 +25734,16 @@ function foldDuplicateProblem(store2, dup, survivor, ts) {
25717
25734
  if (!surv) return;
25718
25735
  const sources = new Set(surv.attrs["sources"] ?? []);
25719
25736
  for (const s of dup.attrs["sources"] ?? []) sources.add(s);
25737
+ const dupSeq = dup.attrs["createdAtSeq"] ?? store2.currentIngestSeq();
25738
+ const exposure = priorExposure(store2, survivor.id, dupSeq);
25739
+ const expField = `reinforce${exposure[0].toUpperCase()}${exposure.slice(1)}Count`;
25720
25740
  store2.updateNode(survivor.id, {
25721
25741
  attrs: {
25722
25742
  ...surv.attrs,
25723
25743
  sources: [...sources],
25724
- corroborations: corroborations(surv) + corroborations(dup) + 1
25744
+ corroborations: corroborations(surv) + corroborations(dup) + 1,
25745
+ [expField]: (surv.attrs[expField] ?? 0) + 1,
25746
+ lastReinforceExposure: exposure
25725
25747
  },
25726
25748
  cumulativeHits: (surv.cumulativeHits ?? 0) + (dup.cumulativeHits ?? 0),
25727
25749
  lastUpdatedAt: ts
@@ -25750,6 +25772,7 @@ function foldDuplicateProblem(store2, dup, survivor, ts) {
25750
25772
  function isConstraintProblem(node) {
25751
25773
  return node.attrs["kind"] === "constraint";
25752
25774
  }
25775
+ var RECURRENCE_DEBOUNCE_MS = 60 * 60 * 1e3;
25753
25776
  var CITABLE_PRIOR_LABELS = /* @__PURE__ */ new Set([
25754
25777
  "Solution",
25755
25778
  "RootCause",
@@ -25936,6 +25959,16 @@ function clearSettledFixCandidates(store2, t) {
25936
25959
  }
25937
25960
  return report;
25938
25961
  }
25962
+ function priorExposure(store2, nodeId, atSeq) {
25963
+ const n = store2.getNode(nodeId);
25964
+ if (!n || !n.attrs) return "unshown";
25965
+ const shownSeq = n.attrs["lastShownAtSeq"];
25966
+ if (shownSeq !== void 0 && shownSeq <= atSeq) return "shown";
25967
+ const evictedSeq = n.attrs["lastEvictedAtSeq"];
25968
+ if (evictedSeq !== void 0 && evictedSeq <= atSeq) return "evicted";
25969
+ if ((n.attrs["evictedCount"] ?? 0) > 0) return "evicted";
25970
+ return "unshown";
25971
+ }
25939
25972
 
25940
25973
  // ../../packages/local-graph/src/intent.ts
25941
25974
  init_src();
@@ -27034,7 +27067,19 @@ function buildSnapshot(opts) {
27034
27067
  anchors: opts.store.outEdges(p.id, ["MANIFESTED_IN", "EVIDENCED_BY"])
27035
27068
  }));
27036
27069
  const recentConstraints = stillOpen.filter((p) => isConstraintProblem(p)).sort((a, b) => b.lastUpdatedAt - a.lastUpdatedAt).slice(0, 3);
27037
- const recentResolved = problems.filter((p) => p.attrs["resolvedAt"] != null && p.attrs["resolvedAs"] == null).sort((a, b) => Number(b.attrs["resolvedAt"] ?? 0) - Number(a.attrs["resolvedAt"] ?? 0)).slice(0, 4).map((p) => {
27070
+ const regressions = problems.filter((p) => p.attrs["resolvedAt"] == null && p.attrs["mergedInto"] === void 0).flatMap(
27071
+ (open) => opts.store.outEdges(open.id, ["REGRESSION_OF"]).flatMap((e) => {
27072
+ const closed = opts.store.getNode(e.to);
27073
+ if (!closed || closed.attrs["resolutionSuspect"] !== true || closed.attrs["resolvedAt"] == null) {
27074
+ return [];
27075
+ }
27076
+ const solEdge = opts.store.outEdges(closed.id, ["SOLVED_BY"])[0];
27077
+ const solution = solEdge ? opts.store.getNode(solEdge.to) ?? void 0 : void 0;
27078
+ return [{ open, closed, ...solution ? { solution } : {} }];
27079
+ })
27080
+ ).sort((a, b) => Number(b.closed.attrs["recurredAt"] ?? 0) - Number(a.closed.attrs["recurredAt"] ?? 0)).slice(0, 2);
27081
+ const regressionClosedIds = new Set(regressions.map((r) => r.closed.id));
27082
+ const recentResolved = problems.filter((p) => p.attrs["resolvedAt"] != null && p.attrs["resolvedAs"] == null).filter((p) => !regressionClosedIds.has(p.id)).sort((a, b) => Number(b.attrs["resolvedAt"] ?? 0) - Number(a.attrs["resolvedAt"] ?? 0)).slice(0, 4).map((p) => {
27038
27083
  const solEdge = opts.store.outEdges(p.id, ["SOLVED_BY"])[0];
27039
27084
  const solution = solEdge ? opts.store.getNode(solEdge.to) ?? void 0 : void 0;
27040
27085
  return { node: p, ...solution ? { solution } : {} };
@@ -27104,6 +27149,7 @@ function buildSnapshot(opts) {
27104
27149
  recentProblems: recent,
27105
27150
  recentResolved,
27106
27151
  recentConstraints,
27152
+ regressions,
27107
27153
  ...causalNudge ? { causalNudge } : {},
27108
27154
  ...opts.selfCiteSkips && opts.selfCiteSkips > 0 ? { selfCiteSkips: opts.selfCiteSkips } : {},
27109
27155
  ...domainNudge ? { domainNudge } : {},