@inerrata-corporation/errata 2.0.8-dev.2890 → 2.0.8-dev.2896
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 +323 -178
- package/package.json +1 -1
package/errata.mjs
CHANGED
|
@@ -54319,8 +54319,8 @@ var require_request = __commonJS({
|
|
|
54319
54319
|
var require_dispatcher = __commonJS({
|
|
54320
54320
|
"../../node_modules/.pnpm/undici@6.24.1/node_modules/undici/lib/dispatcher/dispatcher.js"(exports, module2) {
|
|
54321
54321
|
"use strict";
|
|
54322
|
-
var
|
|
54323
|
-
var Dispatcher = class extends
|
|
54322
|
+
var EventEmitter3 = __require("node:events");
|
|
54323
|
+
var Dispatcher = class extends EventEmitter3 {
|
|
54324
54324
|
dispatch() {
|
|
54325
54325
|
throw new Error("not implemented");
|
|
54326
54326
|
}
|
|
@@ -70935,9 +70935,9 @@ __export(witness_ledger_exports, {
|
|
|
70935
70935
|
witnessLedgerPath: () => witnessLedgerPath
|
|
70936
70936
|
});
|
|
70937
70937
|
import { appendFileSync as appendFileSync3, existsSync as existsSync24, readFileSync as readFileSync26, writeFileSync as writeFileSync19 } from "node:fs";
|
|
70938
|
-
import { join as
|
|
70938
|
+
import { join as join32 } from "node:path";
|
|
70939
70939
|
function witnessLedgerPath(configDir) {
|
|
70940
|
-
return
|
|
70940
|
+
return join32(configDir, "witness-ledger.jsonl");
|
|
70941
70941
|
}
|
|
70942
70942
|
function appendWitnessLedger(configDir, entry) {
|
|
70943
70943
|
const path2 = witnessLedgerPath(configDir);
|
|
@@ -71393,8 +71393,8 @@ var init_report_render = __esm({
|
|
|
71393
71393
|
|
|
71394
71394
|
// src/cli.ts
|
|
71395
71395
|
init_src6();
|
|
71396
|
-
import { closeSync as closeSync2, existsSync as existsSync34, openSync as openSync2, readFileSync as readFileSync35, renameSync as renameSync4, statSync as
|
|
71397
|
-
import { join as
|
|
71396
|
+
import { closeSync as closeSync2, existsSync as existsSync34, openSync as openSync2, readFileSync as readFileSync35, renameSync as renameSync4, statSync as statSync10 } from "node:fs";
|
|
71397
|
+
import { join as join43, resolve as pathResolve2 } from "node:path";
|
|
71398
71398
|
import { spawn as spawn5 } from "node:child_process";
|
|
71399
71399
|
|
|
71400
71400
|
// src/daemon.ts
|
|
@@ -71978,8 +71978,13 @@ init_config();
|
|
|
71978
71978
|
|
|
71979
71979
|
// src/engine.ts
|
|
71980
71980
|
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
71981
|
-
import { existsSync as existsSync25, statSync as
|
|
71982
|
-
import { join as
|
|
71981
|
+
import { existsSync as existsSync25, statSync as statSync8, appendFileSync as appendFileSync4, readdirSync as readdirSync10, renameSync as renameSync3, readFileSync as readFileSync28, writeFileSync as writeFileSync21 } from "node:fs";
|
|
71982
|
+
import { join as join34, relative as relative6, sep as sep4 } from "node:path";
|
|
71983
|
+
|
|
71984
|
+
// src/source-watcher.ts
|
|
71985
|
+
import { EventEmitter as EventEmitter2 } from "node:events";
|
|
71986
|
+
import { statSync as statSync5, watch as watch2 } from "node:fs";
|
|
71987
|
+
import { join as join19 } from "node:path";
|
|
71983
71988
|
|
|
71984
71989
|
// ../../node_modules/.pnpm/chokidar@4.0.3/node_modules/chokidar/esm/index.js
|
|
71985
71990
|
import { stat as statcb } from "fs";
|
|
@@ -73672,6 +73677,95 @@ function watch(paths, options = {}) {
|
|
|
73672
73677
|
}
|
|
73673
73678
|
var esm_default = { watch, FSWatcher };
|
|
73674
73679
|
|
|
73680
|
+
// src/source-watcher.ts
|
|
73681
|
+
var NATIVE_RECURSIVE_PLATFORMS = ["win32", "darwin"];
|
|
73682
|
+
var SETTLE_MS = 50;
|
|
73683
|
+
function createSourceWatcher(targets, opts) {
|
|
73684
|
+
const native = opts.native ?? NATIVE_RECURSIVE_PLATFORMS.includes(process.platform);
|
|
73685
|
+
return native ? new NativeSourceWatcher(targets, opts.ignored) : chokidarSourceWatcher(targets, opts.ignored);
|
|
73686
|
+
}
|
|
73687
|
+
function chokidarSourceWatcher(targets, ignored) {
|
|
73688
|
+
const w = esm_default.watch([...targets], { ignored, ignoreInitial: true, persistent: true });
|
|
73689
|
+
const self = {
|
|
73690
|
+
on(event, listener) {
|
|
73691
|
+
w.on(event, listener);
|
|
73692
|
+
return self;
|
|
73693
|
+
},
|
|
73694
|
+
add: (p) => void w.add(p),
|
|
73695
|
+
unwatch: (p) => void w.unwatch(p),
|
|
73696
|
+
close: () => w.close()
|
|
73697
|
+
};
|
|
73698
|
+
return self;
|
|
73699
|
+
}
|
|
73700
|
+
var NativeSourceWatcher = class extends EventEmitter2 {
|
|
73701
|
+
constructor(targets, ignored) {
|
|
73702
|
+
super();
|
|
73703
|
+
this.ignored = ignored;
|
|
73704
|
+
for (const t of targets) this.add(t);
|
|
73705
|
+
}
|
|
73706
|
+
handles = /* @__PURE__ */ new Map();
|
|
73707
|
+
pending = /* @__PURE__ */ new Map();
|
|
73708
|
+
known = /* @__PURE__ */ new Set();
|
|
73709
|
+
closed = false;
|
|
73710
|
+
add(target) {
|
|
73711
|
+
if (this.closed || this.handles.has(target)) return;
|
|
73712
|
+
let isDir;
|
|
73713
|
+
try {
|
|
73714
|
+
isDir = statSync5(target).isDirectory();
|
|
73715
|
+
} catch {
|
|
73716
|
+
return;
|
|
73717
|
+
}
|
|
73718
|
+
try {
|
|
73719
|
+
const h = watch2(target, { recursive: isDir, persistent: true }, (event, name2) => {
|
|
73720
|
+
const path2 = isDir ? name2 ? join19(target, name2.toString()) : null : target;
|
|
73721
|
+
if (!path2) return;
|
|
73722
|
+
this.emit("raw", event, path2, { watchedPath: target });
|
|
73723
|
+
if (!this.ignored(path2)) this.schedule(path2, event === "rename");
|
|
73724
|
+
});
|
|
73725
|
+
h.on("error", () => this.unwatch(target));
|
|
73726
|
+
this.handles.set(target, h);
|
|
73727
|
+
} catch {
|
|
73728
|
+
}
|
|
73729
|
+
}
|
|
73730
|
+
unwatch(target) {
|
|
73731
|
+
this.handles.get(target)?.close();
|
|
73732
|
+
this.handles.delete(target);
|
|
73733
|
+
}
|
|
73734
|
+
async close() {
|
|
73735
|
+
this.closed = true;
|
|
73736
|
+
for (const h of this.handles.values()) h.close();
|
|
73737
|
+
this.handles.clear();
|
|
73738
|
+
for (const p of this.pending.values()) clearTimeout(p.timer);
|
|
73739
|
+
this.pending.clear();
|
|
73740
|
+
}
|
|
73741
|
+
schedule(path2, renamed) {
|
|
73742
|
+
const prev = this.pending.get(path2);
|
|
73743
|
+
if (prev) clearTimeout(prev.timer);
|
|
73744
|
+
const timer = setTimeout(() => {
|
|
73745
|
+
this.pending.delete(path2);
|
|
73746
|
+
this.classify(path2, renamed || (prev?.renamed ?? false));
|
|
73747
|
+
}, SETTLE_MS);
|
|
73748
|
+
this.pending.set(path2, { timer, renamed: renamed || (prev?.renamed ?? false) });
|
|
73749
|
+
}
|
|
73750
|
+
classify(path2, renamed) {
|
|
73751
|
+
if (this.closed) return;
|
|
73752
|
+
let isFile;
|
|
73753
|
+
try {
|
|
73754
|
+
const s = statSync5(path2);
|
|
73755
|
+
if (s.isDirectory()) return;
|
|
73756
|
+
isFile = s.isFile();
|
|
73757
|
+
} catch {
|
|
73758
|
+
this.known.delete(path2);
|
|
73759
|
+
this.emit("unlink", path2);
|
|
73760
|
+
return;
|
|
73761
|
+
}
|
|
73762
|
+
if (!isFile) return;
|
|
73763
|
+
const first = !this.known.has(path2);
|
|
73764
|
+
this.known.add(path2);
|
|
73765
|
+
this.emit(renamed && first ? "add" : "change", path2);
|
|
73766
|
+
}
|
|
73767
|
+
};
|
|
73768
|
+
|
|
73675
73769
|
// src/engine.ts
|
|
73676
73770
|
init_generalize_graph();
|
|
73677
73771
|
init_src();
|
|
@@ -73928,8 +74022,8 @@ init_review2();
|
|
|
73928
74022
|
|
|
73929
74023
|
// src/turn.ts
|
|
73930
74024
|
init_checkout_root();
|
|
73931
|
-
import { closeSync, existsSync as existsSync16, fstatSync, openSync, readdirSync as readdirSync6, readSync, realpathSync, statSync as
|
|
73932
|
-
import { basename as basename5, delimiter, dirname as dirname10, join as
|
|
74025
|
+
import { closeSync, existsSync as existsSync16, fstatSync, openSync, readdirSync as readdirSync6, readSync, realpathSync, statSync as statSync6 } from "node:fs";
|
|
74026
|
+
import { basename as basename5, delimiter, dirname as dirname10, join as join20, normalize as normalize3 } from "node:path";
|
|
73933
74027
|
import { homedir as homedir4 } from "node:os";
|
|
73934
74028
|
import { createHash as createHash14 } from "node:crypto";
|
|
73935
74029
|
function readFrom(path2, fromByte, maxBytes) {
|
|
@@ -74307,7 +74401,7 @@ function turnsSince(turns, mark) {
|
|
|
74307
74401
|
return at >= 0 ? turns.slice(at + 1) : turns;
|
|
74308
74402
|
}
|
|
74309
74403
|
function claudeProjectDir(cwd, home = homedir4()) {
|
|
74310
|
-
return
|
|
74404
|
+
return join20(home, ".claude", "projects", cwd.replace(/[\\/:.]/g, "-"));
|
|
74311
74405
|
}
|
|
74312
74406
|
function recentTranscripts(cwd, opts = {}) {
|
|
74313
74407
|
const dir = claudeProjectDir(cwd, opts.home ?? homedir4());
|
|
@@ -74322,10 +74416,10 @@ function recentTranscripts(cwd, opts = {}) {
|
|
|
74322
74416
|
const refs = [];
|
|
74323
74417
|
for (const name2 of names) {
|
|
74324
74418
|
if (!name2.endsWith(".jsonl")) continue;
|
|
74325
|
-
const path2 =
|
|
74419
|
+
const path2 = join20(dir, name2);
|
|
74326
74420
|
let mtimeMs;
|
|
74327
74421
|
try {
|
|
74328
|
-
mtimeMs =
|
|
74422
|
+
mtimeMs = statSync6(path2).mtimeMs;
|
|
74329
74423
|
} catch {
|
|
74330
74424
|
continue;
|
|
74331
74425
|
}
|
|
@@ -74337,7 +74431,7 @@ function recentTranscripts(cwd, opts = {}) {
|
|
|
74337
74431
|
}
|
|
74338
74432
|
function subagentTranscripts(mainTranscriptPath, sessionId) {
|
|
74339
74433
|
if (!mainTranscriptPath || !sessionId) return [];
|
|
74340
|
-
const dir =
|
|
74434
|
+
const dir = join20(dirname10(mainTranscriptPath), sessionId, "subagents");
|
|
74341
74435
|
if (!existsSync16(dir)) return [];
|
|
74342
74436
|
let names;
|
|
74343
74437
|
try {
|
|
@@ -74348,10 +74442,10 @@ function subagentTranscripts(mainTranscriptPath, sessionId) {
|
|
|
74348
74442
|
const refs = [];
|
|
74349
74443
|
for (const name2 of names) {
|
|
74350
74444
|
if (!name2.endsWith(".jsonl")) continue;
|
|
74351
|
-
const path2 =
|
|
74445
|
+
const path2 = join20(dir, name2);
|
|
74352
74446
|
let mtimeMs;
|
|
74353
74447
|
try {
|
|
74354
|
-
mtimeMs =
|
|
74448
|
+
mtimeMs = statSync6(path2).mtimeMs;
|
|
74355
74449
|
} catch {
|
|
74356
74450
|
continue;
|
|
74357
74451
|
}
|
|
@@ -74367,8 +74461,8 @@ function splitPathList(value, sep5 = delimiter) {
|
|
|
74367
74461
|
function codexSessionRoots(env2 = process.env, home = homedir4()) {
|
|
74368
74462
|
const roots = /* @__PURE__ */ new Set();
|
|
74369
74463
|
for (const d of splitPathList(env2["ERRATA_CODEX_SESSIONS_DIRS"])) roots.add(d);
|
|
74370
|
-
if (env2["CODEX_HOME"]) roots.add(
|
|
74371
|
-
roots.add(
|
|
74464
|
+
if (env2["CODEX_HOME"]) roots.add(join20(env2["CODEX_HOME"], "sessions"));
|
|
74465
|
+
roots.add(join20(home, ".codex", "sessions"));
|
|
74372
74466
|
return [...roots];
|
|
74373
74467
|
}
|
|
74374
74468
|
function readCodexRolloutCwd(path2) {
|
|
@@ -74426,10 +74520,10 @@ function codexRolloutsForCwd(cwd, opts = {}) {
|
|
|
74426
74520
|
continue;
|
|
74427
74521
|
}
|
|
74428
74522
|
for (const name2 of names) {
|
|
74429
|
-
const full =
|
|
74523
|
+
const full = join20(dir, name2);
|
|
74430
74524
|
let st;
|
|
74431
74525
|
try {
|
|
74432
|
-
st =
|
|
74526
|
+
st = statSync6(full);
|
|
74433
74527
|
} catch {
|
|
74434
74528
|
continue;
|
|
74435
74529
|
}
|
|
@@ -74458,8 +74552,8 @@ function codexRolloutsForCwd(cwd, opts = {}) {
|
|
|
74458
74552
|
function geminiSessionRoots(env2 = process.env, home = homedir4()) {
|
|
74459
74553
|
const roots = /* @__PURE__ */ new Set();
|
|
74460
74554
|
for (const d of splitPathList(env2["ERRATA_GEMINI_SESSIONS_DIRS"])) roots.add(d);
|
|
74461
|
-
if (env2["GEMINI_CLI_HOME"]) roots.add(
|
|
74462
|
-
roots.add(
|
|
74555
|
+
if (env2["GEMINI_CLI_HOME"]) roots.add(join20(env2["GEMINI_CLI_HOME"], ".gemini", "tmp"));
|
|
74556
|
+
roots.add(join20(home, ".gemini", "tmp"));
|
|
74463
74557
|
return [...roots];
|
|
74464
74558
|
}
|
|
74465
74559
|
function geminiProjectHash(cwd) {
|
|
@@ -74507,7 +74601,7 @@ function geminiTranscriptsForCwd(cwd, opts = {}) {
|
|
|
74507
74601
|
continue;
|
|
74508
74602
|
}
|
|
74509
74603
|
for (const slug2 of slugs) {
|
|
74510
|
-
const chats =
|
|
74604
|
+
const chats = join20(root, slug2, "chats");
|
|
74511
74605
|
let names;
|
|
74512
74606
|
try {
|
|
74513
74607
|
names = readdirSync6(chats);
|
|
@@ -74516,10 +74610,10 @@ function geminiTranscriptsForCwd(cwd, opts = {}) {
|
|
|
74516
74610
|
}
|
|
74517
74611
|
for (const name2 of names) {
|
|
74518
74612
|
if (!name2.startsWith("session-") || !name2.endsWith(".jsonl")) continue;
|
|
74519
|
-
const full =
|
|
74613
|
+
const full = join20(chats, name2);
|
|
74520
74614
|
let st;
|
|
74521
74615
|
try {
|
|
74522
|
-
st =
|
|
74616
|
+
st = statSync6(full);
|
|
74523
74617
|
} catch {
|
|
74524
74618
|
continue;
|
|
74525
74619
|
}
|
|
@@ -74536,8 +74630,8 @@ function geminiTranscriptsForCwd(cwd, opts = {}) {
|
|
|
74536
74630
|
function opencodeSessionRoots(env2 = process.env, home = homedir4()) {
|
|
74537
74631
|
const roots = /* @__PURE__ */ new Set();
|
|
74538
74632
|
for (const d of splitPathList(env2["ERRATA_OPENCODE_SESSIONS_DIRS"])) roots.add(d);
|
|
74539
|
-
if (env2["XDG_DATA_HOME"]) roots.add(
|
|
74540
|
-
roots.add(
|
|
74633
|
+
if (env2["XDG_DATA_HOME"]) roots.add(join20(env2["XDG_DATA_HOME"], "opencode", "errata"));
|
|
74634
|
+
roots.add(join20(home, ".local", "share", "opencode", "errata"));
|
|
74541
74635
|
return [...roots];
|
|
74542
74636
|
}
|
|
74543
74637
|
function readOpencodeTranscriptDirectory(path2) {
|
|
@@ -74579,10 +74673,10 @@ function opencodeTranscriptsForCwd(cwd, opts = {}) {
|
|
|
74579
74673
|
}
|
|
74580
74674
|
for (const name2 of names) {
|
|
74581
74675
|
if (!name2.endsWith(".jsonl")) continue;
|
|
74582
|
-
const full =
|
|
74676
|
+
const full = join20(root, name2);
|
|
74583
74677
|
let st;
|
|
74584
74678
|
try {
|
|
74585
|
-
st =
|
|
74679
|
+
st = statSync6(full);
|
|
74586
74680
|
} catch {
|
|
74587
74681
|
continue;
|
|
74588
74682
|
}
|
|
@@ -75765,7 +75859,7 @@ ${conversation}` }]
|
|
|
75765
75859
|
init_src5();
|
|
75766
75860
|
init_src2();
|
|
75767
75861
|
import { existsSync as existsSync17, readFileSync as readFileSync15, readdirSync as readdirSync7, writeFileSync as writeFileSync13 } from "node:fs";
|
|
75768
|
-
import { join as
|
|
75862
|
+
import { join as join21 } from "node:path";
|
|
75769
75863
|
import { homedir as homedir5 } from "node:os";
|
|
75770
75864
|
var BACKFILL_VERSION = 1;
|
|
75771
75865
|
var EMPTY = {
|
|
@@ -75779,7 +75873,7 @@ var EMPTY = {
|
|
|
75779
75873
|
recoverable: 0
|
|
75780
75874
|
};
|
|
75781
75875
|
function markerPath(configDir) {
|
|
75782
|
-
return
|
|
75876
|
+
return join21(configDir, "constraint-backfill.json");
|
|
75783
75877
|
}
|
|
75784
75878
|
function alreadyDone(configDir) {
|
|
75785
75879
|
const p = markerPath(configDir);
|
|
@@ -75805,7 +75899,7 @@ function replay(root) {
|
|
|
75805
75899
|
for (const f of names) {
|
|
75806
75900
|
let lines;
|
|
75807
75901
|
try {
|
|
75808
|
-
lines = readFileSync15(
|
|
75902
|
+
lines = readFileSync15(join21(dir, f), "utf8").split("\n");
|
|
75809
75903
|
} catch {
|
|
75810
75904
|
continue;
|
|
75811
75905
|
}
|
|
@@ -75933,7 +76027,7 @@ function backfillConstraintKind(store, opts) {
|
|
|
75933
76027
|
init_src();
|
|
75934
76028
|
init_src5();
|
|
75935
76029
|
import { existsSync as existsSync18, readFileSync as readFileSync16, writeFileSync as writeFileSync14 } from "node:fs";
|
|
75936
|
-
import { join as
|
|
76030
|
+
import { join as join22 } from "node:path";
|
|
75937
76031
|
function citeEdgeId(from, type, to) {
|
|
75938
76032
|
return `edge_${digest({ from, type, to })}`.slice(0, 24);
|
|
75939
76033
|
}
|
|
@@ -75948,7 +76042,7 @@ var EMPTY2 = {
|
|
|
75948
76042
|
byType: {}
|
|
75949
76043
|
};
|
|
75950
76044
|
function markerPath2(configDir) {
|
|
75951
|
-
return
|
|
76045
|
+
return join22(configDir, "edge-repair.json");
|
|
75952
76046
|
}
|
|
75953
76047
|
function alreadyDone2(configDir) {
|
|
75954
76048
|
const p = markerPath2(configDir);
|
|
@@ -76018,7 +76112,7 @@ init_reconcile();
|
|
|
76018
76112
|
|
|
76019
76113
|
// src/pass-ledger.ts
|
|
76020
76114
|
import { appendFileSync as appendFileSync2, existsSync as existsSync19, readFileSync as readFileSync17, writeFileSync as writeFileSync15 } from "node:fs";
|
|
76021
|
-
import { join as
|
|
76115
|
+
import { join as join23 } from "node:path";
|
|
76022
76116
|
|
|
76023
76117
|
// src/isolate-census.ts
|
|
76024
76118
|
var live = 0;
|
|
@@ -76041,7 +76135,7 @@ var PER_KIND_MAX = 100;
|
|
|
76041
76135
|
var TRIM_EVERY = 50;
|
|
76042
76136
|
var appendsSinceTrim = /* @__PURE__ */ new Map();
|
|
76043
76137
|
function passLedgerPath(configDir) {
|
|
76044
|
-
return
|
|
76138
|
+
return join23(configDir, "pass-ledger.jsonl");
|
|
76045
76139
|
}
|
|
76046
76140
|
function appendPassLedger(configDir, kind, durationMs, counts) {
|
|
76047
76141
|
const path2 = passLedgerPath(configDir);
|
|
@@ -76468,10 +76562,10 @@ init_src9();
|
|
|
76468
76562
|
init_src();
|
|
76469
76563
|
init_src2();
|
|
76470
76564
|
import { readFileSync as readFileSync18 } from "node:fs";
|
|
76471
|
-
import { join as
|
|
76565
|
+
import { join as join24 } from "node:path";
|
|
76472
76566
|
function loadClaimIgnorePatterns(workspaceRoot) {
|
|
76473
76567
|
try {
|
|
76474
|
-
return readFileSync18(
|
|
76568
|
+
return readFileSync18(join24(workspaceRoot, ".errataignore"), "utf8").split(/\r?\n/).map((l) => l.trim()).filter((l) => l.length > 0 && !l.startsWith("#")).map((l) => l.toLowerCase());
|
|
76475
76569
|
} catch {
|
|
76476
76570
|
return [];
|
|
76477
76571
|
}
|
|
@@ -76834,9 +76928,9 @@ async function pullCloudTriage(shared, cloud, profile, limit = 50) {
|
|
|
76834
76928
|
// src/retrieval-stack.ts
|
|
76835
76929
|
init_src();
|
|
76836
76930
|
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
76837
|
-
import { existsSync as existsSync20, readFileSync as readFileSync19, statSync as
|
|
76931
|
+
import { existsSync as existsSync20, readFileSync as readFileSync19, statSync as statSync7 } from "node:fs";
|
|
76838
76932
|
import { homedir as homedir6 } from "node:os";
|
|
76839
|
-
import { join as
|
|
76933
|
+
import { join as join25 } from "node:path";
|
|
76840
76934
|
var RETRIEVAL_STACK_CAP = 24;
|
|
76841
76935
|
var MANIFEST_SCAN_CAP = 400;
|
|
76842
76936
|
var RUNTIME_TOKENS = /* @__PURE__ */ new Set([
|
|
@@ -77133,44 +77227,44 @@ function loadRegistryPolicy(root, env2 = process.env, repoLocator) {
|
|
|
77133
77227
|
};
|
|
77134
77228
|
const texts = (...paths) => paths.map(read2).filter((t) => t !== null);
|
|
77135
77229
|
const home = homedir6();
|
|
77136
|
-
const npm = parseNpmrcPolicy(texts(
|
|
77230
|
+
const npm = parseNpmrcPolicy(texts(join25(root, ".npmrc"), join25(home, ".npmrc")));
|
|
77137
77231
|
const blocked = /* @__PURE__ */ new Set();
|
|
77138
77232
|
if (!npm.defaultPublic) blocked.add("npm");
|
|
77139
77233
|
if (pypiIndexIsPrivate(
|
|
77140
77234
|
texts(
|
|
77141
|
-
|
|
77142
|
-
|
|
77143
|
-
|
|
77144
|
-
|
|
77145
|
-
|
|
77146
|
-
|
|
77147
|
-
|
|
77235
|
+
join25(root, "pip.conf"),
|
|
77236
|
+
join25(root, "pip.ini"),
|
|
77237
|
+
join25(root, "pyproject.toml"),
|
|
77238
|
+
join25(root, "requirements.txt"),
|
|
77239
|
+
join25(home, ".pip", "pip.conf"),
|
|
77240
|
+
join25(home, ".config", "pip", "pip.conf"),
|
|
77241
|
+
join25(env2["APPDATA"] ?? home, "pip", "pip.ini")
|
|
77148
77242
|
)
|
|
77149
77243
|
)) {
|
|
77150
77244
|
blocked.add("pypi");
|
|
77151
77245
|
}
|
|
77152
77246
|
if (cargoRegistryIsPrivate(
|
|
77153
77247
|
texts(
|
|
77154
|
-
|
|
77155
|
-
|
|
77156
|
-
|
|
77157
|
-
|
|
77248
|
+
join25(root, ".cargo", "config.toml"),
|
|
77249
|
+
join25(root, ".cargo", "config"),
|
|
77250
|
+
join25(home, ".cargo", "config.toml"),
|
|
77251
|
+
join25(home, ".cargo", "config")
|
|
77158
77252
|
)
|
|
77159
77253
|
)) {
|
|
77160
77254
|
blocked.add("cargo");
|
|
77161
77255
|
}
|
|
77162
77256
|
if (nugetSourcesArePrivate(
|
|
77163
77257
|
texts(
|
|
77164
|
-
|
|
77165
|
-
|
|
77166
|
-
|
|
77167
|
-
|
|
77168
|
-
|
|
77258
|
+
join25(root, "NuGet.config"),
|
|
77259
|
+
join25(root, "nuget.config"),
|
|
77260
|
+
join25(root, "NuGet.Config"),
|
|
77261
|
+
join25(env2["APPDATA"] ?? home, "NuGet", "NuGet.Config"),
|
|
77262
|
+
join25(home, ".nuget", "NuGet", "NuGet.Config")
|
|
77169
77263
|
)
|
|
77170
77264
|
)) {
|
|
77171
77265
|
blocked.add("nuget");
|
|
77172
77266
|
}
|
|
77173
|
-
const goEnvFile = env2["GOENV"] ??
|
|
77267
|
+
const goEnvFile = env2["GOENV"] ?? join25(env2["APPDATA"] ?? join25(home, ".config"), "go", "env");
|
|
77174
77268
|
const goEnvText = read2(goEnvFile) ?? "";
|
|
77175
77269
|
const fromFile = ["GOPRIVATE", "GONOSUMDB", "GONOSUMCHECK"].map(
|
|
77176
77270
|
(k) => new RegExp(`^${k}=(.*)$`, "m").exec(goEnvText)?.[1]
|
|
@@ -77181,10 +77275,10 @@ function loadRegistryPolicy(root, env2 = process.env, repoLocator) {
|
|
|
77181
77275
|
env2["GONOSUMCHECK"],
|
|
77182
77276
|
...fromFile
|
|
77183
77277
|
]);
|
|
77184
|
-
const gemfiles = texts(
|
|
77278
|
+
const gemfiles = texts(join25(root, "Gemfile"));
|
|
77185
77279
|
if (gemSourceIsPrivate(gemfiles)) blocked.add("gem");
|
|
77186
77280
|
if (mavenReposArePrivate(
|
|
77187
|
-
texts(
|
|
77281
|
+
texts(join25(root, "pom.xml"), join25(home, ".m2", "settings.xml"))
|
|
77188
77282
|
)) {
|
|
77189
77283
|
blocked.add("maven");
|
|
77190
77284
|
}
|
|
@@ -77351,10 +77445,10 @@ function readDirectDependencies(root) {
|
|
|
77351
77445
|
const familiesSeen = /* @__PURE__ */ new Set();
|
|
77352
77446
|
for (const c of LOCKFILES) {
|
|
77353
77447
|
if (familiesSeen.has(c.family)) continue;
|
|
77354
|
-
const p =
|
|
77448
|
+
const p = join25(root, c.file);
|
|
77355
77449
|
if (!existsSync20(p)) continue;
|
|
77356
77450
|
try {
|
|
77357
|
-
const s =
|
|
77451
|
+
const s = statSync7(p);
|
|
77358
77452
|
stamps.push(`${c.file}:${s.mtimeMs}:${s.size}`);
|
|
77359
77453
|
} catch {
|
|
77360
77454
|
continue;
|
|
@@ -77415,14 +77509,14 @@ function manifestPaths(root) {
|
|
|
77415
77509
|
"project.godot"
|
|
77416
77510
|
];
|
|
77417
77511
|
return {
|
|
77418
|
-
paths: ROOT_MANIFESTS.filter((f) => existsSync20(
|
|
77512
|
+
paths: ROOT_MANIFESTS.filter((f) => existsSync20(join25(root, f))),
|
|
77419
77513
|
tracked: false,
|
|
77420
77514
|
truncated: false
|
|
77421
77515
|
};
|
|
77422
77516
|
}
|
|
77423
77517
|
var WORKSPACE_MARKERS = ["pnpm-workspace.yaml", "lerna.json", "go.work", "settings.gradle", "settings.gradle.kts"];
|
|
77424
77518
|
function rootDeclaresWorkspace(root, texts) {
|
|
77425
|
-
if (WORKSPACE_MARKERS.some((f) => existsSync20(
|
|
77519
|
+
if (WORKSPACE_MARKERS.some((f) => existsSync20(join25(root, f)))) return true;
|
|
77426
77520
|
return /"workspaces"\s*:/.test(texts.get("package.json") ?? "") || /<modules>/.test(texts.get("pom.xml") ?? "") || /^\s*\[workspace\]/m.test(texts.get("Cargo.toml") ?? "");
|
|
77427
77521
|
}
|
|
77428
77522
|
var EMPTY_SCAN = { deps: [], self: [], complete: true };
|
|
@@ -77436,9 +77530,9 @@ function scanManifests(root) {
|
|
|
77436
77530
|
const texts = /* @__PURE__ */ new Map();
|
|
77437
77531
|
const stamps = [];
|
|
77438
77532
|
for (const rel of paths) {
|
|
77439
|
-
const abs =
|
|
77533
|
+
const abs = join25(root, rel);
|
|
77440
77534
|
try {
|
|
77441
|
-
const s =
|
|
77535
|
+
const s = statSync7(abs);
|
|
77442
77536
|
stamps.push(`${rel}:${s.mtimeMs}:${s.size}`);
|
|
77443
77537
|
texts.set(rel, readFileSync19(abs, "utf8"));
|
|
77444
77538
|
} catch {
|
|
@@ -77470,7 +77564,7 @@ function readManifestDependencies(root) {
|
|
|
77470
77564
|
|
|
77471
77565
|
// src/git-sensor.ts
|
|
77472
77566
|
import { existsSync as existsSync21, readFileSync as readFileSync20, watch as fsWatch } from "node:fs";
|
|
77473
|
-
import { join as
|
|
77567
|
+
import { join as join26 } from "node:path";
|
|
77474
77568
|
function readFirstLine(path2) {
|
|
77475
77569
|
try {
|
|
77476
77570
|
return readFileSync20(path2, "utf8").split(/\r?\n/, 1)[0].trim();
|
|
@@ -77479,12 +77573,12 @@ function readFirstLine(path2) {
|
|
|
77479
77573
|
}
|
|
77480
77574
|
}
|
|
77481
77575
|
function readGitRefState(gitDir) {
|
|
77482
|
-
const head2 = readFirstLine(
|
|
77576
|
+
const head2 = readFirstLine(join26(gitDir, "HEAD"));
|
|
77483
77577
|
const m = head2 ? /^ref:\s*refs\/heads\/(.+)$/.exec(head2) : null;
|
|
77484
77578
|
const branch = m ? m[1] : null;
|
|
77485
77579
|
let sha2 = null;
|
|
77486
77580
|
if (branch) {
|
|
77487
|
-
sha2 = readFirstLine(
|
|
77581
|
+
sha2 = readFirstLine(join26(gitDir, "refs", "heads", branch));
|
|
77488
77582
|
if (!sha2) sha2 = shaFromPackedRefs(gitDir, `refs/heads/${branch}`);
|
|
77489
77583
|
} else if (head2 && /^[0-9a-f]{7,40}$/i.test(head2)) {
|
|
77490
77584
|
sha2 = head2;
|
|
@@ -77492,13 +77586,13 @@ function readGitRefState(gitDir) {
|
|
|
77492
77586
|
return {
|
|
77493
77587
|
branch,
|
|
77494
77588
|
sha: sha2,
|
|
77495
|
-
mergeHeadExists: existsSync21(
|
|
77496
|
-
origHeadExists: existsSync21(
|
|
77589
|
+
mergeHeadExists: existsSync21(join26(gitDir, "MERGE_HEAD")),
|
|
77590
|
+
origHeadExists: existsSync21(join26(gitDir, "ORIG_HEAD"))
|
|
77497
77591
|
};
|
|
77498
77592
|
}
|
|
77499
77593
|
function shaFromPackedRefs(gitDir, ref) {
|
|
77500
77594
|
try {
|
|
77501
|
-
for (const line of readFileSync20(
|
|
77595
|
+
for (const line of readFileSync20(join26(gitDir, "packed-refs"), "utf8").split(/\r?\n/)) {
|
|
77502
77596
|
const [sha2, name2] = line.split(/\s+/);
|
|
77503
77597
|
if (name2 === ref && sha2) return sha2;
|
|
77504
77598
|
}
|
|
@@ -77532,7 +77626,7 @@ function startGitSensor(gitDir, onEvent, opts = {}) {
|
|
|
77532
77626
|
const settle = () => {
|
|
77533
77627
|
if (timer) clearTimeout(timer);
|
|
77534
77628
|
timer = setTimeout(() => {
|
|
77535
|
-
if (existsSync21(
|
|
77629
|
+
if (existsSync21(join26(gitDir, "index.lock"))) {
|
|
77536
77630
|
settle();
|
|
77537
77631
|
return;
|
|
77538
77632
|
}
|
|
@@ -77543,7 +77637,7 @@ function startGitSensor(gitDir, onEvent, opts = {}) {
|
|
|
77543
77637
|
}, debounceMs);
|
|
77544
77638
|
};
|
|
77545
77639
|
for (const sub of ["HEAD", "logs/HEAD", "MERGE_HEAD", "ORIG_HEAD"]) {
|
|
77546
|
-
const p =
|
|
77640
|
+
const p = join26(gitDir, sub);
|
|
77547
77641
|
try {
|
|
77548
77642
|
watchers.push(fsWatch(p, settle));
|
|
77549
77643
|
} catch {
|
|
@@ -77768,7 +77862,7 @@ var TelemetryRecorder = class {
|
|
|
77768
77862
|
|
|
77769
77863
|
// src/file-activity.ts
|
|
77770
77864
|
import { readFileSync as readFileSync22 } from "node:fs";
|
|
77771
|
-
import { join as
|
|
77865
|
+
import { join as join28 } from "node:path";
|
|
77772
77866
|
import { createHash as createHash15 } from "node:crypto";
|
|
77773
77867
|
|
|
77774
77868
|
// ../../packages/privacy/src/patterns/credentials.ts
|
|
@@ -78520,7 +78614,7 @@ init_git_remote();
|
|
|
78520
78614
|
// src/history-bundle.ts
|
|
78521
78615
|
import { execFile as execFile2 } from "node:child_process";
|
|
78522
78616
|
import { readFileSync as readFileSync21 } from "node:fs";
|
|
78523
|
-
import { join as
|
|
78617
|
+
import { join as join27 } from "node:path";
|
|
78524
78618
|
var DEFAULT_MAX_TOKENS = 6e3;
|
|
78525
78619
|
var FILE_LIST_CAP = 60;
|
|
78526
78620
|
var DIFF_FILE_CAP = 40;
|
|
@@ -78557,7 +78651,7 @@ function pathAllowedByFloor(path2) {
|
|
|
78557
78651
|
function loadRepoIgnore(root, extraPatterns = []) {
|
|
78558
78652
|
let source = "";
|
|
78559
78653
|
try {
|
|
78560
|
-
source = readFileSync21(
|
|
78654
|
+
source = readFileSync21(join27(root, ".errataignore"), "utf8");
|
|
78561
78655
|
} catch {
|
|
78562
78656
|
source = "";
|
|
78563
78657
|
}
|
|
@@ -78975,7 +79069,7 @@ function readActivityBranch(root) {
|
|
|
78975
79069
|
try {
|
|
78976
79070
|
const gitDir = resolveGitDir(root);
|
|
78977
79071
|
if (!gitDir) return null;
|
|
78978
|
-
const head2 = readFileSync22(
|
|
79072
|
+
const head2 = readFileSync22(join28(gitDir, "HEAD"), "utf8").trim();
|
|
78979
79073
|
const branch = head2.startsWith("ref: refs/heads/") ? head2.slice(16) : /^[a-f0-9]{40,64}$/i.test(head2) ? "HEAD" : null;
|
|
78980
79074
|
return branch && branch.length <= 256 && !/[\x00-\x1f\x7f]/.test(branch) ? branch : null;
|
|
78981
79075
|
} catch {
|
|
@@ -79139,7 +79233,7 @@ import {
|
|
|
79139
79233
|
unlinkSync as unlinkSync2,
|
|
79140
79234
|
writeFileSync as writeFileSync16
|
|
79141
79235
|
} from "node:fs";
|
|
79142
|
-
import { basename as basename6, join as
|
|
79236
|
+
import { basename as basename6, join as join29 } from "node:path";
|
|
79143
79237
|
function skillFileName(id) {
|
|
79144
79238
|
return `${id.replace(/[^A-Za-z0-9_.-]/g, "_")}.md`;
|
|
79145
79239
|
}
|
|
@@ -79170,7 +79264,7 @@ async function syncSkills(paths, client, seed, pins = [], techSeed) {
|
|
|
79170
79264
|
for (const s of res.skills) {
|
|
79171
79265
|
const fileName = skillFileName(s.id);
|
|
79172
79266
|
keep.add(fileName);
|
|
79173
|
-
writeFileSync16(
|
|
79267
|
+
writeFileSync16(join29(paths.skillsDir, fileName), s.markdown, "utf8");
|
|
79174
79268
|
rows.push({
|
|
79175
79269
|
id: s.id,
|
|
79176
79270
|
title: s.title,
|
|
@@ -79183,7 +79277,7 @@ async function syncSkills(paths, client, seed, pins = [], techSeed) {
|
|
|
79183
79277
|
const fileName = skillFileName(p.id);
|
|
79184
79278
|
if (keep.has(fileName)) continue;
|
|
79185
79279
|
keep.add(fileName);
|
|
79186
|
-
writeFileSync16(
|
|
79280
|
+
writeFileSync16(join29(paths.skillsDir, fileName), p.markdown, "utf8");
|
|
79187
79281
|
rows.push({
|
|
79188
79282
|
id: p.id,
|
|
79189
79283
|
title: p.title,
|
|
@@ -79197,7 +79291,7 @@ async function syncSkills(paths, client, seed, pins = [], techSeed) {
|
|
|
79197
79291
|
if (!f.endsWith(".md")) continue;
|
|
79198
79292
|
if (keep.has(basename6(f))) continue;
|
|
79199
79293
|
try {
|
|
79200
|
-
unlinkSync2(
|
|
79294
|
+
unlinkSync2(join29(paths.skillsDir, f));
|
|
79201
79295
|
pruned++;
|
|
79202
79296
|
} catch {
|
|
79203
79297
|
}
|
|
@@ -79224,13 +79318,13 @@ import {
|
|
|
79224
79318
|
symlinkSync,
|
|
79225
79319
|
writeFileSync as writeFileSync17
|
|
79226
79320
|
} from "node:fs";
|
|
79227
|
-
import { join as
|
|
79321
|
+
import { join as join30 } from "node:path";
|
|
79228
79322
|
var SKILL_NS = "errata-";
|
|
79229
79323
|
var HARNESS_SKILL_DIRS = [
|
|
79230
|
-
{ configDir: ".claude", skillsDir:
|
|
79324
|
+
{ configDir: ".claude", skillsDir: join30(".claude", "skills") },
|
|
79231
79325
|
// Cursor adopted the standard; its exact project dir is still moving — kept
|
|
79232
79326
|
// best-effort and gated on `.cursor/` presence so we never create it blind.
|
|
79233
|
-
{ configDir: ".cursor", skillsDir:
|
|
79327
|
+
{ configDir: ".cursor", skillsDir: join30(".cursor", "skills") }
|
|
79234
79328
|
];
|
|
79235
79329
|
function skillSlug(title, id) {
|
|
79236
79330
|
const base = title.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || id.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "skill";
|
|
@@ -79280,7 +79374,7 @@ function reconcileNamespaced(dir, keep) {
|
|
|
79280
79374
|
for (const name2 of readdirSync9(dir)) {
|
|
79281
79375
|
if (!name2.startsWith(SKILL_NS) || keep.has(name2)) continue;
|
|
79282
79376
|
try {
|
|
79283
|
-
rmSync3(
|
|
79377
|
+
rmSync3(join30(dir, name2), { recursive: true, force: true });
|
|
79284
79378
|
pruned++;
|
|
79285
79379
|
} catch {
|
|
79286
79380
|
}
|
|
@@ -79310,7 +79404,7 @@ function safeLstat(p) {
|
|
|
79310
79404
|
}
|
|
79311
79405
|
}
|
|
79312
79406
|
function emitAndProjectSkills(root, skills) {
|
|
79313
|
-
const agentsSkillsDir =
|
|
79407
|
+
const agentsSkillsDir = join30(root, ".agents", "skills");
|
|
79314
79408
|
mkdirSync8(agentsSkillsDir, { recursive: true });
|
|
79315
79409
|
const slugs = [];
|
|
79316
79410
|
const keep = /* @__PURE__ */ new Set();
|
|
@@ -79327,9 +79421,9 @@ function emitAndProjectSkills(root, skills) {
|
|
|
79327
79421
|
keep.add(slug2);
|
|
79328
79422
|
slugs.push(slug2);
|
|
79329
79423
|
const description = deriveDescription(s.title, s.layer, body2);
|
|
79330
|
-
mkdirSync8(
|
|
79424
|
+
mkdirSync8(join30(agentsSkillsDir, slug2), { recursive: true });
|
|
79331
79425
|
writeFileSync17(
|
|
79332
|
-
|
|
79426
|
+
join30(agentsSkillsDir, slug2, "SKILL.md"),
|
|
79333
79427
|
renderSkillMd(slug2, description, body2, skillCiteHandle(s)),
|
|
79334
79428
|
"utf8"
|
|
79335
79429
|
);
|
|
@@ -79338,11 +79432,11 @@ function emitAndProjectSkills(root, skills) {
|
|
|
79338
79432
|
reconcileNamespaced(agentsSkillsDir, keep);
|
|
79339
79433
|
let projected = 0;
|
|
79340
79434
|
for (const h of HARNESS_SKILL_DIRS) {
|
|
79341
|
-
if (!existsSync23(
|
|
79342
|
-
const dir =
|
|
79435
|
+
if (!existsSync23(join30(root, h.configDir))) continue;
|
|
79436
|
+
const dir = join30(root, h.skillsDir);
|
|
79343
79437
|
mkdirSync8(dir, { recursive: true });
|
|
79344
79438
|
for (const slug2 of slugs) {
|
|
79345
|
-
linkOrCopy(
|
|
79439
|
+
linkOrCopy(join30(dir, slug2), join30(agentsSkillsDir, slug2));
|
|
79346
79440
|
projected++;
|
|
79347
79441
|
}
|
|
79348
79442
|
reconcileNamespaced(dir, keep);
|
|
@@ -79359,7 +79453,7 @@ function emitInputsFromManifest(erretaDir, manifestPath) {
|
|
|
79359
79453
|
title: s.title ?? s.id,
|
|
79360
79454
|
layer: s.layer ?? "technique",
|
|
79361
79455
|
confidence: s.confidence ?? 0,
|
|
79362
|
-
bodyPath:
|
|
79456
|
+
bodyPath: join30(erretaDir, s.file)
|
|
79363
79457
|
}));
|
|
79364
79458
|
} catch {
|
|
79365
79459
|
return [];
|
|
@@ -79373,7 +79467,7 @@ var GITIGNORE_LINES = [
|
|
|
79373
79467
|
".cursor/skills/errata-*/"
|
|
79374
79468
|
];
|
|
79375
79469
|
function ensureSkillGitignore(root) {
|
|
79376
|
-
const path2 =
|
|
79470
|
+
const path2 = join30(root, ".gitignore");
|
|
79377
79471
|
let current = "";
|
|
79378
79472
|
try {
|
|
79379
79473
|
current = existsSync23(path2) ? readFileSync24(path2, "utf8") : "";
|
|
@@ -79480,12 +79574,12 @@ init_profile2();
|
|
|
79480
79574
|
|
|
79481
79575
|
// src/witness-queue.ts
|
|
79482
79576
|
import { readFileSync as readFileSync25, renameSync as renameSync2, writeFileSync as writeFileSync18 } from "node:fs";
|
|
79483
|
-
import { dirname as dirname11, join as
|
|
79577
|
+
import { dirname as dirname11, join as join31 } from "node:path";
|
|
79484
79578
|
var WITNESS_QUEUE_CAP = 500;
|
|
79485
79579
|
var WITNESS_TTL_MS = 14 * 24 * 60 * 60 * 1e3;
|
|
79486
79580
|
var WITNESS_MAX_ATTEMPTS = 5;
|
|
79487
79581
|
function witnessQueuePath(workspaceConfigDir) {
|
|
79488
|
-
return
|
|
79582
|
+
return join31(workspaceConfigDir, "witness-queue.json");
|
|
79489
79583
|
}
|
|
79490
79584
|
function loadWitnessQueueWithLosses(path2) {
|
|
79491
79585
|
let raw2;
|
|
@@ -79503,7 +79597,7 @@ function loadWitnessQueueWithLosses(path2) {
|
|
|
79503
79597
|
}
|
|
79504
79598
|
function saveWitnessQueue(path2, queue) {
|
|
79505
79599
|
try {
|
|
79506
|
-
const tmp =
|
|
79600
|
+
const tmp = join31(dirname11(path2), `.${Date.now()}.witness-queue.tmp`);
|
|
79507
79601
|
writeFileSync18(tmp, JSON.stringify(queue), "utf8");
|
|
79508
79602
|
renameSync2(tmp, path2);
|
|
79509
79603
|
} catch {
|
|
@@ -79812,7 +79906,7 @@ function maybeFlushDigests() {
|
|
|
79812
79906
|
// src/liveness-watch.ts
|
|
79813
79907
|
init_src5();
|
|
79814
79908
|
import { readFileSync as readFileSync27, writeFileSync as writeFileSync20 } from "node:fs";
|
|
79815
|
-
import { join as
|
|
79909
|
+
import { join as join33 } from "node:path";
|
|
79816
79910
|
|
|
79817
79911
|
// src/loop-lag.ts
|
|
79818
79912
|
var HEARTBEAT_MS = 500;
|
|
@@ -79943,7 +80037,7 @@ function watchCensusLine(c = watchCensus(), now = Date.now()) {
|
|
|
79943
80037
|
var LIVENESS_WATCH_INTERVAL_MS = 60 * 60 * 1e3;
|
|
79944
80038
|
var ALARM_RENOTIFY_MS = 24 * 60 * 60 * 1e3;
|
|
79945
80039
|
function alarmStatePath(configDir) {
|
|
79946
|
-
return
|
|
80040
|
+
return join33(configDir, "liveness-alarms.json");
|
|
79947
80041
|
}
|
|
79948
80042
|
function loadAlarmState(configDir) {
|
|
79949
80043
|
try {
|
|
@@ -79982,22 +80076,22 @@ function createLivenessWatch(deps) {
|
|
|
79982
80076
|
const rows = evaluateMechanisms(deps.store, invocations);
|
|
79983
80077
|
const workspaceActive = invocations.has("capture") || invocations.has("render");
|
|
79984
80078
|
const bad = workspaceActive ? rows.filter((r) => hasStarvedMechanism([r])) : [];
|
|
79985
|
-
const
|
|
80079
|
+
const watch3 = watchCensus();
|
|
79986
80080
|
const pass = passState();
|
|
79987
80081
|
appendPassLedger(deps.configDir, "liveness-watch", Date.now() - started2, {
|
|
79988
80082
|
mechanisms: rows.length,
|
|
79989
80083
|
alarms: bad.length,
|
|
79990
80084
|
...Object.fromEntries(bad.map((r) => [`starved:${r.id}`, 1])),
|
|
79991
80085
|
...deps.witnessParked ? { witnessParked: deps.witnessParked() } : {},
|
|
79992
|
-
watchDispatched:
|
|
79993
|
-
watchEmitted:
|
|
79994
|
-
watchLogged:
|
|
79995
|
-
watchRejected:
|
|
80086
|
+
watchDispatched: watch3.dispatched,
|
|
80087
|
+
watchEmitted: watch3.emitted,
|
|
80088
|
+
watchLogged: watch3.logged,
|
|
80089
|
+
watchRejected: watch3.rejected,
|
|
79996
80090
|
// HZ-watch-breaker: a recycle count trending upward across hours is a
|
|
79997
80091
|
// handle that keeps wedging — the restart-survivable trace the 8-16
|
|
79998
80092
|
// phantom-rename storm never left.
|
|
79999
|
-
watchBreakerRecycles:
|
|
80000
|
-
watchBreakerQuarantined:
|
|
80093
|
+
watchBreakerRecycles: watch3.breakerRecycles,
|
|
80094
|
+
watchBreakerQuarantined: watch3.breakerQuarantined.length,
|
|
80001
80095
|
// Concurrency and the longest single holder — the two readings that
|
|
80002
80096
|
// named the 6017s zombie pass. A pass legitimately running for hours
|
|
80003
80097
|
// and one wedged forever look identical without a trend.
|
|
@@ -80124,7 +80218,7 @@ function createWatchBreaker(deps) {
|
|
|
80124
80218
|
}
|
|
80125
80219
|
|
|
80126
80220
|
// src/engine.ts
|
|
80127
|
-
var DAEMON_VERSION = true ? "2.0.8-dev.
|
|
80221
|
+
var DAEMON_VERSION = true ? "2.0.8-dev.2896" : "2.0.0-alpha.0";
|
|
80128
80222
|
var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
|
|
80129
80223
|
var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
|
|
80130
80224
|
var GIT_OP_MUTE_MS = 4e3;
|
|
@@ -80136,7 +80230,7 @@ var CODEX_SWEEP_LOOKBACK_MS = 10 * 6e4;
|
|
|
80136
80230
|
function appendIdentityAudit(path2, record2, line) {
|
|
80137
80231
|
if (!record2.accepted && record2.score <= 0) return;
|
|
80138
80232
|
try {
|
|
80139
|
-
if (existsSync25(path2) &&
|
|
80233
|
+
if (existsSync25(path2) && statSync8(path2).size >= IDENTITY_AUDIT_MAX_BYTES) {
|
|
80140
80234
|
renameSync3(path2, `${path2}.1`);
|
|
80141
80235
|
}
|
|
80142
80236
|
appendFileSync4(path2, line);
|
|
@@ -80194,7 +80288,7 @@ function gitSourceWatchTargets(root) {
|
|
|
80194
80288
|
["-C", root, "ls-files", "--others", "--ignored", "--exclude-standard", "--directory", "-z"],
|
|
80195
80289
|
{ encoding: "utf8", maxBuffer: 256 * 1024 * 1024, windowsHide: true, stdio: ["ignore", "pipe", "ignore"] }
|
|
80196
80290
|
);
|
|
80197
|
-
ignoredDirs = igOut.split("\0").filter(Boolean).map((d) => d.replace(/\/+$/, "")).filter((d) => !IGNORED_PATH.test(
|
|
80291
|
+
ignoredDirs = igOut.split("\0").filter(Boolean).map((d) => d.replace(/\/+$/, "")).filter((d) => !IGNORED_PATH.test(join34(root, d) + sep4));
|
|
80198
80292
|
} catch {
|
|
80199
80293
|
}
|
|
80200
80294
|
const hasIgnoredChild = (dir) => ignoredDirs.some((ig) => ig.startsWith(dir + "/"));
|
|
@@ -80206,19 +80300,19 @@ function gitSourceWatchTargets(root) {
|
|
|
80206
80300
|
if (!f.startsWith(prefix)) continue;
|
|
80207
80301
|
const rest2 = f.slice(prefix.length);
|
|
80208
80302
|
if (rest2.includes("/")) children.add(dir === "" ? rest2.slice(0, rest2.indexOf("/")) : dir + "/" + rest2.slice(0, rest2.indexOf("/")));
|
|
80209
|
-
else targets.add(
|
|
80303
|
+
else targets.add(join34(root, f));
|
|
80210
80304
|
}
|
|
80211
80305
|
for (const c of children) {
|
|
80212
|
-
if (IGNORED_PATH.test(
|
|
80306
|
+
if (IGNORED_PATH.test(join34(root, c) + sep4)) continue;
|
|
80213
80307
|
if (hasIgnoredChild(c)) addUnder(c);
|
|
80214
|
-
else targets.add(
|
|
80308
|
+
else targets.add(join34(root, c));
|
|
80215
80309
|
}
|
|
80216
80310
|
};
|
|
80217
80311
|
addUnder("");
|
|
80218
80312
|
if (targets.size > 0) return [...targets];
|
|
80219
80313
|
} catch {
|
|
80220
80314
|
}
|
|
80221
|
-
return readdirSync10(root, { withFileTypes: true }).filter((e) => e.isDirectory() && !IGNORED_PATH.test(
|
|
80315
|
+
return readdirSync10(root, { withFileTypes: true }).filter((e) => e.isDirectory() && !IGNORED_PATH.test(join34(root, String(e.name)) + sep4)).map((e) => join34(root, String(e.name)));
|
|
80222
80316
|
}
|
|
80223
80317
|
function createWorkspaceEngine(opts) {
|
|
80224
80318
|
const paths = workspacePaths(opts.workspaceRoot);
|
|
@@ -80278,12 +80372,10 @@ function createWorkspaceEngine(opts) {
|
|
|
80278
80372
|
let flushTimer = null;
|
|
80279
80373
|
if (!opts.skipWatchers) {
|
|
80280
80374
|
const watchTargets = gitSourceWatchTargets(opts.workspaceRoot);
|
|
80281
|
-
watcher =
|
|
80375
|
+
watcher = createSourceWatcher(watchTargets, {
|
|
80282
80376
|
// Still apply the ignore as defense-in-depth: nested node_modules inside a
|
|
80283
80377
|
// watched dir, and Windows-mangled store paths (IGNORED_NOISE), never reach us.
|
|
80284
|
-
ignored: (p) => IGNORED_PATH.test(p) || IGNORED_NOISE.test(p)
|
|
80285
|
-
ignoreInitial: true,
|
|
80286
|
-
persistent: true
|
|
80378
|
+
ignored: (p) => IGNORED_PATH.test(p) || IGNORED_NOISE.test(p)
|
|
80287
80379
|
});
|
|
80288
80380
|
noteWatcherOpened();
|
|
80289
80381
|
watchBreaker = createWatchBreaker({
|
|
@@ -80311,7 +80403,7 @@ function createWorkspaceEngine(opts) {
|
|
|
80311
80403
|
}
|
|
80312
80404
|
let size = 0;
|
|
80313
80405
|
try {
|
|
80314
|
-
size =
|
|
80406
|
+
size = statSync8(path2).size;
|
|
80315
80407
|
} catch {
|
|
80316
80408
|
}
|
|
80317
80409
|
lastActivityTs = Date.now();
|
|
@@ -80426,7 +80518,7 @@ function createWorkspaceEngine(opts) {
|
|
|
80426
80518
|
const srcPaths = diff.changedPaths.filter((p) => /\.(ts|tsx|js|jsx|mjs|cjs|py)$/i.test(p));
|
|
80427
80519
|
let episodeId2;
|
|
80428
80520
|
if (srcPaths.length > 0) {
|
|
80429
|
-
const abs = srcPaths.map((p) =>
|
|
80521
|
+
const abs = srcPaths.map((p) => join34(opts.workspaceRoot, p));
|
|
80430
80522
|
try {
|
|
80431
80523
|
const r = await runReindexPass(
|
|
80432
80524
|
`git-reindex:${profile.name} (${abs.length} files)`,
|
|
@@ -80462,7 +80554,7 @@ function createWorkspaceEngine(opts) {
|
|
|
80462
80554
|
`[errata] git: ${ev.kind} ${ev.newSha.slice(0, 7)} by ${meta3.authorName} \u2014 ${diff.changedPaths.length} file(s), ${diff.renames.length} rename(s)`
|
|
80463
80555
|
);
|
|
80464
80556
|
};
|
|
80465
|
-
const gitDir =
|
|
80557
|
+
const gitDir = join34(opts.workspaceRoot, ".git");
|
|
80466
80558
|
if (existsSync25(gitDir)) {
|
|
80467
80559
|
stopGit = startGitSensor(gitDir, (ev) => {
|
|
80468
80560
|
void handleGitEvent(ev).catch((err2) => {
|
|
@@ -80644,10 +80736,10 @@ function createWorkspaceEngine(opts) {
|
|
|
80644
80736
|
console.warn("[errata] render ledger failed:", err2.message?.slice(0, 120));
|
|
80645
80737
|
}
|
|
80646
80738
|
writeContextFile(opts.workspaceRoot, body2);
|
|
80647
|
-
const target =
|
|
80739
|
+
const target = join34(opts.workspaceRoot, "AGENTS.md");
|
|
80648
80740
|
writeManagedBlock(target, { body: AGENTS_POINTER_BODY, stable: true, force: true });
|
|
80649
80741
|
if (elicit) {
|
|
80650
|
-
writePrimingHandles(
|
|
80742
|
+
writePrimingHandles(join34(paths.configDir, "priming-handles.json"), [
|
|
80651
80743
|
...snapshot.recentProblems.map((r) => r.node),
|
|
80652
80744
|
// Resolved-band handles: the ✓ problem AND its Solution are citable
|
|
80653
80745
|
// (a fix tag on an already-resolved problem no-ops idempotently; the
|
|
@@ -80989,7 +81081,7 @@ function createWorkspaceEngine(opts) {
|
|
|
80989
81081
|
resultSummary: { exitCode: e.exitCode ?? 1, errorTokens: e.errorTokens }
|
|
80990
81082
|
});
|
|
80991
81083
|
};
|
|
80992
|
-
const turnCursorPath =
|
|
81084
|
+
const turnCursorPath = join34(paths.configDir, "turn-cursors.json");
|
|
80993
81085
|
const lastTurnUuid = loadTurnCursors(turnCursorPath);
|
|
80994
81086
|
const turnOffset = loadTurnOffsets(turnCursorPath);
|
|
80995
81087
|
const readLosses = { parseFailures: 0, ioFailures: 0, bytesUnreachable: 0, sliceGuardHits: 0 };
|
|
@@ -81044,7 +81136,7 @@ function createWorkspaceEngine(opts) {
|
|
|
81044
81136
|
let processedTurns = 0;
|
|
81045
81137
|
const seqAtStart = store.currentIngestSeq();
|
|
81046
81138
|
const elicit = isEdgeElicitationEnabled();
|
|
81047
|
-
const handleMap = elicit ? readPrimingHandles(
|
|
81139
|
+
const handleMap = elicit ? readPrimingHandles(join34(paths.configDir, "priming-handles.json")) : {};
|
|
81048
81140
|
const wsRoot = (opts.workspaceRoot ?? "").replace(/\\/g, "/");
|
|
81049
81141
|
const toRel = (abs) => {
|
|
81050
81142
|
const p = abs.replace(/\\/g, "/");
|
|
@@ -81336,10 +81428,10 @@ function createWorkspaceEngine(opts) {
|
|
|
81336
81428
|
let enclosing = {};
|
|
81337
81429
|
if (p.location?.line !== void 0) {
|
|
81338
81430
|
try {
|
|
81339
|
-
const headSha = readGitRefState(
|
|
81431
|
+
const headSha = readGitRefState(join34(opts.workspaceRoot, ".git")).sha ?? void 0;
|
|
81340
81432
|
enclosing = {
|
|
81341
81433
|
line: p.location.line,
|
|
81342
|
-
fileText: readFileSync28(
|
|
81434
|
+
fileText: readFileSync28(join34(opts.workspaceRoot, anchorPath), "utf8"),
|
|
81343
81435
|
...headSha ? { headSha } : {}
|
|
81344
81436
|
};
|
|
81345
81437
|
} catch {
|
|
@@ -82102,7 +82194,7 @@ B: ${b}`,
|
|
|
82102
82194
|
try {
|
|
82103
82195
|
const inputs = emitInputsFromManifest(paths.configDir, paths.skillsManifest);
|
|
82104
82196
|
emitAndProjectSkills(opts.workspaceRoot, inputs);
|
|
82105
|
-
writePrimingHandles(
|
|
82197
|
+
writePrimingHandles(join34(paths.configDir, "priming-handles.json"), skillHandleNodes(inputs));
|
|
82106
82198
|
} catch (err2) {
|
|
82107
82199
|
console.warn("[skills] agent-skills projection failed (non-fatal):", err2 instanceof Error ? err2.message : err2);
|
|
82108
82200
|
}
|
|
@@ -82605,7 +82697,7 @@ init_reconcile();
|
|
|
82605
82697
|
// src/lockfile-auto.ts
|
|
82606
82698
|
init_src();
|
|
82607
82699
|
import { existsSync as existsSync27, readFileSync as readFileSync29 } from "node:fs";
|
|
82608
|
-
import { join as
|
|
82700
|
+
import { join as join35 } from "node:path";
|
|
82609
82701
|
|
|
82610
82702
|
// src/package-index.ts
|
|
82611
82703
|
init_src();
|
|
@@ -82754,7 +82846,7 @@ function runLockfilePass(opts) {
|
|
|
82754
82846
|
{ file: "package-lock.json", parse: parsePackageLockJson }
|
|
82755
82847
|
];
|
|
82756
82848
|
for (const c of candidates) {
|
|
82757
|
-
const p =
|
|
82849
|
+
const p = join35(opts.root, c.file);
|
|
82758
82850
|
if (!existsSync27(p)) continue;
|
|
82759
82851
|
let sbom;
|
|
82760
82852
|
try {
|
|
@@ -82819,7 +82911,7 @@ init_profile2();
|
|
|
82819
82911
|
|
|
82820
82912
|
// src/public-symbols.ts
|
|
82821
82913
|
import { readFileSync as readFileSync30, readdirSync as readdirSync11, existsSync as existsSync28 } from "node:fs";
|
|
82822
|
-
import { join as
|
|
82914
|
+
import { join as join36 } from "node:path";
|
|
82823
82915
|
var HEAD_BYTES = 8 * 1024;
|
|
82824
82916
|
var INDEX_TTL_MS = 10 * 60 * 1e3;
|
|
82825
82917
|
var MIN_SYMBOL_LEN = 4;
|
|
@@ -82852,7 +82944,7 @@ function bindingNames(clause) {
|
|
|
82852
82944
|
function internalPackageNames(workspaceRoot) {
|
|
82853
82945
|
const names = /* @__PURE__ */ new Set();
|
|
82854
82946
|
const tryRead = (dir) => {
|
|
82855
|
-
const pj =
|
|
82947
|
+
const pj = join36(dir, "package.json");
|
|
82856
82948
|
if (!existsSync28(pj)) return;
|
|
82857
82949
|
try {
|
|
82858
82950
|
const name2 = JSON.parse(readFileSync30(pj, "utf8")).name;
|
|
@@ -82862,10 +82954,10 @@ function internalPackageNames(workspaceRoot) {
|
|
|
82862
82954
|
};
|
|
82863
82955
|
tryRead(workspaceRoot);
|
|
82864
82956
|
for (const group of ["packages", "apps"]) {
|
|
82865
|
-
const groupDir =
|
|
82957
|
+
const groupDir = join36(workspaceRoot, group);
|
|
82866
82958
|
if (!existsSync28(groupDir)) continue;
|
|
82867
82959
|
try {
|
|
82868
|
-
for (const entry of readdirSync11(groupDir)) tryRead(
|
|
82960
|
+
for (const entry of readdirSync11(groupDir)) tryRead(join36(groupDir, entry));
|
|
82869
82961
|
} catch {
|
|
82870
82962
|
}
|
|
82871
82963
|
}
|
|
@@ -82904,7 +82996,7 @@ function publicSymbolIndex(store, workspaceRoot, deps = {}) {
|
|
|
82904
82996
|
}
|
|
82905
82997
|
const symbols = /* @__PURE__ */ new Set();
|
|
82906
82998
|
for (const rel of files) {
|
|
82907
|
-
const head2 = readHead(
|
|
82999
|
+
const head2 = readHead(join36(workspaceRoot, rel));
|
|
82908
83000
|
if (!head2) continue;
|
|
82909
83001
|
for (const re of [NAMED_IMPORT_RE, REQUIRE_RE]) {
|
|
82910
83002
|
re.lastIndex = 0;
|
|
@@ -84341,7 +84433,7 @@ init_src7();
|
|
|
84341
84433
|
init_src();
|
|
84342
84434
|
import { execFile as execFile4 } from "node:child_process";
|
|
84343
84435
|
import { readFileSync as readFileSync32 } from "node:fs";
|
|
84344
|
-
import { join as
|
|
84436
|
+
import { join as join37 } from "node:path";
|
|
84345
84437
|
import { promisify as promisify2 } from "node:util";
|
|
84346
84438
|
|
|
84347
84439
|
// src/history-walk.ts
|
|
@@ -84493,6 +84585,57 @@ async function mergeSide(root, p1, p2) {
|
|
|
84493
84585
|
return { sha: sha2, parents };
|
|
84494
84586
|
});
|
|
84495
84587
|
}
|
|
84588
|
+
async function commitGraph(root, branch) {
|
|
84589
|
+
const out2 = await git(root, [...GIT_OPTS, "rev-list", "--parents", branch]);
|
|
84590
|
+
const graph = /* @__PURE__ */ new Map();
|
|
84591
|
+
for (const l of out2.split(/\r?\n/)) {
|
|
84592
|
+
const [sha2, ...parents] = l.trim().split(" ");
|
|
84593
|
+
if (sha2) graph.set(sha2, parents);
|
|
84594
|
+
}
|
|
84595
|
+
return graph;
|
|
84596
|
+
}
|
|
84597
|
+
function mergeSidesFromGraph(line, start2, graph) {
|
|
84598
|
+
const seen = /* @__PURE__ */ new Set();
|
|
84599
|
+
const reach = (from, into) => {
|
|
84600
|
+
const stack = [from];
|
|
84601
|
+
while (stack.length > 0) {
|
|
84602
|
+
const sha2 = stack.pop();
|
|
84603
|
+
if (seen.has(sha2) || into.has(sha2)) continue;
|
|
84604
|
+
into.add(sha2);
|
|
84605
|
+
for (const p of graph.get(sha2) ?? []) stack.push(p);
|
|
84606
|
+
}
|
|
84607
|
+
};
|
|
84608
|
+
if (start2 > 0) {
|
|
84609
|
+
const base = /* @__PURE__ */ new Set();
|
|
84610
|
+
reach(line[start2 - 1].sha, base);
|
|
84611
|
+
for (const sha2 of base) seen.add(sha2);
|
|
84612
|
+
}
|
|
84613
|
+
const sides = /* @__PURE__ */ new Map();
|
|
84614
|
+
for (let i2 = start2; i2 < line.length; i2++) {
|
|
84615
|
+
const { sha: sha2, parents } = line[i2];
|
|
84616
|
+
if (parents.length >= 2) {
|
|
84617
|
+
const side = /* @__PURE__ */ new Set();
|
|
84618
|
+
reach(parents[1], side);
|
|
84619
|
+
const chain2 = [];
|
|
84620
|
+
let at = side.has(parents[1]) ? parents[1] : void 0;
|
|
84621
|
+
let linear = true;
|
|
84622
|
+
while (at) {
|
|
84623
|
+
const ps = graph.get(at) ?? [];
|
|
84624
|
+
chain2.push({ sha: at, parents: [...ps] });
|
|
84625
|
+
const inSide = ps.filter((p) => side.has(p));
|
|
84626
|
+
if (inSide.length > 1) {
|
|
84627
|
+
linear = false;
|
|
84628
|
+
break;
|
|
84629
|
+
}
|
|
84630
|
+
at = inSide[0];
|
|
84631
|
+
}
|
|
84632
|
+
sides.set(sha2, linear && chain2.length === side.size ? chain2.reverse() : null);
|
|
84633
|
+
for (const s of side) seen.add(s);
|
|
84634
|
+
}
|
|
84635
|
+
seen.add(sha2);
|
|
84636
|
+
}
|
|
84637
|
+
return sides;
|
|
84638
|
+
}
|
|
84496
84639
|
async function tagsByCommit(root) {
|
|
84497
84640
|
const out2 = await git(root, [...GIT_OPTS, "for-each-ref", "--format=%(refname:short)%00%(objectname)%00%(*objectname)", "refs/tags"]);
|
|
84498
84641
|
const map2 = /* @__PURE__ */ new Map();
|
|
@@ -84521,8 +84664,10 @@ async function enumerateUnits(root, opts = {}) {
|
|
|
84521
84664
|
if (start2 >= line.length) return [];
|
|
84522
84665
|
const commits = await readCommitsBulk(root, branch, start2 > 0 ? line[start2 - 1].sha : null);
|
|
84523
84666
|
const commit = async (sha2) => commits.get(sha2) ?? await readCommit(root, sha2);
|
|
84524
|
-
const
|
|
84667
|
+
const fromGraph = mergeSidesFromGraph(line, start2, await commitGraph(root, branch));
|
|
84525
84668
|
const sides = /* @__PURE__ */ new Map();
|
|
84669
|
+
for (const [sha2, side] of fromGraph) if (side) sides.set(sha2, side);
|
|
84670
|
+
const merges = line.slice(start2).filter((c) => c.parents.length >= 2 && !sides.has(c.sha));
|
|
84526
84671
|
const sideLists = await mapBounded(merges, MERGE_SIDE_CONCURRENCY, (m) => mergeSide(root, m.parents[0], m.parents[1]));
|
|
84527
84672
|
merges.forEach((m, i2) => sides.set(m.sha, sideLists[i2]));
|
|
84528
84673
|
const units = [];
|
|
@@ -84729,7 +84874,7 @@ async function defaultGit(root, args2) {
|
|
|
84729
84874
|
function readIgnoreLines(root, profile) {
|
|
84730
84875
|
let lines = [];
|
|
84731
84876
|
try {
|
|
84732
|
-
lines = readFileSync32(
|
|
84877
|
+
lines = readFileSync32(join37(root, ".errataignore"), "utf8").split("\n");
|
|
84733
84878
|
} catch {
|
|
84734
84879
|
}
|
|
84735
84880
|
return [...lines, ...profile.ignoreExtra ?? []].map((l) => l.trim()).filter((l) => l && !l.startsWith("#"));
|
|
@@ -85152,7 +85297,7 @@ init_cloud_auth();
|
|
|
85152
85297
|
import { createHash as createHash16 } from "node:crypto";
|
|
85153
85298
|
import { execFileSync as execFileSync5 } from "node:child_process";
|
|
85154
85299
|
import { existsSync as existsSync30, writeFileSync as writeFileSync23 } from "node:fs";
|
|
85155
|
-
import { join as
|
|
85300
|
+
import { join as join38 } from "node:path";
|
|
85156
85301
|
|
|
85157
85302
|
// src/device-poll.ts
|
|
85158
85303
|
var THROTTLED_POLL_MIN_WAIT_MS = 11e3;
|
|
@@ -85610,7 +85755,7 @@ function applyLinkDecision(root, profile, config2, decision, now = Date.now) {
|
|
|
85610
85755
|
delete nextProfile.projectLinkHold;
|
|
85611
85756
|
let wroteIgnore = false;
|
|
85612
85757
|
if (decision.writeIgnoreStarter !== false) {
|
|
85613
|
-
const target =
|
|
85758
|
+
const target = join38(root, ".errataignore");
|
|
85614
85759
|
if (!existsSync30(target)) {
|
|
85615
85760
|
writeFileSync23(target, IGNORE_STARTER, "utf8");
|
|
85616
85761
|
wroteIgnore = true;
|
|
@@ -85626,11 +85771,11 @@ init_registry();
|
|
|
85626
85771
|
// src/adopt.ts
|
|
85627
85772
|
init_git_remote();
|
|
85628
85773
|
import { existsSync as existsSync31 } from "node:fs";
|
|
85629
|
-
import { dirname as dirname12, join as
|
|
85774
|
+
import { dirname as dirname12, join as join39 } from "node:path";
|
|
85630
85775
|
function findGitRoot(absPath) {
|
|
85631
85776
|
let dir = absPath;
|
|
85632
85777
|
for (let depth = 0; depth < 64; depth++) {
|
|
85633
|
-
if (existsSync31(
|
|
85778
|
+
if (existsSync31(join39(dir, ".git"))) return dir;
|
|
85634
85779
|
const parent = dirname12(dir);
|
|
85635
85780
|
if (parent === dir) return null;
|
|
85636
85781
|
dir = parent;
|
|
@@ -88014,15 +88159,15 @@ function shouldUseOAuthLogin(flags2, env2 = process.env) {
|
|
|
88014
88159
|
import { spawnSync } from "node:child_process";
|
|
88015
88160
|
|
|
88016
88161
|
// src/codex-runtime.ts
|
|
88017
|
-
import { readdirSync as readdirSync12, statSync as
|
|
88018
|
-
import { join as
|
|
88162
|
+
import { readdirSync as readdirSync12, statSync as statSync9 } from "node:fs";
|
|
88163
|
+
import { join as join40 } from "node:path";
|
|
88019
88164
|
function resolveCodexExecutable(options = {}) {
|
|
88020
88165
|
const platform = options.platform ?? process.platform;
|
|
88021
88166
|
const env2 = options.env ?? process.env;
|
|
88022
88167
|
if (platform !== "win32") return "codex";
|
|
88023
88168
|
const fileTime = (path2) => {
|
|
88024
88169
|
try {
|
|
88025
|
-
const s =
|
|
88170
|
+
const s = statSync9(path2);
|
|
88026
88171
|
return s.isFile() ? s.mtimeMs : null;
|
|
88027
88172
|
} catch {
|
|
88028
88173
|
return null;
|
|
@@ -88030,13 +88175,13 @@ function resolveCodexExecutable(options = {}) {
|
|
|
88030
88175
|
};
|
|
88031
88176
|
for (const dir of (env2["PATH"] ?? env2["Path"] ?? "").split(";")) {
|
|
88032
88177
|
if (!dir.trim()) continue;
|
|
88033
|
-
const path2 =
|
|
88178
|
+
const path2 = join40(dir.trim().replace(/^"|"$/g, ""), "codex.exe");
|
|
88034
88179
|
if (fileTime(path2) !== null) return path2;
|
|
88035
88180
|
}
|
|
88036
88181
|
if (!env2["LOCALAPPDATA"]) return "codex";
|
|
88037
|
-
const root =
|
|
88182
|
+
const root = join40(env2["LOCALAPPDATA"], "OpenAI", "Codex", "bin");
|
|
88038
88183
|
try {
|
|
88039
|
-
const candidates = readdirSync12(root, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) =>
|
|
88184
|
+
const candidates = readdirSync12(root, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => join40(root, entry.name, "codex.exe")).map((path2) => ({ path: path2, mtime: fileTime(path2) })).filter((candidate) => candidate.mtime !== null).sort((a, b) => b.mtime - a.mtime || a.path.localeCompare(b.path));
|
|
88040
88185
|
return candidates[0]?.path ?? "codex";
|
|
88041
88186
|
} catch {
|
|
88042
88187
|
return "codex";
|
|
@@ -88157,7 +88302,7 @@ import { createInterface } from "node:readline";
|
|
|
88157
88302
|
// src/codex-hooks.ts
|
|
88158
88303
|
import { existsSync as existsSync33, mkdirSync as mkdirSync9, readFileSync as readFileSync34, writeFileSync as writeFileSync25 } from "node:fs";
|
|
88159
88304
|
import { homedir as homedir7 } from "node:os";
|
|
88160
|
-
import { join as
|
|
88305
|
+
import { join as join41 } from "node:path";
|
|
88161
88306
|
|
|
88162
88307
|
// src/hook-commands.ts
|
|
88163
88308
|
function hookCurlCommand(port, path2 = "/api/hook") {
|
|
@@ -88233,8 +88378,8 @@ try {
|
|
|
88233
88378
|
|
|
88234
88379
|
// src/codex-hooks.ts
|
|
88235
88380
|
var CODEX_HOOK_REVIEW_HELP = "Codex desktop: Settings > Hooks, select this project, expand each event and Trust the Errata hook. CLI users can use /hooks.";
|
|
88236
|
-
function hasCodexConfig(root, codexHome = process.env["CODEX_HOME"] ||
|
|
88237
|
-
return existsSync33(
|
|
88381
|
+
function hasCodexConfig(root, codexHome = process.env["CODEX_HOME"] || join41(homedir7(), ".codex")) {
|
|
88382
|
+
return existsSync33(join41(root, ".codex")) || existsSync33(codexHome);
|
|
88238
88383
|
}
|
|
88239
88384
|
function replaceCodexHooks(existing, block) {
|
|
88240
88385
|
const begin = existing.indexOf(CODEX_HOOKS_BEGIN);
|
|
@@ -88250,12 +88395,12 @@ function replaceCodexHooks(existing, block) {
|
|
|
88250
88395
|
return existing.trimEnd() + (existing.trim() ? "\n\n" : "") + block;
|
|
88251
88396
|
}
|
|
88252
88397
|
function writeCodexHooks(root, port, nodePath = process.execPath) {
|
|
88253
|
-
const dir =
|
|
88254
|
-
const file2 =
|
|
88255
|
-
const relay =
|
|
88398
|
+
const dir = join41(root, ".codex");
|
|
88399
|
+
const file2 = join41(dir, "config.toml");
|
|
88400
|
+
const relay = join41(dir, "hooks", "errata-relay.mjs");
|
|
88256
88401
|
const block = buildCodexHooksToml(port, { nodePath, relayPath: relay });
|
|
88257
88402
|
const final = replaceCodexHooks(existsSync33(file2) ? readFileSync34(file2, "utf8") : "", block);
|
|
88258
|
-
mkdirSync9(
|
|
88403
|
+
mkdirSync9(join41(dir, "hooks"), { recursive: true });
|
|
88259
88404
|
writeFileSync25(relay, CODEX_RELAY_SOURCE, "utf8");
|
|
88260
88405
|
writeFileSync25(file2, final, "utf8");
|
|
88261
88406
|
return file2;
|
|
@@ -88422,7 +88567,7 @@ function consolidationGapMs(lastPassMs, policy) {
|
|
|
88422
88567
|
|
|
88423
88568
|
// src/claude-statusline.ts
|
|
88424
88569
|
import { mkdirSync as mkdirSync10, writeFileSync as writeFileSync26 } from "node:fs";
|
|
88425
|
-
import { join as
|
|
88570
|
+
import { join as join42 } from "node:path";
|
|
88426
88571
|
var STATUSLINE_RELAY_SOURCE = String.raw`// errata-managed: regenerated by errata install-hooks claude
|
|
88427
88572
|
import { readFileSync } from 'node:fs';
|
|
88428
88573
|
|
|
@@ -88451,8 +88596,8 @@ function isErrataStatusLine(value) {
|
|
|
88451
88596
|
}
|
|
88452
88597
|
function installStatusLine(settings, root, port, nodePath = process.execPath) {
|
|
88453
88598
|
if (settings["statusLine"] !== void 0 && !isErrataStatusLine(settings["statusLine"])) return false;
|
|
88454
|
-
const dir =
|
|
88455
|
-
const relay =
|
|
88599
|
+
const dir = join42(root, ".claude", "hooks");
|
|
88600
|
+
const relay = join42(dir, STATUSLINE_RELAY_FILE);
|
|
88456
88601
|
mkdirSync10(dir, { recursive: true });
|
|
88457
88602
|
writeFileSync26(relay, STATUSLINE_RELAY_SOURCE, "utf8");
|
|
88458
88603
|
settings["statusLine"] = buildStatusLine(port, nodePath, relay);
|
|
@@ -88865,13 +89010,13 @@ async function cmdInit() {
|
|
|
88865
89010
|
console.log("");
|
|
88866
89011
|
console.log("installing harness hooks...");
|
|
88867
89012
|
const { existsSync: existsSync35 } = await import("node:fs");
|
|
88868
|
-
const { join:
|
|
89013
|
+
const { join: join44 } = await import("node:path");
|
|
88869
89014
|
try {
|
|
88870
89015
|
await installClaudeHooks(port);
|
|
88871
89016
|
} catch (err2) {
|
|
88872
89017
|
console.warn(` \u26A0\uFE0F Claude hook install failed: ${err2 instanceof Error ? err2.message : err2}`);
|
|
88873
89018
|
}
|
|
88874
|
-
if (existsSync35(
|
|
89019
|
+
if (existsSync35(join44(ROOT, ".cursor"))) {
|
|
88875
89020
|
try {
|
|
88876
89021
|
await installCursorMcpConfig();
|
|
88877
89022
|
} catch (err2) {
|
|
@@ -90758,8 +90903,8 @@ async function cmdReport(args2) {
|
|
|
90758
90903
|
const outDir = workspacePaths(ROOT).configDir;
|
|
90759
90904
|
mkdirSync11(outDir, { recursive: true });
|
|
90760
90905
|
const files = renderReport2(data, { includeFutureVerbs });
|
|
90761
|
-
for (const f of files) writeFileSync27(
|
|
90762
|
-
const indexPath =
|
|
90906
|
+
for (const f of files) writeFileSync27(join43(outDir, f.name), f.html, "utf8");
|
|
90907
|
+
const indexPath = join43(outDir, "report.html");
|
|
90763
90908
|
console.log(`report \u2192 ${indexPath}`);
|
|
90764
90909
|
console.log(
|
|
90765
90910
|
` ${data.repos.length} repo(s) \xB7 ${files.length} file(s) \xB7 ${data.rollup.nodes.toLocaleString("en-US")} nodes`
|
|
@@ -90814,7 +90959,7 @@ function spawnDaemonDetached(options = {}) {
|
|
|
90814
90959
|
try {
|
|
90815
90960
|
const logPath = daemonLogPath();
|
|
90816
90961
|
try {
|
|
90817
|
-
if (
|
|
90962
|
+
if (statSync10(logPath).size > 5 * 1024 * 1024) renameSync4(logPath, `${logPath}.1`);
|
|
90818
90963
|
} catch {
|
|
90819
90964
|
}
|
|
90820
90965
|
out2 = openSync2(logPath, "a");
|
|
@@ -90880,10 +91025,10 @@ async function cmdInstallHooks(args2) {
|
|
|
90880
91025
|
}
|
|
90881
91026
|
async function installOpencodePlugin(port) {
|
|
90882
91027
|
const { mkdirSync: mkdirSync11, existsSync: existsSync35, readFileSync: readFileSync36, writeFileSync: writeFileSync27 } = await import("node:fs");
|
|
90883
|
-
const { join:
|
|
90884
|
-
const dir =
|
|
91028
|
+
const { join: join44 } = await import("node:path");
|
|
91029
|
+
const dir = join44(ROOT, ".opencode", "plugin");
|
|
90885
91030
|
if (!existsSync35(dir)) mkdirSync11(dir, { recursive: true });
|
|
90886
|
-
const file2 =
|
|
91031
|
+
const file2 = join44(dir, "inerrata.js");
|
|
90887
91032
|
if (existsSync35(file2)) {
|
|
90888
91033
|
const head2 = readFileSync36(file2, "utf8").split("\n")[0] ?? "";
|
|
90889
91034
|
if (head2.trim() !== OPENCODE_PLUGIN_MARKER) {
|
|
@@ -90892,7 +91037,7 @@ async function installOpencodePlugin(port) {
|
|
|
90892
91037
|
}
|
|
90893
91038
|
}
|
|
90894
91039
|
writeFileSync27(file2, buildOpencodePluginSource(port, { version: DAEMON_VERSION }), "utf8");
|
|
90895
|
-
const cfgFile =
|
|
91040
|
+
const cfgFile = join44(ROOT, "opencode.json");
|
|
90896
91041
|
let cfg = { $schema: "https://opencode.ai/config.json" };
|
|
90897
91042
|
if (existsSync35(cfgFile)) {
|
|
90898
91043
|
try {
|
|
@@ -90928,10 +91073,10 @@ function errataMcpInvocation() {
|
|
|
90928
91073
|
}
|
|
90929
91074
|
async function installClaudeHooks(port) {
|
|
90930
91075
|
const { mkdirSync: mkdirSync11, existsSync: existsSync35, readFileSync: readFileSync36, writeFileSync: writeFileSync27 } = await import("node:fs");
|
|
90931
|
-
const { join:
|
|
90932
|
-
const dir =
|
|
91076
|
+
const { join: join44 } = await import("node:path");
|
|
91077
|
+
const dir = join44(ROOT, ".claude");
|
|
90933
91078
|
if (!existsSync35(dir)) mkdirSync11(dir, { recursive: true });
|
|
90934
|
-
const file2 =
|
|
91079
|
+
const file2 = join44(dir, "settings.json");
|
|
90935
91080
|
let settings = {};
|
|
90936
91081
|
if (existsSync35(file2)) {
|
|
90937
91082
|
try {
|
|
@@ -90985,7 +91130,7 @@ async function installClaudeHooks(port) {
|
|
|
90985
91130
|
const { homedir: homedir8 } = await import("node:os");
|
|
90986
91131
|
let userStatusLine;
|
|
90987
91132
|
try {
|
|
90988
|
-
userStatusLine = JSON.parse(readFileSync36(
|
|
91133
|
+
userStatusLine = JSON.parse(readFileSync36(join44(homedir8(), ".claude", "settings.json"), "utf8"))["statusLine"];
|
|
90989
91134
|
} catch {
|
|
90990
91135
|
}
|
|
90991
91136
|
const statusLineInstalled = (userStatusLine === void 0 || isErrataStatusLine(userStatusLine)) && installStatusLine(settings, ROOT, port);
|
|
@@ -90995,7 +91140,7 @@ async function installClaudeHooks(port) {
|
|
|
90995
91140
|
statusLineInstalled ? " status line: errata recall card in colour (daemon env ERRATA_RECALL_CARD=off hides the cards)" : " status line: kept your own \u2014 errata's recall card shows inline only"
|
|
90996
91141
|
);
|
|
90997
91142
|
await installClaudeMcpConfig();
|
|
90998
|
-
const claudeMd =
|
|
91143
|
+
const claudeMd = join44(ROOT, "CLAUDE.md");
|
|
90999
91144
|
const recall = writeManagedBlock(claudeMd, { body: RECALL_FIRST_BLOCK });
|
|
91000
91145
|
if (recall.kind === "collision") {
|
|
91001
91146
|
console.warn(
|
|
@@ -91008,8 +91153,8 @@ async function installClaudeHooks(port) {
|
|
|
91008
91153
|
}
|
|
91009
91154
|
async function installClaudeMcpConfig() {
|
|
91010
91155
|
const { mkdirSync: mkdirSync11, existsSync: existsSync35, readFileSync: readFileSync36, writeFileSync: writeFileSync27 } = await import("node:fs");
|
|
91011
|
-
const { join:
|
|
91012
|
-
const file2 =
|
|
91156
|
+
const { join: join44, dirname: dirname13 } = await import("node:path");
|
|
91157
|
+
const file2 = join44(ROOT, ".mcp.json");
|
|
91013
91158
|
const dir = dirname13(file2);
|
|
91014
91159
|
if (!existsSync35(dir)) mkdirSync11(dir, { recursive: true });
|
|
91015
91160
|
let cfg = {};
|
|
@@ -91030,10 +91175,10 @@ async function installClaudeMcpConfig() {
|
|
|
91030
91175
|
}
|
|
91031
91176
|
async function installCursorMcpConfig() {
|
|
91032
91177
|
const { mkdirSync: mkdirSync11, existsSync: existsSync35, readFileSync: readFileSync36, writeFileSync: writeFileSync27 } = await import("node:fs");
|
|
91033
|
-
const { join:
|
|
91034
|
-
const dir =
|
|
91178
|
+
const { join: join44 } = await import("node:path");
|
|
91179
|
+
const dir = join44(ROOT, ".cursor");
|
|
91035
91180
|
if (!existsSync35(dir)) mkdirSync11(dir, { recursive: true });
|
|
91036
|
-
const file2 =
|
|
91181
|
+
const file2 = join44(dir, "mcp.json");
|
|
91037
91182
|
let cfg = {};
|
|
91038
91183
|
if (existsSync35(file2)) {
|
|
91039
91184
|
try {
|
|
@@ -91056,7 +91201,7 @@ async function installCodexHooks(port) {
|
|
|
91056
91201
|
const gitRoot = nearestGitRoot(process.cwd());
|
|
91057
91202
|
const hookRoot = gitRoot && mainCheckoutOfWorktree(gitRoot) ? gitRoot : ROOT;
|
|
91058
91203
|
const file2 = writeCodexHooks(hookRoot, port);
|
|
91059
|
-
const instructions = writeManagedBlock(
|
|
91204
|
+
const instructions = writeManagedBlock(join43(hookRoot, "AGENTS.md"), {
|
|
91060
91205
|
body: AGENTS_POINTER_BODY,
|
|
91061
91206
|
stable: true
|
|
91062
91207
|
});
|
|
@@ -91460,7 +91605,7 @@ async function cmdDash(args2) {
|
|
|
91460
91605
|
await yieldToLoop2();
|
|
91461
91606
|
try {
|
|
91462
91607
|
const items = selectDurableMemory(handle2.sharedStore, r.engine.profile);
|
|
91463
|
-
const res = bleedRules(
|
|
91608
|
+
const res = bleedRules(join43(r.root, ".claude", "rules"), items);
|
|
91464
91609
|
if (res.written || res.pruned) {
|
|
91465
91610
|
console.log(
|
|
91466
91611
|
`[rules:${r.entry.name}] ${res.written} collective principle(s) \u2192 .claude/rules` + (res.pruned ? `, ${res.pruned} pruned` : "")
|