claude-use 11.54.0 → 11.55.0
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/dist/cli.cjs +678 -178
- package/dist/index.cjs +75 -23
- package/dist/index.mjs +76 -24
- package/dist/types/index.d.ts +671 -29
- package/package.json +2 -1
package/dist/cli.cjs
CHANGED
|
@@ -1518,8 +1518,8 @@ function anchor(source) {
|
|
|
1518
1518
|
}
|
|
1519
1519
|
function timeSource(args) {
|
|
1520
1520
|
const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
|
|
1521
|
-
const
|
|
1522
|
-
return
|
|
1521
|
+
const regex2 = typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : args.seconds ? `${hhmm}:[0-5]\\d(?:\\.\\d+)?` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
|
|
1522
|
+
return regex2;
|
|
1523
1523
|
}
|
|
1524
1524
|
function time(args) {
|
|
1525
1525
|
return new RegExp(`^${timeSource(args)}$`);
|
|
@@ -1587,8 +1587,8 @@ var init_regexes = __esm({
|
|
|
1587
1587
|
date = /* @__PURE__ */ anchor(dateSource);
|
|
1588
1588
|
anyString = /^[\s\S]{0,}$/;
|
|
1589
1589
|
string = (params) => {
|
|
1590
|
-
const
|
|
1591
|
-
return new RegExp(`^${
|
|
1590
|
+
const regex2 = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
|
|
1591
|
+
return new RegExp(`^${regex2}$`);
|
|
1592
1592
|
};
|
|
1593
1593
|
bigint = /^-?\d+n?$/;
|
|
1594
1594
|
integer = /^-?\d+$/;
|
|
@@ -4781,14 +4781,14 @@ var init_memoizer = __esm({
|
|
|
4781
4781
|
(_a4 = inst._zod).deferred ?? (_a4.deferred = []);
|
|
4782
4782
|
inst._zod.deferred.push(() => {
|
|
4783
4783
|
const base = inst._zod.parse;
|
|
4784
|
-
const
|
|
4784
|
+
const wrapped2 = (payload, ctx) => {
|
|
4785
4785
|
if (ctx.direction !== "backward" && isBackEdge(ctx, payload.value))
|
|
4786
4786
|
throw new $ZodCyclicError();
|
|
4787
4787
|
return base(payload, ctx);
|
|
4788
4788
|
};
|
|
4789
|
-
inst._zod.parse =
|
|
4789
|
+
inst._zod.parse = wrapped2;
|
|
4790
4790
|
if (inst._zod.run === base)
|
|
4791
|
-
inst._zod.run =
|
|
4791
|
+
inst._zod.run = wrapped2;
|
|
4792
4792
|
});
|
|
4793
4793
|
},
|
|
4794
4794
|
attach(inst) {
|
|
@@ -4800,12 +4800,12 @@ var init_memoizer = __esm({
|
|
|
4800
4800
|
(_a4 = inst._zod).deferred ?? (_a4.deferred = []);
|
|
4801
4801
|
inst._zod.deferred.push(() => {
|
|
4802
4802
|
const base = inst._zod.parse;
|
|
4803
|
-
const
|
|
4803
|
+
const wrapped2 = (payload, ctx) => {
|
|
4804
4804
|
if (isRecursiveInst === void 0) {
|
|
4805
4805
|
const walked = isRecursive(inst, /* @__PURE__ */ new Set(), false);
|
|
4806
4806
|
if (walked === NONE) {
|
|
4807
4807
|
inst._zod.parse = base;
|
|
4808
|
-
if (inst._zod.run ===
|
|
4808
|
+
if (inst._zod.run === wrapped2)
|
|
4809
4809
|
inst._zod.run = base;
|
|
4810
4810
|
return base(payload, ctx);
|
|
4811
4811
|
}
|
|
@@ -4859,9 +4859,9 @@ var init_memoizer = __esm({
|
|
|
4859
4859
|
entry.issues = result.issues.length ? cloneIssues(result.issues) : NO_ISSUES;
|
|
4860
4860
|
return result;
|
|
4861
4861
|
};
|
|
4862
|
-
inst._zod.parse =
|
|
4862
|
+
inst._zod.parse = wrapped2;
|
|
4863
4863
|
if (inst._zod.run === base)
|
|
4864
|
-
inst._zod.run =
|
|
4864
|
+
inst._zod.run = wrapped2;
|
|
4865
4865
|
});
|
|
4866
4866
|
}
|
|
4867
4867
|
};
|
|
@@ -12959,7 +12959,7 @@ function withParser(schema, parser) {
|
|
|
12959
12959
|
const clone3 = clone(schema);
|
|
12960
12960
|
const liveRun = schema._zod.run;
|
|
12961
12961
|
const originalRun = liveRun.__originalRun ?? liveRun;
|
|
12962
|
-
const
|
|
12962
|
+
const wrapped2 = (payload, ctx) => {
|
|
12963
12963
|
if (ctx?.async || ctx?.direction === "backward" || ctx?.skipChecks || ctx?.[FALLBACK_FLAG]) {
|
|
12964
12964
|
return originalRun(payload, ctx);
|
|
12965
12965
|
}
|
|
@@ -12975,10 +12975,10 @@ function withParser(schema, parser) {
|
|
|
12975
12975
|
ctx[FALLBACK_FLAG] = true;
|
|
12976
12976
|
return originalRun(payload, ctx);
|
|
12977
12977
|
};
|
|
12978
|
-
|
|
12978
|
+
wrapped2.__originalRun = originalRun;
|
|
12979
12979
|
clone3._zod.bag.fallbackRun = originalRun;
|
|
12980
12980
|
clone3._zod.bag.validator = parser;
|
|
12981
|
-
clone3._zod.run =
|
|
12981
|
+
clone3._zod.run = wrapped2;
|
|
12982
12982
|
if (!liveRun.__originalRun)
|
|
12983
12983
|
installCompiledUserMethods(clone3, schema, parser);
|
|
12984
12984
|
return clone3;
|
|
@@ -16402,9 +16402,9 @@ var init_json_schema_processors = __esm({
|
|
|
16402
16402
|
json2.pattern = patternList[0].source;
|
|
16403
16403
|
else if (patternList.length > 1) {
|
|
16404
16404
|
json2.allOf = [
|
|
16405
|
-
...patternList.map((
|
|
16405
|
+
...patternList.map((regex2) => ({
|
|
16406
16406
|
...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
|
|
16407
|
-
pattern:
|
|
16407
|
+
pattern: regex2.source
|
|
16408
16408
|
}))
|
|
16409
16409
|
];
|
|
16410
16410
|
}
|
|
@@ -17743,10 +17743,10 @@ function currencyCode2(_params) {
|
|
|
17743
17743
|
function hash(alg, params) {
|
|
17744
17744
|
const enc = params?.enc ?? "hex";
|
|
17745
17745
|
const format = `${alg}_${enc}`;
|
|
17746
|
-
const
|
|
17747
|
-
if (!
|
|
17746
|
+
const regex2 = regexes_exports[format];
|
|
17747
|
+
if (!regex2)
|
|
17748
17748
|
throw new Error(`Unrecognized hash format: ${format}`);
|
|
17749
|
-
return _stringFormat(ZodCustomStringFormat, format,
|
|
17749
|
+
return _stringFormat(ZodCustomStringFormat, format, regex2, params);
|
|
17750
17750
|
}
|
|
17751
17751
|
function number2(params) {
|
|
17752
17752
|
return _number(ZodNumber, params);
|
|
@@ -19607,7 +19607,7 @@ function convertBaseSchema(schema, ctx) {
|
|
|
19607
19607
|
for (const key of Object.keys(payload.value)) {
|
|
19608
19608
|
if (propertyKeys.includes(key))
|
|
19609
19609
|
continue;
|
|
19610
|
-
if (patterns.some((
|
|
19610
|
+
if (patterns.some((regex2) => regex2.test(key)))
|
|
19611
19611
|
continue;
|
|
19612
19612
|
unrecognized.push(key);
|
|
19613
19613
|
}
|
|
@@ -25036,12 +25036,304 @@ var init_proxyBypass = __esm({
|
|
|
25036
25036
|
}
|
|
25037
25037
|
});
|
|
25038
25038
|
|
|
25039
|
+
// node_modules/.pnpm/ansi-regex@6.3.0/node_modules/ansi-regex/index.js
|
|
25040
|
+
function ansiRegex({ onlyFirst = false } = {}) {
|
|
25041
|
+
const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
|
|
25042
|
+
const osc = `(?:\\u001B\\][^\\u0007\\u001B\\u009C]*${ST})`;
|
|
25043
|
+
const csi = "[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";
|
|
25044
|
+
const pattern = `${osc}|${csi}`;
|
|
25045
|
+
return new RegExp(pattern, onlyFirst ? void 0 : "g");
|
|
25046
|
+
}
|
|
25047
|
+
var init_ansi_regex = __esm({
|
|
25048
|
+
"node_modules/.pnpm/ansi-regex@6.3.0/node_modules/ansi-regex/index.js"() {
|
|
25049
|
+
}
|
|
25050
|
+
});
|
|
25051
|
+
|
|
25052
|
+
// node_modules/.pnpm/strip-ansi@7.2.0/node_modules/strip-ansi/index.js
|
|
25053
|
+
function stripAnsi(string4) {
|
|
25054
|
+
if (typeof string4 !== "string") {
|
|
25055
|
+
throw new TypeError(`Expected a \`string\`, got \`${typeof string4}\``);
|
|
25056
|
+
}
|
|
25057
|
+
if (!string4.includes("\x1B") && !string4.includes("\x9B")) {
|
|
25058
|
+
return string4;
|
|
25059
|
+
}
|
|
25060
|
+
return string4.replace(regex, "");
|
|
25061
|
+
}
|
|
25062
|
+
var regex;
|
|
25063
|
+
var init_strip_ansi = __esm({
|
|
25064
|
+
"node_modules/.pnpm/strip-ansi@7.2.0/node_modules/strip-ansi/index.js"() {
|
|
25065
|
+
init_ansi_regex();
|
|
25066
|
+
regex = ansiRegex();
|
|
25067
|
+
}
|
|
25068
|
+
});
|
|
25069
|
+
|
|
25070
|
+
// node_modules/.pnpm/get-east-asian-width@1.6.0/node_modules/get-east-asian-width/lookup-data.js
|
|
25071
|
+
var ambiguousMinimalCodePoint, ambiguousMaximumCodePoint, ambiguousRanges, fullwidthMinimalCodePoint, fullwidthMaximumCodePoint, fullwidthRanges, wideMinimalCodePoint, wideMaximumCodePoint, wideRanges;
|
|
25072
|
+
var init_lookup_data = __esm({
|
|
25073
|
+
"node_modules/.pnpm/get-east-asian-width@1.6.0/node_modules/get-east-asian-width/lookup-data.js"() {
|
|
25074
|
+
ambiguousMinimalCodePoint = 161;
|
|
25075
|
+
ambiguousMaximumCodePoint = 1114109;
|
|
25076
|
+
ambiguousRanges = [161, 161, 164, 164, 167, 168, 170, 170, 173, 174, 176, 180, 182, 186, 188, 191, 198, 198, 208, 208, 215, 216, 222, 225, 230, 230, 232, 234, 236, 237, 240, 240, 242, 243, 247, 250, 252, 252, 254, 254, 257, 257, 273, 273, 275, 275, 283, 283, 294, 295, 299, 299, 305, 307, 312, 312, 319, 322, 324, 324, 328, 331, 333, 333, 338, 339, 358, 359, 363, 363, 462, 462, 464, 464, 466, 466, 468, 468, 470, 470, 472, 472, 474, 474, 476, 476, 593, 593, 609, 609, 708, 708, 711, 711, 713, 715, 717, 717, 720, 720, 728, 731, 733, 733, 735, 735, 768, 879, 913, 929, 931, 937, 945, 961, 963, 969, 1025, 1025, 1040, 1103, 1105, 1105, 8208, 8208, 8211, 8214, 8216, 8217, 8220, 8221, 8224, 8226, 8228, 8231, 8240, 8240, 8242, 8243, 8245, 8245, 8251, 8251, 8254, 8254, 8308, 8308, 8319, 8319, 8321, 8324, 8364, 8364, 8451, 8451, 8453, 8453, 8457, 8457, 8467, 8467, 8470, 8470, 8481, 8482, 8486, 8486, 8491, 8491, 8531, 8532, 8539, 8542, 8544, 8555, 8560, 8569, 8585, 8585, 8592, 8601, 8632, 8633, 8658, 8658, 8660, 8660, 8679, 8679, 8704, 8704, 8706, 8707, 8711, 8712, 8715, 8715, 8719, 8719, 8721, 8721, 8725, 8725, 8730, 8730, 8733, 8736, 8739, 8739, 8741, 8741, 8743, 8748, 8750, 8750, 8756, 8759, 8764, 8765, 8776, 8776, 8780, 8780, 8786, 8786, 8800, 8801, 8804, 8807, 8810, 8811, 8814, 8815, 8834, 8835, 8838, 8839, 8853, 8853, 8857, 8857, 8869, 8869, 8895, 8895, 8978, 8978, 9312, 9449, 9451, 9547, 9552, 9587, 9600, 9615, 9618, 9621, 9632, 9633, 9635, 9641, 9650, 9651, 9654, 9655, 9660, 9661, 9664, 9665, 9670, 9672, 9675, 9675, 9678, 9681, 9698, 9701, 9711, 9711, 9733, 9734, 9737, 9737, 9742, 9743, 9756, 9756, 9758, 9758, 9792, 9792, 9794, 9794, 9824, 9825, 9827, 9829, 9831, 9834, 9836, 9837, 9839, 9839, 9886, 9887, 9919, 9919, 9926, 9933, 9935, 9939, 9941, 9953, 9955, 9955, 9960, 9961, 9963, 9969, 9972, 9972, 9974, 9977, 9979, 9980, 9982, 9983, 10045, 10045, 10102, 10111, 11094, 11097, 12872, 12879, 57344, 63743, 65024, 65039, 65533, 65533, 127232, 127242, 127248, 127277, 127280, 127337, 127344, 127373, 127375, 127376, 127387, 127404, 917760, 917999, 983040, 1048573, 1048576, 1114109];
|
|
25077
|
+
fullwidthMinimalCodePoint = 12288;
|
|
25078
|
+
fullwidthMaximumCodePoint = 65510;
|
|
25079
|
+
fullwidthRanges = [12288, 12288, 65281, 65376, 65504, 65510];
|
|
25080
|
+
wideMinimalCodePoint = 4352;
|
|
25081
|
+
wideMaximumCodePoint = 262141;
|
|
25082
|
+
wideRanges = [4352, 4447, 8986, 8987, 9001, 9002, 9193, 9196, 9200, 9200, 9203, 9203, 9725, 9726, 9748, 9749, 9776, 9783, 9800, 9811, 9855, 9855, 9866, 9871, 9875, 9875, 9889, 9889, 9898, 9899, 9917, 9918, 9924, 9925, 9934, 9934, 9940, 9940, 9962, 9962, 9970, 9971, 9973, 9973, 9978, 9978, 9981, 9981, 9989, 9989, 9994, 9995, 10024, 10024, 10060, 10060, 10062, 10062, 10067, 10069, 10071, 10071, 10133, 10135, 10160, 10160, 10175, 10175, 11035, 11036, 11088, 11088, 11093, 11093, 11904, 11929, 11931, 12019, 12032, 12245, 12272, 12287, 12289, 12350, 12353, 12438, 12441, 12543, 12549, 12591, 12593, 12686, 12688, 12773, 12783, 12830, 12832, 12871, 12880, 42124, 42128, 42182, 43360, 43388, 44032, 55203, 63744, 64255, 65040, 65049, 65072, 65106, 65108, 65126, 65128, 65131, 94176, 94180, 94192, 94198, 94208, 101589, 101631, 101662, 101760, 101874, 110576, 110579, 110581, 110587, 110589, 110590, 110592, 110882, 110898, 110898, 110928, 110930, 110933, 110933, 110948, 110951, 110960, 111355, 119552, 119638, 119648, 119670, 126980, 126980, 127183, 127183, 127374, 127374, 127377, 127386, 127488, 127490, 127504, 127547, 127552, 127560, 127568, 127569, 127584, 127589, 127744, 127776, 127789, 127797, 127799, 127868, 127870, 127891, 127904, 127946, 127951, 127955, 127968, 127984, 127988, 127988, 127992, 128062, 128064, 128064, 128066, 128252, 128255, 128317, 128331, 128334, 128336, 128359, 128378, 128378, 128405, 128406, 128420, 128420, 128507, 128591, 128640, 128709, 128716, 128716, 128720, 128722, 128725, 128728, 128732, 128735, 128747, 128748, 128756, 128764, 128992, 129003, 129008, 129008, 129292, 129338, 129340, 129349, 129351, 129535, 129648, 129660, 129664, 129674, 129678, 129734, 129736, 129736, 129741, 129756, 129759, 129770, 129775, 129784, 131072, 196605, 196608, 262141];
|
|
25083
|
+
}
|
|
25084
|
+
});
|
|
25085
|
+
|
|
25086
|
+
// node_modules/.pnpm/get-east-asian-width@1.6.0/node_modules/get-east-asian-width/utilities.js
|
|
25087
|
+
var isInRange;
|
|
25088
|
+
var init_utilities = __esm({
|
|
25089
|
+
"node_modules/.pnpm/get-east-asian-width@1.6.0/node_modules/get-east-asian-width/utilities.js"() {
|
|
25090
|
+
isInRange = (ranges, codePoint) => {
|
|
25091
|
+
let low = 0;
|
|
25092
|
+
let high = Math.floor(ranges.length / 2) - 1;
|
|
25093
|
+
while (low <= high) {
|
|
25094
|
+
const mid = Math.floor((low + high) / 2);
|
|
25095
|
+
const i10 = mid * 2;
|
|
25096
|
+
if (codePoint < ranges[i10]) {
|
|
25097
|
+
high = mid - 1;
|
|
25098
|
+
} else if (codePoint > ranges[i10 + 1]) {
|
|
25099
|
+
low = mid + 1;
|
|
25100
|
+
} else {
|
|
25101
|
+
return true;
|
|
25102
|
+
}
|
|
25103
|
+
}
|
|
25104
|
+
return false;
|
|
25105
|
+
};
|
|
25106
|
+
}
|
|
25107
|
+
});
|
|
25108
|
+
|
|
25109
|
+
// node_modules/.pnpm/get-east-asian-width@1.6.0/node_modules/get-east-asian-width/lookup.js
|
|
25110
|
+
function findWideFastPathRange(ranges) {
|
|
25111
|
+
let fastPathStart = ranges[0];
|
|
25112
|
+
let fastPathEnd = ranges[1];
|
|
25113
|
+
for (let index = 0; index < ranges.length; index += 2) {
|
|
25114
|
+
const start = ranges[index];
|
|
25115
|
+
const end = ranges[index + 1];
|
|
25116
|
+
if (commonCjkCodePoint >= start && commonCjkCodePoint <= end) {
|
|
25117
|
+
return [start, end];
|
|
25118
|
+
}
|
|
25119
|
+
if (end - start > fastPathEnd - fastPathStart) {
|
|
25120
|
+
fastPathStart = start;
|
|
25121
|
+
fastPathEnd = end;
|
|
25122
|
+
}
|
|
25123
|
+
}
|
|
25124
|
+
return [fastPathStart, fastPathEnd];
|
|
25125
|
+
}
|
|
25126
|
+
var commonCjkCodePoint, wideFastPathStart, wideFastPathEnd, isAmbiguous, isFullWidth, isWide;
|
|
25127
|
+
var init_lookup = __esm({
|
|
25128
|
+
"node_modules/.pnpm/get-east-asian-width@1.6.0/node_modules/get-east-asian-width/lookup.js"() {
|
|
25129
|
+
init_lookup_data();
|
|
25130
|
+
init_utilities();
|
|
25131
|
+
commonCjkCodePoint = 19968;
|
|
25132
|
+
[wideFastPathStart, wideFastPathEnd] = /* @__PURE__ */ findWideFastPathRange(wideRanges);
|
|
25133
|
+
isAmbiguous = (codePoint) => {
|
|
25134
|
+
if (codePoint < ambiguousMinimalCodePoint || codePoint > ambiguousMaximumCodePoint) {
|
|
25135
|
+
return false;
|
|
25136
|
+
}
|
|
25137
|
+
return isInRange(ambiguousRanges, codePoint);
|
|
25138
|
+
};
|
|
25139
|
+
isFullWidth = (codePoint) => {
|
|
25140
|
+
if (codePoint < fullwidthMinimalCodePoint || codePoint > fullwidthMaximumCodePoint) {
|
|
25141
|
+
return false;
|
|
25142
|
+
}
|
|
25143
|
+
return isInRange(fullwidthRanges, codePoint);
|
|
25144
|
+
};
|
|
25145
|
+
isWide = (codePoint) => {
|
|
25146
|
+
if (codePoint >= wideFastPathStart && codePoint <= wideFastPathEnd) {
|
|
25147
|
+
return true;
|
|
25148
|
+
}
|
|
25149
|
+
if (codePoint < wideMinimalCodePoint || codePoint > wideMaximumCodePoint) {
|
|
25150
|
+
return false;
|
|
25151
|
+
}
|
|
25152
|
+
return isInRange(wideRanges, codePoint);
|
|
25153
|
+
};
|
|
25154
|
+
}
|
|
25155
|
+
});
|
|
25156
|
+
|
|
25157
|
+
// node_modules/.pnpm/get-east-asian-width@1.6.0/node_modules/get-east-asian-width/index.js
|
|
25158
|
+
function validate2(codePoint) {
|
|
25159
|
+
if (!Number.isSafeInteger(codePoint)) {
|
|
25160
|
+
throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
|
|
25161
|
+
}
|
|
25162
|
+
}
|
|
25163
|
+
function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
|
|
25164
|
+
validate2(codePoint);
|
|
25165
|
+
if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) {
|
|
25166
|
+
return 2;
|
|
25167
|
+
}
|
|
25168
|
+
return 1;
|
|
25169
|
+
}
|
|
25170
|
+
var init_get_east_asian_width = __esm({
|
|
25171
|
+
"node_modules/.pnpm/get-east-asian-width@1.6.0/node_modules/get-east-asian-width/index.js"() {
|
|
25172
|
+
init_lookup();
|
|
25173
|
+
}
|
|
25174
|
+
});
|
|
25175
|
+
|
|
25176
|
+
// node_modules/.pnpm/string-width@8.3.0/node_modules/string-width/index.js
|
|
25177
|
+
function isDoubleWidthNonRgiEmojiSequence(segment) {
|
|
25178
|
+
if (segment.length > 50) {
|
|
25179
|
+
return false;
|
|
25180
|
+
}
|
|
25181
|
+
if (unqualifiedKeycapRegex.test(segment)) {
|
|
25182
|
+
return true;
|
|
25183
|
+
}
|
|
25184
|
+
if (segment.includes("\u200D")) {
|
|
25185
|
+
const pictographics = segment.match(extendedPictographicRegex);
|
|
25186
|
+
return pictographics !== null && pictographics.length >= 2;
|
|
25187
|
+
}
|
|
25188
|
+
return false;
|
|
25189
|
+
}
|
|
25190
|
+
function baseVisible(segment) {
|
|
25191
|
+
const index = segment.search(visibleCharacterRegex);
|
|
25192
|
+
return index === -1 ? void 0 : segment.slice(index);
|
|
25193
|
+
}
|
|
25194
|
+
function isHangulLeadingJamo(codePoint) {
|
|
25195
|
+
return codePoint >= 4352 && codePoint <= 4447 || codePoint >= 43360 && codePoint <= 43388;
|
|
25196
|
+
}
|
|
25197
|
+
function isHangulVowelJamo(codePoint) {
|
|
25198
|
+
return codePoint >= 4448 && codePoint <= 4519 || codePoint >= 55216 && codePoint <= 55238;
|
|
25199
|
+
}
|
|
25200
|
+
function isHangulTrailingJamo(codePoint) {
|
|
25201
|
+
return codePoint >= 4520 && codePoint <= 4607 || codePoint >= 55243 && codePoint <= 55291;
|
|
25202
|
+
}
|
|
25203
|
+
function isHangulJamo(codePoint) {
|
|
25204
|
+
return isHangulLeadingJamo(codePoint) || isHangulVowelJamo(codePoint) || isHangulTrailingJamo(codePoint);
|
|
25205
|
+
}
|
|
25206
|
+
function hangulClusterWidth(visibleSegment, eastAsianWidthOptions) {
|
|
25207
|
+
const codePoints = [];
|
|
25208
|
+
for (const character of visibleSegment) {
|
|
25209
|
+
if (!visibleCharacterRegex.test(character)) {
|
|
25210
|
+
continue;
|
|
25211
|
+
}
|
|
25212
|
+
codePoints.push(character.codePointAt(0));
|
|
25213
|
+
}
|
|
25214
|
+
if (codePoints.length === 0) {
|
|
25215
|
+
return void 0;
|
|
25216
|
+
}
|
|
25217
|
+
let width = 0;
|
|
25218
|
+
for (let index = 0; index < codePoints.length; index++) {
|
|
25219
|
+
const codePoint = codePoints[index];
|
|
25220
|
+
if (!isHangulJamo(codePoint)) {
|
|
25221
|
+
if (width === 0) {
|
|
25222
|
+
return void 0;
|
|
25223
|
+
}
|
|
25224
|
+
for (let remaining = index; remaining < codePoints.length; remaining++) {
|
|
25225
|
+
width += eastAsianWidth(codePoints[remaining], eastAsianWidthOptions);
|
|
25226
|
+
}
|
|
25227
|
+
return width;
|
|
25228
|
+
}
|
|
25229
|
+
if (isHangulLeadingJamo(codePoint) && isHangulVowelJamo(codePoints[index + 1])) {
|
|
25230
|
+
width += 2;
|
|
25231
|
+
index += isHangulTrailingJamo(codePoints[index + 2]) ? 2 : 1;
|
|
25232
|
+
continue;
|
|
25233
|
+
}
|
|
25234
|
+
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
|
25235
|
+
}
|
|
25236
|
+
return width;
|
|
25237
|
+
}
|
|
25238
|
+
function trailingWidth(visibleSegment, eastAsianWidthOptions) {
|
|
25239
|
+
let extra = 0;
|
|
25240
|
+
let first = true;
|
|
25241
|
+
for (const character of visibleSegment) {
|
|
25242
|
+
if (first) {
|
|
25243
|
+
first = false;
|
|
25244
|
+
continue;
|
|
25245
|
+
}
|
|
25246
|
+
if (spacingMarkRegex.test(character) || character >= "\uFF00" && character <= "\uFFEF") {
|
|
25247
|
+
extra += eastAsianWidth(character.codePointAt(0), eastAsianWidthOptions);
|
|
25248
|
+
}
|
|
25249
|
+
}
|
|
25250
|
+
return extra;
|
|
25251
|
+
}
|
|
25252
|
+
function stringWidth(input2, options = {}) {
|
|
25253
|
+
if (typeof input2 !== "string" || input2.length === 0) {
|
|
25254
|
+
return 0;
|
|
25255
|
+
}
|
|
25256
|
+
const {
|
|
25257
|
+
ambiguousIsNarrow = true,
|
|
25258
|
+
countAnsiEscapeCodes = false
|
|
25259
|
+
} = options;
|
|
25260
|
+
let string4 = input2;
|
|
25261
|
+
if (!countAnsiEscapeCodes && (string4.includes("\x1B") || string4.includes("\x9B"))) {
|
|
25262
|
+
string4 = stripAnsi(string4);
|
|
25263
|
+
}
|
|
25264
|
+
if (string4.length === 0) {
|
|
25265
|
+
return 0;
|
|
25266
|
+
}
|
|
25267
|
+
if (/^[\u0020-\u007E]*$/.test(string4)) {
|
|
25268
|
+
return string4.length;
|
|
25269
|
+
}
|
|
25270
|
+
let width = 0;
|
|
25271
|
+
const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
|
|
25272
|
+
for (const { segment } of segmenter.segment(string4)) {
|
|
25273
|
+
const visibleSegment = baseVisible(segment);
|
|
25274
|
+
if (visibleSegment === void 0) {
|
|
25275
|
+
continue;
|
|
25276
|
+
}
|
|
25277
|
+
if (rgiEmojiRegex.test(segment) || isDoubleWidthNonRgiEmojiSequence(segment)) {
|
|
25278
|
+
width += 2;
|
|
25279
|
+
continue;
|
|
25280
|
+
}
|
|
25281
|
+
const hangulWidth = hangulClusterWidth(visibleSegment, eastAsianWidthOptions);
|
|
25282
|
+
if (hangulWidth !== void 0) {
|
|
25283
|
+
width += hangulWidth;
|
|
25284
|
+
continue;
|
|
25285
|
+
}
|
|
25286
|
+
const codePoint = visibleSegment.codePointAt(0);
|
|
25287
|
+
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
|
25288
|
+
width += trailingWidth(visibleSegment, eastAsianWidthOptions);
|
|
25289
|
+
}
|
|
25290
|
+
return width;
|
|
25291
|
+
}
|
|
25292
|
+
var segmenter, visibleCharacterRegex, spacingMarkRegex, rgiEmojiRegex, unqualifiedKeycapRegex, extendedPictographicRegex;
|
|
25293
|
+
var init_string_width = __esm({
|
|
25294
|
+
"node_modules/.pnpm/string-width@8.3.0/node_modules/string-width/index.js"() {
|
|
25295
|
+
init_strip_ansi();
|
|
25296
|
+
init_get_east_asian_width();
|
|
25297
|
+
segmenter = new Intl.Segmenter();
|
|
25298
|
+
visibleCharacterRegex = new RegExp("[^\\p{Default_Ignorable_Code_Point}\\p{Control}\\p{Format}\\p{Nonspacing_Mark}\\p{Enclosing_Mark}\\p{Surrogate}]", "v");
|
|
25299
|
+
spacingMarkRegex = new RegExp("\\p{Spacing_Mark}", "v");
|
|
25300
|
+
rgiEmojiRegex = new RegExp("^\\p{RGI_Emoji}$", "v");
|
|
25301
|
+
unqualifiedKeycapRegex = /^[\d#*]\u20E3$/;
|
|
25302
|
+
extendedPictographicRegex = new RegExp("\\p{Extended_Pictographic}", "gu");
|
|
25303
|
+
}
|
|
25304
|
+
});
|
|
25305
|
+
|
|
25306
|
+
// src/statusline/blank.ts
|
|
25307
|
+
function drawsNothing(text4) {
|
|
25308
|
+
return stringWidth(text4.replace(BLANK_CELLS, "")) === 0;
|
|
25309
|
+
}
|
|
25310
|
+
var BLANK_CELLS;
|
|
25311
|
+
var init_blank = __esm({
|
|
25312
|
+
"src/statusline/blank.ts"() {
|
|
25313
|
+
"use strict";
|
|
25314
|
+
init_string_width();
|
|
25315
|
+
BLANK_CELLS = /[\p{Zs}\u2800\u3164\uFFA0]/gu;
|
|
25316
|
+
}
|
|
25317
|
+
});
|
|
25318
|
+
|
|
25319
|
+
// src/statusline/graphemes.ts
|
|
25320
|
+
function graphemesOf(text4) {
|
|
25321
|
+
return Array.from(SEGMENTER.segment(text4), (part) => part.segment);
|
|
25322
|
+
}
|
|
25323
|
+
var SEGMENTER;
|
|
25324
|
+
var init_graphemes = __esm({
|
|
25325
|
+
"src/statusline/graphemes.ts"() {
|
|
25326
|
+
"use strict";
|
|
25327
|
+
SEGMENTER = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
25328
|
+
}
|
|
25329
|
+
});
|
|
25330
|
+
|
|
25039
25331
|
// src/config/statusline.ts
|
|
25040
25332
|
function distinctList(member) {
|
|
25041
25333
|
return external_exports.array(member).refine((items) => new Set(items).size === items.length, "must not repeat an entry");
|
|
25042
25334
|
}
|
|
25043
25335
|
function isSingleVisibleGrapheme(text4) {
|
|
25044
|
-
return
|
|
25336
|
+
return graphemesOf(text4).length === 1 && stringWidth(text4) === 1 && !/[\p{C}\p{Z}]/u.test(text4) && !drawsNothing(text4);
|
|
25045
25337
|
}
|
|
25046
25338
|
function isPlainObject2(value2) {
|
|
25047
25339
|
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
@@ -25063,11 +25355,14 @@ function resolveStatusline(settings2) {
|
|
|
25063
25355
|
}
|
|
25064
25356
|
return resolved;
|
|
25065
25357
|
}
|
|
25066
|
-
var STATUSLINE_HEADER_SEGMENTS, STATUSLINE_ROWS, STATUSLINE_COLOUR_NAMES, DEFAULT_HEADER_SEGMENTS, DEFAULT_ROWS, STATUSLINE_PATH_LEVELS, MAX_PERCENT, MAX_STATUSLINE_PALETTE_INDEX,
|
|
25358
|
+
var STATUSLINE_HEADER_SEGMENTS, STATUSLINE_ROWS, STATUSLINE_COLOUR_NAMES, DEFAULT_HEADER_SEGMENTS, DEFAULT_ROWS, STATUSLINE_PATH_LEVELS, STATUSLINE_USAGE_VALUES, STATUSLINE_TIME_FORMATS, STATUSLINE_HOUR_CYCLES, MAX_PERCENT, MAX_STATUSLINE_PALETTE_INDEX, MAX_STATUSLINE_LABEL_COLUMNS, MAX_BAR_CELLS, MAX_ACCOUNT_USER_CHARS, MAX_DISPLAY_TEXT_CHARS, LABEL_RE2, OPTIONAL_LABEL_RE, colourValue, barCharacter, labelText, overrideText, wholePercent, thresholdPercent, SHAPES, StatuslineSchema, ResolvedStatuslineSchema, STATUSLINE_DEFAULTS, STATUSLINE_ENV;
|
|
25067
25359
|
var init_statusline = __esm({
|
|
25068
25360
|
"src/config/statusline.ts"() {
|
|
25069
25361
|
"use strict";
|
|
25362
|
+
init_string_width();
|
|
25070
25363
|
init_zod();
|
|
25364
|
+
init_blank();
|
|
25365
|
+
init_graphemes();
|
|
25071
25366
|
STATUSLINE_HEADER_SEGMENTS = ["model", "provider", "route", "account", "identity", "headroom", "project", "vcs", "effort", "advisor", "version", "outputStyle"];
|
|
25072
25367
|
STATUSLINE_ROWS = ["context", "quota", "addedDirs", "gitFiles"];
|
|
25073
25368
|
STATUSLINE_COLOUR_NAMES = [
|
|
@@ -25093,20 +25388,23 @@ var init_statusline = __esm({
|
|
|
25093
25388
|
DEFAULT_HEADER_SEGMENTS = ["model", "provider", "route", "account", "identity", "headroom"];
|
|
25094
25389
|
DEFAULT_ROWS = ["context", "quota"];
|
|
25095
25390
|
STATUSLINE_PATH_LEVELS = ["1", "2", "3", "full"];
|
|
25391
|
+
STATUSLINE_USAGE_VALUES = ["used", "remaining"];
|
|
25392
|
+
STATUSLINE_TIME_FORMATS = ["relative", "absolute", "both", "elapsed", "elapsedAndAbsolute"];
|
|
25393
|
+
STATUSLINE_HOUR_CYCLES = ["auto", "h11", "h12", "h23", "h24"];
|
|
25096
25394
|
MAX_PERCENT = 100;
|
|
25097
25395
|
MAX_STATUSLINE_PALETTE_INDEX = 255;
|
|
25098
|
-
|
|
25396
|
+
MAX_STATUSLINE_LABEL_COLUMNS = 12;
|
|
25099
25397
|
MAX_BAR_CELLS = 40;
|
|
25100
25398
|
MAX_ACCOUNT_USER_CHARS = 254;
|
|
25101
25399
|
MAX_DISPLAY_TEXT_CHARS = 80;
|
|
25102
25400
|
LABEL_RE2 = /^[^\p{C}\p{Z}]+(?: [^\p{C}\p{Z}]+)*$/u;
|
|
25103
25401
|
OPTIONAL_LABEL_RE = /^(?:[^\p{C}\p{Z}]+(?: [^\p{C}\p{Z}]+)*)?$/u;
|
|
25104
25402
|
colourValue = external_exports.union([external_exports.enum(STATUSLINE_COLOUR_NAMES), external_exports.number().int().min(0).max(MAX_STATUSLINE_PALETTE_INDEX), external_exports.string().regex(/^#[0-9a-fA-F]{6}$/, "must be a colour name, a palette index from 0 to 255 or #rrggbb")]);
|
|
25105
|
-
|
|
25106
|
-
|
|
25107
|
-
labelText = external_exports.string().max(MAX_STATUSLINE_LABEL_CHARS).regex(LABEL_RE2, "must be visible text without control characters");
|
|
25403
|
+
barCharacter = external_exports.string().refine(isSingleVisibleGrapheme, "must be a single visible character that takes one terminal column");
|
|
25404
|
+
labelText = external_exports.string().refine((text4) => stringWidth(text4) <= MAX_STATUSLINE_LABEL_COLUMNS, `must take no more than ${String(MAX_STATUSLINE_LABEL_COLUMNS)} terminal columns`).refine((text4) => !drawsNothing(text4), "must show something: a label of only combining marks or blank characters draws nothing").regex(LABEL_RE2, "must be visible text without control characters");
|
|
25108
25405
|
overrideText = external_exports.string().max(MAX_DISPLAY_TEXT_CHARS).regex(OPTIONAL_LABEL_RE, "must be visible text without control characters");
|
|
25109
25406
|
wholePercent = external_exports.number().int().min(1).max(MAX_PERCENT);
|
|
25407
|
+
thresholdPercent = external_exports.number().int().min(0).max(MAX_PERCENT);
|
|
25110
25408
|
SHAPES = {
|
|
25111
25409
|
layout: {
|
|
25112
25410
|
header: distinctList(external_exports.enum(STATUSLINE_HEADER_SEGMENTS)).describe("The header segments to draw, in drawing order; a segment left out is hidden, and an empty list hides the header."),
|
|
@@ -25143,6 +25441,20 @@ var init_statusline = __esm({
|
|
|
25143
25441
|
filled: barCharacter.describe("The character that draws the used part of a bar."),
|
|
25144
25442
|
empty: barCharacter.describe("The character that draws the unused part of a bar.")
|
|
25145
25443
|
},
|
|
25444
|
+
usage: {
|
|
25445
|
+
value: external_exports.enum(STATUSLINE_USAGE_VALUES).describe("Whether a quota window's figure is the share of it used or the share left; the bar and the colour always follow the share used."),
|
|
25446
|
+
bar: external_exports.boolean().describe("Whether each quota window is drawn as a bar, or as text alone."),
|
|
25447
|
+
compact: external_exports.boolean().describe("Whether the quota windows are drawn as one short line of text (`5h: 25.0% (1h 30m)`) in place of bars; it takes precedence over usage.bar."),
|
|
25448
|
+
resetLabel: external_exports.boolean().describe("Whether a window's reset time is introduced with `resets in` (`resets` for a wall-clock time), as in `(resets in 1h 30m)`, rather than the bare `(1h 30m)`."),
|
|
25449
|
+
modelScoped: external_exports.boolean().describe("Whether the per-model weekly windows the client reports (rate_limits.model_scoped) are drawn after the account's own windows; they describe the signed-in account, so a session that selected a provider never shows them."),
|
|
25450
|
+
timeFormat: external_exports.enum(STATUSLINE_TIME_FORMATS).describe("How a window's reset is shown: the time left (`1h 30m`), the wall-clock time (`at 14:30`), both, the share of the window already gone (`53% elapsed`), or that share and the wall-clock time. A window whose length is not known shows no share."),
|
|
25451
|
+
threshold: thresholdPercent.describe("The whole percentage of use that at least one quota window must reach for the quota row to be drawn at all; 0 always draws it."),
|
|
25452
|
+
sevenDayThreshold: thresholdPercent.describe("The whole percentage of use at which the weekly window is drawn beside the five-hour one; below it the weekly window is hidden. A weekly window with no five-hour window beside it is always drawn, and 0 always draws it.")
|
|
25453
|
+
},
|
|
25454
|
+
clock: {
|
|
25455
|
+
hourCycle: external_exports.enum(STATUSLINE_HOUR_CYCLES).describe("The hour cycle of a wall-clock time: `auto` follows the system locale, `h23` and `h24` are 24-hour time (`h24` writes midnight as 24:00), and `h12` and `h11` are 12-hour time with am or pm (`h11` writes the hour after midnight as 0)."),
|
|
25456
|
+
seconds: external_exports.boolean().describe("Whether a wall-clock time includes seconds (`14:30:07`).")
|
|
25457
|
+
},
|
|
25146
25458
|
colours: {
|
|
25147
25459
|
context: colourValue.describe("The colour of the context bar and its figures below the warning threshold."),
|
|
25148
25460
|
usage: colourValue.describe("The colour of the quota bars and their figures below the warning threshold."),
|
|
@@ -25185,6 +25497,8 @@ var init_statusline = __esm({
|
|
|
25185
25497
|
bands: external_exports.strictObject(SHAPES.bands).partial().optional(),
|
|
25186
25498
|
labels: external_exports.strictObject(SHAPES.labels).partial().optional(),
|
|
25187
25499
|
bar: external_exports.strictObject(SHAPES.bar).partial().optional(),
|
|
25500
|
+
usage: external_exports.strictObject(SHAPES.usage).partial().optional(),
|
|
25501
|
+
clock: external_exports.strictObject(SHAPES.clock).partial().optional(),
|
|
25188
25502
|
colours: external_exports.strictObject(SHAPES.colours).partial().optional(),
|
|
25189
25503
|
project: external_exports.strictObject(SHAPES.project).partial().optional(),
|
|
25190
25504
|
git: external_exports.strictObject(SHAPES.git).partial().optional(),
|
|
@@ -25200,6 +25514,8 @@ var init_statusline = __esm({
|
|
|
25200
25514
|
bands: external_exports.strictObject(SHAPES.bands),
|
|
25201
25515
|
labels: external_exports.strictObject(SHAPES.labels),
|
|
25202
25516
|
bar: external_exports.strictObject(SHAPES.bar),
|
|
25517
|
+
usage: external_exports.strictObject(SHAPES.usage),
|
|
25518
|
+
clock: external_exports.strictObject(SHAPES.clock),
|
|
25203
25519
|
colours: external_exports.strictObject(SHAPES.colours),
|
|
25204
25520
|
project: external_exports.strictObject(SHAPES.project),
|
|
25205
25521
|
git: external_exports.strictObject(SHAPES.git),
|
|
@@ -25215,6 +25531,8 @@ var init_statusline = __esm({
|
|
|
25215
25531
|
bands: { warnAt: 70, criticalAt: 90 },
|
|
25216
25532
|
labels: { fiveHour: "5h", sevenDay: "Wk" },
|
|
25217
25533
|
bar: { width: 10, filled: "\u2588", empty: "\u2591" },
|
|
25534
|
+
usage: { value: "used", bar: true, compact: false, resetLabel: false, modelScoped: false, timeFormat: "relative", threshold: 0, sevenDayThreshold: 0 },
|
|
25535
|
+
clock: { hourCycle: "auto", seconds: false },
|
|
25218
25536
|
colours: {
|
|
25219
25537
|
context: "green",
|
|
25220
25538
|
usage: "green",
|
|
@@ -29129,6 +29447,7 @@ function realIsProcessAlive(pid) {
|
|
|
29129
29447
|
}
|
|
29130
29448
|
}
|
|
29131
29449
|
function realIsProcessZombie(pid) {
|
|
29450
|
+
refuseToBlockInRole("a synchronous process-table read");
|
|
29132
29451
|
const result = (0, import_node_child_process2.spawnSync)("ps", ["-o", "stat=", "-p", String(pid)], { encoding: "utf8" });
|
|
29133
29452
|
return result.status === 0 && result.stdout.trim().startsWith("Z");
|
|
29134
29453
|
}
|
|
@@ -29136,6 +29455,7 @@ function realIsProcessRunning(pid) {
|
|
|
29136
29455
|
return realIsProcessAlive(pid) && !realIsProcessZombie(pid);
|
|
29137
29456
|
}
|
|
29138
29457
|
function realIsFrontDoorSupervisor(pid) {
|
|
29458
|
+
refuseToBlockInRole("a synchronous process-table read");
|
|
29139
29459
|
const result = (0, import_node_child_process2.spawnSync)("ps", ["-o", "pid=,command=", "-p", String(pid)], { encoding: "utf8" });
|
|
29140
29460
|
return result.status === 0 && parseFrontDoorSupervisorPids(result.stdout).includes(pid);
|
|
29141
29461
|
}
|
|
@@ -29184,15 +29504,39 @@ function realReadFileTail(filePath, fromByte, maxBytes) {
|
|
|
29184
29504
|
}
|
|
29185
29505
|
}
|
|
29186
29506
|
function realProcessCommandLine(pid) {
|
|
29507
|
+
refuseToBlockInRole("a synchronous process-table read");
|
|
29187
29508
|
const result = (0, import_node_child_process2.spawnSync)("ps", ["-o", "command=", "-p", String(pid)], { encoding: "utf8", timeout: PS_TIMEOUT_MS });
|
|
29188
29509
|
return result.status === 0 ? result.stdout.trim() : void 0;
|
|
29189
29510
|
}
|
|
29190
29511
|
function realFrontDoorLiveness(pids) {
|
|
29512
|
+
refuseToBlockInRole("a synchronous process-table read");
|
|
29191
29513
|
return frontDoorLivenessOf(pids, (asked) => {
|
|
29192
29514
|
const result = (0, import_node_child_process2.spawnSync)("ps", ["-o", "pid=,stat=,command=", "-p", asked.map(String).join(",")], { encoding: "utf8", timeout: PS_TIMEOUT_MS });
|
|
29193
29515
|
return { status: result.status, stdout: result.stdout, stderr: result.stderr, ...result.error === void 0 ? {} : { error: result.error } };
|
|
29194
29516
|
});
|
|
29195
29517
|
}
|
|
29518
|
+
async function readProcessStates(pids) {
|
|
29519
|
+
return await new Promise((resolve2) => {
|
|
29520
|
+
(0, import_node_child_process2.execFile)("ps", ["-o", "pid=,stat=", "-p", pids.map(String).join(",")], { encoding: "utf8", timeout: PS_TIMEOUT_MS }, (_error, stdout2) => {
|
|
29521
|
+
const states = /* @__PURE__ */ new Map();
|
|
29522
|
+
for (const line of stdout2.split("\n")) {
|
|
29523
|
+
const [pidText, stat] = line.trim().split(/\s+/);
|
|
29524
|
+
if (stat !== void 0) {
|
|
29525
|
+
states.set(Number(pidText), stat);
|
|
29526
|
+
}
|
|
29527
|
+
}
|
|
29528
|
+
resolve2(states);
|
|
29529
|
+
});
|
|
29530
|
+
});
|
|
29531
|
+
}
|
|
29532
|
+
async function realRunningAmong(pids) {
|
|
29533
|
+
const existing = pids.filter(realIsProcessAlive);
|
|
29534
|
+
if (existing.length === 0) {
|
|
29535
|
+
return /* @__PURE__ */ new Set();
|
|
29536
|
+
}
|
|
29537
|
+
const states = await readProcessStates(existing);
|
|
29538
|
+
return new Set(existing.filter((pid) => states.get(pid)?.startsWith("Z") !== true));
|
|
29539
|
+
}
|
|
29196
29540
|
function expandHome(filePath) {
|
|
29197
29541
|
return filePath.startsWith("~/") ? import_node_path9.default.join(import_node_os2.default.homedir(), filePath.slice(1)) : filePath;
|
|
29198
29542
|
}
|
|
@@ -31632,17 +31976,17 @@ var require_picomatch = __commonJS({
|
|
|
31632
31976
|
}
|
|
31633
31977
|
const opts = options || {};
|
|
31634
31978
|
const posix = opts.windows;
|
|
31635
|
-
const
|
|
31636
|
-
const state =
|
|
31637
|
-
delete
|
|
31979
|
+
const regex2 = isState ? picomatch4.compileRe(glob, options) : picomatch4.makeRe(glob, options, false, true);
|
|
31980
|
+
const state = regex2.state;
|
|
31981
|
+
delete regex2.state;
|
|
31638
31982
|
let isIgnored = () => false;
|
|
31639
31983
|
if (opts.ignore) {
|
|
31640
31984
|
const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
|
|
31641
31985
|
isIgnored = picomatch4(opts.ignore, ignoreOpts, returnState);
|
|
31642
31986
|
}
|
|
31643
31987
|
const matcher = (input2, returnObject = false) => {
|
|
31644
|
-
const { isMatch, match, output: output2 } = picomatch4.test(input2,
|
|
31645
|
-
const result = { glob, state, regex, posix, input: input2, output: output2, match, isMatch };
|
|
31988
|
+
const { isMatch, match, output: output2 } = picomatch4.test(input2, regex2, options, { glob, posix });
|
|
31989
|
+
const result = { glob, state, regex: regex2, posix, input: input2, output: output2, match, isMatch };
|
|
31646
31990
|
if (typeof opts.onResult === "function") {
|
|
31647
31991
|
opts.onResult(result);
|
|
31648
31992
|
}
|
|
@@ -31667,7 +32011,7 @@ var require_picomatch = __commonJS({
|
|
|
31667
32011
|
}
|
|
31668
32012
|
return matcher;
|
|
31669
32013
|
};
|
|
31670
|
-
picomatch4.test = (input2,
|
|
32014
|
+
picomatch4.test = (input2, regex2, options, { glob, posix } = {}) => {
|
|
31671
32015
|
if (typeof input2 !== "string") {
|
|
31672
32016
|
throw new TypeError("Expected input to be a string");
|
|
31673
32017
|
}
|
|
@@ -31684,16 +32028,16 @@ var require_picomatch = __commonJS({
|
|
|
31684
32028
|
}
|
|
31685
32029
|
if (match === false || opts.capture === true) {
|
|
31686
32030
|
if (opts.matchBase === true || opts.basename === true) {
|
|
31687
|
-
match = picomatch4.matchBase(input2,
|
|
32031
|
+
match = picomatch4.matchBase(input2, regex2, options, posix);
|
|
31688
32032
|
} else {
|
|
31689
|
-
match =
|
|
32033
|
+
match = regex2.exec(output2);
|
|
31690
32034
|
}
|
|
31691
32035
|
}
|
|
31692
32036
|
return { isMatch: Boolean(match), match, output: output2 };
|
|
31693
32037
|
};
|
|
31694
32038
|
picomatch4.matchBase = (input2, glob, options, posix = options && options.windows) => {
|
|
31695
|
-
const
|
|
31696
|
-
return
|
|
32039
|
+
const regex2 = glob instanceof RegExp ? glob : picomatch4.makeRe(glob, options);
|
|
32040
|
+
return regex2.test(utils.basename(input2, { windows: posix }));
|
|
31697
32041
|
};
|
|
31698
32042
|
picomatch4.isMatch = (str, patterns, options) => picomatch4(patterns, options)(str);
|
|
31699
32043
|
picomatch4.parse = (pattern, options) => {
|
|
@@ -31712,11 +32056,11 @@ var require_picomatch = __commonJS({
|
|
|
31712
32056
|
if (state && state.negated === true) {
|
|
31713
32057
|
source = `^(?!${source}).*$`;
|
|
31714
32058
|
}
|
|
31715
|
-
const
|
|
32059
|
+
const regex2 = picomatch4.toRegex(source, options);
|
|
31716
32060
|
if (returnState === true) {
|
|
31717
|
-
|
|
32061
|
+
regex2.state = state;
|
|
31718
32062
|
}
|
|
31719
|
-
return
|
|
32063
|
+
return regex2;
|
|
31720
32064
|
};
|
|
31721
32065
|
picomatch4.makeRe = (input2, options = {}, returnOutput = false, returnState = false) => {
|
|
31722
32066
|
if (!input2 || typeof input2 !== "string") {
|
|
@@ -35674,9 +36018,9 @@ async function serveFrontDoor(idleShutdownMinutes, ports, options) {
|
|
|
35674
36018
|
const watchdog = ports.startWatchdog?.();
|
|
35675
36019
|
let idleSince;
|
|
35676
36020
|
let ticks = 0;
|
|
35677
|
-
const supersedingOwner = () => {
|
|
36021
|
+
const supersedingOwner = async () => {
|
|
35678
36022
|
const owner = readFrontDoorState(fs30, paths.frontdoorStateFile)?.supervisorPid;
|
|
35679
|
-
return owner !== void 0 && owner !== ports.ownPid && ports.
|
|
36023
|
+
return owner !== void 0 && owner !== ports.ownPid && (await ports.runningAmong([owner])).has(owner) ? owner : void 0;
|
|
35680
36024
|
};
|
|
35681
36025
|
let supersededBy;
|
|
35682
36026
|
let served;
|
|
@@ -35701,7 +36045,7 @@ async function serveFrontDoor(idleShutdownMinutes, ports, options) {
|
|
|
35701
36045
|
watchdog?.stop();
|
|
35702
36046
|
ports.stopBackgroundWork?.();
|
|
35703
36047
|
const drained = [direct.drain(), connect3.drain(), http9.drain()];
|
|
35704
|
-
if (supersedingOwner() === void 0) {
|
|
36048
|
+
if (await supersedingOwner() === void 0) {
|
|
35705
36049
|
writeFrontDoorState(fs30, paths.frontdoorStateFile, sticky());
|
|
35706
36050
|
}
|
|
35707
36051
|
markFrontDoorDraining(fs30, paths.frontdoorDrainingDir, ports.ownPid);
|
|
@@ -35722,7 +36066,7 @@ async function serveFrontDoor(idleShutdownMinutes, ports, options) {
|
|
|
35722
36066
|
};
|
|
35723
36067
|
const shutdown = async () => {
|
|
35724
36068
|
await closeServing();
|
|
35725
|
-
if (supersedingOwner() === void 0) {
|
|
36069
|
+
if (await supersedingOwner() === void 0) {
|
|
35726
36070
|
writeFrontDoorState(fs30, paths.frontdoorStateFile, sticky());
|
|
35727
36071
|
}
|
|
35728
36072
|
return 0;
|
|
@@ -35738,13 +36082,14 @@ async function serveFrontDoor(idleShutdownMinutes, ports, options) {
|
|
|
35738
36082
|
}
|
|
35739
36083
|
ticks += 1;
|
|
35740
36084
|
const listed = listFrontDoorSessions(fs30, paths.frontdoorSessionsDir);
|
|
35741
|
-
const
|
|
36085
|
+
const running = await ports.runningAmong(listed.map((session) => session.pid));
|
|
36086
|
+
const pruned = pruneDeadFrontDoorSessions(fs30, paths.frontdoorSessionsDir, (pid) => running.has(pid));
|
|
35742
36087
|
ports.observeLaunchRegistry(listed, pruned);
|
|
35743
36088
|
ports.checkQuotaExpiry();
|
|
35744
36089
|
const prunedPids = new Set(pruned);
|
|
35745
36090
|
const live = listed.filter((session) => !prunedPids.has(session.pid));
|
|
35746
36091
|
if (supersededBy === void 0) {
|
|
35747
|
-
supersededBy = supersedingOwner();
|
|
36092
|
+
supersededBy = await supersedingOwner();
|
|
35748
36093
|
if (supersededBy !== void 0) {
|
|
35749
36094
|
ports.log(`agent-shim frontdoor supervisor ${String(ports.ownPid)}: supervisor ${String(supersededBy)} now owns the front door; taking no new sessions and exiting once the sessions this door serves have ended`);
|
|
35750
36095
|
ports.doorHealth.superseded(supersededBy);
|
|
@@ -36288,7 +36633,7 @@ var init_package = __esm({
|
|
|
36288
36633
|
"package.json"() {
|
|
36289
36634
|
package_default = {
|
|
36290
36635
|
name: "claude-use",
|
|
36291
|
-
version: "11.
|
|
36636
|
+
version: "11.55.0",
|
|
36292
36637
|
description: "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
|
|
36293
36638
|
license: "MIT",
|
|
36294
36639
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -36346,6 +36691,7 @@ var init_package = __esm({
|
|
|
36346
36691
|
commander: "^15.0.0",
|
|
36347
36692
|
cosmiconfig: "^10.0.1",
|
|
36348
36693
|
picomatch: "^4.0.7",
|
|
36694
|
+
"string-width": "8.3.0",
|
|
36349
36695
|
trilean: "1.7.1",
|
|
36350
36696
|
undici: "7.29.1",
|
|
36351
36697
|
zod: "^4.6.1"
|
|
@@ -62195,10 +62541,10 @@ var require_connection = __commonJS({
|
|
|
62195
62541
|
});
|
|
62196
62542
|
return controller;
|
|
62197
62543
|
}
|
|
62198
|
-
function closeWebSocketConnection(object3, code, reason,
|
|
62544
|
+
function closeWebSocketConnection(object3, code, reason, validate3 = false) {
|
|
62199
62545
|
code ??= null;
|
|
62200
62546
|
reason ??= "";
|
|
62201
|
-
if (
|
|
62547
|
+
if (validate3) validateCloseCodeAndReason(code, reason);
|
|
62202
62548
|
if (isClosed(object3.readyState) || isClosing(object3.readyState)) {
|
|
62203
62549
|
} else if (!isEstablished(object3.readyState)) {
|
|
62204
62550
|
failWebsocketConnection(object3);
|
|
@@ -104293,8 +104639,8 @@ var require_keyword = __commonJS({
|
|
|
104293
104639
|
var _a4;
|
|
104294
104640
|
const { gen, keyword, schema, parentSchema, $data, it: it2 } = cxt;
|
|
104295
104641
|
checkAsyncKeyword(it2, def);
|
|
104296
|
-
const
|
|
104297
|
-
const validateRef = useKeyword(gen, keyword,
|
|
104642
|
+
const validate3 = !$data && def.compile ? def.compile.call(it2.self, schema, parentSchema, it2) : def.validate;
|
|
104643
|
+
const validateRef = useKeyword(gen, keyword, validate3);
|
|
104298
104644
|
const valid = gen.let("valid");
|
|
104299
104645
|
cxt.block$data(valid, validateKeyword);
|
|
104300
104646
|
cxt.ok((_a4 = def.valid) !== null && _a4 !== void 0 ? _a4 : valid);
|
|
@@ -105367,28 +105713,28 @@ var require_compile = __commonJS({
|
|
|
105367
105713
|
if (this.opts.code.process)
|
|
105368
105714
|
sourceCode = this.opts.code.process(sourceCode, sch);
|
|
105369
105715
|
const makeValidate = new Function(`${names_1.default.self}`, `${names_1.default.scope}`, sourceCode);
|
|
105370
|
-
const
|
|
105371
|
-
this.scope.value(validateName, { ref:
|
|
105372
|
-
|
|
105373
|
-
|
|
105374
|
-
|
|
105716
|
+
const validate3 = makeValidate(this, this.scope.get());
|
|
105717
|
+
this.scope.value(validateName, { ref: validate3 });
|
|
105718
|
+
validate3.errors = null;
|
|
105719
|
+
validate3.schema = sch.schema;
|
|
105720
|
+
validate3.schemaEnv = sch;
|
|
105375
105721
|
if (sch.$async)
|
|
105376
|
-
|
|
105722
|
+
validate3.$async = true;
|
|
105377
105723
|
if (this.opts.code.source === true) {
|
|
105378
|
-
|
|
105724
|
+
validate3.source = { validateName, validateCode, scopeValues: gen._values };
|
|
105379
105725
|
}
|
|
105380
105726
|
if (this.opts.unevaluated) {
|
|
105381
105727
|
const { props, items } = schemaCxt;
|
|
105382
|
-
|
|
105728
|
+
validate3.evaluated = {
|
|
105383
105729
|
props: props instanceof codegen_1.Name ? void 0 : props,
|
|
105384
105730
|
items: items instanceof codegen_1.Name ? void 0 : items,
|
|
105385
105731
|
dynamicProps: props instanceof codegen_1.Name,
|
|
105386
105732
|
dynamicItems: items instanceof codegen_1.Name
|
|
105387
105733
|
};
|
|
105388
|
-
if (
|
|
105389
|
-
|
|
105734
|
+
if (validate3.source)
|
|
105735
|
+
validate3.source.evaluated = (0, codegen_1.stringify)(validate3.evaluated);
|
|
105390
105736
|
}
|
|
105391
|
-
sch.validate =
|
|
105737
|
+
sch.validate = validate3;
|
|
105392
105738
|
return sch;
|
|
105393
105739
|
} catch (e14) {
|
|
105394
105740
|
delete sch.validate;
|
|
@@ -107070,10 +107416,10 @@ var require_core2 = __commonJS({
|
|
|
107070
107416
|
}
|
|
107071
107417
|
return metaSchema;
|
|
107072
107418
|
}
|
|
107073
|
-
_removeAllSchemas(schemas,
|
|
107419
|
+
_removeAllSchemas(schemas, regex2) {
|
|
107074
107420
|
for (const keyRef in schemas) {
|
|
107075
107421
|
const sch = schemas[keyRef];
|
|
107076
|
-
if (!
|
|
107422
|
+
if (!regex2 || regex2.test(keyRef)) {
|
|
107077
107423
|
if (typeof sch == "string") {
|
|
107078
107424
|
delete schemas[keyRef];
|
|
107079
107425
|
} else if (sch && !sch.meta) {
|
|
@@ -109311,8 +109657,8 @@ var require_formats = __commonJS({
|
|
|
109311
109657
|
"use strict";
|
|
109312
109658
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
109313
109659
|
exports2.formatNames = exports2.fastFormats = exports2.fullFormats = void 0;
|
|
109314
|
-
function fmtDef(
|
|
109315
|
-
return { validate:
|
|
109660
|
+
function fmtDef(validate3, compare) {
|
|
109661
|
+
return { validate: validate3, compare };
|
|
109316
109662
|
}
|
|
109317
109663
|
exports2.fullFormats = {
|
|
109318
109664
|
// date: http://tools.ietf.org/html/rfc3339#section-5.6
|
|
@@ -109336,7 +109682,7 @@ var require_formats = __commonJS({
|
|
|
109336
109682
|
// optimized https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9780596802837/ch07s16.html
|
|
109337
109683
|
ipv4: /^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,
|
|
109338
109684
|
ipv6: /^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,
|
|
109339
|
-
regex,
|
|
109685
|
+
regex: regex2,
|
|
109340
109686
|
// uuid: http://tools.ietf.org/html/rfc4122
|
|
109341
109687
|
uuid: /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,
|
|
109342
109688
|
// JSON-pointer: https://tools.ietf.org/html/rfc6901
|
|
@@ -109495,7 +109841,7 @@ var require_formats = __commonJS({
|
|
|
109495
109841
|
return true;
|
|
109496
109842
|
}
|
|
109497
109843
|
var Z_ANCHOR = /[^\\]\\Z/;
|
|
109498
|
-
function
|
|
109844
|
+
function regex2(str) {
|
|
109499
109845
|
if (Z_ANCHOR.test(str))
|
|
109500
109846
|
return false;
|
|
109501
109847
|
try {
|
|
@@ -111366,9 +111712,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
111366
111712
|
if (typeof fn2 === "function") {
|
|
111367
111713
|
option.default(defaultValue).argParser(fn2);
|
|
111368
111714
|
} else if (fn2 instanceof RegExp) {
|
|
111369
|
-
const
|
|
111715
|
+
const regex2 = fn2;
|
|
111370
111716
|
fn2 = (val, def) => {
|
|
111371
|
-
const m10 =
|
|
111717
|
+
const m10 = regex2.exec(val);
|
|
111372
111718
|
return m10 ? m10[0] : def;
|
|
111373
111719
|
};
|
|
111374
111720
|
option.default(defaultValue).argParser(fn2);
|
|
@@ -113041,7 +113387,7 @@ var getCodePointsLength = /* @__PURE__ */ (() => {
|
|
|
113041
113387
|
return input2.length - surrogatePairsNr;
|
|
113042
113388
|
};
|
|
113043
113389
|
})();
|
|
113044
|
-
var
|
|
113390
|
+
var isFullWidth2 = (x) => {
|
|
113045
113391
|
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
113046
113392
|
};
|
|
113047
113393
|
var isWideNotCJKTNotEmoji = (x) => {
|
|
@@ -113093,7 +113439,7 @@ var getStringTruncatedWidth = (input2, truncationOptions = {}, widthOptions = {}
|
|
|
113093
113439
|
lengthExtra = 0;
|
|
113094
113440
|
for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
|
|
113095
113441
|
const codePoint = char.codePointAt(0) || 0;
|
|
113096
|
-
if (
|
|
113442
|
+
if (isFullWidth2(codePoint)) {
|
|
113097
113443
|
widthExtra = FULL_WIDTH_WIDTH;
|
|
113098
113444
|
} else if (isWideNotCJKTNotEmoji(codePoint)) {
|
|
113099
113445
|
widthExtra = WIDE_WIDTH;
|
|
@@ -121284,7 +121630,7 @@ function runDoctor(params) {
|
|
|
121284
121630
|
const push = (section, severity, message, subject) => {
|
|
121285
121631
|
findings.push({ section, severity, message, ...subject === void 0 ? {} : { subject } });
|
|
121286
121632
|
};
|
|
121287
|
-
const
|
|
121633
|
+
const validate3 = (schema, input2, section, subject) => {
|
|
121288
121634
|
const validated2 = validateJson(schema, input2);
|
|
121289
121635
|
if (validated2.ok && validated2.warning !== void 0) {
|
|
121290
121636
|
push(section, "warn", validated2.warning, subject);
|
|
@@ -121330,7 +121676,7 @@ function runDoctor(params) {
|
|
|
121330
121676
|
pushLegacyName(push, params);
|
|
121331
121677
|
const profileSources = /* @__PURE__ */ new Map();
|
|
121332
121678
|
for (const entry of params.configProfiles) {
|
|
121333
|
-
const validated2 =
|
|
121679
|
+
const validated2 = validate3(ConfigProfileSchema, entry, "config-profile", entry.name);
|
|
121334
121680
|
if (!validated2.ok) {
|
|
121335
121681
|
push("config-profile", "fail", validated2.message, entry.name);
|
|
121336
121682
|
continue;
|
|
@@ -121352,7 +121698,7 @@ function runDoctor(params) {
|
|
|
121352
121698
|
const validProfileNames = new Set(profileSources.keys());
|
|
121353
121699
|
const validIdentityNames = /* @__PURE__ */ new Set();
|
|
121354
121700
|
for (const entry of params.identities) {
|
|
121355
|
-
const validated2 =
|
|
121701
|
+
const validated2 = validate3(IdentitySchema, entry, "identity", entry.name);
|
|
121356
121702
|
if (!validated2.ok) {
|
|
121357
121703
|
push("identity", "fail", validated2.message, entry.name);
|
|
121358
121704
|
continue;
|
|
@@ -121442,7 +121788,7 @@ function runDoctor(params) {
|
|
|
121442
121788
|
if (params.directoryRules.raw === void 0) {
|
|
121443
121789
|
push("directory-rules", "pass", "No directory-rules.json configured.");
|
|
121444
121790
|
} else {
|
|
121445
|
-
const validated2 =
|
|
121791
|
+
const validated2 = validate3(DirectoryRulesSchema, params.directoryRules, "directory-rules");
|
|
121446
121792
|
if (!validated2.ok) {
|
|
121447
121793
|
push("directory-rules", "fail", validated2.message);
|
|
121448
121794
|
} else {
|
|
@@ -121467,7 +121813,7 @@ function runDoctor(params) {
|
|
|
121467
121813
|
if (params.globalConfig.raw === void 0) {
|
|
121468
121814
|
push("global-config", "pass", "No config.json configured.");
|
|
121469
121815
|
} else {
|
|
121470
|
-
const validated2 =
|
|
121816
|
+
const validated2 = validate3(GlobalConfigSchema, params.globalConfig, "global-config");
|
|
121471
121817
|
if (!validated2.ok) {
|
|
121472
121818
|
push("global-config", "fail", validated2.message);
|
|
121473
121819
|
} else {
|
|
@@ -121498,7 +121844,7 @@ function runDoctor(params) {
|
|
|
121498
121844
|
if (params.categoriesLocal.raw === void 0) {
|
|
121499
121845
|
push("categories-local", "pass", "No categories.local.json configured.");
|
|
121500
121846
|
} else {
|
|
121501
|
-
const validated2 =
|
|
121847
|
+
const validated2 = validate3(CategoryClassificationOverlaySchema, params.categoriesLocal, "categories-local");
|
|
121502
121848
|
push(
|
|
121503
121849
|
"categories-local",
|
|
121504
121850
|
validated2.ok ? "pass" : "fail",
|
|
@@ -128992,8 +129338,8 @@ function getParamRegexp(segment, unnamedStart = 0) {
|
|
|
128992
129338
|
_s2 += segment[j10];
|
|
128993
129339
|
}
|
|
128994
129340
|
[_s2, _i2] = replaceSegmentWildcards(_s2, _i2);
|
|
128995
|
-
const
|
|
128996
|
-
return [new RegExp(`^${
|
|
129341
|
+
const regex2 = _s2.replace(/:([\w-]+)(?:\(([^)]*)\))?/g, (_, id2, p) => `(?<${toGroupName(id2)}>${p || "[^/]+"})`).replace(/\((?![?<])/g, () => `(?<${toUnnamedGroupKey(_i2++)}>`).replace(/\uFFFE(.)/g, (_, c10) => /[.*+?^${}()|[\]\\]/.test(c10) ? `\\${c10}` : c10);
|
|
129342
|
+
return [new RegExp(`^${regex2}$`), _i2];
|
|
128997
129343
|
}
|
|
128998
129344
|
function findRoute(ctx, method = "", path68, opts) {
|
|
128999
129345
|
if (opts?.normalize) path68 = normalizePath(path68);
|
|
@@ -130693,13 +131039,8 @@ function rcFanoutOnDoorHub(fanout, hub) {
|
|
|
130693
131039
|
}
|
|
130694
131040
|
|
|
130695
131041
|
// src/frontdoor/quotaExpiringEvents.ts
|
|
131042
|
+
init_pick();
|
|
130696
131043
|
init_schema2();
|
|
130697
|
-
var MS_PER_HOUR5 = 36e5;
|
|
130698
|
-
var MS_PER_DAY4 = 864e5;
|
|
130699
|
-
var FIVE_HOUR_WINDOW_HOURS = 5;
|
|
130700
|
-
var SEVEN_DAY_WINDOW_DAYS = 7;
|
|
130701
|
-
var FIVE_HOUR_WINDOW_MS2 = FIVE_HOUR_WINDOW_HOURS * MS_PER_HOUR5;
|
|
130702
|
-
var SEVEN_DAY_WINDOW_MS2 = SEVEN_DAY_WINDOW_DAYS * MS_PER_DAY4;
|
|
130703
131044
|
var FINAL_SPAN_DENOMINATOR = 30;
|
|
130704
131045
|
var QUOTA_EXPIRING_WINDOW_FRACTION = 1 / FINAL_SPAN_DENOMINATOR;
|
|
130705
131046
|
function createQuotaExpiringPublisher(hub, deps) {
|
|
@@ -130719,11 +131060,11 @@ function createQuotaExpiringPublisher(hub, deps) {
|
|
|
130719
131060
|
const unified = snapshot.providers[provider]?.rateLimit?.unified;
|
|
130720
131061
|
const fiveHour = unified?.fiveHour;
|
|
130721
131062
|
if (fiveHour?.utilization !== void 0 && fiveHour.resetsAt !== void 0) {
|
|
130722
|
-
views.push({ provider, view: { window: "fiveHour", spanMs:
|
|
131063
|
+
views.push({ provider, view: { window: "fiveHour", spanMs: FIVE_HOUR_WINDOW_MS, utilization: fiveHour.utilization, resetsAtMs: Date.parse(fiveHour.resetsAt) } });
|
|
130723
131064
|
}
|
|
130724
131065
|
const sevenDay = unified?.sevenDay;
|
|
130725
131066
|
if (sevenDay?.utilization !== void 0 && sevenDay.resetsAt !== void 0) {
|
|
130726
|
-
views.push({ provider, view: { window: "sevenDay", spanMs:
|
|
131067
|
+
views.push({ provider, view: { window: "sevenDay", spanMs: SEVEN_DAY_WINDOW_MS, utilization: sevenDay.utilization, resetsAtMs: Date.parse(sevenDay.resetsAt) } });
|
|
130727
131068
|
}
|
|
130728
131069
|
}
|
|
130729
131070
|
return views;
|
|
@@ -131540,10 +131881,10 @@ function quotaHeaders(upstream) {
|
|
|
131540
131881
|
var EXHAUSTED_PERCENT = 100;
|
|
131541
131882
|
var FULL_PERCENT = 100;
|
|
131542
131883
|
var MINUTES_PER_HOUR3 = 60;
|
|
131543
|
-
var
|
|
131884
|
+
var FIVE_HOUR_WINDOW_HOURS = 5;
|
|
131544
131885
|
var HOURS_PER_DAY7 = 24;
|
|
131545
131886
|
var DAYS_PER_WEEK3 = 7;
|
|
131546
|
-
var FIVE_HOUR_MINUTES =
|
|
131887
|
+
var FIVE_HOUR_MINUTES = FIVE_HOUR_WINDOW_HOURS * MINUTES_PER_HOUR3;
|
|
131547
131888
|
var SEVEN_DAY_MINUTES = DAYS_PER_WEEK3 * HOURS_PER_DAY7 * MINUTES_PER_HOUR3;
|
|
131548
131889
|
function windowReadings(upstream, exhausted, quotaError) {
|
|
131549
131890
|
let fiveHour;
|
|
@@ -136526,6 +136867,7 @@ function realFrontDoorSupervisorPorts(paths, respawnGeneration, retire, trackTun
|
|
|
136526
136867
|
});
|
|
136527
136868
|
},
|
|
136528
136869
|
isRunning: realIsProcessRunning,
|
|
136870
|
+
runningAmong: realRunningAmong,
|
|
136529
136871
|
// The turnover check's file identity, over the installed entry resolved once at door start: re-resolving per tick would re-run the PATH scan every second and could theoretically flip between two files, while the entry itself is fixed for as long as this door lives. The existence check prefers the agent-shim sibling only when it is really there (see watchedInstallEntry).
|
|
136530
136872
|
statOwnExecutable: realStatOwnExecutable(watchedInstallEntry(realOwnExecutablePath(), (candidate) => import_node_fs21.default.existsSync(candidate))),
|
|
136531
136873
|
startProviderListener: async (preferredPort) => {
|
|
@@ -136800,7 +137142,7 @@ function registerFrontDoorCommand(program2, deps) {
|
|
|
136800
137142
|
exit: deps.exit,
|
|
136801
137143
|
facts: () => ({
|
|
136802
137144
|
tunnels: openTunnels(),
|
|
136803
|
-
liveSessions: listFrontDoorSessions(realFarmFs, paths.frontdoorSessionsDir).filter((session) => session.pid !== ownPid &&
|
|
137145
|
+
liveSessions: listFrontDoorSessions(realFarmFs, paths.frontdoorSessionsDir).filter((session) => session.pid !== ownPid && realIsProcessAlive(session.pid)).length,
|
|
136804
137146
|
protocol: FRONT_DOOR_PROTOCOL,
|
|
136805
137147
|
uptimeSeconds: Math.round(process.uptime())
|
|
136806
137148
|
})
|
|
@@ -137083,7 +137425,7 @@ function enrichStatuslinePayload(params) {
|
|
|
137083
137425
|
plan = candidatePlan;
|
|
137084
137426
|
}
|
|
137085
137427
|
}
|
|
137086
|
-
const providerQuotaWindows = [...scopedState?.quota?.windows ?? []].sort((a10, b) => (a10.periodMs ?? Number.POSITIVE_INFINITY) - (b.periodMs ?? Number.POSITIVE_INFINITY)).map((window) => ({ measures: window.measures, utilization: window.utilization, resetsAt: window.resetsAt }));
|
|
137428
|
+
const providerQuotaWindows = [...scopedState?.quota?.windows ?? []].sort((a10, b) => (a10.periodMs ?? Number.POSITIVE_INFINITY) - (b.periodMs ?? Number.POSITIVE_INFINITY)).map((window) => ({ measures: window.measures, utilization: window.utilization, resetsAt: window.resetsAt, periodMs: window.periodMs }));
|
|
137087
137429
|
const providerBuckets = Object.fromEntries(
|
|
137088
137430
|
(scopedState?.quota?.windows ?? []).map((window) => [
|
|
137089
137431
|
window.measures,
|
|
@@ -137193,9 +137535,11 @@ var import_node_os12 = __toESM(require("node:os"), 1);
|
|
|
137193
137535
|
var RUN_TIMEOUT_MS = 2e3;
|
|
137194
137536
|
var RUN_MAX_BUFFER_BYTES = 1048576;
|
|
137195
137537
|
function realStatuslinePorts(env) {
|
|
137538
|
+
const { locale, timeZone } = Intl.DateTimeFormat().resolvedOptions();
|
|
137196
137539
|
return {
|
|
137197
137540
|
env,
|
|
137198
137541
|
homeDirectory: import_node_os12.default.homedir(),
|
|
137542
|
+
clock: { locale, timeZone },
|
|
137199
137543
|
readText: (path68) => {
|
|
137200
137544
|
try {
|
|
137201
137545
|
return import_node_fs22.default.readFileSync(path68, "utf8");
|
|
@@ -137253,11 +137597,33 @@ function realStatuslinePorts(env) {
|
|
|
137253
137597
|
init_statusline();
|
|
137254
137598
|
|
|
137255
137599
|
// src/statusline/ansi.ts
|
|
137600
|
+
init_string_width();
|
|
137601
|
+
init_graphemes();
|
|
137256
137602
|
var ESCAPE_CHAR_CODE = 27;
|
|
137257
137603
|
var ESCAPE = String.fromCharCode(ESCAPE_CHAR_CODE);
|
|
137258
|
-
var
|
|
137604
|
+
var BELL = "\\u0007";
|
|
137605
|
+
var ESCAPE_SEQUENCE_PATTERN = [`${ESCAPE}\\[[0-?]*[ -/]*[@-~]`, `${ESCAPE}\\][^${BELL}${ESCAPE}]*(?:${BELL}|${ESCAPE}\\\\)?`, `${ESCAPE}[@-Z\\\\-_]`].join("|");
|
|
137606
|
+
var SPLIT_ON_ESCAPES = new RegExp(`(${ESCAPE_SEQUENCE_PATTERN})`);
|
|
137259
137607
|
function visibleLength(text4) {
|
|
137260
|
-
return text4
|
|
137608
|
+
return stringWidth(text4);
|
|
137609
|
+
}
|
|
137610
|
+
function truncateToColumns(text4, columns) {
|
|
137611
|
+
let used = 0;
|
|
137612
|
+
let kept = "";
|
|
137613
|
+
text4.split(SPLIT_ON_ESCAPES).forEach((part, index) => {
|
|
137614
|
+
if (index % 2 === 1) {
|
|
137615
|
+
kept += part;
|
|
137616
|
+
return;
|
|
137617
|
+
}
|
|
137618
|
+
for (const grapheme of graphemesOf(part)) {
|
|
137619
|
+
used += visibleLength(grapheme);
|
|
137620
|
+
if (used > columns) {
|
|
137621
|
+
return;
|
|
137622
|
+
}
|
|
137623
|
+
kept += grapheme;
|
|
137624
|
+
}
|
|
137625
|
+
});
|
|
137626
|
+
return kept;
|
|
137261
137627
|
}
|
|
137262
137628
|
|
|
137263
137629
|
// src/statusline/barGrid.ts
|
|
@@ -137330,13 +137696,8 @@ function layoutBarGrid(groups, maxWidth, separator, baseBarCells) {
|
|
|
137330
137696
|
return renderGrid(layoutFor(1), maxWidth, separator, baseBarCells);
|
|
137331
137697
|
}
|
|
137332
137698
|
|
|
137333
|
-
// src/statusline/graphemes.ts
|
|
137334
|
-
var SEGMENTER = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
137335
|
-
function graphemesOf(text4) {
|
|
137336
|
-
return Array.from(SEGMENTER.segment(text4), (part) => part.segment);
|
|
137337
|
-
}
|
|
137338
|
-
|
|
137339
137699
|
// src/statusline/elements/header/account.ts
|
|
137700
|
+
init_graphemes();
|
|
137340
137701
|
function tierSuffixOf(tier) {
|
|
137341
137702
|
const match = /_(\d+x)$/i.exec(tier ?? "");
|
|
137342
137703
|
return match === null ? void 0 : match[1];
|
|
@@ -137404,15 +137765,29 @@ function accountSegment({ summary, settings: settings2 }) {
|
|
|
137404
137765
|
|
|
137405
137766
|
// src/statusline/sanitise.ts
|
|
137406
137767
|
init_statusline();
|
|
137407
|
-
|
|
137408
|
-
|
|
137409
|
-
var
|
|
137768
|
+
init_blank();
|
|
137769
|
+
init_graphemes();
|
|
137770
|
+
var ESCAPE_SEQUENCES = new RegExp(ESCAPE_SEQUENCE_PATTERN, "g");
|
|
137771
|
+
var CONTROL_AND_BIDI = /[\p{Cc}\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069\u206a-\u206f]/gu;
|
|
137410
137772
|
function sanitiseDisplayText(text4) {
|
|
137411
137773
|
return text4.replace(ESCAPE_SEQUENCES, "").replace(CONTROL_AND_BIDI, "");
|
|
137412
137774
|
}
|
|
137413
137775
|
function boundedDisplayText(text4) {
|
|
137414
137776
|
return graphemesOf(sanitiseDisplayText(text4).trim()).slice(0, MAX_DISPLAY_TEXT_CHARS).join("").trim();
|
|
137415
137777
|
}
|
|
137778
|
+
var TAG_SEQUENCE2 = "\\u{1F3F4}[\\u{E0020}-\\u{E007E}]+\\u{E007F}";
|
|
137779
|
+
var INVISIBLE_FORMAT = new RegExp(`(${TAG_SEQUENCE2})|(?![\\u200C\\u200D])\\p{Cf}`, "gu");
|
|
137780
|
+
var LINE_SEPARATORS = /[\u2028\u2029]/gu;
|
|
137781
|
+
var HANGUL_JAMO = "\\u1100-\\u115E\\u1161-\\u11FF\\uA960-\\uA97F\\uD7B0-\\uD7FF";
|
|
137782
|
+
var STANDALONE_HANGUL_FILLER = new RegExp(`(?<![${HANGUL_JAMO}])[\\u115F\\u1160](?![${HANGUL_JAMO}])`, "gu");
|
|
137783
|
+
function visibleDisplayText(text4) {
|
|
137784
|
+
const cleaned = sanitiseDisplayText(text4).replace(LINE_SEPARATORS, "").replace(BLANK_CELLS, " ").replace(STANDALONE_HANGUL_FILLER, " ").replace(INVISIBLE_FORMAT, (_match, tagSequence) => tagSequence ?? "");
|
|
137785
|
+
return graphemesOf(cleaned).map((grapheme) => {
|
|
137786
|
+
const body = grapheme.replace(/^ /u, "");
|
|
137787
|
+
const space = body === grapheme ? "" : " ";
|
|
137788
|
+
return drawsNothing(body) ? space : grapheme;
|
|
137789
|
+
}).join("").trim();
|
|
137790
|
+
}
|
|
137416
137791
|
|
|
137417
137792
|
// src/statusline/elements/header/advisor.ts
|
|
137418
137793
|
var MODEL_ID = /^(?:claude-)?(?:(\d{1,2})(?:-(\d{1,2}))?-)?(opus|sonnet|haiku)(?:-(\d{1,2})(?:-(\d{1,2}))?)?(?:-\d{8})?$/i;
|
|
@@ -137560,6 +137935,9 @@ function formatDuration(seconds) {
|
|
|
137560
137935
|
if (seconds === void 0 || seconds <= 0) {
|
|
137561
137936
|
return "available";
|
|
137562
137937
|
}
|
|
137938
|
+
if (seconds < SECONDS_PER_MINUTE2) {
|
|
137939
|
+
return `${String(seconds)}s`;
|
|
137940
|
+
}
|
|
137563
137941
|
const days = Math.floor(seconds / SECONDS_PER_DAY);
|
|
137564
137942
|
const hours = Math.floor(seconds % SECONDS_PER_DAY / (MINUTES_PER_HOUR4 * SECONDS_PER_MINUTE2));
|
|
137565
137943
|
const minutes = Math.floor(seconds % (MINUTES_PER_HOUR4 * SECONDS_PER_MINUTE2) / SECONDS_PER_MINUTE2);
|
|
@@ -138118,56 +138496,11 @@ function gitFilesRow(context) {
|
|
|
138118
138496
|
}
|
|
138119
138497
|
|
|
138120
138498
|
// src/statusline/elements/rows/quota.ts
|
|
138121
|
-
|
|
138122
|
-
|
|
138123
|
-
const style = barStyleOf(context, "usage");
|
|
138124
|
-
const cells = [];
|
|
138125
|
-
const drawWindow = (label2, fraction, resetsAt) => {
|
|
138126
|
-
const clamped = Math.max(0, Math.min(1, fraction));
|
|
138127
|
-
const color = statusColor(clamped, true, style);
|
|
138128
|
-
cells.push(barCell(palette.paint("label", `${label2} `), ` ${withColor(color, `${(fraction * FULL_PERCENT3).toFixed(1)}%`)} (${formatDuration(secondsUntil(resetsAt, nowMs))})`, clamped, style));
|
|
138129
|
-
};
|
|
138130
|
-
if (summary.quotaFamilies.length > 0) {
|
|
138131
|
-
for (const window of summary.quotaFamilies) {
|
|
138132
|
-
drawWindow(window.measures, window.utilization, window.resetsAt);
|
|
138133
|
-
}
|
|
138134
|
-
} else {
|
|
138135
|
-
if (summary.fiveHourUsed !== void 0) {
|
|
138136
|
-
drawWindow(settings2.labels.fiveHour, summary.fiveHourUsed / FULL_PERCENT3, summary.fiveHourResetAt);
|
|
138137
|
-
}
|
|
138138
|
-
if (summary.sevenDayUsed !== void 0) {
|
|
138139
|
-
drawWindow(settings2.labels.sevenDay, summary.sevenDayUsed / FULL_PERCENT3, summary.sevenDayResetAt);
|
|
138140
|
-
}
|
|
138141
|
-
if (summary.fiveHourUsed === void 0 && summary.sevenDayUsed === void 0) {
|
|
138142
|
-
for (const window of summary.providerQuotaWindows) {
|
|
138143
|
-
drawWindow(window.measures, window.utilization, window.resetsAt);
|
|
138144
|
-
}
|
|
138145
|
-
}
|
|
138146
|
-
}
|
|
138147
|
-
return { kind: "bars", cells };
|
|
138148
|
-
}
|
|
138149
|
-
|
|
138150
|
-
// src/statusline/elements/registry.ts
|
|
138151
|
-
var HEADER_ROLES = {
|
|
138152
|
-
model: "model",
|
|
138153
|
-
provider: "model",
|
|
138154
|
-
route: "label",
|
|
138155
|
-
account: "label",
|
|
138156
|
-
identity: "label",
|
|
138157
|
-
headroom: "label",
|
|
138158
|
-
project: "project",
|
|
138159
|
-
vcs: "git",
|
|
138160
|
-
effort: "model",
|
|
138161
|
-
advisor: "label",
|
|
138162
|
-
version: "label",
|
|
138163
|
-
outputStyle: "label"
|
|
138164
|
-
};
|
|
138165
|
-
var ELEMENTS = {
|
|
138166
|
-
header: { model: modelSegment, provider: providerSegment, route: routeSegment, account: accountSegment, identity: identitySegment, headroom: headroomSegment, project: projectSegment, vcs: vcsSegment, effort: effortSegment, advisor: advisorSegment, version: versionSegment, outputStyle: outputStyleSegment },
|
|
138167
|
-
rows: { context: contextRow, quota: quotaRow, addedDirs: addedDirsRow, gitFiles: gitFilesRow }
|
|
138168
|
-
};
|
|
138499
|
+
init_statusline();
|
|
138500
|
+
init_pick();
|
|
138169
138501
|
|
|
138170
138502
|
// src/statusline/headerLayout.ts
|
|
138503
|
+
var SEPARATOR2 = " | ";
|
|
138171
138504
|
function headerUnits(parts, overflow) {
|
|
138172
138505
|
const units = [];
|
|
138173
138506
|
parts.forEach((part, index) => {
|
|
@@ -138207,7 +138540,7 @@ function justify(texts, maxWidth, separator) {
|
|
|
138207
138540
|
});
|
|
138208
138541
|
return parts.join("");
|
|
138209
138542
|
}
|
|
138210
|
-
function
|
|
138543
|
+
function packLines(texts, maxWidth, separator) {
|
|
138211
138544
|
const separatorLength = visibleLength(separator);
|
|
138212
138545
|
const lines = [];
|
|
138213
138546
|
let current = [];
|
|
@@ -138227,9 +138560,176 @@ function layoutHeader(texts, maxWidth, separator) {
|
|
|
138227
138560
|
if (current.length > 0) {
|
|
138228
138561
|
lines.push(current);
|
|
138229
138562
|
}
|
|
138230
|
-
return lines
|
|
138563
|
+
return lines;
|
|
138564
|
+
}
|
|
138565
|
+
function layoutHeader(texts, maxWidth, separator) {
|
|
138566
|
+
return packLines(texts, maxWidth, separator).map((line) => justify(line, maxWidth, separator)).join("\n");
|
|
138567
|
+
}
|
|
138568
|
+
|
|
138569
|
+
// src/statusline/wallClock.ts
|
|
138570
|
+
var DAY_KEY_LOCALE = "en-CA";
|
|
138571
|
+
var FORMATTERS = /* @__PURE__ */ new Map();
|
|
138572
|
+
function formatterFor(locale, options) {
|
|
138573
|
+
const key = JSON.stringify([locale, options]);
|
|
138574
|
+
let formatter = FORMATTERS.get(key);
|
|
138575
|
+
if (formatter === void 0) {
|
|
138576
|
+
formatter = new Intl.DateTimeFormat(locale, options);
|
|
138577
|
+
FORMATTERS.set(key, formatter);
|
|
138578
|
+
}
|
|
138579
|
+
return formatter;
|
|
138580
|
+
}
|
|
138581
|
+
function formatWallClock(atMs, nowMs, clock, settings2) {
|
|
138582
|
+
const { locale, timeZone } = clock;
|
|
138583
|
+
const time4 = formatterFor(locale, {
|
|
138584
|
+
timeZone,
|
|
138585
|
+
timeStyle: settings2.seconds ? "medium" : "short",
|
|
138586
|
+
...settings2.hourCycle === "auto" ? {} : { hourCycle: settings2.hourCycle }
|
|
138587
|
+
}).format(atMs);
|
|
138588
|
+
const dayKey = formatterFor(DAY_KEY_LOCALE, { timeZone, year: "numeric", month: "numeric", day: "numeric" });
|
|
138589
|
+
if (dayKey.format(atMs) === dayKey.format(nowMs)) {
|
|
138590
|
+
return time4;
|
|
138591
|
+
}
|
|
138592
|
+
return `${formatterFor(locale, { timeZone, month: "short", day: "numeric" }).format(atMs)} ${time4}`;
|
|
138593
|
+
}
|
|
138594
|
+
|
|
138595
|
+
// src/statusline/resetTime.ts
|
|
138596
|
+
var AVAILABLE = formatDuration(void 0);
|
|
138597
|
+
function elapsedPercent(resetMs, periodMs, nowMs) {
|
|
138598
|
+
if (!Number.isFinite(resetMs) || periodMs === void 0) {
|
|
138599
|
+
return void 0;
|
|
138600
|
+
}
|
|
138601
|
+
const share = (nowMs - (resetMs - periodMs)) / periodMs * FULL_PERCENT3;
|
|
138602
|
+
return Math.max(0, Math.min(FULL_PERCENT3, Math.round(share)));
|
|
138603
|
+
}
|
|
138604
|
+
function formatResetTime(window, nowMs, settings2, clock) {
|
|
138605
|
+
const resetMs = window.resetsAt === void 0 ? Number.NaN : Date.parse(window.resetsAt);
|
|
138606
|
+
const secondsLeft = secondsUntil(window.resetsAt, nowMs);
|
|
138607
|
+
const pending = secondsLeft !== void 0 && secondsLeft > 0;
|
|
138608
|
+
const relative = formatDuration(secondsLeft);
|
|
138609
|
+
const absolute = pending ? `at ${formatWallClock(resetMs, nowMs, clock, settings2.clock)}` : AVAILABLE;
|
|
138610
|
+
const elapsed = elapsedPercent(resetMs, window.periodMs, nowMs);
|
|
138611
|
+
const elapsedText = elapsed === void 0 ? void 0 : `${String(elapsed)}% elapsed`;
|
|
138612
|
+
switch (settings2.usage.timeFormat) {
|
|
138613
|
+
case "relative":
|
|
138614
|
+
return { text: relative, pending };
|
|
138615
|
+
case "absolute":
|
|
138616
|
+
return { text: absolute, pending };
|
|
138617
|
+
case "both":
|
|
138618
|
+
return { text: pending ? `${relative}, ${absolute}` : AVAILABLE, pending };
|
|
138619
|
+
case "elapsed":
|
|
138620
|
+
return { text: elapsedText ?? "", pending };
|
|
138621
|
+
case "elapsedAndAbsolute":
|
|
138622
|
+
return { text: [elapsedText, pending ? absolute : void 0].filter((part) => part !== void 0).join(", "), pending };
|
|
138623
|
+
default:
|
|
138624
|
+
return settings2.usage.timeFormat;
|
|
138625
|
+
}
|
|
138626
|
+
}
|
|
138627
|
+
|
|
138628
|
+
// src/statusline/elements/rows/quota.ts
|
|
138629
|
+
function safeLabel(label2) {
|
|
138630
|
+
return truncateToColumns(visibleDisplayText(label2), MAX_STATUSLINE_LABEL_COLUMNS).trim();
|
|
138631
|
+
}
|
|
138632
|
+
function modelScopedWindows({ payload }) {
|
|
138633
|
+
return (payload.rate_limits?.model_scoped ?? []).flatMap((window) => {
|
|
138634
|
+
const label2 = safeLabel(window.display_name ?? "");
|
|
138635
|
+
if (label2 === "" || window.utilization === void 0 || !Number.isFinite(window.utilization)) {
|
|
138636
|
+
return [];
|
|
138637
|
+
}
|
|
138638
|
+
return [{ label: label2, fraction: window.utilization / FULL_PERCENT3, resetsAt: window.resets_at, periodMs: SEVEN_DAY_WINDOW_MS, weekly: false }];
|
|
138639
|
+
});
|
|
138640
|
+
}
|
|
138641
|
+
function candidateWindows(context) {
|
|
138642
|
+
const { summary, settings: settings2 } = context;
|
|
138643
|
+
if (summary.quotaFamilies.length > 0) {
|
|
138644
|
+
return summary.quotaFamilies.map((window) => ({ label: window.measures, fraction: window.utilization, resetsAt: window.resetsAt, periodMs: void 0, weekly: false }));
|
|
138645
|
+
}
|
|
138646
|
+
const windows = [];
|
|
138647
|
+
if (summary.fiveHourUsed !== void 0) {
|
|
138648
|
+
windows.push({ label: settings2.labels.fiveHour, fraction: summary.fiveHourUsed / FULL_PERCENT3, resetsAt: summary.fiveHourResetAt, periodMs: FIVE_HOUR_WINDOW_MS, weekly: false });
|
|
138649
|
+
}
|
|
138650
|
+
if (summary.sevenDayUsed !== void 0) {
|
|
138651
|
+
windows.push({ label: settings2.labels.sevenDay, fraction: summary.sevenDayUsed / FULL_PERCENT3, resetsAt: summary.sevenDayResetAt, periodMs: SEVEN_DAY_WINDOW_MS, weekly: true });
|
|
138652
|
+
}
|
|
138653
|
+
if (summary.fiveHourUsed === void 0 && summary.sevenDayUsed === void 0) {
|
|
138654
|
+
windows.push(...summary.providerQuotaWindows.map((window) => ({ label: window.measures, fraction: window.utilization, resetsAt: window.resetsAt, periodMs: window.periodMs, weekly: false })));
|
|
138655
|
+
}
|
|
138656
|
+
if (settings2.usage.modelScoped && summary.provider === void 0) {
|
|
138657
|
+
windows.push(...modelScopedWindows(context));
|
|
138658
|
+
}
|
|
138659
|
+
return windows;
|
|
138660
|
+
}
|
|
138661
|
+
function visibleWindows(context) {
|
|
138662
|
+
const { summary, settings: settings2 } = context;
|
|
138663
|
+
const candidates = candidateWindows(context);
|
|
138664
|
+
const mostUsed = Math.max(0, ...candidates.map((window) => window.fraction * FULL_PERCENT3));
|
|
138665
|
+
if (mostUsed < settings2.usage.threshold) {
|
|
138666
|
+
return [];
|
|
138667
|
+
}
|
|
138668
|
+
const hidesWeekly = summary.fiveHourUsed !== void 0 && summary.sevenDayUsed !== void 0 && summary.sevenDayUsed < settings2.usage.sevenDayThreshold;
|
|
138669
|
+
return hidesWeekly ? candidates.filter((window) => !window.weekly) : candidates;
|
|
138670
|
+
}
|
|
138671
|
+
function figuresOf(window, context, style) {
|
|
138672
|
+
const { settings: settings2, nowMs, ports } = context;
|
|
138673
|
+
const clamped = Math.max(0, Math.min(1, window.fraction));
|
|
138674
|
+
const used = window.fraction * FULL_PERCENT3;
|
|
138675
|
+
const shown = settings2.usage.value === "remaining" ? Math.max(0, FULL_PERCENT3 - used) : used;
|
|
138676
|
+
const { text: text4, pending } = formatResetTime(window, nowMs, settings2, ports.clock);
|
|
138677
|
+
return { value: withColor(statusColor(clamped, true, style), `${shown.toFixed(1)}%`), reset: text4, pending };
|
|
138678
|
+
}
|
|
138679
|
+
function resetSuffix(reset, pending, context) {
|
|
138680
|
+
if (reset === "") {
|
|
138681
|
+
return "";
|
|
138682
|
+
}
|
|
138683
|
+
const { usage } = context.settings;
|
|
138684
|
+
const elapsedForm = usage.timeFormat === "elapsed" || usage.timeFormat === "elapsedAndAbsolute";
|
|
138685
|
+
if (!usage.resetLabel || !pending || elapsedForm) {
|
|
138686
|
+
return `(${reset})`;
|
|
138687
|
+
}
|
|
138688
|
+
return `(${usage.timeFormat === "absolute" ? "resets" : "resets in"} ${reset})`;
|
|
138689
|
+
}
|
|
138690
|
+
function wrapped(windows, width) {
|
|
138691
|
+
return packLines(windows, width, SEPARATOR2).map((line) => line.join(SEPARATOR2));
|
|
138692
|
+
}
|
|
138693
|
+
function quotaRow(context) {
|
|
138694
|
+
const { palette, settings: settings2 } = context;
|
|
138695
|
+
const style = barStyleOf(context, "usage");
|
|
138696
|
+
const windows = visibleWindows(context);
|
|
138697
|
+
const parts = windows.map((window) => {
|
|
138698
|
+
const { value: value2, reset, pending } = figuresOf(window, context, style);
|
|
138699
|
+
return { window, value: value2, reset, suffix: resetSuffix(reset, pending, context) };
|
|
138700
|
+
});
|
|
138701
|
+
if (settings2.usage.compact) {
|
|
138702
|
+
const lines = parts.map(({ window, value: value2, reset }) => `${palette.paint("label", `${window.label}:`)} ${value2}${reset === "" ? "" : ` ${palette.paint("label", `(${reset})`)}`}`);
|
|
138703
|
+
return { kind: "text", lines: wrapped(lines, context.width) };
|
|
138704
|
+
}
|
|
138705
|
+
if (!settings2.usage.bar) {
|
|
138706
|
+
const lines = parts.map(({ window, value: value2, suffix }) => `${palette.paint("label", `${window.label} `)}${value2}${suffix === "" ? "" : ` ${suffix}`}`);
|
|
138707
|
+
return { kind: "text", lines: wrapped(lines, context.width) };
|
|
138708
|
+
}
|
|
138709
|
+
const cells = parts.map(({ window, value: value2, suffix }) => barCell(palette.paint("label", `${window.label} `), ` ${value2}${suffix === "" ? "" : ` ${suffix}`}`, Math.max(0, Math.min(1, window.fraction)), style));
|
|
138710
|
+
return { kind: "bars", cells };
|
|
138231
138711
|
}
|
|
138232
138712
|
|
|
138713
|
+
// src/statusline/elements/registry.ts
|
|
138714
|
+
var HEADER_ROLES = {
|
|
138715
|
+
model: "model",
|
|
138716
|
+
provider: "model",
|
|
138717
|
+
route: "label",
|
|
138718
|
+
account: "label",
|
|
138719
|
+
identity: "label",
|
|
138720
|
+
headroom: "label",
|
|
138721
|
+
project: "project",
|
|
138722
|
+
vcs: "git",
|
|
138723
|
+
effort: "model",
|
|
138724
|
+
advisor: "label",
|
|
138725
|
+
version: "label",
|
|
138726
|
+
outputStyle: "label"
|
|
138727
|
+
};
|
|
138728
|
+
var ELEMENTS = {
|
|
138729
|
+
header: { model: modelSegment, provider: providerSegment, route: routeSegment, account: accountSegment, identity: identitySegment, headroom: headroomSegment, project: projectSegment, vcs: vcsSegment, effort: effortSegment, advisor: advisorSegment, version: versionSegment, outputStyle: outputStyleSegment },
|
|
138730
|
+
rows: { context: contextRow, quota: quotaRow, addedDirs: addedDirsRow, gitFiles: gitFilesRow }
|
|
138731
|
+
};
|
|
138732
|
+
|
|
138233
138733
|
// src/statusline/identityTranscript.ts
|
|
138234
138734
|
init_zod();
|
|
138235
138735
|
var TRANSCRIPT_CHUNK_BYTES = 65536;
|
|
@@ -138322,7 +138822,6 @@ function readTranscriptIdentity(ports, transcriptPath) {
|
|
|
138322
138822
|
|
|
138323
138823
|
// src/statusline/render.ts
|
|
138324
138824
|
var RESERVED_COLUMNS = 4;
|
|
138325
|
-
var SEPARATOR2 = " | ";
|
|
138326
138825
|
function once2(read) {
|
|
138327
138826
|
let kept;
|
|
138328
138827
|
return () => {
|
|
@@ -138332,12 +138831,14 @@ function once2(read) {
|
|
|
138332
138831
|
}
|
|
138333
138832
|
function renderStatuslineBlock(input2) {
|
|
138334
138833
|
const { terminalWidth, settings: settings2 = STATUSLINE_DEFAULTS, elements = ELEMENTS } = input2;
|
|
138834
|
+
const width = Math.max(TWENTY, terminalWidth - RESERVED_COLUMNS);
|
|
138335
138835
|
const context = {
|
|
138336
138836
|
summary: input2.summary,
|
|
138337
138837
|
view: input2.view,
|
|
138338
138838
|
payload: input2.payload,
|
|
138339
138839
|
nowMs: input2.nowMs,
|
|
138340
138840
|
terminalWidth,
|
|
138841
|
+
width,
|
|
138341
138842
|
settings: settings2,
|
|
138342
138843
|
palette: createPalette(settings2.colours, colourEnabled(input2.ports.env)),
|
|
138343
138844
|
ports: input2.ports,
|
|
@@ -138348,7 +138849,6 @@ function renderStatuslineBlock(input2) {
|
|
|
138348
138849
|
return text4 === void 0 ? [] : { name, text: context.palette.paint(HEADER_ROLES[name], text4) };
|
|
138349
138850
|
});
|
|
138350
138851
|
const header = headerUnits(parts, settings2.git.branchOverflow);
|
|
138351
|
-
const width = Math.max(TWENTY, terminalWidth - RESERVED_COLUMNS);
|
|
138352
138852
|
const lines = [];
|
|
138353
138853
|
if (header.length > 0) {
|
|
138354
138854
|
lines.push(layoutHeader(header, width, SEPARATOR2));
|
|
@@ -141015,13 +141515,13 @@ function timeRegex(args) {
|
|
|
141015
141515
|
return new RegExp(`^${timeRegexSource(args)}$`);
|
|
141016
141516
|
}
|
|
141017
141517
|
function datetimeRegex(args) {
|
|
141018
|
-
let
|
|
141518
|
+
let regex2 = `${dateRegexSource}T${timeRegexSource(args)}`;
|
|
141019
141519
|
const opts = [];
|
|
141020
141520
|
opts.push(args.local ? `Z?` : `Z`);
|
|
141021
141521
|
if (args.offset)
|
|
141022
141522
|
opts.push(`([+-]\\d{2}:?\\d{2})`);
|
|
141023
|
-
|
|
141024
|
-
return new RegExp(`^${
|
|
141523
|
+
regex2 = `${regex2}(${opts.join("|")})`;
|
|
141524
|
+
return new RegExp(`^${regex2}$`);
|
|
141025
141525
|
}
|
|
141026
141526
|
function isValidIP(ip2, version2) {
|
|
141027
141527
|
if ((version2 === "v4" || !version2) && ipv4Regex.test(ip2)) {
|
|
@@ -141267,8 +141767,8 @@ var ZodString2 = class _ZodString2 extends ZodType2 {
|
|
|
141267
141767
|
status.dirty();
|
|
141268
141768
|
}
|
|
141269
141769
|
} else if (check2.kind === "datetime") {
|
|
141270
|
-
const
|
|
141271
|
-
if (!
|
|
141770
|
+
const regex2 = datetimeRegex(check2);
|
|
141771
|
+
if (!regex2.test(input2.data)) {
|
|
141272
141772
|
ctx = this._getOrReturnCtx(input2, ctx);
|
|
141273
141773
|
addIssueToContext(ctx, {
|
|
141274
141774
|
code: ZodIssueCode2.invalid_string,
|
|
@@ -141278,8 +141778,8 @@ var ZodString2 = class _ZodString2 extends ZodType2 {
|
|
|
141278
141778
|
status.dirty();
|
|
141279
141779
|
}
|
|
141280
141780
|
} else if (check2.kind === "date") {
|
|
141281
|
-
const
|
|
141282
|
-
if (!
|
|
141781
|
+
const regex2 = dateRegex;
|
|
141782
|
+
if (!regex2.test(input2.data)) {
|
|
141283
141783
|
ctx = this._getOrReturnCtx(input2, ctx);
|
|
141284
141784
|
addIssueToContext(ctx, {
|
|
141285
141785
|
code: ZodIssueCode2.invalid_string,
|
|
@@ -141289,8 +141789,8 @@ var ZodString2 = class _ZodString2 extends ZodType2 {
|
|
|
141289
141789
|
status.dirty();
|
|
141290
141790
|
}
|
|
141291
141791
|
} else if (check2.kind === "time") {
|
|
141292
|
-
const
|
|
141293
|
-
if (!
|
|
141792
|
+
const regex2 = timeRegex(check2);
|
|
141793
|
+
if (!regex2.test(input2.data)) {
|
|
141294
141794
|
ctx = this._getOrReturnCtx(input2, ctx);
|
|
141295
141795
|
addIssueToContext(ctx, {
|
|
141296
141796
|
code: ZodIssueCode2.invalid_string,
|
|
@@ -141365,8 +141865,8 @@ var ZodString2 = class _ZodString2 extends ZodType2 {
|
|
|
141365
141865
|
}
|
|
141366
141866
|
return { status: status.value, value: input2.data };
|
|
141367
141867
|
}
|
|
141368
|
-
_regex(
|
|
141369
|
-
return this.refinement((data) =>
|
|
141868
|
+
_regex(regex2, validation, message) {
|
|
141869
|
+
return this.refinement((data) => regex2.test(data), {
|
|
141370
141870
|
validation,
|
|
141371
141871
|
code: ZodIssueCode2.invalid_string,
|
|
141372
141872
|
...errorUtil.errToObj(message)
|
|
@@ -141458,10 +141958,10 @@ var ZodString2 = class _ZodString2 extends ZodType2 {
|
|
|
141458
141958
|
duration(message) {
|
|
141459
141959
|
return this._addCheck({ kind: "duration", ...errorUtil.errToObj(message) });
|
|
141460
141960
|
}
|
|
141461
|
-
regex(
|
|
141961
|
+
regex(regex2, message) {
|
|
141462
141962
|
return this._addCheck({
|
|
141463
141963
|
kind: "regex",
|
|
141464
|
-
regex,
|
|
141964
|
+
regex: regex2,
|
|
141465
141965
|
...errorUtil.errToObj(message)
|
|
141466
141966
|
});
|
|
141467
141967
|
}
|
|
@@ -144835,7 +145335,7 @@ function addFormat(schema, value2, message, refs) {
|
|
|
144835
145335
|
setResponseValueAndErrors(schema, "format", value2, message, refs);
|
|
144836
145336
|
}
|
|
144837
145337
|
}
|
|
144838
|
-
function addPattern2(schema,
|
|
145338
|
+
function addPattern2(schema, regex2, message, refs) {
|
|
144839
145339
|
if (schema.pattern || schema.allOf?.some((x) => x.pattern)) {
|
|
144840
145340
|
if (!schema.allOf) {
|
|
144841
145341
|
schema.allOf = [];
|
|
@@ -144856,24 +145356,24 @@ function addPattern2(schema, regex, message, refs) {
|
|
|
144856
145356
|
}
|
|
144857
145357
|
}
|
|
144858
145358
|
schema.allOf.push({
|
|
144859
|
-
pattern: stringifyRegExpWithFlags(
|
|
145359
|
+
pattern: stringifyRegExpWithFlags(regex2, refs),
|
|
144860
145360
|
...message && refs.errorMessages && { errorMessage: { pattern: message } }
|
|
144861
145361
|
});
|
|
144862
145362
|
} else {
|
|
144863
|
-
setResponseValueAndErrors(schema, "pattern", stringifyRegExpWithFlags(
|
|
145363
|
+
setResponseValueAndErrors(schema, "pattern", stringifyRegExpWithFlags(regex2, refs), message, refs);
|
|
144864
145364
|
}
|
|
144865
145365
|
}
|
|
144866
|
-
function stringifyRegExpWithFlags(
|
|
144867
|
-
if (!refs.applyRegexFlags || !
|
|
144868
|
-
return
|
|
145366
|
+
function stringifyRegExpWithFlags(regex2, refs) {
|
|
145367
|
+
if (!refs.applyRegexFlags || !regex2.flags) {
|
|
145368
|
+
return regex2.source;
|
|
144869
145369
|
}
|
|
144870
145370
|
const flags = {
|
|
144871
|
-
i:
|
|
144872
|
-
m:
|
|
144873
|
-
s:
|
|
145371
|
+
i: regex2.flags.includes("i"),
|
|
145372
|
+
m: regex2.flags.includes("m"),
|
|
145373
|
+
s: regex2.flags.includes("s")
|
|
144874
145374
|
// `.` matches newlines
|
|
144875
145375
|
};
|
|
144876
|
-
const source = flags.i ?
|
|
145376
|
+
const source = flags.i ? regex2.source.toLowerCase() : regex2.source;
|
|
144877
145377
|
let pattern = "";
|
|
144878
145378
|
let isEscaped = false;
|
|
144879
145379
|
let inCharGroup = false;
|
|
@@ -144934,7 +145434,7 @@ function stringifyRegExpWithFlags(regex, refs) {
|
|
|
144934
145434
|
new RegExp(pattern);
|
|
144935
145435
|
} catch {
|
|
144936
145436
|
console.warn(`Could not convert regex pattern at ${refs.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`);
|
|
144937
|
-
return
|
|
145437
|
+
return regex2.source;
|
|
144938
145438
|
}
|
|
144939
145439
|
return pattern;
|
|
144940
145440
|
}
|