@inerrata-corporation/errata 2.0.17-dev.3447 → 2.0.17-dev.3450

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.
@@ -18575,6 +18575,8 @@ function generalize(text, opts = {}) {
18575
18575
  init_src();
18576
18576
 
18577
18577
  // src/instance-receipts.ts
18578
+ var INSTANCE_SEMANTIC_EDGE_TYPES = ["CAUSED_BY", "SOLVED_BY"];
18579
+ var INSTANCE_ANCHOR_EDGE_TYPES = ["OCCURS_IN", "DEPENDS_ON", "PERTAIN_TO", "CONCERNS"];
18578
18580
  function receiptMap(attrs) {
18579
18581
  const value = attrs["instanceReceipts"];
18580
18582
  return value && typeof value === "object" && !Array.isArray(value) ? value : {};
@@ -19455,8 +19457,8 @@ function generalizeFileRefs(text, fileLexicon, level = 1) {
19455
19457
 
19456
19458
  // src/instance-ingest.ts
19457
19459
  var INSTANCE_LABELS = ["Problem", "Vulnerability", "Solution", "RootCause"];
19458
- var INSTANCE_EDGES = ["CAUSED_BY", "SOLVED_BY"];
19459
- var ANCHOR_EDGES = ["OCCURS_IN", "DEPENDS_ON", "PERTAIN_TO", "CONCERNS"];
19460
+ var INSTANCE_EDGES = INSTANCE_SEMANTIC_EDGE_TYPES;
19461
+ var ANCHOR_EDGES = INSTANCE_ANCHOR_EDGE_TYPES;
19460
19462
  var ANCHOR_TARGET_LABELS = ["Language", "Package", "Domain", "Component"];
19461
19463
  function stripCodebaseScope(scope) {
19462
19464
  const s = { ...scope ?? {} };
package/errata.mjs CHANGED
@@ -82169,7 +82169,7 @@ function createWatchBreaker(deps) {
82169
82169
  }
82170
82170
 
82171
82171
  // src/engine.ts
82172
- var DAEMON_VERSION = true ? "2.0.17-dev.3447" : "2.0.0-alpha.0";
82172
+ var DAEMON_VERSION = true ? "2.0.17-dev.3450" : "2.0.0-alpha.0";
82173
82173
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
82174
82174
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
82175
82175
  var GIT_OP_MUTE_MS = 4e3;
@@ -85055,6 +85055,39 @@ async function linkRegisteredWorkspaces(cfg, loggedInProfile = cfg.activeInstall
85055
85055
 
85056
85056
  // src/instance-receipts.ts
85057
85057
  import { createHash as createHash18 } from "node:crypto";
85058
+ var INSTANCE_SEMANTIC_EDGE_TYPES = ["CAUSED_BY", "SOLVED_BY"];
85059
+ var INSTANCE_ANCHOR_EDGE_TYPES = ["OCCURS_IN", "DEPENDS_ON", "PERTAIN_TO", "CONCERNS"];
85060
+ function edgeReceiptKind(type) {
85061
+ if (INSTANCE_SEMANTIC_EDGE_TYPES.includes(type)) return "semantic";
85062
+ if (INSTANCE_ANCHOR_EDGE_TYPES.includes(type)) return "anchor";
85063
+ return type === "ANCHORED_AT" ? "projectAnchor" : null;
85064
+ }
85065
+ function instanceEdgeReceipts(sent, received, cloudIds) {
85066
+ const wireId = (id) => cloudIds.get(id) ?? id;
85067
+ const edgeKey = (e) => JSON.stringify([wireId(e.from), e.type, wireId(e.to)]);
85068
+ const groupKey = (source, kind) => JSON.stringify([wireId(source), kind]);
85069
+ const accepted = /* @__PURE__ */ new Map();
85070
+ const rejected = /* @__PURE__ */ new Set();
85071
+ for (const edge2 of received) {
85072
+ const key = edgeKey(edge2);
85073
+ if (edge2.decision === "rejected") rejected.add(key);
85074
+ else if (edge2.decision === "created" || edge2.decision === "reinforced") accepted.set(key, (accepted.get(key) ?? 0) + 1);
85075
+ }
85076
+ const groups = /* @__PURE__ */ new Map();
85077
+ for (const edge2 of sent) {
85078
+ const kind = edgeReceiptKind(edge2.type);
85079
+ if (!kind) continue;
85080
+ const group = groupKey(edge2.from, kind);
85081
+ const expected = groups.get(group) ?? /* @__PURE__ */ new Map();
85082
+ const key = edgeKey(edge2);
85083
+ expected.set(key, (expected.get(key) ?? 0) + 1);
85084
+ groups.set(group, expected);
85085
+ }
85086
+ const complete = new Set([...groups].filter(
85087
+ ([, expected]) => [...expected].every(([key, count]) => !rejected.has(key) && (accepted.get(key) ?? 0) >= count)
85088
+ ).map(([group]) => group));
85089
+ return { complete: (source, kind) => complete.has(groupKey(source, kind)) };
85090
+ }
85058
85091
  var FIELDS = ["contributedAtSeq", "cloudNodeId", "anchorsContributedDigest", "projectAnchorsContributedDigest", "semanticEdgesContributedDigest", "shipRefusedSinceSeq", "shipRefusedCount", "shipRefusedReason", "shipRefusedFingerprint"];
85059
85092
  function instanceDestinationKey(input) {
85060
85093
  return createHash18("sha256").update(JSON.stringify([
@@ -85099,6 +85132,7 @@ function acceptedInstanceReceipt(current, sent, decision, destination, mirrorLeg
85099
85132
  }
85100
85133
 
85101
85134
  // src/multi.ts
85135
+ init_src();
85102
85136
  init_dist();
85103
85137
  init_src5();
85104
85138
  import { existsSync as existsSync34, readFileSync as readFileSync36, unlinkSync as unlinkSync5, writeFileSync as writeFileSync26 } from "node:fs";
@@ -85480,8 +85514,8 @@ function internalSymbolsFor(description, lexiconHas, publicIndex) {
85480
85514
  // src/instance-ingest.ts
85481
85515
  init_generalize_graph();
85482
85516
  var INSTANCE_LABELS = ["Problem", "Vulnerability", "Solution", "RootCause"];
85483
- var INSTANCE_EDGES = ["CAUSED_BY", "SOLVED_BY"];
85484
- var ANCHOR_EDGES = ["OCCURS_IN", "DEPENDS_ON", "PERTAIN_TO", "CONCERNS"];
85517
+ var INSTANCE_EDGES = INSTANCE_SEMANTIC_EDGE_TYPES;
85518
+ var ANCHOR_EDGES = INSTANCE_ANCHOR_EDGE_TYPES;
85485
85519
  var ANCHOR_TARGET_LABELS = ["Language", "Package", "Domain", "Component"];
85486
85520
  function stripCodebaseScope(scope) {
85487
85521
  const s = { ...scope ?? {} };
@@ -90343,7 +90377,20 @@ async function startMultiDaemon(opts = {}) {
90343
90377
  if (rn.decision === "rejected") rejected.set(rn.canonicalId, rn.reason ?? "no reason given");
90344
90378
  }
90345
90379
  const rejectedEdges = res.result.edges.filter((re) => re.decision === "rejected");
90346
- const edgeReceiptsComplete = rejectedEdges.length === 0 && res.result.edges.length === instances.edges.length;
90380
+ const cloudIds = /* @__PURE__ */ new Map();
90381
+ for (const node2 of res.result.nodes) {
90382
+ if (isMembraneSaltedId(node2.nodeId)) cloudIds.set(node2.canonicalId, node2.nodeId);
90383
+ }
90384
+ for (const localId of /* @__PURE__ */ new Set([
90385
+ ...Object.keys(instances.anchorDigests),
90386
+ ...Object.keys(instances.projectAnchorDigests),
90387
+ ...Object.keys(instances.semanticEdgeDigests)
90388
+ ])) {
90389
+ const owner = owningStore(localId);
90390
+ const cloudId = owner && instanceReceipt(owner.n, destinationKey)["cloudNodeId"];
90391
+ if (isMembraneSaltedId(cloudId)) cloudIds.set(localId, cloudId);
90392
+ }
90393
+ const edgeReceipts = instanceEdgeReceipts(instances.edges, res.result.edges, cloudIds);
90347
90394
  if (rejectedEdges.length > 0) {
90348
90395
  const byReason = /* @__PURE__ */ new Map();
90349
90396
  for (const re of rejectedEdges) {
@@ -90393,7 +90440,7 @@ async function startMultiDaemon(opts = {}) {
90393
90440
  await stampBatched(Object.entries(instances.anchorDigests), ([localId, dg]) => {
90394
90441
  const owner = owningStore(localId);
90395
90442
  if (!owner) return;
90396
- if (!edgeReceiptsComplete || !instanceReceipt(owner.n, destinationKey)["cloudNodeId"] || rejected.has(localId) || blocked.has(localId)) return;
90443
+ if (!edgeReceipts.complete(localId, "anchor") || !instanceReceipt(owner.n, destinationKey)["cloudNodeId"] || rejected.has(localId) || blocked.has(localId)) return;
90397
90444
  owner.s.updateNode(localId, {
90398
90445
  attrs: updateInstanceReceipt(owner.n, destinationKey, { anchorsContributedDigest: dg }, owner.s === store)
90399
90446
  });
@@ -90401,7 +90448,7 @@ async function startMultiDaemon(opts = {}) {
90401
90448
  await stampBatched(Object.entries(instances.projectAnchorDigests), ([localId, dg]) => {
90402
90449
  const owner = owningStore(localId);
90403
90450
  if (!owner) return;
90404
- if (!edgeReceiptsComplete || !instanceReceipt(owner.n, destinationKey)["cloudNodeId"] || rejected.has(localId) || blocked.has(localId)) return;
90451
+ if (!edgeReceipts.complete(localId, "projectAnchor") || !instanceReceipt(owner.n, destinationKey)["cloudNodeId"] || rejected.has(localId) || blocked.has(localId)) return;
90405
90452
  owner.s.updateNode(localId, {
90406
90453
  attrs: updateInstanceReceipt(owner.n, destinationKey, { projectAnchorsContributedDigest: dg }, owner.s === store)
90407
90454
  });
@@ -90409,7 +90456,7 @@ async function startMultiDaemon(opts = {}) {
90409
90456
  await stampBatched(Object.entries(instances.semanticEdgeDigests), ([localId, dg]) => {
90410
90457
  const owner = owningStore(localId);
90411
90458
  if (!owner) return;
90412
- if (!edgeReceiptsComplete || !instanceReceipt(owner.n, destinationKey)["cloudNodeId"] || rejected.has(localId) || blocked.has(localId)) return;
90459
+ if (!edgeReceipts.complete(localId, "semantic") || !instanceReceipt(owner.n, destinationKey)["cloudNodeId"] || rejected.has(localId) || blocked.has(localId)) return;
90413
90460
  owner.s.updateNode(localId, {
90414
90461
  attrs: updateInstanceReceipt(owner.n, destinationKey, { semanticEdgesContributedDigest: dg }, owner.s === store)
90415
90462
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.17-dev.3447",
3
+ "version": "2.0.17-dev.3450",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {