@inerrata-corporation/errata 2.0.10 → 2.0.12
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.
- package/errata.mjs +31 -10
- 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))
|
|
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
|
-
|
|
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.
|
|
80341
|
+
var DAEMON_VERSION = true ? "2.0.12" : "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
|
}
|
|
@@ -88530,15 +88548,15 @@ function buildCodexHooksToml(port, options) {
|
|
|
88530
88548
|
const platform = options.platform ?? process.platform;
|
|
88531
88549
|
const quote = (value) => {
|
|
88532
88550
|
if (platform === "win32") {
|
|
88533
|
-
if (/["
|
|
88534
|
-
return '"
|
|
88551
|
+
if (/["\r\n]/.test(value)) throw new Error("Unsupported character in Codex hook path");
|
|
88552
|
+
return "'" + value.replace(/'/g, "''") + "'";
|
|
88535
88553
|
}
|
|
88536
88554
|
return "'" + value.replace(/'/g, "'\\''") + "'";
|
|
88537
88555
|
};
|
|
88538
88556
|
if (!Number.isInteger(port) || port < 1 || port > 65535) throw new Error("Invalid hook port");
|
|
88539
|
-
const command = quote(options.nodePath) + " " + quote(options.relayPath) + " " + port;
|
|
88557
|
+
const command = (platform === "win32" ? "& " : "") + 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\
|
|
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
|
}
|
|
@@ -88681,7 +88699,7 @@ function readCodexHookState(cwd, options = {}) {
|
|
|
88681
88699
|
});
|
|
88682
88700
|
});
|
|
88683
88701
|
}
|
|
88684
|
-
function assessCodexHooks(state) {
|
|
88702
|
+
function assessCodexHooks(state, platform = process.platform) {
|
|
88685
88703
|
const check2 = (status, detail) => [{ id: "codex_hooks", status, detail }];
|
|
88686
88704
|
if (state.errors?.length) return check2("fail", `Codex could not load hook configuration. ${CODEX_HOOK_REVIEW_HELP}`);
|
|
88687
88705
|
if ((state.features?.hooks ?? state.features?.codex_hooks) === false) {
|
|
@@ -88691,6 +88709,9 @@ function assessCodexHooks(state) {
|
|
|
88691
88709
|
const required2 = ["sessionStart", "userPromptSubmit", "preToolUse", "postToolUse", "stop"];
|
|
88692
88710
|
const missing = required2.filter((event) => !hooks.some((h) => h.eventName === event));
|
|
88693
88711
|
const checks = [];
|
|
88712
|
+
if (platform === "win32" && hooks.some((h) => /^"[^"]+"\s+"[^"]*[/\\]errata-relay\.mjs"\s+\d+$/.test(h.command ?? ""))) {
|
|
88713
|
+
checks.push(...check2("fail", `Installed Errata hooks use obsolete cmd.exe quoting and cannot run in PowerShell; run errata install-hooks codex here, then review the updated commands. ${CODEX_HOOK_REVIEW_HELP}`));
|
|
88714
|
+
}
|
|
88694
88715
|
if (missing.length) checks.push(...check2("fail", `Errata hooks missing or outdated in this checkout (${missing.join(", ")}); run errata install-hooks codex here`));
|
|
88695
88716
|
if (hooks.some((h) => !h.enabled)) checks.push(...check2("fail", `Errata hooks are disabled in Codex; left unchanged. ${CODEX_HOOK_REVIEW_HELP}`));
|
|
88696
88717
|
if (hooks.some((h) => !["trusted", "managed"].includes(h.trustStatus))) {
|