@inerrata-corporation/errata 2.0.3-dev.1792 → 2.0.3-dev.1793

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 +33 -8
  2. package/package.json +1 -1
package/errata.mjs CHANGED
@@ -57560,7 +57560,14 @@ var census = {
57560
57560
  since: Date.now(),
57561
57561
  breakerRecycles: 0,
57562
57562
  breakerQuarantined: [],
57563
- topOffender: null
57563
+ topOffender: null,
57564
+ liveWatchers: 0
57565
+ };
57566
+ var noteWatcherOpened = () => {
57567
+ census.liveWatchers = (census.liveWatchers ?? 0) + 1;
57568
+ };
57569
+ var noteWatcherClosed = () => {
57570
+ census.liveWatchers = Math.max(0, (census.liveWatchers ?? 0) - 1);
57564
57571
  };
57565
57572
  var QUARANTINE_LIST_CAP = 8;
57566
57573
  var noteWatchDispatched = () => void census.dispatched++;
@@ -57579,19 +57586,33 @@ var noteWindowOffender = (path2, count, windowMs) => {
57579
57586
  function watchCensus() {
57580
57587
  return { ...census };
57581
57588
  }
57582
- function watchCensusLine(c = watchCensus()) {
57589
+ var WATCH_STORM_RATE_PER_SEC = 20;
57590
+ function ago(ms) {
57591
+ const s = Math.max(0, Math.round(ms / 1e3));
57592
+ if (s < 60) return `${s}s ago`;
57593
+ const m = Math.round(s / 60);
57594
+ if (m < 60) return `${m}m ago`;
57595
+ return `${Math.floor(m / 60)}h ${m % 60}m ago`;
57596
+ }
57597
+ function watchCensusLine(c = watchCensus(), now = Date.now()) {
57583
57598
  if (c.dispatched === 0 && c.emitted === 0) return null;
57584
- const mins = Math.max(1, Math.round((Date.now() - c.since) / 6e4));
57585
- const perMin = Math.round(c.dispatched / mins);
57599
+ const elapsedSec = Math.max(1, (now - c.since) / 1e3);
57600
+ const perMin = Math.round(c.dispatched / Math.max(1, elapsedSec / 60));
57586
57601
  let base = `${c.dispatched} OS event(s) \u2192 ${c.logged} logged (${perMin}/min, ${c.rejected} rejected here)`;
57587
57602
  if (c.breakerRecycles > 0 || c.breakerQuarantined.length > 0) {
57588
57603
  const q = c.breakerQuarantined.length > 0 ? `, ${c.breakerQuarantined.length} quarantined` : "";
57589
57604
  base += ` \xB7 breaker: ${c.breakerRecycles} recycled${q}`;
57590
57605
  }
57591
- if (c.dispatched > 500 && c.dispatched / Math.max(c.logged, 1) > 1e4) {
57592
- const top = c.topOffender ? ` \u2014 top: ${c.topOffender.path} (${c.topOffender.count}/${Math.round(c.topOffender.windowMs / 1e3)}s)` : "";
57606
+ const top = c.topOffender ? ` \u2014 top: ${c.topOffender.path} (${c.topOffender.count}/${Math.round(c.topOffender.windowMs / 1e3)}s, ${ago(now - c.topOffender.at)})` : "";
57607
+ const cold = c.liveWatchers === 0;
57608
+ if (cold) return `${base} \xB7 no live watcher (all workspaces cold; lifetime totals of retired engines)${top}`;
57609
+ const noOutput = c.dispatched > 500 && c.dispatched / Math.max(c.logged, 1) > 1e4;
57610
+ if (noOutput && c.dispatched / elapsedSec >= WATCH_STORM_RATE_PER_SEC) {
57593
57611
  return `${base} \u26A0 watcher is doing work with NO output \u2014 a watch target likely contains an ignored tree${top}`;
57594
57612
  }
57613
+ if (noOutput) {
57614
+ return `${base} \xB7 no-output dispatch at a low rate = last-access echo of bulk reads (harmless)${top}`;
57615
+ }
57595
57616
  return base;
57596
57617
  }
57597
57618
 
@@ -57762,7 +57783,7 @@ function createWatchBreaker(deps) {
57762
57783
  }
57763
57784
 
57764
57785
  // src/engine.ts
57765
- var DAEMON_VERSION = true ? "2.0.3-dev.1792" : "2.0.0-alpha.0";
57786
+ var DAEMON_VERSION = true ? "2.0.3-dev.1793" : "2.0.0-alpha.0";
57766
57787
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
57767
57788
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
57768
57789
  var GIT_OP_MUTE_MS = 4e3;
@@ -57907,6 +57928,7 @@ function createWorkspaceEngine(opts) {
57907
57928
  ignoreInitial: true,
57908
57929
  persistent: true
57909
57930
  });
57931
+ noteWatcherOpened();
57910
57932
  watchBreaker = createWatchBreaker({
57911
57933
  unwatch: (p) => void watcher?.unwatch(p),
57912
57934
  readd: (p) => void watcher?.add(p),
@@ -59975,7 +59997,10 @@ B: ${b}`,
59975
59997
  if (stopGit) stopGit();
59976
59998
  if (passWorker) await passWorker.stop();
59977
59999
  if (watchBreaker) watchBreaker.stop();
59978
- if (watcher) await watcher.close();
60000
+ if (watcher) {
60001
+ await watcher.close();
60002
+ noteWatcherClosed();
60003
+ }
59979
60004
  if (flushTimer) clearTimeout(flushTimer);
59980
60005
  for (const tmr of diagTimers.values()) clearTimeout(tmr);
59981
60006
  diagTimers.clear();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.3-dev.1792",
3
+ "version": "2.0.3-dev.1793",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {