@inerrata-corporation/errata 2.0.19-dev.3624 → 2.0.20-dev.3658
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/README.txt +7 -0
- package/errata.mjs +1048 -183
- package/package.json +1 -1
- package/resources/context-plugin/.codex-plugin/plugin.json +24 -0
- package/resources/context-plugin/INSTALL.md +43 -0
- package/resources/context-plugin/SHA256SUMS +14 -0
- package/resources/context-plugin/SUBMISSION.md +97 -0
- package/resources/context-plugin/THIRD-PARTY-NOTICES.md +2840 -0
- package/resources/context-plugin/assets/icon.png +0 -0
- package/resources/context-plugin/configure-local.mjs +27 -0
- package/resources/context-plugin/dist/client.js +4147 -0
- package/resources/context-plugin/dist/index.html +26 -0
- package/resources/context-plugin/dist/mcp-server.mjs +30660 -0
- package/resources/context-plugin/dist/panel.html +4362 -0
- package/resources/context-plugin/dist/server.mjs +521 -0
- package/resources/context-plugin/dist/style.css +189 -0
- package/resources/context-plugin/launch.mjs +63 -0
- package/resources/context-plugin/skills/context-graph/SKILL.md +37 -0
package/errata.mjs
CHANGED
|
@@ -1388,9 +1388,9 @@ function floatSafeRemainder(val, step) {
|
|
|
1388
1388
|
const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
|
|
1389
1389
|
return valInt % stepInt / 10 ** decCount;
|
|
1390
1390
|
}
|
|
1391
|
-
function defineLazy(
|
|
1391
|
+
function defineLazy(object3, key, getter) {
|
|
1392
1392
|
let value = void 0;
|
|
1393
|
-
Object.defineProperty(
|
|
1393
|
+
Object.defineProperty(object3, key, {
|
|
1394
1394
|
get() {
|
|
1395
1395
|
if (value === EVALUATING) {
|
|
1396
1396
|
return void 0;
|
|
@@ -1402,7 +1402,7 @@ function defineLazy(object2, key, getter) {
|
|
|
1402
1402
|
return value;
|
|
1403
1403
|
},
|
|
1404
1404
|
set(v) {
|
|
1405
|
-
Object.defineProperty(
|
|
1405
|
+
Object.defineProperty(object3, key, {
|
|
1406
1406
|
value: v
|
|
1407
1407
|
// configurable: true,
|
|
1408
1408
|
});
|
|
@@ -17175,10 +17175,10 @@ function parseManifest(path2, text) {
|
|
|
17175
17175
|
if (name2.endsWith(".gemspec")) return parseGemspec(path2, text);
|
|
17176
17176
|
return [];
|
|
17177
17177
|
}
|
|
17178
|
-
function buildSpine(sha2, manifestPaths2,
|
|
17178
|
+
function buildSpine(sha2, manifestPaths2, readText2) {
|
|
17179
17179
|
const manifests = {};
|
|
17180
17180
|
for (const p of manifestPaths2) {
|
|
17181
|
-
const deps = parseManifest(p,
|
|
17181
|
+
const deps = parseManifest(p, readText2(p));
|
|
17182
17182
|
if (deps.length > 0) manifests[p] = deps;
|
|
17183
17183
|
}
|
|
17184
17184
|
return { sha: sha2, manifests };
|
|
@@ -29219,9 +29219,9 @@ var init_context = __esm({
|
|
|
29219
29219
|
* })
|
|
29220
29220
|
* ```
|
|
29221
29221
|
*/
|
|
29222
|
-
json = (
|
|
29222
|
+
json = (object3, arg, headers) => {
|
|
29223
29223
|
return this.#newResponse(
|
|
29224
|
-
JSON.stringify(
|
|
29224
|
+
JSON.stringify(object3),
|
|
29225
29225
|
arg,
|
|
29226
29226
|
setDefaultContentType("application/json", headers)
|
|
29227
29227
|
);
|
|
@@ -54397,8 +54397,8 @@ var require_ignore = __commonJS({
|
|
|
54397
54397
|
TMP_KEY_IGNORE = Symbol.for("node-ignore");
|
|
54398
54398
|
}
|
|
54399
54399
|
var KEY_IGNORE = TMP_KEY_IGNORE;
|
|
54400
|
-
var define = (
|
|
54401
|
-
Object.defineProperty(
|
|
54400
|
+
var define = (object3, key, value) => {
|
|
54401
|
+
Object.defineProperty(object3, key, { value });
|
|
54402
54402
|
return value;
|
|
54403
54403
|
};
|
|
54404
54404
|
var REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g;
|
|
@@ -55528,7 +55528,7 @@ var require_util = __commonJS({
|
|
|
55528
55528
|
var net = __require("node:net");
|
|
55529
55529
|
var { Blob: Blob2 } = __require("node:buffer");
|
|
55530
55530
|
var nodeUtil = __require("node:util");
|
|
55531
|
-
var { stringify } = __require("node:querystring");
|
|
55531
|
+
var { stringify: stringify2 } = __require("node:querystring");
|
|
55532
55532
|
var { EventEmitter: EE } = __require("node:events");
|
|
55533
55533
|
var { InvalidArgumentError } = require_errors();
|
|
55534
55534
|
var { headerNameLowerCasedRecord } = require_constants();
|
|
@@ -55572,23 +55572,23 @@ var require_util = __commonJS({
|
|
|
55572
55572
|
function isStream(obj) {
|
|
55573
55573
|
return obj && typeof obj === "object" && typeof obj.pipe === "function" && typeof obj.on === "function";
|
|
55574
55574
|
}
|
|
55575
|
-
function isBlobLike(
|
|
55576
|
-
if (
|
|
55575
|
+
function isBlobLike(object3) {
|
|
55576
|
+
if (object3 === null) {
|
|
55577
55577
|
return false;
|
|
55578
|
-
} else if (
|
|
55578
|
+
} else if (object3 instanceof Blob2) {
|
|
55579
55579
|
return true;
|
|
55580
|
-
} else if (typeof
|
|
55580
|
+
} else if (typeof object3 !== "object") {
|
|
55581
55581
|
return false;
|
|
55582
55582
|
} else {
|
|
55583
|
-
const sTag =
|
|
55584
|
-
return (sTag === "Blob" || sTag === "File") && ("stream" in
|
|
55583
|
+
const sTag = object3[Symbol.toStringTag];
|
|
55584
|
+
return (sTag === "Blob" || sTag === "File") && ("stream" in object3 && typeof object3.stream === "function" || "arrayBuffer" in object3 && typeof object3.arrayBuffer === "function");
|
|
55585
55585
|
}
|
|
55586
55586
|
}
|
|
55587
55587
|
function buildURL(url2, queryParams) {
|
|
55588
55588
|
if (url2.includes("?") || url2.includes("#")) {
|
|
55589
55589
|
throw new Error('Query params cannot be passed when url already contains "?" or "#".');
|
|
55590
55590
|
}
|
|
55591
|
-
const stringified =
|
|
55591
|
+
const stringified = stringify2(queryParams);
|
|
55592
55592
|
if (stringified) {
|
|
55593
55593
|
url2 += "?" + stringified;
|
|
55594
55594
|
}
|
|
@@ -55863,8 +55863,8 @@ var require_util = __commonJS({
|
|
|
55863
55863
|
}
|
|
55864
55864
|
);
|
|
55865
55865
|
}
|
|
55866
|
-
function isFormDataLike(
|
|
55867
|
-
return
|
|
55866
|
+
function isFormDataLike(object3) {
|
|
55867
|
+
return object3 && typeof object3 === "object" && typeof object3.append === "function" && typeof object3.delete === "function" && typeof object3.get === "function" && typeof object3.getAll === "function" && typeof object3.has === "function" && typeof object3.set === "function" && object3[Symbol.toStringTag] === "FormData";
|
|
55868
55868
|
}
|
|
55869
55869
|
function addAbortListener(signal, listener) {
|
|
55870
55870
|
if ("addEventListener" in signal) {
|
|
@@ -57990,7 +57990,7 @@ var require_data_url = __commonJS({
|
|
|
57990
57990
|
const buffer = Buffer.from(data, "base64");
|
|
57991
57991
|
return new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
57992
57992
|
}
|
|
57993
|
-
function collectAnHTTPQuotedString(input, position,
|
|
57993
|
+
function collectAnHTTPQuotedString(input, position, extractValue2) {
|
|
57994
57994
|
const positionStart = position.position;
|
|
57995
57995
|
let value = "";
|
|
57996
57996
|
assert2(input[position.position] === '"');
|
|
@@ -58018,7 +58018,7 @@ var require_data_url = __commonJS({
|
|
|
58018
58018
|
break;
|
|
58019
58019
|
}
|
|
58020
58020
|
}
|
|
58021
|
-
if (
|
|
58021
|
+
if (extractValue2) {
|
|
58022
58022
|
return value;
|
|
58023
58023
|
}
|
|
58024
58024
|
return input.slice(positionStart, position.position);
|
|
@@ -58618,8 +58618,8 @@ var require_util2 = __commonJS({
|
|
|
58618
58618
|
}
|
|
58619
58619
|
return "allowed";
|
|
58620
58620
|
}
|
|
58621
|
-
function isErrorLike(
|
|
58622
|
-
return
|
|
58621
|
+
function isErrorLike(object3) {
|
|
58622
|
+
return object3 instanceof Error || (object3?.constructor?.name === "Error" || object3?.constructor?.name === "DOMException");
|
|
58623
58623
|
}
|
|
58624
58624
|
function isValidReasonPhrase(statusText) {
|
|
58625
58625
|
for (let i2 = 0; i2 < statusText.length; ++i2) {
|
|
@@ -59044,7 +59044,7 @@ var require_util2 = __commonJS({
|
|
|
59044
59044
|
return new FastIterableIterator(target, kind);
|
|
59045
59045
|
};
|
|
59046
59046
|
}
|
|
59047
|
-
function iteratorMixin(name2,
|
|
59047
|
+
function iteratorMixin(name2, object3, kInternalIterator, keyIndex = 0, valueIndex = 1) {
|
|
59048
59048
|
const makeIterator = createIterator(name2, kInternalIterator, keyIndex, valueIndex);
|
|
59049
59049
|
const properties = {
|
|
59050
59050
|
keys: {
|
|
@@ -59052,7 +59052,7 @@ var require_util2 = __commonJS({
|
|
|
59052
59052
|
enumerable: true,
|
|
59053
59053
|
configurable: true,
|
|
59054
59054
|
value: function keys() {
|
|
59055
|
-
webidl.brandCheck(this,
|
|
59055
|
+
webidl.brandCheck(this, object3);
|
|
59056
59056
|
return makeIterator(this, "key");
|
|
59057
59057
|
}
|
|
59058
59058
|
},
|
|
@@ -59061,7 +59061,7 @@ var require_util2 = __commonJS({
|
|
|
59061
59061
|
enumerable: true,
|
|
59062
59062
|
configurable: true,
|
|
59063
59063
|
value: function values() {
|
|
59064
|
-
webidl.brandCheck(this,
|
|
59064
|
+
webidl.brandCheck(this, object3);
|
|
59065
59065
|
return makeIterator(this, "value");
|
|
59066
59066
|
}
|
|
59067
59067
|
},
|
|
@@ -59070,7 +59070,7 @@ var require_util2 = __commonJS({
|
|
|
59070
59070
|
enumerable: true,
|
|
59071
59071
|
configurable: true,
|
|
59072
59072
|
value: function entries() {
|
|
59073
|
-
webidl.brandCheck(this,
|
|
59073
|
+
webidl.brandCheck(this, object3);
|
|
59074
59074
|
return makeIterator(this, "key+value");
|
|
59075
59075
|
}
|
|
59076
59076
|
},
|
|
@@ -59079,7 +59079,7 @@ var require_util2 = __commonJS({
|
|
|
59079
59079
|
enumerable: true,
|
|
59080
59080
|
configurable: true,
|
|
59081
59081
|
value: function forEach(callbackfn, thisArg = globalThis) {
|
|
59082
|
-
webidl.brandCheck(this,
|
|
59082
|
+
webidl.brandCheck(this, object3);
|
|
59083
59083
|
webidl.argumentLengthCheck(arguments, 1, `${name2}.forEach`);
|
|
59084
59084
|
if (typeof callbackfn !== "function") {
|
|
59085
59085
|
throw new TypeError(
|
|
@@ -59092,7 +59092,7 @@ var require_util2 = __commonJS({
|
|
|
59092
59092
|
}
|
|
59093
59093
|
}
|
|
59094
59094
|
};
|
|
59095
|
-
return Object.defineProperties(
|
|
59095
|
+
return Object.defineProperties(object3.prototype, {
|
|
59096
59096
|
...properties,
|
|
59097
59097
|
[Symbol.iterator]: {
|
|
59098
59098
|
writable: true,
|
|
@@ -59492,8 +59492,8 @@ var require_file = __commonJS({
|
|
|
59492
59492
|
}
|
|
59493
59493
|
};
|
|
59494
59494
|
webidl.converters.Blob = webidl.interfaceConverter(Blob2);
|
|
59495
|
-
function isFileLike(
|
|
59496
|
-
return
|
|
59495
|
+
function isFileLike(object3) {
|
|
59496
|
+
return object3 instanceof File2 || object3 && (typeof object3.stream === "function" || typeof object3.arrayBuffer === "function") && object3[Symbol.toStringTag] === "File";
|
|
59497
59497
|
}
|
|
59498
59498
|
module2.exports = { FileLike, isFileLike };
|
|
59499
59499
|
}
|
|
@@ -59941,12 +59941,12 @@ var require_body = __commonJS({
|
|
|
59941
59941
|
}
|
|
59942
59942
|
});
|
|
59943
59943
|
}
|
|
59944
|
-
function extractBody(
|
|
59944
|
+
function extractBody(object3, keepalive = false) {
|
|
59945
59945
|
let stream = null;
|
|
59946
|
-
if (
|
|
59947
|
-
stream =
|
|
59948
|
-
} else if (isBlobLike(
|
|
59949
|
-
stream =
|
|
59946
|
+
if (object3 instanceof ReadableStream) {
|
|
59947
|
+
stream = object3;
|
|
59948
|
+
} else if (isBlobLike(object3)) {
|
|
59949
|
+
stream = object3.stream();
|
|
59950
59950
|
} else {
|
|
59951
59951
|
stream = new ReadableStream({
|
|
59952
59952
|
async pull(controller) {
|
|
@@ -59966,17 +59966,17 @@ var require_body = __commonJS({
|
|
|
59966
59966
|
let source = null;
|
|
59967
59967
|
let length = null;
|
|
59968
59968
|
let type = null;
|
|
59969
|
-
if (typeof
|
|
59970
|
-
source =
|
|
59969
|
+
if (typeof object3 === "string") {
|
|
59970
|
+
source = object3;
|
|
59971
59971
|
type = "text/plain;charset=UTF-8";
|
|
59972
|
-
} else if (
|
|
59973
|
-
source =
|
|
59972
|
+
} else if (object3 instanceof URLSearchParams) {
|
|
59973
|
+
source = object3.toString();
|
|
59974
59974
|
type = "application/x-www-form-urlencoded;charset=UTF-8";
|
|
59975
|
-
} else if (isArrayBuffer(
|
|
59976
|
-
source = new Uint8Array(
|
|
59977
|
-
} else if (ArrayBuffer.isView(
|
|
59978
|
-
source = new Uint8Array(
|
|
59979
|
-
} else if (util.isFormDataLike(
|
|
59975
|
+
} else if (isArrayBuffer(object3)) {
|
|
59976
|
+
source = new Uint8Array(object3.slice());
|
|
59977
|
+
} else if (ArrayBuffer.isView(object3)) {
|
|
59978
|
+
source = new Uint8Array(object3.buffer.slice(object3.byteOffset, object3.byteOffset + object3.byteLength));
|
|
59979
|
+
} else if (util.isFormDataLike(object3)) {
|
|
59980
59980
|
const boundary = `----formdata-undici-0${`${random(1e11)}`.padStart(11, "0")}`;
|
|
59981
59981
|
const prefix = `--${boundary}\r
|
|
59982
59982
|
Content-Disposition: form-data`;
|
|
@@ -59986,7 +59986,7 @@ Content-Disposition: form-data`;
|
|
|
59986
59986
|
const rn = new Uint8Array([13, 10]);
|
|
59987
59987
|
length = 0;
|
|
59988
59988
|
let hasUnknownSizeValue = false;
|
|
59989
|
-
for (const [name2, value] of
|
|
59989
|
+
for (const [name2, value] of object3) {
|
|
59990
59990
|
if (typeof value === "string") {
|
|
59991
59991
|
const chunk2 = textEncoder.encode(prefix + `; name="${escape(normalizeLinefeeds(name2))}"\r
|
|
59992
59992
|
\r
|
|
@@ -60014,7 +60014,7 @@ Content-Type: ${value.type || "application/octet-stream"}\r
|
|
|
60014
60014
|
if (hasUnknownSizeValue) {
|
|
60015
60015
|
length = null;
|
|
60016
60016
|
}
|
|
60017
|
-
source =
|
|
60017
|
+
source = object3;
|
|
60018
60018
|
action = async function* () {
|
|
60019
60019
|
for (const part of blobParts) {
|
|
60020
60020
|
if (part.stream) {
|
|
@@ -60025,22 +60025,22 @@ Content-Type: ${value.type || "application/octet-stream"}\r
|
|
|
60025
60025
|
}
|
|
60026
60026
|
};
|
|
60027
60027
|
type = `multipart/form-data; boundary=${boundary}`;
|
|
60028
|
-
} else if (isBlobLike(
|
|
60029
|
-
source =
|
|
60030
|
-
length =
|
|
60031
|
-
if (
|
|
60032
|
-
type =
|
|
60028
|
+
} else if (isBlobLike(object3)) {
|
|
60029
|
+
source = object3;
|
|
60030
|
+
length = object3.size;
|
|
60031
|
+
if (object3.type) {
|
|
60032
|
+
type = object3.type;
|
|
60033
60033
|
}
|
|
60034
|
-
} else if (typeof
|
|
60034
|
+
} else if (typeof object3[Symbol.asyncIterator] === "function") {
|
|
60035
60035
|
if (keepalive) {
|
|
60036
60036
|
throw new TypeError("keepalive");
|
|
60037
60037
|
}
|
|
60038
|
-
if (util.isDisturbed(
|
|
60038
|
+
if (util.isDisturbed(object3) || object3.locked) {
|
|
60039
60039
|
throw new TypeError(
|
|
60040
60040
|
"Response body object should not be disturbed or locked"
|
|
60041
60041
|
);
|
|
60042
60042
|
}
|
|
60043
|
-
stream =
|
|
60043
|
+
stream = object3 instanceof ReadableStream ? object3 : ReadableStreamFrom(object3);
|
|
60044
60044
|
}
|
|
60045
60045
|
if (typeof source === "string" || util.isBuffer(source)) {
|
|
60046
60046
|
length = Buffer.byteLength(source);
|
|
@@ -60049,7 +60049,7 @@ Content-Type: ${value.type || "application/octet-stream"}\r
|
|
|
60049
60049
|
let iterator;
|
|
60050
60050
|
stream = new ReadableStream({
|
|
60051
60051
|
async start() {
|
|
60052
|
-
iterator = action(
|
|
60052
|
+
iterator = action(object3)[Symbol.asyncIterator]();
|
|
60053
60053
|
},
|
|
60054
60054
|
async pull(controller) {
|
|
60055
60055
|
const { value, done } = await iterator.next();
|
|
@@ -60077,12 +60077,12 @@ Content-Type: ${value.type || "application/octet-stream"}\r
|
|
|
60077
60077
|
const body2 = { stream, source, length };
|
|
60078
60078
|
return [body2, type];
|
|
60079
60079
|
}
|
|
60080
|
-
function safelyExtractBody(
|
|
60081
|
-
if (
|
|
60082
|
-
assert2(!util.isDisturbed(
|
|
60083
|
-
assert2(!
|
|
60080
|
+
function safelyExtractBody(object3, keepalive = false) {
|
|
60081
|
+
if (object3 instanceof ReadableStream) {
|
|
60082
|
+
assert2(!util.isDisturbed(object3), "The body has already been consumed.");
|
|
60083
|
+
assert2(!object3.locked, "The stream is locked.");
|
|
60084
60084
|
}
|
|
60085
|
-
return extractBody(
|
|
60085
|
+
return extractBody(object3, keepalive);
|
|
60086
60086
|
}
|
|
60087
60087
|
function cloneBody(instance2, body2) {
|
|
60088
60088
|
const [out1, out2] = body2.stream.tee();
|
|
@@ -60162,12 +60162,12 @@ Content-Type: ${value.type || "application/octet-stream"}\r
|
|
|
60162
60162
|
function mixinBody(prototype) {
|
|
60163
60163
|
Object.assign(prototype.prototype, bodyMixinMethods(prototype));
|
|
60164
60164
|
}
|
|
60165
|
-
async function consumeBody(
|
|
60166
|
-
webidl.brandCheck(
|
|
60167
|
-
if (bodyUnusable(
|
|
60165
|
+
async function consumeBody(object3, convertBytesToJSValue, instance2) {
|
|
60166
|
+
webidl.brandCheck(object3, instance2);
|
|
60167
|
+
if (bodyUnusable(object3)) {
|
|
60168
60168
|
throw new TypeError("Body is unusable: Body has already been read");
|
|
60169
60169
|
}
|
|
60170
|
-
throwIfAborted(
|
|
60170
|
+
throwIfAborted(object3[kState]);
|
|
60171
60171
|
const promise2 = createDeferredPromise();
|
|
60172
60172
|
const errorSteps = (error48) => promise2.reject(error48);
|
|
60173
60173
|
const successSteps = (data) => {
|
|
@@ -60177,15 +60177,15 @@ Content-Type: ${value.type || "application/octet-stream"}\r
|
|
|
60177
60177
|
errorSteps(e);
|
|
60178
60178
|
}
|
|
60179
60179
|
};
|
|
60180
|
-
if (
|
|
60180
|
+
if (object3[kState].body == null) {
|
|
60181
60181
|
successSteps(Buffer.allocUnsafe(0));
|
|
60182
60182
|
return promise2.promise;
|
|
60183
60183
|
}
|
|
60184
|
-
await fullyReadBody(
|
|
60184
|
+
await fullyReadBody(object3[kState].body, successSteps, errorSteps);
|
|
60185
60185
|
return promise2.promise;
|
|
60186
60186
|
}
|
|
60187
|
-
function bodyUnusable(
|
|
60188
|
-
const body2 =
|
|
60187
|
+
function bodyUnusable(object3) {
|
|
60188
|
+
const body2 = object3[kState].body;
|
|
60189
60189
|
return body2 != null && (body2.stream.locked || util.isDisturbed(body2.stream));
|
|
60190
60190
|
}
|
|
60191
60191
|
function parseJSONFromBytes(bytes) {
|
|
@@ -66232,10 +66232,10 @@ var require_headers = __commonJS({
|
|
|
66232
66232
|
while (j > i2 && isHTTPWhiteSpaceCharCode(potentialValue.charCodeAt(i2))) ++i2;
|
|
66233
66233
|
return i2 === 0 && j === potentialValue.length ? potentialValue : potentialValue.substring(i2, j);
|
|
66234
66234
|
}
|
|
66235
|
-
function fill(headers,
|
|
66236
|
-
if (Array.isArray(
|
|
66237
|
-
for (let i2 = 0; i2 <
|
|
66238
|
-
const header =
|
|
66235
|
+
function fill(headers, object3) {
|
|
66236
|
+
if (Array.isArray(object3)) {
|
|
66237
|
+
for (let i2 = 0; i2 < object3.length; ++i2) {
|
|
66238
|
+
const header = object3[i2];
|
|
66239
66239
|
if (header.length !== 2) {
|
|
66240
66240
|
throw webidl.errors.exception({
|
|
66241
66241
|
header: "Headers constructor",
|
|
@@ -66244,10 +66244,10 @@ var require_headers = __commonJS({
|
|
|
66244
66244
|
}
|
|
66245
66245
|
appendHeader(headers, header[0], header[1]);
|
|
66246
66246
|
}
|
|
66247
|
-
} else if (typeof
|
|
66248
|
-
const keys = Object.keys(
|
|
66247
|
+
} else if (typeof object3 === "object" && object3 !== null) {
|
|
66248
|
+
const keys = Object.keys(object3);
|
|
66249
66249
|
for (let i2 = 0; i2 < keys.length; ++i2) {
|
|
66250
|
-
appendHeader(headers, keys[i2],
|
|
66250
|
+
appendHeader(headers, keys[i2], object3[keys[i2]]);
|
|
66251
66251
|
}
|
|
66252
66252
|
} else {
|
|
66253
66253
|
throw webidl.errors.conversionFailed({
|
|
@@ -70485,7 +70485,7 @@ var require_util6 = __commonJS({
|
|
|
70485
70485
|
throw new Error("Invalid cookie max-age");
|
|
70486
70486
|
}
|
|
70487
70487
|
}
|
|
70488
|
-
function
|
|
70488
|
+
function stringify2(cookie) {
|
|
70489
70489
|
if (cookie.name.length === 0) {
|
|
70490
70490
|
return null;
|
|
70491
70491
|
}
|
|
@@ -70539,7 +70539,7 @@ var require_util6 = __commonJS({
|
|
|
70539
70539
|
validateCookiePath,
|
|
70540
70540
|
validateCookieValue,
|
|
70541
70541
|
toIMFDate,
|
|
70542
|
-
stringify
|
|
70542
|
+
stringify: stringify2
|
|
70543
70543
|
};
|
|
70544
70544
|
}
|
|
70545
70545
|
});
|
|
@@ -70689,7 +70689,7 @@ var require_cookies = __commonJS({
|
|
|
70689
70689
|
"../../node_modules/.pnpm/undici@6.24.1/node_modules/undici/lib/web/cookies/index.js"(exports, module2) {
|
|
70690
70690
|
"use strict";
|
|
70691
70691
|
var { parseSetCookie } = require_parse();
|
|
70692
|
-
var { stringify } = require_util6();
|
|
70692
|
+
var { stringify: stringify2 } = require_util6();
|
|
70693
70693
|
var { webidl } = require_webidl();
|
|
70694
70694
|
var { Headers: Headers2 } = require_headers();
|
|
70695
70695
|
function getCookies(headers) {
|
|
@@ -70732,7 +70732,7 @@ var require_cookies = __commonJS({
|
|
|
70732
70732
|
webidl.argumentLengthCheck(arguments, 2, "setCookie");
|
|
70733
70733
|
webidl.brandCheck(headers, Headers2, { strict: false });
|
|
70734
70734
|
cookie = webidl.converters.Cookie(cookie);
|
|
70735
|
-
const str =
|
|
70735
|
+
const str = stringify2(cookie);
|
|
70736
70736
|
if (str) {
|
|
70737
70737
|
headers.append("Set-Cookie", str);
|
|
70738
70738
|
}
|
|
@@ -73619,8 +73619,8 @@ var init_report_render = __esm({
|
|
|
73619
73619
|
|
|
73620
73620
|
// src/cli.ts
|
|
73621
73621
|
init_src6();
|
|
73622
|
-
import { closeSync as closeSync2, existsSync as
|
|
73623
|
-
import { join as
|
|
73622
|
+
import { closeSync as closeSync2, existsSync as existsSync40, openSync as openSync2, readFileSync as readFileSync42, renameSync as renameSync7, statSync as statSync12 } from "node:fs";
|
|
73623
|
+
import { join as join49, resolve as pathResolve2 } from "node:path";
|
|
73624
73624
|
import { spawn as spawn5 } from "node:child_process";
|
|
73625
73625
|
|
|
73626
73626
|
// src/daemon.ts
|
|
@@ -82706,7 +82706,7 @@ function createWatchBreaker(deps) {
|
|
|
82706
82706
|
}
|
|
82707
82707
|
|
|
82708
82708
|
// src/engine.ts
|
|
82709
|
-
var DAEMON_VERSION = true ? "2.0.
|
|
82709
|
+
var DAEMON_VERSION = true ? "2.0.20-dev.3658" : "2.0.0-alpha.0";
|
|
82710
82710
|
var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
|
|
82711
82711
|
var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
|
|
82712
82712
|
var GIT_OP_MUTE_MS = 4e3;
|
|
@@ -88253,7 +88253,7 @@ async function historicalAnchors(input) {
|
|
|
88253
88253
|
if (m) beforeTokens.set(m[2], m[1]);
|
|
88254
88254
|
}
|
|
88255
88255
|
const parsed = /* @__PURE__ */ new Map();
|
|
88256
|
-
const
|
|
88256
|
+
const parse5 = (commit, token) => {
|
|
88257
88257
|
const path2 = input.bundle.pathTokens[token];
|
|
88258
88258
|
if (!path2 || /[\r\n]/.test(path2) || !pathAllowedByFloor(path2) || isPathBlocked(ignore2, path2)) return Promise.resolve(null);
|
|
88259
88259
|
const provider = providers.find((p) => p.fileExtensions.includes(extname4(path2).toLowerCase()));
|
|
@@ -88292,7 +88292,7 @@ async function historicalAnchors(input) {
|
|
|
88292
88292
|
const commit = side === "after" ? input.unit.sha : input.unit.parents[0];
|
|
88293
88293
|
const token = side === "after" ? block.pathToken : beforeTokens.get(block.pathToken);
|
|
88294
88294
|
if (commit && /^[a-f0-9]{40,64}$/.test(commit) && token) {
|
|
88295
|
-
const file2 = await
|
|
88295
|
+
const file2 = await parse5(commit, token);
|
|
88296
88296
|
const row = (side === "after" ? after : before) - 1;
|
|
88297
88297
|
const start2 = file2?.offsets[row], stop2 = file2?.offsets[row + 1];
|
|
88298
88298
|
if (file2 && start2 !== void 0 && stop2 !== void 0) {
|
|
@@ -88962,6 +88962,7 @@ init_src7();
|
|
|
88962
88962
|
init_cloud_auth();
|
|
88963
88963
|
import { createServer } from "node:http";
|
|
88964
88964
|
var DEFAULT_OAUTH_SCOPE = "openid profile graph:read graph:write mcp:tools";
|
|
88965
|
+
var CODE_FLOW_OAUTH_SCOPE = `${DEFAULT_OAUTH_SCOPE} offline_access`;
|
|
88965
88966
|
var strip = (u) => u.replace(/\/+$/, "");
|
|
88966
88967
|
function deviceEndpoints(tokenEndpoint, deviceAuthorizationEndpoint) {
|
|
88967
88968
|
const token = new URL(tokenEndpoint);
|
|
@@ -89138,7 +89139,7 @@ async function loginOAuthLoopback(opts) {
|
|
|
89138
89139
|
const endpoints = await discoverEndpoints(opts.cloudUrl, fetchFn);
|
|
89139
89140
|
const pkce = generatePkce();
|
|
89140
89141
|
const state = randomState();
|
|
89141
|
-
const scope = opts.scope ??
|
|
89142
|
+
const scope = opts.scope ?? CODE_FLOW_OAUTH_SCOPE;
|
|
89142
89143
|
const { code, redirectUri, clientId } = await new Promise(
|
|
89143
89144
|
(resolve10, reject) => {
|
|
89144
89145
|
const server = createServer((req, res) => {
|
|
@@ -91679,7 +91680,6 @@ init_cloud_endpoint_policy();
|
|
|
91679
91680
|
|
|
91680
91681
|
// src/device-login.ts
|
|
91681
91682
|
init_src7();
|
|
91682
|
-
var DEFAULT_SCOPE = "openid profile graph:read graph:write mcp:tools";
|
|
91683
91683
|
var BRIDGE_REDIRECT_URI = "http://127.0.0.1:1/device-bridge-callback";
|
|
91684
91684
|
var strip2 = (u) => u.replace(/\/+$/, "");
|
|
91685
91685
|
async function discoverDeviceEndpoint(cloudUrl, fetchFn = fetch) {
|
|
@@ -91801,7 +91801,7 @@ function extractCode(redirectUrl, expectedState) {
|
|
|
91801
91801
|
async function loginViaDeviceBridge(opts) {
|
|
91802
91802
|
const fetchFn = opts.fetchFn ?? fetch;
|
|
91803
91803
|
const log = opts.log ?? console.log;
|
|
91804
|
-
const scope = opts.scope ??
|
|
91804
|
+
const scope = opts.scope ?? CODE_FLOW_OAUTH_SCOPE;
|
|
91805
91805
|
const timeoutMs = opts.timeoutMs ?? 15 * 6e4;
|
|
91806
91806
|
const endpoints = await discoverEndpoints(opts.cloudUrl, fetchFn);
|
|
91807
91807
|
const deviceEndpoint = await discoverDeviceEndpoint(opts.cloudUrl, fetchFn);
|
|
@@ -92519,18 +92519,836 @@ function consolidationGapMs(lastPassMs, policy) {
|
|
|
92519
92519
|
return Math.max(policy.baseFloorMs, lastPassMs * policy.dutyFactor);
|
|
92520
92520
|
}
|
|
92521
92521
|
|
|
92522
|
+
// src/codex-context-plugin.ts
|
|
92523
|
+
import { createHash as createHash20 } from "node:crypto";
|
|
92524
|
+
import { cpSync as cpSync2, existsSync as existsSync36, mkdirSync as mkdirSync10, readFileSync as readFileSync38, renameSync as renameSync6, writeFileSync as writeFileSync28 } from "node:fs";
|
|
92525
|
+
import { homedir as homedir8 } from "node:os";
|
|
92526
|
+
import { join as join45 } from "node:path";
|
|
92527
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
92528
|
+
|
|
92529
|
+
// ../../node_modules/.pnpm/smol-toml@1.6.1/node_modules/smol-toml/dist/error.js
|
|
92530
|
+
function getLineColFromPtr(string4, ptr) {
|
|
92531
|
+
let lines = string4.slice(0, ptr).split(/\r\n|\n|\r/g);
|
|
92532
|
+
return [lines.length, lines.pop().length + 1];
|
|
92533
|
+
}
|
|
92534
|
+
function makeCodeBlock(string4, line, column) {
|
|
92535
|
+
let lines = string4.split(/\r\n|\n|\r/g);
|
|
92536
|
+
let codeblock = "";
|
|
92537
|
+
let numberLen = (Math.log10(line + 1) | 0) + 1;
|
|
92538
|
+
for (let i2 = line - 1; i2 <= line + 1; i2++) {
|
|
92539
|
+
let l = lines[i2 - 1];
|
|
92540
|
+
if (!l)
|
|
92541
|
+
continue;
|
|
92542
|
+
codeblock += i2.toString().padEnd(numberLen, " ");
|
|
92543
|
+
codeblock += ": ";
|
|
92544
|
+
codeblock += l;
|
|
92545
|
+
codeblock += "\n";
|
|
92546
|
+
if (i2 === line) {
|
|
92547
|
+
codeblock += " ".repeat(numberLen + column + 2);
|
|
92548
|
+
codeblock += "^\n";
|
|
92549
|
+
}
|
|
92550
|
+
}
|
|
92551
|
+
return codeblock;
|
|
92552
|
+
}
|
|
92553
|
+
var TomlError = class extends Error {
|
|
92554
|
+
line;
|
|
92555
|
+
column;
|
|
92556
|
+
codeblock;
|
|
92557
|
+
constructor(message2, options) {
|
|
92558
|
+
const [line, column] = getLineColFromPtr(options.toml, options.ptr);
|
|
92559
|
+
const codeblock = makeCodeBlock(options.toml, line, column);
|
|
92560
|
+
super(`Invalid TOML document: ${message2}
|
|
92561
|
+
|
|
92562
|
+
${codeblock}`, options);
|
|
92563
|
+
this.line = line;
|
|
92564
|
+
this.column = column;
|
|
92565
|
+
this.codeblock = codeblock;
|
|
92566
|
+
}
|
|
92567
|
+
};
|
|
92568
|
+
|
|
92569
|
+
// ../../node_modules/.pnpm/smol-toml@1.6.1/node_modules/smol-toml/dist/util.js
|
|
92570
|
+
function isEscaped(str, ptr) {
|
|
92571
|
+
let i2 = 0;
|
|
92572
|
+
while (str[ptr - ++i2] === "\\")
|
|
92573
|
+
;
|
|
92574
|
+
return --i2 && i2 % 2;
|
|
92575
|
+
}
|
|
92576
|
+
function indexOfNewline(str, start2 = 0, end = str.length) {
|
|
92577
|
+
let idx = str.indexOf("\n", start2);
|
|
92578
|
+
if (str[idx - 1] === "\r")
|
|
92579
|
+
idx--;
|
|
92580
|
+
return idx <= end ? idx : -1;
|
|
92581
|
+
}
|
|
92582
|
+
function skipComment(str, ptr) {
|
|
92583
|
+
for (let i2 = ptr; i2 < str.length; i2++) {
|
|
92584
|
+
let c = str[i2];
|
|
92585
|
+
if (c === "\n")
|
|
92586
|
+
return i2;
|
|
92587
|
+
if (c === "\r" && str[i2 + 1] === "\n")
|
|
92588
|
+
return i2 + 1;
|
|
92589
|
+
if (c < " " && c !== " " || c === "\x7F") {
|
|
92590
|
+
throw new TomlError("control characters are not allowed in comments", {
|
|
92591
|
+
toml: str,
|
|
92592
|
+
ptr
|
|
92593
|
+
});
|
|
92594
|
+
}
|
|
92595
|
+
}
|
|
92596
|
+
return str.length;
|
|
92597
|
+
}
|
|
92598
|
+
function skipVoid(str, ptr, banNewLines, banComments) {
|
|
92599
|
+
let c;
|
|
92600
|
+
while (1) {
|
|
92601
|
+
while ((c = str[ptr]) === " " || c === " " || !banNewLines && (c === "\n" || c === "\r" && str[ptr + 1] === "\n"))
|
|
92602
|
+
ptr++;
|
|
92603
|
+
if (banComments || c !== "#")
|
|
92604
|
+
break;
|
|
92605
|
+
ptr = skipComment(str, ptr);
|
|
92606
|
+
}
|
|
92607
|
+
return ptr;
|
|
92608
|
+
}
|
|
92609
|
+
function skipUntil(str, ptr, sep6, end, banNewLines = false) {
|
|
92610
|
+
if (!end) {
|
|
92611
|
+
ptr = indexOfNewline(str, ptr);
|
|
92612
|
+
return ptr < 0 ? str.length : ptr;
|
|
92613
|
+
}
|
|
92614
|
+
for (let i2 = ptr; i2 < str.length; i2++) {
|
|
92615
|
+
let c = str[i2];
|
|
92616
|
+
if (c === "#") {
|
|
92617
|
+
i2 = indexOfNewline(str, i2);
|
|
92618
|
+
} else if (c === sep6) {
|
|
92619
|
+
return i2 + 1;
|
|
92620
|
+
} else if (c === end || banNewLines && (c === "\n" || c === "\r" && str[i2 + 1] === "\n")) {
|
|
92621
|
+
return i2;
|
|
92622
|
+
}
|
|
92623
|
+
}
|
|
92624
|
+
throw new TomlError("cannot find end of structure", {
|
|
92625
|
+
toml: str,
|
|
92626
|
+
ptr
|
|
92627
|
+
});
|
|
92628
|
+
}
|
|
92629
|
+
function getStringEnd(str, seek) {
|
|
92630
|
+
let first = str[seek];
|
|
92631
|
+
let target = first === str[seek + 1] && str[seek + 1] === str[seek + 2] ? str.slice(seek, seek + 3) : first;
|
|
92632
|
+
seek += target.length - 1;
|
|
92633
|
+
do
|
|
92634
|
+
seek = str.indexOf(target, ++seek);
|
|
92635
|
+
while (seek > -1 && first !== "'" && isEscaped(str, seek));
|
|
92636
|
+
if (seek > -1) {
|
|
92637
|
+
seek += target.length;
|
|
92638
|
+
if (target.length > 1) {
|
|
92639
|
+
if (str[seek] === first)
|
|
92640
|
+
seek++;
|
|
92641
|
+
if (str[seek] === first)
|
|
92642
|
+
seek++;
|
|
92643
|
+
}
|
|
92644
|
+
}
|
|
92645
|
+
return seek;
|
|
92646
|
+
}
|
|
92647
|
+
|
|
92648
|
+
// ../../node_modules/.pnpm/smol-toml@1.6.1/node_modules/smol-toml/dist/date.js
|
|
92649
|
+
var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
|
|
92650
|
+
var TomlDate = class _TomlDate extends Date {
|
|
92651
|
+
#hasDate = false;
|
|
92652
|
+
#hasTime = false;
|
|
92653
|
+
#offset = null;
|
|
92654
|
+
constructor(date5) {
|
|
92655
|
+
let hasDate = true;
|
|
92656
|
+
let hasTime = true;
|
|
92657
|
+
let offset = "Z";
|
|
92658
|
+
if (typeof date5 === "string") {
|
|
92659
|
+
let match2 = date5.match(DATE_TIME_RE);
|
|
92660
|
+
if (match2) {
|
|
92661
|
+
if (!match2[1]) {
|
|
92662
|
+
hasDate = false;
|
|
92663
|
+
date5 = `0000-01-01T${date5}`;
|
|
92664
|
+
}
|
|
92665
|
+
hasTime = !!match2[2];
|
|
92666
|
+
hasTime && date5[10] === " " && (date5 = date5.replace(" ", "T"));
|
|
92667
|
+
if (match2[2] && +match2[2] > 23) {
|
|
92668
|
+
date5 = "";
|
|
92669
|
+
} else {
|
|
92670
|
+
offset = match2[3] || null;
|
|
92671
|
+
date5 = date5.toUpperCase();
|
|
92672
|
+
if (!offset && hasTime)
|
|
92673
|
+
date5 += "Z";
|
|
92674
|
+
}
|
|
92675
|
+
} else {
|
|
92676
|
+
date5 = "";
|
|
92677
|
+
}
|
|
92678
|
+
}
|
|
92679
|
+
super(date5);
|
|
92680
|
+
if (!isNaN(this.getTime())) {
|
|
92681
|
+
this.#hasDate = hasDate;
|
|
92682
|
+
this.#hasTime = hasTime;
|
|
92683
|
+
this.#offset = offset;
|
|
92684
|
+
}
|
|
92685
|
+
}
|
|
92686
|
+
isDateTime() {
|
|
92687
|
+
return this.#hasDate && this.#hasTime;
|
|
92688
|
+
}
|
|
92689
|
+
isLocal() {
|
|
92690
|
+
return !this.#hasDate || !this.#hasTime || !this.#offset;
|
|
92691
|
+
}
|
|
92692
|
+
isDate() {
|
|
92693
|
+
return this.#hasDate && !this.#hasTime;
|
|
92694
|
+
}
|
|
92695
|
+
isTime() {
|
|
92696
|
+
return this.#hasTime && !this.#hasDate;
|
|
92697
|
+
}
|
|
92698
|
+
isValid() {
|
|
92699
|
+
return this.#hasDate || this.#hasTime;
|
|
92700
|
+
}
|
|
92701
|
+
toISOString() {
|
|
92702
|
+
let iso = super.toISOString();
|
|
92703
|
+
if (this.isDate())
|
|
92704
|
+
return iso.slice(0, 10);
|
|
92705
|
+
if (this.isTime())
|
|
92706
|
+
return iso.slice(11, 23);
|
|
92707
|
+
if (this.#offset === null)
|
|
92708
|
+
return iso.slice(0, -1);
|
|
92709
|
+
if (this.#offset === "Z")
|
|
92710
|
+
return iso;
|
|
92711
|
+
let offset = +this.#offset.slice(1, 3) * 60 + +this.#offset.slice(4, 6);
|
|
92712
|
+
offset = this.#offset[0] === "-" ? offset : -offset;
|
|
92713
|
+
let offsetDate = new Date(this.getTime() - offset * 6e4);
|
|
92714
|
+
return offsetDate.toISOString().slice(0, -1) + this.#offset;
|
|
92715
|
+
}
|
|
92716
|
+
static wrapAsOffsetDateTime(jsDate, offset = "Z") {
|
|
92717
|
+
let date5 = new _TomlDate(jsDate);
|
|
92718
|
+
date5.#offset = offset;
|
|
92719
|
+
return date5;
|
|
92720
|
+
}
|
|
92721
|
+
static wrapAsLocalDateTime(jsDate) {
|
|
92722
|
+
let date5 = new _TomlDate(jsDate);
|
|
92723
|
+
date5.#offset = null;
|
|
92724
|
+
return date5;
|
|
92725
|
+
}
|
|
92726
|
+
static wrapAsLocalDate(jsDate) {
|
|
92727
|
+
let date5 = new _TomlDate(jsDate);
|
|
92728
|
+
date5.#hasTime = false;
|
|
92729
|
+
date5.#offset = null;
|
|
92730
|
+
return date5;
|
|
92731
|
+
}
|
|
92732
|
+
static wrapAsLocalTime(jsDate) {
|
|
92733
|
+
let date5 = new _TomlDate(jsDate);
|
|
92734
|
+
date5.#hasDate = false;
|
|
92735
|
+
date5.#offset = null;
|
|
92736
|
+
return date5;
|
|
92737
|
+
}
|
|
92738
|
+
};
|
|
92739
|
+
|
|
92740
|
+
// ../../node_modules/.pnpm/smol-toml@1.6.1/node_modules/smol-toml/dist/primitive.js
|
|
92741
|
+
var INT_REGEX = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;
|
|
92742
|
+
var FLOAT_REGEX = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/;
|
|
92743
|
+
var LEADING_ZERO = /^[+-]?0[0-9_]/;
|
|
92744
|
+
var ESCAPE_REGEX = /^[0-9a-f]{2,8}$/i;
|
|
92745
|
+
var ESC_MAP = {
|
|
92746
|
+
b: "\b",
|
|
92747
|
+
t: " ",
|
|
92748
|
+
n: "\n",
|
|
92749
|
+
f: "\f",
|
|
92750
|
+
r: "\r",
|
|
92751
|
+
e: "\x1B",
|
|
92752
|
+
'"': '"',
|
|
92753
|
+
"\\": "\\"
|
|
92754
|
+
};
|
|
92755
|
+
function parseString(str, ptr = 0, endPtr = str.length) {
|
|
92756
|
+
let isLiteral = str[ptr] === "'";
|
|
92757
|
+
let isMultiline = str[ptr++] === str[ptr] && str[ptr] === str[ptr + 1];
|
|
92758
|
+
if (isMultiline) {
|
|
92759
|
+
endPtr -= 2;
|
|
92760
|
+
if (str[ptr += 2] === "\r")
|
|
92761
|
+
ptr++;
|
|
92762
|
+
if (str[ptr] === "\n")
|
|
92763
|
+
ptr++;
|
|
92764
|
+
}
|
|
92765
|
+
let tmp = 0;
|
|
92766
|
+
let isEscape;
|
|
92767
|
+
let parsed = "";
|
|
92768
|
+
let sliceStart = ptr;
|
|
92769
|
+
while (ptr < endPtr - 1) {
|
|
92770
|
+
let c = str[ptr++];
|
|
92771
|
+
if (c === "\n" || c === "\r" && str[ptr] === "\n") {
|
|
92772
|
+
if (!isMultiline) {
|
|
92773
|
+
throw new TomlError("newlines are not allowed in strings", {
|
|
92774
|
+
toml: str,
|
|
92775
|
+
ptr: ptr - 1
|
|
92776
|
+
});
|
|
92777
|
+
}
|
|
92778
|
+
} else if (c < " " && c !== " " || c === "\x7F") {
|
|
92779
|
+
throw new TomlError("control characters are not allowed in strings", {
|
|
92780
|
+
toml: str,
|
|
92781
|
+
ptr: ptr - 1
|
|
92782
|
+
});
|
|
92783
|
+
}
|
|
92784
|
+
if (isEscape) {
|
|
92785
|
+
isEscape = false;
|
|
92786
|
+
if (c === "x" || c === "u" || c === "U") {
|
|
92787
|
+
let code = str.slice(ptr, ptr += c === "x" ? 2 : c === "u" ? 4 : 8);
|
|
92788
|
+
if (!ESCAPE_REGEX.test(code)) {
|
|
92789
|
+
throw new TomlError("invalid unicode escape", {
|
|
92790
|
+
toml: str,
|
|
92791
|
+
ptr: tmp
|
|
92792
|
+
});
|
|
92793
|
+
}
|
|
92794
|
+
try {
|
|
92795
|
+
parsed += String.fromCodePoint(parseInt(code, 16));
|
|
92796
|
+
} catch {
|
|
92797
|
+
throw new TomlError("invalid unicode escape", {
|
|
92798
|
+
toml: str,
|
|
92799
|
+
ptr: tmp
|
|
92800
|
+
});
|
|
92801
|
+
}
|
|
92802
|
+
} else if (isMultiline && (c === "\n" || c === " " || c === " " || c === "\r")) {
|
|
92803
|
+
ptr = skipVoid(str, ptr - 1, true);
|
|
92804
|
+
if (str[ptr] !== "\n" && str[ptr] !== "\r") {
|
|
92805
|
+
throw new TomlError("invalid escape: only line-ending whitespace may be escaped", {
|
|
92806
|
+
toml: str,
|
|
92807
|
+
ptr: tmp
|
|
92808
|
+
});
|
|
92809
|
+
}
|
|
92810
|
+
ptr = skipVoid(str, ptr);
|
|
92811
|
+
} else if (c in ESC_MAP) {
|
|
92812
|
+
parsed += ESC_MAP[c];
|
|
92813
|
+
} else {
|
|
92814
|
+
throw new TomlError("unrecognized escape sequence", {
|
|
92815
|
+
toml: str,
|
|
92816
|
+
ptr: tmp
|
|
92817
|
+
});
|
|
92818
|
+
}
|
|
92819
|
+
sliceStart = ptr;
|
|
92820
|
+
} else if (!isLiteral && c === "\\") {
|
|
92821
|
+
tmp = ptr - 1;
|
|
92822
|
+
isEscape = true;
|
|
92823
|
+
parsed += str.slice(sliceStart, tmp);
|
|
92824
|
+
}
|
|
92825
|
+
}
|
|
92826
|
+
return parsed + str.slice(sliceStart, endPtr - 1);
|
|
92827
|
+
}
|
|
92828
|
+
function parseValue(value, toml, ptr, integersAsBigInt) {
|
|
92829
|
+
if (value === "true")
|
|
92830
|
+
return true;
|
|
92831
|
+
if (value === "false")
|
|
92832
|
+
return false;
|
|
92833
|
+
if (value === "-inf")
|
|
92834
|
+
return -Infinity;
|
|
92835
|
+
if (value === "inf" || value === "+inf")
|
|
92836
|
+
return Infinity;
|
|
92837
|
+
if (value === "nan" || value === "+nan" || value === "-nan")
|
|
92838
|
+
return NaN;
|
|
92839
|
+
if (value === "-0")
|
|
92840
|
+
return integersAsBigInt ? 0n : 0;
|
|
92841
|
+
let isInt = INT_REGEX.test(value);
|
|
92842
|
+
if (isInt || FLOAT_REGEX.test(value)) {
|
|
92843
|
+
if (LEADING_ZERO.test(value)) {
|
|
92844
|
+
throw new TomlError("leading zeroes are not allowed", {
|
|
92845
|
+
toml,
|
|
92846
|
+
ptr
|
|
92847
|
+
});
|
|
92848
|
+
}
|
|
92849
|
+
value = value.replace(/_/g, "");
|
|
92850
|
+
let numeric = +value;
|
|
92851
|
+
if (isNaN(numeric)) {
|
|
92852
|
+
throw new TomlError("invalid number", {
|
|
92853
|
+
toml,
|
|
92854
|
+
ptr
|
|
92855
|
+
});
|
|
92856
|
+
}
|
|
92857
|
+
if (isInt) {
|
|
92858
|
+
if ((isInt = !Number.isSafeInteger(numeric)) && !integersAsBigInt) {
|
|
92859
|
+
throw new TomlError("integer value cannot be represented losslessly", {
|
|
92860
|
+
toml,
|
|
92861
|
+
ptr
|
|
92862
|
+
});
|
|
92863
|
+
}
|
|
92864
|
+
if (isInt || integersAsBigInt === true)
|
|
92865
|
+
numeric = BigInt(value);
|
|
92866
|
+
}
|
|
92867
|
+
return numeric;
|
|
92868
|
+
}
|
|
92869
|
+
const date5 = new TomlDate(value);
|
|
92870
|
+
if (!date5.isValid()) {
|
|
92871
|
+
throw new TomlError("invalid value", {
|
|
92872
|
+
toml,
|
|
92873
|
+
ptr
|
|
92874
|
+
});
|
|
92875
|
+
}
|
|
92876
|
+
return date5;
|
|
92877
|
+
}
|
|
92878
|
+
|
|
92879
|
+
// ../../node_modules/.pnpm/smol-toml@1.6.1/node_modules/smol-toml/dist/extract.js
|
|
92880
|
+
function sliceAndTrimEndOf(str, startPtr, endPtr) {
|
|
92881
|
+
let value = str.slice(startPtr, endPtr);
|
|
92882
|
+
let commentIdx = value.indexOf("#");
|
|
92883
|
+
if (commentIdx > -1) {
|
|
92884
|
+
skipComment(str, commentIdx);
|
|
92885
|
+
value = value.slice(0, commentIdx);
|
|
92886
|
+
}
|
|
92887
|
+
return [value.trimEnd(), commentIdx];
|
|
92888
|
+
}
|
|
92889
|
+
function extractValue(str, ptr, end, depth, integersAsBigInt) {
|
|
92890
|
+
if (depth === 0) {
|
|
92891
|
+
throw new TomlError("document contains excessively nested structures. aborting.", {
|
|
92892
|
+
toml: str,
|
|
92893
|
+
ptr
|
|
92894
|
+
});
|
|
92895
|
+
}
|
|
92896
|
+
let c = str[ptr];
|
|
92897
|
+
if (c === "[" || c === "{") {
|
|
92898
|
+
let [value, endPtr2] = c === "[" ? parseArray(str, ptr, depth, integersAsBigInt) : parseInlineTable(str, ptr, depth, integersAsBigInt);
|
|
92899
|
+
if (end) {
|
|
92900
|
+
endPtr2 = skipVoid(str, endPtr2);
|
|
92901
|
+
if (str[endPtr2] === ",")
|
|
92902
|
+
endPtr2++;
|
|
92903
|
+
else if (str[endPtr2] !== end) {
|
|
92904
|
+
throw new TomlError("expected comma or end of structure", {
|
|
92905
|
+
toml: str,
|
|
92906
|
+
ptr: endPtr2
|
|
92907
|
+
});
|
|
92908
|
+
}
|
|
92909
|
+
}
|
|
92910
|
+
return [value, endPtr2];
|
|
92911
|
+
}
|
|
92912
|
+
let endPtr;
|
|
92913
|
+
if (c === '"' || c === "'") {
|
|
92914
|
+
endPtr = getStringEnd(str, ptr);
|
|
92915
|
+
let parsed = parseString(str, ptr, endPtr);
|
|
92916
|
+
if (end) {
|
|
92917
|
+
endPtr = skipVoid(str, endPtr);
|
|
92918
|
+
if (str[endPtr] && str[endPtr] !== "," && str[endPtr] !== end && str[endPtr] !== "\n" && str[endPtr] !== "\r") {
|
|
92919
|
+
throw new TomlError("unexpected character encountered", {
|
|
92920
|
+
toml: str,
|
|
92921
|
+
ptr: endPtr
|
|
92922
|
+
});
|
|
92923
|
+
}
|
|
92924
|
+
endPtr += +(str[endPtr] === ",");
|
|
92925
|
+
}
|
|
92926
|
+
return [parsed, endPtr];
|
|
92927
|
+
}
|
|
92928
|
+
endPtr = skipUntil(str, ptr, ",", end);
|
|
92929
|
+
let slice = sliceAndTrimEndOf(str, ptr, endPtr - +(str[endPtr - 1] === ","));
|
|
92930
|
+
if (!slice[0]) {
|
|
92931
|
+
throw new TomlError("incomplete key-value declaration: no value specified", {
|
|
92932
|
+
toml: str,
|
|
92933
|
+
ptr
|
|
92934
|
+
});
|
|
92935
|
+
}
|
|
92936
|
+
if (end && slice[1] > -1) {
|
|
92937
|
+
endPtr = skipVoid(str, ptr + slice[1]);
|
|
92938
|
+
endPtr += +(str[endPtr] === ",");
|
|
92939
|
+
}
|
|
92940
|
+
return [
|
|
92941
|
+
parseValue(slice[0], str, ptr, integersAsBigInt),
|
|
92942
|
+
endPtr
|
|
92943
|
+
];
|
|
92944
|
+
}
|
|
92945
|
+
|
|
92946
|
+
// ../../node_modules/.pnpm/smol-toml@1.6.1/node_modules/smol-toml/dist/struct.js
|
|
92947
|
+
var KEY_PART_RE = /^[a-zA-Z0-9-_]+[ \t]*$/;
|
|
92948
|
+
function parseKey(str, ptr, end = "=") {
|
|
92949
|
+
let dot = ptr - 1;
|
|
92950
|
+
let parsed = [];
|
|
92951
|
+
let endPtr = str.indexOf(end, ptr);
|
|
92952
|
+
if (endPtr < 0) {
|
|
92953
|
+
throw new TomlError("incomplete key-value: cannot find end of key", {
|
|
92954
|
+
toml: str,
|
|
92955
|
+
ptr
|
|
92956
|
+
});
|
|
92957
|
+
}
|
|
92958
|
+
do {
|
|
92959
|
+
let c = str[ptr = ++dot];
|
|
92960
|
+
if (c !== " " && c !== " ") {
|
|
92961
|
+
if (c === '"' || c === "'") {
|
|
92962
|
+
if (c === str[ptr + 1] && c === str[ptr + 2]) {
|
|
92963
|
+
throw new TomlError("multiline strings are not allowed in keys", {
|
|
92964
|
+
toml: str,
|
|
92965
|
+
ptr
|
|
92966
|
+
});
|
|
92967
|
+
}
|
|
92968
|
+
let eos = getStringEnd(str, ptr);
|
|
92969
|
+
if (eos < 0) {
|
|
92970
|
+
throw new TomlError("unfinished string encountered", {
|
|
92971
|
+
toml: str,
|
|
92972
|
+
ptr
|
|
92973
|
+
});
|
|
92974
|
+
}
|
|
92975
|
+
dot = str.indexOf(".", eos);
|
|
92976
|
+
let strEnd = str.slice(eos, dot < 0 || dot > endPtr ? endPtr : dot);
|
|
92977
|
+
let newLine = indexOfNewline(strEnd);
|
|
92978
|
+
if (newLine > -1) {
|
|
92979
|
+
throw new TomlError("newlines are not allowed in keys", {
|
|
92980
|
+
toml: str,
|
|
92981
|
+
ptr: ptr + dot + newLine
|
|
92982
|
+
});
|
|
92983
|
+
}
|
|
92984
|
+
if (strEnd.trimStart()) {
|
|
92985
|
+
throw new TomlError("found extra tokens after the string part", {
|
|
92986
|
+
toml: str,
|
|
92987
|
+
ptr: eos
|
|
92988
|
+
});
|
|
92989
|
+
}
|
|
92990
|
+
if (endPtr < eos) {
|
|
92991
|
+
endPtr = str.indexOf(end, eos);
|
|
92992
|
+
if (endPtr < 0) {
|
|
92993
|
+
throw new TomlError("incomplete key-value: cannot find end of key", {
|
|
92994
|
+
toml: str,
|
|
92995
|
+
ptr
|
|
92996
|
+
});
|
|
92997
|
+
}
|
|
92998
|
+
}
|
|
92999
|
+
parsed.push(parseString(str, ptr, eos));
|
|
93000
|
+
} else {
|
|
93001
|
+
dot = str.indexOf(".", ptr);
|
|
93002
|
+
let part = str.slice(ptr, dot < 0 || dot > endPtr ? endPtr : dot);
|
|
93003
|
+
if (!KEY_PART_RE.test(part)) {
|
|
93004
|
+
throw new TomlError("only letter, numbers, dashes and underscores are allowed in keys", {
|
|
93005
|
+
toml: str,
|
|
93006
|
+
ptr
|
|
93007
|
+
});
|
|
93008
|
+
}
|
|
93009
|
+
parsed.push(part.trimEnd());
|
|
93010
|
+
}
|
|
93011
|
+
}
|
|
93012
|
+
} while (dot + 1 && dot < endPtr);
|
|
93013
|
+
return [parsed, skipVoid(str, endPtr + 1, true, true)];
|
|
93014
|
+
}
|
|
93015
|
+
function parseInlineTable(str, ptr, depth, integersAsBigInt) {
|
|
93016
|
+
let res = {};
|
|
93017
|
+
let seen = /* @__PURE__ */ new Set();
|
|
93018
|
+
let c;
|
|
93019
|
+
ptr++;
|
|
93020
|
+
while ((c = str[ptr++]) !== "}" && c) {
|
|
93021
|
+
if (c === ",") {
|
|
93022
|
+
throw new TomlError("expected value, found comma", {
|
|
93023
|
+
toml: str,
|
|
93024
|
+
ptr: ptr - 1
|
|
93025
|
+
});
|
|
93026
|
+
} else if (c === "#")
|
|
93027
|
+
ptr = skipComment(str, ptr);
|
|
93028
|
+
else if (c !== " " && c !== " " && c !== "\n" && c !== "\r") {
|
|
93029
|
+
let k;
|
|
93030
|
+
let t = res;
|
|
93031
|
+
let hasOwn = false;
|
|
93032
|
+
let [key, keyEndPtr] = parseKey(str, ptr - 1);
|
|
93033
|
+
for (let i2 = 0; i2 < key.length; i2++) {
|
|
93034
|
+
if (i2)
|
|
93035
|
+
t = hasOwn ? t[k] : t[k] = {};
|
|
93036
|
+
k = key[i2];
|
|
93037
|
+
if ((hasOwn = Object.hasOwn(t, k)) && (typeof t[k] !== "object" || seen.has(t[k]))) {
|
|
93038
|
+
throw new TomlError("trying to redefine an already defined value", {
|
|
93039
|
+
toml: str,
|
|
93040
|
+
ptr
|
|
93041
|
+
});
|
|
93042
|
+
}
|
|
93043
|
+
if (!hasOwn && k === "__proto__") {
|
|
93044
|
+
Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
|
|
93045
|
+
}
|
|
93046
|
+
}
|
|
93047
|
+
if (hasOwn) {
|
|
93048
|
+
throw new TomlError("trying to redefine an already defined value", {
|
|
93049
|
+
toml: str,
|
|
93050
|
+
ptr
|
|
93051
|
+
});
|
|
93052
|
+
}
|
|
93053
|
+
let [value, valueEndPtr] = extractValue(str, keyEndPtr, "}", depth - 1, integersAsBigInt);
|
|
93054
|
+
seen.add(value);
|
|
93055
|
+
t[k] = value;
|
|
93056
|
+
ptr = valueEndPtr;
|
|
93057
|
+
}
|
|
93058
|
+
}
|
|
93059
|
+
if (!c) {
|
|
93060
|
+
throw new TomlError("unfinished table encountered", {
|
|
93061
|
+
toml: str,
|
|
93062
|
+
ptr
|
|
93063
|
+
});
|
|
93064
|
+
}
|
|
93065
|
+
return [res, ptr];
|
|
93066
|
+
}
|
|
93067
|
+
function parseArray(str, ptr, depth, integersAsBigInt) {
|
|
93068
|
+
let res = [];
|
|
93069
|
+
let c;
|
|
93070
|
+
ptr++;
|
|
93071
|
+
while ((c = str[ptr++]) !== "]" && c) {
|
|
93072
|
+
if (c === ",") {
|
|
93073
|
+
throw new TomlError("expected value, found comma", {
|
|
93074
|
+
toml: str,
|
|
93075
|
+
ptr: ptr - 1
|
|
93076
|
+
});
|
|
93077
|
+
} else if (c === "#")
|
|
93078
|
+
ptr = skipComment(str, ptr);
|
|
93079
|
+
else if (c !== " " && c !== " " && c !== "\n" && c !== "\r") {
|
|
93080
|
+
let e = extractValue(str, ptr - 1, "]", depth - 1, integersAsBigInt);
|
|
93081
|
+
res.push(e[0]);
|
|
93082
|
+
ptr = e[1];
|
|
93083
|
+
}
|
|
93084
|
+
}
|
|
93085
|
+
if (!c) {
|
|
93086
|
+
throw new TomlError("unfinished array encountered", {
|
|
93087
|
+
toml: str,
|
|
93088
|
+
ptr
|
|
93089
|
+
});
|
|
93090
|
+
}
|
|
93091
|
+
return [res, ptr];
|
|
93092
|
+
}
|
|
93093
|
+
|
|
93094
|
+
// ../../node_modules/.pnpm/smol-toml@1.6.1/node_modules/smol-toml/dist/parse.js
|
|
93095
|
+
function peekTable(key, table, meta3, type) {
|
|
93096
|
+
let t = table;
|
|
93097
|
+
let m = meta3;
|
|
93098
|
+
let k;
|
|
93099
|
+
let hasOwn = false;
|
|
93100
|
+
let state;
|
|
93101
|
+
for (let i2 = 0; i2 < key.length; i2++) {
|
|
93102
|
+
if (i2) {
|
|
93103
|
+
t = hasOwn ? t[k] : t[k] = {};
|
|
93104
|
+
m = (state = m[k]).c;
|
|
93105
|
+
if (type === 0 && (state.t === 1 || state.t === 2)) {
|
|
93106
|
+
return null;
|
|
93107
|
+
}
|
|
93108
|
+
if (state.t === 2) {
|
|
93109
|
+
let l = t.length - 1;
|
|
93110
|
+
t = t[l];
|
|
93111
|
+
m = m[l].c;
|
|
93112
|
+
}
|
|
93113
|
+
}
|
|
93114
|
+
k = key[i2];
|
|
93115
|
+
if ((hasOwn = Object.hasOwn(t, k)) && m[k]?.t === 0 && m[k]?.d) {
|
|
93116
|
+
return null;
|
|
93117
|
+
}
|
|
93118
|
+
if (!hasOwn) {
|
|
93119
|
+
if (k === "__proto__") {
|
|
93120
|
+
Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
|
|
93121
|
+
Object.defineProperty(m, k, { enumerable: true, configurable: true, writable: true });
|
|
93122
|
+
}
|
|
93123
|
+
m[k] = {
|
|
93124
|
+
t: i2 < key.length - 1 && type === 2 ? 3 : type,
|
|
93125
|
+
d: false,
|
|
93126
|
+
i: 0,
|
|
93127
|
+
c: {}
|
|
93128
|
+
};
|
|
93129
|
+
}
|
|
93130
|
+
}
|
|
93131
|
+
state = m[k];
|
|
93132
|
+
if (state.t !== type && !(type === 1 && state.t === 3)) {
|
|
93133
|
+
return null;
|
|
93134
|
+
}
|
|
93135
|
+
if (type === 2) {
|
|
93136
|
+
if (!state.d) {
|
|
93137
|
+
state.d = true;
|
|
93138
|
+
t[k] = [];
|
|
93139
|
+
}
|
|
93140
|
+
t[k].push(t = {});
|
|
93141
|
+
state.c[state.i++] = state = { t: 1, d: false, i: 0, c: {} };
|
|
93142
|
+
}
|
|
93143
|
+
if (state.d) {
|
|
93144
|
+
return null;
|
|
93145
|
+
}
|
|
93146
|
+
state.d = true;
|
|
93147
|
+
if (type === 1) {
|
|
93148
|
+
t = hasOwn ? t[k] : t[k] = {};
|
|
93149
|
+
} else if (type === 0 && hasOwn) {
|
|
93150
|
+
return null;
|
|
93151
|
+
}
|
|
93152
|
+
return [k, t, state.c];
|
|
93153
|
+
}
|
|
93154
|
+
function parse4(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
|
|
93155
|
+
let res = {};
|
|
93156
|
+
let meta3 = {};
|
|
93157
|
+
let tbl = res;
|
|
93158
|
+
let m = meta3;
|
|
93159
|
+
for (let ptr = skipVoid(toml, 0); ptr < toml.length; ) {
|
|
93160
|
+
if (toml[ptr] === "[") {
|
|
93161
|
+
let isTableArray = toml[++ptr] === "[";
|
|
93162
|
+
let k = parseKey(toml, ptr += +isTableArray, "]");
|
|
93163
|
+
if (isTableArray) {
|
|
93164
|
+
if (toml[k[1] - 1] !== "]") {
|
|
93165
|
+
throw new TomlError("expected end of table declaration", {
|
|
93166
|
+
toml,
|
|
93167
|
+
ptr: k[1] - 1
|
|
93168
|
+
});
|
|
93169
|
+
}
|
|
93170
|
+
k[1]++;
|
|
93171
|
+
}
|
|
93172
|
+
let p = peekTable(
|
|
93173
|
+
k[0],
|
|
93174
|
+
res,
|
|
93175
|
+
meta3,
|
|
93176
|
+
isTableArray ? 2 : 1
|
|
93177
|
+
/* Type.EXPLICIT */
|
|
93178
|
+
);
|
|
93179
|
+
if (!p) {
|
|
93180
|
+
throw new TomlError("trying to redefine an already defined table or value", {
|
|
93181
|
+
toml,
|
|
93182
|
+
ptr
|
|
93183
|
+
});
|
|
93184
|
+
}
|
|
93185
|
+
m = p[2];
|
|
93186
|
+
tbl = p[1];
|
|
93187
|
+
ptr = k[1];
|
|
93188
|
+
} else {
|
|
93189
|
+
let k = parseKey(toml, ptr);
|
|
93190
|
+
let p = peekTable(
|
|
93191
|
+
k[0],
|
|
93192
|
+
tbl,
|
|
93193
|
+
m,
|
|
93194
|
+
0
|
|
93195
|
+
/* Type.DOTTED */
|
|
93196
|
+
);
|
|
93197
|
+
if (!p) {
|
|
93198
|
+
throw new TomlError("trying to redefine an already defined table or value", {
|
|
93199
|
+
toml,
|
|
93200
|
+
ptr
|
|
93201
|
+
});
|
|
93202
|
+
}
|
|
93203
|
+
let v = extractValue(toml, k[1], void 0, maxDepth, integersAsBigInt);
|
|
93204
|
+
p[1][p[0]] = v[0];
|
|
93205
|
+
ptr = v[1];
|
|
93206
|
+
}
|
|
93207
|
+
ptr = skipVoid(toml, ptr, true);
|
|
93208
|
+
if (toml[ptr] && toml[ptr] !== "\n" && toml[ptr] !== "\r") {
|
|
93209
|
+
throw new TomlError("each key-value declaration must be followed by an end-of-line", {
|
|
93210
|
+
toml,
|
|
93211
|
+
ptr
|
|
93212
|
+
});
|
|
93213
|
+
}
|
|
93214
|
+
ptr = skipVoid(toml, ptr);
|
|
93215
|
+
}
|
|
93216
|
+
return res;
|
|
93217
|
+
}
|
|
93218
|
+
|
|
93219
|
+
// src/codex-context-plugin.ts
|
|
93220
|
+
var NAME = "errata-context";
|
|
93221
|
+
var PREFIX2 = `./.errata/plugins/${NAME}/`;
|
|
93222
|
+
var object2 = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
93223
|
+
function readText(file2) {
|
|
93224
|
+
return existsSync36(file2) ? readFileSync38(file2, "utf8") : "";
|
|
93225
|
+
}
|
|
93226
|
+
function writeChanged(file2, content) {
|
|
93227
|
+
if (readText(file2) === content) return;
|
|
93228
|
+
const temp = `${file2}.${process.pid}.tmp`;
|
|
93229
|
+
writeFileSync28(temp, content, "utf8");
|
|
93230
|
+
renameSync6(temp, file2);
|
|
93231
|
+
}
|
|
93232
|
+
function bundledContextPlugin() {
|
|
93233
|
+
const packaged = fileURLToPath2(new URL("./resources/context-plugin/", import.meta.url));
|
|
93234
|
+
if (existsSync36(join45(packaged, ".codex-plugin/plugin.json"))) return packaged;
|
|
93235
|
+
return fileURLToPath2(new URL("../dist/resources/context-plugin/", import.meta.url));
|
|
93236
|
+
}
|
|
93237
|
+
function refreshCodexContextPlugin(root) {
|
|
93238
|
+
const file2 = join45(root, ".agents", "plugins", "marketplace.json");
|
|
93239
|
+
if (!existsSync36(file2)) return false;
|
|
93240
|
+
const marketplace = JSON.parse(readFileSync38(file2, "utf8"));
|
|
93241
|
+
const entries = Array.isArray(marketplace.plugins) ? marketplace.plugins : [];
|
|
93242
|
+
const entry = entries.map(object2).find((value) => value.name === NAME && String(object2(value.source).path).startsWith(PREFIX2));
|
|
93243
|
+
if (!entry) return false;
|
|
93244
|
+
const before = object2(entry.source).path;
|
|
93245
|
+
const installed = installCodexContextPlugin(root);
|
|
93246
|
+
return String(before) !== `${PREFIX2}${installed.plugin.split(/[\\/]/).at(-1)}`;
|
|
93247
|
+
}
|
|
93248
|
+
function installCodexContextPlugin(root, options = {}) {
|
|
93249
|
+
const bundle = options.bundle ?? bundledContextPlugin();
|
|
93250
|
+
const manifest = JSON.parse(
|
|
93251
|
+
readFileSync38(join45(bundle, ".codex-plugin/plugin.json"), "utf8")
|
|
93252
|
+
);
|
|
93253
|
+
if (manifest.name !== NAME || typeof manifest.version !== "string" || !/^[\w.-]+$/.test(manifest.version)) {
|
|
93254
|
+
throw new Error("Invalid bundled Errata Context manifest.");
|
|
93255
|
+
}
|
|
93256
|
+
const checksums = readFileSync38(join45(bundle, "SHA256SUMS"), "utf8");
|
|
93257
|
+
for (const line of checksums.trim().split("\n")) {
|
|
93258
|
+
const match2 = /^([a-f0-9]{64}) ([\w./-]+)$/.exec(line);
|
|
93259
|
+
if (!match2 || match2[2].startsWith("/") || match2[2].split("/").includes("..")) {
|
|
93260
|
+
throw new Error("Invalid bundled Errata Context checksum manifest.");
|
|
93261
|
+
}
|
|
93262
|
+
const actual = createHash20("sha256").update(readFileSync38(join45(bundle, match2[2]))).digest("hex");
|
|
93263
|
+
if (actual !== match2[1])
|
|
93264
|
+
throw new Error(`Bundled Errata Context checksum mismatch: ${match2[2]}`);
|
|
93265
|
+
}
|
|
93266
|
+
const release = `${manifest.version}-${createHash20("sha256").update(checksums).digest("hex").slice(0, 12)}`;
|
|
93267
|
+
const plugin = join45(root, ".errata", "plugins", NAME, release);
|
|
93268
|
+
const marketplaceFile = join45(root, ".agents", "plugins", "marketplace.json");
|
|
93269
|
+
const priorMarketplace = readText(marketplaceFile);
|
|
93270
|
+
const marketplace = priorMarketplace ? JSON.parse(priorMarketplace) : {
|
|
93271
|
+
name: "errata-local",
|
|
93272
|
+
interface: { displayName: "Errata" },
|
|
93273
|
+
plugins: []
|
|
93274
|
+
};
|
|
93275
|
+
if (typeof marketplace.name !== "string" || !/^[\w.-]+$/.test(marketplace.name) || !Array.isArray(marketplace.plugins)) {
|
|
93276
|
+
throw new Error(`Invalid marketplace at ${marketplaceFile}; preserved it.`);
|
|
93277
|
+
}
|
|
93278
|
+
const entries = marketplace.plugins;
|
|
93279
|
+
const matches = entries.filter((entry2) => entry2.name === NAME);
|
|
93280
|
+
if (matches.length > 1)
|
|
93281
|
+
throw new Error("Duplicate Errata Context marketplace entries; preserved them.");
|
|
93282
|
+
const prior = matches[0];
|
|
93283
|
+
if (prior && !(object2(prior.source).source === "local" && String(object2(prior.source).path).startsWith(PREFIX2))) {
|
|
93284
|
+
throw new Error(
|
|
93285
|
+
"An independently managed Errata Context entry already exists in this marketplace; preserved it."
|
|
93286
|
+
);
|
|
93287
|
+
}
|
|
93288
|
+
const key = `${NAME}@${marketplace.name}`;
|
|
93289
|
+
const configFile = join45(root, ".codex", "config.toml");
|
|
93290
|
+
const config2 = readText(configFile);
|
|
93291
|
+
const parsed = parse4(config2);
|
|
93292
|
+
const plugins = object2(parsed.plugins);
|
|
93293
|
+
const codexHome = options.codexHome ?? process.env["CODEX_HOME"] ?? join45(homedir8(), ".codex");
|
|
93294
|
+
const globalPlugins = object2(parse4(readText(join45(codexHome, "config.toml"))).plugins);
|
|
93295
|
+
const disabledGlobally = Object.entries(globalPlugins).some(
|
|
93296
|
+
([name2, value]) => (name2 === NAME || name2.startsWith(`${NAME}@`)) && object2(value).enabled === false
|
|
93297
|
+
);
|
|
93298
|
+
const policyDisabled = object2(prior?.policy).installation === "NOT_AVAILABLE";
|
|
93299
|
+
const localSetting = object2(plugins[key]);
|
|
93300
|
+
const hasLocalSetting = Object.hasOwn(plugins, key);
|
|
93301
|
+
const enabled = !policyDisabled && (hasLocalSetting ? localSetting.enabled !== false : !disabledGlobally);
|
|
93302
|
+
const nextConfig = hasLocalSetting ? config2 : config2.trimEnd() + (config2.trim() ? "\n\n" : "") + `# Errata Context: installed by errata's Codex setup.
|
|
93303
|
+
[plugins.${JSON.stringify(key)}]
|
|
93304
|
+
enabled = ${enabled}
|
|
93305
|
+
`;
|
|
93306
|
+
parse4(nextConfig);
|
|
93307
|
+
const entry = {
|
|
93308
|
+
...prior,
|
|
93309
|
+
name: NAME,
|
|
93310
|
+
source: { source: "local", path: `${PREFIX2}${release}` },
|
|
93311
|
+
policy: prior?.policy ?? { installation: "AVAILABLE", authentication: "ON_INSTALL" },
|
|
93312
|
+
category: prior?.category ?? "Productivity"
|
|
93313
|
+
};
|
|
93314
|
+
marketplace.plugins = [...entries.filter((item2) => item2.name !== NAME), entry];
|
|
93315
|
+
mkdirSync10(plugin, { recursive: true });
|
|
93316
|
+
cpSync2(bundle, plugin, { recursive: true });
|
|
93317
|
+
writeChanged(
|
|
93318
|
+
join45(plugin, ".mcp.json"),
|
|
93319
|
+
JSON.stringify(
|
|
93320
|
+
{
|
|
93321
|
+
mcpServers: {
|
|
93322
|
+
errata_context: {
|
|
93323
|
+
command: options.nodePath ?? process.execPath,
|
|
93324
|
+
args: [join45(plugin, "dist", "mcp-server.mjs")],
|
|
93325
|
+
env: { ERRATA_WORKSPACE: root, ERRATA_CONTEXT_VERSION: manifest.version }
|
|
93326
|
+
}
|
|
93327
|
+
}
|
|
93328
|
+
},
|
|
93329
|
+
null,
|
|
93330
|
+
2
|
|
93331
|
+
) + "\n"
|
|
93332
|
+
);
|
|
93333
|
+
mkdirSync10(join45(root, ".agents", "plugins"), { recursive: true });
|
|
93334
|
+
mkdirSync10(join45(root, ".codex"), { recursive: true });
|
|
93335
|
+
writeChanged(marketplaceFile, JSON.stringify(marketplace, null, 2) + "\n");
|
|
93336
|
+
writeChanged(configFile, nextConfig);
|
|
93337
|
+
return { plugin, enabled, marketplace: marketplaceFile };
|
|
93338
|
+
}
|
|
93339
|
+
|
|
92522
93340
|
// src/codex-hook-refresh.ts
|
|
92523
93341
|
init_checkout_root();
|
|
92524
|
-
import { existsSync as
|
|
92525
|
-
import { dirname as dirname13, join as
|
|
93342
|
+
import { existsSync as existsSync37, readdirSync as readdirSync13, readFileSync as readFileSync39 } from "node:fs";
|
|
93343
|
+
import { dirname as dirname13, join as join46, resolve as resolve8 } from "node:path";
|
|
92526
93344
|
init_registry();
|
|
92527
93345
|
function codexHookRoots(roots) {
|
|
92528
93346
|
const found = new Set(roots.map((root) => resolve8(root)));
|
|
92529
93347
|
for (const root of [...found]) {
|
|
92530
93348
|
const main2 = mainCheckoutOfWorktree(root) ?? root;
|
|
92531
93349
|
found.add(main2);
|
|
92532
|
-
const dir =
|
|
92533
|
-
if (!
|
|
93350
|
+
const dir = join46(main2, ".git", "worktrees");
|
|
93351
|
+
if (!existsSync37(dir)) continue;
|
|
92534
93352
|
let names;
|
|
92535
93353
|
try {
|
|
92536
93354
|
names = readdirSync13(dir);
|
|
@@ -92539,7 +93357,7 @@ function codexHookRoots(roots) {
|
|
|
92539
93357
|
}
|
|
92540
93358
|
for (const name2 of names) {
|
|
92541
93359
|
try {
|
|
92542
|
-
const checkout = dirname13(
|
|
93360
|
+
const checkout = dirname13(readFileSync39(join46(dir, name2, "gitdir"), "utf8").trim());
|
|
92543
93361
|
if (mainCheckoutOfWorktree(checkout) === main2) found.add(checkout);
|
|
92544
93362
|
} catch {
|
|
92545
93363
|
}
|
|
@@ -92561,9 +93379,9 @@ function refreshInstalledCodexRelays(roots = listWorkspaceEntries().map((entry)
|
|
|
92561
93379
|
}
|
|
92562
93380
|
|
|
92563
93381
|
// src/claude-statusline.ts
|
|
92564
|
-
import { existsSync as
|
|
92565
|
-
import { homedir as
|
|
92566
|
-
import { dirname as dirname14, join as
|
|
93382
|
+
import { existsSync as existsSync38, mkdirSync as mkdirSync11, readFileSync as readFileSync40, writeFileSync as writeFileSync29 } from "node:fs";
|
|
93383
|
+
import { homedir as homedir9 } from "node:os";
|
|
93384
|
+
import { dirname as dirname14, join as join47 } from "node:path";
|
|
92567
93385
|
var STATUSLINE_RELAY_SOURCE = String.raw`// errata-managed: regenerated by errata init / install-hooks claude
|
|
92568
93386
|
import { readFileSync } from 'node:fs';
|
|
92569
93387
|
|
|
@@ -92611,8 +93429,8 @@ function isSameInstall(value, relay) {
|
|
|
92611
93429
|
return command.includes(relay.replace(/\\/g, "/").toLowerCase());
|
|
92612
93430
|
}
|
|
92613
93431
|
function userClaudeSettingsPath() {
|
|
92614
|
-
const base = process.env["CLAUDE_CONFIG_DIR"] ??
|
|
92615
|
-
return
|
|
93432
|
+
const base = process.env["CLAUDE_CONFIG_DIR"] ?? join47(homedir9(), ".claude");
|
|
93433
|
+
return join47(base, "settings.json");
|
|
92616
93434
|
}
|
|
92617
93435
|
function ensureUserStatusLine(opts) {
|
|
92618
93436
|
const env2 = opts.env ?? process.env;
|
|
@@ -92620,23 +93438,23 @@ function ensureUserStatusLine(opts) {
|
|
|
92620
93438
|
if (off2 === "0" || off2 === "off" || off2 === "false" || off2 === "no") return "disabled";
|
|
92621
93439
|
const settingsPath = opts.userSettingsPath ?? userClaudeSettingsPath();
|
|
92622
93440
|
let settings = {};
|
|
92623
|
-
if (
|
|
93441
|
+
if (existsSync38(settingsPath)) {
|
|
92624
93442
|
try {
|
|
92625
|
-
const parsed = JSON.parse(
|
|
93443
|
+
const parsed = JSON.parse(readFileSync40(settingsPath, "utf8"));
|
|
92626
93444
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return "unreadable";
|
|
92627
93445
|
settings = parsed;
|
|
92628
93446
|
} catch {
|
|
92629
93447
|
return "unreadable";
|
|
92630
93448
|
}
|
|
92631
93449
|
}
|
|
92632
|
-
const relay =
|
|
93450
|
+
const relay = join47(opts.relayDir, STATUSLINE_RELAY_FILE);
|
|
92633
93451
|
const keep = (value) => value !== void 0 && (!isErrataStatusLine(value) || !isSameInstall(value, relay));
|
|
92634
93452
|
const ownMain = keep(settings["statusLine"]);
|
|
92635
93453
|
const ownRows = keep(settings["subagentStatusLine"]);
|
|
92636
93454
|
if (ownMain && ownRows) return "kept-own";
|
|
92637
|
-
|
|
92638
|
-
if (!
|
|
92639
|
-
|
|
93455
|
+
mkdirSync11(opts.relayDir, { recursive: true });
|
|
93456
|
+
if (!existsSync38(relay) || readFileSync40(relay, "utf8") !== STATUSLINE_RELAY_SOURCE) {
|
|
93457
|
+
writeFileSync29(relay, STATUSLINE_RELAY_SOURCE, "utf8");
|
|
92640
93458
|
}
|
|
92641
93459
|
const nodePath = opts.nodePath ?? process.execPath;
|
|
92642
93460
|
const next = {
|
|
@@ -92647,8 +93465,8 @@ function ensureUserStatusLine(opts) {
|
|
|
92647
93465
|
return ownMain ? "kept-own" : "unchanged";
|
|
92648
93466
|
}
|
|
92649
93467
|
Object.assign(settings, next);
|
|
92650
|
-
|
|
92651
|
-
|
|
93468
|
+
mkdirSync11(dirname14(settingsPath), { recursive: true });
|
|
93469
|
+
writeFileSync29(settingsPath, JSON.stringify(settings, null, 2) + "\n", "utf8");
|
|
92652
93470
|
return "installed";
|
|
92653
93471
|
}
|
|
92654
93472
|
function describeStatusLineOutcome(outcome) {
|
|
@@ -92667,15 +93485,15 @@ function describeStatusLineOutcome(outcome) {
|
|
|
92667
93485
|
}
|
|
92668
93486
|
|
|
92669
93487
|
// src/claude-mods.ts
|
|
92670
|
-
import { createHash as
|
|
92671
|
-
import { cpSync as
|
|
92672
|
-
import { delimiter as delimiter2, dirname as dirname15, join as
|
|
92673
|
-
import { fileURLToPath as
|
|
93488
|
+
import { createHash as createHash21 } from "node:crypto";
|
|
93489
|
+
import { cpSync as cpSync3, existsSync as existsSync39, mkdirSync as mkdirSync12, readFileSync as readFileSync41, readdirSync as readdirSync14, rmSync as rmSync4, statSync as statSync11, writeFileSync as writeFileSync30 } from "node:fs";
|
|
93490
|
+
import { delimiter as delimiter2, dirname as dirname15, join as join48, relative as relative7, resolve as resolve9, sep as sep5 } from "node:path";
|
|
93491
|
+
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
92674
93492
|
var CLAUDE_PLUGIN_DIRS_ENV = "CLAUDE_CODE_PLUGIN_DIRS";
|
|
92675
93493
|
var HASH_FILE = ".errata-mod-hash";
|
|
92676
93494
|
function bundledClaudeModsDir() {
|
|
92677
93495
|
const rel = import.meta.url.endsWith(".mjs") ? "./resources/claude-mods/" : "../claude-mods/";
|
|
92678
|
-
return
|
|
93496
|
+
return fileURLToPath3(new URL(rel, import.meta.url));
|
|
92679
93497
|
}
|
|
92680
93498
|
function isEngineOwned(relPath) {
|
|
92681
93499
|
const p = relPath.split(sep5).join("/");
|
|
@@ -92684,7 +93502,7 @@ function isEngineOwned(relPath) {
|
|
|
92684
93502
|
function listFiles(root, dir = root) {
|
|
92685
93503
|
const out2 = [];
|
|
92686
93504
|
for (const name2 of readdirSync14(dir)) {
|
|
92687
|
-
const abs =
|
|
93505
|
+
const abs = join48(dir, name2);
|
|
92688
93506
|
if (isEngineOwned(relative7(root, abs))) continue;
|
|
92689
93507
|
if (statSync11(abs).isDirectory()) out2.push(...listFiles(root, abs));
|
|
92690
93508
|
else out2.push(abs);
|
|
@@ -92692,18 +93510,18 @@ function listFiles(root, dir = root) {
|
|
|
92692
93510
|
return out2;
|
|
92693
93511
|
}
|
|
92694
93512
|
function modHash(dir) {
|
|
92695
|
-
const h =
|
|
93513
|
+
const h = createHash21("sha256");
|
|
92696
93514
|
for (const abs of listFiles(dir).sort()) {
|
|
92697
93515
|
h.update(relative7(dir, abs).split(sep5).join("/"));
|
|
92698
93516
|
h.update("\0");
|
|
92699
|
-
h.update(
|
|
93517
|
+
h.update(readFileSync41(abs));
|
|
92700
93518
|
h.update("\0");
|
|
92701
93519
|
}
|
|
92702
93520
|
return h.digest("hex");
|
|
92703
93521
|
}
|
|
92704
93522
|
function bundledMods(bundleDir) {
|
|
92705
|
-
if (!
|
|
92706
|
-
return readdirSync14(bundleDir).filter((name2) =>
|
|
93523
|
+
if (!existsSync39(bundleDir)) return [];
|
|
93524
|
+
return readdirSync14(bundleDir).filter((name2) => existsSync39(join48(bundleDir, name2, ".claude-plugin", "plugin.json")));
|
|
92707
93525
|
}
|
|
92708
93526
|
function sameDir(a, b) {
|
|
92709
93527
|
const norm = (p) => resolve9(p).replace(/[\\/]+$/, "").toLowerCase();
|
|
@@ -92718,9 +93536,9 @@ function off(env2) {
|
|
|
92718
93536
|
return v === "0" || v === "off" || v === "false" || v === "no";
|
|
92719
93537
|
}
|
|
92720
93538
|
function readSettings(path2) {
|
|
92721
|
-
if (!
|
|
93539
|
+
if (!existsSync39(path2)) return {};
|
|
92722
93540
|
try {
|
|
92723
|
-
const parsed = JSON.parse(
|
|
93541
|
+
const parsed = JSON.parse(readFileSync41(path2, "utf8"));
|
|
92724
93542
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return null;
|
|
92725
93543
|
return parsed;
|
|
92726
93544
|
} catch {
|
|
@@ -92744,13 +93562,13 @@ function currentDirs(settings) {
|
|
|
92744
93562
|
return raw2.split(delimiter2).map((s) => s.trim()).filter(Boolean);
|
|
92745
93563
|
}
|
|
92746
93564
|
function writeSettings(path2, settings) {
|
|
92747
|
-
|
|
92748
|
-
|
|
93565
|
+
mkdirSync12(dirname15(path2), { recursive: true });
|
|
93566
|
+
writeFileSync30(path2, JSON.stringify(settings, null, 2) + "\n", "utf8");
|
|
92749
93567
|
}
|
|
92750
93568
|
function ensureClaudeMods(opts) {
|
|
92751
93569
|
const env2 = opts.env ?? process.env;
|
|
92752
93570
|
const settingsPath = opts.userSettingsPath ?? userClaudeSettingsPath();
|
|
92753
|
-
const modsRoot =
|
|
93571
|
+
const modsRoot = join48(opts.installRoot, "claude-mods");
|
|
92754
93572
|
if (off(env2)) {
|
|
92755
93573
|
const settings2 = readSettings(settingsPath);
|
|
92756
93574
|
if (!settings2) return { kind: "unreadable" };
|
|
@@ -92767,14 +93585,14 @@ function ensureClaudeMods(opts) {
|
|
|
92767
93585
|
let changed = false;
|
|
92768
93586
|
const installed = [];
|
|
92769
93587
|
for (const name2 of names) {
|
|
92770
|
-
const src =
|
|
92771
|
-
const dest =
|
|
93588
|
+
const src = join48(bundleDir, name2);
|
|
93589
|
+
const dest = join48(modsRoot, name2);
|
|
92772
93590
|
const hash2 = modHash(src);
|
|
92773
|
-
const hashFile =
|
|
92774
|
-
if (!
|
|
93591
|
+
const hashFile = join48(dest, HASH_FILE);
|
|
93592
|
+
if (!existsSync39(hashFile) || readFileSync41(hashFile, "utf8") !== hash2) {
|
|
92775
93593
|
rmSync4(dest, { recursive: true, force: true });
|
|
92776
|
-
|
|
92777
|
-
|
|
93594
|
+
cpSync3(src, dest, { recursive: true, filter: (p) => !isEngineOwned(relative7(src, p)) });
|
|
93595
|
+
writeFileSync30(hashFile, hash2, "utf8");
|
|
92778
93596
|
changed = true;
|
|
92779
93597
|
}
|
|
92780
93598
|
installed.push(dest);
|
|
@@ -93195,9 +94013,9 @@ function resolveHookPort(explicit) {
|
|
|
93195
94013
|
}
|
|
93196
94014
|
}
|
|
93197
94015
|
}
|
|
93198
|
-
const settingsPath =
|
|
94016
|
+
const settingsPath = join49(ROOT, ".claude", "settings.json");
|
|
93199
94017
|
try {
|
|
93200
|
-
if (
|
|
94018
|
+
if (existsSync40(settingsPath)) return installedHookPort(readFileSync42(settingsPath, "utf8")) ?? 7891;
|
|
93201
94019
|
} catch {
|
|
93202
94020
|
}
|
|
93203
94021
|
return 7891;
|
|
@@ -93222,14 +94040,14 @@ async function cmdInit() {
|
|
|
93222
94040
|
if (!skipHooks) {
|
|
93223
94041
|
console.log("");
|
|
93224
94042
|
console.log("installing harness hooks...");
|
|
93225
|
-
const { existsSync:
|
|
93226
|
-
const { join:
|
|
94043
|
+
const { existsSync: existsSync41 } = await import("node:fs");
|
|
94044
|
+
const { join: join50 } = await import("node:path");
|
|
93227
94045
|
try {
|
|
93228
94046
|
await installClaudeHooks(port);
|
|
93229
94047
|
} catch (err2) {
|
|
93230
94048
|
console.warn(` \u26A0\uFE0F Claude hook install failed: ${err2 instanceof Error ? err2.message : err2}`);
|
|
93231
94049
|
}
|
|
93232
|
-
if (
|
|
94050
|
+
if (existsSync41(join50(ROOT, ".cursor"))) {
|
|
93233
94051
|
try {
|
|
93234
94052
|
await installCursorMcpConfig();
|
|
93235
94053
|
} catch (err2) {
|
|
@@ -93444,9 +94262,9 @@ async function cmdStatus() {
|
|
|
93444
94262
|
console.log(` stack: ${profile.stack.join(", ") || "(none)"}`);
|
|
93445
94263
|
console.log(` languages: ${profile.languages.join(", ") || "(none)"}`);
|
|
93446
94264
|
}
|
|
93447
|
-
console.log(` graph db: ${
|
|
93448
|
-
console.log(` event log: ${
|
|
93449
|
-
if (
|
|
94265
|
+
console.log(` graph db: ${existsSync40(paths.castalia) ? "yes" : "no"} (${paths.castalia})`);
|
|
94266
|
+
console.log(` event log: ${existsSync40(paths.eventLog) ? "yes" : "no"} (${paths.eventLog})`);
|
|
94267
|
+
if (existsSync40(paths.castalia)) {
|
|
93450
94268
|
try {
|
|
93451
94269
|
const { openGraphStore: openGraphStore2 } = await Promise.resolve().then(() => (init_src5(), src_exports2));
|
|
93452
94270
|
const store = openGraphStore2({ path: paths.castalia });
|
|
@@ -94440,11 +95258,11 @@ async function cmdInstallationProfile(args2) {
|
|
|
94440
95258
|
}
|
|
94441
95259
|
async function cmdReview() {
|
|
94442
95260
|
const paths = workspacePaths(ROOT);
|
|
94443
|
-
if (!
|
|
95261
|
+
if (!existsSync40(paths.reviewQueue)) {
|
|
94444
95262
|
console.log("(review queue empty)");
|
|
94445
95263
|
return;
|
|
94446
95264
|
}
|
|
94447
|
-
const queue = JSON.parse(
|
|
95265
|
+
const queue = JSON.parse(readFileSync42(paths.reviewQueue, "utf8"));
|
|
94448
95266
|
if (queue.length === 0) {
|
|
94449
95267
|
console.log("(review queue empty)");
|
|
94450
95268
|
return;
|
|
@@ -95115,7 +95933,7 @@ async function gatherRepo(store, ws) {
|
|
|
95115
95933
|
};
|
|
95116
95934
|
}
|
|
95117
95935
|
async function gatherReportData(generatedAt) {
|
|
95118
|
-
const { existsSync:
|
|
95936
|
+
const { existsSync: existsSync41 } = await import("node:fs");
|
|
95119
95937
|
const { openGraphStore: openGraphStore2 } = await Promise.resolve().then(() => (init_src5(), src_exports2));
|
|
95120
95938
|
const cfg = loadConfig();
|
|
95121
95939
|
const outbound = cfg.consent.sync ? "auto" : "off";
|
|
@@ -95123,7 +95941,7 @@ async function gatherReportData(generatedAt) {
|
|
|
95123
95941
|
for (const ws of listWorkspaces()) {
|
|
95124
95942
|
if (ws.missing) continue;
|
|
95125
95943
|
const dbPath = workspacePaths(ws.path).castalia;
|
|
95126
|
-
if (!
|
|
95944
|
+
if (!existsSync41(dbPath)) continue;
|
|
95127
95945
|
let store = null;
|
|
95128
95946
|
try {
|
|
95129
95947
|
store = openGraphStore2({ path: dbPath });
|
|
@@ -95154,7 +95972,7 @@ async function gatherReportData(generatedAt) {
|
|
|
95154
95972
|
};
|
|
95155
95973
|
}
|
|
95156
95974
|
async function cmdReport(args2) {
|
|
95157
|
-
const { mkdirSync:
|
|
95975
|
+
const { mkdirSync: mkdirSync13, writeFileSync: writeFileSync31 } = await import("node:fs");
|
|
95158
95976
|
const { renderReport: renderReport2 } = await Promise.resolve().then(() => (init_report_render(), report_render_exports));
|
|
95159
95977
|
const includeFutureVerbs = args2.includes("--future-verbs");
|
|
95160
95978
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -95165,10 +95983,10 @@ async function cmdReport(args2) {
|
|
|
95165
95983
|
process.exit(2);
|
|
95166
95984
|
}
|
|
95167
95985
|
const outDir = workspacePaths(ROOT).configDir;
|
|
95168
|
-
|
|
95986
|
+
mkdirSync13(outDir, { recursive: true });
|
|
95169
95987
|
const files = renderReport2(data, { includeFutureVerbs });
|
|
95170
|
-
for (const f of files)
|
|
95171
|
-
const indexPath =
|
|
95988
|
+
for (const f of files) writeFileSync31(join49(outDir, f.name), f.html, "utf8");
|
|
95989
|
+
const indexPath = join49(outDir, "report.html");
|
|
95172
95990
|
console.log(`report \u2192 ${indexPath}`);
|
|
95173
95991
|
console.log(
|
|
95174
95992
|
` ${data.repos.length} repo(s) \xB7 ${files.length} file(s) \xB7 ${data.rollup.nodes.toLocaleString("en-US")} nodes`
|
|
@@ -95224,7 +96042,7 @@ function spawnDaemonDetached(options = {}) {
|
|
|
95224
96042
|
try {
|
|
95225
96043
|
const logPath = daemonLogPath();
|
|
95226
96044
|
try {
|
|
95227
|
-
if (statSync12(logPath).size > 5 * 1024 * 1024)
|
|
96045
|
+
if (statSync12(logPath).size > 5 * 1024 * 1024) renameSync7(logPath, `${logPath}.1`);
|
|
95228
96046
|
} catch {
|
|
95229
96047
|
}
|
|
95230
96048
|
out2 = openSync2(logPath, "a");
|
|
@@ -95293,24 +96111,24 @@ async function cmdInstallHooks(args2) {
|
|
|
95293
96111
|
}
|
|
95294
96112
|
}
|
|
95295
96113
|
async function installOpencodePlugin(port) {
|
|
95296
|
-
const { mkdirSync:
|
|
95297
|
-
const { join:
|
|
95298
|
-
const dir =
|
|
95299
|
-
if (!
|
|
95300
|
-
const file2 =
|
|
95301
|
-
if (
|
|
95302
|
-
const head2 =
|
|
96114
|
+
const { mkdirSync: mkdirSync13, existsSync: existsSync41, readFileSync: readFileSync43, writeFileSync: writeFileSync31 } = await import("node:fs");
|
|
96115
|
+
const { join: join50 } = await import("node:path");
|
|
96116
|
+
const dir = join50(ROOT, ".opencode", "plugin");
|
|
96117
|
+
if (!existsSync41(dir)) mkdirSync13(dir, { recursive: true });
|
|
96118
|
+
const file2 = join50(dir, "inerrata.js");
|
|
96119
|
+
if (existsSync41(file2)) {
|
|
96120
|
+
const head2 = readFileSync43(file2, "utf8").split("\n")[0] ?? "";
|
|
95303
96121
|
if (head2.trim() !== OPENCODE_PLUGIN_MARKER) {
|
|
95304
96122
|
console.error(`refusing to overwrite ${file2}: not an errata-managed plugin (line 1 lacks the marker)`);
|
|
95305
96123
|
process.exit(2);
|
|
95306
96124
|
}
|
|
95307
96125
|
}
|
|
95308
|
-
|
|
95309
|
-
const cfgFile =
|
|
96126
|
+
writeFileSync31(file2, buildOpencodePluginSource(port, { version: DAEMON_VERSION }), "utf8");
|
|
96127
|
+
const cfgFile = join50(ROOT, "opencode.json");
|
|
95310
96128
|
let cfg = { $schema: "https://opencode.ai/config.json" };
|
|
95311
|
-
if (
|
|
96129
|
+
if (existsSync41(cfgFile)) {
|
|
95312
96130
|
try {
|
|
95313
|
-
cfg = JSON.parse(
|
|
96131
|
+
cfg = JSON.parse(readFileSync43(cfgFile, "utf8"));
|
|
95314
96132
|
} catch {
|
|
95315
96133
|
console.error(`refusing to touch invalid JSON at ${cfgFile} \u2014 fix it and re-run`);
|
|
95316
96134
|
process.exit(2);
|
|
@@ -95321,7 +96139,7 @@ async function installOpencodePlugin(port) {
|
|
|
95321
96139
|
if (!hadErrata) {
|
|
95322
96140
|
const inv = errataMcpInvocation();
|
|
95323
96141
|
cfg.mcp["errata"] = { type: "local", command: [inv.command, ...inv.args] };
|
|
95324
|
-
|
|
96142
|
+
writeFileSync31(cfgFile, JSON.stringify(cfg, null, 2) + "\n", "utf8");
|
|
95325
96143
|
}
|
|
95326
96144
|
console.log(`installed OpenCode plugin \u2192 ${file2}`);
|
|
95327
96145
|
if (hadErrata) console.log(` mcp.errata already present in ${cfgFile} \u2014 left untouched`);
|
|
@@ -95356,15 +96174,15 @@ function installClaudeMods() {
|
|
|
95356
96174
|
}
|
|
95357
96175
|
}
|
|
95358
96176
|
async function installClaudeHooks(port) {
|
|
95359
|
-
const { mkdirSync:
|
|
95360
|
-
const { join:
|
|
95361
|
-
const dir =
|
|
95362
|
-
if (!
|
|
95363
|
-
const file2 =
|
|
96177
|
+
const { mkdirSync: mkdirSync13, existsSync: existsSync41, readFileSync: readFileSync43, writeFileSync: writeFileSync31 } = await import("node:fs");
|
|
96178
|
+
const { join: join50 } = await import("node:path");
|
|
96179
|
+
const dir = join50(ROOT, ".claude");
|
|
96180
|
+
if (!existsSync41(dir)) mkdirSync13(dir, { recursive: true });
|
|
96181
|
+
const file2 = join50(dir, "settings.json");
|
|
95364
96182
|
let settings = {};
|
|
95365
|
-
if (
|
|
96183
|
+
if (existsSync41(file2)) {
|
|
95366
96184
|
try {
|
|
95367
|
-
settings = JSON.parse(
|
|
96185
|
+
settings = JSON.parse(readFileSync43(file2, "utf8"));
|
|
95368
96186
|
} catch {
|
|
95369
96187
|
console.error(`refusing to overwrite invalid JSON at ${file2}`);
|
|
95370
96188
|
process.exit(2);
|
|
@@ -95413,12 +96231,12 @@ async function installClaudeHooks(port) {
|
|
|
95413
96231
|
list.push({ hooks: [{ type: "command", command: injectCmd }] });
|
|
95414
96232
|
}
|
|
95415
96233
|
removeProjectStatusLine(settings);
|
|
95416
|
-
|
|
96234
|
+
writeFileSync31(file2, JSON.stringify(settings, null, 2) + "\n", "utf8");
|
|
95417
96235
|
console.log(`installed Claude Code hooks \u2192 ${file2}`);
|
|
95418
96236
|
console.log(` ${ensureStatusLine(port)}`);
|
|
95419
96237
|
console.log(` ${installClaudeMods().line}`);
|
|
95420
96238
|
await installClaudeMcpConfig();
|
|
95421
|
-
const claudeMd =
|
|
96239
|
+
const claudeMd = join50(ROOT, "CLAUDE.md");
|
|
95422
96240
|
const recall = writeManagedBlock(claudeMd, { body: RECALL_FIRST_BLOCK });
|
|
95423
96241
|
if (recall.kind === "collision") {
|
|
95424
96242
|
console.warn(
|
|
@@ -95430,15 +96248,15 @@ async function installClaudeHooks(port) {
|
|
|
95430
96248
|
console.log(` endpoint: http://127.0.0.1:${port}/api/hook`);
|
|
95431
96249
|
}
|
|
95432
96250
|
async function installClaudeMcpConfig() {
|
|
95433
|
-
const { mkdirSync:
|
|
95434
|
-
const { join:
|
|
95435
|
-
const file2 =
|
|
96251
|
+
const { mkdirSync: mkdirSync13, existsSync: existsSync41, readFileSync: readFileSync43, writeFileSync: writeFileSync31 } = await import("node:fs");
|
|
96252
|
+
const { join: join50, dirname: dirname16 } = await import("node:path");
|
|
96253
|
+
const file2 = join50(ROOT, ".mcp.json");
|
|
95436
96254
|
const dir = dirname16(file2);
|
|
95437
|
-
if (!
|
|
96255
|
+
if (!existsSync41(dir)) mkdirSync13(dir, { recursive: true });
|
|
95438
96256
|
let cfg = {};
|
|
95439
|
-
if (
|
|
96257
|
+
if (existsSync41(file2)) {
|
|
95440
96258
|
try {
|
|
95441
|
-
cfg = JSON.parse(
|
|
96259
|
+
cfg = JSON.parse(readFileSync43(file2, "utf8"));
|
|
95442
96260
|
} catch {
|
|
95443
96261
|
console.error(`refusing to overwrite invalid JSON at ${file2}`);
|
|
95444
96262
|
process.exit(2);
|
|
@@ -95446,21 +96264,21 @@ async function installClaudeMcpConfig() {
|
|
|
95446
96264
|
}
|
|
95447
96265
|
cfg.mcpServers ??= {};
|
|
95448
96266
|
cfg.mcpServers["errata"] = errataMcpInvocation();
|
|
95449
|
-
|
|
96267
|
+
writeFileSync31(file2, JSON.stringify(cfg, null, 2) + "\n", "utf8");
|
|
95450
96268
|
console.log(`installed Claude Code MCP server config \u2192 ${file2}`);
|
|
95451
96269
|
console.log(` Claude Code will spawn \`errata mcp\` on workspace open.`);
|
|
95452
96270
|
console.log(` Tools: errata.search / locate / neighbors / callers_of / what_uses / show / similar`);
|
|
95453
96271
|
}
|
|
95454
96272
|
async function installCursorMcpConfig() {
|
|
95455
|
-
const { mkdirSync:
|
|
95456
|
-
const { join:
|
|
95457
|
-
const dir =
|
|
95458
|
-
if (!
|
|
95459
|
-
const file2 =
|
|
96273
|
+
const { mkdirSync: mkdirSync13, existsSync: existsSync41, readFileSync: readFileSync43, writeFileSync: writeFileSync31 } = await import("node:fs");
|
|
96274
|
+
const { join: join50 } = await import("node:path");
|
|
96275
|
+
const dir = join50(ROOT, ".cursor");
|
|
96276
|
+
if (!existsSync41(dir)) mkdirSync13(dir, { recursive: true });
|
|
96277
|
+
const file2 = join50(dir, "mcp.json");
|
|
95460
96278
|
let cfg = {};
|
|
95461
|
-
if (
|
|
96279
|
+
if (existsSync41(file2)) {
|
|
95462
96280
|
try {
|
|
95463
|
-
cfg = JSON.parse(
|
|
96281
|
+
cfg = JSON.parse(readFileSync43(file2, "utf8"));
|
|
95464
96282
|
} catch {
|
|
95465
96283
|
console.error(`refusing to overwrite invalid JSON at ${file2}`);
|
|
95466
96284
|
process.exit(2);
|
|
@@ -95468,7 +96286,7 @@ async function installCursorMcpConfig() {
|
|
|
95468
96286
|
}
|
|
95469
96287
|
cfg.mcpServers ??= {};
|
|
95470
96288
|
cfg.mcpServers["errata"] = errataMcpInvocation();
|
|
95471
|
-
|
|
96289
|
+
writeFileSync31(file2, JSON.stringify(cfg, null, 2) + "\n", "utf8");
|
|
95472
96290
|
console.log(`installed Cursor MCP server config \u2192 ${file2}`);
|
|
95473
96291
|
console.log(` Cursor will spawn \`errata mcp\` on workspace open.`);
|
|
95474
96292
|
console.log(` Tools: errata.search / locate / neighbors / callers_of / what_uses`);
|
|
@@ -95479,11 +96297,14 @@ async function installCodexHooks(port) {
|
|
|
95479
96297
|
const gitRoot = nearestGitRoot(process.cwd());
|
|
95480
96298
|
const hookRoot = gitRoot && mainCheckoutOfWorktree(gitRoot) ? gitRoot : ROOT;
|
|
95481
96299
|
const file2 = writeCodexHooks(hookRoot, port);
|
|
95482
|
-
const instructions = writeManagedBlock(
|
|
96300
|
+
const instructions = writeManagedBlock(join49(hookRoot, "AGENTS.md"), {
|
|
95483
96301
|
body: AGENTS_POINTER_BODY,
|
|
95484
96302
|
stable: true
|
|
95485
96303
|
});
|
|
95486
96304
|
console.log(`installed Codex hooks \u2192 ${file2}`);
|
|
96305
|
+
const panel = installCodexContextPlugin(hookRoot);
|
|
96306
|
+
console.log(`installed Errata Context plugin \u2192 ${panel.plugin}`);
|
|
96307
|
+
console.log(panel.enabled ? " Codex will load the panel on its next marketplace refresh; reopen the app if it is already running." : " Errata Context remains disabled by your existing plugin settings.");
|
|
95487
96308
|
if (instructions.kind === "collision") {
|
|
95488
96309
|
console.warn(" AGENTS.md's Errata block was edited; preserved it. Add an explicit instruction to read .errata/context.md each turn.");
|
|
95489
96310
|
} else {
|
|
@@ -95509,6 +96330,13 @@ function refreshExistingCodexHooks() {
|
|
|
95509
96330
|
if (result.status === "error") {
|
|
95510
96331
|
ok = false;
|
|
95511
96332
|
console.warn(`Codex relay refresh needs attention in ${result.root}: ${result.detail}`);
|
|
96333
|
+
} else {
|
|
96334
|
+
try {
|
|
96335
|
+
if (refreshCodexContextPlugin(result.root)) console.log(`updated existing Errata Context plugin \u2192 ${result.root}`);
|
|
96336
|
+
} catch (error48) {
|
|
96337
|
+
ok = false;
|
|
96338
|
+
console.warn(`Errata Context refresh needs attention in ${result.root}: ${error48 instanceof Error ? error48.message : error48}`);
|
|
96339
|
+
}
|
|
95512
96340
|
}
|
|
95513
96341
|
}
|
|
95514
96342
|
return ok;
|
|
@@ -95915,9 +96743,9 @@ async function cmdDash(args2) {
|
|
|
95915
96743
|
await yieldToLoop2();
|
|
95916
96744
|
try {
|
|
95917
96745
|
const items = selectDurableMemory(handle2.sharedStore, r.engine.profile, {
|
|
95918
|
-
atCommit: readGitRefState(
|
|
96746
|
+
atCommit: readGitRefState(join49(r.root, ".git")).sha ?? void 0
|
|
95919
96747
|
});
|
|
95920
|
-
const res = bleedRules(
|
|
96748
|
+
const res = bleedRules(join49(r.root, ".claude", "rules"), items);
|
|
95921
96749
|
if (res.written || res.pruned) {
|
|
95922
96750
|
console.log(
|
|
95923
96751
|
`[rules:${r.entry.name}] ${res.written} collective principle(s) \u2192 .claude/rules` + (res.pruned ? `, ${res.pruned} pruned` : "")
|
|
@@ -96160,4 +96988,41 @@ undici/lib/web/websocket/frame.js:
|
|
|
96160
96988
|
|
|
96161
96989
|
chokidar/esm/index.js:
|
|
96162
96990
|
(*! chokidar - MIT License (c) 2012 Paul Miller (paulmillr.com) *)
|
|
96991
|
+
|
|
96992
|
+
smol-toml/dist/error.js:
|
|
96993
|
+
smol-toml/dist/util.js:
|
|
96994
|
+
smol-toml/dist/date.js:
|
|
96995
|
+
smol-toml/dist/primitive.js:
|
|
96996
|
+
smol-toml/dist/extract.js:
|
|
96997
|
+
smol-toml/dist/struct.js:
|
|
96998
|
+
smol-toml/dist/parse.js:
|
|
96999
|
+
smol-toml/dist/stringify.js:
|
|
97000
|
+
smol-toml/dist/index.js:
|
|
97001
|
+
(*!
|
|
97002
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
97003
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
97004
|
+
*
|
|
97005
|
+
* Redistribution and use in source and binary forms, with or without
|
|
97006
|
+
* modification, are permitted provided that the following conditions are met:
|
|
97007
|
+
*
|
|
97008
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
97009
|
+
* list of conditions and the following disclaimer.
|
|
97010
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
97011
|
+
* this list of conditions and the following disclaimer in the
|
|
97012
|
+
* documentation and/or other materials provided with the distribution.
|
|
97013
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
97014
|
+
* may be used to endorse or promote products derived from this software without
|
|
97015
|
+
* specific prior written permission.
|
|
97016
|
+
*
|
|
97017
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
97018
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
97019
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
97020
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
97021
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
97022
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
97023
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
97024
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
97025
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
97026
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
97027
|
+
*)
|
|
96163
97028
|
*/
|