@inerrata-corporation/errata 2.0.22-dev.4148 → 2.0.22-dev.4164

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.
@@ -17042,6 +17042,20 @@ var SqliteGraphStore = class {
17042
17042
  if (revived > 0) this.mutations++;
17043
17043
  return revived;
17044
17044
  }
17045
+ incomingEdgeCoverage(label, edgeTypes, cloudOnly) {
17046
+ if (edgeTypes.length === 0) return { count: 0, total: 0 };
17047
+ const r = this.db.prepare(
17048
+ `SELECT COUNT(*) AS total,
17049
+ COALESCE(SUM(CASE WHEN EXISTS (
17050
+ SELECT 1 FROM edges e WHERE e.to_id = n.id AND e.valid_to IS NULL
17051
+ AND e.type IN (${edgeTypes.map(() => "?").join(",")})
17052
+ ) THEN 1 ELSE 0 END), 0) AS count
17053
+ FROM nodes n
17054
+ WHERE n.label = ? AND n.valid_to IS NULL
17055
+ AND (? = 0 OR json_extract(n.attrs_json, '$.source') = 'cloud')`
17056
+ ).get(...edgeTypes, label, cloudOnly ? 1 : 0);
17057
+ return { count: Number(r.count), total: Number(r.total) };
17058
+ }
17045
17059
  recentEdgeAttrCoverage(marker, attr, limit) {
17046
17060
  const r = this.db.prepare(
17047
17061
  `SELECT COUNT(*) AS total,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.22-dev.4148",
3
+ "version": "2.0.22-dev.4164",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {
package/pass-worker.mjs CHANGED
@@ -27908,6 +27908,20 @@ var SqliteGraphStore = class {
27908
27908
  if (revived > 0) this.mutations++;
27909
27909
  return revived;
27910
27910
  }
27911
+ incomingEdgeCoverage(label, edgeTypes, cloudOnly) {
27912
+ if (edgeTypes.length === 0) return { count: 0, total: 0 };
27913
+ const r = this.db.prepare(
27914
+ `SELECT COUNT(*) AS total,
27915
+ COALESCE(SUM(CASE WHEN EXISTS (
27916
+ SELECT 1 FROM edges e WHERE e.to_id = n.id AND e.valid_to IS NULL
27917
+ AND e.type IN (${edgeTypes.map(() => "?").join(",")})
27918
+ ) THEN 1 ELSE 0 END), 0) AS count
27919
+ FROM nodes n
27920
+ WHERE n.label = ? AND n.valid_to IS NULL
27921
+ AND (? = 0 OR json_extract(n.attrs_json, '$.source') = 'cloud')`
27922
+ ).get(...edgeTypes, label, cloudOnly ? 1 : 0);
27923
+ return { count: Number(r.count), total: Number(r.total) };
27924
+ }
27911
27925
  recentEdgeAttrCoverage(marker, attr, limit) {
27912
27926
  const r = this.db.prepare(
27913
27927
  `SELECT COUNT(*) AS total,
@@ -29696,12 +29710,39 @@ var MECHANISMS = [
29696
29710
  // reading is IDLE — correct, and it declares no backlog on purpose.
29697
29711
  effectCounter: "alarms",
29698
29712
  note: "steady-state IDLE is healthy; the row exists for its invocation age"
29713
+ },
29714
+ {
29715
+ id: "project-causal-sync",
29716
+ what: "lands the cloud project stratum's SOLVED_BY/FIXED_BY edges onto the knowledge the anchor feed mirrors",
29717
+ // PRODUCER: the anchor feed's causal leg — `fetchProjectAnchors` returns the
29718
+ // edges, `syncProjectAnchors` (apps/daemon/src/project-reanchor.ts) lands or
29719
+ // parks them, on the `anchor-pull` beat. CONSUMERS: every local walk that
29720
+ // crosses Problem→Solution — errata_trace/why/burst over the store, and the
29721
+ // passive priming block that renders a problem with its fix. Before
29722
+ // PJ-sync-causal the feed mirrored 5,054 cloud Solutions on the dev checkout
29723
+ // with not one incoming SOLVED_BY: this row would have read 0.0% for months.
29724
+ pass: "anchor-pull",
29725
+ fedIncoming: { label: "Solution", edgeTypes: ["SOLVED_BY", "FIXED_BY"], cloudOnly: true, minFraction: 0.5 },
29726
+ effectCounter: "edgesLanded",
29727
+ // Parked edges waiting on an endpoint — a flat, non-zero backlog is a stratum
29728
+ // whose other ends never arrive here (a cap, or a gate that refuses them).
29729
+ backlogCounter: "edgesPending",
29730
+ requiresNodes: ["Problem"],
29731
+ note: "an orphaned cloud Solution reads as a fix with no problem; the one-time causal re-walk lifts this after the server ships the leg"
29699
29732
  }
29700
29733
  ];
29701
29734
  var COLUMN_INPUTS = {
29702
29735
  __createdAtSeq: (n) => n.createdAtSeq !== void 0 && n.createdAtSeq !== null
29703
29736
  };
29704
29737
  function evaluateFed(store2, d) {
29738
+ if (d.fedIncoming) {
29739
+ const { count: count2, total } = store2.incomingEdgeCoverage?.(
29740
+ d.fedIncoming.label,
29741
+ d.fedIncoming.edgeTypes,
29742
+ d.fedIncoming.cloudOnly
29743
+ ) ?? { count: 0, total: 0 };
29744
+ return { count: count2, total, fraction: total === 0 ? 0 : count2 / total };
29745
+ }
29705
29746
  if (d.fedEdges) {
29706
29747
  const { count: count2, total } = store2.recentEdgeAttrCoverage(
29707
29748
  d.fedEdges.marker,
@@ -29753,7 +29794,7 @@ function evaluateMechanisms(store2, invocations = /* @__PURE__ */ new Map(), mec
29753
29794
  if (d.configCounter && inv?.lastTotals?.[d.configCounter] === 0) verdict = "unconfigured";
29754
29795
  else if ((backlog ?? 0) === 0 && (!hasInput && !d.inputOptional || missingRequiredNodes)) verdict = "no-input";
29755
29796
  else if (!inv || inv.runs === 0) verdict = "never-invoked";
29756
- else if (fed.fraction < (d.fedEdges?.minFraction ?? d.fed?.minFraction ?? 0)) verdict = "starved";
29797
+ else if (fed.fraction < minFractionOf(d)) verdict = "starved";
29757
29798
  else if (stalled) verdict = "stalled";
29758
29799
  else if (effectCount === 0) verdict = "no-effect";
29759
29800
  else verdict = "ok";
@@ -29764,7 +29805,7 @@ function evaluateMechanisms(store2, invocations = /* @__PURE__ */ new Map(), mec
29764
29805
  fedCount: fed.count,
29765
29806
  fedTotal: fed.total,
29766
29807
  fedFraction: fed.fraction,
29767
- minFraction: d.fedEdges?.minFraction ?? d.fed?.minFraction ?? 0,
29808
+ minFraction: minFractionOf(d),
29768
29809
  ...inv ? { lastInvokedMs: inv.lastTs } : {},
29769
29810
  runs: inv?.runs ?? 0,
29770
29811
  effectCount,
@@ -29776,6 +29817,9 @@ function evaluateMechanisms(store2, invocations = /* @__PURE__ */ new Map(), mec
29776
29817
  };
29777
29818
  });
29778
29819
  }
29820
+ function minFractionOf(d) {
29821
+ return d.fedIncoming?.minFraction ?? d.fedEdges?.minFraction ?? d.fed?.minFraction ?? 0;
29822
+ }
29779
29823
 
29780
29824
  // ../../packages/local-graph/src/wm-calibration.ts
29781
29825
  var WM_CALIBRATION_LABELS = [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "errata-context",
3
- "version": "2.0.22-dev.4148",
3
+ "version": "2.0.22-dev.4164",
4
4
  "description": "A minimal 3D view of loaded Errata priors and recent graph bursts.",
5
5
  "author": {
6
6
  "name": "inErrata"
@@ -1,4 +1,4 @@
1
- cca4f0dd975b5b7f3241ded0ca86ed298023c39b803fdb3f3937cdcb441c3264 .codex-plugin/plugin.json
1
+ 0519a3dd34e55c34ebac732f4b86afc926669093bfa0b1376e57d809addfbe27 .codex-plugin/plugin.json
2
2
  a7bebae9fb01c838d6c75fc784129e28be571233fa66ff5ee8039b574f35ccf7 assets/icon.png
3
3
  fc38b64e4df1e0b72c35764bef6c4c05430d97c9009ad0ecc8a9e75b4deab232 configure-local.mjs
4
4
  73dc6028b3b070257c7c31f252d11e55a9e096f4aed0f187f10cb21716e1e6d7 dist/client.js