@inerrata-corporation/errata 2.0.2-dev.554 → 2.0.2-dev.556

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 +32 -16
  2. package/package.json +1 -1
package/errata.mjs CHANGED
@@ -54374,7 +54374,7 @@ function startLoopLagMonitor(thresholdMs = 1e3) {
54374
54374
  }
54375
54375
 
54376
54376
  // src/engine.ts
54377
- var DAEMON_VERSION = true ? "2.0.2-dev.554" : "2.0.0-alpha.0";
54377
+ var DAEMON_VERSION = true ? "2.0.2-dev.556" : "2.0.0-alpha.0";
54378
54378
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
54379
54379
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
54380
54380
  var GIT_OP_MUTE_MS = 4e3;
@@ -56637,7 +56637,8 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
56637
56637
  for (const label of INSTANCE_LABELS) {
56638
56638
  const ref = [];
56639
56639
  includedByLabel.set(label, ref);
56640
- for (const n of store.findNodesByLabel(label)) {
56640
+ const population = label === "RootCause" && opts.sharedStore ? [...store.findNodesByLabel(label), ...opts.sharedStore.findNodesByLabel(label)] : store.findNodesByLabel(label);
56641
+ for (const n of population) {
56641
56642
  if (seen.has(n.id)) continue;
56642
56643
  if (n.attrs["source"] === "cloud") continue;
56643
56644
  if (label === "Problem" && n.attrs["resolvedAs"] === PROBLEM_RESOLUTION.FALSE_POSITIVE) continue;
@@ -56772,10 +56773,17 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
56772
56773
  const edges = [];
56773
56774
  const semanticEdgeDigests = {};
56774
56775
  for (const [sourceId, wireFrom] of semanticEndpoints) {
56775
- const outs = store.outEdges(sourceId, [...INSTANCE_EDGES]).map((e) => ({ e, wireTo: semanticEndpoints.get(e.to) })).filter((x) => x.wireTo != null);
56776
+ const rawOuts = [
56777
+ ...store.outEdges(sourceId, [...INSTANCE_EDGES]),
56778
+ ...opts.sharedStore?.outEdges(sourceId, [...INSTANCE_EDGES]) ?? []
56779
+ ];
56780
+ const dedup = /* @__PURE__ */ new Map();
56781
+ for (const e of rawOuts) dedup.set(`${e.type}>${e.to}`, e);
56782
+ const outs = [...dedup.values()].map((e) => ({ e, wireTo: semanticEndpoints.get(e.to) })).filter((x) => x.wireTo != null);
56776
56783
  if (outs.length === 0) continue;
56777
56784
  const dg = digest(outs.map(({ e, wireTo }) => `${e.type}>${wireTo}`).sort());
56778
- if (store.getNode(sourceId)?.attrs["semanticEdgesContributedDigest"] === dg) continue;
56785
+ const owner = store.getNode(sourceId) ?? opts.sharedStore?.getNode(sourceId);
56786
+ if (owner?.attrs["semanticEdgesContributedDigest"] === dg) continue;
56779
56787
  semanticEdgeDigests[sourceId] = dg;
56780
56788
  for (const { e, wireTo } of outs) edges.push({ ...e, from: wireFrom, to: wireTo, attrs: {} });
56781
56789
  }
@@ -58092,6 +58100,7 @@ async function startMultiDaemon(opts = {}) {
58092
58100
  const instances = buildInstanceIngest(store, r.engine.profile, DAEMON_VERSION, ignore, {
58093
58101
  includePackages: cfg2.consent.contributePackages,
58094
58102
  workspaceRoot: r.root,
58103
+ sharedStore,
58095
58104
  ...lexicon ? { lexicon } : {},
58096
58105
  ...project ? { project } : {}
58097
58106
  });
@@ -58115,31 +58124,38 @@ async function startMultiDaemon(opts = {}) {
58115
58124
  const cloudIdByLocal = new Map(
58116
58125
  res.result.nodes.filter((rn) => rn.nodeId).map((rn) => [rn.canonicalId, rn.nodeId])
58117
58126
  );
58127
+ const owningStore = (id) => {
58128
+ const w = store.getNode(id);
58129
+ if (w) return { s: store, n: w };
58130
+ const sh = sharedStore.getNode(id);
58131
+ if (sh) return { s: sharedStore, n: sh };
58132
+ return null;
58133
+ };
58118
58134
  for (const n of instances.nodes) {
58119
- const local = store.getNode(n.id);
58120
- if (!local || !["Problem", "Solution", "RootCause"].includes(local.label)) continue;
58135
+ const owner = owningStore(n.id);
58136
+ if (!owner || !["Problem", "Solution", "RootCause"].includes(owner.n.label)) continue;
58121
58137
  if (blocked.has(n.id)) continue;
58122
58138
  const cloudNodeId = cloudIdByLocal.get(n.id);
58123
- store.updateNode(n.id, {
58139
+ owner.s.updateNode(n.id, {
58124
58140
  attrs: {
58125
- ...local.attrs,
58141
+ ...owner.n.attrs,
58126
58142
  contributedAtSeq: seq,
58127
58143
  ...cloudNodeId && cloudNodeId !== n.id ? { cloudNodeId } : {}
58128
58144
  }
58129
58145
  });
58130
58146
  }
58131
58147
  for (const [localId, dg] of Object.entries(instances.anchorDigests)) {
58132
- const local = store.getNode(localId);
58133
- if (!local) continue;
58134
- store.updateNode(localId, {
58135
- attrs: { ...local.attrs, anchorsContributedDigest: dg }
58148
+ const owner = owningStore(localId);
58149
+ if (!owner) continue;
58150
+ owner.s.updateNode(localId, {
58151
+ attrs: { ...owner.n.attrs, anchorsContributedDigest: dg }
58136
58152
  });
58137
58153
  }
58138
58154
  for (const [localId, dg] of Object.entries(instances.semanticEdgeDigests)) {
58139
- const local = store.getNode(localId);
58140
- if (!local) continue;
58141
- store.updateNode(localId, {
58142
- attrs: { ...local.attrs, semanticEdgesContributedDigest: dg }
58155
+ const owner = owningStore(localId);
58156
+ if (!owner) continue;
58157
+ owner.s.updateNode(localId, {
58158
+ attrs: { ...owner.n.attrs, semanticEdgesContributedDigest: dg }
58143
58159
  });
58144
58160
  }
58145
58161
  return res.accepted;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.2-dev.554",
3
+ "version": "2.0.2-dev.556",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {