@inerrata-corporation/errata 2.0.2-dev.73 → 2.0.2-dev.79

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 -6
  2. package/package.json +1 -1
package/errata.mjs CHANGED
@@ -51681,7 +51681,7 @@ function startLoopLagMonitor(thresholdMs = 1e3) {
51681
51681
  }
51682
51682
 
51683
51683
  // src/engine.ts
51684
- var DAEMON_VERSION = true ? "2.0.2-dev.73" : "2.0.0-alpha.0";
51684
+ var DAEMON_VERSION = true ? "2.0.2-dev.79" : "2.0.0-alpha.0";
51685
51685
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
51686
51686
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
51687
51687
  var GIT_OP_MUTE_MS = 4e3;
@@ -53394,6 +53394,10 @@ function wireContextId(n) {
53394
53394
  }
53395
53395
  return n.id;
53396
53396
  }
53397
+ function langAnchor(t) {
53398
+ const name2 = String(t.attrs["name"] ?? "").trim() || t.description.trim() || t.id.replace(/^lang:/, "").trim();
53399
+ return name2 ? `lang:${name2.toLowerCase()}` : void 0;
53400
+ }
53397
53401
  function shareableContext(n, wireId) {
53398
53402
  const attrs = n.label === "Package" ? {
53399
53403
  // No `version` attr: the purl encodes it, and the door's temporal
@@ -53408,7 +53412,8 @@ function shareableContext(n, wireId) {
53408
53412
  id: wireId,
53409
53413
  embedding: [],
53410
53414
  attrs,
53411
- ...n.label === "Package" || n.label === "Language" ? { anchorVisibility: "public" } : {}
53415
+ ...n.label === "Package" ? { anchorVisibility: "public" } : {},
53416
+ ...n.label === "Language" && langAnchor(n) ? { anchorVisibility: "public", anchor: langAnchor(n) } : {}
53412
53417
  };
53413
53418
  }
53414
53419
  function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [], opts = {}) {
@@ -53476,8 +53481,8 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
53476
53481
  if (targets.length === 0) continue;
53477
53482
  const shipped = shippedById.get(sourceId);
53478
53483
  if (shipped) {
53479
- const pick2 = (label) => targets.filter((x) => x.t.label === label).map((x) => x.wireId).sort()[0];
53480
- const anchor = pick2("Package") ?? pick2("Language");
53484
+ const anchors = (label) => targets.filter((x) => x.t.label === label).map((x) => label === "Language" ? langAnchor(x.t) : x.wireId).filter((a) => a != null).sort();
53485
+ const anchor = anchors("Package")[0] ?? anchors("Language")[0];
53481
53486
  if (anchor) {
53482
53487
  shipped.anchorVisibility = "public";
53483
53488
  shipped.anchor = anchor;
@@ -53496,6 +53501,15 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
53496
53501
  contextNodes.push(shareableContext(t, wireId));
53497
53502
  }
53498
53503
  }
53504
+ const primaryLang = (profile.languages ?? []).map((l) => String(l).trim().toLowerCase()).filter(Boolean)[0];
53505
+ if (primaryLang) {
53506
+ for (const shipped of shippedById.values()) {
53507
+ if (!shipped.anchorVisibility) {
53508
+ shipped.anchorVisibility = "public";
53509
+ shipped.anchor = `lang:${primaryLang}`;
53510
+ }
53511
+ }
53512
+ }
53499
53513
  const project = opts.project;
53500
53514
  if (project) {
53501
53515
  const now = Date.now();
@@ -54813,6 +54827,8 @@ async function startMultiDaemon(opts = {}) {
54813
54827
  }
54814
54828
  };
54815
54829
  app.post("/api/sync", async (c) => {
54830
+ if (boundaryFlushing) return c.json({ skipped: "in-flight" }, 409);
54831
+ boundaryFlushing = true;
54816
54832
  try {
54817
54833
  const principles = await daemon.syncPrinciplesPublic();
54818
54834
  const triage = await daemon.syncTriagePublic();
@@ -54821,6 +54837,8 @@ async function startMultiDaemon(opts = {}) {
54821
54837
  return c.json({ principles, triage, instances, edgeBackfill });
54822
54838
  } catch (err2) {
54823
54839
  return c.json({ error: err2 instanceof Error ? err2.message : String(err2) }, 500);
54840
+ } finally {
54841
+ boundaryFlushing = false;
54824
54842
  }
54825
54843
  });
54826
54844
  app.post("/api/tick", async (c) => {
@@ -57644,8 +57662,12 @@ async function cmdSync(arg) {
57644
57662
  try {
57645
57663
  const res = await fetch(`${lock.webUiUrl}/api/sync`, {
57646
57664
  method: "POST",
57647
- signal: AbortSignal.timeout(3e4)
57665
+ signal: AbortSignal.timeout(15 * 6e4)
57648
57666
  });
57667
+ if (res.status === 409) {
57668
+ console.log("sync already running: the daemon is mid-drain \u2014 it will finish on its own. Nothing new was started.");
57669
+ return;
57670
+ }
57649
57671
  if (!res.ok) {
57650
57672
  const detail = await res.text().catch(() => "");
57651
57673
  console.error(`sync failed: daemon at ${lock.webUiUrl} returned ${res.status}${detail ? ` \u2014 ${detail}` : ""}`);
@@ -57656,7 +57678,7 @@ async function cmdSync(arg) {
57656
57678
  } catch (err2) {
57657
57679
  const timedOut = err2 instanceof Error && err2.name === "TimeoutError";
57658
57680
  console.error(
57659
- timedOut ? `sync failed: the running daemon at ${lock.webUiUrl} didn't respond within 30s \u2014 it may be mid-reindex. Retry shortly.` : `sync failed: could not reach the running daemon at ${lock.webUiUrl} (${err2 instanceof Error ? err2.message : err2})`
57681
+ timedOut ? `sync gave up waiting after 15 min \u2014 the daemon's pass may STILL be running (aborting this request does not cancel it). Check daemon.log before retrying; a retry while it runs answers 409.` : `sync failed: could not reach the running daemon at ${lock.webUiUrl} (${err2 instanceof Error ? err2.message : err2})`
57660
57682
  );
57661
57683
  process.exit(1);
57662
57684
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.2-dev.73",
3
+ "version": "2.0.2-dev.79",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {