@inerrata-corporation/errata 2.0.17-dev.3564 → 2.0.17-dev.3576
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 +374 -205
- package/package.json +1 -1
- package/pass-worker.mjs +54 -33
- package/resources/claude-mods/errata-minimap/.claude-plugin/plugin.json +7 -0
- package/resources/claude-mods/errata-minimap/hooks/hooks.json +1 -0
- package/resources/claude-mods/errata-minimap/hooks/minimap.ts +632 -0
- package/resources/claude-mods/errata-minimap/hooks/register.tsx +484 -0
- package/resources/claude-mods/errata-minimap/tsconfig.json +3 -0
- package/resources/claude-mods/errata-minimap/types/index.d.ts +74 -0
package/errata.mjs
CHANGED
|
@@ -960,7 +960,7 @@ function lemma(token) {
|
|
|
960
960
|
}
|
|
961
961
|
return token;
|
|
962
962
|
}
|
|
963
|
-
function tokenize(text,
|
|
963
|
+
function tokenize(text, resolve10) {
|
|
964
964
|
const matches = text.normalize("NFC").toLowerCase().match(TOKEN_RE) ?? [];
|
|
965
965
|
const out2 = /* @__PURE__ */ new Set();
|
|
966
966
|
for (const raw2 of matches) {
|
|
@@ -970,7 +970,7 @@ function tokenize(text, resolve9) {
|
|
|
970
970
|
out2.add(token);
|
|
971
971
|
continue;
|
|
972
972
|
}
|
|
973
|
-
const canonical =
|
|
973
|
+
const canonical = resolve10(token);
|
|
974
974
|
out2.add(canonical ?? lemma(token));
|
|
975
975
|
}
|
|
976
976
|
return [...out2].sort();
|
|
@@ -2302,8 +2302,8 @@ var init_regexes = __esm({
|
|
|
2302
2302
|
_emoji = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
|
|
2303
2303
|
ipv4 = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
|
|
2304
2304
|
ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;
|
|
2305
|
-
mac = (
|
|
2306
|
-
const escapedDelim = escapeRegex(
|
|
2305
|
+
mac = (delimiter3) => {
|
|
2306
|
+
const escapedDelim = escapeRegex(delimiter3 ?? ":");
|
|
2307
2307
|
return new RegExp(`^(?:[0-9A-F]{2}${escapedDelim}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${escapedDelim}){5}[0-9a-f]{2}$`);
|
|
2308
2308
|
};
|
|
2309
2309
|
cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/;
|
|
@@ -17754,8 +17754,8 @@ ${endMarker}
|
|
|
17754
17754
|
const startM = current.match(START_RE);
|
|
17755
17755
|
const endM = current.match(END_RE);
|
|
17756
17756
|
if (!startM || !endM || startM.index === void 0 || endM.index === void 0) {
|
|
17757
|
-
const
|
|
17758
|
-
writeFileSync(filePath, `${current}${
|
|
17757
|
+
const sep6 = current.endsWith("\n") ? "" : "\n";
|
|
17758
|
+
writeFileSync(filePath, `${current}${sep6}
|
|
17759
17759
|
${blockText}`, "utf8");
|
|
17760
17760
|
return { kind: "created", newHash };
|
|
17761
17761
|
}
|
|
@@ -22314,20 +22314,13 @@ var init_intent = __esm({
|
|
|
22314
22314
|
function isLegacyAnchor(attrs) {
|
|
22315
22315
|
return attrs?.["captureTime"] === true && attrs["anchorProvenance"] === void 0;
|
|
22316
22316
|
}
|
|
22317
|
-
function
|
|
22318
|
-
const report = {
|
|
22319
|
-
repaired: [],
|
|
22320
|
-
retiredGuesses: 0,
|
|
22321
|
-
noPathNamed: 0,
|
|
22322
|
-
pathUnknown: 0,
|
|
22323
|
-
alreadyCorrect: 0
|
|
22324
|
-
};
|
|
22317
|
+
function filePathResolver(store) {
|
|
22325
22318
|
const byPath = /* @__PURE__ */ new Map();
|
|
22326
22319
|
for (const f of store.findNodesByLabel("File")) {
|
|
22327
22320
|
const path2 = String(f.attrs["relPath"] ?? f.description ?? "");
|
|
22328
22321
|
if (path2) byPath.set(path2, { id: f.id, path: path2 });
|
|
22329
22322
|
}
|
|
22330
|
-
|
|
22323
|
+
return (named) => {
|
|
22331
22324
|
const exact = byPath.get(named);
|
|
22332
22325
|
if (exact) return exact;
|
|
22333
22326
|
const hits = [...byPath.values()].filter(
|
|
@@ -22335,6 +22328,40 @@ function repairLegacyAnchorsFromStatement(store, ts) {
|
|
|
22335
22328
|
);
|
|
22336
22329
|
return hits.length === 1 ? hits[0] : null;
|
|
22337
22330
|
};
|
|
22331
|
+
}
|
|
22332
|
+
function statementTarget(statement, resolvePath2) {
|
|
22333
|
+
for (const m of statement.matchAll(STATEMENT_PATH_RE)) {
|
|
22334
|
+
const f = resolvePath2(m[0]);
|
|
22335
|
+
if (f) return f;
|
|
22336
|
+
}
|
|
22337
|
+
return null;
|
|
22338
|
+
}
|
|
22339
|
+
function restatedAnchor(problemId, fileId, restatedFrom, ts) {
|
|
22340
|
+
return {
|
|
22341
|
+
id: `edge_${digest({ from: problemId, type: "ANCHORED_AT", to: fileId })}`.slice(0, 24),
|
|
22342
|
+
from: problemId,
|
|
22343
|
+
to: fileId,
|
|
22344
|
+
type: "ANCHORED_AT",
|
|
22345
|
+
// Same confidence a capture-time anchor enters at: the source is the
|
|
22346
|
+
// agent's own statement either way, only the moment of reading differs.
|
|
22347
|
+
confidence: 0.4,
|
|
22348
|
+
extractionSource: "agent-observed",
|
|
22349
|
+
createdAt: ts,
|
|
22350
|
+
lastSeenAt: ts,
|
|
22351
|
+
navSuccesses: 0,
|
|
22352
|
+
navFailures: 0,
|
|
22353
|
+
attrs: { anchorProvenance: "restated", restatedFrom, restatedAt: ts }
|
|
22354
|
+
};
|
|
22355
|
+
}
|
|
22356
|
+
function repairLegacyAnchorsFromStatement(store, ts) {
|
|
22357
|
+
const report = {
|
|
22358
|
+
repaired: [],
|
|
22359
|
+
retiredGuesses: 0,
|
|
22360
|
+
noPathNamed: 0,
|
|
22361
|
+
pathUnknown: 0,
|
|
22362
|
+
alreadyCorrect: 0
|
|
22363
|
+
};
|
|
22364
|
+
const resolvePath2 = filePathResolver(store);
|
|
22338
22365
|
for (const p of store.findNodesByLabel("Problem")) {
|
|
22339
22366
|
try {
|
|
22340
22367
|
const anchors = store.outEdges(p.id, ["ANCHORED_AT"]);
|
|
@@ -22374,25 +22401,7 @@ function repairLegacyAnchorsFromStatement(store, ts) {
|
|
|
22374
22401
|
report.pathUnknown++;
|
|
22375
22402
|
continue;
|
|
22376
22403
|
}
|
|
22377
|
-
store.mergeEdge(
|
|
22378
|
-
id: `edge_${digest({ from: p.id, type: "ANCHORED_AT", to: target.id })}`.slice(0, 24),
|
|
22379
|
-
from: p.id,
|
|
22380
|
-
to: target.id,
|
|
22381
|
-
type: "ANCHORED_AT",
|
|
22382
|
-
// Same confidence a capture-time anchor enters at: the source is the
|
|
22383
|
-
// agent's own statement either way, only the moment of reading differs.
|
|
22384
|
-
confidence: 0.4,
|
|
22385
|
-
extractionSource: "agent-observed",
|
|
22386
|
-
createdAt: ts,
|
|
22387
|
-
lastSeenAt: ts,
|
|
22388
|
-
navSuccesses: 0,
|
|
22389
|
-
navFailures: 0,
|
|
22390
|
-
attrs: {
|
|
22391
|
-
anchorProvenance: "restated",
|
|
22392
|
-
restatedFrom: guessedPaths[0] ?? "",
|
|
22393
|
-
restatedAt: ts
|
|
22394
|
-
}
|
|
22395
|
-
});
|
|
22404
|
+
store.mergeEdge(restatedAnchor(p.id, target.id, guessedPaths[0] ?? "", ts));
|
|
22396
22405
|
for (const e of legacy) {
|
|
22397
22406
|
if (e.to !== target.id) store.closeEdge(e.id, ts);
|
|
22398
22407
|
}
|
|
@@ -22412,23 +22421,35 @@ function backfillLegacyAnchors(store, ts) {
|
|
|
22412
22421
|
const report = {
|
|
22413
22422
|
demotedEdges: 0,
|
|
22414
22423
|
demotedProblems: 0,
|
|
22424
|
+
restatedProblems: 0,
|
|
22415
22425
|
labeledEdges: 0,
|
|
22416
22426
|
suspects: []
|
|
22417
22427
|
};
|
|
22428
|
+
let resolvePath2;
|
|
22418
22429
|
for (const p of store.findNodesByLabel("Problem")) {
|
|
22419
|
-
const legacy = store.outEdges(p.id, ["ANCHORED_AT"]).filter((e) => isLegacyAnchor(e.attrs));
|
|
22420
|
-
if (legacy.length === 0) continue;
|
|
22421
22430
|
const resolved = p.attrs["resolvedAt"] !== void 0;
|
|
22431
|
+
const legacy = store.outEdges(p.id, ["ANCHORED_AT"]).filter((e) => isLegacyAnchor(e.attrs) || !resolved && e.attrs?.["anchorProvenance"] === "legacy");
|
|
22432
|
+
if (legacy.length === 0) continue;
|
|
22422
22433
|
try {
|
|
22423
22434
|
if (!resolved) {
|
|
22424
|
-
|
|
22435
|
+
resolvePath2 ??= filePathResolver(store);
|
|
22436
|
+
const target = statementTarget(String(p.description ?? ""), resolvePath2);
|
|
22437
|
+
if (target) {
|
|
22438
|
+
const guessed = store.getNode(legacy[0].to);
|
|
22439
|
+
store.mergeEdge(
|
|
22440
|
+
restatedAnchor(p.id, target.id, String(guessed?.attrs["relPath"] ?? guessed?.description ?? ""), ts)
|
|
22441
|
+
);
|
|
22442
|
+
report.restatedProblems++;
|
|
22443
|
+
}
|
|
22444
|
+
const retired = legacy.filter((e) => !(target && e.to === target.id));
|
|
22445
|
+
for (const e of retired) {
|
|
22425
22446
|
const file2 = store.getNode(e.to);
|
|
22426
22447
|
const path2 = String(file2?.attrs["relPath"] ?? file2?.description ?? "");
|
|
22427
22448
|
if (path2) recordAnchorHint(store, p.id, path2, "legacy", ts);
|
|
22428
|
-
store.
|
|
22449
|
+
store.closeEdge(e.id, ts);
|
|
22429
22450
|
report.demotedEdges++;
|
|
22430
22451
|
}
|
|
22431
|
-
report.demotedProblems++;
|
|
22452
|
+
if (retired.length > 0) report.demotedProblems++;
|
|
22432
22453
|
continue;
|
|
22433
22454
|
}
|
|
22434
22455
|
for (const e of legacy) {
|
|
@@ -36897,13 +36918,13 @@ async function Module2(moduleArg = {}) {
|
|
|
36897
36918
|
}
|
|
36898
36919
|
readAsync = /* @__PURE__ */ __name(async (url2) => {
|
|
36899
36920
|
if (isFileURI(url2)) {
|
|
36900
|
-
return new Promise((
|
|
36921
|
+
return new Promise((resolve10, reject) => {
|
|
36901
36922
|
var xhr = new XMLHttpRequest();
|
|
36902
36923
|
xhr.open("GET", url2, true);
|
|
36903
36924
|
xhr.responseType = "arraybuffer";
|
|
36904
36925
|
xhr.onload = () => {
|
|
36905
36926
|
if (xhr.status == 200 || xhr.status == 0 && xhr.response) {
|
|
36906
|
-
|
|
36927
|
+
resolve10(xhr.response);
|
|
36907
36928
|
return;
|
|
36908
36929
|
}
|
|
36909
36930
|
reject(xhr.status);
|
|
@@ -37099,9 +37120,9 @@ async function Module2(moduleArg = {}) {
|
|
|
37099
37120
|
__name(receiveInstantiationResult, "receiveInstantiationResult");
|
|
37100
37121
|
var info2 = getWasmImports();
|
|
37101
37122
|
if (Module["instantiateWasm"]) {
|
|
37102
|
-
return new Promise((
|
|
37123
|
+
return new Promise((resolve10, reject) => {
|
|
37103
37124
|
Module["instantiateWasm"](info2, (mod, inst) => {
|
|
37104
|
-
|
|
37125
|
+
resolve10(receiveInstance(mod, inst));
|
|
37105
37126
|
});
|
|
37106
37127
|
});
|
|
37107
37128
|
}
|
|
@@ -38432,8 +38453,8 @@ async function Module2(moduleArg = {}) {
|
|
|
38432
38453
|
if (runtimeInitialized) {
|
|
38433
38454
|
moduleRtn = Module;
|
|
38434
38455
|
} else {
|
|
38435
|
-
moduleRtn = new Promise((
|
|
38436
|
-
readyPromiseResolve =
|
|
38456
|
+
moduleRtn = new Promise((resolve10, reject) => {
|
|
38457
|
+
readyPromiseResolve = resolve10;
|
|
38437
38458
|
readyPromiseReject = reject;
|
|
38438
38459
|
});
|
|
38439
38460
|
}
|
|
@@ -43759,7 +43780,7 @@ async function findStaleFiles(store, rootPath, workspaceId2) {
|
|
|
43759
43780
|
}
|
|
43760
43781
|
if (++scanned % SCAN_YIELD_EVERY === 0) {
|
|
43761
43782
|
check2();
|
|
43762
|
-
await new Promise((
|
|
43783
|
+
await new Promise((resolve10) => setImmediate(resolve10));
|
|
43763
43784
|
}
|
|
43764
43785
|
}
|
|
43765
43786
|
check2();
|
|
@@ -56598,9 +56619,9 @@ var require_dispatcher_base = __commonJS({
|
|
|
56598
56619
|
}
|
|
56599
56620
|
close(callback) {
|
|
56600
56621
|
if (callback === void 0) {
|
|
56601
|
-
return new Promise((
|
|
56622
|
+
return new Promise((resolve10, reject) => {
|
|
56602
56623
|
this.close((err2, data) => {
|
|
56603
|
-
return err2 ? reject(err2) :
|
|
56624
|
+
return err2 ? reject(err2) : resolve10(data);
|
|
56604
56625
|
});
|
|
56605
56626
|
});
|
|
56606
56627
|
}
|
|
@@ -56638,12 +56659,12 @@ var require_dispatcher_base = __commonJS({
|
|
|
56638
56659
|
err2 = null;
|
|
56639
56660
|
}
|
|
56640
56661
|
if (callback === void 0) {
|
|
56641
|
-
return new Promise((
|
|
56662
|
+
return new Promise((resolve10, reject) => {
|
|
56642
56663
|
this.destroy(err2, (err3, data) => {
|
|
56643
56664
|
return err3 ? (
|
|
56644
56665
|
/* istanbul ignore next: should never error */
|
|
56645
56666
|
reject(err3)
|
|
56646
|
-
) :
|
|
56667
|
+
) : resolve10(data);
|
|
56647
56668
|
});
|
|
56648
56669
|
});
|
|
56649
56670
|
}
|
|
@@ -58910,8 +58931,8 @@ var require_util2 = __commonJS({
|
|
|
58910
58931
|
function createDeferredPromise() {
|
|
58911
58932
|
let res;
|
|
58912
58933
|
let rej;
|
|
58913
|
-
const promise2 = new Promise((
|
|
58914
|
-
res =
|
|
58934
|
+
const promise2 = new Promise((resolve10, reject) => {
|
|
58935
|
+
res = resolve10;
|
|
58915
58936
|
rej = reject;
|
|
58916
58937
|
});
|
|
58917
58938
|
return { promise: promise2, resolve: res, reject: rej };
|
|
@@ -61052,12 +61073,12 @@ upgrade: ${upgrade}\r
|
|
|
61052
61073
|
cb();
|
|
61053
61074
|
}
|
|
61054
61075
|
}
|
|
61055
|
-
const waitForDrain = () => new Promise((
|
|
61076
|
+
const waitForDrain = () => new Promise((resolve10, reject) => {
|
|
61056
61077
|
assert2(callback === null);
|
|
61057
61078
|
if (socket[kError]) {
|
|
61058
61079
|
reject(socket[kError]);
|
|
61059
61080
|
} else {
|
|
61060
|
-
callback =
|
|
61081
|
+
callback = resolve10;
|
|
61061
61082
|
}
|
|
61062
61083
|
});
|
|
61063
61084
|
socket.on("close", onDrain).on("drain", onDrain);
|
|
@@ -61694,12 +61715,12 @@ var require_client_h2 = __commonJS({
|
|
|
61694
61715
|
cb();
|
|
61695
61716
|
}
|
|
61696
61717
|
}
|
|
61697
|
-
const waitForDrain = () => new Promise((
|
|
61718
|
+
const waitForDrain = () => new Promise((resolve10, reject) => {
|
|
61698
61719
|
assert2(callback === null);
|
|
61699
61720
|
if (socket[kError]) {
|
|
61700
61721
|
reject(socket[kError]);
|
|
61701
61722
|
} else {
|
|
61702
|
-
callback =
|
|
61723
|
+
callback = resolve10;
|
|
61703
61724
|
}
|
|
61704
61725
|
});
|
|
61705
61726
|
h2stream.on("close", onDrain).on("drain", onDrain);
|
|
@@ -62176,16 +62197,16 @@ var require_client = __commonJS({
|
|
|
62176
62197
|
return this[kNeedDrain] < 2;
|
|
62177
62198
|
}
|
|
62178
62199
|
async [kClose]() {
|
|
62179
|
-
return new Promise((
|
|
62200
|
+
return new Promise((resolve10) => {
|
|
62180
62201
|
if (this[kSize]) {
|
|
62181
|
-
this[kClosedResolve] =
|
|
62202
|
+
this[kClosedResolve] = resolve10;
|
|
62182
62203
|
} else {
|
|
62183
|
-
|
|
62204
|
+
resolve10(null);
|
|
62184
62205
|
}
|
|
62185
62206
|
});
|
|
62186
62207
|
}
|
|
62187
62208
|
async [kDestroy](err2) {
|
|
62188
|
-
return new Promise((
|
|
62209
|
+
return new Promise((resolve10) => {
|
|
62189
62210
|
const requests = this[kQueue].splice(this[kPendingIdx]);
|
|
62190
62211
|
for (let i2 = 0; i2 < requests.length; i2++) {
|
|
62191
62212
|
const request = requests[i2];
|
|
@@ -62196,7 +62217,7 @@ var require_client = __commonJS({
|
|
|
62196
62217
|
this[kClosedResolve]();
|
|
62197
62218
|
this[kClosedResolve] = null;
|
|
62198
62219
|
}
|
|
62199
|
-
|
|
62220
|
+
resolve10(null);
|
|
62200
62221
|
};
|
|
62201
62222
|
if (this[kHTTPContext]) {
|
|
62202
62223
|
this[kHTTPContext].destroy(err2, callback);
|
|
@@ -62247,7 +62268,7 @@ var require_client = __commonJS({
|
|
|
62247
62268
|
});
|
|
62248
62269
|
}
|
|
62249
62270
|
try {
|
|
62250
|
-
const socket = await new Promise((
|
|
62271
|
+
const socket = await new Promise((resolve10, reject) => {
|
|
62251
62272
|
client[kConnector]({
|
|
62252
62273
|
host,
|
|
62253
62274
|
hostname: hostname3,
|
|
@@ -62259,7 +62280,7 @@ var require_client = __commonJS({
|
|
|
62259
62280
|
if (err2) {
|
|
62260
62281
|
reject(err2);
|
|
62261
62282
|
} else {
|
|
62262
|
-
|
|
62283
|
+
resolve10(socket2);
|
|
62263
62284
|
}
|
|
62264
62285
|
});
|
|
62265
62286
|
});
|
|
@@ -62595,8 +62616,8 @@ var require_pool_base = __commonJS({
|
|
|
62595
62616
|
if (this[kQueue].isEmpty()) {
|
|
62596
62617
|
await Promise.all(this[kClients].map((c) => c.close()));
|
|
62597
62618
|
} else {
|
|
62598
|
-
await new Promise((
|
|
62599
|
-
this[kClosedResolve] =
|
|
62619
|
+
await new Promise((resolve10) => {
|
|
62620
|
+
this[kClosedResolve] = resolve10;
|
|
62600
62621
|
});
|
|
62601
62622
|
}
|
|
62602
62623
|
}
|
|
@@ -63811,7 +63832,7 @@ var require_readable = __commonJS({
|
|
|
63811
63832
|
if (this._readableState.closeEmitted) {
|
|
63812
63833
|
return null;
|
|
63813
63834
|
}
|
|
63814
|
-
return await new Promise((
|
|
63835
|
+
return await new Promise((resolve10, reject) => {
|
|
63815
63836
|
if (this[kContentLength] > limit) {
|
|
63816
63837
|
this.destroy(new AbortError());
|
|
63817
63838
|
}
|
|
@@ -63824,7 +63845,7 @@ var require_readable = __commonJS({
|
|
|
63824
63845
|
if (signal?.aborted) {
|
|
63825
63846
|
reject(signal.reason ?? new AbortError());
|
|
63826
63847
|
} else {
|
|
63827
|
-
|
|
63848
|
+
resolve10(null);
|
|
63828
63849
|
}
|
|
63829
63850
|
}).on("error", noop).on("data", function(chunk) {
|
|
63830
63851
|
limit -= chunk.length;
|
|
@@ -63843,7 +63864,7 @@ var require_readable = __commonJS({
|
|
|
63843
63864
|
}
|
|
63844
63865
|
async function consume(stream, type) {
|
|
63845
63866
|
assert2(!stream[kConsume]);
|
|
63846
|
-
return new Promise((
|
|
63867
|
+
return new Promise((resolve10, reject) => {
|
|
63847
63868
|
if (isUnusable(stream)) {
|
|
63848
63869
|
const rState = stream._readableState;
|
|
63849
63870
|
if (rState.destroyed && rState.closeEmitted === false) {
|
|
@@ -63860,7 +63881,7 @@ var require_readable = __commonJS({
|
|
|
63860
63881
|
stream[kConsume] = {
|
|
63861
63882
|
type,
|
|
63862
63883
|
stream,
|
|
63863
|
-
resolve:
|
|
63884
|
+
resolve: resolve10,
|
|
63864
63885
|
reject,
|
|
63865
63886
|
length: 0,
|
|
63866
63887
|
body: []
|
|
@@ -63930,18 +63951,18 @@ var require_readable = __commonJS({
|
|
|
63930
63951
|
return buffer;
|
|
63931
63952
|
}
|
|
63932
63953
|
function consumeEnd(consume2) {
|
|
63933
|
-
const { type, body: body2, resolve:
|
|
63954
|
+
const { type, body: body2, resolve: resolve10, stream, length } = consume2;
|
|
63934
63955
|
try {
|
|
63935
63956
|
if (type === "text") {
|
|
63936
|
-
|
|
63957
|
+
resolve10(chunksDecode(body2, length));
|
|
63937
63958
|
} else if (type === "json") {
|
|
63938
|
-
|
|
63959
|
+
resolve10(JSON.parse(chunksDecode(body2, length)));
|
|
63939
63960
|
} else if (type === "arrayBuffer") {
|
|
63940
|
-
|
|
63961
|
+
resolve10(chunksConcat(body2, length).buffer);
|
|
63941
63962
|
} else if (type === "blob") {
|
|
63942
|
-
|
|
63963
|
+
resolve10(new Blob(body2, { type: stream[kContentType] }));
|
|
63943
63964
|
} else if (type === "bytes") {
|
|
63944
|
-
|
|
63965
|
+
resolve10(chunksConcat(body2, length));
|
|
63945
63966
|
}
|
|
63946
63967
|
consumeFinish(consume2);
|
|
63947
63968
|
} catch (err2) {
|
|
@@ -64198,9 +64219,9 @@ var require_api_request = __commonJS({
|
|
|
64198
64219
|
};
|
|
64199
64220
|
function request(opts, callback) {
|
|
64200
64221
|
if (callback === void 0) {
|
|
64201
|
-
return new Promise((
|
|
64222
|
+
return new Promise((resolve10, reject) => {
|
|
64202
64223
|
request.call(this, opts, (err2, data) => {
|
|
64203
|
-
return err2 ? reject(err2) :
|
|
64224
|
+
return err2 ? reject(err2) : resolve10(data);
|
|
64204
64225
|
});
|
|
64205
64226
|
});
|
|
64206
64227
|
}
|
|
@@ -64423,9 +64444,9 @@ var require_api_stream = __commonJS({
|
|
|
64423
64444
|
};
|
|
64424
64445
|
function stream(opts, factory, callback) {
|
|
64425
64446
|
if (callback === void 0) {
|
|
64426
|
-
return new Promise((
|
|
64447
|
+
return new Promise((resolve10, reject) => {
|
|
64427
64448
|
stream.call(this, opts, factory, (err2, data) => {
|
|
64428
|
-
return err2 ? reject(err2) :
|
|
64449
|
+
return err2 ? reject(err2) : resolve10(data);
|
|
64429
64450
|
});
|
|
64430
64451
|
});
|
|
64431
64452
|
}
|
|
@@ -64710,9 +64731,9 @@ var require_api_upgrade = __commonJS({
|
|
|
64710
64731
|
};
|
|
64711
64732
|
function upgrade(opts, callback) {
|
|
64712
64733
|
if (callback === void 0) {
|
|
64713
|
-
return new Promise((
|
|
64734
|
+
return new Promise((resolve10, reject) => {
|
|
64714
64735
|
upgrade.call(this, opts, (err2, data) => {
|
|
64715
|
-
return err2 ? reject(err2) :
|
|
64736
|
+
return err2 ? reject(err2) : resolve10(data);
|
|
64716
64737
|
});
|
|
64717
64738
|
});
|
|
64718
64739
|
}
|
|
@@ -64804,9 +64825,9 @@ var require_api_connect = __commonJS({
|
|
|
64804
64825
|
};
|
|
64805
64826
|
function connect(opts, callback) {
|
|
64806
64827
|
if (callback === void 0) {
|
|
64807
|
-
return new Promise((
|
|
64828
|
+
return new Promise((resolve10, reject) => {
|
|
64808
64829
|
connect.call(this, opts, (err2, data) => {
|
|
64809
|
-
return err2 ? reject(err2) :
|
|
64830
|
+
return err2 ? reject(err2) : resolve10(data);
|
|
64810
64831
|
});
|
|
64811
64832
|
});
|
|
64812
64833
|
}
|
|
@@ -66275,10 +66296,10 @@ var require_headers = __commonJS({
|
|
|
66275
66296
|
const lowercaseName = isLowerCase ? name2 : name2.toLowerCase();
|
|
66276
66297
|
const exists = this[kHeadersMap].get(lowercaseName);
|
|
66277
66298
|
if (exists) {
|
|
66278
|
-
const
|
|
66299
|
+
const delimiter3 = lowercaseName === "cookie" ? "; " : ", ";
|
|
66279
66300
|
this[kHeadersMap].set(lowercaseName, {
|
|
66280
66301
|
name: exists.name,
|
|
66281
|
-
value: `${exists.value}${
|
|
66302
|
+
value: `${exists.value}${delimiter3}${value}`
|
|
66282
66303
|
});
|
|
66283
66304
|
} else {
|
|
66284
66305
|
this[kHeadersMap].set(lowercaseName, { name: name2, value });
|
|
@@ -68668,7 +68689,7 @@ var require_fetch = __commonJS({
|
|
|
68668
68689
|
function dispatch({ body: body2 }) {
|
|
68669
68690
|
const url2 = requestCurrentURL(request);
|
|
68670
68691
|
const agent = fetchParams.controller.dispatcher;
|
|
68671
|
-
return new Promise((
|
|
68692
|
+
return new Promise((resolve10, reject) => agent.dispatch(
|
|
68672
68693
|
{
|
|
68673
68694
|
path: url2.pathname + url2.search,
|
|
68674
68695
|
origin: url2.origin,
|
|
@@ -68744,7 +68765,7 @@ var require_fetch = __commonJS({
|
|
|
68744
68765
|
}
|
|
68745
68766
|
}
|
|
68746
68767
|
const onError = this.onError.bind(this);
|
|
68747
|
-
|
|
68768
|
+
resolve10({
|
|
68748
68769
|
status,
|
|
68749
68770
|
statusText,
|
|
68750
68771
|
headersList,
|
|
@@ -68790,7 +68811,7 @@ var require_fetch = __commonJS({
|
|
|
68790
68811
|
for (let i2 = 0; i2 < rawHeaders.length; i2 += 2) {
|
|
68791
68812
|
headersList.append(bufferToLowerCasedHeaderName(rawHeaders[i2]), rawHeaders[i2 + 1].toString("latin1"), true);
|
|
68792
68813
|
}
|
|
68793
|
-
|
|
68814
|
+
resolve10({
|
|
68794
68815
|
status,
|
|
68795
68816
|
statusText: STATUS_CODES[status],
|
|
68796
68817
|
headersList,
|
|
@@ -72429,8 +72450,8 @@ var require_util8 = __commonJS({
|
|
|
72429
72450
|
return true;
|
|
72430
72451
|
}
|
|
72431
72452
|
function delay(ms) {
|
|
72432
|
-
return new Promise((
|
|
72433
|
-
setTimeout(
|
|
72453
|
+
return new Promise((resolve10) => {
|
|
72454
|
+
setTimeout(resolve10, ms).unref();
|
|
72434
72455
|
});
|
|
72435
72456
|
}
|
|
72436
72457
|
module2.exports = {
|
|
@@ -73577,8 +73598,8 @@ var init_report_render = __esm({
|
|
|
73577
73598
|
|
|
73578
73599
|
// src/cli.ts
|
|
73579
73600
|
init_src6();
|
|
73580
|
-
import { closeSync as closeSync2, existsSync as
|
|
73581
|
-
import { join as
|
|
73601
|
+
import { closeSync as closeSync2, existsSync as existsSync39, openSync as openSync2, readFileSync as readFileSync42, renameSync as renameSync6, statSync as statSync12 } from "node:fs";
|
|
73602
|
+
import { join as join48, resolve as pathResolve2 } from "node:path";
|
|
73582
73603
|
import { spawn as spawn5 } from "node:child_process";
|
|
73583
73604
|
|
|
73584
73605
|
// src/daemon.ts
|
|
@@ -74012,7 +74033,7 @@ var responseViaResponseObject = async (res, outgoing, options = {}) => {
|
|
|
74012
74033
|
});
|
|
74013
74034
|
if (!chunk) {
|
|
74014
74035
|
if (i2 === 1) {
|
|
74015
|
-
await new Promise((
|
|
74036
|
+
await new Promise((resolve10) => setTimeout(resolve10));
|
|
74016
74037
|
maxReadCount = 3;
|
|
74017
74038
|
continue;
|
|
74018
74039
|
}
|
|
@@ -74940,9 +74961,9 @@ var NodeFsHandler = class {
|
|
|
74940
74961
|
if (this.fsw.closed) {
|
|
74941
74962
|
return;
|
|
74942
74963
|
}
|
|
74943
|
-
const
|
|
74964
|
+
const dirname16 = sysPath.dirname(file2);
|
|
74944
74965
|
const basename9 = sysPath.basename(file2);
|
|
74945
|
-
const parent = this.fsw._getWatchedDir(
|
|
74966
|
+
const parent = this.fsw._getWatchedDir(dirname16);
|
|
74946
74967
|
let prevStats = stats;
|
|
74947
74968
|
if (parent.has(basename9))
|
|
74948
74969
|
return;
|
|
@@ -74969,7 +74990,7 @@ var NodeFsHandler = class {
|
|
|
74969
74990
|
prevStats = newStats2;
|
|
74970
74991
|
}
|
|
74971
74992
|
} catch (error48) {
|
|
74972
|
-
this.fsw._remove(
|
|
74993
|
+
this.fsw._remove(dirname16, basename9);
|
|
74973
74994
|
}
|
|
74974
74995
|
} else if (parent.has(basename9)) {
|
|
74975
74996
|
const at = newStats.atimeMs;
|
|
@@ -75065,7 +75086,7 @@ var NodeFsHandler = class {
|
|
|
75065
75086
|
this._addToNodeFs(path2, initialAdd, wh, depth + 1);
|
|
75066
75087
|
}
|
|
75067
75088
|
}).on(EV.ERROR, this._boundHandleError);
|
|
75068
|
-
return new Promise((
|
|
75089
|
+
return new Promise((resolve10, reject) => {
|
|
75069
75090
|
if (!stream)
|
|
75070
75091
|
return reject();
|
|
75071
75092
|
stream.once(STR_END, () => {
|
|
@@ -75074,7 +75095,7 @@ var NodeFsHandler = class {
|
|
|
75074
75095
|
return;
|
|
75075
75096
|
}
|
|
75076
75097
|
const wasThrottled = throttler ? throttler.clear() : false;
|
|
75077
|
-
|
|
75098
|
+
resolve10(void 0);
|
|
75078
75099
|
previous.getChildren().filter((item2) => {
|
|
75079
75100
|
return item2 !== directory && !current.has(item2);
|
|
75080
75101
|
}).forEach((item2) => {
|
|
@@ -75218,11 +75239,11 @@ function createPattern(matcher) {
|
|
|
75218
75239
|
if (matcher.path === string4)
|
|
75219
75240
|
return true;
|
|
75220
75241
|
if (matcher.recursive) {
|
|
75221
|
-
const
|
|
75222
|
-
if (!
|
|
75242
|
+
const relative8 = sysPath2.relative(matcher.path, string4);
|
|
75243
|
+
if (!relative8) {
|
|
75223
75244
|
return false;
|
|
75224
75245
|
}
|
|
75225
|
-
return !
|
|
75246
|
+
return !relative8.startsWith("..") && !sysPath2.isAbsolute(relative8);
|
|
75226
75247
|
}
|
|
75227
75248
|
return false;
|
|
75228
75249
|
};
|
|
@@ -76839,9 +76860,9 @@ function subagentTranscripts(mainTranscriptPath, sessionId) {
|
|
|
76839
76860
|
refs.sort((a, b) => b.mtimeMs - a.mtimeMs);
|
|
76840
76861
|
return refs;
|
|
76841
76862
|
}
|
|
76842
|
-
function splitPathList(value,
|
|
76863
|
+
function splitPathList(value, sep6 = delimiter) {
|
|
76843
76864
|
if (!value) return [];
|
|
76844
|
-
return value.split(
|
|
76865
|
+
return value.split(sep6).map((d) => d.trim()).filter(Boolean).map((d) => normalize3(d));
|
|
76845
76866
|
}
|
|
76846
76867
|
function codexSessionRoots(env2 = process.env, home = homedir4()) {
|
|
76847
76868
|
const roots = /* @__PURE__ */ new Set();
|
|
@@ -78985,8 +79006,8 @@ var PassWorker = class {
|
|
|
78985
79006
|
const id = this.nextId++;
|
|
78986
79007
|
try {
|
|
78987
79008
|
await this.ready;
|
|
78988
|
-
return await new Promise((
|
|
78989
|
-
this.pending.set(id, { resolve:
|
|
79009
|
+
return await new Promise((resolve10, reject) => {
|
|
79010
|
+
this.pending.set(id, { resolve: resolve10, reject });
|
|
78990
79011
|
this.worker.postMessage({ id, kind, ...payload !== void 0 ? { payload } : {} });
|
|
78991
79012
|
});
|
|
78992
79013
|
} finally {
|
|
@@ -79020,12 +79041,12 @@ var PassWorker = class {
|
|
|
79020
79041
|
});
|
|
79021
79042
|
noteIsolateSpawned();
|
|
79022
79043
|
this.worker = worker;
|
|
79023
|
-
this.ready = new Promise((
|
|
79044
|
+
this.ready = new Promise((resolve10, reject) => {
|
|
79024
79045
|
const onReady = (m) => {
|
|
79025
79046
|
if (m?.ready) {
|
|
79026
79047
|
worker.off("message", onReady);
|
|
79027
79048
|
worker.off("error", onErr);
|
|
79028
|
-
|
|
79049
|
+
resolve10();
|
|
79029
79050
|
}
|
|
79030
79051
|
};
|
|
79031
79052
|
const onErr = (err2) => reject(err2);
|
|
@@ -80188,7 +80209,7 @@ function startGitSensor(gitDir, onEvent, opts = {}) {
|
|
|
80188
80209
|
// src/git-delta.ts
|
|
80189
80210
|
import { execFile } from "node:child_process";
|
|
80190
80211
|
function git(repoDir, args2) {
|
|
80191
|
-
return new Promise((
|
|
80212
|
+
return new Promise((resolve10, reject) => {
|
|
80192
80213
|
execFile(
|
|
80193
80214
|
"git",
|
|
80194
80215
|
["-C", repoDir, ...args2],
|
|
@@ -80199,7 +80220,7 @@ function git(repoDir, args2) {
|
|
|
80199
80220
|
// git-sensor runs on every commit/checkout.
|
|
80200
80221
|
windowsHide: true
|
|
80201
80222
|
},
|
|
80202
|
-
(err2, stdout) => err2 ? reject(err2) :
|
|
80223
|
+
(err2, stdout) => err2 ? reject(err2) : resolve10(stdout)
|
|
80203
80224
|
);
|
|
80204
80225
|
});
|
|
80205
80226
|
}
|
|
@@ -81361,12 +81382,12 @@ function headerPaths(diff) {
|
|
|
81361
81382
|
return out2.filter((p) => p !== "/dev/null");
|
|
81362
81383
|
}
|
|
81363
81384
|
function git2(repoDir, args2) {
|
|
81364
|
-
return new Promise((
|
|
81385
|
+
return new Promise((resolve10, reject) => {
|
|
81365
81386
|
execFile2(
|
|
81366
81387
|
"git",
|
|
81367
81388
|
["-C", repoDir, ...args2],
|
|
81368
81389
|
{ encoding: "utf8", maxBuffer: 64 * 1024 * 1024, windowsHide: true },
|
|
81369
|
-
(err2, stdout) => err2 ? reject(err2) :
|
|
81390
|
+
(err2, stdout) => err2 ? reject(err2) : resolve10(stdout)
|
|
81370
81391
|
);
|
|
81371
81392
|
});
|
|
81372
81393
|
}
|
|
@@ -82664,7 +82685,7 @@ function createWatchBreaker(deps) {
|
|
|
82664
82685
|
}
|
|
82665
82686
|
|
|
82666
82687
|
// src/engine.ts
|
|
82667
|
-
var DAEMON_VERSION = true ? "2.0.17-dev.
|
|
82688
|
+
var DAEMON_VERSION = true ? "2.0.17-dev.3576" : "2.0.0-alpha.0";
|
|
82668
82689
|
var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
|
|
82669
82690
|
var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
|
|
82670
82691
|
var GIT_OP_MUTE_MS = 4e3;
|
|
@@ -82699,8 +82720,8 @@ function loadTurnOffsets(path2) {
|
|
|
82699
82720
|
const raw2 = JSON.parse(readFileSync32(path2, "utf8"));
|
|
82700
82721
|
const out2 = /* @__PURE__ */ new Map();
|
|
82701
82722
|
for (const [k, v] of Object.entries(raw2)) {
|
|
82702
|
-
const
|
|
82703
|
-
if (typeof
|
|
82723
|
+
const off2 = typeof v === "object" && v !== null ? v.offset : void 0;
|
|
82724
|
+
if (typeof off2 === "number" && off2 >= 0) out2.set(k, off2);
|
|
82704
82725
|
}
|
|
82705
82726
|
return out2;
|
|
82706
82727
|
} catch {
|
|
@@ -84682,7 +84703,7 @@ function createWorkspaceEngine(opts) {
|
|
|
84682
84703
|
}
|
|
84683
84704
|
turns = next.turns;
|
|
84684
84705
|
nextOffset = next.nextOffset;
|
|
84685
|
-
await new Promise((
|
|
84706
|
+
await new Promise((resolve10) => setImmediate(resolve10));
|
|
84686
84707
|
}
|
|
84687
84708
|
};
|
|
84688
84709
|
const seenMessageIds = /* @__PURE__ */ new Set();
|
|
@@ -85386,9 +85407,9 @@ async function startDaemon(opts) {
|
|
|
85386
85407
|
};
|
|
85387
85408
|
}
|
|
85388
85409
|
async function listenServer(fetchFn, port) {
|
|
85389
|
-
return new Promise((
|
|
85410
|
+
return new Promise((resolve10) => {
|
|
85390
85411
|
const server = serve({ fetch: fetchFn, hostname: "127.0.0.1", port }, (info2) => {
|
|
85391
|
-
|
|
85412
|
+
resolve10({ server, port: info2.port });
|
|
85392
85413
|
});
|
|
85393
85414
|
});
|
|
85394
85415
|
}
|
|
@@ -86742,8 +86763,8 @@ var ConsolidateWorker = class {
|
|
|
86742
86763
|
const id = this.nextId++;
|
|
86743
86764
|
try {
|
|
86744
86765
|
await this.ready;
|
|
86745
|
-
return await new Promise((
|
|
86746
|
-
this.pending.set(id, { resolve:
|
|
86766
|
+
return await new Promise((resolve10, reject) => {
|
|
86767
|
+
this.pending.set(id, { resolve: resolve10, reject });
|
|
86747
86768
|
this.worker.postMessage({ ...req, id });
|
|
86748
86769
|
});
|
|
86749
86770
|
} finally {
|
|
@@ -86772,12 +86793,12 @@ var ConsolidateWorker = class {
|
|
|
86772
86793
|
});
|
|
86773
86794
|
noteIsolateSpawned();
|
|
86774
86795
|
this.worker = worker;
|
|
86775
|
-
this.ready = new Promise((
|
|
86796
|
+
this.ready = new Promise((resolve10, reject) => {
|
|
86776
86797
|
const onReady = (m) => {
|
|
86777
86798
|
if (m?.ready) {
|
|
86778
86799
|
worker.off("message", onReady);
|
|
86779
86800
|
worker.off("error", onErr);
|
|
86780
|
-
|
|
86801
|
+
resolve10();
|
|
86781
86802
|
}
|
|
86782
86803
|
};
|
|
86783
86804
|
const onErr = (err2) => {
|
|
@@ -86995,17 +87016,17 @@ function startUpdatePoller(opts) {
|
|
|
86995
87016
|
};
|
|
86996
87017
|
}
|
|
86997
87018
|
function runNpmInstall(channel) {
|
|
86998
|
-
return new Promise((
|
|
87019
|
+
return new Promise((resolve10) => {
|
|
86999
87020
|
const child = spawn2("npm", ["install", "-g", `${PACKAGE_NAME}@${channel}`], {
|
|
87000
87021
|
stdio: "inherit",
|
|
87001
87022
|
shell: true
|
|
87002
87023
|
});
|
|
87003
|
-
child.on("close", (code) =>
|
|
87004
|
-
child.on("error", () =>
|
|
87024
|
+
child.on("close", (code) => resolve10(code ?? 1));
|
|
87025
|
+
child.on("error", () => resolve10(1));
|
|
87005
87026
|
});
|
|
87006
87027
|
}
|
|
87007
87028
|
async function runInstalledHookRefresh() {
|
|
87008
|
-
const root = await new Promise((
|
|
87029
|
+
const root = await new Promise((resolve10) => {
|
|
87009
87030
|
const child = spawn2("npm", ["root", "-g"], {
|
|
87010
87031
|
shell: true,
|
|
87011
87032
|
windowsHide: true,
|
|
@@ -87017,18 +87038,18 @@ async function runInstalledHookRefresh() {
|
|
|
87017
87038
|
output += chunk;
|
|
87018
87039
|
if (output.length > 32768) child.kill();
|
|
87019
87040
|
});
|
|
87020
|
-
child.on("error", () =>
|
|
87021
|
-
child.on("close", (code) =>
|
|
87041
|
+
child.on("error", () => resolve10(""));
|
|
87042
|
+
child.on("close", (code) => resolve10(code === 0 ? output.trim() : ""));
|
|
87022
87043
|
});
|
|
87023
87044
|
if (!isAbsolute5(root)) return 1;
|
|
87024
|
-
return new Promise((
|
|
87045
|
+
return new Promise((resolve10) => {
|
|
87025
87046
|
const child = spawn2(process.execPath, [join38(root, PACKAGE_NAME, "errata.mjs"), "install-hooks", "codex", "--refresh-existing"], {
|
|
87026
87047
|
windowsHide: true,
|
|
87027
87048
|
stdio: "inherit",
|
|
87028
87049
|
timeout: 3e4
|
|
87029
87050
|
});
|
|
87030
|
-
child.on("error", () =>
|
|
87031
|
-
child.on("close", (code) =>
|
|
87051
|
+
child.on("error", () => resolve10(1));
|
|
87052
|
+
child.on("close", (code) => resolve10(code ?? 1));
|
|
87032
87053
|
});
|
|
87033
87054
|
}
|
|
87034
87055
|
|
|
@@ -87043,7 +87064,7 @@ function liveCloudClient(src) {
|
|
|
87043
87064
|
let current = null;
|
|
87044
87065
|
let currentKey = "";
|
|
87045
87066
|
let checkedAt = -Infinity;
|
|
87046
|
-
const
|
|
87067
|
+
const resolve10 = () => {
|
|
87047
87068
|
const t = now();
|
|
87048
87069
|
if (current && t - checkedAt < recheckMs) return current;
|
|
87049
87070
|
checkedAt = t;
|
|
@@ -87063,7 +87084,7 @@ function liveCloudClient(src) {
|
|
|
87063
87084
|
};
|
|
87064
87085
|
return new Proxy({}, {
|
|
87065
87086
|
get(_target, prop) {
|
|
87066
|
-
const client =
|
|
87087
|
+
const client = resolve10();
|
|
87067
87088
|
const value = Reflect.get(client, prop, client);
|
|
87068
87089
|
return typeof value === "function" ? value.bind(client) : value;
|
|
87069
87090
|
}
|
|
@@ -87609,7 +87630,7 @@ async function syncHistoryRevision(opts) {
|
|
|
87609
87630
|
changed += result.changed;
|
|
87610
87631
|
remaining = result.remaining;
|
|
87611
87632
|
if (!remaining || Date.now() - started2 >= (opts.budgetMs ?? 45e3)) break;
|
|
87612
|
-
await new Promise((
|
|
87633
|
+
await new Promise((resolve10) => setImmediate(resolve10));
|
|
87613
87634
|
}
|
|
87614
87635
|
return { changed, remaining };
|
|
87615
87636
|
})();
|
|
@@ -88134,8 +88155,8 @@ var GitBlobReader = class {
|
|
|
88134
88155
|
if (this.failed) return Promise.reject(this.failed);
|
|
88135
88156
|
if (/[\r\n]/.test(spec)) return Promise.resolve(null);
|
|
88136
88157
|
const proc = this.start();
|
|
88137
|
-
return new Promise((
|
|
88138
|
-
this.queue.push({ resolve:
|
|
88158
|
+
return new Promise((resolve10, reject) => {
|
|
88159
|
+
this.queue.push({ resolve: resolve10, reject });
|
|
88139
88160
|
proc.stdin.write(`${spec}
|
|
88140
88161
|
`);
|
|
88141
88162
|
});
|
|
@@ -88149,14 +88170,14 @@ var GitBlobReader = class {
|
|
|
88149
88170
|
const proc = this.proc;
|
|
88150
88171
|
this.proc = null;
|
|
88151
88172
|
if (!proc || proc.exitCode !== null) return Promise.resolve();
|
|
88152
|
-
return new Promise((
|
|
88173
|
+
return new Promise((resolve10) => {
|
|
88153
88174
|
const timer = setTimeout(() => {
|
|
88154
88175
|
proc.kill();
|
|
88155
|
-
|
|
88176
|
+
resolve10();
|
|
88156
88177
|
}, timeoutMs);
|
|
88157
88178
|
proc.once("exit", () => {
|
|
88158
88179
|
clearTimeout(timer);
|
|
88159
|
-
|
|
88180
|
+
resolve10();
|
|
88160
88181
|
});
|
|
88161
88182
|
proc.stdin.end();
|
|
88162
88183
|
});
|
|
@@ -88952,7 +88973,7 @@ async function loginOAuthDevice(opts) {
|
|
|
88952
88973
|
let deviceSession = null;
|
|
88953
88974
|
let approvedInstallation = null;
|
|
88954
88975
|
while (Date.now() < deadline) {
|
|
88955
|
-
await (opts.sleep ?? ((ms) => new Promise((
|
|
88976
|
+
await (opts.sleep ?? ((ms) => new Promise((resolve10) => setTimeout(resolve10, ms))))(waitMs);
|
|
88956
88977
|
waitMs = intervalMs;
|
|
88957
88978
|
const poll = await fetchDevicePoll(fetchFn, device.token, {
|
|
88958
88979
|
method: "POST",
|
|
@@ -89077,7 +89098,7 @@ async function loginOAuthLoopback(opts) {
|
|
|
89077
89098
|
const state = randomState();
|
|
89078
89099
|
const scope = opts.scope ?? DEFAULT_OAUTH_SCOPE;
|
|
89079
89100
|
const { code, redirectUri, clientId } = await new Promise(
|
|
89080
|
-
(
|
|
89101
|
+
(resolve10, reject) => {
|
|
89081
89102
|
const server = createServer((req, res) => {
|
|
89082
89103
|
const u = new URL(req.url ?? "/", "http://127.0.0.1");
|
|
89083
89104
|
if (u.pathname !== "/callback") {
|
|
@@ -89100,7 +89121,7 @@ async function loginOAuthLoopback(opts) {
|
|
|
89100
89121
|
res.writeHead(200, { "content-type": "text/html" });
|
|
89101
89122
|
res.end("<html><body>inErrata: you're logged in. You can close this tab.</body></html>");
|
|
89102
89123
|
server.close();
|
|
89103
|
-
|
|
89124
|
+
resolve10({ code: code2, redirectUri: `http://127.0.0.1:${port}/callback`, clientId: activeClientId });
|
|
89104
89125
|
});
|
|
89105
89126
|
let activeClientId = oauthClientId();
|
|
89106
89127
|
server.on("error", reject);
|
|
@@ -89199,7 +89220,7 @@ async function linkThroughConsole(opts) {
|
|
|
89199
89220
|
const deadline = Date.now() + Math.min(code.expires_in * 1e3, opts.timeoutMs ?? Number.POSITIVE_INFINITY);
|
|
89200
89221
|
let intervalMs = Math.max(2, code.interval ?? 5) * 1e3;
|
|
89201
89222
|
let waitMs = intervalMs;
|
|
89202
|
-
const sleep = opts.sleep ?? ((ms) => new Promise((
|
|
89223
|
+
const sleep = opts.sleep ?? ((ms) => new Promise((resolve10) => setTimeout(resolve10, ms)));
|
|
89203
89224
|
while (Date.now() < deadline) {
|
|
89204
89225
|
await sleep(waitMs);
|
|
89205
89226
|
waitMs = intervalMs;
|
|
@@ -90695,7 +90716,7 @@ async function startMultiDaemon(opts = {}) {
|
|
|
90695
90716
|
const packageAutoAll = async () => {
|
|
90696
90717
|
const out2 = /* @__PURE__ */ new Map();
|
|
90697
90718
|
for (const r of records) {
|
|
90698
|
-
await new Promise((
|
|
90719
|
+
await new Promise((resolve10) => setImmediate(resolve10));
|
|
90699
90720
|
const done = markPass(`package-index:${r.entry.name}`);
|
|
90700
90721
|
try {
|
|
90701
90722
|
out2.set(
|
|
@@ -92264,7 +92285,7 @@ function inspectCodexContext(cwd) {
|
|
|
92264
92285
|
return { id: "codex_context", status: "fail", detail: "No usable saved workspace context; run errata start here and check the daemon log if context.md remains unavailable" };
|
|
92265
92286
|
}
|
|
92266
92287
|
function readCodexHookState(cwd, options = {}) {
|
|
92267
|
-
return new Promise((
|
|
92288
|
+
return new Promise((resolve10, reject) => {
|
|
92268
92289
|
const child = spawn4(options.bin ?? resolveCodexExecutable(), options.args ?? ["app-server", "--stdio"], {
|
|
92269
92290
|
cwd,
|
|
92270
92291
|
windowsHide: true,
|
|
@@ -92285,7 +92306,7 @@ function readCodexHookState(cwd, options = {}) {
|
|
|
92285
92306
|
child.once("close", () => {
|
|
92286
92307
|
clearTimeout(reap);
|
|
92287
92308
|
if (error48) reject(error48);
|
|
92288
|
-
else
|
|
92309
|
+
else resolve10({ ...hooks, features });
|
|
92289
92310
|
});
|
|
92290
92311
|
child.kill();
|
|
92291
92312
|
};
|
|
@@ -92527,8 +92548,8 @@ function userClaudeSettingsPath() {
|
|
|
92527
92548
|
}
|
|
92528
92549
|
function ensureUserStatusLine(opts) {
|
|
92529
92550
|
const env2 = opts.env ?? process.env;
|
|
92530
|
-
const
|
|
92531
|
-
if (
|
|
92551
|
+
const off2 = (env2["ERRATA_STATUSLINE"] ?? "").trim().toLowerCase();
|
|
92552
|
+
if (off2 === "0" || off2 === "off" || off2 === "false" || off2 === "no") return "disabled";
|
|
92532
92553
|
const settingsPath = opts.userSettingsPath ?? userClaudeSettingsPath();
|
|
92533
92554
|
let settings = {};
|
|
92534
92555
|
if (existsSync37(settingsPath)) {
|
|
@@ -92577,6 +92598,142 @@ function describeStatusLineOutcome(outcome) {
|
|
|
92577
92598
|
}
|
|
92578
92599
|
}
|
|
92579
92600
|
|
|
92601
|
+
// src/claude-mods.ts
|
|
92602
|
+
import { createHash as createHash20 } from "node:crypto";
|
|
92603
|
+
import { cpSync as cpSync2, existsSync as existsSync38, mkdirSync as mkdirSync11, readFileSync as readFileSync41, readdirSync as readdirSync14, rmSync as rmSync4, statSync as statSync11, writeFileSync as writeFileSync29 } from "node:fs";
|
|
92604
|
+
import { delimiter as delimiter2, dirname as dirname15, join as join47, relative as relative7, resolve as resolve9, sep as sep5 } from "node:path";
|
|
92605
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
92606
|
+
var CLAUDE_PLUGIN_DIRS_ENV = "CLAUDE_CODE_PLUGIN_DIRS";
|
|
92607
|
+
var HASH_FILE = ".errata-mod-hash";
|
|
92608
|
+
function bundledClaudeModsDir() {
|
|
92609
|
+
const rel = import.meta.url.endsWith(".mjs") ? "./resources/claude-mods/" : "../claude-mods/";
|
|
92610
|
+
return fileURLToPath2(new URL(rel, import.meta.url));
|
|
92611
|
+
}
|
|
92612
|
+
function isEngineOwned(relPath) {
|
|
92613
|
+
const p = relPath.split(sep5).join("/");
|
|
92614
|
+
return p === ".claude-plugin/types" || p.startsWith(".claude-plugin/types/") || p === HASH_FILE;
|
|
92615
|
+
}
|
|
92616
|
+
function listFiles(root, dir = root) {
|
|
92617
|
+
const out2 = [];
|
|
92618
|
+
for (const name2 of readdirSync14(dir)) {
|
|
92619
|
+
const abs = join47(dir, name2);
|
|
92620
|
+
if (isEngineOwned(relative7(root, abs))) continue;
|
|
92621
|
+
if (statSync11(abs).isDirectory()) out2.push(...listFiles(root, abs));
|
|
92622
|
+
else out2.push(abs);
|
|
92623
|
+
}
|
|
92624
|
+
return out2;
|
|
92625
|
+
}
|
|
92626
|
+
function modHash(dir) {
|
|
92627
|
+
const h = createHash20("sha256");
|
|
92628
|
+
for (const abs of listFiles(dir).sort()) {
|
|
92629
|
+
h.update(relative7(dir, abs).split(sep5).join("/"));
|
|
92630
|
+
h.update("\0");
|
|
92631
|
+
h.update(readFileSync41(abs));
|
|
92632
|
+
h.update("\0");
|
|
92633
|
+
}
|
|
92634
|
+
return h.digest("hex");
|
|
92635
|
+
}
|
|
92636
|
+
function bundledMods(bundleDir) {
|
|
92637
|
+
if (!existsSync38(bundleDir)) return [];
|
|
92638
|
+
return readdirSync14(bundleDir).filter((name2) => existsSync38(join47(bundleDir, name2, ".claude-plugin", "plugin.json")));
|
|
92639
|
+
}
|
|
92640
|
+
function sameDir(a, b) {
|
|
92641
|
+
const norm = (p) => resolve9(p).replace(/[\\/]+$/, "").toLowerCase();
|
|
92642
|
+
return norm(a) === norm(b);
|
|
92643
|
+
}
|
|
92644
|
+
function isUnder(path2, root) {
|
|
92645
|
+
const rel = relative7(resolve9(root), resolve9(path2));
|
|
92646
|
+
return rel !== "" && !rel.startsWith("..") && !rel.includes(":");
|
|
92647
|
+
}
|
|
92648
|
+
function off(env2) {
|
|
92649
|
+
const v = (env2["ERRATA_CLAUDE_MODS"] ?? "").trim().toLowerCase();
|
|
92650
|
+
return v === "0" || v === "off" || v === "false" || v === "no";
|
|
92651
|
+
}
|
|
92652
|
+
function readSettings(path2) {
|
|
92653
|
+
if (!existsSync38(path2)) return {};
|
|
92654
|
+
try {
|
|
92655
|
+
const parsed = JSON.parse(readFileSync41(path2, "utf8"));
|
|
92656
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return null;
|
|
92657
|
+
return parsed;
|
|
92658
|
+
} catch {
|
|
92659
|
+
return null;
|
|
92660
|
+
}
|
|
92661
|
+
}
|
|
92662
|
+
function setPluginDirs(settings, dirs) {
|
|
92663
|
+
const env2 = settings["env"] && typeof settings["env"] === "object" && !Array.isArray(settings["env"]) ? { ...settings["env"] } : {};
|
|
92664
|
+
const before = typeof env2[CLAUDE_PLUGIN_DIRS_ENV] === "string" ? env2[CLAUDE_PLUGIN_DIRS_ENV] : void 0;
|
|
92665
|
+
const after = dirs.length > 0 ? dirs.join(delimiter2) : void 0;
|
|
92666
|
+
if (before === after) return false;
|
|
92667
|
+
if (after === void 0) delete env2[CLAUDE_PLUGIN_DIRS_ENV];
|
|
92668
|
+
else env2[CLAUDE_PLUGIN_DIRS_ENV] = after;
|
|
92669
|
+
if (Object.keys(env2).length > 0) settings["env"] = env2;
|
|
92670
|
+
else delete settings["env"];
|
|
92671
|
+
return true;
|
|
92672
|
+
}
|
|
92673
|
+
function currentDirs(settings) {
|
|
92674
|
+
const env2 = settings["env"];
|
|
92675
|
+
const raw2 = env2 && typeof env2[CLAUDE_PLUGIN_DIRS_ENV] === "string" ? env2[CLAUDE_PLUGIN_DIRS_ENV] : "";
|
|
92676
|
+
return raw2.split(delimiter2).map((s) => s.trim()).filter(Boolean);
|
|
92677
|
+
}
|
|
92678
|
+
function writeSettings(path2, settings) {
|
|
92679
|
+
mkdirSync11(dirname15(path2), { recursive: true });
|
|
92680
|
+
writeFileSync29(path2, JSON.stringify(settings, null, 2) + "\n", "utf8");
|
|
92681
|
+
}
|
|
92682
|
+
function ensureClaudeMods(opts) {
|
|
92683
|
+
const env2 = opts.env ?? process.env;
|
|
92684
|
+
const settingsPath = opts.userSettingsPath ?? userClaudeSettingsPath();
|
|
92685
|
+
const modsRoot = join47(opts.installRoot, "claude-mods");
|
|
92686
|
+
if (off(env2)) {
|
|
92687
|
+
const settings2 = readSettings(settingsPath);
|
|
92688
|
+
if (!settings2) return { kind: "unreadable" };
|
|
92689
|
+
const dirs2 = currentDirs(settings2);
|
|
92690
|
+
const kept = dirs2.filter((d) => !isUnder(d, modsRoot));
|
|
92691
|
+
if (setPluginDirs(settings2, kept)) writeSettings(settingsPath, settings2);
|
|
92692
|
+
return { kind: "disabled", removed: dirs2.length - kept.length };
|
|
92693
|
+
}
|
|
92694
|
+
const bundleDir = opts.bundleDir ?? bundledClaudeModsDir();
|
|
92695
|
+
const names = bundledMods(bundleDir);
|
|
92696
|
+
if (names.length === 0) return { kind: "no-bundle" };
|
|
92697
|
+
const settings = readSettings(settingsPath);
|
|
92698
|
+
if (!settings) return { kind: "unreadable" };
|
|
92699
|
+
let changed = false;
|
|
92700
|
+
const installed = [];
|
|
92701
|
+
for (const name2 of names) {
|
|
92702
|
+
const src = join47(bundleDir, name2);
|
|
92703
|
+
const dest = join47(modsRoot, name2);
|
|
92704
|
+
const hash2 = modHash(src);
|
|
92705
|
+
const hashFile = join47(dest, HASH_FILE);
|
|
92706
|
+
if (!existsSync38(hashFile) || readFileSync41(hashFile, "utf8") !== hash2) {
|
|
92707
|
+
rmSync4(dest, { recursive: true, force: true });
|
|
92708
|
+
cpSync2(src, dest, { recursive: true, filter: (p) => !isEngineOwned(relative7(src, p)) });
|
|
92709
|
+
writeFileSync29(hashFile, hash2, "utf8");
|
|
92710
|
+
changed = true;
|
|
92711
|
+
}
|
|
92712
|
+
installed.push(dest);
|
|
92713
|
+
}
|
|
92714
|
+
const others = currentDirs(settings).filter((d) => !isUnder(d, modsRoot));
|
|
92715
|
+
const dirs = [...installed, ...others.filter((d) => !installed.some((m) => sameDir(m, d)))];
|
|
92716
|
+
if (setPluginDirs(settings, dirs)) {
|
|
92717
|
+
writeSettings(settingsPath, settings);
|
|
92718
|
+
changed = true;
|
|
92719
|
+
}
|
|
92720
|
+
return { kind: changed ? "installed" : "unchanged", mods: names };
|
|
92721
|
+
}
|
|
92722
|
+
function describeClaudeModsOutcome(outcome) {
|
|
92723
|
+
switch (outcome.kind) {
|
|
92724
|
+
case "installed":
|
|
92725
|
+
return `Claude Code mods: installed ${outcome.mods.join(", ")} \u2014 new Claude Code sessions load them`;
|
|
92726
|
+
case "unchanged":
|
|
92727
|
+
return `Claude Code mods: ${outcome.mods.join(", ")} up to date`;
|
|
92728
|
+
case "disabled":
|
|
92729
|
+
return `Claude Code mods: off (ERRATA_CLAUDE_MODS)${outcome.removed > 0 ? ` \u2014 removed ${outcome.removed} from settings` : ""}`;
|
|
92730
|
+
case "unreadable":
|
|
92731
|
+
return "Claude Code mods: not installed \u2014 ~/.claude/settings.json is not valid JSON (left untouched)";
|
|
92732
|
+
case "no-bundle":
|
|
92733
|
+
return "Claude Code mods: none bundled with this build";
|
|
92734
|
+
}
|
|
92735
|
+
}
|
|
92736
|
+
|
|
92580
92737
|
// src/opencode-plugin.ts
|
|
92581
92738
|
var OPENCODE_PLUGIN_MARKER = "// @inerrata opencode plugin \u2014 errata-managed (errata install-hooks opencode)";
|
|
92582
92739
|
var OPENCODE_D1_CONTRACT = "Behavioral contract: (1) On ANY error, call search() BEFORE debugging \u2014 costs ~400 tokens vs 5,000\u201350,000 cold. (2) After solving non-trivial problems, contribute back: if your harness emits typed nodes (canonicalId + label + attrs), use ingest \u2014 the typed door; otherwise call contribute(), the prose fallback. (3) Before web search, try search() first \u2014 graph is 2\u201315\xD7 cheaper. (4) At session end, review what you solved and contribute anything novel.";
|
|
@@ -92960,9 +93117,9 @@ function resolveHookPort(explicit) {
|
|
|
92960
93117
|
}
|
|
92961
93118
|
}
|
|
92962
93119
|
}
|
|
92963
|
-
const settingsPath =
|
|
93120
|
+
const settingsPath = join48(ROOT, ".claude", "settings.json");
|
|
92964
93121
|
try {
|
|
92965
|
-
if (
|
|
93122
|
+
if (existsSync39(settingsPath)) return installedHookPort(readFileSync42(settingsPath, "utf8")) ?? 7891;
|
|
92966
93123
|
} catch {
|
|
92967
93124
|
}
|
|
92968
93125
|
return 7891;
|
|
@@ -92987,14 +93144,14 @@ async function cmdInit() {
|
|
|
92987
93144
|
if (!skipHooks) {
|
|
92988
93145
|
console.log("");
|
|
92989
93146
|
console.log("installing harness hooks...");
|
|
92990
|
-
const { existsSync:
|
|
92991
|
-
const { join:
|
|
93147
|
+
const { existsSync: existsSync40 } = await import("node:fs");
|
|
93148
|
+
const { join: join49 } = await import("node:path");
|
|
92992
93149
|
try {
|
|
92993
93150
|
await installClaudeHooks(port);
|
|
92994
93151
|
} catch (err2) {
|
|
92995
93152
|
console.warn(` \u26A0\uFE0F Claude hook install failed: ${err2 instanceof Error ? err2.message : err2}`);
|
|
92996
93153
|
}
|
|
92997
|
-
if (
|
|
93154
|
+
if (existsSync40(join49(ROOT, ".cursor"))) {
|
|
92998
93155
|
try {
|
|
92999
93156
|
await installCursorMcpConfig();
|
|
93000
93157
|
} catch (err2) {
|
|
@@ -93207,9 +93364,9 @@ async function cmdStatus() {
|
|
|
93207
93364
|
console.log(` stack: ${profile.stack.join(", ") || "(none)"}`);
|
|
93208
93365
|
console.log(` languages: ${profile.languages.join(", ") || "(none)"}`);
|
|
93209
93366
|
}
|
|
93210
|
-
console.log(` graph db: ${
|
|
93211
|
-
console.log(` event log: ${
|
|
93212
|
-
if (
|
|
93367
|
+
console.log(` graph db: ${existsSync39(paths.castalia) ? "yes" : "no"} (${paths.castalia})`);
|
|
93368
|
+
console.log(` event log: ${existsSync39(paths.eventLog) ? "yes" : "no"} (${paths.eventLog})`);
|
|
93369
|
+
if (existsSync39(paths.castalia)) {
|
|
93213
93370
|
try {
|
|
93214
93371
|
const { openGraphStore: openGraphStore2 } = await Promise.resolve().then(() => (init_src5(), src_exports2));
|
|
93215
93372
|
const store = openGraphStore2({ path: paths.castalia });
|
|
@@ -93832,6 +93989,7 @@ async function cmdLink(args2) {
|
|
|
93832
93989
|
return;
|
|
93833
93990
|
}
|
|
93834
93991
|
console.log(ensureStatusLine(resolveHookPort()));
|
|
93992
|
+
console.log(installClaudeMods().line);
|
|
93835
93993
|
delete profile.projectLinkDisabled;
|
|
93836
93994
|
const remote = flag("--remote");
|
|
93837
93995
|
if (remote) {
|
|
@@ -94182,11 +94340,11 @@ async function cmdInstallationProfile(args2) {
|
|
|
94182
94340
|
}
|
|
94183
94341
|
async function cmdReview() {
|
|
94184
94342
|
const paths = workspacePaths(ROOT);
|
|
94185
|
-
if (!
|
|
94343
|
+
if (!existsSync39(paths.reviewQueue)) {
|
|
94186
94344
|
console.log("(review queue empty)");
|
|
94187
94345
|
return;
|
|
94188
94346
|
}
|
|
94189
|
-
const queue = JSON.parse(
|
|
94347
|
+
const queue = JSON.parse(readFileSync42(paths.reviewQueue, "utf8"));
|
|
94190
94348
|
if (queue.length === 0) {
|
|
94191
94349
|
console.log("(review queue empty)");
|
|
94192
94350
|
return;
|
|
@@ -94857,7 +95015,7 @@ async function gatherRepo(store, ws) {
|
|
|
94857
95015
|
};
|
|
94858
95016
|
}
|
|
94859
95017
|
async function gatherReportData(generatedAt) {
|
|
94860
|
-
const { existsSync:
|
|
95018
|
+
const { existsSync: existsSync40 } = await import("node:fs");
|
|
94861
95019
|
const { openGraphStore: openGraphStore2 } = await Promise.resolve().then(() => (init_src5(), src_exports2));
|
|
94862
95020
|
const cfg = loadConfig();
|
|
94863
95021
|
const outbound = cfg.consent.sync ? "auto" : "off";
|
|
@@ -94865,7 +95023,7 @@ async function gatherReportData(generatedAt) {
|
|
|
94865
95023
|
for (const ws of listWorkspaces()) {
|
|
94866
95024
|
if (ws.missing) continue;
|
|
94867
95025
|
const dbPath = workspacePaths(ws.path).castalia;
|
|
94868
|
-
if (!
|
|
95026
|
+
if (!existsSync40(dbPath)) continue;
|
|
94869
95027
|
let store = null;
|
|
94870
95028
|
try {
|
|
94871
95029
|
store = openGraphStore2({ path: dbPath });
|
|
@@ -94896,7 +95054,7 @@ async function gatherReportData(generatedAt) {
|
|
|
94896
95054
|
};
|
|
94897
95055
|
}
|
|
94898
95056
|
async function cmdReport(args2) {
|
|
94899
|
-
const { mkdirSync:
|
|
95057
|
+
const { mkdirSync: mkdirSync12, writeFileSync: writeFileSync30 } = await import("node:fs");
|
|
94900
95058
|
const { renderReport: renderReport2 } = await Promise.resolve().then(() => (init_report_render(), report_render_exports));
|
|
94901
95059
|
const includeFutureVerbs = args2.includes("--future-verbs");
|
|
94902
95060
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -94907,10 +95065,10 @@ async function cmdReport(args2) {
|
|
|
94907
95065
|
process.exit(2);
|
|
94908
95066
|
}
|
|
94909
95067
|
const outDir = workspacePaths(ROOT).configDir;
|
|
94910
|
-
|
|
95068
|
+
mkdirSync12(outDir, { recursive: true });
|
|
94911
95069
|
const files = renderReport2(data, { includeFutureVerbs });
|
|
94912
|
-
for (const f of files)
|
|
94913
|
-
const indexPath =
|
|
95070
|
+
for (const f of files) writeFileSync30(join48(outDir, f.name), f.html, "utf8");
|
|
95071
|
+
const indexPath = join48(outDir, "report.html");
|
|
94914
95072
|
console.log(`report \u2192 ${indexPath}`);
|
|
94915
95073
|
console.log(
|
|
94916
95074
|
` ${data.repos.length} repo(s) \xB7 ${files.length} file(s) \xB7 ${data.rollup.nodes.toLocaleString("en-US")} nodes`
|
|
@@ -94954,7 +95112,7 @@ function spawnDaemonDetached(options = {}) {
|
|
|
94954
95112
|
try {
|
|
94955
95113
|
const logPath = daemonLogPath();
|
|
94956
95114
|
try {
|
|
94957
|
-
if (
|
|
95115
|
+
if (statSync12(logPath).size > 5 * 1024 * 1024) renameSync6(logPath, `${logPath}.1`);
|
|
94958
95116
|
} catch {
|
|
94959
95117
|
}
|
|
94960
95118
|
out2 = openSync2(logPath, "a");
|
|
@@ -95023,24 +95181,24 @@ async function cmdInstallHooks(args2) {
|
|
|
95023
95181
|
}
|
|
95024
95182
|
}
|
|
95025
95183
|
async function installOpencodePlugin(port) {
|
|
95026
|
-
const { mkdirSync:
|
|
95027
|
-
const { join:
|
|
95028
|
-
const dir =
|
|
95029
|
-
if (!
|
|
95030
|
-
const file2 =
|
|
95031
|
-
if (
|
|
95032
|
-
const head2 =
|
|
95184
|
+
const { mkdirSync: mkdirSync12, existsSync: existsSync40, readFileSync: readFileSync43, writeFileSync: writeFileSync30 } = await import("node:fs");
|
|
95185
|
+
const { join: join49 } = await import("node:path");
|
|
95186
|
+
const dir = join49(ROOT, ".opencode", "plugin");
|
|
95187
|
+
if (!existsSync40(dir)) mkdirSync12(dir, { recursive: true });
|
|
95188
|
+
const file2 = join49(dir, "inerrata.js");
|
|
95189
|
+
if (existsSync40(file2)) {
|
|
95190
|
+
const head2 = readFileSync43(file2, "utf8").split("\n")[0] ?? "";
|
|
95033
95191
|
if (head2.trim() !== OPENCODE_PLUGIN_MARKER) {
|
|
95034
95192
|
console.error(`refusing to overwrite ${file2}: not an errata-managed plugin (line 1 lacks the marker)`);
|
|
95035
95193
|
process.exit(2);
|
|
95036
95194
|
}
|
|
95037
95195
|
}
|
|
95038
|
-
|
|
95039
|
-
const cfgFile =
|
|
95196
|
+
writeFileSync30(file2, buildOpencodePluginSource(port, { version: DAEMON_VERSION }), "utf8");
|
|
95197
|
+
const cfgFile = join49(ROOT, "opencode.json");
|
|
95040
95198
|
let cfg = { $schema: "https://opencode.ai/config.json" };
|
|
95041
|
-
if (
|
|
95199
|
+
if (existsSync40(cfgFile)) {
|
|
95042
95200
|
try {
|
|
95043
|
-
cfg = JSON.parse(
|
|
95201
|
+
cfg = JSON.parse(readFileSync43(cfgFile, "utf8"));
|
|
95044
95202
|
} catch {
|
|
95045
95203
|
console.error(`refusing to touch invalid JSON at ${cfgFile} \u2014 fix it and re-run`);
|
|
95046
95204
|
process.exit(2);
|
|
@@ -95051,7 +95209,7 @@ async function installOpencodePlugin(port) {
|
|
|
95051
95209
|
if (!hadErrata) {
|
|
95052
95210
|
const inv = errataMcpInvocation();
|
|
95053
95211
|
cfg.mcp["errata"] = { type: "local", command: [inv.command, ...inv.args] };
|
|
95054
|
-
|
|
95212
|
+
writeFileSync30(cfgFile, JSON.stringify(cfg, null, 2) + "\n", "utf8");
|
|
95055
95213
|
}
|
|
95056
95214
|
console.log(`installed OpenCode plugin \u2192 ${file2}`);
|
|
95057
95215
|
if (hadErrata) console.log(` mcp.errata already present in ${cfgFile} \u2014 left untouched`);
|
|
@@ -95077,16 +95235,24 @@ function ensureStatusLine(port) {
|
|
|
95077
95235
|
return `status line: not installed (${err2 instanceof Error ? err2.message : err2})`;
|
|
95078
95236
|
}
|
|
95079
95237
|
}
|
|
95238
|
+
function installClaudeMods() {
|
|
95239
|
+
try {
|
|
95240
|
+
const outcome = ensureClaudeMods({ installRoot: globalDir() });
|
|
95241
|
+
return { line: describeClaudeModsOutcome(outcome), changed: outcome.kind !== "unchanged" && outcome.kind !== "no-bundle" };
|
|
95242
|
+
} catch (err2) {
|
|
95243
|
+
return { line: `Claude Code mods: not installed (${err2 instanceof Error ? err2.message : err2})`, changed: true };
|
|
95244
|
+
}
|
|
95245
|
+
}
|
|
95080
95246
|
async function installClaudeHooks(port) {
|
|
95081
|
-
const { mkdirSync:
|
|
95082
|
-
const { join:
|
|
95083
|
-
const dir =
|
|
95084
|
-
if (!
|
|
95085
|
-
const file2 =
|
|
95247
|
+
const { mkdirSync: mkdirSync12, existsSync: existsSync40, readFileSync: readFileSync43, writeFileSync: writeFileSync30 } = await import("node:fs");
|
|
95248
|
+
const { join: join49 } = await import("node:path");
|
|
95249
|
+
const dir = join49(ROOT, ".claude");
|
|
95250
|
+
if (!existsSync40(dir)) mkdirSync12(dir, { recursive: true });
|
|
95251
|
+
const file2 = join49(dir, "settings.json");
|
|
95086
95252
|
let settings = {};
|
|
95087
|
-
if (
|
|
95253
|
+
if (existsSync40(file2)) {
|
|
95088
95254
|
try {
|
|
95089
|
-
settings = JSON.parse(
|
|
95255
|
+
settings = JSON.parse(readFileSync43(file2, "utf8"));
|
|
95090
95256
|
} catch {
|
|
95091
95257
|
console.error(`refusing to overwrite invalid JSON at ${file2}`);
|
|
95092
95258
|
process.exit(2);
|
|
@@ -95135,11 +95301,12 @@ async function installClaudeHooks(port) {
|
|
|
95135
95301
|
list.push({ hooks: [{ type: "command", command: injectCmd }] });
|
|
95136
95302
|
}
|
|
95137
95303
|
removeProjectStatusLine(settings);
|
|
95138
|
-
|
|
95304
|
+
writeFileSync30(file2, JSON.stringify(settings, null, 2) + "\n", "utf8");
|
|
95139
95305
|
console.log(`installed Claude Code hooks \u2192 ${file2}`);
|
|
95140
95306
|
console.log(` ${ensureStatusLine(port)}`);
|
|
95307
|
+
console.log(` ${installClaudeMods().line}`);
|
|
95141
95308
|
await installClaudeMcpConfig();
|
|
95142
|
-
const claudeMd =
|
|
95309
|
+
const claudeMd = join49(ROOT, "CLAUDE.md");
|
|
95143
95310
|
const recall = writeManagedBlock(claudeMd, { body: RECALL_FIRST_BLOCK });
|
|
95144
95311
|
if (recall.kind === "collision") {
|
|
95145
95312
|
console.warn(
|
|
@@ -95151,15 +95318,15 @@ async function installClaudeHooks(port) {
|
|
|
95151
95318
|
console.log(` endpoint: http://127.0.0.1:${port}/api/hook`);
|
|
95152
95319
|
}
|
|
95153
95320
|
async function installClaudeMcpConfig() {
|
|
95154
|
-
const { mkdirSync:
|
|
95155
|
-
const { join:
|
|
95156
|
-
const file2 =
|
|
95157
|
-
const dir =
|
|
95158
|
-
if (!
|
|
95321
|
+
const { mkdirSync: mkdirSync12, existsSync: existsSync40, readFileSync: readFileSync43, writeFileSync: writeFileSync30 } = await import("node:fs");
|
|
95322
|
+
const { join: join49, dirname: dirname16 } = await import("node:path");
|
|
95323
|
+
const file2 = join49(ROOT, ".mcp.json");
|
|
95324
|
+
const dir = dirname16(file2);
|
|
95325
|
+
if (!existsSync40(dir)) mkdirSync12(dir, { recursive: true });
|
|
95159
95326
|
let cfg = {};
|
|
95160
|
-
if (
|
|
95327
|
+
if (existsSync40(file2)) {
|
|
95161
95328
|
try {
|
|
95162
|
-
cfg = JSON.parse(
|
|
95329
|
+
cfg = JSON.parse(readFileSync43(file2, "utf8"));
|
|
95163
95330
|
} catch {
|
|
95164
95331
|
console.error(`refusing to overwrite invalid JSON at ${file2}`);
|
|
95165
95332
|
process.exit(2);
|
|
@@ -95167,21 +95334,21 @@ async function installClaudeMcpConfig() {
|
|
|
95167
95334
|
}
|
|
95168
95335
|
cfg.mcpServers ??= {};
|
|
95169
95336
|
cfg.mcpServers["errata"] = errataMcpInvocation();
|
|
95170
|
-
|
|
95337
|
+
writeFileSync30(file2, JSON.stringify(cfg, null, 2) + "\n", "utf8");
|
|
95171
95338
|
console.log(`installed Claude Code MCP server config \u2192 ${file2}`);
|
|
95172
95339
|
console.log(` Claude Code will spawn \`errata mcp\` on workspace open.`);
|
|
95173
95340
|
console.log(` Tools: errata.search / locate / neighbors / callers_of / what_uses / show / similar`);
|
|
95174
95341
|
}
|
|
95175
95342
|
async function installCursorMcpConfig() {
|
|
95176
|
-
const { mkdirSync:
|
|
95177
|
-
const { join:
|
|
95178
|
-
const dir =
|
|
95179
|
-
if (!
|
|
95180
|
-
const file2 =
|
|
95343
|
+
const { mkdirSync: mkdirSync12, existsSync: existsSync40, readFileSync: readFileSync43, writeFileSync: writeFileSync30 } = await import("node:fs");
|
|
95344
|
+
const { join: join49 } = await import("node:path");
|
|
95345
|
+
const dir = join49(ROOT, ".cursor");
|
|
95346
|
+
if (!existsSync40(dir)) mkdirSync12(dir, { recursive: true });
|
|
95347
|
+
const file2 = join49(dir, "mcp.json");
|
|
95181
95348
|
let cfg = {};
|
|
95182
|
-
if (
|
|
95349
|
+
if (existsSync40(file2)) {
|
|
95183
95350
|
try {
|
|
95184
|
-
cfg = JSON.parse(
|
|
95351
|
+
cfg = JSON.parse(readFileSync43(file2, "utf8"));
|
|
95185
95352
|
} catch {
|
|
95186
95353
|
console.error(`refusing to overwrite invalid JSON at ${file2}`);
|
|
95187
95354
|
process.exit(2);
|
|
@@ -95189,7 +95356,7 @@ async function installCursorMcpConfig() {
|
|
|
95189
95356
|
}
|
|
95190
95357
|
cfg.mcpServers ??= {};
|
|
95191
95358
|
cfg.mcpServers["errata"] = errataMcpInvocation();
|
|
95192
|
-
|
|
95359
|
+
writeFileSync30(file2, JSON.stringify(cfg, null, 2) + "\n", "utf8");
|
|
95193
95360
|
console.log(`installed Cursor MCP server config \u2192 ${file2}`);
|
|
95194
95361
|
console.log(` Cursor will spawn \`errata mcp\` on workspace open.`);
|
|
95195
95362
|
console.log(` Tools: errata.search / locate / neighbors / callers_of / what_uses`);
|
|
@@ -95200,7 +95367,7 @@ async function installCodexHooks(port) {
|
|
|
95200
95367
|
const gitRoot = nearestGitRoot(process.cwd());
|
|
95201
95368
|
const hookRoot = gitRoot && mainCheckoutOfWorktree(gitRoot) ? gitRoot : ROOT;
|
|
95202
95369
|
const file2 = writeCodexHooks(hookRoot, port);
|
|
95203
|
-
const instructions = writeManagedBlock(
|
|
95370
|
+
const instructions = writeManagedBlock(join48(hookRoot, "AGENTS.md"), {
|
|
95204
95371
|
body: AGENTS_POINTER_BODY,
|
|
95205
95372
|
stable: true
|
|
95206
95373
|
});
|
|
@@ -95393,6 +95560,8 @@ async function cmdDash(args2) {
|
|
|
95393
95560
|
const reindexOnStart = !args2.includes("--no-reindex");
|
|
95394
95561
|
const skipEmbed = !args2.includes("--embed");
|
|
95395
95562
|
const skipWatchers = args2.includes("--no-watch");
|
|
95563
|
+
const mods = installClaudeMods();
|
|
95564
|
+
if (mods.changed) console.log(`[errata] ${mods.line}`);
|
|
95396
95565
|
const handle2 = await startMultiDaemon({
|
|
95397
95566
|
webPort: port,
|
|
95398
95567
|
reindexOnStart,
|
|
@@ -95542,7 +95711,7 @@ async function cmdDash(args2) {
|
|
|
95542
95711
|
const hotspotScanMark = /* @__PURE__ */ new Map();
|
|
95543
95712
|
const HOTSPOT_FANIN = 20;
|
|
95544
95713
|
const runNightlyPass = async (dueIds) => {
|
|
95545
|
-
const yieldToLoop2 = () => new Promise((
|
|
95714
|
+
const yieldToLoop2 = () => new Promise((resolve10) => setImmediate(resolve10));
|
|
95546
95715
|
const fullReclusterPass = nightlyCount++ % FULL_RECLUSTER_EVERY === 0;
|
|
95547
95716
|
const m = dueIds ? await handle2.nightlyFor(dueIds) : await handle2.nightlyAll();
|
|
95548
95717
|
let skillsLearned = 0;
|
|
@@ -95620,9 +95789,9 @@ async function cmdDash(args2) {
|
|
|
95620
95789
|
await yieldToLoop2();
|
|
95621
95790
|
try {
|
|
95622
95791
|
const items = selectDurableMemory(handle2.sharedStore, r.engine.profile, {
|
|
95623
|
-
atCommit: readGitRefState(
|
|
95792
|
+
atCommit: readGitRefState(join48(r.root, ".git")).sha ?? void 0
|
|
95624
95793
|
});
|
|
95625
|
-
const res = bleedRules(
|
|
95794
|
+
const res = bleedRules(join48(r.root, ".claude", "rules"), items);
|
|
95626
95795
|
if (res.written || res.pruned) {
|
|
95627
95796
|
console.log(
|
|
95628
95797
|
`[rules:${r.entry.name}] ${res.written} collective principle(s) \u2192 .claude/rules` + (res.pruned ? `, ${res.pruned} pruned` : "")
|