@inerrata-corporation/errata 2.0.8-dev.2881 → 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 +41 -8
  2. package/package.json +1 -1
package/errata.mjs CHANGED
@@ -80114,7 +80114,7 @@ function createWatchBreaker(deps) {
80114
80114
  }
80115
80115
 
80116
80116
  // src/engine.ts
80117
- var DAEMON_VERSION = true ? "2.0.8-dev.2881" : "2.0.0-alpha.0";
80117
+ var DAEMON_VERSION = true ? "2.0.8-dev.2889" : "2.0.0-alpha.0";
80118
80118
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
80119
80119
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
80120
80120
  var GIT_OP_MUTE_MS = 4e3;
@@ -85807,6 +85807,27 @@ function codexWakeCandidates(input) {
85807
85807
  return out2;
85808
85808
  }
85809
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
+
85810
85831
  // src/multi.ts
85811
85832
  init_profile2();
85812
85833
 
@@ -86277,6 +86298,7 @@ async function startMultiDaemon(opts = {}) {
86277
86298
  );
86278
86299
  }
86279
86300
  const app = new Hono2();
86301
+ const enqueueWakeIndex = serialQueue();
86280
86302
  const attachWorkspace = (root) => {
86281
86303
  const norm = normPath(root);
86282
86304
  if (records.some((r) => normPath(r.root) === norm)) return { attached: false, id: null, reason: "already-watched" };
@@ -86306,8 +86328,16 @@ async function startMultiDaemon(opts = {}) {
86306
86328
  registerWorkspace(rec.engine.profile, rec.root);
86307
86329
  } catch {
86308
86330
  }
86309
- void rec.engine.reindex({ skipEmbed: true, quiet: rec.engine.store.nodeCount() > 0 }).catch(() => {
86310
- });
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
+ }
86311
86341
  console.log(`[errata] hot-registered ${rec.entry.name} (${rec.id}) \u2014 now watching live`);
86312
86342
  return { attached: true, id: rec.id };
86313
86343
  };
@@ -86583,11 +86613,14 @@ async function startMultiDaemon(opts = {}) {
86583
86613
  sinceMs: Date.now() - lookback,
86584
86614
  disabled: process.env["ERRATA_CODEX_WAKE_DISABLE"] === "1"
86585
86615
  });
86586
- for (const c of candidates) {
86587
- if (attachWorkspace(c.path).attached) {
86588
- console.log(`[errata] woke workspace ${c.name} \u2014 recent Codex/Gemini/OpenCode transcript (headless capture)`);
86589
- }
86590
- }
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
+ });
86591
86624
  };
86592
86625
  const codexWake = setInterval(sweepCodexWake, WORKSPACE_SWEEP_INTERVAL_MS);
86593
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.2881",
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": {