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/index.mjs
CHANGED
|
@@ -121,58 +121,123 @@ import { z } from "zod";
|
|
|
121
121
|
function distinctList(member) {
|
|
122
122
|
return z.array(member).refine((items) => new Set(items).size === items.length, "must not repeat a segment");
|
|
123
123
|
}
|
|
124
|
+
function isSingleVisibleGrapheme(text) {
|
|
125
|
+
return [...GRAPHEMES.segment(text)].length === 1 && !/[\p{C}\p{Z}]/u.test(text);
|
|
126
|
+
}
|
|
127
|
+
function isPlainObject(value) {
|
|
128
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
129
|
+
}
|
|
130
|
+
function mergeStatuslineSettings(base, over) {
|
|
131
|
+
if (!isPlainObject(base) || !isPlainObject(over)) {
|
|
132
|
+
return over === void 0 ? base : over;
|
|
133
|
+
}
|
|
134
|
+
const merged = { ...base };
|
|
135
|
+
for (const [key, value] of Object.entries(over)) {
|
|
136
|
+
merged[key] = key in base ? mergeStatuslineSettings(base[key], value) : value;
|
|
137
|
+
}
|
|
138
|
+
return merged;
|
|
139
|
+
}
|
|
124
140
|
function resolveStatusline(settings) {
|
|
125
|
-
const resolved =
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
warnAt: settings?.warnAt ?? STATUSLINE_DEFAULTS.warnAt,
|
|
129
|
-
criticalAt: settings?.criticalAt ?? STATUSLINE_DEFAULTS.criticalAt,
|
|
130
|
-
fiveHourLabel: settings?.fiveHourLabel ?? STATUSLINE_DEFAULTS.fiveHourLabel,
|
|
131
|
-
sevenDayLabel: settings?.sevenDayLabel ?? STATUSLINE_DEFAULTS.sevenDayLabel,
|
|
132
|
-
barWidth: settings?.barWidth ?? STATUSLINE_DEFAULTS.barWidth
|
|
133
|
-
};
|
|
134
|
-
if (resolved.warnAt >= resolved.criticalAt) {
|
|
135
|
-
throw new RangeError(`statusline warnAt (${String(resolved.warnAt)}) must be below criticalAt (${String(resolved.criticalAt)})`);
|
|
141
|
+
const resolved = ResolvedStatuslineSchema.parse(mergeStatuslineSettings(STATUSLINE_DEFAULTS, settings));
|
|
142
|
+
if (resolved.bands.warnAt >= resolved.bands.criticalAt) {
|
|
143
|
+
throw new RangeError(`statusline bands.warnAt (${String(resolved.bands.warnAt)}) must be below bands.criticalAt (${String(resolved.bands.criticalAt)})`);
|
|
136
144
|
}
|
|
137
145
|
return resolved;
|
|
138
146
|
}
|
|
139
|
-
var STATUSLINE_HEADER_SEGMENTS,
|
|
147
|
+
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;
|
|
140
148
|
var init_statusline = __esm({
|
|
141
149
|
"src/config/statusline.ts"() {
|
|
142
150
|
"use strict";
|
|
143
151
|
STATUSLINE_HEADER_SEGMENTS = ["model", "provider", "route", "account", "identity", "headroom"];
|
|
144
|
-
|
|
152
|
+
STATUSLINE_ROWS = ["context", "quota"];
|
|
153
|
+
STATUSLINE_COLOUR_NAMES = [
|
|
154
|
+
"default",
|
|
155
|
+
"dim",
|
|
156
|
+
"black",
|
|
157
|
+
"red",
|
|
158
|
+
"green",
|
|
159
|
+
"yellow",
|
|
160
|
+
"blue",
|
|
161
|
+
"magenta",
|
|
162
|
+
"cyan",
|
|
163
|
+
"white",
|
|
164
|
+
"brightBlack",
|
|
165
|
+
"brightRed",
|
|
166
|
+
"brightGreen",
|
|
167
|
+
"brightYellow",
|
|
168
|
+
"brightBlue",
|
|
169
|
+
"brightMagenta",
|
|
170
|
+
"brightCyan",
|
|
171
|
+
"brightWhite"
|
|
172
|
+
];
|
|
145
173
|
MAX_PERCENT = 100;
|
|
174
|
+
MAX_STATUSLINE_PALETTE_INDEX = 255;
|
|
146
175
|
MAX_STATUSLINE_LABEL_CHARS = 12;
|
|
147
176
|
MAX_BAR_CELLS = 40;
|
|
148
177
|
LABEL_RE2 = /^[^\p{C}\p{Z}]+(?: [^\p{C}\p{Z}]+)*$/u;
|
|
178
|
+
colourValue = z.union([z.enum(STATUSLINE_COLOUR_NAMES), z.number().int().min(0).max(MAX_STATUSLINE_PALETTE_INDEX), z.string().regex(/^#[0-9a-fA-F]{6}$/, "must be a colour name, a palette index from 0 to 255 or #rrggbb")]);
|
|
179
|
+
GRAPHEMES = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
180
|
+
barCharacter = z.string().refine(isSingleVisibleGrapheme, "must be a single visible character");
|
|
181
|
+
labelText = z.string().max(MAX_STATUSLINE_LABEL_CHARS).regex(LABEL_RE2, "must be visible text without control characters");
|
|
149
182
|
wholePercent = z.number().int().min(1).max(MAX_PERCENT);
|
|
183
|
+
SHAPES = {
|
|
184
|
+
layout: {
|
|
185
|
+
header: distinctList(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."),
|
|
186
|
+
rows: distinctList(z.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.")
|
|
187
|
+
},
|
|
188
|
+
bands: {
|
|
189
|
+
warnAt: wholePercent.describe("The whole percentage of use at which a bar turns yellow; it must be below criticalAt."),
|
|
190
|
+
criticalAt: wholePercent.describe("The whole percentage of use at which a bar turns red.")
|
|
191
|
+
},
|
|
192
|
+
labels: {
|
|
193
|
+
fiveHour: labelText.describe("The name of the five-hour subscription window."),
|
|
194
|
+
sevenDay: labelText.describe("The name of the weekly subscription window.")
|
|
195
|
+
},
|
|
196
|
+
bar: {
|
|
197
|
+
width: z.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."),
|
|
198
|
+
filled: barCharacter.describe("The character that draws the used part of a bar."),
|
|
199
|
+
empty: barCharacter.describe("The character that draws the unused part of a bar.")
|
|
200
|
+
},
|
|
201
|
+
colours: {
|
|
202
|
+
context: colourValue.describe("The colour of the context bar and its figures below the warning threshold."),
|
|
203
|
+
usage: colourValue.describe("The colour of the quota bars and their figures below the warning threshold."),
|
|
204
|
+
warning: colourValue.describe("The colour of the context bar at or above bands.warnAt, and of a cache hit share that is middling."),
|
|
205
|
+
usageWarning: colourValue.describe("The colour of a quota bar at or above bands.warnAt."),
|
|
206
|
+
critical: colourValue.describe("The colour of a bar at or above bands.criticalAt, and of a cache hit share that is nearly nothing."),
|
|
207
|
+
model: colourValue.describe("The colour of the model and provider segments."),
|
|
208
|
+
label: colourValue.describe("The colour of labels and secondary text: row labels, and the route, account, identity and headroom segments."),
|
|
209
|
+
empty: colourValue.describe("The colour of the unused part of a bar.")
|
|
210
|
+
}
|
|
211
|
+
};
|
|
150
212
|
StatuslineSchema = z.strictObject({
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
sevenDayLabel: z.string().max(MAX_STATUSLINE_LABEL_CHARS).regex(LABEL_RE2, "must be visible text without control characters").optional(),
|
|
157
|
-
barWidth: z.number().int().min(1).max(MAX_BAR_CELLS).optional()
|
|
213
|
+
layout: z.strictObject(SHAPES.layout).partial().optional(),
|
|
214
|
+
bands: z.strictObject(SHAPES.bands).partial().optional(),
|
|
215
|
+
labels: z.strictObject(SHAPES.labels).partial().optional(),
|
|
216
|
+
bar: z.strictObject(SHAPES.bar).partial().optional(),
|
|
217
|
+
colours: z.strictObject(SHAPES.colours).partial().optional()
|
|
158
218
|
});
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
sevenDayLabel: z.union([StatuslineSchema.shape.sevenDayLabel.unwrap(), z.literal(false)]).optional(),
|
|
166
|
-
barWidth: z.union([StatuslineSchema.shape.barWidth.unwrap(), z.literal(false)]).optional()
|
|
219
|
+
ResolvedStatuslineSchema = z.strictObject({
|
|
220
|
+
layout: z.strictObject(SHAPES.layout),
|
|
221
|
+
bands: z.strictObject(SHAPES.bands),
|
|
222
|
+
labels: z.strictObject(SHAPES.labels),
|
|
223
|
+
bar: z.strictObject(SHAPES.bar),
|
|
224
|
+
colours: z.strictObject(SHAPES.colours)
|
|
167
225
|
});
|
|
168
226
|
STATUSLINE_DEFAULTS = {
|
|
169
|
-
header: STATUSLINE_HEADER_SEGMENTS,
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
227
|
+
layout: { header: [...STATUSLINE_HEADER_SEGMENTS], rows: [...STATUSLINE_ROWS] },
|
|
228
|
+
bands: { warnAt: 70, criticalAt: 90 },
|
|
229
|
+
labels: { fiveHour: "5h", sevenDay: "Wk" },
|
|
230
|
+
bar: { width: 10, filled: "\u2588", empty: "\u2591" },
|
|
231
|
+
colours: {
|
|
232
|
+
context: "green",
|
|
233
|
+
usage: "green",
|
|
234
|
+
warning: "yellow",
|
|
235
|
+
usageWarning: "yellow",
|
|
236
|
+
critical: "red",
|
|
237
|
+
model: "default",
|
|
238
|
+
label: "default",
|
|
239
|
+
empty: "brightBlack"
|
|
240
|
+
}
|
|
176
241
|
};
|
|
177
242
|
STATUSLINE_ENV = "AGENT_SHIM_STATUSLINE";
|
|
178
243
|
}
|
|
@@ -1570,7 +1635,7 @@ function flattenLayers(layers, options) {
|
|
|
1570
1635
|
launch.proxyBypass = layer.launch.proxyBypass;
|
|
1571
1636
|
}
|
|
1572
1637
|
if (layer.launch.statusline !== void 0) {
|
|
1573
|
-
launch.statusline =
|
|
1638
|
+
launch.statusline = StatuslineSchema.parse(mergeStatuslineSettings(launch.statusline, layer.launch.statusline));
|
|
1574
1639
|
}
|
|
1575
1640
|
}
|
|
1576
1641
|
if (layer.models !== void 0) {
|
|
@@ -1751,6 +1816,7 @@ var init_flatten = __esm({
|
|
|
1751
1816
|
"src/resolve/flatten.ts"() {
|
|
1752
1817
|
"use strict";
|
|
1753
1818
|
init_schema();
|
|
1819
|
+
init_statusline();
|
|
1754
1820
|
init_conditions();
|
|
1755
1821
|
init_match();
|
|
1756
1822
|
}
|
|
@@ -4235,7 +4301,7 @@ var init_package = __esm({
|
|
|
4235
4301
|
"package.json"() {
|
|
4236
4302
|
package_default = {
|
|
4237
4303
|
name: "claude-use",
|
|
4238
|
-
version: "11.
|
|
4304
|
+
version: "11.52.0",
|
|
4239
4305
|
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.",
|
|
4240
4306
|
license: "MIT",
|
|
4241
4307
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -7393,6 +7459,114 @@ var init_poolPick = __esm({
|
|
|
7393
7459
|
}
|
|
7394
7460
|
});
|
|
7395
7461
|
|
|
7462
|
+
// src/statusline/keys.ts
|
|
7463
|
+
import { z as z15 } from "zod";
|
|
7464
|
+
function valueAt(source, path43) {
|
|
7465
|
+
let current = source;
|
|
7466
|
+
for (const part of path43) {
|
|
7467
|
+
if (!isPlainObject(current)) {
|
|
7468
|
+
return void 0;
|
|
7469
|
+
}
|
|
7470
|
+
current = current[part];
|
|
7471
|
+
}
|
|
7472
|
+
return current;
|
|
7473
|
+
}
|
|
7474
|
+
function keyOf(path43, leaf) {
|
|
7475
|
+
const common = { path: path43.join("."), description: leaf.description ?? "", defaultValue: valueAt(STATUSLINE_DEFAULTS, path43) };
|
|
7476
|
+
if (leaf instanceof z15.ZodNumber) {
|
|
7477
|
+
return { ...common, kind: "integer", choices: [] };
|
|
7478
|
+
}
|
|
7479
|
+
if (leaf instanceof z15.ZodString) {
|
|
7480
|
+
return { ...common, kind: "text", choices: [] };
|
|
7481
|
+
}
|
|
7482
|
+
if (leaf instanceof z15.ZodUnion) {
|
|
7483
|
+
return { ...common, kind: "colour", choices: [...STATUSLINE_COLOUR_NAMES] };
|
|
7484
|
+
}
|
|
7485
|
+
if (leaf instanceof z15.ZodEnum) {
|
|
7486
|
+
return { ...common, kind: "choice", choices: Object.values(leaf.enum).map(String) };
|
|
7487
|
+
}
|
|
7488
|
+
if (leaf instanceof z15.ZodArray && leaf.element instanceof z15.ZodEnum) {
|
|
7489
|
+
return { ...common, kind: "list", choices: Object.values(leaf.element.enum).map(String) };
|
|
7490
|
+
}
|
|
7491
|
+
throw new TypeError(`statusline setting ${path43.join(".")} has a kind the key listing does not describe`);
|
|
7492
|
+
}
|
|
7493
|
+
function walk(shape, prefix) {
|
|
7494
|
+
return Object.entries(shape).flatMap(([name, schema]) => schema instanceof z15.ZodObject ? walk(schema.shape, [...prefix, name]) : [keyOf([...prefix, name], schema)]);
|
|
7495
|
+
}
|
|
7496
|
+
function statuslineKeys() {
|
|
7497
|
+
return walk(ResolvedStatuslineSchema.shape, []);
|
|
7498
|
+
}
|
|
7499
|
+
var init_keys = __esm({
|
|
7500
|
+
"src/statusline/keys.ts"() {
|
|
7501
|
+
"use strict";
|
|
7502
|
+
init_statusline();
|
|
7503
|
+
}
|
|
7504
|
+
});
|
|
7505
|
+
|
|
7506
|
+
// src/statusline/change.ts
|
|
7507
|
+
function keyNamed(path43) {
|
|
7508
|
+
const found = statuslineKeys().find((key) => key.path === path43);
|
|
7509
|
+
if (found === void 0) {
|
|
7510
|
+
throw new UsageError(`"${path43}" is not a statusline setting; \`agent-shim statusline keys\` lists them.`);
|
|
7511
|
+
}
|
|
7512
|
+
return found;
|
|
7513
|
+
}
|
|
7514
|
+
function setAt(target, path43, value) {
|
|
7515
|
+
const [head, ...rest] = path43;
|
|
7516
|
+
if (head === void 0) {
|
|
7517
|
+
return;
|
|
7518
|
+
}
|
|
7519
|
+
if (rest.length === 0) {
|
|
7520
|
+
target[head] = value;
|
|
7521
|
+
return;
|
|
7522
|
+
}
|
|
7523
|
+
const child = target[head];
|
|
7524
|
+
const next = isPlainObject(child) ? child : {};
|
|
7525
|
+
target[head] = next;
|
|
7526
|
+
setAt(next, rest, value);
|
|
7527
|
+
}
|
|
7528
|
+
function removeAt(target, path43) {
|
|
7529
|
+
const [head, ...rest] = path43;
|
|
7530
|
+
if (head === void 0) {
|
|
7531
|
+
return;
|
|
7532
|
+
}
|
|
7533
|
+
const child = target[head];
|
|
7534
|
+
if (rest.length === 0) {
|
|
7535
|
+
Reflect.deleteProperty(target, head);
|
|
7536
|
+
return;
|
|
7537
|
+
}
|
|
7538
|
+
if (isPlainObject(child)) {
|
|
7539
|
+
removeAt(child, rest);
|
|
7540
|
+
if (Object.keys(child).length === 0) {
|
|
7541
|
+
Reflect.deleteProperty(target, head);
|
|
7542
|
+
}
|
|
7543
|
+
}
|
|
7544
|
+
}
|
|
7545
|
+
function applyStatuslineChange(existing, change) {
|
|
7546
|
+
const draft = structuredClone(existing ?? {});
|
|
7547
|
+
for (const [path43, value] of Object.entries(change.set ?? {})) {
|
|
7548
|
+
keyNamed(path43);
|
|
7549
|
+
setAt(draft, path43.split("."), value);
|
|
7550
|
+
}
|
|
7551
|
+
for (const path43 of change.unset ?? []) {
|
|
7552
|
+
keyNamed(path43);
|
|
7553
|
+
removeAt(draft, path43.split("."));
|
|
7554
|
+
}
|
|
7555
|
+
const result = StatuslineSchema.safeParse(draft);
|
|
7556
|
+
if (!result.success) {
|
|
7557
|
+
throw new UsageError(`statusline: ${result.error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`).join("; ")}.`);
|
|
7558
|
+
}
|
|
7559
|
+
return Object.keys(result.data).length === 0 ? void 0 : result.data;
|
|
7560
|
+
}
|
|
7561
|
+
var init_change = __esm({
|
|
7562
|
+
"src/statusline/change.ts"() {
|
|
7563
|
+
"use strict";
|
|
7564
|
+
init_cliError();
|
|
7565
|
+
init_statusline();
|
|
7566
|
+
init_keys();
|
|
7567
|
+
}
|
|
7568
|
+
});
|
|
7569
|
+
|
|
7396
7570
|
// src/configProfilesStore.ts
|
|
7397
7571
|
import fs4 from "node:fs";
|
|
7398
7572
|
import path22 from "node:path";
|
|
@@ -7494,17 +7668,6 @@ function removeProfile(paths, name) {
|
|
|
7494
7668
|
requireProfileExists(paths, name);
|
|
7495
7669
|
fs4.rmSync(profileJsonPath(paths, name));
|
|
7496
7670
|
}
|
|
7497
|
-
function withStatuslineChange(existing, change) {
|
|
7498
|
-
const merged = new Map(Object.entries({ ...existing }));
|
|
7499
|
-
for (const [key, value] of Object.entries(change)) {
|
|
7500
|
-
if (value === false) {
|
|
7501
|
-
merged.delete(key);
|
|
7502
|
-
} else {
|
|
7503
|
-
merged.set(key, value);
|
|
7504
|
-
}
|
|
7505
|
-
}
|
|
7506
|
-
return merged.size === 0 ? void 0 : StatuslineSchema.parse(Object.fromEntries(merged));
|
|
7507
|
-
}
|
|
7508
7671
|
function applyProfileChange(paths, name, change) {
|
|
7509
7672
|
let touched = false;
|
|
7510
7673
|
if (change.category !== void 0) {
|
|
@@ -7554,7 +7717,7 @@ function applyProfileChange(paths, name, change) {
|
|
|
7554
7717
|
launchPatch.explain = change.launchExplain;
|
|
7555
7718
|
}
|
|
7556
7719
|
if (change.launchStatusline !== void 0) {
|
|
7557
|
-
launchPatch.statusline =
|
|
7720
|
+
launchPatch.statusline = applyStatuslineChange(readProfile(paths, name)?.launch?.statusline, change.launchStatusline);
|
|
7558
7721
|
}
|
|
7559
7722
|
if (Object.keys(launchPatch).length > 0) {
|
|
7560
7723
|
setProfileLaunchFlags(paths, name, launchPatch);
|
|
@@ -7569,7 +7732,7 @@ var init_configProfilesStore = __esm({
|
|
|
7569
7732
|
init_store();
|
|
7570
7733
|
init_schema();
|
|
7571
7734
|
init_cliError();
|
|
7572
|
-
|
|
7735
|
+
init_change();
|
|
7573
7736
|
init_load();
|
|
7574
7737
|
ProfileNotFoundError = class extends CliError {
|
|
7575
7738
|
constructor(profileName) {
|
|
@@ -7681,7 +7844,7 @@ var init_paths = __esm({
|
|
|
7681
7844
|
});
|
|
7682
7845
|
|
|
7683
7846
|
// src/credentialCache.ts
|
|
7684
|
-
import { z as
|
|
7847
|
+
import { z as z16 } from "zod";
|
|
7685
7848
|
function effectiveStore(cache, platform) {
|
|
7686
7849
|
return cache.store ?? (platform === "darwin" ? "keychain" : "file");
|
|
7687
7850
|
}
|
|
@@ -7748,9 +7911,9 @@ var init_credentialCache = __esm({
|
|
|
7748
7911
|
init_schema();
|
|
7749
7912
|
init_preflight();
|
|
7750
7913
|
MS_PER_UNIT = { s: 1e3, m: 6e4, h: 36e5, d: 864e5 };
|
|
7751
|
-
CachedCredentialSchema =
|
|
7752
|
-
token:
|
|
7753
|
-
fetchedAt:
|
|
7914
|
+
CachedCredentialSchema = z16.strictObject({
|
|
7915
|
+
token: z16.string().min(1),
|
|
7916
|
+
fetchedAt: z16.number().int().nonnegative(),
|
|
7754
7917
|
source: CredentialSourceSchema
|
|
7755
7918
|
});
|
|
7756
7919
|
}
|
|
@@ -7842,7 +8005,7 @@ var init_realCredentialCache = __esm({
|
|
|
7842
8005
|
});
|
|
7843
8006
|
|
|
7844
8007
|
// src/providerAliases.ts
|
|
7845
|
-
import { z as
|
|
8008
|
+
import { z as z17 } from "zod";
|
|
7846
8009
|
function parseAliases(file, raw) {
|
|
7847
8010
|
const parsed = ProviderAliasesSchema.safeParse(raw);
|
|
7848
8011
|
if (!parsed.success) {
|
|
@@ -7881,7 +8044,7 @@ var init_providerAliases = __esm({
|
|
|
7881
8044
|
init_cliError();
|
|
7882
8045
|
init_load();
|
|
7883
8046
|
init_store();
|
|
7884
|
-
ProviderAliasesSchema =
|
|
8047
|
+
ProviderAliasesSchema = z17.record(z17.string().min(1), z17.string().min(1));
|
|
7885
8048
|
}
|
|
7886
8049
|
});
|
|
7887
8050
|
|
|
@@ -8898,7 +9061,7 @@ var init_commandDeps = __esm({
|
|
|
8898
9061
|
// src/claudeShim.ts
|
|
8899
9062
|
import fs8 from "node:fs";
|
|
8900
9063
|
import path28 from "node:path";
|
|
8901
|
-
import { z as
|
|
9064
|
+
import { z as z22 } from "zod";
|
|
8902
9065
|
function commandFilename(ownExecutablePath, commandName) {
|
|
8903
9066
|
return ownExecutablePath.toLowerCase().endsWith(".exe") ? `${commandName}.exe` : commandName;
|
|
8904
9067
|
}
|
|
@@ -8948,10 +9111,10 @@ var init_claudeShim = __esm({
|
|
|
8948
9111
|
init_store();
|
|
8949
9112
|
init_realPorts();
|
|
8950
9113
|
init_cliError();
|
|
8951
|
-
ClaudeShimStateSchema =
|
|
8952
|
-
targetPath:
|
|
8953
|
-
method:
|
|
8954
|
-
installedAtMs:
|
|
9114
|
+
ClaudeShimStateSchema = z22.strictObject({
|
|
9115
|
+
targetPath: z22.string().min(1),
|
|
9116
|
+
method: z22.enum(["hardlink", "copy"]),
|
|
9117
|
+
installedAtMs: z22.number()
|
|
8955
9118
|
});
|
|
8956
9119
|
nodeLinkFs = { link: fs8.linkSync, copyFile: fs8.copyFileSync, chmod: fs8.chmodSync };
|
|
8957
9120
|
}
|
|
@@ -8970,14 +9133,14 @@ function memberKindOf(ref, models) {
|
|
|
8970
9133
|
function expandMembers(name, models) {
|
|
8971
9134
|
const virtual = models?.virtual ?? {};
|
|
8972
9135
|
const expanded = [];
|
|
8973
|
-
const
|
|
9136
|
+
const walk2 = (current, chain) => {
|
|
8974
9137
|
const nested = virtual[current];
|
|
8975
9138
|
if (nested !== void 0) {
|
|
8976
9139
|
if (chain.includes(current)) {
|
|
8977
9140
|
throw new Error(`virtual model cycle: ${[...chain, current].join(" -> ")}`);
|
|
8978
9141
|
}
|
|
8979
9142
|
for (const member of nested.members) {
|
|
8980
|
-
|
|
9143
|
+
walk2(member, [...chain, current]);
|
|
8981
9144
|
}
|
|
8982
9145
|
return;
|
|
8983
9146
|
}
|
|
@@ -8990,7 +9153,7 @@ function expandMembers(name, models) {
|
|
|
8990
9153
|
throw new VirtualModelNotFoundError(name);
|
|
8991
9154
|
}
|
|
8992
9155
|
for (const member of top.members) {
|
|
8993
|
-
|
|
9156
|
+
walk2(member, [name]);
|
|
8994
9157
|
}
|
|
8995
9158
|
return expanded;
|
|
8996
9159
|
}
|
|
@@ -9047,62 +9210,62 @@ var init_signatures = __esm({
|
|
|
9047
9210
|
});
|
|
9048
9211
|
|
|
9049
9212
|
// src/codex/anthropic.ts
|
|
9050
|
-
import { z as
|
|
9213
|
+
import { z as z26 } from "zod";
|
|
9051
9214
|
var TextBlockSchema, Base64ImageSourceSchema, UrlImageSourceSchema, ImageBlockSchema, ToolUseBlockSchema, ToolResultContentBlockSchema, ToolResultBlockSchema, OtherBlockSchema, ContentBlockSchema, MessageSchema, ToolSchema, ToolChoiceSchema, SystemSchema, MessagesRequestSchema, CountTokensRequestSchema;
|
|
9052
9215
|
var init_anthropic = __esm({
|
|
9053
9216
|
"src/codex/anthropic.ts"() {
|
|
9054
9217
|
"use strict";
|
|
9055
|
-
TextBlockSchema =
|
|
9056
|
-
Base64ImageSourceSchema =
|
|
9057
|
-
UrlImageSourceSchema =
|
|
9058
|
-
ImageBlockSchema =
|
|
9059
|
-
type:
|
|
9060
|
-
source:
|
|
9218
|
+
TextBlockSchema = z26.looseObject({ type: z26.literal("text"), text: z26.string() });
|
|
9219
|
+
Base64ImageSourceSchema = z26.looseObject({ type: z26.literal("base64"), media_type: z26.string().min(1), data: z26.string() });
|
|
9220
|
+
UrlImageSourceSchema = z26.looseObject({ type: z26.literal("url"), url: z26.string().min(1) });
|
|
9221
|
+
ImageBlockSchema = z26.looseObject({
|
|
9222
|
+
type: z26.literal("image"),
|
|
9223
|
+
source: z26.union([Base64ImageSourceSchema, UrlImageSourceSchema])
|
|
9061
9224
|
});
|
|
9062
|
-
ToolUseBlockSchema =
|
|
9063
|
-
type:
|
|
9064
|
-
id:
|
|
9065
|
-
name:
|
|
9066
|
-
input:
|
|
9225
|
+
ToolUseBlockSchema = z26.looseObject({
|
|
9226
|
+
type: z26.literal("tool_use"),
|
|
9227
|
+
id: z26.string().min(1),
|
|
9228
|
+
name: z26.string().min(1),
|
|
9229
|
+
input: z26.unknown()
|
|
9067
9230
|
});
|
|
9068
|
-
ToolResultContentBlockSchema =
|
|
9069
|
-
ToolResultBlockSchema =
|
|
9070
|
-
type:
|
|
9071
|
-
tool_use_id:
|
|
9072
|
-
content:
|
|
9231
|
+
ToolResultContentBlockSchema = z26.union([TextBlockSchema, z26.looseObject({ type: z26.string() })]);
|
|
9232
|
+
ToolResultBlockSchema = z26.looseObject({
|
|
9233
|
+
type: z26.literal("tool_result"),
|
|
9234
|
+
tool_use_id: z26.string().min(1),
|
|
9235
|
+
content: z26.union([z26.string(), z26.array(ToolResultContentBlockSchema)]).optional()
|
|
9073
9236
|
});
|
|
9074
|
-
OtherBlockSchema =
|
|
9075
|
-
ContentBlockSchema =
|
|
9076
|
-
MessageSchema =
|
|
9077
|
-
role:
|
|
9078
|
-
content:
|
|
9237
|
+
OtherBlockSchema = z26.looseObject({ type: z26.string() });
|
|
9238
|
+
ContentBlockSchema = z26.union([TextBlockSchema, ImageBlockSchema, ToolUseBlockSchema, ToolResultBlockSchema, OtherBlockSchema]);
|
|
9239
|
+
MessageSchema = z26.looseObject({
|
|
9240
|
+
role: z26.enum(["user", "assistant", "system"]),
|
|
9241
|
+
content: z26.union([z26.string(), z26.array(ContentBlockSchema)])
|
|
9079
9242
|
});
|
|
9080
|
-
ToolSchema =
|
|
9081
|
-
name:
|
|
9082
|
-
description:
|
|
9083
|
-
input_schema:
|
|
9243
|
+
ToolSchema = z26.looseObject({
|
|
9244
|
+
name: z26.string().min(1),
|
|
9245
|
+
description: z26.string().optional(),
|
|
9246
|
+
input_schema: z26.record(z26.string(), z26.unknown()).optional()
|
|
9084
9247
|
});
|
|
9085
|
-
ToolChoiceSchema =
|
|
9086
|
-
|
|
9087
|
-
|
|
9248
|
+
ToolChoiceSchema = z26.union([
|
|
9249
|
+
z26.looseObject({ type: z26.enum(["auto", "none", "any"]) }),
|
|
9250
|
+
z26.looseObject({ type: z26.literal("tool"), name: z26.string().min(1) })
|
|
9088
9251
|
]);
|
|
9089
|
-
SystemSchema =
|
|
9090
|
-
MessagesRequestSchema =
|
|
9091
|
-
model:
|
|
9252
|
+
SystemSchema = z26.union([z26.string(), z26.array(z26.union([TextBlockSchema, OtherBlockSchema]))]);
|
|
9253
|
+
MessagesRequestSchema = z26.looseObject({
|
|
9254
|
+
model: z26.string().optional(),
|
|
9092
9255
|
system: SystemSchema.optional(),
|
|
9093
|
-
messages:
|
|
9094
|
-
tools:
|
|
9256
|
+
messages: z26.array(MessageSchema),
|
|
9257
|
+
tools: z26.array(ToolSchema).optional(),
|
|
9095
9258
|
tool_choice: ToolChoiceSchema.optional(),
|
|
9096
|
-
stream:
|
|
9259
|
+
stream: z26.boolean().optional(),
|
|
9097
9260
|
/** `user_id` is stable for one Claude Code session and differs between sessions, which is what makes it the right key for both the backend's prompt cache and its session header. */
|
|
9098
|
-
metadata:
|
|
9261
|
+
metadata: z26.looseObject({ user_id: z26.string().optional() }).optional(),
|
|
9099
9262
|
/** Claude Code's effort setting. Any string is accepted; the translator honours only the levels the backend understands. */
|
|
9100
|
-
output_config:
|
|
9263
|
+
output_config: z26.looseObject({ effort: z26.string().optional() }).optional()
|
|
9101
9264
|
});
|
|
9102
|
-
CountTokensRequestSchema =
|
|
9103
|
-
system:
|
|
9104
|
-
messages:
|
|
9105
|
-
tools:
|
|
9265
|
+
CountTokensRequestSchema = z26.looseObject({
|
|
9266
|
+
system: z26.unknown().optional(),
|
|
9267
|
+
messages: z26.unknown().optional(),
|
|
9268
|
+
tools: z26.unknown().optional()
|
|
9106
9269
|
});
|
|
9107
9270
|
}
|
|
9108
9271
|
});
|
|
@@ -9187,7 +9350,7 @@ var init_translate2 = __esm({
|
|
|
9187
9350
|
// src/providerCatalogue.ts
|
|
9188
9351
|
import path30 from "node:path";
|
|
9189
9352
|
import picomatch4 from "picomatch";
|
|
9190
|
-
import { z as
|
|
9353
|
+
import { z as z27 } from "zod";
|
|
9191
9354
|
function catalogueCachePath(paths, name) {
|
|
9192
9355
|
return path30.join(paths.catalogueDir, `${name}.json`);
|
|
9193
9356
|
}
|
|
@@ -9222,8 +9385,8 @@ var init_providerCatalogue = __esm({
|
|
|
9222
9385
|
CATALOGUE_REQUEST_SECONDS = 10;
|
|
9223
9386
|
CATALOGUE_REQUEST_TIMEOUT_MS = CATALOGUE_REQUEST_SECONDS * MS_PER_SECOND5;
|
|
9224
9387
|
CATALOGUE_REFRESH_TIMEOUT_MS = DEFAULT_CANDIDATE_URLS * CATALOGUE_REQUEST_TIMEOUT_MS;
|
|
9225
|
-
CatalogueModelSchema =
|
|
9226
|
-
CatalogueCacheSchema =
|
|
9388
|
+
CatalogueModelSchema = z27.strictObject({ id: z27.string().min(1), name: z27.string().min(1).optional() });
|
|
9389
|
+
CatalogueCacheSchema = z27.strictObject({ fetchedAt: z27.number(), url: z27.string().min(1), models: z27.array(CatalogueModelSchema) });
|
|
9227
9390
|
}
|
|
9228
9391
|
});
|
|
9229
9392
|
|
|
@@ -11583,7 +11746,7 @@ function isAnthropicUsageStale(member, nowMs) {
|
|
|
11583
11746
|
function poolIdentityNames(pools, poolName) {
|
|
11584
11747
|
const seenPools = /* @__PURE__ */ new Set();
|
|
11585
11748
|
const identities = /* @__PURE__ */ new Set();
|
|
11586
|
-
const
|
|
11749
|
+
const walk2 = (name) => {
|
|
11587
11750
|
const pool = pools[name];
|
|
11588
11751
|
if (pool === void 0 || seenPools.has(name)) {
|
|
11589
11752
|
return;
|
|
@@ -11595,11 +11758,11 @@ function poolIdentityNames(pools, poolName) {
|
|
|
11595
11758
|
if (nested === void 0) {
|
|
11596
11759
|
identities.add(member);
|
|
11597
11760
|
} else {
|
|
11598
|
-
|
|
11761
|
+
walk2(nested);
|
|
11599
11762
|
}
|
|
11600
11763
|
}
|
|
11601
11764
|
};
|
|
11602
|
-
|
|
11765
|
+
walk2(poolName);
|
|
11603
11766
|
return [...identities];
|
|
11604
11767
|
}
|
|
11605
11768
|
function describeError(error) {
|
|
@@ -11718,7 +11881,7 @@ var init_identityClaude = __esm({
|
|
|
11718
11881
|
});
|
|
11719
11882
|
|
|
11720
11883
|
// src/usage/providerQuota.ts
|
|
11721
|
-
import { z as
|
|
11884
|
+
import { z as z34 } from "zod";
|
|
11722
11885
|
var 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_DAY3, OpenRouterKeySchema, OpenRouterCreditsSchema, ANTIGRAVITY_HOST, ANTIGRAVITY_QUOTA_URL, ANTIGRAVITY_USER_URL, FIVE_HOURS2, DAYS_PER_WEEK2, FIVE_HOURS_MS, WEEK_MS, AntigravityBucketSchema, AntigravitySummarySchema, GoogleTokenInfoSchema, AntigravityUserSchema;
|
|
11723
11886
|
var init_providerQuota = __esm({
|
|
11724
11887
|
"src/usage/providerQuota.ts"() {
|
|
@@ -11737,35 +11900,35 @@ var init_providerQuota = __esm({
|
|
|
11737
11900
|
[ZAI_UNIT_HOURS, SECONDS_PER_HOUR3 * MS_PER_SECOND9],
|
|
11738
11901
|
[ZAI_UNIT_MONTHS, DAYS_PER_MONTH * HOURS_PER_DAY6 * SECONDS_PER_HOUR3 * MS_PER_SECOND9]
|
|
11739
11902
|
]);
|
|
11740
|
-
ZaiLimitSchema =
|
|
11741
|
-
type:
|
|
11742
|
-
unit:
|
|
11743
|
-
number:
|
|
11744
|
-
percentage:
|
|
11745
|
-
nextResetTime:
|
|
11746
|
-
usage:
|
|
11747
|
-
currentValue:
|
|
11748
|
-
remaining:
|
|
11903
|
+
ZaiLimitSchema = z34.object({
|
|
11904
|
+
type: z34.string(),
|
|
11905
|
+
unit: z34.number().int(),
|
|
11906
|
+
number: z34.number().int().positive(),
|
|
11907
|
+
percentage: z34.number().nonnegative(),
|
|
11908
|
+
nextResetTime: z34.number().positive().optional(),
|
|
11909
|
+
usage: z34.number().nonnegative().optional(),
|
|
11910
|
+
currentValue: z34.number().nonnegative().optional(),
|
|
11911
|
+
remaining: z34.number().nonnegative().optional()
|
|
11749
11912
|
});
|
|
11750
|
-
ZaiResponseSchema =
|
|
11751
|
-
success:
|
|
11752
|
-
msg:
|
|
11753
|
-
data:
|
|
11913
|
+
ZaiResponseSchema = z34.object({
|
|
11914
|
+
success: z34.boolean(),
|
|
11915
|
+
msg: z34.string().optional(),
|
|
11916
|
+
data: z34.object({ level: z34.string().optional(), limits: z34.array(ZaiLimitSchema) })
|
|
11754
11917
|
});
|
|
11755
11918
|
OPENROUTER_HOST = "openrouter.ai";
|
|
11756
11919
|
OPENROUTER_KEY_URL = `https://${OPENROUTER_HOST}/api/v1/key`;
|
|
11757
11920
|
OPENROUTER_CREDITS_URL = `https://${OPENROUTER_HOST}/api/v1/credits`;
|
|
11758
11921
|
MS_PER_DAY3 = HOURS_PER_DAY6 * SECONDS_PER_HOUR3 * MS_PER_SECOND9;
|
|
11759
|
-
OpenRouterKeySchema =
|
|
11760
|
-
data:
|
|
11761
|
-
limit:
|
|
11762
|
-
limit_remaining:
|
|
11763
|
-
limit_reset:
|
|
11764
|
-
is_free_tier:
|
|
11765
|
-
free_model_daily_requests:
|
|
11922
|
+
OpenRouterKeySchema = z34.object({
|
|
11923
|
+
data: z34.object({
|
|
11924
|
+
limit: z34.number().nonnegative().nullable(),
|
|
11925
|
+
limit_remaining: z34.number().nullable(),
|
|
11926
|
+
limit_reset: z34.string().nullable(),
|
|
11927
|
+
is_free_tier: z34.boolean().optional(),
|
|
11928
|
+
free_model_daily_requests: z34.object({ used: z34.number().nonnegative(), limit: z34.number().nonnegative(), remaining: z34.number() }).optional()
|
|
11766
11929
|
})
|
|
11767
11930
|
});
|
|
11768
|
-
OpenRouterCreditsSchema =
|
|
11931
|
+
OpenRouterCreditsSchema = z34.object({ data: z34.object({ total_credits: z34.number().nonnegative(), total_usage: z34.number().nonnegative() }) });
|
|
11769
11932
|
ANTIGRAVITY_HOST = "daily-cloudcode-pa.googleapis.com";
|
|
11770
11933
|
ANTIGRAVITY_QUOTA_URL = `https://${ANTIGRAVITY_HOST}/v1internal:retrieveUserQuotaSummary`;
|
|
11771
11934
|
ANTIGRAVITY_USER_URL = `https://${ANTIGRAVITY_HOST}/v1internal:loadCodeAssist`;
|
|
@@ -11773,21 +11936,21 @@ var init_providerQuota = __esm({
|
|
|
11773
11936
|
DAYS_PER_WEEK2 = 7;
|
|
11774
11937
|
FIVE_HOURS_MS = FIVE_HOURS2 * SECONDS_PER_HOUR3 * MS_PER_SECOND9;
|
|
11775
11938
|
WEEK_MS = DAYS_PER_WEEK2 * HOURS_PER_DAY6 * SECONDS_PER_HOUR3 * MS_PER_SECOND9;
|
|
11776
|
-
AntigravityBucketSchema =
|
|
11777
|
-
bucketId:
|
|
11778
|
-
remainingFraction:
|
|
11779
|
-
resetTime:
|
|
11939
|
+
AntigravityBucketSchema = z34.object({
|
|
11940
|
+
bucketId: z34.string(),
|
|
11941
|
+
remainingFraction: z34.number().optional(),
|
|
11942
|
+
resetTime: z34.string().optional()
|
|
11780
11943
|
});
|
|
11781
|
-
AntigravitySummarySchema =
|
|
11782
|
-
GoogleTokenInfoSchema =
|
|
11783
|
-
email:
|
|
11784
|
-
sub:
|
|
11944
|
+
AntigravitySummarySchema = z34.object({ groups: z34.array(z34.object({ buckets: z34.array(AntigravityBucketSchema) })) });
|
|
11945
|
+
GoogleTokenInfoSchema = z34.object({
|
|
11946
|
+
email: z34.string().optional(),
|
|
11947
|
+
sub: z34.string().optional()
|
|
11785
11948
|
});
|
|
11786
|
-
AntigravityUserSchema =
|
|
11949
|
+
AntigravityUserSchema = z34.object({
|
|
11787
11950
|
/** The code-assist tier context, which defaults to the free tier for every account. */
|
|
11788
|
-
currentTier:
|
|
11951
|
+
currentTier: z34.object({ name: z34.string().optional(), id: z34.string().optional() }).optional(),
|
|
11789
11952
|
/** The account's paid subscription; absent when the account has none. */
|
|
11790
|
-
paidTier:
|
|
11953
|
+
paidTier: z34.object({ name: z34.string().optional(), id: z34.string().optional() }).optional()
|
|
11791
11954
|
});
|
|
11792
11955
|
}
|
|
11793
11956
|
});
|
|
@@ -14686,7 +14849,7 @@ function writePools(paths, pools) {
|
|
|
14686
14849
|
applyPatch(paths.globalConfigFile, GlobalConfigSchema, { pools }, { defaults: {} });
|
|
14687
14850
|
}
|
|
14688
14851
|
function poolCycleOf(pools, name) {
|
|
14689
|
-
const
|
|
14852
|
+
const walk2 = (current, path43) => {
|
|
14690
14853
|
for (const entry of pools[current]?.identities ?? []) {
|
|
14691
14854
|
const nested = poolNameOf(poolMemberIdentity(entry));
|
|
14692
14855
|
if (nested === void 0) {
|
|
@@ -14698,14 +14861,14 @@ function poolCycleOf(pools, name) {
|
|
|
14698
14861
|
if (path43.includes(nested)) {
|
|
14699
14862
|
continue;
|
|
14700
14863
|
}
|
|
14701
|
-
const found =
|
|
14864
|
+
const found = walk2(nested, [...path43, nested]);
|
|
14702
14865
|
if (found !== void 0) {
|
|
14703
14866
|
return found;
|
|
14704
14867
|
}
|
|
14705
14868
|
}
|
|
14706
14869
|
return void 0;
|
|
14707
14870
|
};
|
|
14708
|
-
return
|
|
14871
|
+
return walk2(name, [name]);
|
|
14709
14872
|
}
|
|
14710
14873
|
function validateMembers(pools, name, members) {
|
|
14711
14874
|
for (const entry of members) {
|
|
@@ -14834,7 +14997,7 @@ init_providersStore();
|
|
|
14834
14997
|
init_projects();
|
|
14835
14998
|
init_pipeline();
|
|
14836
14999
|
import path27 from "node:path";
|
|
14837
|
-
import { z as
|
|
15000
|
+
import { z as z18 } from "zod";
|
|
14838
15001
|
var HISTORY_PROJECTS_KEY_PREFIX = "history/projects/";
|
|
14839
15002
|
function projectFragmentOf(rawKey) {
|
|
14840
15003
|
return rawKey.startsWith(HISTORY_PROJECTS_KEY_PREFIX) ? rawKey.slice(HISTORY_PROJECTS_KEY_PREFIX.length) : void 0;
|
|
@@ -14903,9 +15066,9 @@ function lookupKeychainService(run, farmRoot) {
|
|
|
14903
15066
|
}
|
|
14904
15067
|
return { checked: true, found: true, serviceName, note: `Keychain service name for this identity: "${serviceName}".` };
|
|
14905
15068
|
}
|
|
14906
|
-
var SettingsSecretsShapeSchema =
|
|
14907
|
-
env:
|
|
14908
|
-
hooks:
|
|
15069
|
+
var SettingsSecretsShapeSchema = z18.looseObject({
|
|
15070
|
+
env: z18.record(z18.string(), z18.unknown()).optional(),
|
|
15071
|
+
hooks: z18.record(z18.string(), z18.array(z18.unknown())).optional()
|
|
14909
15072
|
});
|
|
14910
15073
|
function hookCommandCountOf(group) {
|
|
14911
15074
|
if (typeof group !== "object" || group === null) {
|
|
@@ -15202,7 +15365,7 @@ init_schema();
|
|
|
15202
15365
|
init_claudeVersion();
|
|
15203
15366
|
init_identity();
|
|
15204
15367
|
init_projects();
|
|
15205
|
-
import { z as
|
|
15368
|
+
import { z as z20 } from "zod";
|
|
15206
15369
|
|
|
15207
15370
|
// src/resolve/types.ts
|
|
15208
15371
|
var LAYER_KINDS = [
|
|
@@ -15263,123 +15426,123 @@ var DIAGNOSTIC_SEVERITIES = ["error", "warning", "info"];
|
|
|
15263
15426
|
|
|
15264
15427
|
// src/usage/pickReportSchema.ts
|
|
15265
15428
|
init_plan2();
|
|
15266
|
-
import { z as
|
|
15267
|
-
var PoolPickCandidateViewSchema =
|
|
15268
|
-
identity:
|
|
15429
|
+
import { z as z19 } from "zod";
|
|
15430
|
+
var PoolPickCandidateViewSchema = z19.strictObject({
|
|
15431
|
+
identity: z19.string(),
|
|
15269
15432
|
/** In pick order: `scored` has usable quota data, `unknown` has none, `pay-per-use` bills by use, `ineligible` is refused right now. */
|
|
15270
|
-
class:
|
|
15433
|
+
class: z19.enum(["scored", "unknown", "pay-per-use", "ineligible"]),
|
|
15271
15434
|
/** Plan-size-weighted remaining quota per hour until its reset; present for `scored` only. */
|
|
15272
|
-
score:
|
|
15435
|
+
score: z19.number().optional(),
|
|
15273
15436
|
/** Which window's reset divides the score: the seven-day window, or the five-hour one when the member reports no seven-day utilisation or its measured-ratio five-hour term outranks the weekly one; present with `score`. */
|
|
15274
|
-
scoreWindow:
|
|
15437
|
+
scoreWindow: z19.enum(["sevenDay", "fiveHour"]).optional(),
|
|
15275
15438
|
/** False when the five-hour window would run dry, at the observed pace, before it resets. */
|
|
15276
|
-
feasible:
|
|
15439
|
+
feasible: z19.boolean(),
|
|
15277
15440
|
/** When an `ineligible` member can be used again, as an ISO instant. */
|
|
15278
|
-
blockedUntil:
|
|
15441
|
+
blockedUntil: z19.iso.datetime().optional(),
|
|
15279
15442
|
plan: PlanClassSchema,
|
|
15280
15443
|
/** The facts behind the class and score, in the order they matter. */
|
|
15281
|
-
reasons:
|
|
15444
|
+
reasons: z19.array(z19.string())
|
|
15282
15445
|
});
|
|
15283
|
-
var PoolPickReportSchema =
|
|
15284
|
-
pool:
|
|
15285
|
-
directory:
|
|
15446
|
+
var PoolPickReportSchema = z19.strictObject({
|
|
15447
|
+
pool: z19.string(),
|
|
15448
|
+
directory: z19.string(),
|
|
15286
15449
|
/** The member a launch would run as, absent when every member is refused. */
|
|
15287
|
-
pick:
|
|
15288
|
-
candidates:
|
|
15450
|
+
pick: z19.string().optional(),
|
|
15451
|
+
candidates: z19.array(PoolPickCandidateViewSchema),
|
|
15289
15452
|
/** Identity members anywhere in the pool's graph that do not exist; a launch skips them. */
|
|
15290
|
-
missing:
|
|
15453
|
+
missing: z19.array(z19.string()),
|
|
15291
15454
|
/** When nothing can be picked, the soonest any member returns. */
|
|
15292
|
-
earliestReturn:
|
|
15455
|
+
earliestReturn: z19.strictObject({ identity: z19.string(), at: z19.iso.datetime() }).optional(),
|
|
15293
15456
|
/** The member a resumed conversation started on but moved off, and why, when the ranking could not keep it. */
|
|
15294
|
-
movedOff:
|
|
15457
|
+
movedOff: z19.strictObject({ identity: z19.string(), reason: z19.string() }).optional(),
|
|
15295
15458
|
/** Why the last-pick record could not be read, when that is the case. */
|
|
15296
|
-
stickyProblem:
|
|
15459
|
+
stickyProblem: z19.string().optional()
|
|
15297
15460
|
});
|
|
15298
15461
|
|
|
15299
15462
|
// src/checkReportSchema.ts
|
|
15300
15463
|
var CHECK_CREDENTIAL_APPLIES = ["provider", "identity", "stored-login"];
|
|
15301
|
-
var CheckLayerViewSchema =
|
|
15302
|
-
id:
|
|
15303
|
-
kind:
|
|
15304
|
-
source:
|
|
15464
|
+
var CheckLayerViewSchema = z20.strictObject({
|
|
15465
|
+
id: z20.int(),
|
|
15466
|
+
kind: z20.enum(LAYER_KINDS),
|
|
15467
|
+
source: z20.string()
|
|
15305
15468
|
});
|
|
15306
|
-
var CheckEntryViewSchema =
|
|
15307
|
-
path:
|
|
15308
|
-
shared:
|
|
15309
|
-
via:
|
|
15469
|
+
var CheckEntryViewSchema = z20.strictObject({
|
|
15470
|
+
path: z20.string(),
|
|
15471
|
+
shared: z20.boolean(),
|
|
15472
|
+
via: z20.enum(DECISION_VIAS),
|
|
15310
15473
|
/** The entry's real category, or null when nothing classifies it. */
|
|
15311
|
-
category:
|
|
15312
|
-
rule:
|
|
15474
|
+
category: z20.enum(CATEGORY_NAMES).nullable(),
|
|
15475
|
+
rule: z20.strictObject({ key: z20.string(), layer: z20.int() }).optional(),
|
|
15313
15476
|
/** Rules that matched but whose `when` condition failed, each with the conditions that failed. */
|
|
15314
|
-
eliminated:
|
|
15477
|
+
eliminated: z20.readonly(z20.array(z20.strictObject({ key: z20.string(), failed: z20.readonly(z20.array(z20.string())) }))).optional()
|
|
15315
15478
|
});
|
|
15316
|
-
var CheckDiagnosticSchema =
|
|
15317
|
-
code:
|
|
15318
|
-
severity:
|
|
15319
|
-
message:
|
|
15320
|
-
subject:
|
|
15321
|
-
layer:
|
|
15479
|
+
var CheckDiagnosticSchema = z20.strictObject({
|
|
15480
|
+
code: z20.enum(DIAGNOSTIC_CODES),
|
|
15481
|
+
severity: z20.enum(DIAGNOSTIC_SEVERITIES),
|
|
15482
|
+
message: z20.string(),
|
|
15483
|
+
subject: z20.string().optional(),
|
|
15484
|
+
layer: z20.int().optional()
|
|
15322
15485
|
});
|
|
15323
|
-
var CheckAmbientCredentialSchema =
|
|
15324
|
-
var CheckKeychainSchema =
|
|
15325
|
-
checked:
|
|
15326
|
-
found:
|
|
15327
|
-
serviceName:
|
|
15328
|
-
note:
|
|
15486
|
+
var CheckAmbientCredentialSchema = z20.union([z20.strictObject({ ok: z20.literal(true) }), z20.strictObject({ ok: z20.literal(false), variable: z20.string(), message: z20.string() })]);
|
|
15487
|
+
var CheckKeychainSchema = z20.strictObject({
|
|
15488
|
+
checked: z20.literal(true),
|
|
15489
|
+
found: z20.boolean(),
|
|
15490
|
+
serviceName: z20.string().optional(),
|
|
15491
|
+
note: z20.string()
|
|
15329
15492
|
});
|
|
15330
|
-
var CheckSettingsExposureSchema =
|
|
15331
|
-
file:
|
|
15332
|
-
envKeyNames:
|
|
15333
|
-
hookEventNames:
|
|
15334
|
-
hookCommandCount:
|
|
15493
|
+
var CheckSettingsExposureSchema = z20.strictObject({
|
|
15494
|
+
file: z20.string(),
|
|
15495
|
+
envKeyNames: z20.readonly(z20.array(z20.string())),
|
|
15496
|
+
hookEventNames: z20.readonly(z20.array(z20.string())),
|
|
15497
|
+
hookCommandCount: z20.int().nonnegative()
|
|
15335
15498
|
});
|
|
15336
|
-
var CredentialSourceSummarySchema =
|
|
15337
|
-
|
|
15338
|
-
|
|
15339
|
-
|
|
15340
|
-
|
|
15341
|
-
|
|
15342
|
-
|
|
15499
|
+
var CredentialSourceSummarySchema = z20.union([
|
|
15500
|
+
z20.strictObject({ kind: z20.literal("env"), variable: z20.string() }),
|
|
15501
|
+
z20.strictObject({ kind: z20.literal("file"), path: z20.string() }),
|
|
15502
|
+
z20.strictObject({ kind: z20.literal("command"), program: z20.string() }),
|
|
15503
|
+
z20.strictObject({ kind: z20.literal("op"), reference: z20.string() }),
|
|
15504
|
+
z20.strictObject({ kind: z20.literal("keychain"), service: z20.string(), account: z20.string().optional() }),
|
|
15505
|
+
z20.strictObject({ kind: z20.literal("literal") })
|
|
15343
15506
|
]);
|
|
15344
|
-
var CredentialSummarySchema =
|
|
15345
|
-
target:
|
|
15346
|
-
sources:
|
|
15507
|
+
var CredentialSummarySchema = z20.strictObject({
|
|
15508
|
+
target: z20.enum(CREDENTIAL_TARGETS),
|
|
15509
|
+
sources: z20.readonly(z20.array(CredentialSourceSummarySchema)),
|
|
15347
15510
|
cache: CredentialCacheSchema.optional()
|
|
15348
15511
|
});
|
|
15349
|
-
var CachedCredentialStateSchema =
|
|
15350
|
-
|
|
15351
|
-
|
|
15352
|
-
|
|
15512
|
+
var CachedCredentialStateSchema = z20.union([
|
|
15513
|
+
z20.strictObject({ store: z20.enum(CREDENTIAL_CACHE_STORES), status: z20.literal("empty") }),
|
|
15514
|
+
z20.strictObject({ store: z20.enum(CREDENTIAL_CACHE_STORES), status: z20.literal("unreadable"), reason: z20.string() }),
|
|
15515
|
+
z20.strictObject({ store: z20.enum(CREDENTIAL_CACHE_STORES), status: z20.enum(["fresh", "expired"]), ageMs: z20.number(), expiresInMs: z20.number().optional() })
|
|
15353
15516
|
]);
|
|
15354
|
-
var CheckCredentialProviderSchema =
|
|
15355
|
-
|
|
15356
|
-
|
|
15517
|
+
var CheckCredentialProviderSchema = z20.union([
|
|
15518
|
+
z20.strictObject({ name: z20.string(), credential: CredentialSummarySchema.optional(), cached: CachedCredentialStateSchema.optional() }),
|
|
15519
|
+
z20.strictObject({ name: z20.string(), problem: z20.string() })
|
|
15357
15520
|
]);
|
|
15358
|
-
var CheckCredentialSchema =
|
|
15359
|
-
applies:
|
|
15521
|
+
var CheckCredentialSchema = z20.strictObject({
|
|
15522
|
+
applies: z20.enum(CHECK_CREDENTIAL_APPLIES),
|
|
15360
15523
|
provider: CheckCredentialProviderSchema.optional(),
|
|
15361
15524
|
identity: CredentialSummarySchema.optional(),
|
|
15362
15525
|
identityCached: CachedCredentialStateSchema.optional()
|
|
15363
15526
|
});
|
|
15364
|
-
var CheckClaudeVersionSchema =
|
|
15365
|
-
pinned:
|
|
15366
|
-
highestInstalled:
|
|
15367
|
-
installed:
|
|
15527
|
+
var CheckClaudeVersionSchema = z20.strictObject({
|
|
15528
|
+
pinned: z20.strictObject({ version: z20.string(), source: z20.enum(CLAUDE_VERSION_SOURCES), installed: z20.boolean() }).optional(),
|
|
15529
|
+
highestInstalled: z20.string().optional(),
|
|
15530
|
+
installed: z20.readonly(z20.array(z20.string()))
|
|
15368
15531
|
});
|
|
15369
|
-
var CheckReportJsonSchema =
|
|
15370
|
-
identity:
|
|
15532
|
+
var CheckReportJsonSchema = z20.strictObject({
|
|
15533
|
+
identity: z20.strictObject({ name: z20.string().nullable(), source: z20.enum(IDENTITY_DECISION_SOURCES) }),
|
|
15371
15534
|
/** The pool ranking, when the launch named a pool instead of an identity. */
|
|
15372
15535
|
pool: PoolPickReportSchema.optional(),
|
|
15373
|
-
configProfile:
|
|
15374
|
-
layers:
|
|
15375
|
-
entries:
|
|
15376
|
-
projectEncodingAmbiguities:
|
|
15377
|
-
|
|
15536
|
+
configProfile: z20.strictObject({ name: z20.string().nullable(), source: z20.enum(CONFIG_PROFILE_DECISION_SOURCES) }),
|
|
15537
|
+
layers: z20.readonly(z20.array(CheckLayerViewSchema)),
|
|
15538
|
+
entries: z20.readonly(z20.array(CheckEntryViewSchema)),
|
|
15539
|
+
projectEncodingAmbiguities: z20.readonly(
|
|
15540
|
+
z20.array(z20.strictObject({ fragment: z20.string(), encoded: z20.string(), reason: z20.enum(ENCODING_AMBIGUITY_REASONS), detail: z20.string() }))
|
|
15378
15541
|
),
|
|
15379
|
-
diagnostics:
|
|
15542
|
+
diagnostics: z20.readonly(z20.array(CheckDiagnosticSchema)),
|
|
15380
15543
|
ambientCredential: CheckAmbientCredentialSchema,
|
|
15381
15544
|
keychain: CheckKeychainSchema.optional(),
|
|
15382
|
-
settingsExposure:
|
|
15545
|
+
settingsExposure: z20.readonly(z20.array(CheckSettingsExposureSchema)),
|
|
15383
15546
|
credential: CheckCredentialSchema,
|
|
15384
15547
|
claudeVersion: CheckClaudeVersionSchema.optional()
|
|
15385
15548
|
});
|
|
@@ -15439,28 +15602,28 @@ function collectResets(snapshots, nowMs) {
|
|
|
15439
15602
|
}
|
|
15440
15603
|
|
|
15441
15604
|
// src/usage/resetsSchema.ts
|
|
15442
|
-
import { z as
|
|
15443
|
-
var ResetRowSchema =
|
|
15444
|
-
identity:
|
|
15445
|
-
provider:
|
|
15605
|
+
import { z as z21 } from "zod";
|
|
15606
|
+
var ResetRowSchema = z21.strictObject({
|
|
15607
|
+
identity: z21.string(),
|
|
15608
|
+
provider: z21.string(),
|
|
15446
15609
|
/** What the window is: `5h`, `7d` or `extra usage` for an Anthropic account, or the provider's own measure and period (`tokens 5h`). */
|
|
15447
|
-
window:
|
|
15610
|
+
window: z21.string(),
|
|
15448
15611
|
/** When the state the window comes from was observed, as an ISO instant. */
|
|
15449
|
-
observedAt:
|
|
15612
|
+
observedAt: z21.iso.datetime(),
|
|
15450
15613
|
/** When the window resets, as an ISO instant; absent when the upstream reported none. */
|
|
15451
|
-
resetsAt:
|
|
15614
|
+
resetsAt: z21.iso.datetime().optional(),
|
|
15452
15615
|
/** True when the reset time has passed, so the recorded observation describes a window that no longer exists and its utilisation reads as 0. */
|
|
15453
|
-
reset:
|
|
15616
|
+
reset: z21.boolean(),
|
|
15454
15617
|
/** The fraction used, as `effectiveWindow` reads it at the report's own clock. */
|
|
15455
|
-
utilization:
|
|
15618
|
+
utilization: z21.number().optional(),
|
|
15456
15619
|
/** The window's own status, for a window that has not reset yet. */
|
|
15457
|
-
status:
|
|
15620
|
+
status: z21.string().optional()
|
|
15458
15621
|
});
|
|
15459
|
-
var ResetScheduleSchema =
|
|
15622
|
+
var ResetScheduleSchema = z21.strictObject({ resets: z21.readonly(z21.array(ResetRowSchema)) });
|
|
15460
15623
|
|
|
15461
15624
|
// src/frontdoor/controlSchemas.ts
|
|
15462
15625
|
import path32 from "node:path";
|
|
15463
|
-
import { z as
|
|
15626
|
+
import { z as z28 } from "zod";
|
|
15464
15627
|
|
|
15465
15628
|
// src/doctorReport.ts
|
|
15466
15629
|
init_claudeShim();
|
|
@@ -15640,24 +15803,24 @@ import path31 from "node:path";
|
|
|
15640
15803
|
init_signIn();
|
|
15641
15804
|
|
|
15642
15805
|
// src/codex/siwcStore.ts
|
|
15643
|
-
import { z as
|
|
15806
|
+
import { z as z25 } from "zod";
|
|
15644
15807
|
|
|
15645
15808
|
// src/codex/auth.ts
|
|
15646
|
-
import { z as
|
|
15647
|
-
var AuthFileSchema =
|
|
15648
|
-
tokens:
|
|
15649
|
-
access_token:
|
|
15650
|
-
refresh_token:
|
|
15651
|
-
id_token:
|
|
15652
|
-
account_id:
|
|
15809
|
+
import { z as z23 } from "zod";
|
|
15810
|
+
var AuthFileSchema = z23.looseObject({
|
|
15811
|
+
tokens: z23.looseObject({
|
|
15812
|
+
access_token: z23.string().optional(),
|
|
15813
|
+
refresh_token: z23.string().optional(),
|
|
15814
|
+
id_token: z23.string().optional(),
|
|
15815
|
+
account_id: z23.string().optional()
|
|
15653
15816
|
}).nullish(),
|
|
15654
|
-
last_refresh:
|
|
15817
|
+
last_refresh: z23.string().optional()
|
|
15655
15818
|
});
|
|
15656
|
-
var TokenGrantSchema =
|
|
15657
|
-
access_token:
|
|
15658
|
-
refresh_token:
|
|
15659
|
-
id_token:
|
|
15660
|
-
account_id:
|
|
15819
|
+
var TokenGrantSchema = z23.looseObject({
|
|
15820
|
+
access_token: z23.string().min(1).optional(),
|
|
15821
|
+
refresh_token: z23.string().min(1).optional(),
|
|
15822
|
+
id_token: z23.string().min(1).optional(),
|
|
15823
|
+
account_id: z23.string().min(1).optional()
|
|
15661
15824
|
});
|
|
15662
15825
|
var CodexAuthError = class extends Error {
|
|
15663
15826
|
constructor(message) {
|
|
@@ -15667,41 +15830,41 @@ var CodexAuthError = class extends Error {
|
|
|
15667
15830
|
};
|
|
15668
15831
|
|
|
15669
15832
|
// src/codex/siwc.ts
|
|
15670
|
-
import { z as
|
|
15833
|
+
import { z as z24 } from "zod";
|
|
15671
15834
|
var SIWC_RESOURCE = "https://api.openai.com/v1";
|
|
15672
15835
|
var SIWC_RESPONSES_URL = `${SIWC_RESOURCE}/responses`;
|
|
15673
15836
|
var SIWC_PLAN_SCOPE = "chatgpt.tokens.use.direct";
|
|
15674
|
-
var TokenResponseSchema =
|
|
15675
|
-
access_token:
|
|
15676
|
-
refresh_token:
|
|
15677
|
-
id_token:
|
|
15678
|
-
expires_in:
|
|
15679
|
-
scope:
|
|
15837
|
+
var TokenResponseSchema = z24.looseObject({
|
|
15838
|
+
access_token: z24.string().min(1),
|
|
15839
|
+
refresh_token: z24.string().min(1).optional(),
|
|
15840
|
+
id_token: z24.string().min(1).optional(),
|
|
15841
|
+
expires_in: z24.number().positive(),
|
|
15842
|
+
scope: z24.string().optional()
|
|
15680
15843
|
});
|
|
15681
|
-
var JwtHeaderSchema =
|
|
15682
|
-
var IdTokenClaimsSchema =
|
|
15683
|
-
iss:
|
|
15684
|
-
sub:
|
|
15685
|
-
aud:
|
|
15686
|
-
exp:
|
|
15687
|
-
nonce:
|
|
15688
|
-
email:
|
|
15844
|
+
var JwtHeaderSchema = z24.looseObject({ alg: z24.string(), kid: z24.string().optional() });
|
|
15845
|
+
var IdTokenClaimsSchema = z24.looseObject({
|
|
15846
|
+
iss: z24.string(),
|
|
15847
|
+
sub: z24.string().min(1),
|
|
15848
|
+
aud: z24.union([z24.string(), z24.array(z24.string())]),
|
|
15849
|
+
exp: z24.number(),
|
|
15850
|
+
nonce: z24.string().optional(),
|
|
15851
|
+
email: z24.string().optional()
|
|
15689
15852
|
});
|
|
15690
|
-
var JwksSchema =
|
|
15853
|
+
var JwksSchema = z24.object({ keys: z24.array(z24.looseObject({ kid: z24.string().optional(), kty: z24.string() })) });
|
|
15691
15854
|
|
|
15692
15855
|
// src/codex/siwcStore.ts
|
|
15693
|
-
var SiwcGrantSchema =
|
|
15694
|
-
clientId:
|
|
15695
|
-
sub:
|
|
15696
|
-
email:
|
|
15697
|
-
idToken:
|
|
15698
|
-
accessToken:
|
|
15699
|
-
refreshToken:
|
|
15700
|
-
scopes:
|
|
15856
|
+
var SiwcGrantSchema = z25.strictObject({
|
|
15857
|
+
clientId: z25.string().min(1),
|
|
15858
|
+
sub: z25.string().min(1),
|
|
15859
|
+
email: z25.string().optional(),
|
|
15860
|
+
idToken: z25.string().min(1),
|
|
15861
|
+
accessToken: z25.string().min(1),
|
|
15862
|
+
refreshToken: z25.string().min(1),
|
|
15863
|
+
scopes: z25.array(z25.string()).readonly(),
|
|
15701
15864
|
/** When the access token stops working, in milliseconds since the epoch. */
|
|
15702
|
-
expiresAt:
|
|
15865
|
+
expiresAt: z25.number()
|
|
15703
15866
|
});
|
|
15704
|
-
var SiwcFileSchema =
|
|
15867
|
+
var SiwcFileSchema = z25.strictObject({ registeredClientId: z25.string().min(1).optional(), grant: SiwcGrantSchema.optional() });
|
|
15705
15868
|
function parseSiwcFile(raw, filePath) {
|
|
15706
15869
|
let json;
|
|
15707
15870
|
try {
|
|
@@ -16665,92 +16828,92 @@ function collectDoctorReport(params) {
|
|
|
16665
16828
|
// src/frontdoor/controlSchemas.ts
|
|
16666
16829
|
init_schema2();
|
|
16667
16830
|
init_state();
|
|
16668
|
-
var UsageListOutputSchema =
|
|
16669
|
-
var UsageWindowsInputSchema =
|
|
16670
|
-
identity:
|
|
16671
|
-
provider:
|
|
16831
|
+
var UsageListOutputSchema = z28.strictObject({ snapshots: z28.readonly(z28.array(UsageSnapshotSchema)) });
|
|
16832
|
+
var UsageWindowsInputSchema = z28.strictObject({
|
|
16833
|
+
identity: z28.string().min(1),
|
|
16834
|
+
provider: z28.string().min(1).optional()
|
|
16672
16835
|
});
|
|
16673
|
-
var EffectiveWindowSchema =
|
|
16836
|
+
var EffectiveWindowSchema = z28.strictObject({
|
|
16674
16837
|
/** True when the window's reset time has passed, so the recorded observation describes a window that no longer exists. */
|
|
16675
|
-
reset:
|
|
16838
|
+
reset: z28.boolean(),
|
|
16676
16839
|
/** The fraction used: 0 for a reset window, otherwise what was last observed, absent when none was reported. */
|
|
16677
|
-
utilization:
|
|
16840
|
+
utilization: z28.number().optional(),
|
|
16678
16841
|
/** The reset instant, for a window that has not reset yet and reported one. */
|
|
16679
|
-
resetsAtMs:
|
|
16842
|
+
resetsAtMs: z28.number().optional(),
|
|
16680
16843
|
/** The window's own status, for a window that has not reset yet. */
|
|
16681
|
-
status:
|
|
16844
|
+
status: z28.string().optional()
|
|
16682
16845
|
});
|
|
16683
|
-
var UsageWindowsOutputSchema =
|
|
16684
|
-
identity:
|
|
16685
|
-
provider:
|
|
16846
|
+
var UsageWindowsOutputSchema = z28.strictObject({
|
|
16847
|
+
identity: z28.string(),
|
|
16848
|
+
provider: z28.string(),
|
|
16686
16849
|
/** When the rate-limit state the windows come from was observed. */
|
|
16687
|
-
observedAt:
|
|
16850
|
+
observedAt: z28.iso.datetime().optional(),
|
|
16688
16851
|
fiveHour: EffectiveWindowSchema.optional(),
|
|
16689
16852
|
sevenDay: EffectiveWindowSchema.optional()
|
|
16690
16853
|
});
|
|
16691
|
-
var UsageLiveOutputSchema =
|
|
16854
|
+
var UsageLiveOutputSchema = z28.strictObject({
|
|
16692
16855
|
/** The freshest observation the door holds, never narrowed by the read's session filter because it is the door's single latest statement of the account's quota; absent while no rate_limit_event has been filed at all. */
|
|
16693
16856
|
latest: RcLiveRateLimitSchema.optional(),
|
|
16694
16857
|
/** One observation per session whose stream has filed a rate_limit_event this door generation. */
|
|
16695
|
-
sessions:
|
|
16858
|
+
sessions: z28.readonly(z28.array(RcLiveRateLimitSchema))
|
|
16696
16859
|
});
|
|
16697
|
-
var FrontDoorSessionStatusSchema =
|
|
16698
|
-
pid:
|
|
16699
|
-
startedAt:
|
|
16700
|
-
alive:
|
|
16860
|
+
var FrontDoorSessionStatusSchema = z28.strictObject({
|
|
16861
|
+
pid: z28.int().positive(),
|
|
16862
|
+
startedAt: z28.number(),
|
|
16863
|
+
alive: z28.boolean()
|
|
16701
16864
|
});
|
|
16702
|
-
var HeadroomSocketTargetSchema =
|
|
16703
|
-
var FrontDoorStatusOutputSchema =
|
|
16865
|
+
var HeadroomSocketTargetSchema = z28.union([z28.strictObject({ socketPath: z28.string() }), z28.strictObject({ refused: z28.string() })]);
|
|
16866
|
+
var FrontDoorStatusOutputSchema = z28.strictObject({
|
|
16704
16867
|
state: FrontDoorStateSchema,
|
|
16705
|
-
supervisorAlive:
|
|
16868
|
+
supervisorAlive: z28.boolean(),
|
|
16706
16869
|
/** The pids of earlier doors that released their addresses and are finishing the connections they carried: running, but not serving anything new. */
|
|
16707
|
-
draining:
|
|
16708
|
-
sessions:
|
|
16870
|
+
draining: z28.readonly(z28.array(z28.number().int().positive())),
|
|
16871
|
+
sessions: z28.readonly(z28.array(FrontDoorSessionStatusSchema)),
|
|
16709
16872
|
headroomSocket: HeadroomSocketTargetSchema.optional(),
|
|
16710
|
-
logPath:
|
|
16711
|
-
logExists:
|
|
16873
|
+
logPath: z28.string(),
|
|
16874
|
+
logExists: z28.boolean()
|
|
16712
16875
|
});
|
|
16713
|
-
var FrontDoorSessionsOutputSchema =
|
|
16714
|
-
var CheckRunInputSchema =
|
|
16715
|
-
path:
|
|
16716
|
-
identity:
|
|
16876
|
+
var FrontDoorSessionsOutputSchema = z28.strictObject({ sessions: z28.readonly(z28.array(FrontDoorSessionStatusSchema)) });
|
|
16877
|
+
var CheckRunInputSchema = z28.strictObject({
|
|
16878
|
+
path: z28.string().min(1),
|
|
16879
|
+
identity: z28.string().min(1).optional()
|
|
16717
16880
|
}).refine((input) => path32.isAbsolute(input.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
|
|
16718
|
-
var PoolPickInputSchema =
|
|
16719
|
-
pool:
|
|
16720
|
-
path:
|
|
16881
|
+
var PoolPickInputSchema = z28.strictObject({
|
|
16882
|
+
pool: z28.string().min(1),
|
|
16883
|
+
path: z28.string().min(1)
|
|
16721
16884
|
}).refine((input) => path32.isAbsolute(input.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
|
|
16722
|
-
var DoctorFindingSchema =
|
|
16723
|
-
section:
|
|
16724
|
-
subject:
|
|
16725
|
-
severity:
|
|
16726
|
-
message:
|
|
16885
|
+
var DoctorFindingSchema = z28.strictObject({
|
|
16886
|
+
section: z28.enum(DOCTOR_SECTIONS),
|
|
16887
|
+
subject: z28.string().optional(),
|
|
16888
|
+
severity: z28.enum(DOCTOR_SEVERITIES),
|
|
16889
|
+
message: z28.string()
|
|
16727
16890
|
});
|
|
16728
|
-
var DoctorRunOutputSchema =
|
|
16891
|
+
var DoctorRunOutputSchema = z28.strictObject({
|
|
16729
16892
|
/** False exactly when any finding is a `fail`; a `warn` never fails the report on its own. */
|
|
16730
|
-
ok:
|
|
16731
|
-
findings:
|
|
16893
|
+
ok: z28.boolean(),
|
|
16894
|
+
findings: z28.readonly(z28.array(DoctorFindingSchema))
|
|
16732
16895
|
});
|
|
16733
|
-
var FrontDoorRestartOutputSchema =
|
|
16734
|
-
action:
|
|
16735
|
-
previousPid:
|
|
16896
|
+
var FrontDoorRestartOutputSchema = z28.strictObject({
|
|
16897
|
+
action: z28.literal("restarting"),
|
|
16898
|
+
previousPid: z28.int().positive()
|
|
16736
16899
|
});
|
|
16737
|
-
var UpdateCheckOutputSchema =
|
|
16738
|
-
current:
|
|
16739
|
-
latest:
|
|
16740
|
-
action:
|
|
16900
|
+
var UpdateCheckOutputSchema = z28.strictObject({
|
|
16901
|
+
current: z28.string(),
|
|
16902
|
+
latest: z28.string(),
|
|
16903
|
+
action: z28.enum(["current", "available", "updated"])
|
|
16741
16904
|
});
|
|
16742
|
-
var CodexSignInSchema =
|
|
16743
|
-
|
|
16744
|
-
|
|
16745
|
-
|
|
16905
|
+
var CodexSignInSchema = z28.discriminatedUnion("state", [
|
|
16906
|
+
z28.strictObject({ state: z28.literal("none") }),
|
|
16907
|
+
z28.strictObject({ state: z28.literal("signed-in"), email: z28.string().optional(), planScope: z28.boolean(), accessTokenExpiresAt: z28.number() }),
|
|
16908
|
+
z28.strictObject({ state: z28.literal("unreadable"), message: z28.string() })
|
|
16746
16909
|
]);
|
|
16747
|
-
var CodexStatusOutputSchema =
|
|
16910
|
+
var CodexStatusOutputSchema = z28.strictObject({
|
|
16748
16911
|
signIn: CodexSignInSchema,
|
|
16749
|
-
codexProviders:
|
|
16912
|
+
codexProviders: z28.readonly(z28.array(z28.string()))
|
|
16750
16913
|
});
|
|
16751
|
-
var CodexLogoutOutputSchema =
|
|
16752
|
-
hadGrant:
|
|
16753
|
-
revoked:
|
|
16914
|
+
var CodexLogoutOutputSchema = z28.strictObject({
|
|
16915
|
+
hadGrant: z28.boolean(),
|
|
16916
|
+
revoked: z28.boolean()
|
|
16754
16917
|
});
|
|
16755
16918
|
|
|
16756
16919
|
// src/frontdoor/codexApi.ts
|
|
@@ -16909,145 +17072,147 @@ init_providersStore();
|
|
|
16909
17072
|
|
|
16910
17073
|
// src/frontdoor/configSchemas.ts
|
|
16911
17074
|
init_schema();
|
|
16912
|
-
|
|
16913
|
-
|
|
16914
|
-
var
|
|
16915
|
-
|
|
16916
|
-
|
|
16917
|
-
|
|
16918
|
-
cache: z28.union([z28.literal(false), CredentialCacheSchema]).optional()
|
|
17075
|
+
import { z as z29 } from "zod";
|
|
17076
|
+
var RemovalConfirmationSchema = z29.boolean();
|
|
17077
|
+
var CredentialWriteSchema = (targets) => z29.strictObject({
|
|
17078
|
+
sources: z29.array(RemoteCredentialSourceSchema).min(1).optional(),
|
|
17079
|
+
target: z29.enum(targets).optional(),
|
|
17080
|
+
cache: z29.union([z29.literal(false), CredentialCacheSchema]).optional()
|
|
16919
17081
|
});
|
|
16920
|
-
var CredentialSummarySchema2 =
|
|
16921
|
-
target:
|
|
16922
|
-
sources:
|
|
16923
|
-
|
|
16924
|
-
|
|
16925
|
-
|
|
16926
|
-
|
|
16927
|
-
|
|
16928
|
-
|
|
16929
|
-
|
|
17082
|
+
var CredentialSummarySchema2 = z29.strictObject({
|
|
17083
|
+
target: z29.enum(CREDENTIAL_TARGETS),
|
|
17084
|
+
sources: z29.readonly(z29.array(
|
|
17085
|
+
z29.discriminatedUnion("kind", [
|
|
17086
|
+
z29.strictObject({ kind: z29.literal("env"), variable: z29.string() }),
|
|
17087
|
+
z29.strictObject({ kind: z29.literal("file"), path: z29.string() }),
|
|
17088
|
+
z29.strictObject({ kind: z29.literal("command"), program: z29.string() }),
|
|
17089
|
+
z29.strictObject({ kind: z29.literal("op"), reference: z29.string() }),
|
|
17090
|
+
z29.strictObject({ kind: z29.literal("keychain"), service: z29.string(), account: z29.string().optional() }),
|
|
17091
|
+
z29.strictObject({ kind: z29.literal("literal") })
|
|
16930
17092
|
])
|
|
16931
17093
|
)),
|
|
16932
17094
|
cache: CredentialCacheSchema.optional()
|
|
16933
17095
|
});
|
|
16934
|
-
var mutationOutput = (kind, action) =>
|
|
16935
|
-
var storedMutationOutput = (kind, action, value) =>
|
|
16936
|
-
var IdentityValueSchema =
|
|
16937
|
-
name:
|
|
16938
|
-
defaultConfigProfile:
|
|
16939
|
-
allowAmbientCredential:
|
|
17096
|
+
var mutationOutput = (kind, action) => z29.strictObject({ action: z29.literal(action), kind: z29.literal(kind), name: z29.string() });
|
|
17097
|
+
var storedMutationOutput = (kind, action, value) => z29.strictObject({ action: z29.literal(action), kind: z29.literal(kind), name: z29.string(), value });
|
|
17098
|
+
var IdentityValueSchema = z29.strictObject({
|
|
17099
|
+
name: z29.string(),
|
|
17100
|
+
defaultConfigProfile: z29.string().optional(),
|
|
17101
|
+
allowAmbientCredential: z29.boolean(),
|
|
16940
17102
|
credential: CredentialSummarySchema2.optional(),
|
|
16941
|
-
anchors:
|
|
17103
|
+
anchors: z29.array(AnchorSchema).optional()
|
|
16942
17104
|
});
|
|
16943
17105
|
var ProfileValueSchema = ConfigProfileSchema.omit({ $schema: true });
|
|
16944
|
-
var ProviderValueSchema =
|
|
16945
|
-
name:
|
|
16946
|
-
kind:
|
|
16947
|
-
displayName:
|
|
16948
|
-
baseUrl:
|
|
17106
|
+
var ProviderValueSchema = z29.strictObject({
|
|
17107
|
+
name: z29.string(),
|
|
17108
|
+
kind: z29.enum(PROVIDER_KINDS),
|
|
17109
|
+
displayName: z29.string(),
|
|
17110
|
+
baseUrl: z29.string().optional(),
|
|
16949
17111
|
codex: CodexProviderConfigSchema.optional(),
|
|
16950
17112
|
credential: CredentialSummarySchema2.optional(),
|
|
16951
|
-
env:
|
|
17113
|
+
env: z29.record(z29.string(), z29.string()).optional()
|
|
16952
17114
|
});
|
|
16953
|
-
var ConfigNameInputSchema =
|
|
17115
|
+
var ConfigNameInputSchema = z29.strictObject({ name: z29.string().min(1) });
|
|
16954
17116
|
var ConfigIdentityAddOutputSchema = storedMutationOutput("identity", "created", IdentityValueSchema);
|
|
16955
|
-
var ConfigIdentitySetInputSchema =
|
|
16956
|
-
name:
|
|
16957
|
-
defaultConfigProfile:
|
|
16958
|
-
allowAmbientCredential:
|
|
16959
|
-
credential:
|
|
17117
|
+
var ConfigIdentitySetInputSchema = z29.strictObject({
|
|
17118
|
+
name: z29.string().min(1),
|
|
17119
|
+
defaultConfigProfile: z29.union([z29.string().min(1), z29.literal(false)]).optional(),
|
|
17120
|
+
allowAmbientCredential: z29.boolean().optional(),
|
|
17121
|
+
credential: z29.union([z29.literal(false), CredentialWriteSchema(CREDENTIAL_TARGETS)]).optional(),
|
|
16960
17122
|
/** `false` removes the anchors; a list replaces them. */
|
|
16961
|
-
anchors:
|
|
17123
|
+
anchors: z29.union([z29.literal(false), z29.array(AnchorSchema).min(1)]).optional()
|
|
16962
17124
|
});
|
|
16963
17125
|
var ConfigIdentitySetOutputSchema = storedMutationOutput("identity", "updated", IdentityValueSchema);
|
|
16964
|
-
var ConfigIdentityRemoveInputSchema =
|
|
17126
|
+
var ConfigIdentityRemoveInputSchema = z29.strictObject({ name: z29.string().min(1), confirm: RemovalConfirmationSchema });
|
|
16965
17127
|
var ConfigIdentityRemoveOutputSchema = mutationOutput("identity", "removed");
|
|
16966
17128
|
var ConfigIdentityUseOutputSchema = mutationOutput("identity", "selected");
|
|
16967
|
-
var ConfigProfileAddInputSchema =
|
|
16968
|
-
name:
|
|
16969
|
-
extends:
|
|
16970
|
-
description:
|
|
17129
|
+
var ConfigProfileAddInputSchema = z29.strictObject({
|
|
17130
|
+
name: z29.string().min(1),
|
|
17131
|
+
extends: z29.array(z29.string().min(1)).optional(),
|
|
17132
|
+
description: z29.string().optional()
|
|
16971
17133
|
});
|
|
16972
17134
|
var ConfigProfileAddOutputSchema = storedMutationOutput("profile", "created", ProfileValueSchema);
|
|
16973
|
-
var ConfigProfileSetInputSchema =
|
|
16974
|
-
name:
|
|
16975
|
-
category:
|
|
16976
|
-
entry:
|
|
16977
|
-
extends:
|
|
16978
|
-
description:
|
|
16979
|
-
launch:
|
|
16980
|
-
skipPermissions:
|
|
16981
|
-
remoteControl:
|
|
16982
|
-
headroom:
|
|
16983
|
-
trackUsage:
|
|
16984
|
-
provider:
|
|
16985
|
-
claudeVersion:
|
|
16986
|
-
delay:
|
|
16987
|
-
pause:
|
|
16988
|
-
explain:
|
|
16989
|
-
proxyBypass:
|
|
16990
|
-
statusline:
|
|
17135
|
+
var ConfigProfileSetInputSchema = z29.strictObject({
|
|
17136
|
+
name: z29.string().min(1),
|
|
17137
|
+
category: z29.record(z29.string(), z29.boolean()).optional(),
|
|
17138
|
+
entry: z29.record(z29.string(), z29.boolean()).optional(),
|
|
17139
|
+
extends: z29.union([z29.array(z29.string().min(1)), z29.literal(false)]).optional(),
|
|
17140
|
+
description: z29.union([z29.string(), z29.literal(false)]).optional(),
|
|
17141
|
+
launch: z29.strictObject({
|
|
17142
|
+
skipPermissions: z29.boolean().optional(),
|
|
17143
|
+
remoteControl: z29.boolean().optional(),
|
|
17144
|
+
headroom: z29.boolean().optional(),
|
|
17145
|
+
trackUsage: z29.boolean().optional(),
|
|
17146
|
+
provider: z29.union([z29.string().min(1), z29.literal(false)]).optional(),
|
|
17147
|
+
claudeVersion: z29.union([z29.string().min(1), z29.literal(false)]).optional(),
|
|
17148
|
+
delay: z29.union([z29.string().regex(DURATION_RE), z29.literal(false)]).optional(),
|
|
17149
|
+
pause: z29.boolean().optional(),
|
|
17150
|
+
explain: z29.boolean().optional(),
|
|
17151
|
+
proxyBypass: z29.union([z29.array(z29.string().min(1)), z29.literal(false)]).optional(),
|
|
17152
|
+
statusline: z29.strictObject({
|
|
17153
|
+
set: z29.record(z29.string(), z29.unknown()).optional(),
|
|
17154
|
+
unset: z29.array(z29.string()).optional()
|
|
17155
|
+
}).optional()
|
|
16991
17156
|
}).optional()
|
|
16992
17157
|
});
|
|
16993
17158
|
var ConfigProfileSetOutputSchema = storedMutationOutput("profile", "updated", ProfileValueSchema);
|
|
16994
|
-
var ConfigProfileRemoveInputSchema =
|
|
17159
|
+
var ConfigProfileRemoveInputSchema = z29.strictObject({ name: z29.string().min(1), confirm: RemovalConfirmationSchema });
|
|
16995
17160
|
var ConfigProfileRemoveOutputSchema = mutationOutput("profile", "removed");
|
|
16996
17161
|
var ConfigProfileUseOutputSchema = mutationOutput("profile", "selected");
|
|
16997
|
-
var PoolMembersInputSchema =
|
|
16998
|
-
var ConfigPoolAddInputSchema =
|
|
16999
|
-
name:
|
|
17162
|
+
var PoolMembersInputSchema = z29.array(z29.string().min(1)).min(1);
|
|
17163
|
+
var ConfigPoolAddInputSchema = z29.strictObject({
|
|
17164
|
+
name: z29.string().min(1),
|
|
17000
17165
|
identities: PoolMembersInputSchema,
|
|
17001
|
-
preference:
|
|
17002
|
-
resumeOnLimit:
|
|
17003
|
-
compactBeforeLimit:
|
|
17166
|
+
preference: z29.enum(POOL_PREFERENCES).optional(),
|
|
17167
|
+
resumeOnLimit: z29.boolean().optional(),
|
|
17168
|
+
compactBeforeLimit: z29.boolean().optional(),
|
|
17004
17169
|
compactAtUtilisation: CompactAtUtilisationSchema.optional()
|
|
17005
17170
|
});
|
|
17006
17171
|
var ConfigPoolAddOutputSchema = storedMutationOutput("pool", "created", PoolSchema);
|
|
17007
|
-
var ConfigPoolSetInputSchema =
|
|
17008
|
-
name:
|
|
17172
|
+
var ConfigPoolSetInputSchema = z29.strictObject({
|
|
17173
|
+
name: z29.string().min(1),
|
|
17009
17174
|
identities: PoolMembersInputSchema.optional(),
|
|
17010
|
-
preference:
|
|
17011
|
-
resumeOnLimit:
|
|
17012
|
-
compactBeforeLimit:
|
|
17013
|
-
compactAtUtilisation:
|
|
17175
|
+
preference: z29.union([z29.enum(POOL_PREFERENCES), z29.literal(false)]).optional(),
|
|
17176
|
+
resumeOnLimit: z29.boolean().optional(),
|
|
17177
|
+
compactBeforeLimit: z29.boolean().optional(),
|
|
17178
|
+
compactAtUtilisation: z29.union([CompactAtUtilisationSchema, z29.literal(false)]).optional()
|
|
17014
17179
|
});
|
|
17015
17180
|
var ConfigPoolSetOutputSchema = storedMutationOutput("pool", "updated", PoolSchema);
|
|
17016
|
-
var ConfigPoolRemoveInputSchema =
|
|
17181
|
+
var ConfigPoolRemoveInputSchema = z29.strictObject({ name: z29.string().min(1), confirm: RemovalConfirmationSchema });
|
|
17017
17182
|
var ConfigPoolRemoveOutputSchema = mutationOutput("pool", "removed");
|
|
17018
17183
|
var ConfigPoolUseOutputSchema = mutationOutput("pool", "selected");
|
|
17019
|
-
var ConfigProviderAddInputSchema =
|
|
17020
|
-
name:
|
|
17021
|
-
kind:
|
|
17022
|
-
displayName:
|
|
17023
|
-
baseUrl:
|
|
17184
|
+
var ConfigProviderAddInputSchema = z29.strictObject({
|
|
17185
|
+
name: z29.string().min(1),
|
|
17186
|
+
kind: z29.enum(PROVIDER_KINDS).optional(),
|
|
17187
|
+
displayName: z29.string().min(1),
|
|
17188
|
+
baseUrl: z29.string().min(1).optional(),
|
|
17024
17189
|
credential: CredentialWriteSchema(PROVIDER_CREDENTIAL_TARGETS).required({ sources: true }),
|
|
17025
17190
|
codex: CodexProviderConfigSchema.optional()
|
|
17026
17191
|
});
|
|
17027
17192
|
var ConfigProviderAddOutputSchema = storedMutationOutput("provider", "created", ProviderValueSchema);
|
|
17028
|
-
var ConfigProviderSetInputSchema =
|
|
17029
|
-
name:
|
|
17030
|
-
displayName:
|
|
17031
|
-
baseUrl:
|
|
17193
|
+
var ConfigProviderSetInputSchema = z29.strictObject({
|
|
17194
|
+
name: z29.string().min(1),
|
|
17195
|
+
displayName: z29.string().min(1).optional(),
|
|
17196
|
+
baseUrl: z29.string().min(1).optional(),
|
|
17032
17197
|
credential: CredentialWriteSchema(PROVIDER_CREDENTIAL_TARGETS).optional(),
|
|
17033
17198
|
codex: CodexProviderConfigSchema.optional()
|
|
17034
17199
|
});
|
|
17035
17200
|
var ConfigProviderSetOutputSchema = storedMutationOutput("provider", "updated", ProviderValueSchema);
|
|
17036
|
-
var ConfigProviderRemoveInputSchema =
|
|
17201
|
+
var ConfigProviderRemoveInputSchema = z29.strictObject({ name: z29.string().min(1), confirm: RemovalConfirmationSchema });
|
|
17037
17202
|
var ConfigProviderRemoveOutputSchema = mutationOutput("provider", "removed");
|
|
17038
|
-
var ConfigRuleAddInputSchema =
|
|
17039
|
-
path:
|
|
17040
|
-
configProfile:
|
|
17041
|
-
identity:
|
|
17203
|
+
var ConfigRuleAddInputSchema = z29.strictObject({
|
|
17204
|
+
path: z29.string().min(1),
|
|
17205
|
+
configProfile: z29.string().min(1).optional(),
|
|
17206
|
+
identity: z29.string().min(1).optional()
|
|
17042
17207
|
});
|
|
17043
17208
|
var ConfigRuleAddOutputSchema = storedMutationOutput("rule", "created", DirectoryRuleSchema);
|
|
17044
|
-
var ConfigRuleSetInputSchema =
|
|
17045
|
-
path:
|
|
17046
|
-
configProfile:
|
|
17047
|
-
identity:
|
|
17209
|
+
var ConfigRuleSetInputSchema = z29.strictObject({
|
|
17210
|
+
path: z29.string().min(1),
|
|
17211
|
+
configProfile: z29.union([z29.string().min(1), z29.literal(false)]).optional(),
|
|
17212
|
+
identity: z29.union([z29.string().min(1), z29.literal(false)]).optional()
|
|
17048
17213
|
});
|
|
17049
17214
|
var ConfigRuleSetOutputSchema = storedMutationOutput("rule", "updated", DirectoryRuleSchema);
|
|
17050
|
-
var ConfigRuleRemoveInputSchema =
|
|
17215
|
+
var ConfigRuleRemoveInputSchema = z29.strictObject({ path: z29.string().min(1), confirm: RemovalConfirmationSchema });
|
|
17051
17216
|
var ConfigRuleRemoveOutputSchema = mutationOutput("rule", "removed");
|
|
17052
17217
|
|
|
17053
17218
|
// src/frontdoor/configApi.ts
|
|
@@ -17360,43 +17525,43 @@ import { openapi as openapi4 } from "@orpc/openapi";
|
|
|
17360
17525
|
import { eventIterator as eventIterator2, withEventMeta as withEventMeta2 } from "@orpc/server";
|
|
17361
17526
|
|
|
17362
17527
|
// src/frontdoor/eventSchemas.ts
|
|
17363
|
-
import { z as
|
|
17528
|
+
import { z as z30 } from "zod";
|
|
17364
17529
|
var DOOR_EVENT_SOURCE_RC = "rc";
|
|
17365
17530
|
var LAUNCH_EVENT_SOURCE = "launch";
|
|
17366
17531
|
var USAGE_EVENT_SOURCE = "usage";
|
|
17367
17532
|
var DOOR_HEALTH_EVENT_SOURCE = "door";
|
|
17368
17533
|
var QUOTA_EXPIRING_EVENT_SOURCE = "quota-expiring";
|
|
17369
|
-
var DoorEventSchema =
|
|
17370
|
-
source:
|
|
17534
|
+
var DoorEventSchema = z30.strictObject({
|
|
17535
|
+
source: z30.string().min(1),
|
|
17371
17536
|
/** A positive integer because the backbone's counters start at one and only ever increase. */
|
|
17372
|
-
sequence:
|
|
17373
|
-
payload:
|
|
17537
|
+
sequence: z30.number().int().positive(),
|
|
17538
|
+
payload: z30.unknown()
|
|
17374
17539
|
});
|
|
17375
|
-
var DoorEventSourceQuerySchema =
|
|
17376
|
-
sources:
|
|
17540
|
+
var DoorEventSourceQuerySchema = z30.strictObject({
|
|
17541
|
+
sources: z30.array(z30.string().min(1)).min(1).optional()
|
|
17377
17542
|
});
|
|
17378
|
-
var LaunchLifecycleEventSchema =
|
|
17379
|
-
kind:
|
|
17380
|
-
pid:
|
|
17381
|
-
startedAt:
|
|
17382
|
-
observedAt:
|
|
17543
|
+
var LaunchLifecycleEventSchema = z30.strictObject({
|
|
17544
|
+
kind: z30.enum(["registered", "pruned", "ended"]),
|
|
17545
|
+
pid: z30.number().int().positive(),
|
|
17546
|
+
startedAt: z30.number(),
|
|
17547
|
+
observedAt: z30.number()
|
|
17383
17548
|
});
|
|
17384
|
-
var DoorHealthEventSchema =
|
|
17385
|
-
|
|
17386
|
-
|
|
17387
|
-
|
|
17388
|
-
|
|
17389
|
-
|
|
17390
|
-
|
|
17549
|
+
var DoorHealthEventSchema = z30.discriminatedUnion("kind", [
|
|
17550
|
+
z30.strictObject({ kind: z30.literal("generation"), pid: z30.number().int().positive(), providerPort: z30.number().int().positive(), connectPort: z30.number().int().positive(), directPort: z30.number().int().positive(), observedAt: z30.number() }),
|
|
17551
|
+
z30.strictObject({ kind: z30.literal("listenerFailed"), pid: z30.number().int().positive(), listener: z30.enum(["provider", "connect", "direct"]), message: z30.string(), observedAt: z30.number() }),
|
|
17552
|
+
z30.strictObject({ kind: z30.literal("binaryTurnover"), pid: z30.number().int().positive(), observedAt: z30.number() }),
|
|
17553
|
+
z30.strictObject({ kind: z30.literal("idleShutdown"), pid: z30.number().int().positive(), observedAt: z30.number() }),
|
|
17554
|
+
z30.strictObject({ kind: z30.literal("superseded"), pid: z30.number().int().positive(), ownerPid: z30.number().int().positive(), observedAt: z30.number() }),
|
|
17555
|
+
z30.strictObject({ kind: z30.literal("drained"), pid: z30.number().int().positive(), observedAt: z30.number() })
|
|
17391
17556
|
]);
|
|
17392
|
-
var QuotaExpiringEventSchema =
|
|
17393
|
-
identity:
|
|
17394
|
-
provider:
|
|
17395
|
-
window:
|
|
17557
|
+
var QuotaExpiringEventSchema = z30.strictObject({
|
|
17558
|
+
identity: z30.string().min(1),
|
|
17559
|
+
provider: z30.string().min(1),
|
|
17560
|
+
window: z30.enum(["fiveHour", "sevenDay"]),
|
|
17396
17561
|
/** The fraction of the window already used when it was seen expiring, always below one because a fully used window has nothing left to spend. */
|
|
17397
|
-
utilization:
|
|
17398
|
-
resetsAt:
|
|
17399
|
-
observedAt:
|
|
17562
|
+
utilization: z30.number().min(0).max(1),
|
|
17563
|
+
resetsAt: z30.iso.datetime(),
|
|
17564
|
+
observedAt: z30.number()
|
|
17400
17565
|
});
|
|
17401
17566
|
|
|
17402
17567
|
// src/frontdoor/eventsApi.ts
|
|
@@ -17480,60 +17645,60 @@ import { openapi as openapi6 } from "@orpc/openapi";
|
|
|
17480
17645
|
|
|
17481
17646
|
// src/frontdoor/launchSchemas.ts
|
|
17482
17647
|
import path33 from "node:path";
|
|
17483
|
-
import { z as
|
|
17648
|
+
import { z as z31 } from "zod";
|
|
17484
17649
|
init_statusline();
|
|
17485
17650
|
init_claudeVersion();
|
|
17486
17651
|
init_identity();
|
|
17487
|
-
var LaunchResolveInputSchema =
|
|
17488
|
-
path:
|
|
17652
|
+
var LaunchResolveInputSchema = z31.strictObject({
|
|
17653
|
+
path: z31.string().min(1),
|
|
17489
17654
|
/** `@name`, launch flags, then the arguments for `claude`; empty for a bare launch. */
|
|
17490
|
-
argv:
|
|
17655
|
+
argv: z31.readonly(z31.array(z31.string())).optional(),
|
|
17491
17656
|
/** The launch's inherited environment. Absent means an empty one: the door's own environment is never a substitute for the caller's, so a caller that wants `AGENT_SHIM_*` switches or a `CLAUDE_CONFIG_DIR` considered names them here. Values are read, never reported. */
|
|
17492
|
-
env:
|
|
17657
|
+
env: z31.record(z31.string(), z31.string()).optional()
|
|
17493
17658
|
}).refine((input) => path33.isAbsolute(input.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
|
|
17494
|
-
var LaunchPoolDecisionSchema =
|
|
17495
|
-
name:
|
|
17496
|
-
reasons:
|
|
17497
|
-
movedOff:
|
|
17659
|
+
var LaunchPoolDecisionSchema = z31.strictObject({
|
|
17660
|
+
name: z31.string(),
|
|
17661
|
+
reasons: z31.readonly(z31.array(z31.string())),
|
|
17662
|
+
movedOff: z31.strictObject({ identity: z31.string(), reason: z31.string() }).optional()
|
|
17498
17663
|
});
|
|
17499
|
-
var LaunchDecisionSchema =
|
|
17500
|
-
identity:
|
|
17501
|
-
identitySource:
|
|
17664
|
+
var LaunchDecisionSchema = z31.strictObject({
|
|
17665
|
+
identity: z31.string().optional(),
|
|
17666
|
+
identitySource: z31.enum(IDENTITY_DECISION_SOURCES),
|
|
17502
17667
|
pool: LaunchPoolDecisionSchema.optional(),
|
|
17503
|
-
configDirEscapeHatch:
|
|
17504
|
-
configDir:
|
|
17505
|
-
configProfile:
|
|
17506
|
-
configProfileSource:
|
|
17507
|
-
provider:
|
|
17668
|
+
configDirEscapeHatch: z31.boolean(),
|
|
17669
|
+
configDir: z31.string().optional(),
|
|
17670
|
+
configProfile: z31.string().optional(),
|
|
17671
|
+
configProfileSource: z31.enum(CONFIG_PROFILE_DECISION_SOURCES),
|
|
17672
|
+
provider: z31.string().optional()
|
|
17508
17673
|
});
|
|
17509
|
-
var LaunchFlagsSchema =
|
|
17510
|
-
skipPermissions:
|
|
17511
|
-
remoteControl:
|
|
17512
|
-
headroom:
|
|
17513
|
-
trackUsage:
|
|
17514
|
-
pause:
|
|
17515
|
-
explain:
|
|
17674
|
+
var LaunchFlagsSchema = z31.strictObject({
|
|
17675
|
+
skipPermissions: z31.boolean(),
|
|
17676
|
+
remoteControl: z31.boolean(),
|
|
17677
|
+
headroom: z31.boolean(),
|
|
17678
|
+
trackUsage: z31.boolean(),
|
|
17679
|
+
pause: z31.boolean(),
|
|
17680
|
+
explain: z31.boolean(),
|
|
17516
17681
|
/** How long the launch waits after its own output before it starts claude, in milliseconds. */
|
|
17517
|
-
delayMs:
|
|
17682
|
+
delayMs: z31.number(),
|
|
17518
17683
|
/** The hosts the launch keeps off the front door by adding them to the child's `NO_PROXY`. */
|
|
17519
|
-
proxyBypass:
|
|
17684
|
+
proxyBypass: z31.array(z31.string()).readonly(),
|
|
17520
17685
|
/** How the session's built-in statusline looks, when the launch configures any of it. */
|
|
17521
17686
|
statusline: StatuslineSchema.optional()
|
|
17522
17687
|
});
|
|
17523
|
-
var LaunchResolveOutputSchema =
|
|
17688
|
+
var LaunchResolveOutputSchema = z31.strictObject({
|
|
17524
17689
|
decision: LaunchDecisionSchema,
|
|
17525
17690
|
flags: LaunchFlagsSchema,
|
|
17526
|
-
claudeVersion:
|
|
17691
|
+
claudeVersion: z31.strictObject({ version: z31.string(), source: z31.enum(CLAUDE_VERSION_SOURCES) }).optional(),
|
|
17527
17692
|
/** The real `claude` binary the launch would spawn, on the door's host. */
|
|
17528
|
-
bin:
|
|
17693
|
+
bin: z31.string(),
|
|
17529
17694
|
/** The arguments the launch would pass it: the tool's own flags, then `CLAUDE_EXTRA_FLAGS`, then the caller's own. */
|
|
17530
|
-
args:
|
|
17695
|
+
args: z31.readonly(z31.array(z31.string())),
|
|
17531
17696
|
/** The credential the launch would authenticate with, by target and source kinds. Absent when none applies. */
|
|
17532
|
-
credential:
|
|
17533
|
-
routing:
|
|
17697
|
+
credential: z31.strictObject({ subject: z31.enum(["provider", "identity"]), name: z31.string(), summary: CredentialSummarySchema }).optional(),
|
|
17698
|
+
routing: z31.strictObject({ frontDoor: z31.boolean(), headroom: z31.boolean() }),
|
|
17534
17699
|
/** The names of the environment variables the launch would set or unset, sorted. Values are not reported. */
|
|
17535
|
-
environment:
|
|
17536
|
-
warnings:
|
|
17700
|
+
environment: z31.readonly(z31.array(z31.string())),
|
|
17701
|
+
warnings: z31.readonly(z31.array(z31.string()))
|
|
17537
17702
|
});
|
|
17538
17703
|
|
|
17539
17704
|
// src/frontdoor/launchApi.ts
|
|
@@ -17569,22 +17734,22 @@ function createLaunchApiRouter(deps) {
|
|
|
17569
17734
|
// src/frontdoor/agentTreesApi.ts
|
|
17570
17735
|
import { ORPCError as ORPCError6 } from "@orpc/client";
|
|
17571
17736
|
import { openapi as openapi7 } from "@orpc/openapi";
|
|
17572
|
-
import { z as
|
|
17737
|
+
import { z as z32 } from "zod";
|
|
17573
17738
|
init_cliError();
|
|
17574
|
-
var AgentTreesListInputSchema =
|
|
17739
|
+
var AgentTreesListInputSchema = z32.strictObject({
|
|
17575
17740
|
/** Only this identity's sessions. */
|
|
17576
|
-
identity:
|
|
17741
|
+
identity: z32.string().optional(),
|
|
17577
17742
|
/** Include sessions that spawned no agent and ran no workflow. */
|
|
17578
|
-
all:
|
|
17743
|
+
all: z32.boolean().optional()
|
|
17579
17744
|
});
|
|
17580
|
-
var AgentTreesListOutputSchema =
|
|
17581
|
-
var AgentTreesShowInputSchema =
|
|
17745
|
+
var AgentTreesListOutputSchema = z32.array(SessionSummarySchema);
|
|
17746
|
+
var AgentTreesShowInputSchema = z32.strictObject({
|
|
17582
17747
|
/** A session id, or an unambiguous prefix of one. */
|
|
17583
|
-
session:
|
|
17748
|
+
session: z32.string().min(1),
|
|
17584
17749
|
/** Look only in this identity. */
|
|
17585
|
-
identity:
|
|
17750
|
+
identity: z32.string().optional()
|
|
17586
17751
|
});
|
|
17587
|
-
var AgentTreesShowOutputSchema =
|
|
17752
|
+
var AgentTreesShowOutputSchema = z32.strictObject({ identities: z32.array(z32.string()), ...MergedAgentTreeSchema.shape });
|
|
17588
17753
|
function asBadRequest(error) {
|
|
17589
17754
|
if (error instanceof CliError) {
|
|
17590
17755
|
throw new ORPCError6("BAD_REQUEST", { message: error.message });
|
|
@@ -19777,7 +19942,7 @@ init_poolPick();
|
|
|
19777
19942
|
|
|
19778
19943
|
// src/agents/read.ts
|
|
19779
19944
|
import path35 from "node:path";
|
|
19780
|
-
import { z as
|
|
19945
|
+
import { z as z33 } from "zod";
|
|
19781
19946
|
var PROJECTS_DIR = "projects";
|
|
19782
19947
|
var TASKS_DIR = "tasks";
|
|
19783
19948
|
var SUBAGENTS_DIR = "subagents";
|
|
@@ -19896,14 +20061,14 @@ function parseJson2(text) {
|
|
|
19896
20061
|
return void 0;
|
|
19897
20062
|
}
|
|
19898
20063
|
}
|
|
19899
|
-
var TaskFileSchema =
|
|
19900
|
-
var WorkflowRunFileSchema =
|
|
19901
|
-
runId:
|
|
19902
|
-
workflowName:
|
|
19903
|
-
status:
|
|
19904
|
-
startTime:
|
|
19905
|
-
phases:
|
|
19906
|
-
summary:
|
|
20064
|
+
var TaskFileSchema = z33.object({ ...TaskItemSchema.omit({ taskList: true }).shape, blocks: z33.array(z33.string()).default([]), blockedBy: z33.array(z33.string()).default([]) });
|
|
20065
|
+
var WorkflowRunFileSchema = z33.object({
|
|
20066
|
+
runId: z33.string(),
|
|
20067
|
+
workflowName: z33.string().optional(),
|
|
20068
|
+
status: z33.string().optional(),
|
|
20069
|
+
startTime: z33.number().optional(),
|
|
20070
|
+
phases: z33.array(z33.object({ title: z33.string() })).default([]),
|
|
20071
|
+
summary: z33.string().optional()
|
|
19907
20072
|
});
|
|
19908
20073
|
function summariseSession(fs14, configDir, ref) {
|
|
19909
20074
|
const sessionRelative = path35.join(PROJECTS_DIR, ref.project, ref.entry);
|