@inerrata-corporation/errata 2.0.8-dev.2932 → 2.0.9

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.
@@ -18216,15 +18216,6 @@ function generalize(text, opts = {}) {
18216
18216
  // src/instance-ingest.ts
18217
18217
  init_src();
18218
18218
 
18219
- // src/instance-receipts.ts
18220
- function receiptMap(attrs) {
18221
- const value = attrs["instanceReceipts"];
18222
- return value && typeof value === "object" && !Array.isArray(value) ? value : {};
18223
- }
18224
- function instanceReceipt(n, destination) {
18225
- return destination ? receiptMap(n.attrs)[destination] ?? {} : n.attrs;
18226
- }
18227
-
18228
18219
  // src/contribution-ready.ts
18229
18220
  function cosine2(a, b) {
18230
18221
  if (a.length === 0 || a.length !== b.length) return 0;
@@ -19094,8 +19085,8 @@ function stripCodebaseScope(scope) {
19094
19085
  delete s["codebase"];
19095
19086
  return s;
19096
19087
  }
19097
- function contributedWireId(n, destinationKey) {
19098
- const cloudId = instanceReceipt(n, destinationKey)["cloudNodeId"];
19088
+ function contributedWireId(n) {
19089
+ const cloudId = n.attrs["cloudNodeId"];
19099
19090
  return isMembraneSaltedId(cloudId) ? cloudId : n.id;
19100
19091
  }
19101
19092
  var WIRE_CANONICAL_ID_MIN = 6;
@@ -19239,26 +19230,10 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
19239
19230
  fileRefsSubstituted: 0,
19240
19231
  fileRefLexiconMisses: 0
19241
19232
  };
19242
- const sharedCauses = /* @__PURE__ */ new Map();
19243
- const causalQueue = store.findNodesByLabel("Problem").filter(
19244
- (n) => n.attrs["source"] !== "cloud" && n.attrs["resolvedAs"] !== PROBLEM_RESOLUTION.FALSE_POSITIVE && !ignored(n.description)
19245
- ).map((n) => n.id);
19246
- const causalSeen = new Set(causalQueue);
19247
- for (let i = 0; i < causalQueue.length; i++) {
19248
- const id = causalQueue[i];
19249
- for (const e of [...store.outEdges(id, ["CAUSED_BY"]), ...opts.sharedStore?.outEdges(id, ["CAUSED_BY"]) ?? []]) {
19250
- if (causalSeen.has(e.to)) continue;
19251
- causalSeen.add(e.to);
19252
- const cause = nodeOf(e.to);
19253
- if (!cause || cause.label !== "RootCause" || cause.attrs["source"] === "cloud" || ignored(cause.description)) continue;
19254
- sharedCauses.set(cause.id, cause);
19255
- causalQueue.push(cause.id);
19256
- }
19257
- }
19258
19233
  for (const label of INSTANCE_LABELS) {
19259
19234
  const ref = [];
19260
19235
  includedByLabel.set(label, ref);
19261
- const population = label === "RootCause" && opts.sharedStore ? [...store.findNodesByLabel(label), ...sharedCauses.values()] : store.findNodesByLabel(label);
19236
+ const population = label === "RootCause" && opts.sharedStore ? [...store.findNodesByLabel(label), ...opts.sharedStore.findNodesByLabel(label)] : store.findNodesByLabel(label);
19262
19237
  for (const n of population) {
19263
19238
  if (seen.has(n.id)) continue;
19264
19239
  if (walked.has(n.id)) continue;
@@ -19276,18 +19251,18 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
19276
19251
  composition.ignored++;
19277
19252
  continue;
19278
19253
  }
19279
- const contributedAtSeq = instanceReceipt(n, opts.destinationKey)["contributedAtSeq"];
19254
+ const contributedAtSeq = n.attrs["contributedAtSeq"];
19280
19255
  if (typeof contributedAtSeq === "number" && (n.lastReinforcedAtSeq ?? 0) <= contributedAtSeq) {
19281
19256
  composition.watermarked++;
19282
19257
  anchorSources.add(n.id);
19283
- semanticEndpoints.set(n.id, contributedWireId(n, opts.destinationKey));
19258
+ semanticEndpoints.set(n.id, contributedWireId(n));
19284
19259
  continue;
19285
19260
  }
19286
19261
  if (label === "Solution" && n.description.startsWith(AUTO_MINT_PREFIX)) {
19287
19262
  composition.autoMint++;
19288
19263
  continue;
19289
19264
  }
19290
- if (isTerminallyRefused({ ...n, attrs: instanceReceipt(n, opts.destinationKey) })) {
19265
+ if (isTerminallyRefused(n)) {
19291
19266
  composition.terminalRefused++;
19292
19267
  continue;
19293
19268
  }
@@ -19346,9 +19321,9 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
19346
19321
  }
19347
19322
  const dg = digest(targets.map(({ e, wireId }) => `${e.type}>${wireId}`).sort());
19348
19323
  const sourceNode = nodeOf(sourceId);
19349
- if ((sourceNode && instanceReceipt(sourceNode, opts.destinationKey)["anchorsContributedDigest"]) === dg) continue;
19324
+ if (sourceNode?.attrs["anchorsContributedDigest"] === dg) continue;
19350
19325
  anchorDigests[sourceId] = dg;
19351
- const wireFrom = seen.has(sourceId) || !sourceNode ? sourceId : contributedWireId(sourceNode, opts.destinationKey);
19326
+ const wireFrom = seen.has(sourceId) || !sourceNode ? sourceId : contributedWireId(sourceNode);
19352
19327
  for (const { e, t, wireId } of targets) {
19353
19328
  const reject = unshippableReason(wireId, t.label);
19354
19329
  if (reject) {
@@ -19377,7 +19352,7 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
19377
19352
  for (const sourceId of anchorSources) {
19378
19353
  const source = nodeOf(sourceId);
19379
19354
  if (!source) continue;
19380
- const wireFrom = seen.has(sourceId) ? sourceId : contributedWireId(source, opts.destinationKey);
19355
+ const wireFrom = seen.has(sourceId) ? sourceId : contributedWireId(source);
19381
19356
  const planned = [];
19382
19357
  for (const e of store.outEdges(sourceId, ["ANCHORED_AT"])) {
19383
19358
  const target = nodeOf(e.to);
@@ -19412,7 +19387,7 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
19412
19387
  const dg = digest(
19413
19388
  planned.map(({ symId, wireAttrs }) => `ANCHORED_AT>${symId}>${JSON.stringify(wireAttrs)}`).sort()
19414
19389
  );
19415
- if (instanceReceipt(source, opts.destinationKey)["projectAnchorsContributedDigest"] === dg) continue;
19390
+ if (source.attrs["projectAnchorsContributedDigest"] === dg) continue;
19416
19391
  projectAnchorDigests[sourceId] = dg;
19417
19392
  for (const { e, target, symId, wireAttrs } of planned) {
19418
19393
  if (!contextSeen.has(symId)) {
@@ -19458,7 +19433,7 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
19458
19433
  if (outs.length === 0) continue;
19459
19434
  const dg = digest(outs.map(({ e, wireTo }) => `${e.type}>${wireTo}`).sort());
19460
19435
  const owner = nodeOf(sourceId);
19461
- const digestSkip = (owner && instanceReceipt(owner, opts.destinationKey)["semanticEdgesContributedDigest"]) === dg;
19436
+ const digestSkip = owner?.attrs["semanticEdgesContributedDigest"] === dg;
19462
19437
  if (!digestSkip) semanticEdgeDigests[sourceId] = dg;
19463
19438
  for (const { e, wireTo } of outs) {
19464
19439
  if (digestSkip && !shippedById.has(e.to)) continue;
@@ -19515,7 +19490,7 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
19515
19490
  for (const wn of nodes) {
19516
19491
  if (wn.label !== "RootCause" && wn.label !== "Solution") continue;
19517
19492
  const src = nodeOf(wn.id);
19518
- if (src && typeof instanceReceipt(src, opts.destinationKey)["contributedAtSeq"] === "number") continue;
19493
+ if (typeof src?.attrs["contributedAtSeq"] === "number") continue;
19519
19494
  if (bindingEndpoints.has(wn.id)) continue;
19520
19495
  heldOrphans.add(wn.id);
19521
19496
  }
@@ -19593,7 +19568,6 @@ function buildDrainInstances(store, sharedStore, input) {
19593
19568
  ...input.includePackages !== void 0 ? { includePackages: input.includePackages } : {},
19594
19569
  workspaceRoot: input.workspaceRoot,
19595
19570
  sharedStore,
19596
- destinationKey: input.destinationKey,
19597
19571
  onComposition: (c) => {
19598
19572
  composition = c;
19599
19573
  },
package/errata.mjs CHANGED
@@ -26368,8 +26368,8 @@ var init_config = __esm({
26368
26368
  "use strict";
26369
26369
  init_paths();
26370
26370
  LEGACY_CLOUD_URL = "https://inerrata-gateway.onrender.com";
26371
- DEFAULT_CLOUD_URL = true ? "https://dev.inerrata.dev" : DEV_CLOUD_URL;
26372
- DEFAULT_UPDATE_CHANNEL = false ? "latest" : "dev";
26371
+ DEFAULT_CLOUD_URL = true ? "https://inerrata.dev" : DEV_CLOUD_URL;
26372
+ DEFAULT_UPDATE_CHANNEL = true ? "latest" : "dev";
26373
26373
  }
26374
26374
  });
26375
26375
 
@@ -29506,18 +29506,6 @@ function resolveWorkspaceIdentity(cfg, entry, env2 = process.env) {
29506
29506
  function identityKey(id) {
29507
29507
  return id.profileName ?? "@default";
29508
29508
  }
29509
- function publicWorkspaceIdentity(identity) {
29510
- return {
29511
- profileName: identity.profileName,
29512
- rule: identity.rule,
29513
- invalid: identity.invalid,
29514
- reason: identity.reason,
29515
- profile: identity.profile ? {
29516
- installationId: identity.profile.installationId,
29517
- cloudUrl: identity.profile.cloudUrl
29518
- } : null
29519
- };
29520
- }
29521
29509
  function blockedCloudClient(reason) {
29522
29510
  return new Proxy(
29523
29511
  {},
@@ -80279,7 +80267,7 @@ function createWatchBreaker(deps) {
80279
80267
  }
80280
80268
 
80281
80269
  // src/engine.ts
80282
- var DAEMON_VERSION = true ? "2.0.8-dev.2932" : "2.0.0-alpha.0";
80270
+ var DAEMON_VERSION = true ? "2.0.9" : "2.0.0-alpha.0";
80283
80271
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
80284
80272
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
80285
80273
  var GIT_OP_MUTE_MS = 4e3;
@@ -82725,40 +82713,6 @@ async function listenServer(fetchFn, port) {
82725
82713
  init_registry();
82726
82714
  init_identity2();
82727
82715
 
82728
- // src/instance-receipts.ts
82729
- import { createHash as createHash16 } from "node:crypto";
82730
- var FIELDS = ["contributedAtSeq", "cloudNodeId", "anchorsContributedDigest", "projectAnchorsContributedDigest", "semanticEdgesContributedDigest", "shipRefusedSinceSeq", "shipRefusedCount", "shipRefusedReason", "shipRefusedFingerprint"];
82731
- function instanceDestinationKey(input) {
82732
- return createHash16("sha256").update(JSON.stringify([
82733
- input.workspace,
82734
- input.cloudUrl.replace(/\/+$/, ""),
82735
- input.installationId ?? input.profileName ?? "default",
82736
- input.projectId ?? null,
82737
- input.writeTarget?.visibility ?? null,
82738
- input.writeTarget?.org_id ?? null,
82739
- input.writeTarget?.team_id ?? null
82740
- ])).digest("hex");
82741
- }
82742
- function receiptMap(attrs) {
82743
- const value = attrs["instanceReceipts"];
82744
- return value && typeof value === "object" && !Array.isArray(value) ? value : {};
82745
- }
82746
- function instanceReceipt(n, destination) {
82747
- return destination ? receiptMap(n.attrs)[destination] ?? {} : n.attrs;
82748
- }
82749
- function updateInstanceReceipt(n, destination, patch, mirrorLegacy) {
82750
- const receipt = { ...instanceReceipt(n, destination), ...patch };
82751
- const attrs = { ...n.attrs, instanceReceipts: { ...receiptMap(n.attrs), [destination]: receipt } };
82752
- if (mirrorLegacy) for (const field of FIELDS) {
82753
- if (field in receipt) attrs[field] = receipt[field];
82754
- else delete attrs[field];
82755
- }
82756
- return attrs;
82757
- }
82758
- function instanceReceiptSequence(n) {
82759
- return Math.max(n.lastReinforcedAtSeq ?? 0, n.createdAtSeq ?? 0);
82760
- }
82761
-
82762
82716
  // src/multi.ts
82763
82717
  init_dist();
82764
82718
  init_src5();
@@ -83163,8 +83117,8 @@ function compositionCounters(c) {
83163
83117
  ...Object.fromEntries(buckets.map((b) => [`sidecarDrop_${b}`, sidecarDropReasons[b] ?? 0]))
83164
83118
  };
83165
83119
  }
83166
- function contributedWireId(n, destinationKey) {
83167
- const cloudId = instanceReceipt(n, destinationKey)["cloudNodeId"];
83120
+ function contributedWireId(n) {
83121
+ const cloudId = n.attrs["cloudNodeId"];
83168
83122
  return isMembraneSaltedId(cloudId) ? cloudId : n.id;
83169
83123
  }
83170
83124
  var WIRE_CANONICAL_ID_MIN = 6;
@@ -83308,26 +83262,10 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
83308
83262
  fileRefsSubstituted: 0,
83309
83263
  fileRefLexiconMisses: 0
83310
83264
  };
83311
- const sharedCauses = /* @__PURE__ */ new Map();
83312
- const causalQueue = store.findNodesByLabel("Problem").filter(
83313
- (n) => n.attrs["source"] !== "cloud" && n.attrs["resolvedAs"] !== PROBLEM_RESOLUTION.FALSE_POSITIVE && !ignored(n.description)
83314
- ).map((n) => n.id);
83315
- const causalSeen = new Set(causalQueue);
83316
- for (let i2 = 0; i2 < causalQueue.length; i2++) {
83317
- const id = causalQueue[i2];
83318
- for (const e of [...store.outEdges(id, ["CAUSED_BY"]), ...opts.sharedStore?.outEdges(id, ["CAUSED_BY"]) ?? []]) {
83319
- if (causalSeen.has(e.to)) continue;
83320
- causalSeen.add(e.to);
83321
- const cause = nodeOf(e.to);
83322
- if (!cause || cause.label !== "RootCause" || cause.attrs["source"] === "cloud" || ignored(cause.description)) continue;
83323
- sharedCauses.set(cause.id, cause);
83324
- causalQueue.push(cause.id);
83325
- }
83326
- }
83327
83265
  for (const label of INSTANCE_LABELS) {
83328
83266
  const ref = [];
83329
83267
  includedByLabel.set(label, ref);
83330
- const population = label === "RootCause" && opts.sharedStore ? [...store.findNodesByLabel(label), ...sharedCauses.values()] : store.findNodesByLabel(label);
83268
+ const population = label === "RootCause" && opts.sharedStore ? [...store.findNodesByLabel(label), ...opts.sharedStore.findNodesByLabel(label)] : store.findNodesByLabel(label);
83331
83269
  for (const n of population) {
83332
83270
  if (seen.has(n.id)) continue;
83333
83271
  if (walked.has(n.id)) continue;
@@ -83345,18 +83283,18 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
83345
83283
  composition.ignored++;
83346
83284
  continue;
83347
83285
  }
83348
- const contributedAtSeq = instanceReceipt(n, opts.destinationKey)["contributedAtSeq"];
83286
+ const contributedAtSeq = n.attrs["contributedAtSeq"];
83349
83287
  if (typeof contributedAtSeq === "number" && (n.lastReinforcedAtSeq ?? 0) <= contributedAtSeq) {
83350
83288
  composition.watermarked++;
83351
83289
  anchorSources.add(n.id);
83352
- semanticEndpoints.set(n.id, contributedWireId(n, opts.destinationKey));
83290
+ semanticEndpoints.set(n.id, contributedWireId(n));
83353
83291
  continue;
83354
83292
  }
83355
83293
  if (label === "Solution" && n.description.startsWith(AUTO_MINT_PREFIX)) {
83356
83294
  composition.autoMint++;
83357
83295
  continue;
83358
83296
  }
83359
- if (isTerminallyRefused({ ...n, attrs: instanceReceipt(n, opts.destinationKey) })) {
83297
+ if (isTerminallyRefused(n)) {
83360
83298
  composition.terminalRefused++;
83361
83299
  continue;
83362
83300
  }
@@ -83415,9 +83353,9 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
83415
83353
  }
83416
83354
  const dg = digest(targets.map(({ e, wireId }) => `${e.type}>${wireId}`).sort());
83417
83355
  const sourceNode = nodeOf(sourceId);
83418
- if ((sourceNode && instanceReceipt(sourceNode, opts.destinationKey)["anchorsContributedDigest"]) === dg) continue;
83356
+ if (sourceNode?.attrs["anchorsContributedDigest"] === dg) continue;
83419
83357
  anchorDigests[sourceId] = dg;
83420
- const wireFrom = seen.has(sourceId) || !sourceNode ? sourceId : contributedWireId(sourceNode, opts.destinationKey);
83358
+ const wireFrom = seen.has(sourceId) || !sourceNode ? sourceId : contributedWireId(sourceNode);
83421
83359
  for (const { e, t, wireId } of targets) {
83422
83360
  const reject = unshippableReason(wireId, t.label);
83423
83361
  if (reject) {
@@ -83446,7 +83384,7 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
83446
83384
  for (const sourceId of anchorSources) {
83447
83385
  const source = nodeOf(sourceId);
83448
83386
  if (!source) continue;
83449
- const wireFrom = seen.has(sourceId) ? sourceId : contributedWireId(source, opts.destinationKey);
83387
+ const wireFrom = seen.has(sourceId) ? sourceId : contributedWireId(source);
83450
83388
  const planned = [];
83451
83389
  for (const e of store.outEdges(sourceId, ["ANCHORED_AT"])) {
83452
83390
  const target = nodeOf(e.to);
@@ -83481,7 +83419,7 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
83481
83419
  const dg = digest(
83482
83420
  planned.map(({ symId, wireAttrs }) => `ANCHORED_AT>${symId}>${JSON.stringify(wireAttrs)}`).sort()
83483
83421
  );
83484
- if (instanceReceipt(source, opts.destinationKey)["projectAnchorsContributedDigest"] === dg) continue;
83422
+ if (source.attrs["projectAnchorsContributedDigest"] === dg) continue;
83485
83423
  projectAnchorDigests[sourceId] = dg;
83486
83424
  for (const { e, target, symId, wireAttrs } of planned) {
83487
83425
  if (!contextSeen.has(symId)) {
@@ -83527,7 +83465,7 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
83527
83465
  if (outs.length === 0) continue;
83528
83466
  const dg = digest(outs.map(({ e, wireTo }) => `${e.type}>${wireTo}`).sort());
83529
83467
  const owner = nodeOf(sourceId);
83530
- const digestSkip = (owner && instanceReceipt(owner, opts.destinationKey)["semanticEdgesContributedDigest"]) === dg;
83468
+ const digestSkip = owner?.attrs["semanticEdgesContributedDigest"] === dg;
83531
83469
  if (!digestSkip) semanticEdgeDigests[sourceId] = dg;
83532
83470
  for (const { e, wireTo } of outs) {
83533
83471
  if (digestSkip && !shippedById.has(e.to)) continue;
@@ -83584,7 +83522,7 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
83584
83522
  for (const wn of nodes) {
83585
83523
  if (wn.label !== "RootCause" && wn.label !== "Solution") continue;
83586
83524
  const src = nodeOf(wn.id);
83587
- if (src && typeof instanceReceipt(src, opts.destinationKey)["contributedAtSeq"] === "number") continue;
83525
+ if (typeof src?.attrs["contributedAtSeq"] === "number") continue;
83588
83526
  if (bindingEndpoints.has(wn.id)) continue;
83589
83527
  heldOrphans.add(wn.id);
83590
83528
  }
@@ -83738,7 +83676,6 @@ function buildDrainInstances(store, sharedStore, input) {
83738
83676
  ...input.includePackages !== void 0 ? { includePackages: input.includePackages } : {},
83739
83677
  workspaceRoot: input.workspaceRoot,
83740
83678
  sharedStore,
83741
- destinationKey: input.destinationKey,
83742
83679
  onComposition: (c) => {
83743
83680
  composition = c;
83744
83681
  },
@@ -85406,7 +85343,7 @@ async function startHistoryStage(root, input, client, walk11 = {}) {
85406
85343
 
85407
85344
  // src/link-flow.ts
85408
85345
  init_cloud_auth();
85409
- import { createHash as createHash17 } from "node:crypto";
85346
+ import { createHash as createHash16 } from "node:crypto";
85410
85347
  import { execFileSync as execFileSync5 } from "node:child_process";
85411
85348
  import { existsSync as existsSync30, writeFileSync as writeFileSync23 } from "node:fs";
85412
85349
  import { join as join38 } from "node:path";
@@ -85700,7 +85637,7 @@ async function loginOAuthLoopback(opts) {
85700
85637
 
85701
85638
  // src/link-flow.ts
85702
85639
  function remoteFingerprint(locator) {
85703
- return createHash17("sha256").update(locator).digest("hex");
85640
+ return createHash16("sha256").update(locator).digest("hex");
85704
85641
  }
85705
85642
  function isDecision(value) {
85706
85643
  if (!value || typeof value !== "object") return false;
@@ -87007,17 +86944,11 @@ async function startMultiDaemon(opts = {}) {
87007
86944
  const ANCHOR_PULL_INTERVAL_MS = 10 * 60 * 1e3;
87008
86945
  const anchorPullAll = async () => {
87009
86946
  const c = loadConfig();
87010
- if (registryCorrupt()) return;
86947
+ if (!hasCloudCredential(c)) return;
86948
+ const client = cloudNow();
87011
86949
  for (const r of records) {
87012
86950
  const projectId = r.engine.profile.projectId;
87013
86951
  if (!projectId || !effectiveConsent(c, r.engine.profile).sync) continue;
87014
- const identity = identityFor(liveWorkspaceEntry(r.entry));
87015
- if (identity.invalid) {
87016
- noteIdentityBlock(r.id, r.entry.name, identity);
87017
- continue;
87018
- }
87019
- if (identity.rule !== "workspace-binding" && !hasCloudCredential(c)) continue;
87020
- const client = cloudForIdentity(identity);
87021
86952
  try {
87022
86953
  const { salt } = await resolveProjectSymbolSalt(client, projectId);
87023
86954
  await pullProjectAnchors(r, client, salt);
@@ -87031,17 +86962,11 @@ async function startMultiDaemon(opts = {}) {
87031
86962
  }, ANCHOR_PULL_INTERVAL_MS);
87032
86963
  const ambientLinkAll = async () => {
87033
86964
  const c = loadConfig();
87034
- if (registryCorrupt()) return;
86965
+ if (!hasCloudCredential(c)) return;
86966
+ const client = cloudNow();
87035
86967
  for (const r of records) {
87036
86968
  const working = loadProfile(r.root) ?? r.engine.profile;
87037
86969
  if (!effectiveConsent(c, working).sync) continue;
87038
- const identity = identityFor(liveWorkspaceEntry(r.entry));
87039
- if (identity.invalid) {
87040
- noteIdentityBlock(r.id, r.entry.name, identity);
87041
- continue;
87042
- }
87043
- if (identity.rule !== "workspace-binding" && !hasCloudCredential(c)) continue;
87044
- const client = cloudForIdentity(identity);
87045
86970
  const out2 = await ensureProjectLink(r.root, working, client);
87046
86971
  if (working !== r.engine.profile) adoptLinkFields(r.engine.profile, working);
87047
86972
  if (out2.linked) {
@@ -87429,7 +87354,6 @@ async function startMultiDaemon(opts = {}) {
87429
87354
  }
87430
87355
  const ignore2 = loadClaimIgnorePatterns(globalDir());
87431
87356
  const clientPool = /* @__PURE__ */ new Map();
87432
- const receiptContexts = /* @__PURE__ */ new Map();
87433
87357
  const poolFor = (identity) => {
87434
87358
  const k = identityKey(identity);
87435
87359
  let c = clientPool.get(k);
@@ -87572,26 +87496,7 @@ async function startMultiDaemon(opts = {}) {
87572
87496
  return res.accepted;
87573
87497
  });
87574
87498
  }
87575
- const receiptProfile = recordIdentity.profile ?? (cfg2.activeInstallationProfile ? cfg2.installationProfiles[cfg2.activeInstallationProfile] : void 0);
87576
- let receiptContext = receiptContexts.get(identityKey(recordIdentity));
87577
- if (!receiptContext) {
87578
- try {
87579
- receiptContext = await client.context();
87580
- receiptContexts.set(identityKey(recordIdentity), receiptContext);
87581
- } catch (err2) {
87582
- errors.push(`[${projectName}] instance destination unresolved: ${err2 instanceof Error ? err2.message : String(err2)}`);
87583
- continue;
87584
- }
87585
- }
87586
- const destinationKey = instanceDestinationKey({
87587
- workspace: r.id,
87588
- cloudUrl: opts.cloudUrl ?? receiptProfile?.cloudUrl ?? cfg2.cloudUrl,
87589
- installationId: receiptContext.context.installation_id ?? receiptContext.identity.credential_id,
87590
- projectId: project?.projectId,
87591
- writeTarget: project ? null : receiptContext.context.default_write_target
87592
- });
87593
87499
  const built = await buildInstanceBatch(r, {
87594
- destinationKey,
87595
87500
  profile: r.engine.profile,
87596
87501
  daemonVersion: DAEMON_VERSION,
87597
87502
  ignorePatterns: [...ignore2],
@@ -87636,6 +87541,7 @@ async function startMultiDaemon(opts = {}) {
87636
87541
  );
87637
87542
  }
87638
87543
  uploaded += res.accepted;
87544
+ const seq = store.currentIngestSeq();
87639
87545
  const cloudIdByLocal = new Map(
87640
87546
  res.result.nodes.filter((rn) => rn.nodeId).map((rn) => [rn.canonicalId, rn.nodeId])
87641
87547
  );
@@ -87644,7 +87550,6 @@ async function startMultiDaemon(opts = {}) {
87644
87550
  if (rn.decision === "rejected") rejected.set(rn.canonicalId, rn.reason ?? "no reason given");
87645
87551
  }
87646
87552
  const rejectedEdges = res.result.edges.filter((re) => re.decision === "rejected");
87647
- const edgeReceiptsComplete = rejectedEdges.length === 0 && res.result.edges.length === instances.edges.length;
87648
87553
  if (rejectedEdges.length > 0) {
87649
87554
  const byReason = /* @__PURE__ */ new Map();
87650
87555
  for (const re of rejectedEdges) {
@@ -87675,17 +87580,17 @@ async function startMultiDaemon(opts = {}) {
87675
87580
  const owner = owningStore(id);
87676
87581
  if (!owner) return;
87677
87582
  const fp = refusalFingerprint(reason, owner.n.description);
87678
- const same = instanceReceipt(owner.n, destinationKey)["shipRefusedFingerprint"] === fp;
87679
- const count = same ? Number(instanceReceipt(owner.n, destinationKey)["shipRefusedCount"] ?? 0) + 1 : 1;
87680
- if (instanceReceipt(owner.n, destinationKey)["shipRefusedSinceSeq"] !== void 0) repeat();
87583
+ const same = owner.n.attrs["shipRefusedFingerprint"] === fp;
87584
+ const count = same ? Number(owner.n.attrs["shipRefusedCount"] ?? 0) + 1 : 1;
87585
+ if (owner.n.attrs["shipRefusedSinceSeq"] !== void 0) repeat();
87681
87586
  owner.s.updateNode(id, {
87682
- attrs: updateInstanceReceipt(owner.n, destinationKey, {
87683
- ...instanceReceipt(owner.n, destinationKey),
87684
- ...same && instanceReceipt(owner.n, destinationKey)["shipRefusedSinceSeq"] !== void 0 ? {} : { shipRefusedSinceSeq: owner.s.currentIngestSeq() },
87587
+ attrs: {
87588
+ ...owner.n.attrs,
87589
+ ...same && owner.n.attrs["shipRefusedSinceSeq"] !== void 0 ? {} : { shipRefusedSinceSeq: seq },
87685
87590
  shipRefusedCount: count,
87686
87591
  shipRefusedReason: reason,
87687
87592
  shipRefusedFingerprint: fp
87688
- }, owner.s === store)
87593
+ }
87689
87594
  });
87690
87595
  if (same && count === SHIP_TERMINAL_REFUSALS && !isRetryableRefusal(reason)) {
87691
87596
  nowHeld.push({ id, reason });
@@ -87702,7 +87607,6 @@ async function startMultiDaemon(opts = {}) {
87702
87607
  const owner = owningStore(n.id);
87703
87608
  if (!owner || !["Problem", "Solution", "RootCause"].includes(owner.n.label)) return;
87704
87609
  if (blocked.has(n.id)) return;
87705
- if (!cloudIdByLocal.has(n.id)) return;
87706
87610
  if (rejected.has(n.id)) return;
87707
87611
  const cloudNodeId = cloudIdByLocal.get(n.id);
87708
87612
  const {
@@ -87711,41 +87615,37 @@ async function startMultiDaemon(opts = {}) {
87711
87615
  shipRefusedReason: _clearedReason,
87712
87616
  shipRefusedFingerprint: _clearedFp,
87713
87617
  ...carried
87714
- } = instanceReceipt(owner.n, destinationKey);
87618
+ } = owner.n.attrs;
87715
87619
  owner.s.updateNode(n.id, {
87716
- attrs: updateInstanceReceipt(owner.n, destinationKey, {
87620
+ attrs: {
87717
87621
  ...carried,
87718
- shipRefusedSinceSeq: void 0,
87719
- shipRefusedCount: void 0,
87720
- shipRefusedReason: void 0,
87721
- shipRefusedFingerprint: void 0,
87722
- contributedAtSeq: instanceReceiptSequence(n),
87723
- cloudNodeId
87724
- }, owner.s === store)
87622
+ contributedAtSeq: seq,
87623
+ ...cloudNodeId && cloudNodeId !== n.id ? { cloudNodeId } : {}
87624
+ }
87725
87625
  });
87726
87626
  });
87727
87627
  await stampBatched(Object.entries(instances.anchorDigests), ([localId, dg]) => {
87728
87628
  const owner = owningStore(localId);
87729
87629
  if (!owner) return;
87730
- if (!edgeReceiptsComplete || !instanceReceipt(owner.n, destinationKey)["cloudNodeId"] || rejected.has(localId) || blocked.has(localId)) return;
87630
+ if (rejected.has(localId) || blocked.has(localId)) return;
87731
87631
  owner.s.updateNode(localId, {
87732
- attrs: updateInstanceReceipt(owner.n, destinationKey, { anchorsContributedDigest: dg }, owner.s === store)
87632
+ attrs: { ...owner.n.attrs, anchorsContributedDigest: dg }
87733
87633
  });
87734
87634
  });
87735
87635
  await stampBatched(Object.entries(instances.projectAnchorDigests), ([localId, dg]) => {
87736
87636
  const owner = owningStore(localId);
87737
87637
  if (!owner) return;
87738
- if (!edgeReceiptsComplete || !instanceReceipt(owner.n, destinationKey)["cloudNodeId"] || rejected.has(localId) || blocked.has(localId)) return;
87638
+ if (rejected.has(localId) || blocked.has(localId)) return;
87739
87639
  owner.s.updateNode(localId, {
87740
- attrs: updateInstanceReceipt(owner.n, destinationKey, { projectAnchorsContributedDigest: dg }, owner.s === store)
87640
+ attrs: { ...owner.n.attrs, projectAnchorsContributedDigest: dg }
87741
87641
  });
87742
87642
  });
87743
87643
  await stampBatched(Object.entries(instances.semanticEdgeDigests), ([localId, dg]) => {
87744
87644
  const owner = owningStore(localId);
87745
87645
  if (!owner) return;
87746
- if (!edgeReceiptsComplete || !instanceReceipt(owner.n, destinationKey)["cloudNodeId"] || rejected.has(localId) || blocked.has(localId)) return;
87646
+ if (rejected.has(localId) || blocked.has(localId)) return;
87747
87647
  owner.s.updateNode(localId, {
87748
- attrs: updateInstanceReceipt(owner.n, destinationKey, { semanticEdgesContributedDigest: dg }, owner.s === store)
87648
+ attrs: { ...owner.n.attrs, semanticEdgesContributedDigest: dg }
87749
87649
  });
87750
87650
  });
87751
87651
  appendPassLedger(r.engine.paths.configDir, "ship", Date.now() - shipStartedAt, {
@@ -89639,7 +89539,7 @@ async function cmdWhoami(args2) {
89639
89539
  `note: daemon capture and the MCP server resolve identically; a process with ERRATA_CONFIG_PATH set resolves by rule 1 regardless of binding.`
89640
89540
  ];
89641
89541
  if (args2.includes("--json")) {
89642
- console.log(JSON.stringify({ path: path2, registered: Boolean(entry), ...publicWorkspaceIdentity(identity) }, null, 2));
89542
+ console.log(JSON.stringify({ path: path2, registered: Boolean(entry), ...identity }, null, 2));
89643
89543
  } else {
89644
89544
  for (const l of lines) console.log(l);
89645
89545
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.8-dev.2932",
3
+ "version": "2.0.9",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {