@inerrata-corporation/errata 2.0.1-dev.100 → 2.0.1-dev.102

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 +28 -8
  2. package/package.json +1 -1
package/errata.mjs CHANGED
@@ -21851,8 +21851,14 @@ var init_client = __esm({
21851
21851
  * the per-decision response into flush accounting.
21852
21852
  *
21853
21853
  * The v1 door caps a payload at `MAX_NODES_PER_PAYLOAD` / `MAX_EDGES_PER_PAYLOAD`
21854
- * (413 over). A batch above the cap is split and drained across calls under ONE
21855
- * runId: every NODE chunk first (edges empty), then EDGE chunks (nodes empty).
21854
+ * (413 over). A batch above the cap is split and drained across calls, every
21855
+ * NODE chunk first (edges empty), then EDGE chunks (nodes empty). Each chunk
21856
+ * gets its OWN runId: the door's durable idempotency claim is keyed on
21857
+ * (agent, org, runId) with the payload digest, so reusing one runId across
21858
+ * different chunk payloads 409s "runId was already used with a different
21859
+ * payload" on the second chunk — exactly how the first real >25-node drain
21860
+ * died (2026-07-22). The runId never grouped anything server-side; it exists
21861
+ * for duplicate-POST protection, which is per-request by nature.
21856
21862
  * Recognition resolves an edge's endpoints against nodes already ingested this
21857
21863
  * drain (endpoint-label validation is deferred to the service when an endpoint
21858
21864
  * isn't in-payload), so the split never orphans an edge. Sub-results concat into
@@ -21865,6 +21871,7 @@ var init_client = __esm({
21865
21871
  }
21866
21872
  const merged = { runId, nodes: [], edges: [] };
21867
21873
  let pendingEdges = [...batch.edges];
21874
+ const echoedCloudId = /* @__PURE__ */ new Map();
21868
21875
  for (const nodeChunk of chunkArray(batch.nodes, INGEST_NODE_CHUNK)) {
21869
21876
  const ids = new Set(nodeChunk.map((n) => n.id));
21870
21877
  const inChunk = pendingEdges.filter((e) => ids.has(e.from) && ids.has(e.to)).slice(0, MAX_EDGES_PER_PAYLOAD);
@@ -21872,15 +21879,23 @@ var init_client = __esm({
21872
21879
  const shipped = new Set(inChunk);
21873
21880
  pendingEdges = pendingEdges.filter((e) => !shipped.has(e));
21874
21881
  }
21875
- const r = await this.ingestWire(toWirePayload({ ...batch, nodes: nodeChunk, edges: inChunk }, runId));
21882
+ const r = await this.ingestWire(toWirePayload({ ...batch, nodes: nodeChunk, edges: inChunk }, randomUUID()));
21876
21883
  merged.nodes.push(...r.nodes);
21877
21884
  merged.edges.push(...r.edges);
21885
+ for (const rn of r.nodes) {
21886
+ if (rn.nodeId && rn.nodeId !== rn.canonicalId) echoedCloudId.set(rn.canonicalId, rn.nodeId);
21887
+ }
21878
21888
  if (r.patternReconciliation) {
21879
21889
  merged.patternReconciliation = { ...merged.patternReconciliation, ...r.patternReconciliation };
21880
21890
  }
21881
21891
  }
21882
21892
  for (const edgeChunk of chunkArray(pendingEdges, MAX_EDGES_PER_PAYLOAD)) {
21883
- const r = await this.ingestWire(toWirePayload({ ...batch, nodes: [], edges: edgeChunk }, runId));
21893
+ const rewritten = edgeChunk.map((e) => ({
21894
+ ...e,
21895
+ from: echoedCloudId.get(e.from) ?? e.from,
21896
+ to: echoedCloudId.get(e.to) ?? e.to
21897
+ }));
21898
+ const r = await this.ingestWire(toWirePayload({ ...batch, nodes: [], edges: rewritten }, randomUUID()));
21884
21899
  merged.edges.push(...r.edges);
21885
21900
  }
21886
21901
  return { ...summarizeIngestResult(merged), result: merged };
@@ -51649,7 +51664,7 @@ function startLoopLagMonitor(thresholdMs = 1e3) {
51649
51664
  }
51650
51665
 
51651
51666
  // src/engine.ts
51652
- var DAEMON_VERSION = true ? "2.0.1-dev.100" : "2.0.0-alpha.0";
51667
+ var DAEMON_VERSION = true ? "2.0.1-dev.102" : "2.0.0-alpha.0";
51653
51668
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
51654
51669
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
51655
51670
  var GIT_OP_MUTE_MS = 4e3;
@@ -53429,10 +53444,13 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
53429
53444
  }
53430
53445
  if (targets.length === 0) continue;
53431
53446
  const dg = digest(targets.map(({ e, wireId }) => `${e.type}>${wireId}`).sort());
53432
- if (store.getNode(sourceId)?.attrs["anchorsContributedDigest"] === dg) continue;
53447
+ const sourceNode = store.getNode(sourceId);
53448
+ if (sourceNode?.attrs["anchorsContributedDigest"] === dg) continue;
53433
53449
  anchorDigests[sourceId] = dg;
53450
+ const skippedCloudId = !seen.has(sourceId) ? sourceNode?.attrs["cloudNodeId"] : void 0;
53451
+ const wireFrom = typeof skippedCloudId === "string" && skippedCloudId.length > 0 ? skippedCloudId : sourceId;
53434
53452
  for (const { e, t, wireId } of targets) {
53435
- anchorEdges.push({ ...e, to: wireId, attrs: {} });
53453
+ anchorEdges.push({ ...e, from: wireFrom, to: wireId, attrs: {} });
53436
53454
  if (t.attrs["source"] === "cloud" || contextSeen.has(wireId)) continue;
53437
53455
  contextSeen.add(wireId);
53438
53456
  contextNodes.push(shareableContext(t, wireId));
@@ -53444,6 +53462,8 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
53444
53462
  for (const sourceId of anchorSources) {
53445
53463
  const source = store.getNode(sourceId);
53446
53464
  if (!source) continue;
53465
+ const skippedCloudId = !seen.has(sourceId) ? source.attrs["cloudNodeId"] : void 0;
53466
+ const wireFrom = typeof skippedCloudId === "string" && skippedCloudId.length > 0 ? skippedCloudId : sourceId;
53447
53467
  for (const e of store.outEdges(sourceId, ["ANCHORED_AT"])) {
53448
53468
  const target = store.getNode(e.to);
53449
53469
  if (!target) continue;
@@ -53478,7 +53498,7 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
53478
53498
  stability: "unstable"
53479
53499
  });
53480
53500
  }
53481
- anchorEdges.push({ ...e, to: symId, attrs: {} });
53501
+ anchorEdges.push({ ...e, from: wireFrom, to: symId, attrs: {} });
53482
53502
  }
53483
53503
  }
53484
53504
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.1-dev.100",
3
+ "version": "2.0.1-dev.102",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {