claude-use 11.54.1 → 11.56.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 +889 -219
- package/dist/index.cjs +129 -53
- package/dist/index.mjs +130 -54
- package/dist/types/index.d.ts +667 -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",
|
|
@@ -29227,11 +29545,59 @@ function hasDesktopSession() {
|
|
|
29227
29545
|
const result = (0, import_node_child_process2.spawnSync)("launchctl", ["managername"], { encoding: "utf8" });
|
|
29228
29546
|
return result.status === 0 && result.stdout.trim() === MACOS_GUI_SESSION_MANAGER;
|
|
29229
29547
|
}
|
|
29548
|
+
return hasDisplayServer();
|
|
29549
|
+
}
|
|
29550
|
+
function hasDisplayServer() {
|
|
29230
29551
|
if (process.platform === "win32") {
|
|
29231
29552
|
return false;
|
|
29232
29553
|
}
|
|
29233
29554
|
return (process.env.DISPLAY ?? "") !== "" || (process.env.WAYLAND_DISPLAY ?? "") !== "";
|
|
29234
29555
|
}
|
|
29556
|
+
async function hasDesktopSessionAsync() {
|
|
29557
|
+
if (process.platform !== "darwin") {
|
|
29558
|
+
return hasDisplayServer();
|
|
29559
|
+
}
|
|
29560
|
+
return await new Promise((resolve2) => {
|
|
29561
|
+
(0, import_node_child_process2.execFile)("launchctl", ["managername"], { encoding: "utf8" }, (error63, stdout2) => {
|
|
29562
|
+
resolve2(error63 === null && stdout2.trim() === MACOS_GUI_SESSION_MANAGER);
|
|
29563
|
+
});
|
|
29564
|
+
});
|
|
29565
|
+
}
|
|
29566
|
+
async function runCredentialCommand(argv, options) {
|
|
29567
|
+
const [command, ...args] = argv;
|
|
29568
|
+
return await new Promise((resolve2) => {
|
|
29569
|
+
const child = (0, import_node_child_process2.spawn)(command, args, { stdio: options.interactive ? ["inherit", "pipe", "inherit"] : ["ignore", "pipe", "pipe"] });
|
|
29570
|
+
let stdout2 = "";
|
|
29571
|
+
let stderr = "";
|
|
29572
|
+
let timedOut = false;
|
|
29573
|
+
const timer = setTimeout(() => {
|
|
29574
|
+
timedOut = true;
|
|
29575
|
+
child.kill();
|
|
29576
|
+
}, options.timeoutMs);
|
|
29577
|
+
let settled = false;
|
|
29578
|
+
const settle2 = (result) => {
|
|
29579
|
+
if (!settled) {
|
|
29580
|
+
settled = true;
|
|
29581
|
+
clearTimeout(timer);
|
|
29582
|
+
resolve2(result);
|
|
29583
|
+
}
|
|
29584
|
+
};
|
|
29585
|
+
child.stdout?.setEncoding("utf8");
|
|
29586
|
+
child.stdout?.on("data", (chunk2) => {
|
|
29587
|
+
stdout2 += chunk2;
|
|
29588
|
+
});
|
|
29589
|
+
child.stderr?.setEncoding("utf8");
|
|
29590
|
+
child.stderr?.on("data", (chunk2) => {
|
|
29591
|
+
stderr += chunk2;
|
|
29592
|
+
});
|
|
29593
|
+
child.once("error", (error63) => {
|
|
29594
|
+
settle2({ status: null, stdout: "", stderr: error63.message, timedOut: false });
|
|
29595
|
+
});
|
|
29596
|
+
child.once("close", (status) => {
|
|
29597
|
+
settle2(timedOut ? { status: null, stdout: "", stderr: "", timedOut: true } : { status, stdout: stdout2, stderr: options.interactive ? "" : stderr, timedOut: false });
|
|
29598
|
+
});
|
|
29599
|
+
});
|
|
29600
|
+
}
|
|
29235
29601
|
function resolveGitBranch(run, cwd) {
|
|
29236
29602
|
const result = run.run("git", ["-C", cwd, "rev-parse", "--abbrev-ref", "HEAD"]);
|
|
29237
29603
|
if (result.status !== 0) {
|
|
@@ -29428,7 +29794,7 @@ function realResolveClaudeBinary(isOwnBinary) {
|
|
|
29428
29794
|
function realInstalledClaudeVersions() {
|
|
29429
29795
|
return installedVersions(listVersionsDir(defaultVersionsDir()));
|
|
29430
29796
|
}
|
|
29431
|
-
var import_node_child_process2, import_node_crypto4, import_node_fs3, import_node_os2, import_node_path9, import_node_sea, realFsPort, OWNER_ONLY_DIR_MODE, OWNER_ONLY_FILE_MODE, PERMISSION_BITS, realFarmFs, INT32_BYTE_LENGTH, KEY_POLL_MS, CTRL_C_BYTE, realHoldPort, LINE_FEED, UTF8_CONTINUATION_MASK, UTF8_CONTINUATION_BITS, PS_TIMEOUT_MS, realRunPort, MACOS_GUI_SESSION_MANAGER, realCredentialPort, SOCKET_PERMISSION_BITS, realHeadroomSocketTrust, realSpawnPort, realProcPort, realLogPort, EXECUTE_BITS_MASK, WINDOWS_DEFAULT_PATHEXT;
|
|
29797
|
+
var import_node_child_process2, import_node_crypto4, import_node_fs3, import_node_os2, import_node_path9, import_node_sea, realFsPort, OWNER_ONLY_DIR_MODE, OWNER_ONLY_FILE_MODE, PERMISSION_BITS, realFarmFs, INT32_BYTE_LENGTH, KEY_POLL_MS, CTRL_C_BYTE, realHoldPort, LINE_FEED, UTF8_CONTINUATION_MASK, UTF8_CONTINUATION_BITS, PS_TIMEOUT_MS, realRunPort, MACOS_GUI_SESSION_MANAGER, realCredentialPort, realAsyncCredentialPort, SOCKET_PERMISSION_BITS, realHeadroomSocketTrust, realSpawnPort, realProcPort, realLogPort, EXECUTE_BITS_MASK, WINDOWS_DEFAULT_PATHEXT;
|
|
29432
29798
|
var init_realPorts = __esm({
|
|
29433
29799
|
"src/realPorts.ts"() {
|
|
29434
29800
|
"use strict";
|
|
@@ -29644,6 +30010,11 @@ var init_realPorts = __esm({
|
|
|
29644
30010
|
},
|
|
29645
30011
|
personPresent: () => process.stdin.isTTY || hasDesktopSession()
|
|
29646
30012
|
};
|
|
30013
|
+
realAsyncCredentialPort = {
|
|
30014
|
+
readSecretFile: (filePath) => realCredentialPort.readSecretFile(filePath),
|
|
30015
|
+
runCommand: runCredentialCommand,
|
|
30016
|
+
personPresent: async () => process.stdin.isTTY || await hasDesktopSessionAsync()
|
|
30017
|
+
};
|
|
29647
30018
|
SOCKET_PERMISSION_BITS = 4095;
|
|
29648
30019
|
realHeadroomSocketTrust = {
|
|
29649
30020
|
platform: process.platform,
|
|
@@ -31658,17 +32029,17 @@ var require_picomatch = __commonJS({
|
|
|
31658
32029
|
}
|
|
31659
32030
|
const opts = options || {};
|
|
31660
32031
|
const posix = opts.windows;
|
|
31661
|
-
const
|
|
31662
|
-
const state =
|
|
31663
|
-
delete
|
|
32032
|
+
const regex2 = isState ? picomatch4.compileRe(glob, options) : picomatch4.makeRe(glob, options, false, true);
|
|
32033
|
+
const state = regex2.state;
|
|
32034
|
+
delete regex2.state;
|
|
31664
32035
|
let isIgnored = () => false;
|
|
31665
32036
|
if (opts.ignore) {
|
|
31666
32037
|
const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
|
|
31667
32038
|
isIgnored = picomatch4(opts.ignore, ignoreOpts, returnState);
|
|
31668
32039
|
}
|
|
31669
32040
|
const matcher = (input2, returnObject = false) => {
|
|
31670
|
-
const { isMatch, match, output: output2 } = picomatch4.test(input2,
|
|
31671
|
-
const result = { glob, state, regex, posix, input: input2, output: output2, match, isMatch };
|
|
32041
|
+
const { isMatch, match, output: output2 } = picomatch4.test(input2, regex2, options, { glob, posix });
|
|
32042
|
+
const result = { glob, state, regex: regex2, posix, input: input2, output: output2, match, isMatch };
|
|
31672
32043
|
if (typeof opts.onResult === "function") {
|
|
31673
32044
|
opts.onResult(result);
|
|
31674
32045
|
}
|
|
@@ -31693,7 +32064,7 @@ var require_picomatch = __commonJS({
|
|
|
31693
32064
|
}
|
|
31694
32065
|
return matcher;
|
|
31695
32066
|
};
|
|
31696
|
-
picomatch4.test = (input2,
|
|
32067
|
+
picomatch4.test = (input2, regex2, options, { glob, posix } = {}) => {
|
|
31697
32068
|
if (typeof input2 !== "string") {
|
|
31698
32069
|
throw new TypeError("Expected input to be a string");
|
|
31699
32070
|
}
|
|
@@ -31710,16 +32081,16 @@ var require_picomatch = __commonJS({
|
|
|
31710
32081
|
}
|
|
31711
32082
|
if (match === false || opts.capture === true) {
|
|
31712
32083
|
if (opts.matchBase === true || opts.basename === true) {
|
|
31713
|
-
match = picomatch4.matchBase(input2,
|
|
32084
|
+
match = picomatch4.matchBase(input2, regex2, options, posix);
|
|
31714
32085
|
} else {
|
|
31715
|
-
match =
|
|
32086
|
+
match = regex2.exec(output2);
|
|
31716
32087
|
}
|
|
31717
32088
|
}
|
|
31718
32089
|
return { isMatch: Boolean(match), match, output: output2 };
|
|
31719
32090
|
};
|
|
31720
32091
|
picomatch4.matchBase = (input2, glob, options, posix = options && options.windows) => {
|
|
31721
|
-
const
|
|
31722
|
-
return
|
|
32092
|
+
const regex2 = glob instanceof RegExp ? glob : picomatch4.makeRe(glob, options);
|
|
32093
|
+
return regex2.test(utils.basename(input2, { windows: posix }));
|
|
31723
32094
|
};
|
|
31724
32095
|
picomatch4.isMatch = (str, patterns, options) => picomatch4(patterns, options)(str);
|
|
31725
32096
|
picomatch4.parse = (pattern, options) => {
|
|
@@ -31738,11 +32109,11 @@ var require_picomatch = __commonJS({
|
|
|
31738
32109
|
if (state && state.negated === true) {
|
|
31739
32110
|
source = `^(?!${source}).*$`;
|
|
31740
32111
|
}
|
|
31741
|
-
const
|
|
32112
|
+
const regex2 = picomatch4.toRegex(source, options);
|
|
31742
32113
|
if (returnState === true) {
|
|
31743
|
-
|
|
32114
|
+
regex2.state = state;
|
|
31744
32115
|
}
|
|
31745
|
-
return
|
|
32116
|
+
return regex2;
|
|
31746
32117
|
};
|
|
31747
32118
|
picomatch4.makeRe = (input2, options = {}, returnOutput = false, returnState = false) => {
|
|
31748
32119
|
if (!input2 || typeof input2 !== "string") {
|
|
@@ -35047,51 +35418,87 @@ function unpackKeyringToken(raw) {
|
|
|
35047
35418
|
}
|
|
35048
35419
|
return trimmed;
|
|
35049
35420
|
}
|
|
35050
|
-
function
|
|
35051
|
-
|
|
35421
|
+
function declined(reason, warn = false) {
|
|
35422
|
+
return { ok: false, reason, warn };
|
|
35423
|
+
}
|
|
35424
|
+
function isCommandBacked(source) {
|
|
35425
|
+
return "command" in source || "op" in source || "keychain" in source;
|
|
35426
|
+
}
|
|
35427
|
+
function immediateOutcome(source, params) {
|
|
35052
35428
|
if ("env" in source) {
|
|
35053
35429
|
const value2 = params.env[source.env];
|
|
35054
|
-
return value2 === void 0 || value2 === "" ?
|
|
35430
|
+
return value2 === void 0 || value2 === "" ? declined("is unset or empty") : { ok: true, token: unpackKeyringToken(value2) };
|
|
35055
35431
|
}
|
|
35056
35432
|
if ("literal" in source) {
|
|
35057
35433
|
return { ok: true, token: source.literal };
|
|
35058
35434
|
}
|
|
35059
|
-
|
|
35060
|
-
|
|
35061
|
-
|
|
35062
|
-
return none("does not exist");
|
|
35063
|
-
}
|
|
35064
|
-
if (read.mode !== void 0 && (read.mode & GROUP_OTHER_PERMISSION_BITS) !== 0) {
|
|
35065
|
-
return none(
|
|
35066
|
-
`is readable or writable by group or others (mode ${(read.mode & PERMISSION_BITS2).toString(OCTAL_RADIX2)}); run \`chmod 600 ${source.file}\``,
|
|
35067
|
-
true
|
|
35068
|
-
);
|
|
35069
|
-
}
|
|
35070
|
-
const token2 = unpackKeyringToken(read.content.trim());
|
|
35071
|
-
return token2 === "" ? none("is empty") : { ok: true, token: token2 };
|
|
35435
|
+
const read = params.port.readSecretFile(source.file);
|
|
35436
|
+
if (!read.found) {
|
|
35437
|
+
return declined("does not exist");
|
|
35072
35438
|
}
|
|
35073
|
-
|
|
35074
|
-
|
|
35075
|
-
|
|
35076
|
-
|
|
35439
|
+
if (read.mode !== void 0 && (read.mode & GROUP_OTHER_PERMISSION_BITS) !== 0) {
|
|
35440
|
+
return declined(
|
|
35441
|
+
`is readable or writable by group or others (mode ${(read.mode & PERMISSION_BITS2).toString(OCTAL_RADIX2)}); run \`chmod 600 ${source.file}\``,
|
|
35442
|
+
true
|
|
35443
|
+
);
|
|
35077
35444
|
}
|
|
35078
|
-
const
|
|
35079
|
-
|
|
35445
|
+
const token = unpackKeyringToken(read.content.trim());
|
|
35446
|
+
return token === "" ? declined("is empty") : { ok: true, token };
|
|
35447
|
+
}
|
|
35448
|
+
function commandRunOf(source, env) {
|
|
35449
|
+
const interactive = isInteractiveSource(source, env);
|
|
35450
|
+
return { argv: commandArgv(source), interactive, timeoutMs: source.timeoutMs ?? (interactive ? CREDENTIAL_INTERACTIVE_TIMEOUT_MS : CREDENTIAL_COMMAND_TIMEOUT_MS) };
|
|
35451
|
+
}
|
|
35452
|
+
function commandOutcome(result, timeoutMs) {
|
|
35080
35453
|
if (result.timedOut) {
|
|
35081
|
-
return
|
|
35454
|
+
return declined(`timed out after ${String(timeoutMs)}ms`);
|
|
35082
35455
|
}
|
|
35083
35456
|
if (result.status !== 0) {
|
|
35084
35457
|
const stderr = result.stderr.trim();
|
|
35085
35458
|
const outcome = result.status === null ? "could not be run or was killed by a signal" : `exited with status ${String(result.status)}`;
|
|
35086
|
-
return
|
|
35459
|
+
return declined(`${outcome}${stderr === "" ? "" : `: ${stderr}`}`);
|
|
35087
35460
|
}
|
|
35088
35461
|
const token = unpackKeyringToken(result.stdout.trim());
|
|
35089
|
-
return token === "" ?
|
|
35462
|
+
return token === "" ? declined("printed no token") : { ok: true, token };
|
|
35463
|
+
}
|
|
35464
|
+
function trySource(source, params) {
|
|
35465
|
+
if (!isCommandBacked(source)) {
|
|
35466
|
+
return immediateOutcome(source, params);
|
|
35467
|
+
}
|
|
35468
|
+
const run = commandRunOf(source, params.env);
|
|
35469
|
+
if (run.interactive && !params.port.personPresent()) {
|
|
35470
|
+
return declined(NO_PERSON_REASON);
|
|
35471
|
+
}
|
|
35472
|
+
return commandOutcome(params.port.runCommand(run.argv, { timeoutMs: run.timeoutMs, interactive: run.interactive }), run.timeoutMs);
|
|
35473
|
+
}
|
|
35474
|
+
async function trySourceAsync(source, params) {
|
|
35475
|
+
if (!isCommandBacked(source)) {
|
|
35476
|
+
return immediateOutcome(source, params);
|
|
35477
|
+
}
|
|
35478
|
+
const run = commandRunOf(source, params.env);
|
|
35479
|
+
if (run.interactive && !await params.port.personPresent()) {
|
|
35480
|
+
return declined(NO_PERSON_REASON);
|
|
35481
|
+
}
|
|
35482
|
+
return commandOutcome(await params.port.runCommand(run.argv, { timeoutMs: run.timeoutMs, interactive: run.interactive }), run.timeoutMs);
|
|
35090
35483
|
}
|
|
35091
35484
|
function warmCommandFor(subject) {
|
|
35092
35485
|
const [kind, name] = subject.split(" ");
|
|
35093
35486
|
return kind === "provider" ? `agent-shim credential warm --provider ${name ?? ""}` : `agent-shim credential warm ${name ?? ""}`;
|
|
35094
35487
|
}
|
|
35488
|
+
function cachedResolution(target, entry) {
|
|
35489
|
+
return { ok: true, credential: { target, token: entry.token, source: entry.source, warnings: [], cachedAt: entry.fetchedAt } };
|
|
35490
|
+
}
|
|
35491
|
+
function liveResolution(target, token, source, warnings) {
|
|
35492
|
+
return { ok: true, credential: { target, token, source, warnings } };
|
|
35493
|
+
}
|
|
35494
|
+
function unresolved(subject, cacheBlock, attempts) {
|
|
35495
|
+
const hint = cacheBlock === void 0 ? "" : `; fill the cache from a terminal with \`${warmCommandFor(subject)}\``;
|
|
35496
|
+
return { ok: false, message: `agent-shim: ${subject} has no usable credential: ${attempts.join("; ")}${hint}` };
|
|
35497
|
+
}
|
|
35498
|
+
function declinedLine(source, outcome, subject) {
|
|
35499
|
+
const attempt = `${describeSource(source)} ${outcome.reason}`;
|
|
35500
|
+
return { attempt, warning: outcome.warn ? `agent-shim: ${subject}: skipped ${attempt}` : void 0 };
|
|
35501
|
+
}
|
|
35095
35502
|
function resolveCredential(params) {
|
|
35096
35503
|
const target = params.credential.target ?? "bearer";
|
|
35097
35504
|
const cacheBlock = params.credential.cache;
|
|
@@ -35100,7 +35507,7 @@ function resolveCredential(params) {
|
|
|
35100
35507
|
if (cacheBlock !== void 0 && cache !== void 0 && store !== void 0 && params.refresh !== true) {
|
|
35101
35508
|
const entry = cache.port.read(store, params.subject);
|
|
35102
35509
|
if (entry !== void 0 && isFresh(entry, cacheBlock, cache.now())) {
|
|
35103
|
-
return
|
|
35510
|
+
return cachedResolution(target, entry);
|
|
35104
35511
|
}
|
|
35105
35512
|
}
|
|
35106
35513
|
const attempts = [];
|
|
@@ -35111,16 +35518,59 @@ function resolveCredential(params) {
|
|
|
35111
35518
|
if (cache !== void 0 && store !== void 0) {
|
|
35112
35519
|
cache.port.write(store, params.subject, { token: outcome.token, fetchedAt: cache.now(), source });
|
|
35113
35520
|
}
|
|
35114
|
-
return
|
|
35521
|
+
return liveResolution(target, outcome.token, source, warnings);
|
|
35115
35522
|
}
|
|
35116
|
-
const line =
|
|
35117
|
-
attempts.push(line);
|
|
35118
|
-
if (
|
|
35119
|
-
warnings.push(
|
|
35523
|
+
const line = declinedLine(source, outcome, params.subject);
|
|
35524
|
+
attempts.push(line.attempt);
|
|
35525
|
+
if (line.warning !== void 0) {
|
|
35526
|
+
warnings.push(line.warning);
|
|
35120
35527
|
}
|
|
35121
35528
|
}
|
|
35122
|
-
|
|
35123
|
-
|
|
35529
|
+
return unresolved(params.subject, cacheBlock, attempts);
|
|
35530
|
+
}
|
|
35531
|
+
async function resolveCredentialAsync(params) {
|
|
35532
|
+
const target = params.credential.target ?? "bearer";
|
|
35533
|
+
const cacheBlock = params.credential.cache;
|
|
35534
|
+
const cache = cacheBlock === void 0 ? void 0 : params.port.cache;
|
|
35535
|
+
const store = cacheBlock === void 0 || cache === void 0 ? void 0 : effectiveStore(cacheBlock, cache.platform);
|
|
35536
|
+
if (cacheBlock !== void 0 && cache !== void 0 && store !== void 0 && params.refresh !== true) {
|
|
35537
|
+
const entry = await cache.port.read(store, params.subject);
|
|
35538
|
+
if (entry !== void 0 && isFresh(entry, cacheBlock, cache.now())) {
|
|
35539
|
+
return cachedResolution(target, entry);
|
|
35540
|
+
}
|
|
35541
|
+
}
|
|
35542
|
+
const attempts = [];
|
|
35543
|
+
const warnings = [];
|
|
35544
|
+
for (const source of params.credential.sources) {
|
|
35545
|
+
const outcome = await trySourceAsync(source, params);
|
|
35546
|
+
if (outcome.ok) {
|
|
35547
|
+
if (cache !== void 0 && store !== void 0) {
|
|
35548
|
+
await cache.port.write(store, params.subject, { token: outcome.token, fetchedAt: cache.now(), source });
|
|
35549
|
+
}
|
|
35550
|
+
return liveResolution(target, outcome.token, source, warnings);
|
|
35551
|
+
}
|
|
35552
|
+
const line = declinedLine(source, outcome, params.subject);
|
|
35553
|
+
attempts.push(line.attempt);
|
|
35554
|
+
if (line.warning !== void 0) {
|
|
35555
|
+
warnings.push(line.warning);
|
|
35556
|
+
}
|
|
35557
|
+
}
|
|
35558
|
+
return unresolved(params.subject, cacheBlock, attempts);
|
|
35559
|
+
}
|
|
35560
|
+
function shareInFlightResolutions(resolve2) {
|
|
35561
|
+
const inFlight = /* @__PURE__ */ new Map();
|
|
35562
|
+
return async (params) => {
|
|
35563
|
+
const key = JSON.stringify([params.subject, params.credential, params.refresh === true]);
|
|
35564
|
+
const running = inFlight.get(key);
|
|
35565
|
+
if (running !== void 0) {
|
|
35566
|
+
return await running;
|
|
35567
|
+
}
|
|
35568
|
+
const started = resolve2(params).finally(() => {
|
|
35569
|
+
inFlight.delete(key);
|
|
35570
|
+
});
|
|
35571
|
+
inFlight.set(key, started);
|
|
35572
|
+
return await started;
|
|
35573
|
+
};
|
|
35124
35574
|
}
|
|
35125
35575
|
function credentialVariables(target, token) {
|
|
35126
35576
|
return {
|
|
@@ -35129,7 +35579,7 @@ function credentialVariables(target, token) {
|
|
|
35129
35579
|
CLAUDE_CODE_OAUTH_TOKEN: target === "oauthToken" ? token : void 0
|
|
35130
35580
|
};
|
|
35131
35581
|
}
|
|
35132
|
-
var CREDENTIAL_UNAVAILABLE_EXIT, CREDENTIAL_COMMAND_TIMEOUT_MS, CREDENTIAL_INTERACTIVE_TIMEOUT_MS, GROUP_OTHER_PERMISSION_BITS, PERMISSION_BITS2, OCTAL_RADIX2, GO_KEYRING_BASE64_PREFIX;
|
|
35582
|
+
var CREDENTIAL_UNAVAILABLE_EXIT, CREDENTIAL_COMMAND_TIMEOUT_MS, CREDENTIAL_INTERACTIVE_TIMEOUT_MS, GROUP_OTHER_PERMISSION_BITS, PERMISSION_BITS2, OCTAL_RADIX2, GO_KEYRING_BASE64_PREFIX, NO_PERSON_REASON;
|
|
35133
35583
|
var init_credential = __esm({
|
|
35134
35584
|
"src/credential.ts"() {
|
|
35135
35585
|
"use strict";
|
|
@@ -35141,6 +35591,7 @@ var init_credential = __esm({
|
|
|
35141
35591
|
PERMISSION_BITS2 = 511;
|
|
35142
35592
|
OCTAL_RADIX2 = 8;
|
|
35143
35593
|
GO_KEYRING_BASE64_PREFIX = "go-keyring-base64:";
|
|
35594
|
+
NO_PERSON_REASON = "needs a person to approve it, but there is no terminal or desktop session";
|
|
35144
35595
|
}
|
|
35145
35596
|
});
|
|
35146
35597
|
|
|
@@ -36315,7 +36766,7 @@ var init_package = __esm({
|
|
|
36315
36766
|
"package.json"() {
|
|
36316
36767
|
package_default = {
|
|
36317
36768
|
name: "claude-use",
|
|
36318
|
-
version: "11.
|
|
36769
|
+
version: "11.56.0",
|
|
36319
36770
|
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.",
|
|
36320
36771
|
license: "MIT",
|
|
36321
36772
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -36373,6 +36824,7 @@ var init_package = __esm({
|
|
|
36373
36824
|
commander: "^15.0.0",
|
|
36374
36825
|
cosmiconfig: "^10.0.1",
|
|
36375
36826
|
picomatch: "^4.0.7",
|
|
36827
|
+
"string-width": "8.3.0",
|
|
36376
36828
|
trilean: "1.7.1",
|
|
36377
36829
|
undici: "7.29.1",
|
|
36378
36830
|
zod: "^4.6.1"
|
|
@@ -37751,6 +38203,30 @@ function security(args, stdin2) {
|
|
|
37751
38203
|
const result = (0, import_node_child_process3.spawnSync)("security", args, { encoding: "utf8", ...stdin2 === void 0 ? {} : { input: stdin2 }, stdio: ["pipe", "pipe", "ignore"] });
|
|
37752
38204
|
return { status: result.status, stdout: result.stdout };
|
|
37753
38205
|
}
|
|
38206
|
+
async function securityAsync(args, stdin2) {
|
|
38207
|
+
return await new Promise((resolve2) => {
|
|
38208
|
+
const child = (0, import_node_child_process3.spawn)("security", args, { stdio: ["pipe", "pipe", "ignore"] });
|
|
38209
|
+
let stdout2 = "";
|
|
38210
|
+
let settled = false;
|
|
38211
|
+
const settle2 = (status) => {
|
|
38212
|
+
if (!settled) {
|
|
38213
|
+
settled = true;
|
|
38214
|
+
resolve2({ status, stdout: stdout2 });
|
|
38215
|
+
}
|
|
38216
|
+
};
|
|
38217
|
+
child.stdout.setEncoding("utf8");
|
|
38218
|
+
child.stdout.on("data", (chunk2) => {
|
|
38219
|
+
stdout2 += chunk2;
|
|
38220
|
+
});
|
|
38221
|
+
child.stdin.on("error", () => {
|
|
38222
|
+
});
|
|
38223
|
+
child.stdin.end(stdin2);
|
|
38224
|
+
child.once("error", () => {
|
|
38225
|
+
settle2(null);
|
|
38226
|
+
});
|
|
38227
|
+
child.once("close", settle2);
|
|
38228
|
+
});
|
|
38229
|
+
}
|
|
37754
38230
|
function createRealCredentialCache(root) {
|
|
37755
38231
|
const dir = import_node_path29.default.join(root, "credential-cache");
|
|
37756
38232
|
const filePath = (owner) => import_node_path29.default.join(dir, cacheFileNameFor(owner));
|
|
@@ -37799,6 +38275,46 @@ function createRealCredentialCache(root) {
|
|
|
37799
38275
|
function realCredentialCacheEnv(paths) {
|
|
37800
38276
|
return { port: createRealCredentialCache(paths.root), platform: process.platform, now: () => Date.now() };
|
|
37801
38277
|
}
|
|
38278
|
+
function createAsyncRealCredentialCache(root) {
|
|
38279
|
+
const dir = import_node_path29.default.join(root, "credential-cache");
|
|
38280
|
+
const filePath = (owner) => import_node_path29.default.join(dir, cacheFileNameFor(owner));
|
|
38281
|
+
return {
|
|
38282
|
+
async read(store, owner) {
|
|
38283
|
+
if (store === "file") {
|
|
38284
|
+
try {
|
|
38285
|
+
return parseEntry(await import_node_fs9.default.promises.readFile(filePath(owner), "utf8"));
|
|
38286
|
+
} catch {
|
|
38287
|
+
return void 0;
|
|
38288
|
+
}
|
|
38289
|
+
}
|
|
38290
|
+
requireKeychain();
|
|
38291
|
+
const result = await securityAsync(["find-generic-password", "-s", KEYCHAIN_CACHE_SERVICE, "-a", owner, "-w"]);
|
|
38292
|
+
return result.status === 0 ? parseEntry(Buffer.from(result.stdout.trim(), "base64").toString("utf8")) : void 0;
|
|
38293
|
+
},
|
|
38294
|
+
async write(store, owner, entry) {
|
|
38295
|
+
const serialised = JSON.stringify(entry);
|
|
38296
|
+
if (store === "file") {
|
|
38297
|
+
await import_node_fs9.default.promises.mkdir(dir, { recursive: true, mode: CACHE_DIR_MODE });
|
|
38298
|
+
await import_node_fs9.default.promises.chmod(dir, CACHE_DIR_MODE);
|
|
38299
|
+
const target = filePath(owner);
|
|
38300
|
+
const temp = `${target}.${String(process.pid)}.tmp`;
|
|
38301
|
+
await import_node_fs9.default.promises.writeFile(temp, serialised, { mode: CACHE_FILE_MODE });
|
|
38302
|
+
await import_node_fs9.default.promises.rename(temp, target);
|
|
38303
|
+
return;
|
|
38304
|
+
}
|
|
38305
|
+
requireKeychain();
|
|
38306
|
+
const encoded = Buffer.from(serialised, "utf8").toString("base64");
|
|
38307
|
+
const result = await securityAsync(["-i"], `add-generic-password -U -s ${KEYCHAIN_CACHE_SERVICE} -a ${JSON.stringify(owner)} -w ${encoded}
|
|
38308
|
+
`);
|
|
38309
|
+
if (result.status !== 0) {
|
|
38310
|
+
throw new Error(`could not write the keychain credential cache for ${owner}`);
|
|
38311
|
+
}
|
|
38312
|
+
}
|
|
38313
|
+
};
|
|
38314
|
+
}
|
|
38315
|
+
function realAsyncCredentialCacheEnv(paths) {
|
|
38316
|
+
return { port: createAsyncRealCredentialCache(paths.root), platform: process.platform, now: () => Date.now() };
|
|
38317
|
+
}
|
|
37802
38318
|
var import_node_child_process3, import_node_fs9, import_node_path29, KEYCHAIN_CACHE_SERVICE, CACHE_DIR_MODE, CACHE_FILE_MODE;
|
|
37803
38319
|
var init_realCredentialCache = __esm({
|
|
37804
38320
|
"src/realCredentialCache.ts"() {
|
|
@@ -62222,10 +62738,10 @@ var require_connection = __commonJS({
|
|
|
62222
62738
|
});
|
|
62223
62739
|
return controller;
|
|
62224
62740
|
}
|
|
62225
|
-
function closeWebSocketConnection(object3, code, reason,
|
|
62741
|
+
function closeWebSocketConnection(object3, code, reason, validate3 = false) {
|
|
62226
62742
|
code ??= null;
|
|
62227
62743
|
reason ??= "";
|
|
62228
|
-
if (
|
|
62744
|
+
if (validate3) validateCloseCodeAndReason(code, reason);
|
|
62229
62745
|
if (isClosed(object3.readyState) || isClosing(object3.readyState)) {
|
|
62230
62746
|
} else if (!isEstablished(object3.readyState)) {
|
|
62231
62747
|
failWebsocketConnection(object3);
|
|
@@ -68358,13 +68874,13 @@ function resolveLaunch(params) {
|
|
|
68358
68874
|
environment
|
|
68359
68875
|
};
|
|
68360
68876
|
}
|
|
68361
|
-
function runLaunchPlan(plan,
|
|
68877
|
+
function runLaunchPlan(plan, spawn9) {
|
|
68362
68878
|
try {
|
|
68363
68879
|
if (plan.hold() === "cancelled") {
|
|
68364
68880
|
return LAUNCH_CANCELLED_EXIT;
|
|
68365
68881
|
}
|
|
68366
68882
|
plan.markChildStarted();
|
|
68367
|
-
const result =
|
|
68883
|
+
const result = spawn9.spawnSync(plan.bin, plan.args, { stdio: "inherit", env: plan.env });
|
|
68368
68884
|
if (result.error !== void 0) {
|
|
68369
68885
|
throw result.error;
|
|
68370
68886
|
}
|
|
@@ -68852,7 +69368,7 @@ function createQuotaRefresher(deps) {
|
|
|
68852
69368
|
const fetchNow = async (identity, provider, lookup, adapter) => {
|
|
68853
69369
|
const key = `${identity}\0${provider}`;
|
|
68854
69370
|
try {
|
|
68855
|
-
const apiKey = lookup.apiKey();
|
|
69371
|
+
const apiKey = await lookup.apiKey();
|
|
68856
69372
|
const quota = await adapter.fetch(apiKey, deps.http, AbortSignal.timeout(QUOTA_REQUEST_TIMEOUT_MS), deps.now());
|
|
68857
69373
|
if (!deps.record(identity, provider, quota)) {
|
|
68858
69374
|
return { status: "no-usage" };
|
|
@@ -68922,8 +69438,8 @@ function createProviderLookup(ports) {
|
|
|
68922
69438
|
}
|
|
68923
69439
|
return {
|
|
68924
69440
|
baseUrl,
|
|
68925
|
-
apiKey: () => {
|
|
68926
|
-
const resolution =
|
|
69441
|
+
apiKey: async () => {
|
|
69442
|
+
const resolution = await resolveCredentialAsync({ credential: isRouterProvider(definition) ? { sources: [] } : definition.credential, env: ports.env, port: ports.credentials, subject: `provider ${name}` });
|
|
68927
69443
|
if (!resolution.ok) {
|
|
68928
69444
|
throw new Error(resolution.message);
|
|
68929
69445
|
}
|
|
@@ -104320,8 +104836,8 @@ var require_keyword = __commonJS({
|
|
|
104320
104836
|
var _a4;
|
|
104321
104837
|
const { gen, keyword, schema, parentSchema, $data, it: it2 } = cxt;
|
|
104322
104838
|
checkAsyncKeyword(it2, def);
|
|
104323
|
-
const
|
|
104324
|
-
const validateRef = useKeyword(gen, keyword,
|
|
104839
|
+
const validate3 = !$data && def.compile ? def.compile.call(it2.self, schema, parentSchema, it2) : def.validate;
|
|
104840
|
+
const validateRef = useKeyword(gen, keyword, validate3);
|
|
104325
104841
|
const valid = gen.let("valid");
|
|
104326
104842
|
cxt.block$data(valid, validateKeyword);
|
|
104327
104843
|
cxt.ok((_a4 = def.valid) !== null && _a4 !== void 0 ? _a4 : valid);
|
|
@@ -105394,28 +105910,28 @@ var require_compile = __commonJS({
|
|
|
105394
105910
|
if (this.opts.code.process)
|
|
105395
105911
|
sourceCode = this.opts.code.process(sourceCode, sch);
|
|
105396
105912
|
const makeValidate = new Function(`${names_1.default.self}`, `${names_1.default.scope}`, sourceCode);
|
|
105397
|
-
const
|
|
105398
|
-
this.scope.value(validateName, { ref:
|
|
105399
|
-
|
|
105400
|
-
|
|
105401
|
-
|
|
105913
|
+
const validate3 = makeValidate(this, this.scope.get());
|
|
105914
|
+
this.scope.value(validateName, { ref: validate3 });
|
|
105915
|
+
validate3.errors = null;
|
|
105916
|
+
validate3.schema = sch.schema;
|
|
105917
|
+
validate3.schemaEnv = sch;
|
|
105402
105918
|
if (sch.$async)
|
|
105403
|
-
|
|
105919
|
+
validate3.$async = true;
|
|
105404
105920
|
if (this.opts.code.source === true) {
|
|
105405
|
-
|
|
105921
|
+
validate3.source = { validateName, validateCode, scopeValues: gen._values };
|
|
105406
105922
|
}
|
|
105407
105923
|
if (this.opts.unevaluated) {
|
|
105408
105924
|
const { props, items } = schemaCxt;
|
|
105409
|
-
|
|
105925
|
+
validate3.evaluated = {
|
|
105410
105926
|
props: props instanceof codegen_1.Name ? void 0 : props,
|
|
105411
105927
|
items: items instanceof codegen_1.Name ? void 0 : items,
|
|
105412
105928
|
dynamicProps: props instanceof codegen_1.Name,
|
|
105413
105929
|
dynamicItems: items instanceof codegen_1.Name
|
|
105414
105930
|
};
|
|
105415
|
-
if (
|
|
105416
|
-
|
|
105931
|
+
if (validate3.source)
|
|
105932
|
+
validate3.source.evaluated = (0, codegen_1.stringify)(validate3.evaluated);
|
|
105417
105933
|
}
|
|
105418
|
-
sch.validate =
|
|
105934
|
+
sch.validate = validate3;
|
|
105419
105935
|
return sch;
|
|
105420
105936
|
} catch (e14) {
|
|
105421
105937
|
delete sch.validate;
|
|
@@ -107097,10 +107613,10 @@ var require_core2 = __commonJS({
|
|
|
107097
107613
|
}
|
|
107098
107614
|
return metaSchema;
|
|
107099
107615
|
}
|
|
107100
|
-
_removeAllSchemas(schemas,
|
|
107616
|
+
_removeAllSchemas(schemas, regex2) {
|
|
107101
107617
|
for (const keyRef in schemas) {
|
|
107102
107618
|
const sch = schemas[keyRef];
|
|
107103
|
-
if (!
|
|
107619
|
+
if (!regex2 || regex2.test(keyRef)) {
|
|
107104
107620
|
if (typeof sch == "string") {
|
|
107105
107621
|
delete schemas[keyRef];
|
|
107106
107622
|
} else if (sch && !sch.meta) {
|
|
@@ -109338,8 +109854,8 @@ var require_formats = __commonJS({
|
|
|
109338
109854
|
"use strict";
|
|
109339
109855
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
109340
109856
|
exports2.formatNames = exports2.fastFormats = exports2.fullFormats = void 0;
|
|
109341
|
-
function fmtDef(
|
|
109342
|
-
return { validate:
|
|
109857
|
+
function fmtDef(validate3, compare) {
|
|
109858
|
+
return { validate: validate3, compare };
|
|
109343
109859
|
}
|
|
109344
109860
|
exports2.fullFormats = {
|
|
109345
109861
|
// date: http://tools.ietf.org/html/rfc3339#section-5.6
|
|
@@ -109363,7 +109879,7 @@ var require_formats = __commonJS({
|
|
|
109363
109879
|
// optimized https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9780596802837/ch07s16.html
|
|
109364
109880
|
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)$/,
|
|
109365
109881
|
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,
|
|
109366
|
-
regex,
|
|
109882
|
+
regex: regex2,
|
|
109367
109883
|
// uuid: http://tools.ietf.org/html/rfc4122
|
|
109368
109884
|
uuid: /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,
|
|
109369
109885
|
// JSON-pointer: https://tools.ietf.org/html/rfc6901
|
|
@@ -109522,7 +110038,7 @@ var require_formats = __commonJS({
|
|
|
109522
110038
|
return true;
|
|
109523
110039
|
}
|
|
109524
110040
|
var Z_ANCHOR = /[^\\]\\Z/;
|
|
109525
|
-
function
|
|
110041
|
+
function regex2(str) {
|
|
109526
110042
|
if (Z_ANCHOR.test(str))
|
|
109527
110043
|
return false;
|
|
109528
110044
|
try {
|
|
@@ -111393,9 +111909,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
111393
111909
|
if (typeof fn2 === "function") {
|
|
111394
111910
|
option.default(defaultValue).argParser(fn2);
|
|
111395
111911
|
} else if (fn2 instanceof RegExp) {
|
|
111396
|
-
const
|
|
111912
|
+
const regex2 = fn2;
|
|
111397
111913
|
fn2 = (val, def) => {
|
|
111398
|
-
const m10 =
|
|
111914
|
+
const m10 = regex2.exec(val);
|
|
111399
111915
|
return m10 ? m10[0] : def;
|
|
111400
111916
|
};
|
|
111401
111917
|
option.default(defaultValue).argParser(fn2);
|
|
@@ -113068,7 +113584,7 @@ var getCodePointsLength = /* @__PURE__ */ (() => {
|
|
|
113068
113584
|
return input2.length - surrogatePairsNr;
|
|
113069
113585
|
};
|
|
113070
113586
|
})();
|
|
113071
|
-
var
|
|
113587
|
+
var isFullWidth2 = (x) => {
|
|
113072
113588
|
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
113073
113589
|
};
|
|
113074
113590
|
var isWideNotCJKTNotEmoji = (x) => {
|
|
@@ -113120,7 +113636,7 @@ var getStringTruncatedWidth = (input2, truncationOptions = {}, widthOptions = {}
|
|
|
113120
113636
|
lengthExtra = 0;
|
|
113121
113637
|
for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
|
|
113122
113638
|
const codePoint = char.codePointAt(0) || 0;
|
|
113123
|
-
if (
|
|
113639
|
+
if (isFullWidth2(codePoint)) {
|
|
113124
113640
|
widthExtra = FULL_WIDTH_WIDTH;
|
|
113125
113641
|
} else if (isWideNotCJKTNotEmoji(codePoint)) {
|
|
113126
113642
|
widthExtra = WIDE_WIDTH;
|
|
@@ -121311,7 +121827,7 @@ function runDoctor(params) {
|
|
|
121311
121827
|
const push = (section, severity, message, subject) => {
|
|
121312
121828
|
findings.push({ section, severity, message, ...subject === void 0 ? {} : { subject } });
|
|
121313
121829
|
};
|
|
121314
|
-
const
|
|
121830
|
+
const validate3 = (schema, input2, section, subject) => {
|
|
121315
121831
|
const validated2 = validateJson(schema, input2);
|
|
121316
121832
|
if (validated2.ok && validated2.warning !== void 0) {
|
|
121317
121833
|
push(section, "warn", validated2.warning, subject);
|
|
@@ -121357,7 +121873,7 @@ function runDoctor(params) {
|
|
|
121357
121873
|
pushLegacyName(push, params);
|
|
121358
121874
|
const profileSources = /* @__PURE__ */ new Map();
|
|
121359
121875
|
for (const entry of params.configProfiles) {
|
|
121360
|
-
const validated2 =
|
|
121876
|
+
const validated2 = validate3(ConfigProfileSchema, entry, "config-profile", entry.name);
|
|
121361
121877
|
if (!validated2.ok) {
|
|
121362
121878
|
push("config-profile", "fail", validated2.message, entry.name);
|
|
121363
121879
|
continue;
|
|
@@ -121379,7 +121895,7 @@ function runDoctor(params) {
|
|
|
121379
121895
|
const validProfileNames = new Set(profileSources.keys());
|
|
121380
121896
|
const validIdentityNames = /* @__PURE__ */ new Set();
|
|
121381
121897
|
for (const entry of params.identities) {
|
|
121382
|
-
const validated2 =
|
|
121898
|
+
const validated2 = validate3(IdentitySchema, entry, "identity", entry.name);
|
|
121383
121899
|
if (!validated2.ok) {
|
|
121384
121900
|
push("identity", "fail", validated2.message, entry.name);
|
|
121385
121901
|
continue;
|
|
@@ -121469,7 +121985,7 @@ function runDoctor(params) {
|
|
|
121469
121985
|
if (params.directoryRules.raw === void 0) {
|
|
121470
121986
|
push("directory-rules", "pass", "No directory-rules.json configured.");
|
|
121471
121987
|
} else {
|
|
121472
|
-
const validated2 =
|
|
121988
|
+
const validated2 = validate3(DirectoryRulesSchema, params.directoryRules, "directory-rules");
|
|
121473
121989
|
if (!validated2.ok) {
|
|
121474
121990
|
push("directory-rules", "fail", validated2.message);
|
|
121475
121991
|
} else {
|
|
@@ -121494,7 +122010,7 @@ function runDoctor(params) {
|
|
|
121494
122010
|
if (params.globalConfig.raw === void 0) {
|
|
121495
122011
|
push("global-config", "pass", "No config.json configured.");
|
|
121496
122012
|
} else {
|
|
121497
|
-
const validated2 =
|
|
122013
|
+
const validated2 = validate3(GlobalConfigSchema, params.globalConfig, "global-config");
|
|
121498
122014
|
if (!validated2.ok) {
|
|
121499
122015
|
push("global-config", "fail", validated2.message);
|
|
121500
122016
|
} else {
|
|
@@ -121525,7 +122041,7 @@ function runDoctor(params) {
|
|
|
121525
122041
|
if (params.categoriesLocal.raw === void 0) {
|
|
121526
122042
|
push("categories-local", "pass", "No categories.local.json configured.");
|
|
121527
122043
|
} else {
|
|
121528
|
-
const validated2 =
|
|
122044
|
+
const validated2 = validate3(CategoryClassificationOverlaySchema, params.categoriesLocal, "categories-local");
|
|
121529
122045
|
push(
|
|
121530
122046
|
"categories-local",
|
|
121531
122047
|
validated2.ok ? "pass" : "fail",
|
|
@@ -129019,8 +129535,8 @@ function getParamRegexp(segment, unnamedStart = 0) {
|
|
|
129019
129535
|
_s2 += segment[j10];
|
|
129020
129536
|
}
|
|
129021
129537
|
[_s2, _i2] = replaceSegmentWildcards(_s2, _i2);
|
|
129022
|
-
const
|
|
129023
|
-
return [new RegExp(`^${
|
|
129538
|
+
const regex2 = _s2.replace(/:([\w-]+)(?:\(([^)]*)\))?/g, (_, id2, p) => `(?<${toGroupName(id2)}>${p || "[^/]+"})`).replace(/\((?![?<])/g, () => `(?<${toUnnamedGroupKey(_i2++)}>`).replace(/\uFFFE(.)/g, (_, c10) => /[.*+?^${}()|[\]\\]/.test(c10) ? `\\${c10}` : c10);
|
|
129539
|
+
return [new RegExp(`^${regex2}$`), _i2];
|
|
129024
129540
|
}
|
|
129025
129541
|
function findRoute(ctx, method = "", path68, opts) {
|
|
129026
129542
|
if (opts?.normalize) path68 = normalizePath(path68);
|
|
@@ -130720,13 +131236,8 @@ function rcFanoutOnDoorHub(fanout, hub) {
|
|
|
130720
131236
|
}
|
|
130721
131237
|
|
|
130722
131238
|
// src/frontdoor/quotaExpiringEvents.ts
|
|
131239
|
+
init_pick();
|
|
130723
131240
|
init_schema2();
|
|
130724
|
-
var MS_PER_HOUR5 = 36e5;
|
|
130725
|
-
var MS_PER_DAY4 = 864e5;
|
|
130726
|
-
var FIVE_HOUR_WINDOW_HOURS = 5;
|
|
130727
|
-
var SEVEN_DAY_WINDOW_DAYS = 7;
|
|
130728
|
-
var FIVE_HOUR_WINDOW_MS2 = FIVE_HOUR_WINDOW_HOURS * MS_PER_HOUR5;
|
|
130729
|
-
var SEVEN_DAY_WINDOW_MS2 = SEVEN_DAY_WINDOW_DAYS * MS_PER_DAY4;
|
|
130730
131241
|
var FINAL_SPAN_DENOMINATOR = 30;
|
|
130731
131242
|
var QUOTA_EXPIRING_WINDOW_FRACTION = 1 / FINAL_SPAN_DENOMINATOR;
|
|
130732
131243
|
function createQuotaExpiringPublisher(hub, deps) {
|
|
@@ -130746,11 +131257,11 @@ function createQuotaExpiringPublisher(hub, deps) {
|
|
|
130746
131257
|
const unified = snapshot.providers[provider]?.rateLimit?.unified;
|
|
130747
131258
|
const fiveHour = unified?.fiveHour;
|
|
130748
131259
|
if (fiveHour?.utilization !== void 0 && fiveHour.resetsAt !== void 0) {
|
|
130749
|
-
views.push({ provider, view: { window: "fiveHour", spanMs:
|
|
131260
|
+
views.push({ provider, view: { window: "fiveHour", spanMs: FIVE_HOUR_WINDOW_MS, utilization: fiveHour.utilization, resetsAtMs: Date.parse(fiveHour.resetsAt) } });
|
|
130750
131261
|
}
|
|
130751
131262
|
const sevenDay = unified?.sevenDay;
|
|
130752
131263
|
if (sevenDay?.utilization !== void 0 && sevenDay.resetsAt !== void 0) {
|
|
130753
|
-
views.push({ provider, view: { window: "sevenDay", spanMs:
|
|
131264
|
+
views.push({ provider, view: { window: "sevenDay", spanMs: SEVEN_DAY_WINDOW_MS, utilization: sevenDay.utilization, resetsAtMs: Date.parse(sevenDay.resetsAt) } });
|
|
130754
131265
|
}
|
|
130755
131266
|
}
|
|
130756
131267
|
return views;
|
|
@@ -131567,10 +132078,10 @@ function quotaHeaders(upstream) {
|
|
|
131567
132078
|
var EXHAUSTED_PERCENT = 100;
|
|
131568
132079
|
var FULL_PERCENT = 100;
|
|
131569
132080
|
var MINUTES_PER_HOUR3 = 60;
|
|
131570
|
-
var
|
|
132081
|
+
var FIVE_HOUR_WINDOW_HOURS = 5;
|
|
131571
132082
|
var HOURS_PER_DAY7 = 24;
|
|
131572
132083
|
var DAYS_PER_WEEK3 = 7;
|
|
131573
|
-
var FIVE_HOUR_MINUTES =
|
|
132084
|
+
var FIVE_HOUR_MINUTES = FIVE_HOUR_WINDOW_HOURS * MINUTES_PER_HOUR3;
|
|
131574
132085
|
var SEVEN_DAY_MINUTES = DAYS_PER_WEEK3 * HOURS_PER_DAY7 * MINUTES_PER_HOUR3;
|
|
131575
132086
|
function windowReadings(upstream, exhausted, quotaError) {
|
|
131576
132087
|
let fiveHour;
|
|
@@ -132434,7 +132945,7 @@ function createAntigravityRoute(ports) {
|
|
|
132434
132945
|
body: JSON.stringify({ type: "error", error: { type: "not_found_error", message: "no provider specified in path" } })
|
|
132435
132946
|
};
|
|
132436
132947
|
}
|
|
132437
|
-
const lookup = ports.loadProvider(providerName);
|
|
132948
|
+
const lookup = await ports.loadProvider(providerName);
|
|
132438
132949
|
if (!lookup.ok) {
|
|
132439
132950
|
return {
|
|
132440
132951
|
status: lookup.status,
|
|
@@ -132948,6 +133459,7 @@ function resolveAccountTarget(model, models) {
|
|
|
132948
133459
|
}
|
|
132949
133460
|
function createProviderRouteResolver(deps) {
|
|
132950
133461
|
const oauthRoute = createPassthroughRoute("anthropic", { baseUrl: `https://${CONNECT_INTERCEPT_HOST}:${String(HTTPS_PORT)}`, stripPrefix: void 0, headroomUpstream: void 0 });
|
|
133462
|
+
const resolveCredential2 = shareInFlightResolutions(resolveCredentialAsync);
|
|
132951
133463
|
const antigravityQuotaSources = /* @__PURE__ */ new Map();
|
|
132952
133464
|
const antigravityRoutingMemory = /* @__PURE__ */ new Map();
|
|
132953
133465
|
const definesProvider = (name) => {
|
|
@@ -132976,7 +133488,7 @@ function createProviderRouteResolver(deps) {
|
|
|
132976
133488
|
const source = createCachedAntigravityQuotaSource({
|
|
132977
133489
|
now: () => Date.now(),
|
|
132978
133490
|
fetchSummary: async (nowMs) => {
|
|
132979
|
-
const res =
|
|
133491
|
+
const res = await resolveCredential2({ credential: definition.credential, env: deps.env, port: deps.credentials, subject: `provider ${provider}` });
|
|
132980
133492
|
if (!res.ok) {
|
|
132981
133493
|
return void 0;
|
|
132982
133494
|
}
|
|
@@ -133042,8 +133554,8 @@ function createProviderRouteResolver(deps) {
|
|
|
133042
133554
|
ok: true,
|
|
133043
133555
|
route: createAntigravityRouteMount(
|
|
133044
133556
|
{
|
|
133045
|
-
loadProvider: () => {
|
|
133046
|
-
const res =
|
|
133557
|
+
loadProvider: async () => {
|
|
133558
|
+
const res = await resolveCredential2({
|
|
133047
133559
|
credential: antigravityProvider.credential,
|
|
133048
133560
|
env: deps.env,
|
|
133049
133561
|
port: deps.credentials,
|
|
@@ -133079,7 +133591,7 @@ function createProviderRouteResolver(deps) {
|
|
|
133079
133591
|
stripPrefix: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(provider)}`,
|
|
133080
133592
|
headroomUpstream: directOrigin2(deps.directPort())
|
|
133081
133593
|
}),
|
|
133082
|
-
{ provider, credential: httpProvider.credential, env: deps.env, port: deps.credentials }
|
|
133594
|
+
{ provider, credential: httpProvider.credential, env: deps.env, port: deps.credentials, resolve: resolveCredential2 }
|
|
133083
133595
|
)
|
|
133084
133596
|
};
|
|
133085
133597
|
};
|
|
@@ -133225,7 +133737,7 @@ function attachingProviderCredential(route, deps) {
|
|
|
133225
133737
|
headroomEligible: route.headroomEligible,
|
|
133226
133738
|
headroomUpstream: route.headroomUpstream,
|
|
133227
133739
|
serve: async (request7, response) => {
|
|
133228
|
-
const resolution =
|
|
133740
|
+
const resolution = await deps.resolve({ credential: deps.credential, env: deps.env, port: deps.port, subject: `provider ${deps.provider}` });
|
|
133229
133741
|
if (!resolution.ok) {
|
|
133230
133742
|
response.start(HTTP_STATUS.badGateway, { "Content-Type": "application/json" });
|
|
133231
133743
|
await response.write(
|
|
@@ -136267,7 +136779,7 @@ init_read();
|
|
|
136267
136779
|
function createRealQuotaRefresher(params) {
|
|
136268
136780
|
const { paths, store, log } = params;
|
|
136269
136781
|
return createQuotaRefresher({
|
|
136270
|
-
lookup: createProviderLookup({ fs: realFsPort, providersDir: paths.providersDir, env: process.env, credentials:
|
|
136782
|
+
lookup: createProviderLookup({ fs: realFsPort, providersDir: paths.providersDir, env: process.env, credentials: realAsyncCredentialPort }),
|
|
136271
136783
|
http: realQuotaHttpGet,
|
|
136272
136784
|
readQuota: (identity, provider) => {
|
|
136273
136785
|
try {
|
|
@@ -136385,7 +136897,7 @@ function realFrontDoorSupervisorPorts(paths, respawnGeneration, retire, trackTun
|
|
|
136385
136897
|
directPort: () => directPort,
|
|
136386
136898
|
// The same port (cache included) the launcher resolves a launch's provider with, so the credential the door attaches at the route and the one the launcher handed the child are the same resolution of the same block.
|
|
136387
136899
|
env: process.env,
|
|
136388
|
-
credentials: { ...
|
|
136900
|
+
credentials: { ...realAsyncCredentialPort, cache: realAsyncCredentialCacheEnv(paths) },
|
|
136389
136901
|
usageSnapshotOf: (identity) => identity === void 0 ? void 0 : routingSnapshots.get(identity) ?? readUsageSnapshot(realFarmFs, paths.usageSnapshotsDir, identity),
|
|
136390
136902
|
// An `acct:` model member is served by relaunch: the door leaves a move request for the session's supervisor (found across every pool's registry, since the door does not know which pool launched the session) and answers the request with what is happening. A session nothing supervises gets the message naming the command to run instead.
|
|
136391
136903
|
observations: (target) => observations.observation(target),
|
|
@@ -137111,7 +137623,7 @@ function enrichStatuslinePayload(params) {
|
|
|
137111
137623
|
plan = candidatePlan;
|
|
137112
137624
|
}
|
|
137113
137625
|
}
|
|
137114
|
-
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 }));
|
|
137626
|
+
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 }));
|
|
137115
137627
|
const providerBuckets = Object.fromEntries(
|
|
137116
137628
|
(scopedState?.quota?.windows ?? []).map((window) => [
|
|
137117
137629
|
window.measures,
|
|
@@ -137221,9 +137733,11 @@ var import_node_os12 = __toESM(require("node:os"), 1);
|
|
|
137221
137733
|
var RUN_TIMEOUT_MS = 2e3;
|
|
137222
137734
|
var RUN_MAX_BUFFER_BYTES = 1048576;
|
|
137223
137735
|
function realStatuslinePorts(env) {
|
|
137736
|
+
const { locale, timeZone } = Intl.DateTimeFormat().resolvedOptions();
|
|
137224
137737
|
return {
|
|
137225
137738
|
env,
|
|
137226
137739
|
homeDirectory: import_node_os12.default.homedir(),
|
|
137740
|
+
clock: { locale, timeZone },
|
|
137227
137741
|
readText: (path68) => {
|
|
137228
137742
|
try {
|
|
137229
137743
|
return import_node_fs22.default.readFileSync(path68, "utf8");
|
|
@@ -137281,11 +137795,33 @@ function realStatuslinePorts(env) {
|
|
|
137281
137795
|
init_statusline();
|
|
137282
137796
|
|
|
137283
137797
|
// src/statusline/ansi.ts
|
|
137798
|
+
init_string_width();
|
|
137799
|
+
init_graphemes();
|
|
137284
137800
|
var ESCAPE_CHAR_CODE = 27;
|
|
137285
137801
|
var ESCAPE = String.fromCharCode(ESCAPE_CHAR_CODE);
|
|
137286
|
-
var
|
|
137802
|
+
var BELL = "\\u0007";
|
|
137803
|
+
var ESCAPE_SEQUENCE_PATTERN = [`${ESCAPE}\\[[0-?]*[ -/]*[@-~]`, `${ESCAPE}\\][^${BELL}${ESCAPE}]*(?:${BELL}|${ESCAPE}\\\\)?`, `${ESCAPE}[@-Z\\\\-_]`].join("|");
|
|
137804
|
+
var SPLIT_ON_ESCAPES = new RegExp(`(${ESCAPE_SEQUENCE_PATTERN})`);
|
|
137287
137805
|
function visibleLength(text4) {
|
|
137288
|
-
return text4
|
|
137806
|
+
return stringWidth(text4);
|
|
137807
|
+
}
|
|
137808
|
+
function truncateToColumns(text4, columns) {
|
|
137809
|
+
let used = 0;
|
|
137810
|
+
let kept = "";
|
|
137811
|
+
text4.split(SPLIT_ON_ESCAPES).forEach((part, index) => {
|
|
137812
|
+
if (index % 2 === 1) {
|
|
137813
|
+
kept += part;
|
|
137814
|
+
return;
|
|
137815
|
+
}
|
|
137816
|
+
for (const grapheme of graphemesOf(part)) {
|
|
137817
|
+
used += visibleLength(grapheme);
|
|
137818
|
+
if (used > columns) {
|
|
137819
|
+
return;
|
|
137820
|
+
}
|
|
137821
|
+
kept += grapheme;
|
|
137822
|
+
}
|
|
137823
|
+
});
|
|
137824
|
+
return kept;
|
|
137289
137825
|
}
|
|
137290
137826
|
|
|
137291
137827
|
// src/statusline/barGrid.ts
|
|
@@ -137358,13 +137894,8 @@ function layoutBarGrid(groups, maxWidth, separator, baseBarCells) {
|
|
|
137358
137894
|
return renderGrid(layoutFor(1), maxWidth, separator, baseBarCells);
|
|
137359
137895
|
}
|
|
137360
137896
|
|
|
137361
|
-
// src/statusline/graphemes.ts
|
|
137362
|
-
var SEGMENTER = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
137363
|
-
function graphemesOf(text4) {
|
|
137364
|
-
return Array.from(SEGMENTER.segment(text4), (part) => part.segment);
|
|
137365
|
-
}
|
|
137366
|
-
|
|
137367
137897
|
// src/statusline/elements/header/account.ts
|
|
137898
|
+
init_graphemes();
|
|
137368
137899
|
function tierSuffixOf(tier) {
|
|
137369
137900
|
const match = /_(\d+x)$/i.exec(tier ?? "");
|
|
137370
137901
|
return match === null ? void 0 : match[1];
|
|
@@ -137432,15 +137963,29 @@ function accountSegment({ summary, settings: settings2 }) {
|
|
|
137432
137963
|
|
|
137433
137964
|
// src/statusline/sanitise.ts
|
|
137434
137965
|
init_statusline();
|
|
137435
|
-
|
|
137436
|
-
|
|
137437
|
-
var
|
|
137966
|
+
init_blank();
|
|
137967
|
+
init_graphemes();
|
|
137968
|
+
var ESCAPE_SEQUENCES = new RegExp(ESCAPE_SEQUENCE_PATTERN, "g");
|
|
137969
|
+
var CONTROL_AND_BIDI = /[\p{Cc}\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069\u206a-\u206f]/gu;
|
|
137438
137970
|
function sanitiseDisplayText(text4) {
|
|
137439
137971
|
return text4.replace(ESCAPE_SEQUENCES, "").replace(CONTROL_AND_BIDI, "");
|
|
137440
137972
|
}
|
|
137441
137973
|
function boundedDisplayText(text4) {
|
|
137442
137974
|
return graphemesOf(sanitiseDisplayText(text4).trim()).slice(0, MAX_DISPLAY_TEXT_CHARS).join("").trim();
|
|
137443
137975
|
}
|
|
137976
|
+
var TAG_SEQUENCE2 = "\\u{1F3F4}[\\u{E0020}-\\u{E007E}]+\\u{E007F}";
|
|
137977
|
+
var INVISIBLE_FORMAT = new RegExp(`(${TAG_SEQUENCE2})|(?![\\u200C\\u200D])\\p{Cf}`, "gu");
|
|
137978
|
+
var LINE_SEPARATORS = /[\u2028\u2029]/gu;
|
|
137979
|
+
var HANGUL_JAMO = "\\u1100-\\u115E\\u1161-\\u11FF\\uA960-\\uA97F\\uD7B0-\\uD7FF";
|
|
137980
|
+
var STANDALONE_HANGUL_FILLER = new RegExp(`(?<![${HANGUL_JAMO}])[\\u115F\\u1160](?![${HANGUL_JAMO}])`, "gu");
|
|
137981
|
+
function visibleDisplayText(text4) {
|
|
137982
|
+
const cleaned = sanitiseDisplayText(text4).replace(LINE_SEPARATORS, "").replace(BLANK_CELLS, " ").replace(STANDALONE_HANGUL_FILLER, " ").replace(INVISIBLE_FORMAT, (_match, tagSequence) => tagSequence ?? "");
|
|
137983
|
+
return graphemesOf(cleaned).map((grapheme) => {
|
|
137984
|
+
const body = grapheme.replace(/^ /u, "");
|
|
137985
|
+
const space = body === grapheme ? "" : " ";
|
|
137986
|
+
return drawsNothing(body) ? space : grapheme;
|
|
137987
|
+
}).join("").trim();
|
|
137988
|
+
}
|
|
137444
137989
|
|
|
137445
137990
|
// src/statusline/elements/header/advisor.ts
|
|
137446
137991
|
var MODEL_ID = /^(?:claude-)?(?:(\d{1,2})(?:-(\d{1,2}))?-)?(opus|sonnet|haiku)(?:-(\d{1,2})(?:-(\d{1,2}))?)?(?:-\d{8})?$/i;
|
|
@@ -137588,6 +138133,9 @@ function formatDuration(seconds) {
|
|
|
137588
138133
|
if (seconds === void 0 || seconds <= 0) {
|
|
137589
138134
|
return "available";
|
|
137590
138135
|
}
|
|
138136
|
+
if (seconds < SECONDS_PER_MINUTE2) {
|
|
138137
|
+
return `${String(seconds)}s`;
|
|
138138
|
+
}
|
|
137591
138139
|
const days = Math.floor(seconds / SECONDS_PER_DAY);
|
|
137592
138140
|
const hours = Math.floor(seconds % SECONDS_PER_DAY / (MINUTES_PER_HOUR4 * SECONDS_PER_MINUTE2));
|
|
137593
138141
|
const minutes = Math.floor(seconds % (MINUTES_PER_HOUR4 * SECONDS_PER_MINUTE2) / SECONDS_PER_MINUTE2);
|
|
@@ -138146,56 +138694,11 @@ function gitFilesRow(context) {
|
|
|
138146
138694
|
}
|
|
138147
138695
|
|
|
138148
138696
|
// src/statusline/elements/rows/quota.ts
|
|
138149
|
-
|
|
138150
|
-
|
|
138151
|
-
const style = barStyleOf(context, "usage");
|
|
138152
|
-
const cells = [];
|
|
138153
|
-
const drawWindow = (label2, fraction, resetsAt) => {
|
|
138154
|
-
const clamped = Math.max(0, Math.min(1, fraction));
|
|
138155
|
-
const color = statusColor(clamped, true, style);
|
|
138156
|
-
cells.push(barCell(palette.paint("label", `${label2} `), ` ${withColor(color, `${(fraction * FULL_PERCENT3).toFixed(1)}%`)} (${formatDuration(secondsUntil(resetsAt, nowMs))})`, clamped, style));
|
|
138157
|
-
};
|
|
138158
|
-
if (summary.quotaFamilies.length > 0) {
|
|
138159
|
-
for (const window of summary.quotaFamilies) {
|
|
138160
|
-
drawWindow(window.measures, window.utilization, window.resetsAt);
|
|
138161
|
-
}
|
|
138162
|
-
} else {
|
|
138163
|
-
if (summary.fiveHourUsed !== void 0) {
|
|
138164
|
-
drawWindow(settings2.labels.fiveHour, summary.fiveHourUsed / FULL_PERCENT3, summary.fiveHourResetAt);
|
|
138165
|
-
}
|
|
138166
|
-
if (summary.sevenDayUsed !== void 0) {
|
|
138167
|
-
drawWindow(settings2.labels.sevenDay, summary.sevenDayUsed / FULL_PERCENT3, summary.sevenDayResetAt);
|
|
138168
|
-
}
|
|
138169
|
-
if (summary.fiveHourUsed === void 0 && summary.sevenDayUsed === void 0) {
|
|
138170
|
-
for (const window of summary.providerQuotaWindows) {
|
|
138171
|
-
drawWindow(window.measures, window.utilization, window.resetsAt);
|
|
138172
|
-
}
|
|
138173
|
-
}
|
|
138174
|
-
}
|
|
138175
|
-
return { kind: "bars", cells };
|
|
138176
|
-
}
|
|
138177
|
-
|
|
138178
|
-
// src/statusline/elements/registry.ts
|
|
138179
|
-
var HEADER_ROLES = {
|
|
138180
|
-
model: "model",
|
|
138181
|
-
provider: "model",
|
|
138182
|
-
route: "label",
|
|
138183
|
-
account: "label",
|
|
138184
|
-
identity: "label",
|
|
138185
|
-
headroom: "label",
|
|
138186
|
-
project: "project",
|
|
138187
|
-
vcs: "git",
|
|
138188
|
-
effort: "model",
|
|
138189
|
-
advisor: "label",
|
|
138190
|
-
version: "label",
|
|
138191
|
-
outputStyle: "label"
|
|
138192
|
-
};
|
|
138193
|
-
var ELEMENTS = {
|
|
138194
|
-
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 },
|
|
138195
|
-
rows: { context: contextRow, quota: quotaRow, addedDirs: addedDirsRow, gitFiles: gitFilesRow }
|
|
138196
|
-
};
|
|
138697
|
+
init_statusline();
|
|
138698
|
+
init_pick();
|
|
138197
138699
|
|
|
138198
138700
|
// src/statusline/headerLayout.ts
|
|
138701
|
+
var SEPARATOR2 = " | ";
|
|
138199
138702
|
function headerUnits(parts, overflow) {
|
|
138200
138703
|
const units = [];
|
|
138201
138704
|
parts.forEach((part, index) => {
|
|
@@ -138235,7 +138738,7 @@ function justify(texts, maxWidth, separator) {
|
|
|
138235
138738
|
});
|
|
138236
138739
|
return parts.join("");
|
|
138237
138740
|
}
|
|
138238
|
-
function
|
|
138741
|
+
function packLines(texts, maxWidth, separator) {
|
|
138239
138742
|
const separatorLength = visibleLength(separator);
|
|
138240
138743
|
const lines = [];
|
|
138241
138744
|
let current = [];
|
|
@@ -138255,8 +138758,175 @@ function layoutHeader(texts, maxWidth, separator) {
|
|
|
138255
138758
|
if (current.length > 0) {
|
|
138256
138759
|
lines.push(current);
|
|
138257
138760
|
}
|
|
138258
|
-
return lines
|
|
138761
|
+
return lines;
|
|
138762
|
+
}
|
|
138763
|
+
function layoutHeader(texts, maxWidth, separator) {
|
|
138764
|
+
return packLines(texts, maxWidth, separator).map((line) => justify(line, maxWidth, separator)).join("\n");
|
|
138765
|
+
}
|
|
138766
|
+
|
|
138767
|
+
// src/statusline/wallClock.ts
|
|
138768
|
+
var DAY_KEY_LOCALE = "en-CA";
|
|
138769
|
+
var FORMATTERS = /* @__PURE__ */ new Map();
|
|
138770
|
+
function formatterFor(locale, options) {
|
|
138771
|
+
const key = JSON.stringify([locale, options]);
|
|
138772
|
+
let formatter = FORMATTERS.get(key);
|
|
138773
|
+
if (formatter === void 0) {
|
|
138774
|
+
formatter = new Intl.DateTimeFormat(locale, options);
|
|
138775
|
+
FORMATTERS.set(key, formatter);
|
|
138776
|
+
}
|
|
138777
|
+
return formatter;
|
|
138778
|
+
}
|
|
138779
|
+
function formatWallClock(atMs, nowMs, clock, settings2) {
|
|
138780
|
+
const { locale, timeZone } = clock;
|
|
138781
|
+
const time4 = formatterFor(locale, {
|
|
138782
|
+
timeZone,
|
|
138783
|
+
timeStyle: settings2.seconds ? "medium" : "short",
|
|
138784
|
+
...settings2.hourCycle === "auto" ? {} : { hourCycle: settings2.hourCycle }
|
|
138785
|
+
}).format(atMs);
|
|
138786
|
+
const dayKey = formatterFor(DAY_KEY_LOCALE, { timeZone, year: "numeric", month: "numeric", day: "numeric" });
|
|
138787
|
+
if (dayKey.format(atMs) === dayKey.format(nowMs)) {
|
|
138788
|
+
return time4;
|
|
138789
|
+
}
|
|
138790
|
+
return `${formatterFor(locale, { timeZone, month: "short", day: "numeric" }).format(atMs)} ${time4}`;
|
|
138791
|
+
}
|
|
138792
|
+
|
|
138793
|
+
// src/statusline/resetTime.ts
|
|
138794
|
+
var AVAILABLE = formatDuration(void 0);
|
|
138795
|
+
function elapsedPercent(resetMs, periodMs, nowMs) {
|
|
138796
|
+
if (!Number.isFinite(resetMs) || periodMs === void 0) {
|
|
138797
|
+
return void 0;
|
|
138798
|
+
}
|
|
138799
|
+
const share = (nowMs - (resetMs - periodMs)) / periodMs * FULL_PERCENT3;
|
|
138800
|
+
return Math.max(0, Math.min(FULL_PERCENT3, Math.round(share)));
|
|
138801
|
+
}
|
|
138802
|
+
function formatResetTime(window, nowMs, settings2, clock) {
|
|
138803
|
+
const resetMs = window.resetsAt === void 0 ? Number.NaN : Date.parse(window.resetsAt);
|
|
138804
|
+
const secondsLeft = secondsUntil(window.resetsAt, nowMs);
|
|
138805
|
+
const pending = secondsLeft !== void 0 && secondsLeft > 0;
|
|
138806
|
+
const relative = formatDuration(secondsLeft);
|
|
138807
|
+
const absolute = pending ? `at ${formatWallClock(resetMs, nowMs, clock, settings2.clock)}` : AVAILABLE;
|
|
138808
|
+
const elapsed = elapsedPercent(resetMs, window.periodMs, nowMs);
|
|
138809
|
+
const elapsedText = elapsed === void 0 ? void 0 : `${String(elapsed)}% elapsed`;
|
|
138810
|
+
switch (settings2.usage.timeFormat) {
|
|
138811
|
+
case "relative":
|
|
138812
|
+
return { text: relative, pending };
|
|
138813
|
+
case "absolute":
|
|
138814
|
+
return { text: absolute, pending };
|
|
138815
|
+
case "both":
|
|
138816
|
+
return { text: pending ? `${relative}, ${absolute}` : AVAILABLE, pending };
|
|
138817
|
+
case "elapsed":
|
|
138818
|
+
return { text: elapsedText ?? "", pending };
|
|
138819
|
+
case "elapsedAndAbsolute":
|
|
138820
|
+
return { text: [elapsedText, pending ? absolute : void 0].filter((part) => part !== void 0).join(", "), pending };
|
|
138821
|
+
default:
|
|
138822
|
+
return settings2.usage.timeFormat;
|
|
138823
|
+
}
|
|
138824
|
+
}
|
|
138825
|
+
|
|
138826
|
+
// src/statusline/elements/rows/quota.ts
|
|
138827
|
+
function safeLabel(label2) {
|
|
138828
|
+
return truncateToColumns(visibleDisplayText(label2), MAX_STATUSLINE_LABEL_COLUMNS).trim();
|
|
138829
|
+
}
|
|
138830
|
+
function modelScopedWindows({ payload }) {
|
|
138831
|
+
return (payload.rate_limits?.model_scoped ?? []).flatMap((window) => {
|
|
138832
|
+
const label2 = safeLabel(window.display_name ?? "");
|
|
138833
|
+
if (label2 === "" || window.utilization === void 0 || !Number.isFinite(window.utilization)) {
|
|
138834
|
+
return [];
|
|
138835
|
+
}
|
|
138836
|
+
return [{ label: label2, fraction: window.utilization / FULL_PERCENT3, resetsAt: window.resets_at, periodMs: SEVEN_DAY_WINDOW_MS, weekly: false }];
|
|
138837
|
+
});
|
|
138838
|
+
}
|
|
138839
|
+
function candidateWindows(context) {
|
|
138840
|
+
const { summary, settings: settings2 } = context;
|
|
138841
|
+
if (summary.quotaFamilies.length > 0) {
|
|
138842
|
+
return summary.quotaFamilies.map((window) => ({ label: window.measures, fraction: window.utilization, resetsAt: window.resetsAt, periodMs: void 0, weekly: false }));
|
|
138843
|
+
}
|
|
138844
|
+
const windows = [];
|
|
138845
|
+
if (summary.fiveHourUsed !== void 0) {
|
|
138846
|
+
windows.push({ label: settings2.labels.fiveHour, fraction: summary.fiveHourUsed / FULL_PERCENT3, resetsAt: summary.fiveHourResetAt, periodMs: FIVE_HOUR_WINDOW_MS, weekly: false });
|
|
138847
|
+
}
|
|
138848
|
+
if (summary.sevenDayUsed !== void 0) {
|
|
138849
|
+
windows.push({ label: settings2.labels.sevenDay, fraction: summary.sevenDayUsed / FULL_PERCENT3, resetsAt: summary.sevenDayResetAt, periodMs: SEVEN_DAY_WINDOW_MS, weekly: true });
|
|
138850
|
+
}
|
|
138851
|
+
if (summary.fiveHourUsed === void 0 && summary.sevenDayUsed === void 0) {
|
|
138852
|
+
windows.push(...summary.providerQuotaWindows.map((window) => ({ label: window.measures, fraction: window.utilization, resetsAt: window.resetsAt, periodMs: window.periodMs, weekly: false })));
|
|
138853
|
+
}
|
|
138854
|
+
if (settings2.usage.modelScoped && summary.provider === void 0) {
|
|
138855
|
+
windows.push(...modelScopedWindows(context));
|
|
138856
|
+
}
|
|
138857
|
+
return windows;
|
|
138858
|
+
}
|
|
138859
|
+
function visibleWindows(context) {
|
|
138860
|
+
const { summary, settings: settings2 } = context;
|
|
138861
|
+
const candidates = candidateWindows(context);
|
|
138862
|
+
const mostUsed = Math.max(0, ...candidates.map((window) => window.fraction * FULL_PERCENT3));
|
|
138863
|
+
if (mostUsed < settings2.usage.threshold) {
|
|
138864
|
+
return [];
|
|
138865
|
+
}
|
|
138866
|
+
const hidesWeekly = summary.fiveHourUsed !== void 0 && summary.sevenDayUsed !== void 0 && summary.sevenDayUsed < settings2.usage.sevenDayThreshold;
|
|
138867
|
+
return hidesWeekly ? candidates.filter((window) => !window.weekly) : candidates;
|
|
138868
|
+
}
|
|
138869
|
+
function figuresOf(window, context, style) {
|
|
138870
|
+
const { settings: settings2, nowMs, ports } = context;
|
|
138871
|
+
const clamped = Math.max(0, Math.min(1, window.fraction));
|
|
138872
|
+
const used = window.fraction * FULL_PERCENT3;
|
|
138873
|
+
const shown = settings2.usage.value === "remaining" ? Math.max(0, FULL_PERCENT3 - used) : used;
|
|
138874
|
+
const { text: text4, pending } = formatResetTime(window, nowMs, settings2, ports.clock);
|
|
138875
|
+
return { value: withColor(statusColor(clamped, true, style), `${shown.toFixed(1)}%`), reset: text4, pending };
|
|
138876
|
+
}
|
|
138877
|
+
function resetSuffix(reset, pending, context) {
|
|
138878
|
+
if (reset === "") {
|
|
138879
|
+
return "";
|
|
138880
|
+
}
|
|
138881
|
+
const { usage } = context.settings;
|
|
138882
|
+
const elapsedForm = usage.timeFormat === "elapsed" || usage.timeFormat === "elapsedAndAbsolute";
|
|
138883
|
+
if (!usage.resetLabel || !pending || elapsedForm) {
|
|
138884
|
+
return `(${reset})`;
|
|
138885
|
+
}
|
|
138886
|
+
return `(${usage.timeFormat === "absolute" ? "resets" : "resets in"} ${reset})`;
|
|
138259
138887
|
}
|
|
138888
|
+
function wrapped(windows, width) {
|
|
138889
|
+
return packLines(windows, width, SEPARATOR2).map((line) => line.join(SEPARATOR2));
|
|
138890
|
+
}
|
|
138891
|
+
function quotaRow(context) {
|
|
138892
|
+
const { palette, settings: settings2 } = context;
|
|
138893
|
+
const style = barStyleOf(context, "usage");
|
|
138894
|
+
const windows = visibleWindows(context);
|
|
138895
|
+
const parts = windows.map((window) => {
|
|
138896
|
+
const { value: value2, reset, pending } = figuresOf(window, context, style);
|
|
138897
|
+
return { window, value: value2, reset, suffix: resetSuffix(reset, pending, context) };
|
|
138898
|
+
});
|
|
138899
|
+
if (settings2.usage.compact) {
|
|
138900
|
+
const lines = parts.map(({ window, value: value2, reset }) => `${palette.paint("label", `${window.label}:`)} ${value2}${reset === "" ? "" : ` ${palette.paint("label", `(${reset})`)}`}`);
|
|
138901
|
+
return { kind: "text", lines: wrapped(lines, context.width) };
|
|
138902
|
+
}
|
|
138903
|
+
if (!settings2.usage.bar) {
|
|
138904
|
+
const lines = parts.map(({ window, value: value2, suffix }) => `${palette.paint("label", `${window.label} `)}${value2}${suffix === "" ? "" : ` ${suffix}`}`);
|
|
138905
|
+
return { kind: "text", lines: wrapped(lines, context.width) };
|
|
138906
|
+
}
|
|
138907
|
+
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));
|
|
138908
|
+
return { kind: "bars", cells };
|
|
138909
|
+
}
|
|
138910
|
+
|
|
138911
|
+
// src/statusline/elements/registry.ts
|
|
138912
|
+
var HEADER_ROLES = {
|
|
138913
|
+
model: "model",
|
|
138914
|
+
provider: "model",
|
|
138915
|
+
route: "label",
|
|
138916
|
+
account: "label",
|
|
138917
|
+
identity: "label",
|
|
138918
|
+
headroom: "label",
|
|
138919
|
+
project: "project",
|
|
138920
|
+
vcs: "git",
|
|
138921
|
+
effort: "model",
|
|
138922
|
+
advisor: "label",
|
|
138923
|
+
version: "label",
|
|
138924
|
+
outputStyle: "label"
|
|
138925
|
+
};
|
|
138926
|
+
var ELEMENTS = {
|
|
138927
|
+
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 },
|
|
138928
|
+
rows: { context: contextRow, quota: quotaRow, addedDirs: addedDirsRow, gitFiles: gitFilesRow }
|
|
138929
|
+
};
|
|
138260
138930
|
|
|
138261
138931
|
// src/statusline/identityTranscript.ts
|
|
138262
138932
|
init_zod();
|
|
@@ -138350,7 +139020,6 @@ function readTranscriptIdentity(ports, transcriptPath) {
|
|
|
138350
139020
|
|
|
138351
139021
|
// src/statusline/render.ts
|
|
138352
139022
|
var RESERVED_COLUMNS = 4;
|
|
138353
|
-
var SEPARATOR2 = " | ";
|
|
138354
139023
|
function once2(read) {
|
|
138355
139024
|
let kept;
|
|
138356
139025
|
return () => {
|
|
@@ -138360,12 +139029,14 @@ function once2(read) {
|
|
|
138360
139029
|
}
|
|
138361
139030
|
function renderStatuslineBlock(input2) {
|
|
138362
139031
|
const { terminalWidth, settings: settings2 = STATUSLINE_DEFAULTS, elements = ELEMENTS } = input2;
|
|
139032
|
+
const width = Math.max(TWENTY, terminalWidth - RESERVED_COLUMNS);
|
|
138363
139033
|
const context = {
|
|
138364
139034
|
summary: input2.summary,
|
|
138365
139035
|
view: input2.view,
|
|
138366
139036
|
payload: input2.payload,
|
|
138367
139037
|
nowMs: input2.nowMs,
|
|
138368
139038
|
terminalWidth,
|
|
139039
|
+
width,
|
|
138369
139040
|
settings: settings2,
|
|
138370
139041
|
palette: createPalette(settings2.colours, colourEnabled(input2.ports.env)),
|
|
138371
139042
|
ports: input2.ports,
|
|
@@ -138376,7 +139047,6 @@ function renderStatuslineBlock(input2) {
|
|
|
138376
139047
|
return text4 === void 0 ? [] : { name, text: context.palette.paint(HEADER_ROLES[name], text4) };
|
|
138377
139048
|
});
|
|
138378
139049
|
const header = headerUnits(parts, settings2.git.branchOverflow);
|
|
138379
|
-
const width = Math.max(TWENTY, terminalWidth - RESERVED_COLUMNS);
|
|
138380
139050
|
const lines = [];
|
|
138381
139051
|
if (header.length > 0) {
|
|
138382
139052
|
lines.push(layoutHeader(header, width, SEPARATOR2));
|
|
@@ -141043,13 +141713,13 @@ function timeRegex(args) {
|
|
|
141043
141713
|
return new RegExp(`^${timeRegexSource(args)}$`);
|
|
141044
141714
|
}
|
|
141045
141715
|
function datetimeRegex(args) {
|
|
141046
|
-
let
|
|
141716
|
+
let regex2 = `${dateRegexSource}T${timeRegexSource(args)}`;
|
|
141047
141717
|
const opts = [];
|
|
141048
141718
|
opts.push(args.local ? `Z?` : `Z`);
|
|
141049
141719
|
if (args.offset)
|
|
141050
141720
|
opts.push(`([+-]\\d{2}:?\\d{2})`);
|
|
141051
|
-
|
|
141052
|
-
return new RegExp(`^${
|
|
141721
|
+
regex2 = `${regex2}(${opts.join("|")})`;
|
|
141722
|
+
return new RegExp(`^${regex2}$`);
|
|
141053
141723
|
}
|
|
141054
141724
|
function isValidIP(ip2, version2) {
|
|
141055
141725
|
if ((version2 === "v4" || !version2) && ipv4Regex.test(ip2)) {
|
|
@@ -141295,8 +141965,8 @@ var ZodString2 = class _ZodString2 extends ZodType2 {
|
|
|
141295
141965
|
status.dirty();
|
|
141296
141966
|
}
|
|
141297
141967
|
} else if (check2.kind === "datetime") {
|
|
141298
|
-
const
|
|
141299
|
-
if (!
|
|
141968
|
+
const regex2 = datetimeRegex(check2);
|
|
141969
|
+
if (!regex2.test(input2.data)) {
|
|
141300
141970
|
ctx = this._getOrReturnCtx(input2, ctx);
|
|
141301
141971
|
addIssueToContext(ctx, {
|
|
141302
141972
|
code: ZodIssueCode2.invalid_string,
|
|
@@ -141306,8 +141976,8 @@ var ZodString2 = class _ZodString2 extends ZodType2 {
|
|
|
141306
141976
|
status.dirty();
|
|
141307
141977
|
}
|
|
141308
141978
|
} else if (check2.kind === "date") {
|
|
141309
|
-
const
|
|
141310
|
-
if (!
|
|
141979
|
+
const regex2 = dateRegex;
|
|
141980
|
+
if (!regex2.test(input2.data)) {
|
|
141311
141981
|
ctx = this._getOrReturnCtx(input2, ctx);
|
|
141312
141982
|
addIssueToContext(ctx, {
|
|
141313
141983
|
code: ZodIssueCode2.invalid_string,
|
|
@@ -141317,8 +141987,8 @@ var ZodString2 = class _ZodString2 extends ZodType2 {
|
|
|
141317
141987
|
status.dirty();
|
|
141318
141988
|
}
|
|
141319
141989
|
} else if (check2.kind === "time") {
|
|
141320
|
-
const
|
|
141321
|
-
if (!
|
|
141990
|
+
const regex2 = timeRegex(check2);
|
|
141991
|
+
if (!regex2.test(input2.data)) {
|
|
141322
141992
|
ctx = this._getOrReturnCtx(input2, ctx);
|
|
141323
141993
|
addIssueToContext(ctx, {
|
|
141324
141994
|
code: ZodIssueCode2.invalid_string,
|
|
@@ -141393,8 +142063,8 @@ var ZodString2 = class _ZodString2 extends ZodType2 {
|
|
|
141393
142063
|
}
|
|
141394
142064
|
return { status: status.value, value: input2.data };
|
|
141395
142065
|
}
|
|
141396
|
-
_regex(
|
|
141397
|
-
return this.refinement((data) =>
|
|
142066
|
+
_regex(regex2, validation, message) {
|
|
142067
|
+
return this.refinement((data) => regex2.test(data), {
|
|
141398
142068
|
validation,
|
|
141399
142069
|
code: ZodIssueCode2.invalid_string,
|
|
141400
142070
|
...errorUtil.errToObj(message)
|
|
@@ -141486,10 +142156,10 @@ var ZodString2 = class _ZodString2 extends ZodType2 {
|
|
|
141486
142156
|
duration(message) {
|
|
141487
142157
|
return this._addCheck({ kind: "duration", ...errorUtil.errToObj(message) });
|
|
141488
142158
|
}
|
|
141489
|
-
regex(
|
|
142159
|
+
regex(regex2, message) {
|
|
141490
142160
|
return this._addCheck({
|
|
141491
142161
|
kind: "regex",
|
|
141492
|
-
regex,
|
|
142162
|
+
regex: regex2,
|
|
141493
142163
|
...errorUtil.errToObj(message)
|
|
141494
142164
|
});
|
|
141495
142165
|
}
|
|
@@ -144863,7 +145533,7 @@ function addFormat(schema, value2, message, refs) {
|
|
|
144863
145533
|
setResponseValueAndErrors(schema, "format", value2, message, refs);
|
|
144864
145534
|
}
|
|
144865
145535
|
}
|
|
144866
|
-
function addPattern2(schema,
|
|
145536
|
+
function addPattern2(schema, regex2, message, refs) {
|
|
144867
145537
|
if (schema.pattern || schema.allOf?.some((x) => x.pattern)) {
|
|
144868
145538
|
if (!schema.allOf) {
|
|
144869
145539
|
schema.allOf = [];
|
|
@@ -144884,24 +145554,24 @@ function addPattern2(schema, regex, message, refs) {
|
|
|
144884
145554
|
}
|
|
144885
145555
|
}
|
|
144886
145556
|
schema.allOf.push({
|
|
144887
|
-
pattern: stringifyRegExpWithFlags(
|
|
145557
|
+
pattern: stringifyRegExpWithFlags(regex2, refs),
|
|
144888
145558
|
...message && refs.errorMessages && { errorMessage: { pattern: message } }
|
|
144889
145559
|
});
|
|
144890
145560
|
} else {
|
|
144891
|
-
setResponseValueAndErrors(schema, "pattern", stringifyRegExpWithFlags(
|
|
145561
|
+
setResponseValueAndErrors(schema, "pattern", stringifyRegExpWithFlags(regex2, refs), message, refs);
|
|
144892
145562
|
}
|
|
144893
145563
|
}
|
|
144894
|
-
function stringifyRegExpWithFlags(
|
|
144895
|
-
if (!refs.applyRegexFlags || !
|
|
144896
|
-
return
|
|
145564
|
+
function stringifyRegExpWithFlags(regex2, refs) {
|
|
145565
|
+
if (!refs.applyRegexFlags || !regex2.flags) {
|
|
145566
|
+
return regex2.source;
|
|
144897
145567
|
}
|
|
144898
145568
|
const flags = {
|
|
144899
|
-
i:
|
|
144900
|
-
m:
|
|
144901
|
-
s:
|
|
145569
|
+
i: regex2.flags.includes("i"),
|
|
145570
|
+
m: regex2.flags.includes("m"),
|
|
145571
|
+
s: regex2.flags.includes("s")
|
|
144902
145572
|
// `.` matches newlines
|
|
144903
145573
|
};
|
|
144904
|
-
const source = flags.i ?
|
|
145574
|
+
const source = flags.i ? regex2.source.toLowerCase() : regex2.source;
|
|
144905
145575
|
let pattern = "";
|
|
144906
145576
|
let isEscaped = false;
|
|
144907
145577
|
let inCharGroup = false;
|
|
@@ -144962,7 +145632,7 @@ function stringifyRegExpWithFlags(regex, refs) {
|
|
|
144962
145632
|
new RegExp(pattern);
|
|
144963
145633
|
} catch {
|
|
144964
145634
|
console.warn(`Could not convert regex pattern at ${refs.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`);
|
|
144965
|
-
return
|
|
145635
|
+
return regex2.source;
|
|
144966
145636
|
}
|
|
144967
145637
|
return pattern;
|
|
144968
145638
|
}
|