@inerrata-corporation/errata 2.0.10 → 2.0.11

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 +24 -6
  2. package/package.json +1 -1
package/errata.mjs CHANGED
@@ -74590,6 +74590,7 @@ function readCodexRolloutCwd(path2) {
74590
74590
  }
74591
74591
  }
74592
74592
  }
74593
+ var codexRolloutActivity = /* @__PURE__ */ new Map();
74593
74594
  function codexRolloutsForCwd(cwd, opts = {}) {
74594
74595
  const sinceMs = opts.sinceMs ?? 0;
74595
74596
  const limit = opts.limit ?? 25;
@@ -74597,7 +74598,14 @@ function codexRolloutsForCwd(cwd, opts = {}) {
74597
74598
  const owner = checkoutRootOf(cwd);
74598
74599
  const owners = /* @__PURE__ */ new Map();
74599
74600
  for (const root of codexSessionRoots(opts.env, opts.home)) {
74600
- if (!existsSync16(root)) continue;
74601
+ if (!existsSync16(root)) {
74602
+ codexRolloutActivity.delete(root);
74603
+ continue;
74604
+ }
74605
+ const activity = codexRolloutActivity.get(root) ?? /* @__PURE__ */ new Map();
74606
+ codexRolloutActivity.set(root, activity);
74607
+ const observed = /* @__PURE__ */ new Set();
74608
+ const scannedAt = Date.now();
74601
74609
  const stack = [{ dir: root, depth: 0 }];
74602
74610
  while (stack.length > 0) {
74603
74611
  const { dir, depth } = stack.pop();
@@ -74621,7 +74629,15 @@ function codexRolloutsForCwd(cwd, opts = {}) {
74621
74629
  }
74622
74630
  if (depth < 3) continue;
74623
74631
  if (!name2.startsWith("rollout-") || !name2.endsWith(".jsonl")) continue;
74624
- if (st.mtimeMs < sinceMs) continue;
74632
+ observed.add(full);
74633
+ const previous = activity.get(full);
74634
+ const activityAtMs = Math.max(
74635
+ st.mtimeMs,
74636
+ previous?.activeAt ?? 0,
74637
+ previous && previous.size !== st.size ? scannedAt : 0
74638
+ );
74639
+ activity.set(full, { size: st.size, activeAt: activityAtMs });
74640
+ if (activityAtMs < sinceMs) continue;
74625
74641
  const sessionCwd = readCodexRolloutCwd(full);
74626
74642
  if (sessionCwd === null) continue;
74627
74643
  let sessionOwner = owners.get(sessionCwd);
@@ -74630,11 +74646,12 @@ function codexRolloutsForCwd(cwd, opts = {}) {
74630
74646
  owners.set(sessionCwd, sessionOwner);
74631
74647
  }
74632
74648
  if (sessionOwner !== owner) continue;
74633
- out2.push({ path: full, sessionId: `codex:${basename5(name2, ".jsonl")}`, mtimeMs: st.mtimeMs });
74649
+ out2.push({ path: full, sessionId: `codex:${basename5(name2, ".jsonl")}`, mtimeMs: st.mtimeMs, activityAtMs });
74634
74650
  }
74635
74651
  }
74652
+ for (const path2 of activity.keys()) if (!observed.has(path2)) activity.delete(path2);
74636
74653
  }
74637
- out2.sort((a, b) => b.mtimeMs - a.mtimeMs);
74654
+ out2.sort((a, b) => (b.activityAtMs ?? b.mtimeMs) - (a.activityAtMs ?? a.mtimeMs));
74638
74655
  return out2.slice(0, limit);
74639
74656
  }
74640
74657
  function geminiSessionRoots(env2 = process.env, home = homedir4()) {
@@ -80321,7 +80338,7 @@ function createWatchBreaker(deps) {
80321
80338
  }
80322
80339
 
80323
80340
  // src/engine.ts
80324
- var DAEMON_VERSION = true ? "2.0.10" : "2.0.0-alpha.0";
80341
+ var DAEMON_VERSION = true ? "2.0.11" : "2.0.0-alpha.0";
80325
80342
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
80326
80343
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
80327
80344
  var GIT_OP_MUTE_MS = 4e3;
@@ -82179,6 +82196,7 @@ function createWorkspaceEngine(opts) {
82179
82196
  for (const ref of refs) {
82180
82197
  await yieldToLoop();
82181
82198
  await harvestSession(ref.sessionId, ref.path);
82199
+ lastActivityTs = Math.max(lastActivityTs, ref.activityAtMs ?? ref.mtimeMs);
82182
82200
  }
82183
82201
  } catch {
82184
82202
  }
@@ -88538,7 +88556,7 @@ function buildCodexHooksToml(port, options) {
88538
88556
  if (!Number.isInteger(port) || port < 1 || port > 65535) throw new Error("Invalid hook port");
88539
88557
  const command = quote(options.nodePath) + " " + quote(options.relayPath) + " " + port;
88540
88558
  const handlers = ["SessionStart", "UserPromptSubmit", "PreToolUse", "PostToolUse", "Stop"].map(
88541
- (event) => "[[hooks." + event + "]]\n" + (["UserPromptSubmit", "Stop"].includes(event) ? "" : 'matcher = ".*"\n') + "\n[[hooks." + event + '.hooks]]\ntype = "command"\ncommand = ' + JSON.stringify(command) + "\ntimeout = 10\nadditionalContextLimit = 5000\n"
88559
+ (event) => "[[hooks." + event + "]]\n" + (["UserPromptSubmit", "Stop"].includes(event) ? "" : 'matcher = ".*"\n') + "\n[[hooks." + event + '.hooks]]\ntype = "command"\ncommand = ' + JSON.stringify(command) + "\ntimeout = 10\n" + (event === "Stop" ? "" : "additionalContextLimit = 5000\n")
88542
88560
  );
88543
88561
  return CODEX_HOOKS_BEGIN + "\n" + handlers.join("\n") + CODEX_HOOKS_END + "\n";
88544
88562
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.10",
3
+ "version": "2.0.11",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {