agent-shim 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/index.cjs
CHANGED
|
@@ -138,12 +138,37 @@ var init_proxyBypass = __esm({
|
|
|
138
138
|
}
|
|
139
139
|
});
|
|
140
140
|
|
|
141
|
+
// src/statusline/blank.ts
|
|
142
|
+
function drawsNothing(text) {
|
|
143
|
+
return (0, import_string_width.default)(text.replace(BLANK_CELLS, "")) === 0;
|
|
144
|
+
}
|
|
145
|
+
var import_string_width, BLANK_CELLS;
|
|
146
|
+
var init_blank = __esm({
|
|
147
|
+
"src/statusline/blank.ts"() {
|
|
148
|
+
"use strict";
|
|
149
|
+
import_string_width = __toESM(require("string-width"), 1);
|
|
150
|
+
BLANK_CELLS = /[\p{Zs}\u2800\u3164\uFFA0]/gu;
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
// src/statusline/graphemes.ts
|
|
155
|
+
function graphemesOf(text) {
|
|
156
|
+
return Array.from(SEGMENTER.segment(text), (part) => part.segment);
|
|
157
|
+
}
|
|
158
|
+
var SEGMENTER;
|
|
159
|
+
var init_graphemes = __esm({
|
|
160
|
+
"src/statusline/graphemes.ts"() {
|
|
161
|
+
"use strict";
|
|
162
|
+
SEGMENTER = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
|
|
141
166
|
// src/config/statusline.ts
|
|
142
167
|
function distinctList(member) {
|
|
143
168
|
return import_zod.z.array(member).refine((items) => new Set(items).size === items.length, "must not repeat an entry");
|
|
144
169
|
}
|
|
145
170
|
function isSingleVisibleGrapheme(text) {
|
|
146
|
-
return
|
|
171
|
+
return graphemesOf(text).length === 1 && (0, import_string_width2.default)(text) === 1 && !/[\p{C}\p{Z}]/u.test(text) && !drawsNothing(text);
|
|
147
172
|
}
|
|
148
173
|
function isPlainObject(value) {
|
|
149
174
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -165,11 +190,14 @@ function resolveStatusline(settings) {
|
|
|
165
190
|
}
|
|
166
191
|
return resolved;
|
|
167
192
|
}
|
|
168
|
-
var import_zod, STATUSLINE_HEADER_SEGMENTS, STATUSLINE_ROWS, STATUSLINE_COLOUR_NAMES, DEFAULT_HEADER_SEGMENTS, DEFAULT_ROWS, STATUSLINE_PATH_LEVELS, MAX_PERCENT, MAX_STATUSLINE_PALETTE_INDEX,
|
|
193
|
+
var import_string_width2, import_zod, 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;
|
|
169
194
|
var init_statusline = __esm({
|
|
170
195
|
"src/config/statusline.ts"() {
|
|
171
196
|
"use strict";
|
|
197
|
+
import_string_width2 = __toESM(require("string-width"), 1);
|
|
172
198
|
import_zod = require("zod");
|
|
199
|
+
init_blank();
|
|
200
|
+
init_graphemes();
|
|
173
201
|
STATUSLINE_HEADER_SEGMENTS = ["model", "provider", "route", "account", "identity", "headroom", "project", "vcs", "effort", "advisor", "version", "outputStyle"];
|
|
174
202
|
STATUSLINE_ROWS = ["context", "quota", "addedDirs", "gitFiles"];
|
|
175
203
|
STATUSLINE_COLOUR_NAMES = [
|
|
@@ -195,20 +223,23 @@ var init_statusline = __esm({
|
|
|
195
223
|
DEFAULT_HEADER_SEGMENTS = ["model", "provider", "route", "account", "identity", "headroom"];
|
|
196
224
|
DEFAULT_ROWS = ["context", "quota"];
|
|
197
225
|
STATUSLINE_PATH_LEVELS = ["1", "2", "3", "full"];
|
|
226
|
+
STATUSLINE_USAGE_VALUES = ["used", "remaining"];
|
|
227
|
+
STATUSLINE_TIME_FORMATS = ["relative", "absolute", "both", "elapsed", "elapsedAndAbsolute"];
|
|
228
|
+
STATUSLINE_HOUR_CYCLES = ["auto", "h11", "h12", "h23", "h24"];
|
|
198
229
|
MAX_PERCENT = 100;
|
|
199
230
|
MAX_STATUSLINE_PALETTE_INDEX = 255;
|
|
200
|
-
|
|
231
|
+
MAX_STATUSLINE_LABEL_COLUMNS = 12;
|
|
201
232
|
MAX_BAR_CELLS = 40;
|
|
202
233
|
MAX_ACCOUNT_USER_CHARS = 254;
|
|
203
234
|
MAX_DISPLAY_TEXT_CHARS = 80;
|
|
204
235
|
LABEL_RE2 = /^[^\p{C}\p{Z}]+(?: [^\p{C}\p{Z}]+)*$/u;
|
|
205
236
|
OPTIONAL_LABEL_RE = /^(?:[^\p{C}\p{Z}]+(?: [^\p{C}\p{Z}]+)*)?$/u;
|
|
206
237
|
colourValue = import_zod.z.union([import_zod.z.enum(STATUSLINE_COLOUR_NAMES), import_zod.z.number().int().min(0).max(MAX_STATUSLINE_PALETTE_INDEX), import_zod.z.string().regex(/^#[0-9a-fA-F]{6}$/, "must be a colour name, a palette index from 0 to 255 or #rrggbb")]);
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
labelText = import_zod.z.string().max(MAX_STATUSLINE_LABEL_CHARS).regex(LABEL_RE2, "must be visible text without control characters");
|
|
238
|
+
barCharacter = import_zod.z.string().refine(isSingleVisibleGrapheme, "must be a single visible character that takes one terminal column");
|
|
239
|
+
labelText = import_zod.z.string().refine((text) => (0, import_string_width2.default)(text) <= MAX_STATUSLINE_LABEL_COLUMNS, `must take no more than ${String(MAX_STATUSLINE_LABEL_COLUMNS)} terminal columns`).refine((text) => !drawsNothing(text), "must show something: a label of only combining marks or blank characters draws nothing").regex(LABEL_RE2, "must be visible text without control characters");
|
|
210
240
|
overrideText = import_zod.z.string().max(MAX_DISPLAY_TEXT_CHARS).regex(OPTIONAL_LABEL_RE, "must be visible text without control characters");
|
|
211
241
|
wholePercent = import_zod.z.number().int().min(1).max(MAX_PERCENT);
|
|
242
|
+
thresholdPercent = import_zod.z.number().int().min(0).max(MAX_PERCENT);
|
|
212
243
|
SHAPES = {
|
|
213
244
|
layout: {
|
|
214
245
|
header: distinctList(import_zod.z.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."),
|
|
@@ -245,6 +276,20 @@ var init_statusline = __esm({
|
|
|
245
276
|
filled: barCharacter.describe("The character that draws the used part of a bar."),
|
|
246
277
|
empty: barCharacter.describe("The character that draws the unused part of a bar.")
|
|
247
278
|
},
|
|
279
|
+
usage: {
|
|
280
|
+
value: import_zod.z.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."),
|
|
281
|
+
bar: import_zod.z.boolean().describe("Whether each quota window is drawn as a bar, or as text alone."),
|
|
282
|
+
compact: import_zod.z.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."),
|
|
283
|
+
resetLabel: import_zod.z.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)`."),
|
|
284
|
+
modelScoped: import_zod.z.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."),
|
|
285
|
+
timeFormat: import_zod.z.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."),
|
|
286
|
+
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."),
|
|
287
|
+
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.")
|
|
288
|
+
},
|
|
289
|
+
clock: {
|
|
290
|
+
hourCycle: import_zod.z.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)."),
|
|
291
|
+
seconds: import_zod.z.boolean().describe("Whether a wall-clock time includes seconds (`14:30:07`).")
|
|
292
|
+
},
|
|
248
293
|
colours: {
|
|
249
294
|
context: colourValue.describe("The colour of the context bar and its figures below the warning threshold."),
|
|
250
295
|
usage: colourValue.describe("The colour of the quota bars and their figures below the warning threshold."),
|
|
@@ -287,6 +332,8 @@ var init_statusline = __esm({
|
|
|
287
332
|
bands: import_zod.z.strictObject(SHAPES.bands).partial().optional(),
|
|
288
333
|
labels: import_zod.z.strictObject(SHAPES.labels).partial().optional(),
|
|
289
334
|
bar: import_zod.z.strictObject(SHAPES.bar).partial().optional(),
|
|
335
|
+
usage: import_zod.z.strictObject(SHAPES.usage).partial().optional(),
|
|
336
|
+
clock: import_zod.z.strictObject(SHAPES.clock).partial().optional(),
|
|
290
337
|
colours: import_zod.z.strictObject(SHAPES.colours).partial().optional(),
|
|
291
338
|
project: import_zod.z.strictObject(SHAPES.project).partial().optional(),
|
|
292
339
|
git: import_zod.z.strictObject(SHAPES.git).partial().optional(),
|
|
@@ -302,6 +349,8 @@ var init_statusline = __esm({
|
|
|
302
349
|
bands: import_zod.z.strictObject(SHAPES.bands),
|
|
303
350
|
labels: import_zod.z.strictObject(SHAPES.labels),
|
|
304
351
|
bar: import_zod.z.strictObject(SHAPES.bar),
|
|
352
|
+
usage: import_zod.z.strictObject(SHAPES.usage),
|
|
353
|
+
clock: import_zod.z.strictObject(SHAPES.clock),
|
|
305
354
|
colours: import_zod.z.strictObject(SHAPES.colours),
|
|
306
355
|
project: import_zod.z.strictObject(SHAPES.project),
|
|
307
356
|
git: import_zod.z.strictObject(SHAPES.git),
|
|
@@ -317,6 +366,8 @@ var init_statusline = __esm({
|
|
|
317
366
|
bands: { warnAt: 70, criticalAt: 90 },
|
|
318
367
|
labels: { fiveHour: "5h", sevenDay: "Wk" },
|
|
319
368
|
bar: { width: 10, filled: "\u2588", empty: "\u2591" },
|
|
369
|
+
usage: { value: "used", bar: true, compact: false, resetLabel: false, modelScoped: false, timeFormat: "relative", threshold: 0, sevenDayThreshold: 0 },
|
|
370
|
+
clock: { hourCycle: "auto", seconds: false },
|
|
320
371
|
colours: {
|
|
321
372
|
context: "green",
|
|
322
373
|
usage: "green",
|
|
@@ -4399,7 +4450,7 @@ var init_package = __esm({
|
|
|
4399
4450
|
"package.json"() {
|
|
4400
4451
|
package_default = {
|
|
4401
4452
|
name: "agent-shim",
|
|
4402
|
-
version: "11.
|
|
4453
|
+
version: "11.56.0",
|
|
4403
4454
|
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.",
|
|
4404
4455
|
license: "MIT",
|
|
4405
4456
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -4457,6 +4508,7 @@ var init_package = __esm({
|
|
|
4457
4508
|
commander: "^15.0.0",
|
|
4458
4509
|
cosmiconfig: "^10.0.1",
|
|
4459
4510
|
picomatch: "^4.0.7",
|
|
4511
|
+
"string-width": "8.3.0",
|
|
4460
4512
|
trilean: "1.7.1",
|
|
4461
4513
|
undici: "7.29.1",
|
|
4462
4514
|
zod: "^4.6.1"
|
|
@@ -5685,6 +5737,9 @@ function hasDesktopSession() {
|
|
|
5685
5737
|
const result = (0, import_node_child_process2.spawnSync)("launchctl", ["managername"], { encoding: "utf8" });
|
|
5686
5738
|
return result.status === 0 && result.stdout.trim() === MACOS_GUI_SESSION_MANAGER;
|
|
5687
5739
|
}
|
|
5740
|
+
return hasDisplayServer();
|
|
5741
|
+
}
|
|
5742
|
+
function hasDisplayServer() {
|
|
5688
5743
|
if (process.platform === "win32") {
|
|
5689
5744
|
return false;
|
|
5690
5745
|
}
|
|
@@ -8256,51 +8311,77 @@ function unpackKeyringToken(raw) {
|
|
|
8256
8311
|
}
|
|
8257
8312
|
return trimmed;
|
|
8258
8313
|
}
|
|
8259
|
-
function
|
|
8260
|
-
|
|
8314
|
+
function declined(reason, warn = false) {
|
|
8315
|
+
return { ok: false, reason, warn };
|
|
8316
|
+
}
|
|
8317
|
+
function isCommandBacked(source) {
|
|
8318
|
+
return "command" in source || "op" in source || "keychain" in source;
|
|
8319
|
+
}
|
|
8320
|
+
function immediateOutcome(source, params) {
|
|
8261
8321
|
if ("env" in source) {
|
|
8262
8322
|
const value = params.env[source.env];
|
|
8263
|
-
return value === void 0 || value === "" ?
|
|
8323
|
+
return value === void 0 || value === "" ? declined("is unset or empty") : { ok: true, token: unpackKeyringToken(value) };
|
|
8264
8324
|
}
|
|
8265
8325
|
if ("literal" in source) {
|
|
8266
8326
|
return { ok: true, token: source.literal };
|
|
8267
8327
|
}
|
|
8268
|
-
|
|
8269
|
-
|
|
8270
|
-
|
|
8271
|
-
return none("does not exist");
|
|
8272
|
-
}
|
|
8273
|
-
if (read.mode !== void 0 && (read.mode & GROUP_OTHER_PERMISSION_BITS) !== 0) {
|
|
8274
|
-
return none(
|
|
8275
|
-
`is readable or writable by group or others (mode ${(read.mode & PERMISSION_BITS2).toString(OCTAL_RADIX2)}); run \`chmod 600 ${source.file}\``,
|
|
8276
|
-
true
|
|
8277
|
-
);
|
|
8278
|
-
}
|
|
8279
|
-
const token2 = unpackKeyringToken(read.content.trim());
|
|
8280
|
-
return token2 === "" ? none("is empty") : { ok: true, token: token2 };
|
|
8328
|
+
const read = params.port.readSecretFile(source.file);
|
|
8329
|
+
if (!read.found) {
|
|
8330
|
+
return declined("does not exist");
|
|
8281
8331
|
}
|
|
8282
|
-
|
|
8283
|
-
|
|
8284
|
-
|
|
8285
|
-
|
|
8332
|
+
if (read.mode !== void 0 && (read.mode & GROUP_OTHER_PERMISSION_BITS) !== 0) {
|
|
8333
|
+
return declined(
|
|
8334
|
+
`is readable or writable by group or others (mode ${(read.mode & PERMISSION_BITS2).toString(OCTAL_RADIX2)}); run \`chmod 600 ${source.file}\``,
|
|
8335
|
+
true
|
|
8336
|
+
);
|
|
8286
8337
|
}
|
|
8287
|
-
const
|
|
8288
|
-
|
|
8338
|
+
const token = unpackKeyringToken(read.content.trim());
|
|
8339
|
+
return token === "" ? declined("is empty") : { ok: true, token };
|
|
8340
|
+
}
|
|
8341
|
+
function commandRunOf(source, env) {
|
|
8342
|
+
const interactive = isInteractiveSource(source, env);
|
|
8343
|
+
return { argv: commandArgv(source), interactive, timeoutMs: source.timeoutMs ?? (interactive ? CREDENTIAL_INTERACTIVE_TIMEOUT_MS : CREDENTIAL_COMMAND_TIMEOUT_MS) };
|
|
8344
|
+
}
|
|
8345
|
+
function commandOutcome(result, timeoutMs) {
|
|
8289
8346
|
if (result.timedOut) {
|
|
8290
|
-
return
|
|
8347
|
+
return declined(`timed out after ${String(timeoutMs)}ms`);
|
|
8291
8348
|
}
|
|
8292
8349
|
if (result.status !== 0) {
|
|
8293
8350
|
const stderr = result.stderr.trim();
|
|
8294
8351
|
const outcome = result.status === null ? "could not be run or was killed by a signal" : `exited with status ${String(result.status)}`;
|
|
8295
|
-
return
|
|
8352
|
+
return declined(`${outcome}${stderr === "" ? "" : `: ${stderr}`}`);
|
|
8296
8353
|
}
|
|
8297
8354
|
const token = unpackKeyringToken(result.stdout.trim());
|
|
8298
|
-
return token === "" ?
|
|
8355
|
+
return token === "" ? declined("printed no token") : { ok: true, token };
|
|
8356
|
+
}
|
|
8357
|
+
function trySource(source, params) {
|
|
8358
|
+
if (!isCommandBacked(source)) {
|
|
8359
|
+
return immediateOutcome(source, params);
|
|
8360
|
+
}
|
|
8361
|
+
const run = commandRunOf(source, params.env);
|
|
8362
|
+
if (run.interactive && !params.port.personPresent()) {
|
|
8363
|
+
return declined(NO_PERSON_REASON);
|
|
8364
|
+
}
|
|
8365
|
+
return commandOutcome(params.port.runCommand(run.argv, { timeoutMs: run.timeoutMs, interactive: run.interactive }), run.timeoutMs);
|
|
8299
8366
|
}
|
|
8300
8367
|
function warmCommandFor(subject) {
|
|
8301
8368
|
const [kind, name] = subject.split(" ");
|
|
8302
8369
|
return kind === "provider" ? `agent-shim credential warm --provider ${name ?? ""}` : `agent-shim credential warm ${name ?? ""}`;
|
|
8303
8370
|
}
|
|
8371
|
+
function cachedResolution(target, entry) {
|
|
8372
|
+
return { ok: true, credential: { target, token: entry.token, source: entry.source, warnings: [], cachedAt: entry.fetchedAt } };
|
|
8373
|
+
}
|
|
8374
|
+
function liveResolution(target, token, source, warnings) {
|
|
8375
|
+
return { ok: true, credential: { target, token, source, warnings } };
|
|
8376
|
+
}
|
|
8377
|
+
function unresolved(subject, cacheBlock, attempts) {
|
|
8378
|
+
const hint = cacheBlock === void 0 ? "" : `; fill the cache from a terminal with \`${warmCommandFor(subject)}\``;
|
|
8379
|
+
return { ok: false, message: `agent-shim: ${subject} has no usable credential: ${attempts.join("; ")}${hint}` };
|
|
8380
|
+
}
|
|
8381
|
+
function declinedLine(source, outcome, subject) {
|
|
8382
|
+
const attempt = `${describeSource(source)} ${outcome.reason}`;
|
|
8383
|
+
return { attempt, warning: outcome.warn ? `agent-shim: ${subject}: skipped ${attempt}` : void 0 };
|
|
8384
|
+
}
|
|
8304
8385
|
function resolveCredential(params) {
|
|
8305
8386
|
const target = params.credential.target ?? "bearer";
|
|
8306
8387
|
const cacheBlock = params.credential.cache;
|
|
@@ -8309,7 +8390,7 @@ function resolveCredential(params) {
|
|
|
8309
8390
|
if (cacheBlock !== void 0 && cache !== void 0 && store !== void 0 && params.refresh !== true) {
|
|
8310
8391
|
const entry = cache.port.read(store, params.subject);
|
|
8311
8392
|
if (entry !== void 0 && isFresh(entry, cacheBlock, cache.now())) {
|
|
8312
|
-
return
|
|
8393
|
+
return cachedResolution(target, entry);
|
|
8313
8394
|
}
|
|
8314
8395
|
}
|
|
8315
8396
|
const attempts = [];
|
|
@@ -8320,16 +8401,15 @@ function resolveCredential(params) {
|
|
|
8320
8401
|
if (cache !== void 0 && store !== void 0) {
|
|
8321
8402
|
cache.port.write(store, params.subject, { token: outcome.token, fetchedAt: cache.now(), source });
|
|
8322
8403
|
}
|
|
8323
|
-
return
|
|
8404
|
+
return liveResolution(target, outcome.token, source, warnings);
|
|
8324
8405
|
}
|
|
8325
|
-
const line =
|
|
8326
|
-
attempts.push(line);
|
|
8327
|
-
if (
|
|
8328
|
-
warnings.push(
|
|
8406
|
+
const line = declinedLine(source, outcome, params.subject);
|
|
8407
|
+
attempts.push(line.attempt);
|
|
8408
|
+
if (line.warning !== void 0) {
|
|
8409
|
+
warnings.push(line.warning);
|
|
8329
8410
|
}
|
|
8330
8411
|
}
|
|
8331
|
-
|
|
8332
|
-
return { ok: false, message: `agent-shim: ${params.subject} has no usable credential: ${attempts.join("; ")}${hint}` };
|
|
8412
|
+
return unresolved(params.subject, cacheBlock, attempts);
|
|
8333
8413
|
}
|
|
8334
8414
|
function credentialVariables(target, token) {
|
|
8335
8415
|
return {
|
|
@@ -8338,7 +8418,7 @@ function credentialVariables(target, token) {
|
|
|
8338
8418
|
CLAUDE_CODE_OAUTH_TOKEN: target === "oauthToken" ? token : void 0
|
|
8339
8419
|
};
|
|
8340
8420
|
}
|
|
8341
|
-
var CREDENTIAL_UNAVAILABLE_EXIT, CREDENTIAL_COMMAND_TIMEOUT_MS, CREDENTIAL_INTERACTIVE_TIMEOUT_MS, GROUP_OTHER_PERMISSION_BITS, PERMISSION_BITS2, OCTAL_RADIX2, GO_KEYRING_BASE64_PREFIX;
|
|
8421
|
+
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;
|
|
8342
8422
|
var init_credential = __esm({
|
|
8343
8423
|
"src/credential.ts"() {
|
|
8344
8424
|
"use strict";
|
|
@@ -8350,6 +8430,7 @@ var init_credential = __esm({
|
|
|
8350
8430
|
PERMISSION_BITS2 = 511;
|
|
8351
8431
|
OCTAL_RADIX2 = 8;
|
|
8352
8432
|
GO_KEYRING_BASE64_PREFIX = "go-keyring-base64:";
|
|
8433
|
+
NO_PERSON_REASON = "needs a person to approve it, but there is no terminal or desktop session";
|
|
8353
8434
|
}
|
|
8354
8435
|
});
|
|
8355
8436
|
|
|
@@ -11446,13 +11527,13 @@ function resolveLaunch(params) {
|
|
|
11446
11527
|
environment
|
|
11447
11528
|
};
|
|
11448
11529
|
}
|
|
11449
|
-
function runLaunchPlan(plan,
|
|
11530
|
+
function runLaunchPlan(plan, spawn4) {
|
|
11450
11531
|
try {
|
|
11451
11532
|
if (plan.hold() === "cancelled") {
|
|
11452
11533
|
return LAUNCH_CANCELLED_EXIT;
|
|
11453
11534
|
}
|
|
11454
11535
|
plan.markChildStarted();
|
|
11455
|
-
const result =
|
|
11536
|
+
const result = spawn4.spawnSync(plan.bin, plan.args, { stdio: "inherit", env: plan.env });
|
|
11456
11537
|
if (result.error !== void 0) {
|
|
11457
11538
|
throw result.error;
|
|
11458
11539
|
}
|
|
@@ -11993,7 +12074,7 @@ var init_identityClaude = __esm({
|
|
|
11993
12074
|
});
|
|
11994
12075
|
|
|
11995
12076
|
// src/usage/providerQuota.ts
|
|
11996
|
-
var import_zod34, MS_PER_SECOND9, SECONDS_PER_HOUR3, HOURS_PER_DAY6, DAYS_PER_MONTH, ZAI_HOST, ZAI_QUOTA_URL, ZAI_UNIT_HOURS, ZAI_UNIT_MONTHS, ZAI_UNIT_MS, ZaiLimitSchema, ZaiResponseSchema, OPENROUTER_HOST, OPENROUTER_KEY_URL, OPENROUTER_CREDITS_URL,
|
|
12077
|
+
var import_zod34, MS_PER_SECOND9, SECONDS_PER_HOUR3, HOURS_PER_DAY6, DAYS_PER_MONTH, ZAI_HOST, ZAI_QUOTA_URL, ZAI_UNIT_HOURS, ZAI_UNIT_MONTHS, ZAI_UNIT_MS, ZaiLimitSchema, ZaiResponseSchema, OPENROUTER_HOST, OPENROUTER_KEY_URL, OPENROUTER_CREDITS_URL, MS_PER_DAY2, OpenRouterKeySchema, OpenRouterCreditsSchema, ANTIGRAVITY_HOST, ANTIGRAVITY_QUOTA_URL, ANTIGRAVITY_USER_URL, FIVE_HOURS2, DAYS_PER_WEEK2, FIVE_HOURS_MS, WEEK_MS, AntigravityBucketSchema, AntigravitySummarySchema, GoogleTokenInfoSchema, AntigravityUserSchema;
|
|
11997
12078
|
var init_providerQuota = __esm({
|
|
11998
12079
|
"src/usage/providerQuota.ts"() {
|
|
11999
12080
|
"use strict";
|
|
@@ -12030,7 +12111,7 @@ var init_providerQuota = __esm({
|
|
|
12030
12111
|
OPENROUTER_HOST = "openrouter.ai";
|
|
12031
12112
|
OPENROUTER_KEY_URL = `https://${OPENROUTER_HOST}/api/v1/key`;
|
|
12032
12113
|
OPENROUTER_CREDITS_URL = `https://${OPENROUTER_HOST}/api/v1/credits`;
|
|
12033
|
-
|
|
12114
|
+
MS_PER_DAY2 = HOURS_PER_DAY6 * SECONDS_PER_HOUR3 * MS_PER_SECOND9;
|
|
12034
12115
|
OpenRouterKeySchema = import_zod34.z.object({
|
|
12035
12116
|
data: import_zod34.z.object({
|
|
12036
12117
|
limit: import_zod34.z.number().nonnegative().nullable(),
|
|
@@ -18634,13 +18715,8 @@ function createDoorHealthPublisher(hub, now, pid) {
|
|
|
18634
18715
|
}
|
|
18635
18716
|
|
|
18636
18717
|
// src/frontdoor/quotaExpiringEvents.ts
|
|
18718
|
+
init_pick();
|
|
18637
18719
|
init_schema2();
|
|
18638
|
-
var MS_PER_HOUR5 = 36e5;
|
|
18639
|
-
var MS_PER_DAY2 = 864e5;
|
|
18640
|
-
var FIVE_HOUR_WINDOW_HOURS = 5;
|
|
18641
|
-
var SEVEN_DAY_WINDOW_DAYS = 7;
|
|
18642
|
-
var FIVE_HOUR_WINDOW_MS2 = FIVE_HOUR_WINDOW_HOURS * MS_PER_HOUR5;
|
|
18643
|
-
var SEVEN_DAY_WINDOW_MS2 = SEVEN_DAY_WINDOW_DAYS * MS_PER_DAY2;
|
|
18644
18720
|
var FINAL_SPAN_DENOMINATOR = 30;
|
|
18645
18721
|
var QUOTA_EXPIRING_WINDOW_FRACTION = 1 / FINAL_SPAN_DENOMINATOR;
|
|
18646
18722
|
function createQuotaExpiringPublisher(hub, deps) {
|
|
@@ -18660,11 +18736,11 @@ function createQuotaExpiringPublisher(hub, deps) {
|
|
|
18660
18736
|
const unified = snapshot.providers[provider]?.rateLimit?.unified;
|
|
18661
18737
|
const fiveHour = unified?.fiveHour;
|
|
18662
18738
|
if (fiveHour?.utilization !== void 0 && fiveHour.resetsAt !== void 0) {
|
|
18663
|
-
views.push({ provider, view: { window: "fiveHour", spanMs:
|
|
18739
|
+
views.push({ provider, view: { window: "fiveHour", spanMs: FIVE_HOUR_WINDOW_MS, utilization: fiveHour.utilization, resetsAtMs: Date.parse(fiveHour.resetsAt) } });
|
|
18664
18740
|
}
|
|
18665
18741
|
const sevenDay = unified?.sevenDay;
|
|
18666
18742
|
if (sevenDay?.utilization !== void 0 && sevenDay.resetsAt !== void 0) {
|
|
18667
|
-
views.push({ provider, view: { window: "sevenDay", spanMs:
|
|
18743
|
+
views.push({ provider, view: { window: "sevenDay", spanMs: SEVEN_DAY_WINDOW_MS, utilization: sevenDay.utilization, resetsAtMs: Date.parse(sevenDay.resetsAt) } });
|
|
18668
18744
|
}
|
|
18669
18745
|
}
|
|
18670
18746
|
return views;
|