@inerrata-corporation/errata 2.0.8-dev.2870 → 2.0.8-dev.2889

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 +42 -8
  2. package/package.json +1 -1
package/errata.mjs CHANGED
@@ -79709,6 +79709,7 @@ function osaQuote(s) {
79709
79709
  return `"${s.replace(/[\\"]/g, "\\$&")}"`;
79710
79710
  }
79711
79711
  function notify(title, body2) {
79712
+ if (process.env["VITEST"] === "true" || process.env["NODE_ENV"] === "test") return;
79712
79713
  switch (process.platform) {
79713
79714
  case "darwin":
79714
79715
  run2("osascript", [
@@ -80113,7 +80114,7 @@ function createWatchBreaker(deps) {
80113
80114
  }
80114
80115
 
80115
80116
  // src/engine.ts
80116
- var DAEMON_VERSION = true ? "2.0.8-dev.2870" : "2.0.0-alpha.0";
80117
+ var DAEMON_VERSION = true ? "2.0.8-dev.2889" : "2.0.0-alpha.0";
80117
80118
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
80118
80119
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
80119
80120
  var GIT_OP_MUTE_MS = 4e3;
@@ -85806,6 +85807,27 @@ function codexWakeCandidates(input) {
85806
85807
  return out2;
85807
85808
  }
85808
85809
 
85810
+ // src/wake-policy.ts
85811
+ function wakeIndexPlan(nodeCount, reindexOnStart) {
85812
+ if (nodeCount > 0) return "catch-up";
85813
+ return reindexOnStart ? "full-index" : "skip";
85814
+ }
85815
+ var WAKE_STAGGER_MS = 2e4;
85816
+ function wakeDelay(index, staggerMs = WAKE_STAGGER_MS) {
85817
+ return Math.max(0, index) * staggerMs;
85818
+ }
85819
+ function serialQueue() {
85820
+ let chain2 = Promise.resolve();
85821
+ return (job) => {
85822
+ const run3 = chain2.then(job).then(
85823
+ () => void 0,
85824
+ () => void 0
85825
+ );
85826
+ chain2 = run3;
85827
+ return run3;
85828
+ };
85829
+ }
85830
+
85809
85831
  // src/multi.ts
85810
85832
  init_profile2();
85811
85833
 
@@ -86276,6 +86298,7 @@ async function startMultiDaemon(opts = {}) {
86276
86298
  );
86277
86299
  }
86278
86300
  const app = new Hono2();
86301
+ const enqueueWakeIndex = serialQueue();
86279
86302
  const attachWorkspace = (root) => {
86280
86303
  const norm = normPath(root);
86281
86304
  if (records.some((r) => normPath(r.root) === norm)) return { attached: false, id: null, reason: "already-watched" };
@@ -86305,8 +86328,16 @@ async function startMultiDaemon(opts = {}) {
86305
86328
  registerWorkspace(rec.engine.profile, rec.root);
86306
86329
  } catch {
86307
86330
  }
86308
- void rec.engine.reindex({ skipEmbed: true, quiet: rec.engine.store.nodeCount() > 0 }).catch(() => {
86309
- });
86331
+ if (wakeIndexPlan(rec.engine.store.nodeCount(), opts.reindexOnStart !== false) === "full-index") {
86332
+ void enqueueWakeIndex(async () => {
86333
+ const done = markPass(`wake-index:${rec.entry.name}`);
86334
+ try {
86335
+ await rec.engine.reindex({ skipEmbed: true });
86336
+ } finally {
86337
+ done();
86338
+ }
86339
+ });
86340
+ }
86310
86341
  console.log(`[errata] hot-registered ${rec.entry.name} (${rec.id}) \u2014 now watching live`);
86311
86342
  return { attached: true, id: rec.id };
86312
86343
  };
@@ -86582,11 +86613,14 @@ async function startMultiDaemon(opts = {}) {
86582
86613
  sinceMs: Date.now() - lookback,
86583
86614
  disabled: process.env["ERRATA_CODEX_WAKE_DISABLE"] === "1"
86584
86615
  });
86585
- for (const c of candidates) {
86586
- if (attachWorkspace(c.path).attached) {
86587
- console.log(`[errata] woke workspace ${c.name} \u2014 recent Codex/Gemini/OpenCode transcript (headless capture)`);
86588
- }
86589
- }
86616
+ candidates.forEach((c, i2) => {
86617
+ const wake = setTimeout(() => {
86618
+ if (attachWorkspace(c.path).attached) {
86619
+ console.log(`[errata] woke workspace ${c.name} \u2014 recent Codex/Gemini/OpenCode transcript (headless capture)`);
86620
+ }
86621
+ }, wakeDelay(i2));
86622
+ wake.unref?.();
86623
+ });
86590
86624
  };
86591
86625
  const codexWake = setInterval(sweepCodexWake, WORKSPACE_SWEEP_INTERVAL_MS);
86592
86626
  codexWake.unref?.();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.8-dev.2870",
3
+ "version": "2.0.8-dev.2889",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {