claude-use 11.50.2 → 11.52.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/README.md +2 -2
- package/dist/cli.cjs +589 -263
- package/dist/index.cjs +682 -516
- package/dist/index.mjs +675 -510
- package/dist/types/index.d.ts +4165 -434
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -23995,7 +23995,7 @@ var require_merge2 = __commonJS({
|
|
|
23995
23995
|
exports2.mergeAll = exports2.hasOwn = void 0;
|
|
23996
23996
|
exports2.hasOwn = Function.prototype.call.bind(Object.prototype.hasOwnProperty);
|
|
23997
23997
|
var objToString = Function.prototype.call.bind(Object.prototype.toString);
|
|
23998
|
-
function
|
|
23998
|
+
function isPlainObject5(obj) {
|
|
23999
23999
|
return objToString(obj) === "[object Object]";
|
|
24000
24000
|
}
|
|
24001
24001
|
function merge2(target, source, options) {
|
|
@@ -24010,7 +24010,7 @@ var require_merge2 = __commonJS({
|
|
|
24010
24010
|
target[key].push(...newValue);
|
|
24011
24011
|
continue;
|
|
24012
24012
|
}
|
|
24013
|
-
} else if (
|
|
24013
|
+
} else if (isPlainObject5(target[key]) && isPlainObject5(newValue)) {
|
|
24014
24014
|
target[key] = merge2(target[key], newValue, options);
|
|
24015
24015
|
continue;
|
|
24016
24016
|
}
|
|
@@ -25040,59 +25040,124 @@ var init_proxyBypass = __esm({
|
|
|
25040
25040
|
function distinctList(member) {
|
|
25041
25041
|
return external_exports.array(member).refine((items) => new Set(items).size === items.length, "must not repeat a segment");
|
|
25042
25042
|
}
|
|
25043
|
+
function isSingleVisibleGrapheme(text2) {
|
|
25044
|
+
return [...GRAPHEMES.segment(text2)].length === 1 && !/[\p{C}\p{Z}]/u.test(text2);
|
|
25045
|
+
}
|
|
25046
|
+
function isPlainObject2(value2) {
|
|
25047
|
+
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
25048
|
+
}
|
|
25049
|
+
function mergeStatuslineSettings(base, over) {
|
|
25050
|
+
if (!isPlainObject2(base) || !isPlainObject2(over)) {
|
|
25051
|
+
return over === void 0 ? base : over;
|
|
25052
|
+
}
|
|
25053
|
+
const merged = { ...base };
|
|
25054
|
+
for (const [key, value2] of Object.entries(over)) {
|
|
25055
|
+
merged[key] = key in base ? mergeStatuslineSettings(base[key], value2) : value2;
|
|
25056
|
+
}
|
|
25057
|
+
return merged;
|
|
25058
|
+
}
|
|
25043
25059
|
function resolveStatusline(settings2) {
|
|
25044
|
-
const resolved =
|
|
25045
|
-
|
|
25046
|
-
|
|
25047
|
-
warnAt: settings2?.warnAt ?? STATUSLINE_DEFAULTS.warnAt,
|
|
25048
|
-
criticalAt: settings2?.criticalAt ?? STATUSLINE_DEFAULTS.criticalAt,
|
|
25049
|
-
fiveHourLabel: settings2?.fiveHourLabel ?? STATUSLINE_DEFAULTS.fiveHourLabel,
|
|
25050
|
-
sevenDayLabel: settings2?.sevenDayLabel ?? STATUSLINE_DEFAULTS.sevenDayLabel,
|
|
25051
|
-
barWidth: settings2?.barWidth ?? STATUSLINE_DEFAULTS.barWidth
|
|
25052
|
-
};
|
|
25053
|
-
if (resolved.warnAt >= resolved.criticalAt) {
|
|
25054
|
-
throw new RangeError(`statusline warnAt (${String(resolved.warnAt)}) must be below criticalAt (${String(resolved.criticalAt)})`);
|
|
25060
|
+
const resolved = ResolvedStatuslineSchema.parse(mergeStatuslineSettings(STATUSLINE_DEFAULTS, settings2));
|
|
25061
|
+
if (resolved.bands.warnAt >= resolved.bands.criticalAt) {
|
|
25062
|
+
throw new RangeError(`statusline bands.warnAt (${String(resolved.bands.warnAt)}) must be below bands.criticalAt (${String(resolved.bands.criticalAt)})`);
|
|
25055
25063
|
}
|
|
25056
25064
|
return resolved;
|
|
25057
25065
|
}
|
|
25058
|
-
var STATUSLINE_HEADER_SEGMENTS,
|
|
25066
|
+
var STATUSLINE_HEADER_SEGMENTS, STATUSLINE_ROWS, STATUSLINE_COLOUR_NAMES, MAX_PERCENT, MAX_STATUSLINE_PALETTE_INDEX, MAX_STATUSLINE_LABEL_CHARS, MAX_BAR_CELLS, LABEL_RE2, colourValue, GRAPHEMES, barCharacter, labelText, wholePercent, SHAPES, StatuslineSchema, ResolvedStatuslineSchema, STATUSLINE_DEFAULTS, STATUSLINE_ENV;
|
|
25059
25067
|
var init_statusline = __esm({
|
|
25060
25068
|
"src/config/statusline.ts"() {
|
|
25061
25069
|
"use strict";
|
|
25062
25070
|
init_zod();
|
|
25063
25071
|
STATUSLINE_HEADER_SEGMENTS = ["model", "provider", "route", "account", "identity", "headroom"];
|
|
25064
|
-
|
|
25072
|
+
STATUSLINE_ROWS = ["context", "quota"];
|
|
25073
|
+
STATUSLINE_COLOUR_NAMES = [
|
|
25074
|
+
"default",
|
|
25075
|
+
"dim",
|
|
25076
|
+
"black",
|
|
25077
|
+
"red",
|
|
25078
|
+
"green",
|
|
25079
|
+
"yellow",
|
|
25080
|
+
"blue",
|
|
25081
|
+
"magenta",
|
|
25082
|
+
"cyan",
|
|
25083
|
+
"white",
|
|
25084
|
+
"brightBlack",
|
|
25085
|
+
"brightRed",
|
|
25086
|
+
"brightGreen",
|
|
25087
|
+
"brightYellow",
|
|
25088
|
+
"brightBlue",
|
|
25089
|
+
"brightMagenta",
|
|
25090
|
+
"brightCyan",
|
|
25091
|
+
"brightWhite"
|
|
25092
|
+
];
|
|
25065
25093
|
MAX_PERCENT = 100;
|
|
25094
|
+
MAX_STATUSLINE_PALETTE_INDEX = 255;
|
|
25066
25095
|
MAX_STATUSLINE_LABEL_CHARS = 12;
|
|
25067
25096
|
MAX_BAR_CELLS = 40;
|
|
25068
25097
|
LABEL_RE2 = /^[^\p{C}\p{Z}]+(?: [^\p{C}\p{Z}]+)*$/u;
|
|
25098
|
+
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")]);
|
|
25099
|
+
GRAPHEMES = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
25100
|
+
barCharacter = external_exports.string().refine(isSingleVisibleGrapheme, "must be a single visible character");
|
|
25101
|
+
labelText = external_exports.string().max(MAX_STATUSLINE_LABEL_CHARS).regex(LABEL_RE2, "must be visible text without control characters");
|
|
25069
25102
|
wholePercent = external_exports.number().int().min(1).max(MAX_PERCENT);
|
|
25103
|
+
SHAPES = {
|
|
25104
|
+
layout: {
|
|
25105
|
+
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."),
|
|
25106
|
+
rows: distinctList(external_exports.enum(STATUSLINE_ROWS)).describe("The rows to draw below the header, in drawing order; a row left out is hidden, and an empty list hides every row.")
|
|
25107
|
+
},
|
|
25108
|
+
bands: {
|
|
25109
|
+
warnAt: wholePercent.describe("The whole percentage of use at which a bar turns yellow; it must be below criticalAt."),
|
|
25110
|
+
criticalAt: wholePercent.describe("The whole percentage of use at which a bar turns red.")
|
|
25111
|
+
},
|
|
25112
|
+
labels: {
|
|
25113
|
+
fiveHour: labelText.describe("The name of the five-hour subscription window."),
|
|
25114
|
+
sevenDay: labelText.describe("The name of the weekly subscription window.")
|
|
25115
|
+
},
|
|
25116
|
+
bar: {
|
|
25117
|
+
width: external_exports.number().int().min(1).max(MAX_BAR_CELLS).describe("A bar's width in cells before the line's spare width is shared out among the bars."),
|
|
25118
|
+
filled: barCharacter.describe("The character that draws the used part of a bar."),
|
|
25119
|
+
empty: barCharacter.describe("The character that draws the unused part of a bar.")
|
|
25120
|
+
},
|
|
25121
|
+
colours: {
|
|
25122
|
+
context: colourValue.describe("The colour of the context bar and its figures below the warning threshold."),
|
|
25123
|
+
usage: colourValue.describe("The colour of the quota bars and their figures below the warning threshold."),
|
|
25124
|
+
warning: colourValue.describe("The colour of the context bar at or above bands.warnAt, and of a cache hit share that is middling."),
|
|
25125
|
+
usageWarning: colourValue.describe("The colour of a quota bar at or above bands.warnAt."),
|
|
25126
|
+
critical: colourValue.describe("The colour of a bar at or above bands.criticalAt, and of a cache hit share that is nearly nothing."),
|
|
25127
|
+
model: colourValue.describe("The colour of the model and provider segments."),
|
|
25128
|
+
label: colourValue.describe("The colour of labels and secondary text: row labels, and the route, account, identity and headroom segments."),
|
|
25129
|
+
empty: colourValue.describe("The colour of the unused part of a bar.")
|
|
25130
|
+
}
|
|
25131
|
+
};
|
|
25070
25132
|
StatuslineSchema = external_exports.strictObject({
|
|
25071
|
-
|
|
25072
|
-
|
|
25073
|
-
|
|
25074
|
-
|
|
25075
|
-
|
|
25076
|
-
|
|
25077
|
-
|
|
25078
|
-
|
|
25079
|
-
|
|
25080
|
-
|
|
25081
|
-
|
|
25082
|
-
|
|
25083
|
-
criticalAt: external_exports.union([StatuslineSchema.shape.criticalAt.unwrap(), external_exports.literal(false)]).optional(),
|
|
25084
|
-
fiveHourLabel: external_exports.union([StatuslineSchema.shape.fiveHourLabel.unwrap(), external_exports.literal(false)]).optional(),
|
|
25085
|
-
sevenDayLabel: external_exports.union([StatuslineSchema.shape.sevenDayLabel.unwrap(), external_exports.literal(false)]).optional(),
|
|
25086
|
-
barWidth: external_exports.union([StatuslineSchema.shape.barWidth.unwrap(), external_exports.literal(false)]).optional()
|
|
25133
|
+
layout: external_exports.strictObject(SHAPES.layout).partial().optional(),
|
|
25134
|
+
bands: external_exports.strictObject(SHAPES.bands).partial().optional(),
|
|
25135
|
+
labels: external_exports.strictObject(SHAPES.labels).partial().optional(),
|
|
25136
|
+
bar: external_exports.strictObject(SHAPES.bar).partial().optional(),
|
|
25137
|
+
colours: external_exports.strictObject(SHAPES.colours).partial().optional()
|
|
25138
|
+
});
|
|
25139
|
+
ResolvedStatuslineSchema = external_exports.strictObject({
|
|
25140
|
+
layout: external_exports.strictObject(SHAPES.layout),
|
|
25141
|
+
bands: external_exports.strictObject(SHAPES.bands),
|
|
25142
|
+
labels: external_exports.strictObject(SHAPES.labels),
|
|
25143
|
+
bar: external_exports.strictObject(SHAPES.bar),
|
|
25144
|
+
colours: external_exports.strictObject(SHAPES.colours)
|
|
25087
25145
|
});
|
|
25088
25146
|
STATUSLINE_DEFAULTS = {
|
|
25089
|
-
header: STATUSLINE_HEADER_SEGMENTS,
|
|
25090
|
-
|
|
25091
|
-
|
|
25092
|
-
|
|
25093
|
-
|
|
25094
|
-
|
|
25095
|
-
|
|
25147
|
+
layout: { header: [...STATUSLINE_HEADER_SEGMENTS], rows: [...STATUSLINE_ROWS] },
|
|
25148
|
+
bands: { warnAt: 70, criticalAt: 90 },
|
|
25149
|
+
labels: { fiveHour: "5h", sevenDay: "Wk" },
|
|
25150
|
+
bar: { width: 10, filled: "\u2588", empty: "\u2591" },
|
|
25151
|
+
colours: {
|
|
25152
|
+
context: "green",
|
|
25153
|
+
usage: "green",
|
|
25154
|
+
warning: "yellow",
|
|
25155
|
+
usageWarning: "yellow",
|
|
25156
|
+
critical: "red",
|
|
25157
|
+
model: "default",
|
|
25158
|
+
label: "default",
|
|
25159
|
+
empty: "brightBlack"
|
|
25160
|
+
}
|
|
25096
25161
|
};
|
|
25097
25162
|
STATUSLINE_ENV = "AGENT_SHIM_STATUSLINE";
|
|
25098
25163
|
}
|
|
@@ -31868,6 +31933,148 @@ var init_identity = __esm({
|
|
|
31868
31933
|
}
|
|
31869
31934
|
});
|
|
31870
31935
|
|
|
31936
|
+
// src/statusline/keys.ts
|
|
31937
|
+
function valueAt(source, path66) {
|
|
31938
|
+
let current = source;
|
|
31939
|
+
for (const part of path66) {
|
|
31940
|
+
if (!isPlainObject2(current)) {
|
|
31941
|
+
return void 0;
|
|
31942
|
+
}
|
|
31943
|
+
current = current[part];
|
|
31944
|
+
}
|
|
31945
|
+
return current;
|
|
31946
|
+
}
|
|
31947
|
+
function keyOf(path66, leaf) {
|
|
31948
|
+
const common = { path: path66.join("."), description: leaf.description ?? "", defaultValue: valueAt(STATUSLINE_DEFAULTS, path66) };
|
|
31949
|
+
if (leaf instanceof external_exports.ZodNumber) {
|
|
31950
|
+
return { ...common, kind: "integer", choices: [] };
|
|
31951
|
+
}
|
|
31952
|
+
if (leaf instanceof external_exports.ZodString) {
|
|
31953
|
+
return { ...common, kind: "text", choices: [] };
|
|
31954
|
+
}
|
|
31955
|
+
if (leaf instanceof external_exports.ZodUnion) {
|
|
31956
|
+
return { ...common, kind: "colour", choices: [...STATUSLINE_COLOUR_NAMES] };
|
|
31957
|
+
}
|
|
31958
|
+
if (leaf instanceof external_exports.ZodEnum) {
|
|
31959
|
+
return { ...common, kind: "choice", choices: Object.values(leaf.enum).map(String) };
|
|
31960
|
+
}
|
|
31961
|
+
if (leaf instanceof external_exports.ZodArray && leaf.element instanceof external_exports.ZodEnum) {
|
|
31962
|
+
return { ...common, kind: "list", choices: Object.values(leaf.element.enum).map(String) };
|
|
31963
|
+
}
|
|
31964
|
+
throw new TypeError(`statusline setting ${path66.join(".")} has a kind the key listing does not describe`);
|
|
31965
|
+
}
|
|
31966
|
+
function walk(shape, prefix) {
|
|
31967
|
+
return Object.entries(shape).flatMap(([name, schema]) => schema instanceof external_exports.ZodObject ? walk(schema.shape, [...prefix, name]) : [keyOf([...prefix, name], schema)]);
|
|
31968
|
+
}
|
|
31969
|
+
function statuslineKeys() {
|
|
31970
|
+
return walk(ResolvedStatuslineSchema.shape, []);
|
|
31971
|
+
}
|
|
31972
|
+
function formatStatuslineKeys(keys) {
|
|
31973
|
+
return keys.map((key) => {
|
|
31974
|
+
const takes = key.kind === "choice" || key.kind === "list" || key.kind === "colour" ? `${key.kind} of ${key.choices.join(", ")}` : key.kind;
|
|
31975
|
+
return `${key.path} (${takes}; default ${JSON.stringify(key.defaultValue)})
|
|
31976
|
+
${key.description}`;
|
|
31977
|
+
}).join("\n");
|
|
31978
|
+
}
|
|
31979
|
+
var init_keys = __esm({
|
|
31980
|
+
"src/statusline/keys.ts"() {
|
|
31981
|
+
"use strict";
|
|
31982
|
+
init_zod();
|
|
31983
|
+
init_statusline();
|
|
31984
|
+
}
|
|
31985
|
+
});
|
|
31986
|
+
|
|
31987
|
+
// src/statusline/change.ts
|
|
31988
|
+
function keyNamed(path66) {
|
|
31989
|
+
const found = statuslineKeys().find((key) => key.path === path66);
|
|
31990
|
+
if (found === void 0) {
|
|
31991
|
+
throw new UsageError(`"${path66}" is not a statusline setting; \`agent-shim statusline keys\` lists them.`);
|
|
31992
|
+
}
|
|
31993
|
+
return found;
|
|
31994
|
+
}
|
|
31995
|
+
function parseStatuslineAssignment(text2) {
|
|
31996
|
+
const split = text2.indexOf("=");
|
|
31997
|
+
if (split < 1) {
|
|
31998
|
+
throw new UsageError(`"${text2}" is not <setting>=<value>.`);
|
|
31999
|
+
}
|
|
32000
|
+
const path66 = text2.slice(0, split);
|
|
32001
|
+
const raw = text2.slice(split + 1);
|
|
32002
|
+
const key = keyNamed(path66);
|
|
32003
|
+
switch (key.kind) {
|
|
32004
|
+
case "integer": {
|
|
32005
|
+
const number4 = Number(raw);
|
|
32006
|
+
if (raw.trim() === "" || !Number.isFinite(number4)) {
|
|
32007
|
+
throw new UsageError(`${path66}: "${raw}" is not a number.`);
|
|
32008
|
+
}
|
|
32009
|
+
return { path: path66, value: number4 };
|
|
32010
|
+
}
|
|
32011
|
+
case "text":
|
|
32012
|
+
case "choice":
|
|
32013
|
+
return { path: path66, value: raw };
|
|
32014
|
+
case "colour":
|
|
32015
|
+
return { path: path66, value: /^\d+$/.test(raw) ? Number(raw) : raw };
|
|
32016
|
+
case "list":
|
|
32017
|
+
return { path: path66, value: raw === "" ? [] : raw.split(",") };
|
|
32018
|
+
default:
|
|
32019
|
+
return key.kind;
|
|
32020
|
+
}
|
|
32021
|
+
}
|
|
32022
|
+
function setAt(target, path66, value2) {
|
|
32023
|
+
const [head, ...rest] = path66;
|
|
32024
|
+
if (head === void 0) {
|
|
32025
|
+
return;
|
|
32026
|
+
}
|
|
32027
|
+
if (rest.length === 0) {
|
|
32028
|
+
target[head] = value2;
|
|
32029
|
+
return;
|
|
32030
|
+
}
|
|
32031
|
+
const child = target[head];
|
|
32032
|
+
const next = isPlainObject2(child) ? child : {};
|
|
32033
|
+
target[head] = next;
|
|
32034
|
+
setAt(next, rest, value2);
|
|
32035
|
+
}
|
|
32036
|
+
function removeAt(target, path66) {
|
|
32037
|
+
const [head, ...rest] = path66;
|
|
32038
|
+
if (head === void 0) {
|
|
32039
|
+
return;
|
|
32040
|
+
}
|
|
32041
|
+
const child = target[head];
|
|
32042
|
+
if (rest.length === 0) {
|
|
32043
|
+
Reflect.deleteProperty(target, head);
|
|
32044
|
+
return;
|
|
32045
|
+
}
|
|
32046
|
+
if (isPlainObject2(child)) {
|
|
32047
|
+
removeAt(child, rest);
|
|
32048
|
+
if (Object.keys(child).length === 0) {
|
|
32049
|
+
Reflect.deleteProperty(target, head);
|
|
32050
|
+
}
|
|
32051
|
+
}
|
|
32052
|
+
}
|
|
32053
|
+
function applyStatuslineChange(existing, change) {
|
|
32054
|
+
const draft = structuredClone(existing ?? {});
|
|
32055
|
+
for (const [path66, value2] of Object.entries(change.set ?? {})) {
|
|
32056
|
+
keyNamed(path66);
|
|
32057
|
+
setAt(draft, path66.split("."), value2);
|
|
32058
|
+
}
|
|
32059
|
+
for (const path66 of change.unset ?? []) {
|
|
32060
|
+
keyNamed(path66);
|
|
32061
|
+
removeAt(draft, path66.split("."));
|
|
32062
|
+
}
|
|
32063
|
+
const result = StatuslineSchema.safeParse(draft);
|
|
32064
|
+
if (!result.success) {
|
|
32065
|
+
throw new UsageError(`statusline: ${result.error.issues.map((issue2) => `${issue2.path.join(".")}: ${issue2.message}`).join("; ")}.`);
|
|
32066
|
+
}
|
|
32067
|
+
return Object.keys(result.data).length === 0 ? void 0 : result.data;
|
|
32068
|
+
}
|
|
32069
|
+
var init_change = __esm({
|
|
32070
|
+
"src/statusline/change.ts"() {
|
|
32071
|
+
"use strict";
|
|
32072
|
+
init_cliError();
|
|
32073
|
+
init_statusline();
|
|
32074
|
+
init_keys();
|
|
32075
|
+
}
|
|
32076
|
+
});
|
|
32077
|
+
|
|
31871
32078
|
// src/configProfilesStore.ts
|
|
31872
32079
|
function profileJsonPath(paths, name) {
|
|
31873
32080
|
return import_node_path12.default.join(paths.configProfilesDir, `${name}.json`);
|
|
@@ -31967,17 +32174,6 @@ function removeProfile(paths, name) {
|
|
|
31967
32174
|
requireProfileExists(paths, name);
|
|
31968
32175
|
import_node_fs5.default.rmSync(profileJsonPath(paths, name));
|
|
31969
32176
|
}
|
|
31970
|
-
function withStatuslineChange(existing, change) {
|
|
31971
|
-
const merged = new Map(Object.entries({ ...existing }));
|
|
31972
|
-
for (const [key, value2] of Object.entries(change)) {
|
|
31973
|
-
if (value2 === false) {
|
|
31974
|
-
merged.delete(key);
|
|
31975
|
-
} else {
|
|
31976
|
-
merged.set(key, value2);
|
|
31977
|
-
}
|
|
31978
|
-
}
|
|
31979
|
-
return merged.size === 0 ? void 0 : StatuslineSchema.parse(Object.fromEntries(merged));
|
|
31980
|
-
}
|
|
31981
32177
|
function applyProfileChange(paths, name, change) {
|
|
31982
32178
|
let touched = false;
|
|
31983
32179
|
if (change.category !== void 0) {
|
|
@@ -32027,7 +32223,7 @@ function applyProfileChange(paths, name, change) {
|
|
|
32027
32223
|
launchPatch.explain = change.launchExplain;
|
|
32028
32224
|
}
|
|
32029
32225
|
if (change.launchStatusline !== void 0) {
|
|
32030
|
-
launchPatch.statusline =
|
|
32226
|
+
launchPatch.statusline = applyStatuslineChange(readProfile(paths, name)?.launch?.statusline, change.launchStatusline);
|
|
32031
32227
|
}
|
|
32032
32228
|
if (Object.keys(launchPatch).length > 0) {
|
|
32033
32229
|
setProfileLaunchFlags(paths, name, launchPatch);
|
|
@@ -32044,7 +32240,7 @@ var init_configProfilesStore = __esm({
|
|
|
32044
32240
|
init_store();
|
|
32045
32241
|
init_schema();
|
|
32046
32242
|
init_cliError();
|
|
32047
|
-
|
|
32243
|
+
init_change();
|
|
32048
32244
|
init_load();
|
|
32049
32245
|
ProfileNotFoundError = class extends CliError {
|
|
32050
32246
|
constructor(profileName) {
|
|
@@ -32671,9 +32867,9 @@ function referencesFact(when, key) {
|
|
|
32671
32867
|
if (when === void 0 || !("kind" in when)) {
|
|
32672
32868
|
return false;
|
|
32673
32869
|
}
|
|
32674
|
-
const
|
|
32870
|
+
const walk3 = (node2) => {
|
|
32675
32871
|
if (Array.isArray(node2)) {
|
|
32676
|
-
return node2.some(
|
|
32872
|
+
return node2.some(walk3);
|
|
32677
32873
|
}
|
|
32678
32874
|
if (typeof node2 !== "object" || node2 === null) {
|
|
32679
32875
|
return false;
|
|
@@ -32681,9 +32877,9 @@ function referencesFact(when, key) {
|
|
|
32681
32877
|
if ("kind" in node2 && node2.kind === "reference" && "key" in node2 && node2.key === key) {
|
|
32682
32878
|
return true;
|
|
32683
32879
|
}
|
|
32684
|
-
return Object.values(node2).some(
|
|
32880
|
+
return Object.values(node2).some(walk3);
|
|
32685
32881
|
};
|
|
32686
|
-
return
|
|
32882
|
+
return walk3(when);
|
|
32687
32883
|
}
|
|
32688
32884
|
function isVacuousWhen(when) {
|
|
32689
32885
|
return when !== void 0 && !("kind" in when) && Object.keys(when).length === 0;
|
|
@@ -33003,7 +33199,7 @@ function flattenLayers(layers, options) {
|
|
|
33003
33199
|
launch.proxyBypass = layer.launch.proxyBypass;
|
|
33004
33200
|
}
|
|
33005
33201
|
if (layer.launch.statusline !== void 0) {
|
|
33006
|
-
launch.statusline =
|
|
33202
|
+
launch.statusline = StatuslineSchema.parse(mergeStatuslineSettings(launch.statusline, layer.launch.statusline));
|
|
33007
33203
|
}
|
|
33008
33204
|
}
|
|
33009
33205
|
if (layer.models !== void 0) {
|
|
@@ -33184,6 +33380,7 @@ var init_flatten = __esm({
|
|
|
33184
33380
|
"src/resolve/flatten.ts"() {
|
|
33185
33381
|
"use strict";
|
|
33186
33382
|
init_schema();
|
|
33383
|
+
init_statusline();
|
|
33187
33384
|
init_conditions();
|
|
33188
33385
|
init_match();
|
|
33189
33386
|
}
|
|
@@ -36010,7 +36207,7 @@ var init_package = __esm({
|
|
|
36010
36207
|
"package.json"() {
|
|
36011
36208
|
package_default = {
|
|
36012
36209
|
name: "claude-use",
|
|
36013
|
-
version: "11.
|
|
36210
|
+
version: "11.52.0",
|
|
36014
36211
|
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.",
|
|
36015
36212
|
license: "MIT",
|
|
36016
36213
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -64959,7 +65156,7 @@ function isAnthropicUsageStale(member, nowMs) {
|
|
|
64959
65156
|
function poolIdentityNames(pools, poolName) {
|
|
64960
65157
|
const seenPools = /* @__PURE__ */ new Set();
|
|
64961
65158
|
const identities = /* @__PURE__ */ new Set();
|
|
64962
|
-
const
|
|
65159
|
+
const walk3 = (name) => {
|
|
64963
65160
|
const pool = pools[name];
|
|
64964
65161
|
if (pool === void 0 || seenPools.has(name)) {
|
|
64965
65162
|
return;
|
|
@@ -64971,11 +65168,11 @@ function poolIdentityNames(pools, poolName) {
|
|
|
64971
65168
|
if (nested === void 0) {
|
|
64972
65169
|
identities.add(member);
|
|
64973
65170
|
} else {
|
|
64974
|
-
|
|
65171
|
+
walk3(nested);
|
|
64975
65172
|
}
|
|
64976
65173
|
}
|
|
64977
65174
|
};
|
|
64978
|
-
|
|
65175
|
+
walk3(poolName);
|
|
64979
65176
|
return [...identities];
|
|
64980
65177
|
}
|
|
64981
65178
|
function describeError(error63) {
|
|
@@ -67168,14 +67365,14 @@ function memberKindOf(ref, models) {
|
|
|
67168
67365
|
function expandMembers(name, models) {
|
|
67169
67366
|
const virtual = models?.virtual ?? {};
|
|
67170
67367
|
const expanded = [];
|
|
67171
|
-
const
|
|
67368
|
+
const walk3 = (current, chain) => {
|
|
67172
67369
|
const nested = virtual[current];
|
|
67173
67370
|
if (nested !== void 0) {
|
|
67174
67371
|
if (chain.includes(current)) {
|
|
67175
67372
|
throw new Error(`virtual model cycle: ${[...chain, current].join(" -> ")}`);
|
|
67176
67373
|
}
|
|
67177
67374
|
for (const member of nested.members) {
|
|
67178
|
-
|
|
67375
|
+
walk3(member, [...chain, current]);
|
|
67179
67376
|
}
|
|
67180
67377
|
return;
|
|
67181
67378
|
}
|
|
@@ -67188,7 +67385,7 @@ function expandMembers(name, models) {
|
|
|
67188
67385
|
throw new VirtualModelNotFoundError(name);
|
|
67189
67386
|
}
|
|
67190
67387
|
for (const member of top.members) {
|
|
67191
|
-
|
|
67388
|
+
walk3(member, [name]);
|
|
67192
67389
|
}
|
|
67193
67390
|
return expanded;
|
|
67194
67391
|
}
|
|
@@ -113936,7 +114133,7 @@ function writePools(paths, pools) {
|
|
|
113936
114133
|
applyPatch(paths.globalConfigFile, GlobalConfigSchema, { pools }, { defaults: {} });
|
|
113937
114134
|
}
|
|
113938
114135
|
function poolCycleOf(pools, name) {
|
|
113939
|
-
const
|
|
114136
|
+
const walk3 = (current, path66) => {
|
|
113940
114137
|
for (const entry of pools[current]?.identities ?? []) {
|
|
113941
114138
|
const nested = poolNameOf(poolMemberIdentity(entry));
|
|
113942
114139
|
if (nested === void 0) {
|
|
@@ -113948,14 +114145,14 @@ function poolCycleOf(pools, name) {
|
|
|
113948
114145
|
if (path66.includes(nested)) {
|
|
113949
114146
|
continue;
|
|
113950
114147
|
}
|
|
113951
|
-
const found =
|
|
114148
|
+
const found = walk3(nested, [...path66, nested]);
|
|
113952
114149
|
if (found !== void 0) {
|
|
113953
114150
|
return found;
|
|
113954
114151
|
}
|
|
113955
114152
|
}
|
|
113956
114153
|
return void 0;
|
|
113957
114154
|
};
|
|
113958
|
-
return
|
|
114155
|
+
return walk3(name, [name]);
|
|
113959
114156
|
}
|
|
113960
114157
|
function validateMembers(pools, name, members2) {
|
|
113961
114158
|
for (const entry of members2) {
|
|
@@ -115117,7 +115314,7 @@ async function resolveFarmConflicts(params) {
|
|
|
115117
115314
|
// src/configProfiles.ts
|
|
115118
115315
|
init_commandDeps();
|
|
115119
115316
|
init_cliError();
|
|
115120
|
-
|
|
115317
|
+
init_change();
|
|
115121
115318
|
init_proxyBypass2();
|
|
115122
115319
|
init_configProfilesStore();
|
|
115123
115320
|
async function ensureProfileExists(deps, name) {
|
|
@@ -115144,28 +115341,12 @@ async function ensureProfileExists(deps, name) {
|
|
|
115144
115341
|
function toProfileView(name, profile, globalDefault) {
|
|
115145
115342
|
return { name, globalDefault: name === globalDefault, ...profile, $schema: void 0 };
|
|
115146
115343
|
}
|
|
115147
|
-
function segmentList(values) {
|
|
115148
|
-
return values.length === 1 && values[0] === "none" ? [] : values;
|
|
115149
|
-
}
|
|
115150
115344
|
function statuslineChangeOf(options) {
|
|
115151
|
-
|
|
115152
|
-
header: options.statuslineHeader === void 0 || options.statuslineHeader === false ? options.statuslineHeader : segmentList(options.statuslineHeader),
|
|
115153
|
-
bars: options.statuslineBars === void 0 || options.statuslineBars === false ? options.statuslineBars : segmentList(options.statuslineBars),
|
|
115154
|
-
warnAt: options.statuslineWarnAt === void 0 || options.statuslineWarnAt === false ? options.statuslineWarnAt : Number(options.statuslineWarnAt),
|
|
115155
|
-
criticalAt: options.statuslineCriticalAt === void 0 || options.statuslineCriticalAt === false ? options.statuslineCriticalAt : Number(options.statuslineCriticalAt),
|
|
115156
|
-
fiveHourLabel: options.statuslineFiveHourLabel,
|
|
115157
|
-
sevenDayLabel: options.statuslineSevenDayLabel,
|
|
115158
|
-
barWidth: options.statuslineBarWidth === void 0 || options.statuslineBarWidth === false ? options.statuslineBarWidth : Number(options.statuslineBarWidth)
|
|
115159
|
-
};
|
|
115160
|
-
const given = Object.entries(raw).filter(([, value2]) => value2 !== void 0);
|
|
115161
|
-
if (given.length === 0) {
|
|
115345
|
+
if (options.statusline === void 0 && options.unsetStatusline === void 0) {
|
|
115162
115346
|
return void 0;
|
|
115163
115347
|
}
|
|
115164
|
-
const
|
|
115165
|
-
|
|
115166
|
-
throw new UsageError(`--statusline-*: ${result.error.issues.map((issue2) => `${issue2.path.join(".")}: ${issue2.message}`).join("; ")}.`);
|
|
115167
|
-
}
|
|
115168
|
-
return Object.fromEntries(given);
|
|
115348
|
+
const assignments = (options.statusline ?? []).map(parseStatuslineAssignment);
|
|
115349
|
+
return { set: Object.fromEntries(assignments.map(({ path: path66, value: value2 }) => [path66, value2])), unset: options.unsetStatusline ?? [] };
|
|
115169
115350
|
}
|
|
115170
115351
|
function registerProfileCommand(program2, deps) {
|
|
115171
115352
|
const { paths } = deps;
|
|
@@ -115202,7 +115383,7 @@ function registerProfileCommand(program2, deps) {
|
|
|
115202
115383
|
withExamples(
|
|
115203
115384
|
profile.command("set <name>").description(
|
|
115204
115385
|
"Update a configuration profile's categories, entries, extends list, description or launch settings. With no options on a terminal, walks through its categories."
|
|
115205
|
-
).option("--category <category=bool>", "Share (true) or hide (false) a whole category (repeatable).", collectBoolPair).option("--entry <path=bool>", "Share (true) or hide (false) one <category>/<path> entry (repeatable).", collectBoolPair).option("--extends <profile>", "Replace the extends list with these profiles (repeatable, in order).", collectRepeated).option("--no-extends", "Clear the extends list.").option("--description <text>", "Replace the description.").option("--no-description", "Clear the description.").option("--launch-skip-permissions", "Launches under this profile skip permission prompts.").option("--no-launch-skip-permissions", "Launches under this profile keep permission prompts.").option("--launch-remote-control", "Launches under this profile enable Remote Control.").option("--no-launch-remote-control", "Launches under this profile leave Remote Control off.").option("--launch-headroom", "Launches under this profile route through headroom.").option("--no-launch-headroom", "Launches under this profile route direct.").option("--launch-track-usage", "Launches under this profile route through the front door so their requests and quota are recorded, with no headroom needed.").option("--no-launch-track-usage", "Launches under this profile are not recorded unless a provider or headroom routes them anyway.").option("--launch-provider <provider>", "Launches under this profile route through this provider.").option("--no-launch-provider", "Clear this profile's provider selection.").option("--launch-claude-version <version>", "Launches under this profile run exactly this installed Claude Code version (such as 2.1.220); a version that is not installed fails the launch.").option("--no-launch-claude-version", "Clear this profile's Claude Code version pin.").option("--launch-delay <duration>", "Launches under this profile wait this long (such as 5s) after the launcher's own output before starting claude, so the output can be read.", parseDurationLiteral).option("--no-launch-delay", "Clear this profile's launch delay.").option("--launch-pause", "Launches under this profile wait for a key press after the launcher's own output before starting claude.").option("--no-launch-pause", "Launches under this profile start claude without waiting for a key press.").option("--launch-explain", "Launches under this profile that pick from a pool list every member the pick ranked and why, in the launcher's report.").option("--no-launch-explain", "Launches under this profile name only the member a pool pick chose.").option("--launch-proxy-bypass <host>", "Launches under this profile keep this host off the front door by adding it to NO_PROXY, so its traffic goes direct (repeatable; replaces the profile's list).", collectRepeated).option("--no-launch-proxy-bypass", "Clear this profile's list of hosts kept off the front door.").option("--statusline
|
|
115386
|
+
).option("--category <category=bool>", "Share (true) or hide (false) a whole category (repeatable).", collectBoolPair).option("--entry <path=bool>", "Share (true) or hide (false) one <category>/<path> entry (repeatable).", collectBoolPair).option("--extends <profile>", "Replace the extends list with these profiles (repeatable, in order).", collectRepeated).option("--no-extends", "Clear the extends list.").option("--description <text>", "Replace the description.").option("--no-description", "Clear the description.").option("--launch-skip-permissions", "Launches under this profile skip permission prompts.").option("--no-launch-skip-permissions", "Launches under this profile keep permission prompts.").option("--launch-remote-control", "Launches under this profile enable Remote Control.").option("--no-launch-remote-control", "Launches under this profile leave Remote Control off.").option("--launch-headroom", "Launches under this profile route through headroom.").option("--no-launch-headroom", "Launches under this profile route direct.").option("--launch-track-usage", "Launches under this profile route through the front door so their requests and quota are recorded, with no headroom needed.").option("--no-launch-track-usage", "Launches under this profile are not recorded unless a provider or headroom routes them anyway.").option("--launch-provider <provider>", "Launches under this profile route through this provider.").option("--no-launch-provider", "Clear this profile's provider selection.").option("--launch-claude-version <version>", "Launches under this profile run exactly this installed Claude Code version (such as 2.1.220); a version that is not installed fails the launch.").option("--no-launch-claude-version", "Clear this profile's Claude Code version pin.").option("--launch-delay <duration>", "Launches under this profile wait this long (such as 5s) after the launcher's own output before starting claude, so the output can be read.", parseDurationLiteral).option("--no-launch-delay", "Clear this profile's launch delay.").option("--launch-pause", "Launches under this profile wait for a key press after the launcher's own output before starting claude.").option("--no-launch-pause", "Launches under this profile start claude without waiting for a key press.").option("--launch-explain", "Launches under this profile that pick from a pool list every member the pick ranked and why, in the launcher's report.").option("--no-launch-explain", "Launches under this profile name only the member a pool pick chose.").option("--launch-proxy-bypass <host>", "Launches under this profile keep this host off the front door by adding it to NO_PROXY, so its traffic goes direct (repeatable; replaces the profile's list).", collectRepeated).option("--no-launch-proxy-bypass", "Clear this profile's list of hosts kept off the front door.").option("--statusline <setting=value>", "Set one statusline setting for launches under this profile (repeatable; `agent-shim statusline keys` lists them; a list is comma-separated, and an empty value is the empty list).", collectRepeated).option("--unset-statusline <setting>", "Remove one statusline setting from this profile so the shallower layers or the default apply again (repeatable).", collectRepeated).option("--json", "Print the result as JSON.").action(async (name, allOptions) => {
|
|
115206
115387
|
const { json: json2, ...options } = allOptions;
|
|
115207
115388
|
requireProfileExists(paths, name);
|
|
115208
115389
|
if (Object.entries(allOptions).every(([key, value2]) => key === "json" || value2 === void 0)) {
|
|
@@ -121899,7 +122080,7 @@ function findDeepMatches(check2, payload, segments = [], maps = [], values = [])
|
|
|
121899
122080
|
payload.forEach((v, i10) => {
|
|
121900
122081
|
findDeepMatches(check2, v, [...segments, i10], maps, values);
|
|
121901
122082
|
});
|
|
121902
|
-
} else if (
|
|
122083
|
+
} else if (isPlainObject3(payload)) {
|
|
121903
122084
|
for (const key of Object.keys(payload)) {
|
|
121904
122085
|
findDeepMatches(check2, payload[key], [...segments, key], maps, values);
|
|
121905
122086
|
}
|
|
@@ -121924,7 +122105,7 @@ function* getConstructors(value2) {
|
|
|
121924
122105
|
proto = Object.getPrototypeOf(proto);
|
|
121925
122106
|
}
|
|
121926
122107
|
}
|
|
121927
|
-
function
|
|
122108
|
+
function isPlainObject3(value2) {
|
|
121928
122109
|
if (!value2 || typeof value2 !== "object") {
|
|
121929
122110
|
return false;
|
|
121930
122111
|
}
|
|
@@ -121957,7 +122138,7 @@ function setOwn(object3, key, value2) {
|
|
|
121957
122138
|
}
|
|
121958
122139
|
}
|
|
121959
122140
|
function mergeTwoLevels(first, second) {
|
|
121960
|
-
if (!
|
|
122141
|
+
if (!isPlainObject3(first) || !isPlainObject3(second)) {
|
|
121961
122142
|
return second;
|
|
121962
122143
|
}
|
|
121963
122144
|
const result = { ...first, ...second };
|
|
@@ -121967,7 +122148,7 @@ function mergeTwoLevels(first, second) {
|
|
|
121967
122148
|
}
|
|
121968
122149
|
const firstValue = first[key];
|
|
121969
122150
|
const secondValue = second[key];
|
|
121970
|
-
if (
|
|
122151
|
+
if (isPlainObject3(firstValue) && isPlainObject3(secondValue)) {
|
|
121971
122152
|
result[key] = { ...firstValue, ...secondValue };
|
|
121972
122153
|
}
|
|
121973
122154
|
}
|
|
@@ -121996,7 +122177,7 @@ function cloneWithVisited(value2, visited) {
|
|
|
121996
122177
|
}
|
|
121997
122178
|
return result;
|
|
121998
122179
|
}
|
|
121999
|
-
if (
|
|
122180
|
+
if (isPlainObject3(value2)) {
|
|
122000
122181
|
const existing = visited.get(value2);
|
|
122001
122182
|
if (existing) {
|
|
122002
122183
|
return existing;
|
|
@@ -122021,7 +122202,7 @@ function copyOnWrite(parent, key, original) {
|
|
|
122021
122202
|
let copy;
|
|
122022
122203
|
if (Array.isArray(value2)) {
|
|
122023
122204
|
copy = value2.slice();
|
|
122024
|
-
} else if (
|
|
122205
|
+
} else if (isPlainObject3(value2)) {
|
|
122025
122206
|
copy = { ...value2 };
|
|
122026
122207
|
} else {
|
|
122027
122208
|
return value2;
|
|
@@ -122638,7 +122819,7 @@ function toORPCError(error63) {
|
|
|
122638
122819
|
return error63 instanceof ORPCError ? error63 : new ORPCError("INTERNAL_SERVER_ERROR", { cause: error63 });
|
|
122639
122820
|
}
|
|
122640
122821
|
function isORPCErrorJson(json2) {
|
|
122641
|
-
if (!
|
|
122822
|
+
if (!isPlainObject3(json2)) {
|
|
122642
122823
|
return false;
|
|
122643
122824
|
}
|
|
122644
122825
|
const validKeys = ["defined", "code", "message", "data"];
|
|
@@ -122672,7 +122853,7 @@ function inferMalformedResponseMessage(response) {
|
|
|
122672
122853
|
if (typeof response.body === "string" && isInferableMessage(response.body)) {
|
|
122673
122854
|
return response.body;
|
|
122674
122855
|
}
|
|
122675
|
-
if (
|
|
122856
|
+
if (isPlainObject3(response.body) && typeof response.body.message === "string" && isInferableMessage(response.body.message)) {
|
|
122676
122857
|
return response.body.message;
|
|
122677
122858
|
}
|
|
122678
122859
|
const commonCode = Object.entries(COMMON_ERROR_STATUS_MAP).find(([, status]) => status === response.status)?.[0];
|
|
@@ -122963,7 +123144,7 @@ var RPCJsonSerializer = class {
|
|
|
122963
123144
|
}
|
|
122964
123145
|
return json2;
|
|
122965
123146
|
}
|
|
122966
|
-
if (
|
|
123147
|
+
if (isPlainObject3(data)) {
|
|
122967
123148
|
const json2 = new NullProtoObj();
|
|
122968
123149
|
for (const k10 of Object.keys(data)) {
|
|
122969
123150
|
const v = data[k10];
|
|
@@ -123209,7 +123390,7 @@ var BracketNotationSerializer = class {
|
|
|
123209
123390
|
data.forEach((item, i10) => {
|
|
123210
123391
|
this.internalSerialize(item, isRoot ? i10.toString() : `${path66}[${i10}]`, false, result);
|
|
123211
123392
|
});
|
|
123212
|
-
} else if (
|
|
123393
|
+
} else if (isPlainObject3(data)) {
|
|
123213
123394
|
for (const key of Object.keys(data)) {
|
|
123214
123395
|
this.internalSerialize(data[key], isRoot ? key : `${path66}[${key}]`, false, result);
|
|
123215
123396
|
}
|
|
@@ -123229,7 +123410,7 @@ var BracketNotationSerializer = class {
|
|
|
123229
123410
|
const isLast = i10 === segments.length - 1;
|
|
123230
123411
|
const existing = getOwn(currentRef, nextSegment);
|
|
123231
123412
|
let child = existing;
|
|
123232
|
-
if (!Array.isArray(child) && !
|
|
123413
|
+
if (!Array.isArray(child) && !isPlainObject3(child)) {
|
|
123233
123414
|
child = [];
|
|
123234
123415
|
}
|
|
123235
123416
|
if (Array.isArray(child)) {
|
|
@@ -123784,7 +123965,7 @@ var OpenAPIJsonSerializer = class {
|
|
|
123784
123965
|
}
|
|
123785
123966
|
return json2;
|
|
123786
123967
|
}
|
|
123787
|
-
if (
|
|
123968
|
+
if (isPlainObject3(data)) {
|
|
123788
123969
|
const json2 = new NullProtoObj();
|
|
123789
123970
|
for (const k10 of Object.keys(data)) {
|
|
123790
123971
|
const v = data[k10];
|
|
@@ -126618,7 +126799,7 @@ function toBodyContent(ctx, direction, schema) {
|
|
|
126618
126799
|
if (rest.length > 0) {
|
|
126619
126800
|
const restSchema = fileSchemasByMediaType.size ? combineJsonSchemasWithComposition("anyOf", rest) : schema;
|
|
126620
126801
|
const hasNestedFiles = findDeepMatches(
|
|
126621
|
-
(v) =>
|
|
126802
|
+
(v) => isPlainObject3(v) && isJsonFileSchema(v),
|
|
126622
126803
|
restSchema
|
|
126623
126804
|
).values.length > 0;
|
|
126624
126805
|
const contentType = hasNestedFiles ? "multipart/form-data" : "application/json";
|
|
@@ -129117,7 +129298,7 @@ var OpenAPIHandlerCodecCore = class {
|
|
|
129117
129298
|
if (!params || Object.keys(params).length < 1) {
|
|
129118
129299
|
return data;
|
|
129119
129300
|
}
|
|
129120
|
-
if (!
|
|
129301
|
+
if (!isPlainObject3(data)) {
|
|
129121
129302
|
return params;
|
|
129122
129303
|
}
|
|
129123
129304
|
return {
|
|
@@ -129177,7 +129358,7 @@ var OpenAPIHandlerCodecCore = class {
|
|
|
129177
129358
|
const [, search] = parseStandardUrl(url2);
|
|
129178
129359
|
const searchParams = new URLSearchParams(search);
|
|
129179
129360
|
const parsed = this.serializer.deserialize(searchParams);
|
|
129180
|
-
if (!styles || !
|
|
129361
|
+
if (!styles || !isPlainObject3(parsed)) {
|
|
129181
129362
|
return parsed;
|
|
129182
129363
|
}
|
|
129183
129364
|
Object.entries(styles).forEach(([key, hint]) => {
|
|
@@ -129513,7 +129694,6 @@ init_providersStore();
|
|
|
129513
129694
|
// src/frontdoor/configSchemas.ts
|
|
129514
129695
|
init_zod();
|
|
129515
129696
|
init_schema();
|
|
129516
|
-
init_statusline();
|
|
129517
129697
|
var RemovalConfirmationSchema = external_exports.boolean();
|
|
129518
129698
|
var CredentialWriteSchema = (targets) => external_exports.strictObject({
|
|
129519
129699
|
sources: external_exports.array(RemoteCredentialSourceSchema).min(1).optional(),
|
|
@@ -129590,7 +129770,10 @@ var ConfigProfileSetInputSchema = external_exports.strictObject({
|
|
|
129590
129770
|
pause: external_exports.boolean().optional(),
|
|
129591
129771
|
explain: external_exports.boolean().optional(),
|
|
129592
129772
|
proxyBypass: external_exports.union([external_exports.array(external_exports.string().min(1)), external_exports.literal(false)]).optional(),
|
|
129593
|
-
statusline:
|
|
129773
|
+
statusline: external_exports.strictObject({
|
|
129774
|
+
set: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
|
|
129775
|
+
unset: external_exports.array(external_exports.string()).optional()
|
|
129776
|
+
}).optional()
|
|
129594
129777
|
}).optional()
|
|
129595
129778
|
});
|
|
129596
129779
|
var ConfigProfileSetOutputSchema = storedMutationOutput("profile", "updated", ProfileValueSchema);
|
|
@@ -130607,7 +130790,7 @@ function nextToken(body, from) {
|
|
|
130607
130790
|
}
|
|
130608
130791
|
return SCALAR;
|
|
130609
130792
|
}
|
|
130610
|
-
function
|
|
130793
|
+
function walk2(body, hashing, parentAfter) {
|
|
130611
130794
|
const thread = (0, import_node_crypto22.createHash)("sha256");
|
|
130612
130795
|
const messages = (0, import_node_crypto22.createHash)("sha256");
|
|
130613
130796
|
let parentDigest;
|
|
@@ -130724,12 +130907,12 @@ function lineageOf(body) {
|
|
|
130724
130907
|
if (body.length > LINEAGE_BODY_BYTES_LIMIT) {
|
|
130725
130908
|
return void 0;
|
|
130726
130909
|
}
|
|
130727
|
-
const counted =
|
|
130910
|
+
const counted = walk2(body, false, void 0);
|
|
130728
130911
|
if (counted.abandoned || !counted.sawMessages) {
|
|
130729
130912
|
return void 0;
|
|
130730
130913
|
}
|
|
130731
130914
|
const parentAfter = counted.elements > MESSAGES_PER_TURN ? counted.elements - MESSAGES_PER_TURN : void 0;
|
|
130732
|
-
const hashed =
|
|
130915
|
+
const hashed = walk2(body, true, parentAfter);
|
|
130733
130916
|
const combine = (messagesDigest) => (0, import_node_crypto22.createHash)("sha256").update(hashed.threadDigest).update(messagesDigest).digest("hex");
|
|
130734
130917
|
return { ownKey: combine(hashed.messagesDigest), parentKey: hashed.parentDigest === void 0 ? void 0 : combine(hashed.parentDigest) };
|
|
130735
130918
|
}
|
|
@@ -136872,6 +137055,9 @@ function providerScopedState(snapshot, providerName, providerDisplayName) {
|
|
|
136872
137055
|
// src/statusline/commands.ts
|
|
136873
137056
|
init_read();
|
|
136874
137057
|
|
|
137058
|
+
// src/statusline/render.ts
|
|
137059
|
+
init_statusline();
|
|
137060
|
+
|
|
136875
137061
|
// src/statusline/ansi.ts
|
|
136876
137062
|
var ESCAPE_CHAR_CODE = 27;
|
|
136877
137063
|
var ESCAPE = String.fromCharCode(ESCAPE_CHAR_CODE);
|
|
@@ -136880,9 +137066,6 @@ function visibleLength(text2) {
|
|
|
136880
137066
|
return text2.replace(ANSI_REGEX, "").length;
|
|
136881
137067
|
}
|
|
136882
137068
|
|
|
136883
|
-
// src/statusline/render.ts
|
|
136884
|
-
init_statusline();
|
|
136885
|
-
|
|
136886
137069
|
// src/statusline/barGrid.ts
|
|
136887
137070
|
var BRACKET_COLUMNS = 2;
|
|
136888
137071
|
function chunk(items, size) {
|
|
@@ -136953,7 +137136,122 @@ function layoutBarGrid(groups, maxWidth, separator, baseBarCells) {
|
|
|
136953
137136
|
return renderGrid(layoutFor(1), maxWidth, separator, baseBarCells);
|
|
136954
137137
|
}
|
|
136955
137138
|
|
|
136956
|
-
// src/statusline/
|
|
137139
|
+
// src/statusline/elements/header/account.ts
|
|
137140
|
+
function tierSuffixOf(tier) {
|
|
137141
|
+
const match = /_(\d+x)$/i.exec(tier ?? "");
|
|
137142
|
+
return match === null ? void 0 : match[1];
|
|
137143
|
+
}
|
|
137144
|
+
function accountPlanLabel(summary) {
|
|
137145
|
+
switch (summary.loginOrganizationType) {
|
|
137146
|
+
case void 0:
|
|
137147
|
+
return planLabelOf(summary.loginRateLimitTier);
|
|
137148
|
+
case "claude_max": {
|
|
137149
|
+
const tier = tierSuffixOf(summary.loginRateLimitTier);
|
|
137150
|
+
return tier === void 0 ? "Max" : `Max ${tier}`;
|
|
137151
|
+
}
|
|
137152
|
+
case "claude_pro":
|
|
137153
|
+
return "Pro";
|
|
137154
|
+
case "claude_team":
|
|
137155
|
+
if (summary.loginSeatTier === "team_standard") {
|
|
137156
|
+
return "Team Standard";
|
|
137157
|
+
}
|
|
137158
|
+
if (summary.loginSeatTier === "team_tier_1") {
|
|
137159
|
+
return "Team Premium";
|
|
137160
|
+
}
|
|
137161
|
+
return "Team";
|
|
137162
|
+
case "claude_enterprise":
|
|
137163
|
+
return "Enterprise";
|
|
137164
|
+
default:
|
|
137165
|
+
return summary.loginOrganizationType;
|
|
137166
|
+
}
|
|
137167
|
+
}
|
|
137168
|
+
function planLabelOf(tier) {
|
|
137169
|
+
if (tier === void 0 || tier === "") {
|
|
137170
|
+
return void 0;
|
|
137171
|
+
}
|
|
137172
|
+
const cleaned = tier.startsWith("default_") ? tier.slice("default_".length) : tier;
|
|
137173
|
+
if (cleaned === "free") {
|
|
137174
|
+
return "Free";
|
|
137175
|
+
}
|
|
137176
|
+
const maxWithMultiplier = /^claude_max_(\d+)x$/.exec(cleaned);
|
|
137177
|
+
if (maxWithMultiplier !== null) {
|
|
137178
|
+
return `Max ${maxWithMultiplier[1] ?? ""}x`;
|
|
137179
|
+
}
|
|
137180
|
+
if (cleaned === "claude_max") {
|
|
137181
|
+
return "Max";
|
|
137182
|
+
}
|
|
137183
|
+
if (cleaned === "claude_pro") {
|
|
137184
|
+
return "Pro";
|
|
137185
|
+
}
|
|
137186
|
+
return cleaned;
|
|
137187
|
+
}
|
|
137188
|
+
function accountSegment({ summary }) {
|
|
137189
|
+
const loginPlan = summary.provider === void 0 ? summary.loginPlan ?? accountPlanLabel(summary) : void 0;
|
|
137190
|
+
const loginOrgName = summary.loginOrganizationType === "claude_team" || summary.loginOrganizationType === "claude_enterprise" ? summary.loginOrganizationName : void 0;
|
|
137191
|
+
const loginParts = [summary.loginAccountEmail, loginOrgName, loginPlan].filter((part) => part !== void 0);
|
|
137192
|
+
if (summary.loginAccountEmail !== void 0 && summary.loginAccountEmail !== summary.providerAccountEmail) {
|
|
137193
|
+
return loginParts.join(" \xB7 ");
|
|
137194
|
+
}
|
|
137195
|
+
return summary.provider === void 0 && loginParts.length > 0 ? loginParts.join(" \xB7 ") : void 0;
|
|
137196
|
+
}
|
|
137197
|
+
|
|
137198
|
+
// src/statusline/palette.ts
|
|
137199
|
+
init_statusline();
|
|
137200
|
+
var RESET = `${ESCAPE}[0m`;
|
|
137201
|
+
var SGR_BY_NAME = {
|
|
137202
|
+
default: "",
|
|
137203
|
+
dim: "2",
|
|
137204
|
+
black: "30",
|
|
137205
|
+
red: "31",
|
|
137206
|
+
green: "32",
|
|
137207
|
+
yellow: "33",
|
|
137208
|
+
blue: "34",
|
|
137209
|
+
magenta: "35",
|
|
137210
|
+
cyan: "36",
|
|
137211
|
+
white: "37",
|
|
137212
|
+
brightBlack: "90",
|
|
137213
|
+
brightRed: "91",
|
|
137214
|
+
brightGreen: "92",
|
|
137215
|
+
brightYellow: "93",
|
|
137216
|
+
brightBlue: "94",
|
|
137217
|
+
brightMagenta: "95",
|
|
137218
|
+
brightCyan: "96",
|
|
137219
|
+
brightWhite: "97"
|
|
137220
|
+
};
|
|
137221
|
+
function isColourName(value2) {
|
|
137222
|
+
return STATUSLINE_COLOUR_NAMES.some((name) => name === value2);
|
|
137223
|
+
}
|
|
137224
|
+
var CHANNELS = 3;
|
|
137225
|
+
var CHANNEL_DIGITS = 2;
|
|
137226
|
+
var HEX_RADIX2 = 16;
|
|
137227
|
+
function sgrOf(value2) {
|
|
137228
|
+
if (typeof value2 === "number") {
|
|
137229
|
+
return `38;5;${String(value2)}`;
|
|
137230
|
+
}
|
|
137231
|
+
if (value2.startsWith("#")) {
|
|
137232
|
+
const channels = Array.from({ length: CHANNELS }, (_, index) => Number.parseInt(value2.slice(1 + index * CHANNEL_DIGITS, 1 + (index + 1) * CHANNEL_DIGITS), HEX_RADIX2));
|
|
137233
|
+
return `38;2;${channels.join(";")}`;
|
|
137234
|
+
}
|
|
137235
|
+
return isColourName(value2) ? SGR_BY_NAME[value2] : "";
|
|
137236
|
+
}
|
|
137237
|
+
function colourEnabled(env) {
|
|
137238
|
+
return env.NO_COLOR === void 0;
|
|
137239
|
+
}
|
|
137240
|
+
function createPalette(colours, enabled) {
|
|
137241
|
+
const ansi = (role) => {
|
|
137242
|
+
const sgr = enabled ? sgrOf(colours[role]) : "";
|
|
137243
|
+
return sgr === "" ? "" : `${ESCAPE}[${sgr}m`;
|
|
137244
|
+
};
|
|
137245
|
+
return {
|
|
137246
|
+
ansi,
|
|
137247
|
+
paint: (role, text2) => {
|
|
137248
|
+
const start = ansi(role);
|
|
137249
|
+
return start === "" ? text2 : `${start}${text2}${RESET}`;
|
|
137250
|
+
}
|
|
137251
|
+
};
|
|
137252
|
+
}
|
|
137253
|
+
|
|
137254
|
+
// src/statusline/style.ts
|
|
136957
137255
|
var SECONDS_PER_MINUTE2 = 60;
|
|
136958
137256
|
var MINUTES_PER_HOUR4 = 60;
|
|
136959
137257
|
var SECONDS_PER_DAY = 86400;
|
|
@@ -136961,34 +137259,26 @@ var THOUSAND = 1e3;
|
|
|
136961
137259
|
var MILLION = 1e6;
|
|
136962
137260
|
var TEN = 10;
|
|
136963
137261
|
var TWENTY = 20;
|
|
136964
|
-
var RESERVED_COLUMNS = 4;
|
|
136965
|
-
var SEPARATOR2 = " | ";
|
|
136966
137262
|
var FULL_PERCENT3 = 100;
|
|
136967
137263
|
var ONE_PERCENT = 1;
|
|
136968
|
-
|
|
136969
|
-
|
|
136970
|
-
|
|
136971
|
-
|
|
136972
|
-
|
|
136973
|
-
|
|
136974
|
-
|
|
136975
|
-
}
|
|
136976
|
-
function statusColor(fraction, isUsedMetric, bands) {
|
|
136977
|
-
if (!colorize()) {
|
|
136978
|
-
return "";
|
|
136979
|
-
}
|
|
136980
|
-
const yellowAt = bands.warnAt / FULL_PERCENT3;
|
|
136981
|
-
const redAt = bands.criticalAt / FULL_PERCENT3;
|
|
137264
|
+
function withColor(color, text2) {
|
|
137265
|
+
return color === "" ? text2 : `${color}${text2}${RESET}`;
|
|
137266
|
+
}
|
|
137267
|
+
function statusColor(fraction, isUsedMetric, style) {
|
|
137268
|
+
const yellowAt = style.bands.warnAt / FULL_PERCENT3;
|
|
137269
|
+
const redAt = style.bands.criticalAt / FULL_PERCENT3;
|
|
137270
|
+
const warningRole = style.okRole === "usage" ? "usageWarning" : "warning";
|
|
137271
|
+
const { ansi } = style.palette;
|
|
136982
137272
|
if (isUsedMetric) {
|
|
136983
137273
|
if (fraction >= redAt) {
|
|
136984
|
-
return
|
|
137274
|
+
return ansi("critical");
|
|
136985
137275
|
}
|
|
136986
|
-
return fraction >= yellowAt ?
|
|
137276
|
+
return fraction >= yellowAt ? ansi(warningRole) : ansi(style.okRole);
|
|
136987
137277
|
}
|
|
136988
137278
|
if (fraction <= 1 - redAt) {
|
|
136989
|
-
return
|
|
137279
|
+
return ansi("critical");
|
|
136990
137280
|
}
|
|
136991
|
-
return fraction <= 1 - yellowAt ?
|
|
137281
|
+
return fraction <= 1 - yellowAt ? ansi(warningRole) : ansi(style.okRole);
|
|
136992
137282
|
}
|
|
136993
137283
|
function formatTokens(num) {
|
|
136994
137284
|
if (num >= MILLION) {
|
|
@@ -137016,6 +137306,29 @@ function formatDuration(seconds) {
|
|
|
137016
137306
|
}
|
|
137017
137307
|
return `${String(minutes)}m`;
|
|
137018
137308
|
}
|
|
137309
|
+
function secondsUntil(resetAt, nowMs) {
|
|
137310
|
+
if (resetAt === void 0) {
|
|
137311
|
+
return void 0;
|
|
137312
|
+
}
|
|
137313
|
+
const resetMs = Date.parse(resetAt);
|
|
137314
|
+
return Number.isNaN(resetMs) ? void 0 : Math.max(0, Math.round((resetMs - nowMs) / THOUSAND));
|
|
137315
|
+
}
|
|
137316
|
+
function drawBar(fraction, cells, style) {
|
|
137317
|
+
const clamped = Math.max(0, Math.min(1, fraction));
|
|
137318
|
+
const filled = Math.round(clamped * cells);
|
|
137319
|
+
const color = statusColor(clamped, true, style);
|
|
137320
|
+
const emptyColor = style.palette.ansi("empty");
|
|
137321
|
+
const body = `${style.filled.repeat(filled)}${style.empty.repeat(cells - filled)}`;
|
|
137322
|
+
if (color === "" && emptyColor === "") {
|
|
137323
|
+
return `[${body}]`;
|
|
137324
|
+
}
|
|
137325
|
+
return `[${color}${style.filled.repeat(filled)}${emptyColor}${style.empty.repeat(cells - filled)}${RESET}]`;
|
|
137326
|
+
}
|
|
137327
|
+
function barCell(prefix, suffix, fraction, style) {
|
|
137328
|
+
return { prefix, suffix, draw: (cells) => drawBar(fraction, cells, style) };
|
|
137329
|
+
}
|
|
137330
|
+
|
|
137331
|
+
// src/statusline/elements/header/headroom.ts
|
|
137019
137332
|
function headroomText(stats) {
|
|
137020
137333
|
if (stats === void 0) {
|
|
137021
137334
|
return void 0;
|
|
@@ -137028,85 +137341,123 @@ function headroomText(stats) {
|
|
|
137028
137341
|
].filter((part) => part !== void 0);
|
|
137029
137342
|
return parts.length === 0 ? void 0 : `headroom ${parts.join(" \xB7 ")}`;
|
|
137030
137343
|
}
|
|
137031
|
-
function
|
|
137344
|
+
function headroomSegment({ summary }) {
|
|
137345
|
+
return headroomText(summary.headroom);
|
|
137346
|
+
}
|
|
137347
|
+
|
|
137348
|
+
// src/statusline/elements/header/identity.ts
|
|
137349
|
+
function identitySegment({ summary }) {
|
|
137350
|
+
if (summary.identity !== void 0 && summary.provider !== void 0 && summary.identity !== summary.providerAccountEmail && summary.identity !== summary.loginAccountEmail) {
|
|
137351
|
+
return summary.identity;
|
|
137352
|
+
}
|
|
137353
|
+
return void 0;
|
|
137354
|
+
}
|
|
137355
|
+
|
|
137356
|
+
// src/statusline/elements/header/model.ts
|
|
137357
|
+
function choiceNamesProvider(summary) {
|
|
137358
|
+
return summary.modelChoice !== void 0 && (summary.modelChoice.providers.length > 1 || summary.routedTarget !== void 0);
|
|
137359
|
+
}
|
|
137360
|
+
function modelSegment({ summary, view }) {
|
|
137361
|
+
const namesProvider = choiceNamesProvider(summary);
|
|
137362
|
+
const segment = summary.modelChoice !== void 0 && view.modelDisplayName !== void 0 && view.modelDisplayName !== "" ? `${view.modelDisplayName} -> ${namesProvider ? `${summary.modelChoice.provider}/${summary.modelChoice.served}` : summary.modelChoice.served}` : view.modelDisplayName;
|
|
137363
|
+
return segment !== void 0 && segment !== "" ? segment : void 0;
|
|
137364
|
+
}
|
|
137365
|
+
|
|
137366
|
+
// src/statusline/elements/header/provider.ts
|
|
137367
|
+
function providerSegment({ summary }) {
|
|
137368
|
+
if (summary.provider === void 0) {
|
|
137369
|
+
return void 0;
|
|
137370
|
+
}
|
|
137371
|
+
const account = [summary.providerAccountEmail, summary.providerPlan].filter((part) => part !== void 0);
|
|
137372
|
+
return account.length > 0 ? `${summary.provider} \xB7 ${account.join(" \xB7 ")}` : summary.provider;
|
|
137373
|
+
}
|
|
137374
|
+
|
|
137375
|
+
// src/statusline/elements/header/route.ts
|
|
137376
|
+
function routeSegment({ summary }) {
|
|
137377
|
+
return summary.routedTarget !== void 0 && !choiceNamesProvider(summary) ? `via ${summary.routedTarget}` : void 0;
|
|
137378
|
+
}
|
|
137379
|
+
|
|
137380
|
+
// src/statusline/elements/context.ts
|
|
137381
|
+
function barStyleOf({ settings: settings2, palette }, okRole) {
|
|
137382
|
+
return { bands: settings2.bands, palette, okRole, filled: settings2.bar.filled, empty: settings2.bar.empty };
|
|
137383
|
+
}
|
|
137384
|
+
|
|
137385
|
+
// src/statusline/elements/rows/context.ts
|
|
137386
|
+
function cacheHitText(hitFraction, style) {
|
|
137032
137387
|
const clamped = Math.max(0, Math.min(1, hitFraction));
|
|
137033
|
-
return ` (Cache: ${statusColor(clamped, false,
|
|
137388
|
+
return ` (Cache: ${withColor(statusColor(clamped, false, style), `${(clamped * FULL_PERCENT3).toFixed(0)}%`)})`;
|
|
137034
137389
|
}
|
|
137035
|
-
function cacheShareText(view,
|
|
137390
|
+
function cacheShareText(view, style) {
|
|
137036
137391
|
const hitRatio = view.cacheHitRatio;
|
|
137037
137392
|
if (hitRatio !== void 0 && Number.isFinite(hitRatio)) {
|
|
137038
|
-
return cacheHitText(hitRatio,
|
|
137393
|
+
return cacheHitText(hitRatio, style);
|
|
137039
137394
|
}
|
|
137040
137395
|
const promptTotal = (view.cacheReadTokens ?? 0) + (view.freshInputTokens ?? 0);
|
|
137041
137396
|
if (promptTotal > 0 && (view.cacheReadTokens ?? 0) > 0) {
|
|
137042
|
-
return cacheHitText((view.cacheReadTokens ?? 0) / promptTotal,
|
|
137397
|
+
return cacheHitText((view.cacheReadTokens ?? 0) / promptTotal, style);
|
|
137043
137398
|
}
|
|
137044
137399
|
return "";
|
|
137045
137400
|
}
|
|
137046
|
-
function
|
|
137047
|
-
const
|
|
137048
|
-
|
|
137401
|
+
function contextRow(context) {
|
|
137402
|
+
const { view, palette } = context;
|
|
137403
|
+
const style = barStyleOf(context, "context");
|
|
137404
|
+
const cells = [];
|
|
137405
|
+
if (view.contextUsedPercentage !== void 0) {
|
|
137406
|
+
const fraction = Math.max(0, Math.min(1, view.contextUsedPercentage / FULL_PERCENT3));
|
|
137407
|
+
const color = statusColor(fraction, true, style);
|
|
137408
|
+
const percent2 = withColor(color, `${view.contextUsedPercentage.toFixed(1)}%`);
|
|
137409
|
+
const tokens = view.contextTotalTokens !== void 0 && view.contextWindowTokens !== void 0 ? `${formatTokens(view.contextTotalTokens)}/${formatTokens(view.contextWindowTokens)} ` : "";
|
|
137410
|
+
const cache = cacheShareText(view, style);
|
|
137411
|
+
cells.push(barCell(palette.paint("label", `Ctx ${tokens}`), ` ${percent2}${cache}`, fraction, style));
|
|
137412
|
+
}
|
|
137413
|
+
return { kind: "bars", cells };
|
|
137049
137414
|
}
|
|
137050
|
-
|
|
137051
|
-
|
|
137052
|
-
|
|
137053
|
-
|
|
137054
|
-
|
|
137055
|
-
|
|
137056
|
-
|
|
137415
|
+
|
|
137416
|
+
// src/statusline/elements/rows/quota.ts
|
|
137417
|
+
function quotaRow(context) {
|
|
137418
|
+
const { summary, nowMs, settings: settings2, palette } = context;
|
|
137419
|
+
const style = barStyleOf(context, "usage");
|
|
137420
|
+
const cells = [];
|
|
137421
|
+
const drawWindow = (label, fraction, resetsAt) => {
|
|
137422
|
+
const clamped = Math.max(0, Math.min(1, fraction));
|
|
137423
|
+
const color = statusColor(clamped, true, style);
|
|
137424
|
+
cells.push(barCell(palette.paint("label", `${label} `), ` ${withColor(color, `${(fraction * FULL_PERCENT3).toFixed(1)}%`)} (${formatDuration(secondsUntil(resetsAt, nowMs))})`, clamped, style));
|
|
137425
|
+
};
|
|
137426
|
+
if (summary.quotaFamilies.length > 0) {
|
|
137427
|
+
for (const window of summary.quotaFamilies) {
|
|
137428
|
+
drawWindow(window.measures, window.utilization, window.resetsAt);
|
|
137057
137429
|
}
|
|
137058
|
-
|
|
137059
|
-
|
|
137060
|
-
|
|
137061
|
-
|
|
137062
|
-
|
|
137063
|
-
|
|
137064
|
-
|
|
137065
|
-
|
|
137430
|
+
} else {
|
|
137431
|
+
if (summary.fiveHourUsed !== void 0) {
|
|
137432
|
+
drawWindow(settings2.labels.fiveHour, summary.fiveHourUsed / FULL_PERCENT3, summary.fiveHourResetAt);
|
|
137433
|
+
}
|
|
137434
|
+
if (summary.sevenDayUsed !== void 0) {
|
|
137435
|
+
drawWindow(settings2.labels.sevenDay, summary.sevenDayUsed / FULL_PERCENT3, summary.sevenDayResetAt);
|
|
137436
|
+
}
|
|
137437
|
+
if (summary.fiveHourUsed === void 0 && summary.sevenDayUsed === void 0) {
|
|
137438
|
+
for (const window of summary.providerQuotaWindows) {
|
|
137439
|
+
drawWindow(window.measures, window.utilization, window.resetsAt);
|
|
137066
137440
|
}
|
|
137067
|
-
|
|
137068
|
-
case "claude_enterprise":
|
|
137069
|
-
return "Enterprise";
|
|
137070
|
-
default:
|
|
137071
|
-
return summary.loginOrganizationType;
|
|
137072
|
-
}
|
|
137073
|
-
}
|
|
137074
|
-
function planLabelOf(tier) {
|
|
137075
|
-
if (tier === void 0 || tier === "") {
|
|
137076
|
-
return void 0;
|
|
137077
|
-
}
|
|
137078
|
-
const cleaned = tier.startsWith("default_") ? tier.slice("default_".length) : tier;
|
|
137079
|
-
if (cleaned === "free") {
|
|
137080
|
-
return "Free";
|
|
137081
|
-
}
|
|
137082
|
-
const maxWithMultiplier = /^claude_max_(\d+)x$/.exec(cleaned);
|
|
137083
|
-
if (maxWithMultiplier !== null) {
|
|
137084
|
-
return `Max ${maxWithMultiplier[1] ?? ""}x`;
|
|
137085
|
-
}
|
|
137086
|
-
if (cleaned === "claude_max") {
|
|
137087
|
-
return "Max";
|
|
137088
|
-
}
|
|
137089
|
-
if (cleaned === "claude_pro") {
|
|
137090
|
-
return "Pro";
|
|
137091
|
-
}
|
|
137092
|
-
return cleaned;
|
|
137093
|
-
}
|
|
137094
|
-
function secondsUntil(resetAt, nowMs) {
|
|
137095
|
-
if (resetAt === void 0) {
|
|
137096
|
-
return void 0;
|
|
137441
|
+
}
|
|
137097
137442
|
}
|
|
137098
|
-
|
|
137099
|
-
return Number.isNaN(resetMs) ? void 0 : Math.max(0, Math.round((resetMs - nowMs) / THOUSAND));
|
|
137100
|
-
}
|
|
137101
|
-
function drawBar(fraction, cells, bands) {
|
|
137102
|
-
const clamped = Math.max(0, Math.min(1, fraction));
|
|
137103
|
-
const filled = Math.round(clamped * cells);
|
|
137104
|
-
const color = statusColor(clamped, true, bands);
|
|
137105
|
-
return color === "" ? `[${"\u2588".repeat(filled)}${"\u2591".repeat(cells - filled)}]` : `[${color}${"\u2588".repeat(filled)}${DIM}${"\u2591".repeat(cells - filled)}${RESET}]`;
|
|
137106
|
-
}
|
|
137107
|
-
function barCell(prefix, suffix, fraction, bands) {
|
|
137108
|
-
return { prefix, suffix, draw: (cells) => drawBar(fraction, cells, bands) };
|
|
137443
|
+
return { kind: "bars", cells };
|
|
137109
137444
|
}
|
|
137445
|
+
|
|
137446
|
+
// src/statusline/elements/registry.ts
|
|
137447
|
+
var HEADER_ROLES = {
|
|
137448
|
+
model: "model",
|
|
137449
|
+
provider: "model",
|
|
137450
|
+
route: "label",
|
|
137451
|
+
account: "label",
|
|
137452
|
+
identity: "label",
|
|
137453
|
+
headroom: "label"
|
|
137454
|
+
};
|
|
137455
|
+
var ELEMENTS = {
|
|
137456
|
+
header: { model: modelSegment, provider: providerSegment, route: routeSegment, account: accountSegment, identity: identitySegment, headroom: headroomSegment },
|
|
137457
|
+
rows: { context: contextRow, quota: quotaRow }
|
|
137458
|
+
};
|
|
137459
|
+
|
|
137460
|
+
// src/statusline/headerLayout.ts
|
|
137110
137461
|
function justify(texts, maxWidth, separator) {
|
|
137111
137462
|
if (texts.length < 2) {
|
|
137112
137463
|
return texts.join(separator);
|
|
@@ -137156,80 +137507,41 @@ function layoutHeader(texts, maxWidth, separator) {
|
|
|
137156
137507
|
}
|
|
137157
137508
|
return lines.map((line) => justify(line, maxWidth, separator)).join("\n");
|
|
137158
137509
|
}
|
|
137159
|
-
|
|
137160
|
-
|
|
137161
|
-
|
|
137162
|
-
|
|
137163
|
-
|
|
137164
|
-
|
|
137165
|
-
|
|
137166
|
-
|
|
137167
|
-
|
|
137168
|
-
|
|
137169
|
-
}
|
|
137170
|
-
if (summary.routedTarget !== void 0 && !choiceNamesProvider) {
|
|
137171
|
-
segments.route = `via ${summary.routedTarget}`;
|
|
137172
|
-
}
|
|
137173
|
-
const loginPlan = summary.provider === void 0 ? summary.loginPlan ?? accountPlanLabel(summary) : void 0;
|
|
137174
|
-
const loginOrgName = summary.loginOrganizationType === "claude_team" || summary.loginOrganizationType === "claude_enterprise" ? summary.loginOrganizationName : void 0;
|
|
137175
|
-
const loginParts = [summary.loginAccountEmail, loginOrgName, loginPlan].filter((part) => part !== void 0);
|
|
137176
|
-
if (summary.loginAccountEmail !== void 0 && summary.loginAccountEmail !== summary.providerAccountEmail) {
|
|
137177
|
-
segments.account = loginParts.join(" \xB7 ");
|
|
137178
|
-
} else if (summary.provider === void 0 && loginParts.length > 0) {
|
|
137179
|
-
segments.account = loginParts.join(" \xB7 ");
|
|
137180
|
-
}
|
|
137181
|
-
if (summary.identity !== void 0 && summary.provider !== void 0 && summary.identity !== summary.providerAccountEmail && summary.identity !== summary.loginAccountEmail) {
|
|
137182
|
-
segments.identity = summary.identity;
|
|
137183
|
-
}
|
|
137184
|
-
const savings = headroomText(summary.headroom);
|
|
137185
|
-
if (savings !== void 0) {
|
|
137186
|
-
segments.headroom = savings;
|
|
137187
|
-
}
|
|
137188
|
-
const header = settings2.header.flatMap((name) => segments[name] ?? []);
|
|
137189
|
-
const bands = { warnAt: settings2.warnAt, criticalAt: settings2.criticalAt };
|
|
137190
|
-
const contextGroup = [];
|
|
137191
|
-
if (view.contextUsedPercentage !== void 0) {
|
|
137192
|
-
const fraction = Math.max(0, Math.min(1, view.contextUsedPercentage / FULL_PERCENT3));
|
|
137193
|
-
const color = statusColor(fraction, true, bands);
|
|
137194
|
-
const percent2 = `${color}${view.contextUsedPercentage.toFixed(1)}%${RESET}`;
|
|
137195
|
-
const tokens = view.contextTotalTokens !== void 0 && view.contextWindowTokens !== void 0 ? `${formatTokens(view.contextTotalTokens)}/${formatTokens(view.contextWindowTokens)} ` : "";
|
|
137196
|
-
const cache = cacheShareText(view, bands);
|
|
137197
|
-
contextGroup.push(barCell(`Ctx ${tokens}`, ` ${percent2}${cache}`, fraction, bands));
|
|
137198
|
-
}
|
|
137199
|
-
const quotaGroup = [];
|
|
137200
|
-
const drawWindow = (label, fraction, resetsAt) => {
|
|
137201
|
-
const clamped = Math.max(0, Math.min(1, fraction));
|
|
137202
|
-
const color = statusColor(clamped, true, bands);
|
|
137203
|
-
quotaGroup.push(barCell(`${label} `, ` ${color}${(fraction * FULL_PERCENT3).toFixed(1)}%${RESET} (${formatDuration(secondsUntil(resetsAt, nowMs))})`, clamped, bands));
|
|
137204
|
-
};
|
|
137205
|
-
if (summary.quotaFamilies.length > 0) {
|
|
137206
|
-
for (const window of summary.quotaFamilies) {
|
|
137207
|
-
drawWindow(window.measures, window.utilization, window.resetsAt);
|
|
137208
|
-
}
|
|
137209
|
-
} else {
|
|
137210
|
-
if (summary.fiveHourUsed !== void 0) {
|
|
137211
|
-
drawWindow(settings2.fiveHourLabel, summary.fiveHourUsed / FULL_PERCENT3, summary.fiveHourResetAt);
|
|
137212
|
-
}
|
|
137213
|
-
if (summary.sevenDayUsed !== void 0) {
|
|
137214
|
-
drawWindow(settings2.sevenDayLabel, summary.sevenDayUsed / FULL_PERCENT3, summary.sevenDayResetAt);
|
|
137215
|
-
}
|
|
137216
|
-
if (summary.fiveHourUsed === void 0 && summary.sevenDayUsed === void 0) {
|
|
137217
|
-
for (const window of summary.providerQuotaWindows) {
|
|
137218
|
-
drawWindow(window.measures, window.utilization, window.resetsAt);
|
|
137219
|
-
}
|
|
137220
|
-
}
|
|
137221
|
-
}
|
|
137510
|
+
|
|
137511
|
+
// src/statusline/render.ts
|
|
137512
|
+
var RESERVED_COLUMNS = 4;
|
|
137513
|
+
var SEPARATOR2 = " | ";
|
|
137514
|
+
function renderStatuslineBlock(summary, view, terminalWidth, nowMs, settings2 = STATUSLINE_DEFAULTS, elements = ELEMENTS, env = process.env) {
|
|
137515
|
+
const context = { summary, view, nowMs, settings: settings2, palette: createPalette(settings2.colours, colourEnabled(env)) };
|
|
137516
|
+
const header = settings2.layout.header.flatMap((name) => {
|
|
137517
|
+
const text2 = elements.header[name](context);
|
|
137518
|
+
return text2 === void 0 ? [] : context.palette.paint(HEADER_ROLES[name], text2);
|
|
137519
|
+
});
|
|
137222
137520
|
const width = Math.max(TWENTY, terminalWidth - RESERVED_COLUMNS);
|
|
137223
137521
|
const lines = [];
|
|
137224
137522
|
if (header.length > 0) {
|
|
137225
137523
|
lines.push(layoutHeader(header, width, SEPARATOR2));
|
|
137226
137524
|
}
|
|
137227
|
-
|
|
137228
|
-
|
|
137525
|
+
let barGroups = [];
|
|
137526
|
+
const flushBars = () => {
|
|
137527
|
+
lines.push(...layoutBarGrid(barGroups, width, SEPARATOR2, settings2.bar.width));
|
|
137528
|
+
barGroups = [];
|
|
137529
|
+
};
|
|
137530
|
+
for (const name of settings2.layout.rows) {
|
|
137531
|
+
const output2 = elements.rows[name](context);
|
|
137532
|
+
if (output2.kind === "bars") {
|
|
137533
|
+
barGroups.push(output2.cells);
|
|
137534
|
+
} else {
|
|
137535
|
+
flushBars();
|
|
137536
|
+
lines.push(...output2.lines);
|
|
137537
|
+
}
|
|
137538
|
+
}
|
|
137539
|
+
flushBars();
|
|
137229
137540
|
return lines.join("\n");
|
|
137230
137541
|
}
|
|
137231
137542
|
|
|
137232
137543
|
// src/statusline/commands.ts
|
|
137544
|
+
init_keys();
|
|
137233
137545
|
init_settings2();
|
|
137234
137546
|
|
|
137235
137547
|
// src/statusline/width.ts
|
|
@@ -137281,8 +137593,9 @@ async function readAllStdin() {
|
|
|
137281
137593
|
}
|
|
137282
137594
|
var ROUTED_TARGET_LOOKBACK_MS = 36e5;
|
|
137283
137595
|
function registerStatuslineCommand(program2, deps) {
|
|
137596
|
+
const statusline = program2.command("statusline");
|
|
137284
137597
|
withExamples(
|
|
137285
|
-
|
|
137598
|
+
statusline.description("Serve as a statusline entrypoint: read the client's stdin payload, add the identity's live provider, account and usage windows under an agent_shim key, then run the renderer named in AGENT_SHIM_STATUSLINE_CMD or print the built-in line.").action(async () => {
|
|
137286
137599
|
const stdin2 = await readAllStdin();
|
|
137287
137600
|
let payload;
|
|
137288
137601
|
try {
|
|
@@ -137370,6 +137683,19 @@ function registerStatuslineCommand(program2, deps) {
|
|
|
137370
137683
|
}),
|
|
137371
137684
|
["$ agent-shim statusline # a client's statusline setting names this; it renders or delegates"]
|
|
137372
137685
|
);
|
|
137686
|
+
registerStatuslineKeys(statusline);
|
|
137687
|
+
}
|
|
137688
|
+
function registerStatuslineKeys(statusline) {
|
|
137689
|
+
withExamples(
|
|
137690
|
+
statusline.command("keys").description("List every setting of the built-in statusline with its kind, its default and what it does.").option("--json", "Print the settings as JSON."),
|
|
137691
|
+
["agent-shim statusline keys", "agent-shim statusline keys --json"]
|
|
137692
|
+
).action((options) => {
|
|
137693
|
+
if (options.json === true) {
|
|
137694
|
+
printJson(statuslineKeys());
|
|
137695
|
+
return;
|
|
137696
|
+
}
|
|
137697
|
+
console.log(formatStatuslineKeys(statuslineKeys()));
|
|
137698
|
+
});
|
|
137373
137699
|
}
|
|
137374
137700
|
|
|
137375
137701
|
// node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.0_supports-color@7.2.0_zod@4.6.5/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
|
|
@@ -145437,7 +145763,7 @@ var Protocol = class {
|
|
|
145437
145763
|
};
|
|
145438
145764
|
}
|
|
145439
145765
|
};
|
|
145440
|
-
function
|
|
145766
|
+
function isPlainObject4(value2) {
|
|
145441
145767
|
return value2 !== null && typeof value2 === "object" && !Array.isArray(value2);
|
|
145442
145768
|
}
|
|
145443
145769
|
function mergeCapabilities(base, additional) {
|
|
@@ -145448,7 +145774,7 @@ function mergeCapabilities(base, additional) {
|
|
|
145448
145774
|
if (addValue === void 0)
|
|
145449
145775
|
continue;
|
|
145450
145776
|
const baseValue = result[k10];
|
|
145451
|
-
if (
|
|
145777
|
+
if (isPlainObject4(baseValue) && isPlainObject4(addValue)) {
|
|
145452
145778
|
result[k10] = { ...baseValue, ...addValue };
|
|
145453
145779
|
} else {
|
|
145454
145780
|
result[k10] = addValue;
|