@inerrata-corporation/errata 2.0.6-dev.2330 → 2.0.6-dev.2494

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.
package/errata.mjs CHANGED
@@ -15858,7 +15858,7 @@ var init_wire = __esm({
15858
15858
  /** Org-membrane (M2): the daemon's anchor tag — it owns the lockfile, so it
15859
15859
  * knows which packages are private. The door does NOT trust a `public` claim
15860
15860
  * blindly (it re-confirms on the spine); absent ⇒ unknown ⇒ fail-closed to
15861
- * org-private. Accepted-but-ignored until ORG_MEMBRANE_ENABLED flips. */
15861
+ * org-private. Ignored only where ORG_MEMBRANE_ENABLED=false (default ON). */
15862
15862
  anchorVisibility: external_exports.enum(["public", "private"]).optional(),
15863
15863
  /** The spine-resolvable anchor id backing a `public` tag (OM-anchor-tag): a
15864
15864
  * Package purl or `languageCanonicalId`. The door validates THIS on the
@@ -78124,7 +78124,7 @@ function createWatchBreaker(deps) {
78124
78124
  }
78125
78125
 
78126
78126
  // src/engine.ts
78127
- var DAEMON_VERSION = true ? "2.0.6-dev.2330" : "2.0.0-alpha.0";
78127
+ var DAEMON_VERSION = true ? "2.0.6-dev.2494" : "2.0.0-alpha.0";
78128
78128
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
78129
78129
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
78130
78130
  var GIT_OP_MUTE_MS = 4e3;
@@ -80960,7 +80960,7 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
80960
80960
  return key ? { originSession: key } : {};
80961
80961
  };
80962
80962
  const symbolIndex = opts.workspaceRoot ? publicSymbolIndex(store, opts.workspaceRoot) : null;
80963
- const ownLexicon = buildSymbolLexicon(store);
80963
+ const ownLexicon = opts.lexicon ?? buildSymbolLexicon(store);
80964
80964
  const projectIdentity = {
80965
80965
  ...profile.name ? { name: profile.name } : {},
80966
80966
  ...profile.repoLocator ? { repoLocator: profile.repoLocator } : {},
@@ -81348,8 +81348,40 @@ function buildCausalEdgeBackfill(store, profile, daemonVersion) {
81348
81348
  return { ...base, payloadDigest: digest(base) };
81349
81349
  }
81350
81350
 
81351
- // src/multi.ts
81351
+ // src/drain-build.ts
81352
81352
  init_generalize_graph();
81353
+ function buildDrainContext(store, input) {
81354
+ return buildContextIngest(store, input.profile, input.daemonVersion, input.ignorePatterns, {
81355
+ ...input.includePackages !== void 0 ? { includePackages: input.includePackages } : {}
81356
+ });
81357
+ }
81358
+ function buildDrainInstances(store, sharedStore, input) {
81359
+ let lexicon;
81360
+ let lexiconError;
81361
+ try {
81362
+ lexicon = buildSymbolLexicon(store);
81363
+ } catch (err2) {
81364
+ lexiconError = err2 instanceof Error ? err2.message : String(err2);
81365
+ }
81366
+ let composition = null;
81367
+ const batch = buildInstanceIngest(store, input.profile, input.daemonVersion, input.ignorePatterns, {
81368
+ ...input.includePackages !== void 0 ? { includePackages: input.includePackages } : {},
81369
+ workspaceRoot: input.workspaceRoot,
81370
+ sharedStore,
81371
+ onComposition: (c) => {
81372
+ composition = c;
81373
+ },
81374
+ ...lexicon ? { lexicon } : {},
81375
+ ...input.project ? { project: input.project } : {}
81376
+ });
81377
+ return {
81378
+ batch,
81379
+ composition: composition ?? batch?.composition ?? null,
81380
+ ...lexiconError ? { lexiconError } : {}
81381
+ };
81382
+ }
81383
+
81384
+ // src/multi.ts
81353
81385
  init_webui();
81354
81386
 
81355
81387
  // src/consolidate-worker-client.ts
@@ -84403,6 +84435,15 @@ async function resolveProjectSymbolSalt(client, projectId) {
84403
84435
  projectSymbolSalts.set(projectId, salt);
84404
84436
  return { projectId, salt };
84405
84437
  }
84438
+ var WATERMARK_BATCH = 250;
84439
+ async function stampBatched(items, stamp) {
84440
+ let i2 = 0;
84441
+ for (const item of items) {
84442
+ if (i2 > 0 && i2 % WATERMARK_BATCH === 0) await new Promise((r) => setImmediate(r));
84443
+ i2++;
84444
+ stamp(item);
84445
+ }
84446
+ }
84406
84447
  function normPath(p) {
84407
84448
  return p.replace(/\\/g, "/").replace(/\/+$/, "").toLowerCase();
84408
84449
  }
@@ -85507,6 +85548,53 @@ async function startMultiDaemon(opts = {}) {
85507
85548
  };
85508
85549
  let uploaded = 0;
85509
85550
  const errors = [];
85551
+ const workerFor = (r) => consolidateWorker && r.engine.paths.castalia !== ":memory:" ? consolidateWorker : null;
85552
+ const buildContextBatch = async (r, input) => {
85553
+ const w = workerFor(r);
85554
+ if (w) {
85555
+ try {
85556
+ return await w.run({
85557
+ kind: "drainContext",
85558
+ sharedDbPath,
85559
+ castaliaPath: r.engine.paths.castalia,
85560
+ drain: input
85561
+ });
85562
+ } catch (err2) {
85563
+ console.warn(
85564
+ `[errata] drain context-build worker failed \u2014 running inline: ${err2 instanceof Error ? err2.message : err2}`
85565
+ );
85566
+ }
85567
+ }
85568
+ const done = markPass(`drain-context-build-inline:${r.entry.name}`);
85569
+ try {
85570
+ return buildDrainContext(r.engine.store, input);
85571
+ } finally {
85572
+ done();
85573
+ }
85574
+ };
85575
+ const buildInstanceBatch = async (r, input) => {
85576
+ const w = workerFor(r);
85577
+ if (w) {
85578
+ try {
85579
+ return await w.run({
85580
+ kind: "drainInstances",
85581
+ sharedDbPath,
85582
+ castaliaPath: r.engine.paths.castalia,
85583
+ drain: input
85584
+ });
85585
+ } catch (err2) {
85586
+ console.warn(
85587
+ `[errata] drain instance-build worker failed \u2014 running inline: ${err2 instanceof Error ? err2.message : err2}`
85588
+ );
85589
+ }
85590
+ }
85591
+ const done = markPass(`drain-instance-build-inline:${r.entry.name}`);
85592
+ try {
85593
+ return buildDrainInstances(r.engine.store, sharedStore, input);
85594
+ } finally {
85595
+ done();
85596
+ }
85597
+ };
85510
85598
  const lane = async (name2, projectName, run3) => {
85511
85599
  try {
85512
85600
  await run3();
@@ -85548,7 +85636,10 @@ async function startMultiDaemon(opts = {}) {
85548
85636
  }
85549
85637
  }
85550
85638
  clearProjectHold(r.id);
85551
- const context = buildContextIngest(store, r.engine.profile, DAEMON_VERSION, ignore2, {
85639
+ const context = await buildContextBatch(r, {
85640
+ profile: r.engine.profile,
85641
+ daemonVersion: DAEMON_VERSION,
85642
+ ignorePatterns: [...ignore2],
85552
85643
  includePackages: cfg2.consent.contributePackages
85553
85644
  });
85554
85645
  if (context) {
@@ -85556,12 +85647,14 @@ async function startMultiDaemon(opts = {}) {
85556
85647
  const res = await client.ingest(context, {
85557
85648
  onChunk: (p) => {
85558
85649
  const seq = store.currentIngestSeq();
85559
- for (const wireId of p.nodeIds) {
85560
- const localId = context.localIdByWireId[wireId] ?? wireId;
85561
- const local = store.getNode(localId);
85562
- if (!local) continue;
85563
- store.updateNode(localId, { attrs: { ...local.attrs, contributedAtSeq: seq } });
85564
- }
85650
+ store.transaction(() => {
85651
+ for (const wireId of p.nodeIds) {
85652
+ const localId = context.localIdByWireId[wireId] ?? wireId;
85653
+ const local = store.getNode(localId);
85654
+ if (!local) continue;
85655
+ store.updateNode(localId, { attrs: { ...local.attrs, contributedAtSeq: seq } });
85656
+ }
85657
+ });
85565
85658
  if (p.blockedNodeIds?.length) {
85566
85659
  console.log(
85567
85660
  `[sync\u2192cloud] [${projectName}] context: ${p.blockedNodeIds.length} node(s) refused by an edge/CDN filter on content \u2014 left pending, will retry`
@@ -85574,25 +85667,21 @@ async function startMultiDaemon(opts = {}) {
85574
85667
  return res.accepted;
85575
85668
  });
85576
85669
  }
85577
- let lexicon;
85578
- let lexiconError;
85579
- try {
85580
- lexicon = buildSymbolLexicon(store);
85581
- } catch (err2) {
85582
- lexiconError = err2 instanceof Error ? err2.message : String(err2);
85583
- console.warn(`[errata] symbol sidecar DISABLED for ${r.entry.name}: lexicon build failed \u2014 ${lexiconError}`);
85584
- }
85585
- let composition = null;
85586
- const instances = buildInstanceIngest(store, r.engine.profile, DAEMON_VERSION, ignore2, {
85670
+ const built = await buildInstanceBatch(r, {
85671
+ profile: r.engine.profile,
85672
+ daemonVersion: DAEMON_VERSION,
85673
+ ignorePatterns: [...ignore2],
85587
85674
  includePackages: cfg2.consent.contributePackages,
85588
85675
  workspaceRoot: r.root,
85589
- sharedStore,
85590
- onComposition: (c) => {
85591
- composition = c;
85592
- },
85593
- ...lexicon ? { lexicon } : {},
85594
85676
  ...project ? { project } : {}
85595
85677
  });
85678
+ if (built.lexiconError) {
85679
+ console.warn(
85680
+ `[errata] symbol sidecar DISABLED for ${r.entry.name}: lexicon build failed \u2014 ${built.lexiconError}`
85681
+ );
85682
+ }
85683
+ const composition = built.composition;
85684
+ const instances = built.batch;
85596
85685
  if (!instances && composition) {
85597
85686
  appendPassLedger(r.engine.paths.configDir, "ship", 0, {
85598
85687
  ...compositionCounters(composition),
@@ -85685,11 +85774,11 @@ async function startMultiDaemon(opts = {}) {
85685
85774
  `[sync\u2192cloud] [${projectName}] instances: HOLDING ${nowHeld.length} node(s) \u2014 refused identically ${SHIP_TERMINAL_REFUSALS}\xD7 on unchanged text; not re-sent until the text changes: ` + nowHeld.map(({ id, reason }) => `${id} "${owningStore(id)?.n.description.slice(0, 60) ?? ""}": ${reason}`).join(" | ")
85686
85775
  );
85687
85776
  }
85688
- for (const n of instances.nodes) {
85777
+ await stampBatched(instances.nodes, (n) => {
85689
85778
  const owner = owningStore(n.id);
85690
- if (!owner || !["Problem", "Solution", "RootCause"].includes(owner.n.label)) continue;
85691
- if (blocked.has(n.id)) continue;
85692
- if (rejected.has(n.id)) continue;
85779
+ if (!owner || !["Problem", "Solution", "RootCause"].includes(owner.n.label)) return;
85780
+ if (blocked.has(n.id)) return;
85781
+ if (rejected.has(n.id)) return;
85693
85782
  const cloudNodeId = cloudIdByLocal.get(n.id);
85694
85783
  const {
85695
85784
  shipRefusedSinceSeq: _clearedSeq,
@@ -85705,31 +85794,31 @@ async function startMultiDaemon(opts = {}) {
85705
85794
  ...cloudNodeId && cloudNodeId !== n.id ? { cloudNodeId } : {}
85706
85795
  }
85707
85796
  });
85708
- }
85709
- for (const [localId, dg] of Object.entries(instances.anchorDigests)) {
85797
+ });
85798
+ await stampBatched(Object.entries(instances.anchorDigests), ([localId, dg]) => {
85710
85799
  const owner = owningStore(localId);
85711
- if (!owner) continue;
85712
- if (rejected.has(localId) || blocked.has(localId)) continue;
85800
+ if (!owner) return;
85801
+ if (rejected.has(localId) || blocked.has(localId)) return;
85713
85802
  owner.s.updateNode(localId, {
85714
85803
  attrs: { ...owner.n.attrs, anchorsContributedDigest: dg }
85715
85804
  });
85716
- }
85717
- for (const [localId, dg] of Object.entries(instances.projectAnchorDigests)) {
85805
+ });
85806
+ await stampBatched(Object.entries(instances.projectAnchorDigests), ([localId, dg]) => {
85718
85807
  const owner = owningStore(localId);
85719
- if (!owner) continue;
85720
- if (rejected.has(localId) || blocked.has(localId)) continue;
85808
+ if (!owner) return;
85809
+ if (rejected.has(localId) || blocked.has(localId)) return;
85721
85810
  owner.s.updateNode(localId, {
85722
85811
  attrs: { ...owner.n.attrs, projectAnchorsContributedDigest: dg }
85723
85812
  });
85724
- }
85725
- for (const [localId, dg] of Object.entries(instances.semanticEdgeDigests)) {
85813
+ });
85814
+ await stampBatched(Object.entries(instances.semanticEdgeDigests), ([localId, dg]) => {
85726
85815
  const owner = owningStore(localId);
85727
- if (!owner) continue;
85728
- if (rejected.has(localId) || blocked.has(localId)) continue;
85816
+ if (!owner) return;
85817
+ if (rejected.has(localId) || blocked.has(localId)) return;
85729
85818
  owner.s.updateNode(localId, {
85730
85819
  attrs: { ...owner.n.attrs, semanticEdgesContributedDigest: dg }
85731
85820
  });
85732
- }
85821
+ });
85733
85822
  appendPassLedger(r.engine.paths.configDir, "ship", Date.now() - shipStartedAt, {
85734
85823
  ...compositionCounters(instances.composition),
85735
85824
  accepted: res.accepted,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.6-dev.2330",
3
+ "version": "2.0.6-dev.2494",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {
package/pass-worker.mjs CHANGED
@@ -15228,7 +15228,7 @@ var init_wire = __esm({
15228
15228
  /** Org-membrane (M2): the daemon's anchor tag — it owns the lockfile, so it
15229
15229
  * knows which packages are private. The door does NOT trust a `public` claim
15230
15230
  * blindly (it re-confirms on the spine); absent ⇒ unknown ⇒ fail-closed to
15231
- * org-private. Accepted-but-ignored until ORG_MEMBRANE_ENABLED flips. */
15231
+ * org-private. Ignored only where ORG_MEMBRANE_ENABLED=false (default ON). */
15232
15232
  anchorVisibility: external_exports.enum(["public", "private"]).optional(),
15233
15233
  /** The spine-resolvable anchor id backing a `public` tag (OM-anchor-tag): a
15234
15234
  * Package purl or `languageCanonicalId`. The door validates THIS on the