agent-shim 11.50.2 → 11.51.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 +435 -240
- package/dist/index.cjs +628 -516
- package/dist/index.mjs +621 -510
- package/dist/types/index.d.ts +563 -440
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -121,58 +121,72 @@ 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 isPlainObject(value) {
|
|
125
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
126
|
+
}
|
|
127
|
+
function mergeStatuslineSettings(base, over) {
|
|
128
|
+
if (!isPlainObject(base) || !isPlainObject(over)) {
|
|
129
|
+
return over === void 0 ? base : over;
|
|
130
|
+
}
|
|
131
|
+
const merged = { ...base };
|
|
132
|
+
for (const [key, value] of Object.entries(over)) {
|
|
133
|
+
merged[key] = key in base ? mergeStatuslineSettings(base[key], value) : value;
|
|
134
|
+
}
|
|
135
|
+
return merged;
|
|
136
|
+
}
|
|
124
137
|
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)})`);
|
|
138
|
+
const resolved = ResolvedStatuslineSchema.parse(mergeStatuslineSettings(STATUSLINE_DEFAULTS, settings));
|
|
139
|
+
if (resolved.bands.warnAt >= resolved.bands.criticalAt) {
|
|
140
|
+
throw new RangeError(`statusline bands.warnAt (${String(resolved.bands.warnAt)}) must be below bands.criticalAt (${String(resolved.bands.criticalAt)})`);
|
|
136
141
|
}
|
|
137
142
|
return resolved;
|
|
138
143
|
}
|
|
139
|
-
var STATUSLINE_HEADER_SEGMENTS,
|
|
144
|
+
var STATUSLINE_HEADER_SEGMENTS, STATUSLINE_ROWS, MAX_PERCENT, MAX_STATUSLINE_LABEL_CHARS, MAX_BAR_CELLS, LABEL_RE2, labelText, wholePercent, SHAPES, StatuslineSchema, ResolvedStatuslineSchema, STATUSLINE_DEFAULTS, STATUSLINE_ENV;
|
|
140
145
|
var init_statusline = __esm({
|
|
141
146
|
"src/config/statusline.ts"() {
|
|
142
147
|
"use strict";
|
|
143
148
|
STATUSLINE_HEADER_SEGMENTS = ["model", "provider", "route", "account", "identity", "headroom"];
|
|
144
|
-
|
|
149
|
+
STATUSLINE_ROWS = ["context", "quota"];
|
|
145
150
|
MAX_PERCENT = 100;
|
|
146
151
|
MAX_STATUSLINE_LABEL_CHARS = 12;
|
|
147
152
|
MAX_BAR_CELLS = 40;
|
|
148
153
|
LABEL_RE2 = /^[^\p{C}\p{Z}]+(?: [^\p{C}\p{Z}]+)*$/u;
|
|
154
|
+
labelText = z.string().max(MAX_STATUSLINE_LABEL_CHARS).regex(LABEL_RE2, "must be visible text without control characters");
|
|
149
155
|
wholePercent = z.number().int().min(1).max(MAX_PERCENT);
|
|
156
|
+
SHAPES = {
|
|
157
|
+
layout: {
|
|
158
|
+
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."),
|
|
159
|
+
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.")
|
|
160
|
+
},
|
|
161
|
+
bands: {
|
|
162
|
+
warnAt: wholePercent.describe("The whole percentage of use at which a bar turns yellow; it must be below criticalAt."),
|
|
163
|
+
criticalAt: wholePercent.describe("The whole percentage of use at which a bar turns red.")
|
|
164
|
+
},
|
|
165
|
+
labels: {
|
|
166
|
+
fiveHour: labelText.describe("The name of the five-hour subscription window."),
|
|
167
|
+
sevenDay: labelText.describe("The name of the weekly subscription window.")
|
|
168
|
+
},
|
|
169
|
+
bar: {
|
|
170
|
+
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.")
|
|
171
|
+
}
|
|
172
|
+
};
|
|
150
173
|
StatuslineSchema = z.strictObject({
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
fiveHourLabel: z.string().max(MAX_STATUSLINE_LABEL_CHARS).regex(LABEL_RE2, "must be visible text without control characters").optional(),
|
|
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()
|
|
174
|
+
layout: z.strictObject(SHAPES.layout).partial().optional(),
|
|
175
|
+
bands: z.strictObject(SHAPES.bands).partial().optional(),
|
|
176
|
+
labels: z.strictObject(SHAPES.labels).partial().optional(),
|
|
177
|
+
bar: z.strictObject(SHAPES.bar).partial().optional()
|
|
158
178
|
});
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
fiveHourLabel: z.union([StatuslineSchema.shape.fiveHourLabel.unwrap(), z.literal(false)]).optional(),
|
|
165
|
-
sevenDayLabel: z.union([StatuslineSchema.shape.sevenDayLabel.unwrap(), z.literal(false)]).optional(),
|
|
166
|
-
barWidth: z.union([StatuslineSchema.shape.barWidth.unwrap(), z.literal(false)]).optional()
|
|
179
|
+
ResolvedStatuslineSchema = z.strictObject({
|
|
180
|
+
layout: z.strictObject(SHAPES.layout),
|
|
181
|
+
bands: z.strictObject(SHAPES.bands),
|
|
182
|
+
labels: z.strictObject(SHAPES.labels),
|
|
183
|
+
bar: z.strictObject(SHAPES.bar)
|
|
167
184
|
});
|
|
168
185
|
STATUSLINE_DEFAULTS = {
|
|
169
|
-
header: STATUSLINE_HEADER_SEGMENTS,
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
fiveHourLabel: "5h",
|
|
174
|
-
sevenDayLabel: "Wk",
|
|
175
|
-
barWidth: 10
|
|
186
|
+
layout: { header: [...STATUSLINE_HEADER_SEGMENTS], rows: [...STATUSLINE_ROWS] },
|
|
187
|
+
bands: { warnAt: 70, criticalAt: 90 },
|
|
188
|
+
labels: { fiveHour: "5h", sevenDay: "Wk" },
|
|
189
|
+
bar: { width: 10 }
|
|
176
190
|
};
|
|
177
191
|
STATUSLINE_ENV = "AGENT_SHIM_STATUSLINE";
|
|
178
192
|
}
|
|
@@ -1570,7 +1584,7 @@ function flattenLayers(layers, options) {
|
|
|
1570
1584
|
launch.proxyBypass = layer.launch.proxyBypass;
|
|
1571
1585
|
}
|
|
1572
1586
|
if (layer.launch.statusline !== void 0) {
|
|
1573
|
-
launch.statusline =
|
|
1587
|
+
launch.statusline = StatuslineSchema.parse(mergeStatuslineSettings(launch.statusline, layer.launch.statusline));
|
|
1574
1588
|
}
|
|
1575
1589
|
}
|
|
1576
1590
|
if (layer.models !== void 0) {
|
|
@@ -1751,6 +1765,7 @@ var init_flatten = __esm({
|
|
|
1751
1765
|
"src/resolve/flatten.ts"() {
|
|
1752
1766
|
"use strict";
|
|
1753
1767
|
init_schema();
|
|
1768
|
+
init_statusline();
|
|
1754
1769
|
init_conditions();
|
|
1755
1770
|
init_match();
|
|
1756
1771
|
}
|
|
@@ -4235,7 +4250,7 @@ var init_package = __esm({
|
|
|
4235
4250
|
"package.json"() {
|
|
4236
4251
|
package_default = {
|
|
4237
4252
|
name: "agent-shim",
|
|
4238
|
-
version: "11.
|
|
4253
|
+
version: "11.51.0",
|
|
4239
4254
|
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
4255
|
license: "MIT",
|
|
4241
4256
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -7393,6 +7408,111 @@ var init_poolPick = __esm({
|
|
|
7393
7408
|
}
|
|
7394
7409
|
});
|
|
7395
7410
|
|
|
7411
|
+
// src/statusline/keys.ts
|
|
7412
|
+
import { z as z15 } from "zod";
|
|
7413
|
+
function valueAt(source, path43) {
|
|
7414
|
+
let current = source;
|
|
7415
|
+
for (const part of path43) {
|
|
7416
|
+
if (!isPlainObject(current)) {
|
|
7417
|
+
return void 0;
|
|
7418
|
+
}
|
|
7419
|
+
current = current[part];
|
|
7420
|
+
}
|
|
7421
|
+
return current;
|
|
7422
|
+
}
|
|
7423
|
+
function keyOf(path43, leaf) {
|
|
7424
|
+
const common = { path: path43.join("."), description: leaf.description ?? "", defaultValue: valueAt(STATUSLINE_DEFAULTS, path43) };
|
|
7425
|
+
if (leaf instanceof z15.ZodNumber) {
|
|
7426
|
+
return { ...common, kind: "integer", choices: [] };
|
|
7427
|
+
}
|
|
7428
|
+
if (leaf instanceof z15.ZodString) {
|
|
7429
|
+
return { ...common, kind: "text", choices: [] };
|
|
7430
|
+
}
|
|
7431
|
+
if (leaf instanceof z15.ZodEnum) {
|
|
7432
|
+
return { ...common, kind: "choice", choices: Object.values(leaf.enum).map(String) };
|
|
7433
|
+
}
|
|
7434
|
+
if (leaf instanceof z15.ZodArray && leaf.element instanceof z15.ZodEnum) {
|
|
7435
|
+
return { ...common, kind: "list", choices: Object.values(leaf.element.enum).map(String) };
|
|
7436
|
+
}
|
|
7437
|
+
throw new TypeError(`statusline setting ${path43.join(".")} has a kind the key listing does not describe`);
|
|
7438
|
+
}
|
|
7439
|
+
function walk(shape, prefix) {
|
|
7440
|
+
return Object.entries(shape).flatMap(([name, schema]) => schema instanceof z15.ZodObject ? walk(schema.shape, [...prefix, name]) : [keyOf([...prefix, name], schema)]);
|
|
7441
|
+
}
|
|
7442
|
+
function statuslineKeys() {
|
|
7443
|
+
return walk(ResolvedStatuslineSchema.shape, []);
|
|
7444
|
+
}
|
|
7445
|
+
var init_keys = __esm({
|
|
7446
|
+
"src/statusline/keys.ts"() {
|
|
7447
|
+
"use strict";
|
|
7448
|
+
init_statusline();
|
|
7449
|
+
}
|
|
7450
|
+
});
|
|
7451
|
+
|
|
7452
|
+
// src/statusline/change.ts
|
|
7453
|
+
function keyNamed(path43) {
|
|
7454
|
+
const found = statuslineKeys().find((key) => key.path === path43);
|
|
7455
|
+
if (found === void 0) {
|
|
7456
|
+
throw new UsageError(`"${path43}" is not a statusline setting; \`agent-shim statusline keys\` lists them.`);
|
|
7457
|
+
}
|
|
7458
|
+
return found;
|
|
7459
|
+
}
|
|
7460
|
+
function setAt(target, path43, value) {
|
|
7461
|
+
const [head, ...rest] = path43;
|
|
7462
|
+
if (head === void 0) {
|
|
7463
|
+
return;
|
|
7464
|
+
}
|
|
7465
|
+
if (rest.length === 0) {
|
|
7466
|
+
target[head] = value;
|
|
7467
|
+
return;
|
|
7468
|
+
}
|
|
7469
|
+
const child = target[head];
|
|
7470
|
+
const next = isPlainObject(child) ? child : {};
|
|
7471
|
+
target[head] = next;
|
|
7472
|
+
setAt(next, rest, value);
|
|
7473
|
+
}
|
|
7474
|
+
function removeAt(target, path43) {
|
|
7475
|
+
const [head, ...rest] = path43;
|
|
7476
|
+
if (head === void 0) {
|
|
7477
|
+
return;
|
|
7478
|
+
}
|
|
7479
|
+
const child = target[head];
|
|
7480
|
+
if (rest.length === 0) {
|
|
7481
|
+
Reflect.deleteProperty(target, head);
|
|
7482
|
+
return;
|
|
7483
|
+
}
|
|
7484
|
+
if (isPlainObject(child)) {
|
|
7485
|
+
removeAt(child, rest);
|
|
7486
|
+
if (Object.keys(child).length === 0) {
|
|
7487
|
+
Reflect.deleteProperty(target, head);
|
|
7488
|
+
}
|
|
7489
|
+
}
|
|
7490
|
+
}
|
|
7491
|
+
function applyStatuslineChange(existing, change) {
|
|
7492
|
+
const draft = structuredClone(existing ?? {});
|
|
7493
|
+
for (const [path43, value] of Object.entries(change.set ?? {})) {
|
|
7494
|
+
keyNamed(path43);
|
|
7495
|
+
setAt(draft, path43.split("."), value);
|
|
7496
|
+
}
|
|
7497
|
+
for (const path43 of change.unset ?? []) {
|
|
7498
|
+
keyNamed(path43);
|
|
7499
|
+
removeAt(draft, path43.split("."));
|
|
7500
|
+
}
|
|
7501
|
+
const result = StatuslineSchema.safeParse(draft);
|
|
7502
|
+
if (!result.success) {
|
|
7503
|
+
throw new UsageError(`statusline: ${result.error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`).join("; ")}.`);
|
|
7504
|
+
}
|
|
7505
|
+
return Object.keys(result.data).length === 0 ? void 0 : result.data;
|
|
7506
|
+
}
|
|
7507
|
+
var init_change = __esm({
|
|
7508
|
+
"src/statusline/change.ts"() {
|
|
7509
|
+
"use strict";
|
|
7510
|
+
init_cliError();
|
|
7511
|
+
init_statusline();
|
|
7512
|
+
init_keys();
|
|
7513
|
+
}
|
|
7514
|
+
});
|
|
7515
|
+
|
|
7396
7516
|
// src/configProfilesStore.ts
|
|
7397
7517
|
import fs4 from "node:fs";
|
|
7398
7518
|
import path22 from "node:path";
|
|
@@ -7494,17 +7614,6 @@ function removeProfile(paths, name) {
|
|
|
7494
7614
|
requireProfileExists(paths, name);
|
|
7495
7615
|
fs4.rmSync(profileJsonPath(paths, name));
|
|
7496
7616
|
}
|
|
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
7617
|
function applyProfileChange(paths, name, change) {
|
|
7509
7618
|
let touched = false;
|
|
7510
7619
|
if (change.category !== void 0) {
|
|
@@ -7554,7 +7663,7 @@ function applyProfileChange(paths, name, change) {
|
|
|
7554
7663
|
launchPatch.explain = change.launchExplain;
|
|
7555
7664
|
}
|
|
7556
7665
|
if (change.launchStatusline !== void 0) {
|
|
7557
|
-
launchPatch.statusline =
|
|
7666
|
+
launchPatch.statusline = applyStatuslineChange(readProfile(paths, name)?.launch?.statusline, change.launchStatusline);
|
|
7558
7667
|
}
|
|
7559
7668
|
if (Object.keys(launchPatch).length > 0) {
|
|
7560
7669
|
setProfileLaunchFlags(paths, name, launchPatch);
|
|
@@ -7569,7 +7678,7 @@ var init_configProfilesStore = __esm({
|
|
|
7569
7678
|
init_store();
|
|
7570
7679
|
init_schema();
|
|
7571
7680
|
init_cliError();
|
|
7572
|
-
|
|
7681
|
+
init_change();
|
|
7573
7682
|
init_load();
|
|
7574
7683
|
ProfileNotFoundError = class extends CliError {
|
|
7575
7684
|
constructor(profileName) {
|
|
@@ -7681,7 +7790,7 @@ var init_paths = __esm({
|
|
|
7681
7790
|
});
|
|
7682
7791
|
|
|
7683
7792
|
// src/credentialCache.ts
|
|
7684
|
-
import { z as
|
|
7793
|
+
import { z as z16 } from "zod";
|
|
7685
7794
|
function effectiveStore(cache, platform) {
|
|
7686
7795
|
return cache.store ?? (platform === "darwin" ? "keychain" : "file");
|
|
7687
7796
|
}
|
|
@@ -7748,9 +7857,9 @@ var init_credentialCache = __esm({
|
|
|
7748
7857
|
init_schema();
|
|
7749
7858
|
init_preflight();
|
|
7750
7859
|
MS_PER_UNIT = { s: 1e3, m: 6e4, h: 36e5, d: 864e5 };
|
|
7751
|
-
CachedCredentialSchema =
|
|
7752
|
-
token:
|
|
7753
|
-
fetchedAt:
|
|
7860
|
+
CachedCredentialSchema = z16.strictObject({
|
|
7861
|
+
token: z16.string().min(1),
|
|
7862
|
+
fetchedAt: z16.number().int().nonnegative(),
|
|
7754
7863
|
source: CredentialSourceSchema
|
|
7755
7864
|
});
|
|
7756
7865
|
}
|
|
@@ -7842,7 +7951,7 @@ var init_realCredentialCache = __esm({
|
|
|
7842
7951
|
});
|
|
7843
7952
|
|
|
7844
7953
|
// src/providerAliases.ts
|
|
7845
|
-
import { z as
|
|
7954
|
+
import { z as z17 } from "zod";
|
|
7846
7955
|
function parseAliases(file, raw) {
|
|
7847
7956
|
const parsed = ProviderAliasesSchema.safeParse(raw);
|
|
7848
7957
|
if (!parsed.success) {
|
|
@@ -7881,7 +7990,7 @@ var init_providerAliases = __esm({
|
|
|
7881
7990
|
init_cliError();
|
|
7882
7991
|
init_load();
|
|
7883
7992
|
init_store();
|
|
7884
|
-
ProviderAliasesSchema =
|
|
7993
|
+
ProviderAliasesSchema = z17.record(z17.string().min(1), z17.string().min(1));
|
|
7885
7994
|
}
|
|
7886
7995
|
});
|
|
7887
7996
|
|
|
@@ -8898,7 +9007,7 @@ var init_commandDeps = __esm({
|
|
|
8898
9007
|
// src/claudeShim.ts
|
|
8899
9008
|
import fs8 from "node:fs";
|
|
8900
9009
|
import path28 from "node:path";
|
|
8901
|
-
import { z as
|
|
9010
|
+
import { z as z22 } from "zod";
|
|
8902
9011
|
function commandFilename(ownExecutablePath, commandName) {
|
|
8903
9012
|
return ownExecutablePath.toLowerCase().endsWith(".exe") ? `${commandName}.exe` : commandName;
|
|
8904
9013
|
}
|
|
@@ -8948,10 +9057,10 @@ var init_claudeShim = __esm({
|
|
|
8948
9057
|
init_store();
|
|
8949
9058
|
init_realPorts();
|
|
8950
9059
|
init_cliError();
|
|
8951
|
-
ClaudeShimStateSchema =
|
|
8952
|
-
targetPath:
|
|
8953
|
-
method:
|
|
8954
|
-
installedAtMs:
|
|
9060
|
+
ClaudeShimStateSchema = z22.strictObject({
|
|
9061
|
+
targetPath: z22.string().min(1),
|
|
9062
|
+
method: z22.enum(["hardlink", "copy"]),
|
|
9063
|
+
installedAtMs: z22.number()
|
|
8955
9064
|
});
|
|
8956
9065
|
nodeLinkFs = { link: fs8.linkSync, copyFile: fs8.copyFileSync, chmod: fs8.chmodSync };
|
|
8957
9066
|
}
|
|
@@ -8970,14 +9079,14 @@ function memberKindOf(ref, models) {
|
|
|
8970
9079
|
function expandMembers(name, models) {
|
|
8971
9080
|
const virtual = models?.virtual ?? {};
|
|
8972
9081
|
const expanded = [];
|
|
8973
|
-
const
|
|
9082
|
+
const walk2 = (current, chain) => {
|
|
8974
9083
|
const nested = virtual[current];
|
|
8975
9084
|
if (nested !== void 0) {
|
|
8976
9085
|
if (chain.includes(current)) {
|
|
8977
9086
|
throw new Error(`virtual model cycle: ${[...chain, current].join(" -> ")}`);
|
|
8978
9087
|
}
|
|
8979
9088
|
for (const member of nested.members) {
|
|
8980
|
-
|
|
9089
|
+
walk2(member, [...chain, current]);
|
|
8981
9090
|
}
|
|
8982
9091
|
return;
|
|
8983
9092
|
}
|
|
@@ -8990,7 +9099,7 @@ function expandMembers(name, models) {
|
|
|
8990
9099
|
throw new VirtualModelNotFoundError(name);
|
|
8991
9100
|
}
|
|
8992
9101
|
for (const member of top.members) {
|
|
8993
|
-
|
|
9102
|
+
walk2(member, [name]);
|
|
8994
9103
|
}
|
|
8995
9104
|
return expanded;
|
|
8996
9105
|
}
|
|
@@ -9047,62 +9156,62 @@ var init_signatures = __esm({
|
|
|
9047
9156
|
});
|
|
9048
9157
|
|
|
9049
9158
|
// src/codex/anthropic.ts
|
|
9050
|
-
import { z as
|
|
9159
|
+
import { z as z26 } from "zod";
|
|
9051
9160
|
var TextBlockSchema, Base64ImageSourceSchema, UrlImageSourceSchema, ImageBlockSchema, ToolUseBlockSchema, ToolResultContentBlockSchema, ToolResultBlockSchema, OtherBlockSchema, ContentBlockSchema, MessageSchema, ToolSchema, ToolChoiceSchema, SystemSchema, MessagesRequestSchema, CountTokensRequestSchema;
|
|
9052
9161
|
var init_anthropic = __esm({
|
|
9053
9162
|
"src/codex/anthropic.ts"() {
|
|
9054
9163
|
"use strict";
|
|
9055
|
-
TextBlockSchema =
|
|
9056
|
-
Base64ImageSourceSchema =
|
|
9057
|
-
UrlImageSourceSchema =
|
|
9058
|
-
ImageBlockSchema =
|
|
9059
|
-
type:
|
|
9060
|
-
source:
|
|
9164
|
+
TextBlockSchema = z26.looseObject({ type: z26.literal("text"), text: z26.string() });
|
|
9165
|
+
Base64ImageSourceSchema = z26.looseObject({ type: z26.literal("base64"), media_type: z26.string().min(1), data: z26.string() });
|
|
9166
|
+
UrlImageSourceSchema = z26.looseObject({ type: z26.literal("url"), url: z26.string().min(1) });
|
|
9167
|
+
ImageBlockSchema = z26.looseObject({
|
|
9168
|
+
type: z26.literal("image"),
|
|
9169
|
+
source: z26.union([Base64ImageSourceSchema, UrlImageSourceSchema])
|
|
9061
9170
|
});
|
|
9062
|
-
ToolUseBlockSchema =
|
|
9063
|
-
type:
|
|
9064
|
-
id:
|
|
9065
|
-
name:
|
|
9066
|
-
input:
|
|
9171
|
+
ToolUseBlockSchema = z26.looseObject({
|
|
9172
|
+
type: z26.literal("tool_use"),
|
|
9173
|
+
id: z26.string().min(1),
|
|
9174
|
+
name: z26.string().min(1),
|
|
9175
|
+
input: z26.unknown()
|
|
9067
9176
|
});
|
|
9068
|
-
ToolResultContentBlockSchema =
|
|
9069
|
-
ToolResultBlockSchema =
|
|
9070
|
-
type:
|
|
9071
|
-
tool_use_id:
|
|
9072
|
-
content:
|
|
9177
|
+
ToolResultContentBlockSchema = z26.union([TextBlockSchema, z26.looseObject({ type: z26.string() })]);
|
|
9178
|
+
ToolResultBlockSchema = z26.looseObject({
|
|
9179
|
+
type: z26.literal("tool_result"),
|
|
9180
|
+
tool_use_id: z26.string().min(1),
|
|
9181
|
+
content: z26.union([z26.string(), z26.array(ToolResultContentBlockSchema)]).optional()
|
|
9073
9182
|
});
|
|
9074
|
-
OtherBlockSchema =
|
|
9075
|
-
ContentBlockSchema =
|
|
9076
|
-
MessageSchema =
|
|
9077
|
-
role:
|
|
9078
|
-
content:
|
|
9183
|
+
OtherBlockSchema = z26.looseObject({ type: z26.string() });
|
|
9184
|
+
ContentBlockSchema = z26.union([TextBlockSchema, ImageBlockSchema, ToolUseBlockSchema, ToolResultBlockSchema, OtherBlockSchema]);
|
|
9185
|
+
MessageSchema = z26.looseObject({
|
|
9186
|
+
role: z26.enum(["user", "assistant", "system"]),
|
|
9187
|
+
content: z26.union([z26.string(), z26.array(ContentBlockSchema)])
|
|
9079
9188
|
});
|
|
9080
|
-
ToolSchema =
|
|
9081
|
-
name:
|
|
9082
|
-
description:
|
|
9083
|
-
input_schema:
|
|
9189
|
+
ToolSchema = z26.looseObject({
|
|
9190
|
+
name: z26.string().min(1),
|
|
9191
|
+
description: z26.string().optional(),
|
|
9192
|
+
input_schema: z26.record(z26.string(), z26.unknown()).optional()
|
|
9084
9193
|
});
|
|
9085
|
-
ToolChoiceSchema =
|
|
9086
|
-
|
|
9087
|
-
|
|
9194
|
+
ToolChoiceSchema = z26.union([
|
|
9195
|
+
z26.looseObject({ type: z26.enum(["auto", "none", "any"]) }),
|
|
9196
|
+
z26.looseObject({ type: z26.literal("tool"), name: z26.string().min(1) })
|
|
9088
9197
|
]);
|
|
9089
|
-
SystemSchema =
|
|
9090
|
-
MessagesRequestSchema =
|
|
9091
|
-
model:
|
|
9198
|
+
SystemSchema = z26.union([z26.string(), z26.array(z26.union([TextBlockSchema, OtherBlockSchema]))]);
|
|
9199
|
+
MessagesRequestSchema = z26.looseObject({
|
|
9200
|
+
model: z26.string().optional(),
|
|
9092
9201
|
system: SystemSchema.optional(),
|
|
9093
|
-
messages:
|
|
9094
|
-
tools:
|
|
9202
|
+
messages: z26.array(MessageSchema),
|
|
9203
|
+
tools: z26.array(ToolSchema).optional(),
|
|
9095
9204
|
tool_choice: ToolChoiceSchema.optional(),
|
|
9096
|
-
stream:
|
|
9205
|
+
stream: z26.boolean().optional(),
|
|
9097
9206
|
/** `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:
|
|
9207
|
+
metadata: z26.looseObject({ user_id: z26.string().optional() }).optional(),
|
|
9099
9208
|
/** Claude Code's effort setting. Any string is accepted; the translator honours only the levels the backend understands. */
|
|
9100
|
-
output_config:
|
|
9209
|
+
output_config: z26.looseObject({ effort: z26.string().optional() }).optional()
|
|
9101
9210
|
});
|
|
9102
|
-
CountTokensRequestSchema =
|
|
9103
|
-
system:
|
|
9104
|
-
messages:
|
|
9105
|
-
tools:
|
|
9211
|
+
CountTokensRequestSchema = z26.looseObject({
|
|
9212
|
+
system: z26.unknown().optional(),
|
|
9213
|
+
messages: z26.unknown().optional(),
|
|
9214
|
+
tools: z26.unknown().optional()
|
|
9106
9215
|
});
|
|
9107
9216
|
}
|
|
9108
9217
|
});
|
|
@@ -9187,7 +9296,7 @@ var init_translate2 = __esm({
|
|
|
9187
9296
|
// src/providerCatalogue.ts
|
|
9188
9297
|
import path30 from "node:path";
|
|
9189
9298
|
import picomatch4 from "picomatch";
|
|
9190
|
-
import { z as
|
|
9299
|
+
import { z as z27 } from "zod";
|
|
9191
9300
|
function catalogueCachePath(paths, name) {
|
|
9192
9301
|
return path30.join(paths.catalogueDir, `${name}.json`);
|
|
9193
9302
|
}
|
|
@@ -9222,8 +9331,8 @@ var init_providerCatalogue = __esm({
|
|
|
9222
9331
|
CATALOGUE_REQUEST_SECONDS = 10;
|
|
9223
9332
|
CATALOGUE_REQUEST_TIMEOUT_MS = CATALOGUE_REQUEST_SECONDS * MS_PER_SECOND5;
|
|
9224
9333
|
CATALOGUE_REFRESH_TIMEOUT_MS = DEFAULT_CANDIDATE_URLS * CATALOGUE_REQUEST_TIMEOUT_MS;
|
|
9225
|
-
CatalogueModelSchema =
|
|
9226
|
-
CatalogueCacheSchema =
|
|
9334
|
+
CatalogueModelSchema = z27.strictObject({ id: z27.string().min(1), name: z27.string().min(1).optional() });
|
|
9335
|
+
CatalogueCacheSchema = z27.strictObject({ fetchedAt: z27.number(), url: z27.string().min(1), models: z27.array(CatalogueModelSchema) });
|
|
9227
9336
|
}
|
|
9228
9337
|
});
|
|
9229
9338
|
|
|
@@ -11583,7 +11692,7 @@ function isAnthropicUsageStale(member, nowMs) {
|
|
|
11583
11692
|
function poolIdentityNames(pools, poolName) {
|
|
11584
11693
|
const seenPools = /* @__PURE__ */ new Set();
|
|
11585
11694
|
const identities = /* @__PURE__ */ new Set();
|
|
11586
|
-
const
|
|
11695
|
+
const walk2 = (name) => {
|
|
11587
11696
|
const pool = pools[name];
|
|
11588
11697
|
if (pool === void 0 || seenPools.has(name)) {
|
|
11589
11698
|
return;
|
|
@@ -11595,11 +11704,11 @@ function poolIdentityNames(pools, poolName) {
|
|
|
11595
11704
|
if (nested === void 0) {
|
|
11596
11705
|
identities.add(member);
|
|
11597
11706
|
} else {
|
|
11598
|
-
|
|
11707
|
+
walk2(nested);
|
|
11599
11708
|
}
|
|
11600
11709
|
}
|
|
11601
11710
|
};
|
|
11602
|
-
|
|
11711
|
+
walk2(poolName);
|
|
11603
11712
|
return [...identities];
|
|
11604
11713
|
}
|
|
11605
11714
|
function describeError(error) {
|
|
@@ -11718,7 +11827,7 @@ var init_identityClaude = __esm({
|
|
|
11718
11827
|
});
|
|
11719
11828
|
|
|
11720
11829
|
// src/usage/providerQuota.ts
|
|
11721
|
-
import { z as
|
|
11830
|
+
import { z as z34 } from "zod";
|
|
11722
11831
|
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
11832
|
var init_providerQuota = __esm({
|
|
11724
11833
|
"src/usage/providerQuota.ts"() {
|
|
@@ -11737,35 +11846,35 @@ var init_providerQuota = __esm({
|
|
|
11737
11846
|
[ZAI_UNIT_HOURS, SECONDS_PER_HOUR3 * MS_PER_SECOND9],
|
|
11738
11847
|
[ZAI_UNIT_MONTHS, DAYS_PER_MONTH * HOURS_PER_DAY6 * SECONDS_PER_HOUR3 * MS_PER_SECOND9]
|
|
11739
11848
|
]);
|
|
11740
|
-
ZaiLimitSchema =
|
|
11741
|
-
type:
|
|
11742
|
-
unit:
|
|
11743
|
-
number:
|
|
11744
|
-
percentage:
|
|
11745
|
-
nextResetTime:
|
|
11746
|
-
usage:
|
|
11747
|
-
currentValue:
|
|
11748
|
-
remaining:
|
|
11849
|
+
ZaiLimitSchema = z34.object({
|
|
11850
|
+
type: z34.string(),
|
|
11851
|
+
unit: z34.number().int(),
|
|
11852
|
+
number: z34.number().int().positive(),
|
|
11853
|
+
percentage: z34.number().nonnegative(),
|
|
11854
|
+
nextResetTime: z34.number().positive().optional(),
|
|
11855
|
+
usage: z34.number().nonnegative().optional(),
|
|
11856
|
+
currentValue: z34.number().nonnegative().optional(),
|
|
11857
|
+
remaining: z34.number().nonnegative().optional()
|
|
11749
11858
|
});
|
|
11750
|
-
ZaiResponseSchema =
|
|
11751
|
-
success:
|
|
11752
|
-
msg:
|
|
11753
|
-
data:
|
|
11859
|
+
ZaiResponseSchema = z34.object({
|
|
11860
|
+
success: z34.boolean(),
|
|
11861
|
+
msg: z34.string().optional(),
|
|
11862
|
+
data: z34.object({ level: z34.string().optional(), limits: z34.array(ZaiLimitSchema) })
|
|
11754
11863
|
});
|
|
11755
11864
|
OPENROUTER_HOST = "openrouter.ai";
|
|
11756
11865
|
OPENROUTER_KEY_URL = `https://${OPENROUTER_HOST}/api/v1/key`;
|
|
11757
11866
|
OPENROUTER_CREDITS_URL = `https://${OPENROUTER_HOST}/api/v1/credits`;
|
|
11758
11867
|
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:
|
|
11868
|
+
OpenRouterKeySchema = z34.object({
|
|
11869
|
+
data: z34.object({
|
|
11870
|
+
limit: z34.number().nonnegative().nullable(),
|
|
11871
|
+
limit_remaining: z34.number().nullable(),
|
|
11872
|
+
limit_reset: z34.string().nullable(),
|
|
11873
|
+
is_free_tier: z34.boolean().optional(),
|
|
11874
|
+
free_model_daily_requests: z34.object({ used: z34.number().nonnegative(), limit: z34.number().nonnegative(), remaining: z34.number() }).optional()
|
|
11766
11875
|
})
|
|
11767
11876
|
});
|
|
11768
|
-
OpenRouterCreditsSchema =
|
|
11877
|
+
OpenRouterCreditsSchema = z34.object({ data: z34.object({ total_credits: z34.number().nonnegative(), total_usage: z34.number().nonnegative() }) });
|
|
11769
11878
|
ANTIGRAVITY_HOST = "daily-cloudcode-pa.googleapis.com";
|
|
11770
11879
|
ANTIGRAVITY_QUOTA_URL = `https://${ANTIGRAVITY_HOST}/v1internal:retrieveUserQuotaSummary`;
|
|
11771
11880
|
ANTIGRAVITY_USER_URL = `https://${ANTIGRAVITY_HOST}/v1internal:loadCodeAssist`;
|
|
@@ -11773,21 +11882,21 @@ var init_providerQuota = __esm({
|
|
|
11773
11882
|
DAYS_PER_WEEK2 = 7;
|
|
11774
11883
|
FIVE_HOURS_MS = FIVE_HOURS2 * SECONDS_PER_HOUR3 * MS_PER_SECOND9;
|
|
11775
11884
|
WEEK_MS = DAYS_PER_WEEK2 * HOURS_PER_DAY6 * SECONDS_PER_HOUR3 * MS_PER_SECOND9;
|
|
11776
|
-
AntigravityBucketSchema =
|
|
11777
|
-
bucketId:
|
|
11778
|
-
remainingFraction:
|
|
11779
|
-
resetTime:
|
|
11885
|
+
AntigravityBucketSchema = z34.object({
|
|
11886
|
+
bucketId: z34.string(),
|
|
11887
|
+
remainingFraction: z34.number().optional(),
|
|
11888
|
+
resetTime: z34.string().optional()
|
|
11780
11889
|
});
|
|
11781
|
-
AntigravitySummarySchema =
|
|
11782
|
-
GoogleTokenInfoSchema =
|
|
11783
|
-
email:
|
|
11784
|
-
sub:
|
|
11890
|
+
AntigravitySummarySchema = z34.object({ groups: z34.array(z34.object({ buckets: z34.array(AntigravityBucketSchema) })) });
|
|
11891
|
+
GoogleTokenInfoSchema = z34.object({
|
|
11892
|
+
email: z34.string().optional(),
|
|
11893
|
+
sub: z34.string().optional()
|
|
11785
11894
|
});
|
|
11786
|
-
AntigravityUserSchema =
|
|
11895
|
+
AntigravityUserSchema = z34.object({
|
|
11787
11896
|
/** The code-assist tier context, which defaults to the free tier for every account. */
|
|
11788
|
-
currentTier:
|
|
11897
|
+
currentTier: z34.object({ name: z34.string().optional(), id: z34.string().optional() }).optional(),
|
|
11789
11898
|
/** The account's paid subscription; absent when the account has none. */
|
|
11790
|
-
paidTier:
|
|
11899
|
+
paidTier: z34.object({ name: z34.string().optional(), id: z34.string().optional() }).optional()
|
|
11791
11900
|
});
|
|
11792
11901
|
}
|
|
11793
11902
|
});
|
|
@@ -14686,7 +14795,7 @@ function writePools(paths, pools) {
|
|
|
14686
14795
|
applyPatch(paths.globalConfigFile, GlobalConfigSchema, { pools }, { defaults: {} });
|
|
14687
14796
|
}
|
|
14688
14797
|
function poolCycleOf(pools, name) {
|
|
14689
|
-
const
|
|
14798
|
+
const walk2 = (current, path43) => {
|
|
14690
14799
|
for (const entry of pools[current]?.identities ?? []) {
|
|
14691
14800
|
const nested = poolNameOf(poolMemberIdentity(entry));
|
|
14692
14801
|
if (nested === void 0) {
|
|
@@ -14698,14 +14807,14 @@ function poolCycleOf(pools, name) {
|
|
|
14698
14807
|
if (path43.includes(nested)) {
|
|
14699
14808
|
continue;
|
|
14700
14809
|
}
|
|
14701
|
-
const found =
|
|
14810
|
+
const found = walk2(nested, [...path43, nested]);
|
|
14702
14811
|
if (found !== void 0) {
|
|
14703
14812
|
return found;
|
|
14704
14813
|
}
|
|
14705
14814
|
}
|
|
14706
14815
|
return void 0;
|
|
14707
14816
|
};
|
|
14708
|
-
return
|
|
14817
|
+
return walk2(name, [name]);
|
|
14709
14818
|
}
|
|
14710
14819
|
function validateMembers(pools, name, members) {
|
|
14711
14820
|
for (const entry of members) {
|
|
@@ -14834,7 +14943,7 @@ init_providersStore();
|
|
|
14834
14943
|
init_projects();
|
|
14835
14944
|
init_pipeline();
|
|
14836
14945
|
import path27 from "node:path";
|
|
14837
|
-
import { z as
|
|
14946
|
+
import { z as z18 } from "zod";
|
|
14838
14947
|
var HISTORY_PROJECTS_KEY_PREFIX = "history/projects/";
|
|
14839
14948
|
function projectFragmentOf(rawKey) {
|
|
14840
14949
|
return rawKey.startsWith(HISTORY_PROJECTS_KEY_PREFIX) ? rawKey.slice(HISTORY_PROJECTS_KEY_PREFIX.length) : void 0;
|
|
@@ -14903,9 +15012,9 @@ function lookupKeychainService(run, farmRoot) {
|
|
|
14903
15012
|
}
|
|
14904
15013
|
return { checked: true, found: true, serviceName, note: `Keychain service name for this identity: "${serviceName}".` };
|
|
14905
15014
|
}
|
|
14906
|
-
var SettingsSecretsShapeSchema =
|
|
14907
|
-
env:
|
|
14908
|
-
hooks:
|
|
15015
|
+
var SettingsSecretsShapeSchema = z18.looseObject({
|
|
15016
|
+
env: z18.record(z18.string(), z18.unknown()).optional(),
|
|
15017
|
+
hooks: z18.record(z18.string(), z18.array(z18.unknown())).optional()
|
|
14909
15018
|
});
|
|
14910
15019
|
function hookCommandCountOf(group) {
|
|
14911
15020
|
if (typeof group !== "object" || group === null) {
|
|
@@ -15202,7 +15311,7 @@ init_schema();
|
|
|
15202
15311
|
init_claudeVersion();
|
|
15203
15312
|
init_identity();
|
|
15204
15313
|
init_projects();
|
|
15205
|
-
import { z as
|
|
15314
|
+
import { z as z20 } from "zod";
|
|
15206
15315
|
|
|
15207
15316
|
// src/resolve/types.ts
|
|
15208
15317
|
var LAYER_KINDS = [
|
|
@@ -15263,123 +15372,123 @@ var DIAGNOSTIC_SEVERITIES = ["error", "warning", "info"];
|
|
|
15263
15372
|
|
|
15264
15373
|
// src/usage/pickReportSchema.ts
|
|
15265
15374
|
init_plan2();
|
|
15266
|
-
import { z as
|
|
15267
|
-
var PoolPickCandidateViewSchema =
|
|
15268
|
-
identity:
|
|
15375
|
+
import { z as z19 } from "zod";
|
|
15376
|
+
var PoolPickCandidateViewSchema = z19.strictObject({
|
|
15377
|
+
identity: z19.string(),
|
|
15269
15378
|
/** In pick order: `scored` has usable quota data, `unknown` has none, `pay-per-use` bills by use, `ineligible` is refused right now. */
|
|
15270
|
-
class:
|
|
15379
|
+
class: z19.enum(["scored", "unknown", "pay-per-use", "ineligible"]),
|
|
15271
15380
|
/** Plan-size-weighted remaining quota per hour until its reset; present for `scored` only. */
|
|
15272
|
-
score:
|
|
15381
|
+
score: z19.number().optional(),
|
|
15273
15382
|
/** 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:
|
|
15383
|
+
scoreWindow: z19.enum(["sevenDay", "fiveHour"]).optional(),
|
|
15275
15384
|
/** False when the five-hour window would run dry, at the observed pace, before it resets. */
|
|
15276
|
-
feasible:
|
|
15385
|
+
feasible: z19.boolean(),
|
|
15277
15386
|
/** When an `ineligible` member can be used again, as an ISO instant. */
|
|
15278
|
-
blockedUntil:
|
|
15387
|
+
blockedUntil: z19.iso.datetime().optional(),
|
|
15279
15388
|
plan: PlanClassSchema,
|
|
15280
15389
|
/** The facts behind the class and score, in the order they matter. */
|
|
15281
|
-
reasons:
|
|
15390
|
+
reasons: z19.array(z19.string())
|
|
15282
15391
|
});
|
|
15283
|
-
var PoolPickReportSchema =
|
|
15284
|
-
pool:
|
|
15285
|
-
directory:
|
|
15392
|
+
var PoolPickReportSchema = z19.strictObject({
|
|
15393
|
+
pool: z19.string(),
|
|
15394
|
+
directory: z19.string(),
|
|
15286
15395
|
/** The member a launch would run as, absent when every member is refused. */
|
|
15287
|
-
pick:
|
|
15288
|
-
candidates:
|
|
15396
|
+
pick: z19.string().optional(),
|
|
15397
|
+
candidates: z19.array(PoolPickCandidateViewSchema),
|
|
15289
15398
|
/** Identity members anywhere in the pool's graph that do not exist; a launch skips them. */
|
|
15290
|
-
missing:
|
|
15399
|
+
missing: z19.array(z19.string()),
|
|
15291
15400
|
/** When nothing can be picked, the soonest any member returns. */
|
|
15292
|
-
earliestReturn:
|
|
15401
|
+
earliestReturn: z19.strictObject({ identity: z19.string(), at: z19.iso.datetime() }).optional(),
|
|
15293
15402
|
/** The member a resumed conversation started on but moved off, and why, when the ranking could not keep it. */
|
|
15294
|
-
movedOff:
|
|
15403
|
+
movedOff: z19.strictObject({ identity: z19.string(), reason: z19.string() }).optional(),
|
|
15295
15404
|
/** Why the last-pick record could not be read, when that is the case. */
|
|
15296
|
-
stickyProblem:
|
|
15405
|
+
stickyProblem: z19.string().optional()
|
|
15297
15406
|
});
|
|
15298
15407
|
|
|
15299
15408
|
// src/checkReportSchema.ts
|
|
15300
15409
|
var CHECK_CREDENTIAL_APPLIES = ["provider", "identity", "stored-login"];
|
|
15301
|
-
var CheckLayerViewSchema =
|
|
15302
|
-
id:
|
|
15303
|
-
kind:
|
|
15304
|
-
source:
|
|
15410
|
+
var CheckLayerViewSchema = z20.strictObject({
|
|
15411
|
+
id: z20.int(),
|
|
15412
|
+
kind: z20.enum(LAYER_KINDS),
|
|
15413
|
+
source: z20.string()
|
|
15305
15414
|
});
|
|
15306
|
-
var CheckEntryViewSchema =
|
|
15307
|
-
path:
|
|
15308
|
-
shared:
|
|
15309
|
-
via:
|
|
15415
|
+
var CheckEntryViewSchema = z20.strictObject({
|
|
15416
|
+
path: z20.string(),
|
|
15417
|
+
shared: z20.boolean(),
|
|
15418
|
+
via: z20.enum(DECISION_VIAS),
|
|
15310
15419
|
/** The entry's real category, or null when nothing classifies it. */
|
|
15311
|
-
category:
|
|
15312
|
-
rule:
|
|
15420
|
+
category: z20.enum(CATEGORY_NAMES).nullable(),
|
|
15421
|
+
rule: z20.strictObject({ key: z20.string(), layer: z20.int() }).optional(),
|
|
15313
15422
|
/** Rules that matched but whose `when` condition failed, each with the conditions that failed. */
|
|
15314
|
-
eliminated:
|
|
15423
|
+
eliminated: z20.readonly(z20.array(z20.strictObject({ key: z20.string(), failed: z20.readonly(z20.array(z20.string())) }))).optional()
|
|
15315
15424
|
});
|
|
15316
|
-
var CheckDiagnosticSchema =
|
|
15317
|
-
code:
|
|
15318
|
-
severity:
|
|
15319
|
-
message:
|
|
15320
|
-
subject:
|
|
15321
|
-
layer:
|
|
15425
|
+
var CheckDiagnosticSchema = z20.strictObject({
|
|
15426
|
+
code: z20.enum(DIAGNOSTIC_CODES),
|
|
15427
|
+
severity: z20.enum(DIAGNOSTIC_SEVERITIES),
|
|
15428
|
+
message: z20.string(),
|
|
15429
|
+
subject: z20.string().optional(),
|
|
15430
|
+
layer: z20.int().optional()
|
|
15322
15431
|
});
|
|
15323
|
-
var CheckAmbientCredentialSchema =
|
|
15324
|
-
var CheckKeychainSchema =
|
|
15325
|
-
checked:
|
|
15326
|
-
found:
|
|
15327
|
-
serviceName:
|
|
15328
|
-
note:
|
|
15432
|
+
var CheckAmbientCredentialSchema = z20.union([z20.strictObject({ ok: z20.literal(true) }), z20.strictObject({ ok: z20.literal(false), variable: z20.string(), message: z20.string() })]);
|
|
15433
|
+
var CheckKeychainSchema = z20.strictObject({
|
|
15434
|
+
checked: z20.literal(true),
|
|
15435
|
+
found: z20.boolean(),
|
|
15436
|
+
serviceName: z20.string().optional(),
|
|
15437
|
+
note: z20.string()
|
|
15329
15438
|
});
|
|
15330
|
-
var CheckSettingsExposureSchema =
|
|
15331
|
-
file:
|
|
15332
|
-
envKeyNames:
|
|
15333
|
-
hookEventNames:
|
|
15334
|
-
hookCommandCount:
|
|
15439
|
+
var CheckSettingsExposureSchema = z20.strictObject({
|
|
15440
|
+
file: z20.string(),
|
|
15441
|
+
envKeyNames: z20.readonly(z20.array(z20.string())),
|
|
15442
|
+
hookEventNames: z20.readonly(z20.array(z20.string())),
|
|
15443
|
+
hookCommandCount: z20.int().nonnegative()
|
|
15335
15444
|
});
|
|
15336
|
-
var CredentialSourceSummarySchema =
|
|
15337
|
-
|
|
15338
|
-
|
|
15339
|
-
|
|
15340
|
-
|
|
15341
|
-
|
|
15342
|
-
|
|
15445
|
+
var CredentialSourceSummarySchema = z20.union([
|
|
15446
|
+
z20.strictObject({ kind: z20.literal("env"), variable: z20.string() }),
|
|
15447
|
+
z20.strictObject({ kind: z20.literal("file"), path: z20.string() }),
|
|
15448
|
+
z20.strictObject({ kind: z20.literal("command"), program: z20.string() }),
|
|
15449
|
+
z20.strictObject({ kind: z20.literal("op"), reference: z20.string() }),
|
|
15450
|
+
z20.strictObject({ kind: z20.literal("keychain"), service: z20.string(), account: z20.string().optional() }),
|
|
15451
|
+
z20.strictObject({ kind: z20.literal("literal") })
|
|
15343
15452
|
]);
|
|
15344
|
-
var CredentialSummarySchema =
|
|
15345
|
-
target:
|
|
15346
|
-
sources:
|
|
15453
|
+
var CredentialSummarySchema = z20.strictObject({
|
|
15454
|
+
target: z20.enum(CREDENTIAL_TARGETS),
|
|
15455
|
+
sources: z20.readonly(z20.array(CredentialSourceSummarySchema)),
|
|
15347
15456
|
cache: CredentialCacheSchema.optional()
|
|
15348
15457
|
});
|
|
15349
|
-
var CachedCredentialStateSchema =
|
|
15350
|
-
|
|
15351
|
-
|
|
15352
|
-
|
|
15458
|
+
var CachedCredentialStateSchema = z20.union([
|
|
15459
|
+
z20.strictObject({ store: z20.enum(CREDENTIAL_CACHE_STORES), status: z20.literal("empty") }),
|
|
15460
|
+
z20.strictObject({ store: z20.enum(CREDENTIAL_CACHE_STORES), status: z20.literal("unreadable"), reason: z20.string() }),
|
|
15461
|
+
z20.strictObject({ store: z20.enum(CREDENTIAL_CACHE_STORES), status: z20.enum(["fresh", "expired"]), ageMs: z20.number(), expiresInMs: z20.number().optional() })
|
|
15353
15462
|
]);
|
|
15354
|
-
var CheckCredentialProviderSchema =
|
|
15355
|
-
|
|
15356
|
-
|
|
15463
|
+
var CheckCredentialProviderSchema = z20.union([
|
|
15464
|
+
z20.strictObject({ name: z20.string(), credential: CredentialSummarySchema.optional(), cached: CachedCredentialStateSchema.optional() }),
|
|
15465
|
+
z20.strictObject({ name: z20.string(), problem: z20.string() })
|
|
15357
15466
|
]);
|
|
15358
|
-
var CheckCredentialSchema =
|
|
15359
|
-
applies:
|
|
15467
|
+
var CheckCredentialSchema = z20.strictObject({
|
|
15468
|
+
applies: z20.enum(CHECK_CREDENTIAL_APPLIES),
|
|
15360
15469
|
provider: CheckCredentialProviderSchema.optional(),
|
|
15361
15470
|
identity: CredentialSummarySchema.optional(),
|
|
15362
15471
|
identityCached: CachedCredentialStateSchema.optional()
|
|
15363
15472
|
});
|
|
15364
|
-
var CheckClaudeVersionSchema =
|
|
15365
|
-
pinned:
|
|
15366
|
-
highestInstalled:
|
|
15367
|
-
installed:
|
|
15473
|
+
var CheckClaudeVersionSchema = z20.strictObject({
|
|
15474
|
+
pinned: z20.strictObject({ version: z20.string(), source: z20.enum(CLAUDE_VERSION_SOURCES), installed: z20.boolean() }).optional(),
|
|
15475
|
+
highestInstalled: z20.string().optional(),
|
|
15476
|
+
installed: z20.readonly(z20.array(z20.string()))
|
|
15368
15477
|
});
|
|
15369
|
-
var CheckReportJsonSchema =
|
|
15370
|
-
identity:
|
|
15478
|
+
var CheckReportJsonSchema = z20.strictObject({
|
|
15479
|
+
identity: z20.strictObject({ name: z20.string().nullable(), source: z20.enum(IDENTITY_DECISION_SOURCES) }),
|
|
15371
15480
|
/** The pool ranking, when the launch named a pool instead of an identity. */
|
|
15372
15481
|
pool: PoolPickReportSchema.optional(),
|
|
15373
|
-
configProfile:
|
|
15374
|
-
layers:
|
|
15375
|
-
entries:
|
|
15376
|
-
projectEncodingAmbiguities:
|
|
15377
|
-
|
|
15482
|
+
configProfile: z20.strictObject({ name: z20.string().nullable(), source: z20.enum(CONFIG_PROFILE_DECISION_SOURCES) }),
|
|
15483
|
+
layers: z20.readonly(z20.array(CheckLayerViewSchema)),
|
|
15484
|
+
entries: z20.readonly(z20.array(CheckEntryViewSchema)),
|
|
15485
|
+
projectEncodingAmbiguities: z20.readonly(
|
|
15486
|
+
z20.array(z20.strictObject({ fragment: z20.string(), encoded: z20.string(), reason: z20.enum(ENCODING_AMBIGUITY_REASONS), detail: z20.string() }))
|
|
15378
15487
|
),
|
|
15379
|
-
diagnostics:
|
|
15488
|
+
diagnostics: z20.readonly(z20.array(CheckDiagnosticSchema)),
|
|
15380
15489
|
ambientCredential: CheckAmbientCredentialSchema,
|
|
15381
15490
|
keychain: CheckKeychainSchema.optional(),
|
|
15382
|
-
settingsExposure:
|
|
15491
|
+
settingsExposure: z20.readonly(z20.array(CheckSettingsExposureSchema)),
|
|
15383
15492
|
credential: CheckCredentialSchema,
|
|
15384
15493
|
claudeVersion: CheckClaudeVersionSchema.optional()
|
|
15385
15494
|
});
|
|
@@ -15439,28 +15548,28 @@ function collectResets(snapshots, nowMs) {
|
|
|
15439
15548
|
}
|
|
15440
15549
|
|
|
15441
15550
|
// src/usage/resetsSchema.ts
|
|
15442
|
-
import { z as
|
|
15443
|
-
var ResetRowSchema =
|
|
15444
|
-
identity:
|
|
15445
|
-
provider:
|
|
15551
|
+
import { z as z21 } from "zod";
|
|
15552
|
+
var ResetRowSchema = z21.strictObject({
|
|
15553
|
+
identity: z21.string(),
|
|
15554
|
+
provider: z21.string(),
|
|
15446
15555
|
/** 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:
|
|
15556
|
+
window: z21.string(),
|
|
15448
15557
|
/** When the state the window comes from was observed, as an ISO instant. */
|
|
15449
|
-
observedAt:
|
|
15558
|
+
observedAt: z21.iso.datetime(),
|
|
15450
15559
|
/** When the window resets, as an ISO instant; absent when the upstream reported none. */
|
|
15451
|
-
resetsAt:
|
|
15560
|
+
resetsAt: z21.iso.datetime().optional(),
|
|
15452
15561
|
/** 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:
|
|
15562
|
+
reset: z21.boolean(),
|
|
15454
15563
|
/** The fraction used, as `effectiveWindow` reads it at the report's own clock. */
|
|
15455
|
-
utilization:
|
|
15564
|
+
utilization: z21.number().optional(),
|
|
15456
15565
|
/** The window's own status, for a window that has not reset yet. */
|
|
15457
|
-
status:
|
|
15566
|
+
status: z21.string().optional()
|
|
15458
15567
|
});
|
|
15459
|
-
var ResetScheduleSchema =
|
|
15568
|
+
var ResetScheduleSchema = z21.strictObject({ resets: z21.readonly(z21.array(ResetRowSchema)) });
|
|
15460
15569
|
|
|
15461
15570
|
// src/frontdoor/controlSchemas.ts
|
|
15462
15571
|
import path32 from "node:path";
|
|
15463
|
-
import { z as
|
|
15572
|
+
import { z as z28 } from "zod";
|
|
15464
15573
|
|
|
15465
15574
|
// src/doctorReport.ts
|
|
15466
15575
|
init_claudeShim();
|
|
@@ -15640,24 +15749,24 @@ import path31 from "node:path";
|
|
|
15640
15749
|
init_signIn();
|
|
15641
15750
|
|
|
15642
15751
|
// src/codex/siwcStore.ts
|
|
15643
|
-
import { z as
|
|
15752
|
+
import { z as z25 } from "zod";
|
|
15644
15753
|
|
|
15645
15754
|
// 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:
|
|
15755
|
+
import { z as z23 } from "zod";
|
|
15756
|
+
var AuthFileSchema = z23.looseObject({
|
|
15757
|
+
tokens: z23.looseObject({
|
|
15758
|
+
access_token: z23.string().optional(),
|
|
15759
|
+
refresh_token: z23.string().optional(),
|
|
15760
|
+
id_token: z23.string().optional(),
|
|
15761
|
+
account_id: z23.string().optional()
|
|
15653
15762
|
}).nullish(),
|
|
15654
|
-
last_refresh:
|
|
15763
|
+
last_refresh: z23.string().optional()
|
|
15655
15764
|
});
|
|
15656
|
-
var TokenGrantSchema =
|
|
15657
|
-
access_token:
|
|
15658
|
-
refresh_token:
|
|
15659
|
-
id_token:
|
|
15660
|
-
account_id:
|
|
15765
|
+
var TokenGrantSchema = z23.looseObject({
|
|
15766
|
+
access_token: z23.string().min(1).optional(),
|
|
15767
|
+
refresh_token: z23.string().min(1).optional(),
|
|
15768
|
+
id_token: z23.string().min(1).optional(),
|
|
15769
|
+
account_id: z23.string().min(1).optional()
|
|
15661
15770
|
});
|
|
15662
15771
|
var CodexAuthError = class extends Error {
|
|
15663
15772
|
constructor(message) {
|
|
@@ -15667,41 +15776,41 @@ var CodexAuthError = class extends Error {
|
|
|
15667
15776
|
};
|
|
15668
15777
|
|
|
15669
15778
|
// src/codex/siwc.ts
|
|
15670
|
-
import { z as
|
|
15779
|
+
import { z as z24 } from "zod";
|
|
15671
15780
|
var SIWC_RESOURCE = "https://api.openai.com/v1";
|
|
15672
15781
|
var SIWC_RESPONSES_URL = `${SIWC_RESOURCE}/responses`;
|
|
15673
15782
|
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:
|
|
15783
|
+
var TokenResponseSchema = z24.looseObject({
|
|
15784
|
+
access_token: z24.string().min(1),
|
|
15785
|
+
refresh_token: z24.string().min(1).optional(),
|
|
15786
|
+
id_token: z24.string().min(1).optional(),
|
|
15787
|
+
expires_in: z24.number().positive(),
|
|
15788
|
+
scope: z24.string().optional()
|
|
15680
15789
|
});
|
|
15681
|
-
var JwtHeaderSchema =
|
|
15682
|
-
var IdTokenClaimsSchema =
|
|
15683
|
-
iss:
|
|
15684
|
-
sub:
|
|
15685
|
-
aud:
|
|
15686
|
-
exp:
|
|
15687
|
-
nonce:
|
|
15688
|
-
email:
|
|
15790
|
+
var JwtHeaderSchema = z24.looseObject({ alg: z24.string(), kid: z24.string().optional() });
|
|
15791
|
+
var IdTokenClaimsSchema = z24.looseObject({
|
|
15792
|
+
iss: z24.string(),
|
|
15793
|
+
sub: z24.string().min(1),
|
|
15794
|
+
aud: z24.union([z24.string(), z24.array(z24.string())]),
|
|
15795
|
+
exp: z24.number(),
|
|
15796
|
+
nonce: z24.string().optional(),
|
|
15797
|
+
email: z24.string().optional()
|
|
15689
15798
|
});
|
|
15690
|
-
var JwksSchema =
|
|
15799
|
+
var JwksSchema = z24.object({ keys: z24.array(z24.looseObject({ kid: z24.string().optional(), kty: z24.string() })) });
|
|
15691
15800
|
|
|
15692
15801
|
// src/codex/siwcStore.ts
|
|
15693
|
-
var SiwcGrantSchema =
|
|
15694
|
-
clientId:
|
|
15695
|
-
sub:
|
|
15696
|
-
email:
|
|
15697
|
-
idToken:
|
|
15698
|
-
accessToken:
|
|
15699
|
-
refreshToken:
|
|
15700
|
-
scopes:
|
|
15802
|
+
var SiwcGrantSchema = z25.strictObject({
|
|
15803
|
+
clientId: z25.string().min(1),
|
|
15804
|
+
sub: z25.string().min(1),
|
|
15805
|
+
email: z25.string().optional(),
|
|
15806
|
+
idToken: z25.string().min(1),
|
|
15807
|
+
accessToken: z25.string().min(1),
|
|
15808
|
+
refreshToken: z25.string().min(1),
|
|
15809
|
+
scopes: z25.array(z25.string()).readonly(),
|
|
15701
15810
|
/** When the access token stops working, in milliseconds since the epoch. */
|
|
15702
|
-
expiresAt:
|
|
15811
|
+
expiresAt: z25.number()
|
|
15703
15812
|
});
|
|
15704
|
-
var SiwcFileSchema =
|
|
15813
|
+
var SiwcFileSchema = z25.strictObject({ registeredClientId: z25.string().min(1).optional(), grant: SiwcGrantSchema.optional() });
|
|
15705
15814
|
function parseSiwcFile(raw, filePath) {
|
|
15706
15815
|
let json;
|
|
15707
15816
|
try {
|
|
@@ -16665,92 +16774,92 @@ function collectDoctorReport(params) {
|
|
|
16665
16774
|
// src/frontdoor/controlSchemas.ts
|
|
16666
16775
|
init_schema2();
|
|
16667
16776
|
init_state();
|
|
16668
|
-
var UsageListOutputSchema =
|
|
16669
|
-
var UsageWindowsInputSchema =
|
|
16670
|
-
identity:
|
|
16671
|
-
provider:
|
|
16777
|
+
var UsageListOutputSchema = z28.strictObject({ snapshots: z28.readonly(z28.array(UsageSnapshotSchema)) });
|
|
16778
|
+
var UsageWindowsInputSchema = z28.strictObject({
|
|
16779
|
+
identity: z28.string().min(1),
|
|
16780
|
+
provider: z28.string().min(1).optional()
|
|
16672
16781
|
});
|
|
16673
|
-
var EffectiveWindowSchema =
|
|
16782
|
+
var EffectiveWindowSchema = z28.strictObject({
|
|
16674
16783
|
/** True when the window's reset time has passed, so the recorded observation describes a window that no longer exists. */
|
|
16675
|
-
reset:
|
|
16784
|
+
reset: z28.boolean(),
|
|
16676
16785
|
/** The fraction used: 0 for a reset window, otherwise what was last observed, absent when none was reported. */
|
|
16677
|
-
utilization:
|
|
16786
|
+
utilization: z28.number().optional(),
|
|
16678
16787
|
/** The reset instant, for a window that has not reset yet and reported one. */
|
|
16679
|
-
resetsAtMs:
|
|
16788
|
+
resetsAtMs: z28.number().optional(),
|
|
16680
16789
|
/** The window's own status, for a window that has not reset yet. */
|
|
16681
|
-
status:
|
|
16790
|
+
status: z28.string().optional()
|
|
16682
16791
|
});
|
|
16683
|
-
var UsageWindowsOutputSchema =
|
|
16684
|
-
identity:
|
|
16685
|
-
provider:
|
|
16792
|
+
var UsageWindowsOutputSchema = z28.strictObject({
|
|
16793
|
+
identity: z28.string(),
|
|
16794
|
+
provider: z28.string(),
|
|
16686
16795
|
/** When the rate-limit state the windows come from was observed. */
|
|
16687
|
-
observedAt:
|
|
16796
|
+
observedAt: z28.iso.datetime().optional(),
|
|
16688
16797
|
fiveHour: EffectiveWindowSchema.optional(),
|
|
16689
16798
|
sevenDay: EffectiveWindowSchema.optional()
|
|
16690
16799
|
});
|
|
16691
|
-
var UsageLiveOutputSchema =
|
|
16800
|
+
var UsageLiveOutputSchema = z28.strictObject({
|
|
16692
16801
|
/** 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
16802
|
latest: RcLiveRateLimitSchema.optional(),
|
|
16694
16803
|
/** One observation per session whose stream has filed a rate_limit_event this door generation. */
|
|
16695
|
-
sessions:
|
|
16804
|
+
sessions: z28.readonly(z28.array(RcLiveRateLimitSchema))
|
|
16696
16805
|
});
|
|
16697
|
-
var FrontDoorSessionStatusSchema =
|
|
16698
|
-
pid:
|
|
16699
|
-
startedAt:
|
|
16700
|
-
alive:
|
|
16806
|
+
var FrontDoorSessionStatusSchema = z28.strictObject({
|
|
16807
|
+
pid: z28.int().positive(),
|
|
16808
|
+
startedAt: z28.number(),
|
|
16809
|
+
alive: z28.boolean()
|
|
16701
16810
|
});
|
|
16702
|
-
var HeadroomSocketTargetSchema =
|
|
16703
|
-
var FrontDoorStatusOutputSchema =
|
|
16811
|
+
var HeadroomSocketTargetSchema = z28.union([z28.strictObject({ socketPath: z28.string() }), z28.strictObject({ refused: z28.string() })]);
|
|
16812
|
+
var FrontDoorStatusOutputSchema = z28.strictObject({
|
|
16704
16813
|
state: FrontDoorStateSchema,
|
|
16705
|
-
supervisorAlive:
|
|
16814
|
+
supervisorAlive: z28.boolean(),
|
|
16706
16815
|
/** 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:
|
|
16816
|
+
draining: z28.readonly(z28.array(z28.number().int().positive())),
|
|
16817
|
+
sessions: z28.readonly(z28.array(FrontDoorSessionStatusSchema)),
|
|
16709
16818
|
headroomSocket: HeadroomSocketTargetSchema.optional(),
|
|
16710
|
-
logPath:
|
|
16711
|
-
logExists:
|
|
16819
|
+
logPath: z28.string(),
|
|
16820
|
+
logExists: z28.boolean()
|
|
16712
16821
|
});
|
|
16713
|
-
var FrontDoorSessionsOutputSchema =
|
|
16714
|
-
var CheckRunInputSchema =
|
|
16715
|
-
path:
|
|
16716
|
-
identity:
|
|
16822
|
+
var FrontDoorSessionsOutputSchema = z28.strictObject({ sessions: z28.readonly(z28.array(FrontDoorSessionStatusSchema)) });
|
|
16823
|
+
var CheckRunInputSchema = z28.strictObject({
|
|
16824
|
+
path: z28.string().min(1),
|
|
16825
|
+
identity: z28.string().min(1).optional()
|
|
16717
16826
|
}).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:
|
|
16827
|
+
var PoolPickInputSchema = z28.strictObject({
|
|
16828
|
+
pool: z28.string().min(1),
|
|
16829
|
+
path: z28.string().min(1)
|
|
16721
16830
|
}).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:
|
|
16831
|
+
var DoctorFindingSchema = z28.strictObject({
|
|
16832
|
+
section: z28.enum(DOCTOR_SECTIONS),
|
|
16833
|
+
subject: z28.string().optional(),
|
|
16834
|
+
severity: z28.enum(DOCTOR_SEVERITIES),
|
|
16835
|
+
message: z28.string()
|
|
16727
16836
|
});
|
|
16728
|
-
var DoctorRunOutputSchema =
|
|
16837
|
+
var DoctorRunOutputSchema = z28.strictObject({
|
|
16729
16838
|
/** False exactly when any finding is a `fail`; a `warn` never fails the report on its own. */
|
|
16730
|
-
ok:
|
|
16731
|
-
findings:
|
|
16839
|
+
ok: z28.boolean(),
|
|
16840
|
+
findings: z28.readonly(z28.array(DoctorFindingSchema))
|
|
16732
16841
|
});
|
|
16733
|
-
var FrontDoorRestartOutputSchema =
|
|
16734
|
-
action:
|
|
16735
|
-
previousPid:
|
|
16842
|
+
var FrontDoorRestartOutputSchema = z28.strictObject({
|
|
16843
|
+
action: z28.literal("restarting"),
|
|
16844
|
+
previousPid: z28.int().positive()
|
|
16736
16845
|
});
|
|
16737
|
-
var UpdateCheckOutputSchema =
|
|
16738
|
-
current:
|
|
16739
|
-
latest:
|
|
16740
|
-
action:
|
|
16846
|
+
var UpdateCheckOutputSchema = z28.strictObject({
|
|
16847
|
+
current: z28.string(),
|
|
16848
|
+
latest: z28.string(),
|
|
16849
|
+
action: z28.enum(["current", "available", "updated"])
|
|
16741
16850
|
});
|
|
16742
|
-
var CodexSignInSchema =
|
|
16743
|
-
|
|
16744
|
-
|
|
16745
|
-
|
|
16851
|
+
var CodexSignInSchema = z28.discriminatedUnion("state", [
|
|
16852
|
+
z28.strictObject({ state: z28.literal("none") }),
|
|
16853
|
+
z28.strictObject({ state: z28.literal("signed-in"), email: z28.string().optional(), planScope: z28.boolean(), accessTokenExpiresAt: z28.number() }),
|
|
16854
|
+
z28.strictObject({ state: z28.literal("unreadable"), message: z28.string() })
|
|
16746
16855
|
]);
|
|
16747
|
-
var CodexStatusOutputSchema =
|
|
16856
|
+
var CodexStatusOutputSchema = z28.strictObject({
|
|
16748
16857
|
signIn: CodexSignInSchema,
|
|
16749
|
-
codexProviders:
|
|
16858
|
+
codexProviders: z28.readonly(z28.array(z28.string()))
|
|
16750
16859
|
});
|
|
16751
|
-
var CodexLogoutOutputSchema =
|
|
16752
|
-
hadGrant:
|
|
16753
|
-
revoked:
|
|
16860
|
+
var CodexLogoutOutputSchema = z28.strictObject({
|
|
16861
|
+
hadGrant: z28.boolean(),
|
|
16862
|
+
revoked: z28.boolean()
|
|
16754
16863
|
});
|
|
16755
16864
|
|
|
16756
16865
|
// src/frontdoor/codexApi.ts
|
|
@@ -16909,145 +17018,147 @@ init_providersStore();
|
|
|
16909
17018
|
|
|
16910
17019
|
// src/frontdoor/configSchemas.ts
|
|
16911
17020
|
init_schema();
|
|
16912
|
-
|
|
16913
|
-
|
|
16914
|
-
var
|
|
16915
|
-
|
|
16916
|
-
|
|
16917
|
-
|
|
16918
|
-
cache: z28.union([z28.literal(false), CredentialCacheSchema]).optional()
|
|
17021
|
+
import { z as z29 } from "zod";
|
|
17022
|
+
var RemovalConfirmationSchema = z29.boolean();
|
|
17023
|
+
var CredentialWriteSchema = (targets) => z29.strictObject({
|
|
17024
|
+
sources: z29.array(RemoteCredentialSourceSchema).min(1).optional(),
|
|
17025
|
+
target: z29.enum(targets).optional(),
|
|
17026
|
+
cache: z29.union([z29.literal(false), CredentialCacheSchema]).optional()
|
|
16919
17027
|
});
|
|
16920
|
-
var CredentialSummarySchema2 =
|
|
16921
|
-
target:
|
|
16922
|
-
sources:
|
|
16923
|
-
|
|
16924
|
-
|
|
16925
|
-
|
|
16926
|
-
|
|
16927
|
-
|
|
16928
|
-
|
|
16929
|
-
|
|
17028
|
+
var CredentialSummarySchema2 = z29.strictObject({
|
|
17029
|
+
target: z29.enum(CREDENTIAL_TARGETS),
|
|
17030
|
+
sources: z29.readonly(z29.array(
|
|
17031
|
+
z29.discriminatedUnion("kind", [
|
|
17032
|
+
z29.strictObject({ kind: z29.literal("env"), variable: z29.string() }),
|
|
17033
|
+
z29.strictObject({ kind: z29.literal("file"), path: z29.string() }),
|
|
17034
|
+
z29.strictObject({ kind: z29.literal("command"), program: z29.string() }),
|
|
17035
|
+
z29.strictObject({ kind: z29.literal("op"), reference: z29.string() }),
|
|
17036
|
+
z29.strictObject({ kind: z29.literal("keychain"), service: z29.string(), account: z29.string().optional() }),
|
|
17037
|
+
z29.strictObject({ kind: z29.literal("literal") })
|
|
16930
17038
|
])
|
|
16931
17039
|
)),
|
|
16932
17040
|
cache: CredentialCacheSchema.optional()
|
|
16933
17041
|
});
|
|
16934
|
-
var mutationOutput = (kind, action) =>
|
|
16935
|
-
var storedMutationOutput = (kind, action, value) =>
|
|
16936
|
-
var IdentityValueSchema =
|
|
16937
|
-
name:
|
|
16938
|
-
defaultConfigProfile:
|
|
16939
|
-
allowAmbientCredential:
|
|
17042
|
+
var mutationOutput = (kind, action) => z29.strictObject({ action: z29.literal(action), kind: z29.literal(kind), name: z29.string() });
|
|
17043
|
+
var storedMutationOutput = (kind, action, value) => z29.strictObject({ action: z29.literal(action), kind: z29.literal(kind), name: z29.string(), value });
|
|
17044
|
+
var IdentityValueSchema = z29.strictObject({
|
|
17045
|
+
name: z29.string(),
|
|
17046
|
+
defaultConfigProfile: z29.string().optional(),
|
|
17047
|
+
allowAmbientCredential: z29.boolean(),
|
|
16940
17048
|
credential: CredentialSummarySchema2.optional(),
|
|
16941
|
-
anchors:
|
|
17049
|
+
anchors: z29.array(AnchorSchema).optional()
|
|
16942
17050
|
});
|
|
16943
17051
|
var ProfileValueSchema = ConfigProfileSchema.omit({ $schema: true });
|
|
16944
|
-
var ProviderValueSchema =
|
|
16945
|
-
name:
|
|
16946
|
-
kind:
|
|
16947
|
-
displayName:
|
|
16948
|
-
baseUrl:
|
|
17052
|
+
var ProviderValueSchema = z29.strictObject({
|
|
17053
|
+
name: z29.string(),
|
|
17054
|
+
kind: z29.enum(PROVIDER_KINDS),
|
|
17055
|
+
displayName: z29.string(),
|
|
17056
|
+
baseUrl: z29.string().optional(),
|
|
16949
17057
|
codex: CodexProviderConfigSchema.optional(),
|
|
16950
17058
|
credential: CredentialSummarySchema2.optional(),
|
|
16951
|
-
env:
|
|
17059
|
+
env: z29.record(z29.string(), z29.string()).optional()
|
|
16952
17060
|
});
|
|
16953
|
-
var ConfigNameInputSchema =
|
|
17061
|
+
var ConfigNameInputSchema = z29.strictObject({ name: z29.string().min(1) });
|
|
16954
17062
|
var ConfigIdentityAddOutputSchema = storedMutationOutput("identity", "created", IdentityValueSchema);
|
|
16955
|
-
var ConfigIdentitySetInputSchema =
|
|
16956
|
-
name:
|
|
16957
|
-
defaultConfigProfile:
|
|
16958
|
-
allowAmbientCredential:
|
|
16959
|
-
credential:
|
|
17063
|
+
var ConfigIdentitySetInputSchema = z29.strictObject({
|
|
17064
|
+
name: z29.string().min(1),
|
|
17065
|
+
defaultConfigProfile: z29.union([z29.string().min(1), z29.literal(false)]).optional(),
|
|
17066
|
+
allowAmbientCredential: z29.boolean().optional(),
|
|
17067
|
+
credential: z29.union([z29.literal(false), CredentialWriteSchema(CREDENTIAL_TARGETS)]).optional(),
|
|
16960
17068
|
/** `false` removes the anchors; a list replaces them. */
|
|
16961
|
-
anchors:
|
|
17069
|
+
anchors: z29.union([z29.literal(false), z29.array(AnchorSchema).min(1)]).optional()
|
|
16962
17070
|
});
|
|
16963
17071
|
var ConfigIdentitySetOutputSchema = storedMutationOutput("identity", "updated", IdentityValueSchema);
|
|
16964
|
-
var ConfigIdentityRemoveInputSchema =
|
|
17072
|
+
var ConfigIdentityRemoveInputSchema = z29.strictObject({ name: z29.string().min(1), confirm: RemovalConfirmationSchema });
|
|
16965
17073
|
var ConfigIdentityRemoveOutputSchema = mutationOutput("identity", "removed");
|
|
16966
17074
|
var ConfigIdentityUseOutputSchema = mutationOutput("identity", "selected");
|
|
16967
|
-
var ConfigProfileAddInputSchema =
|
|
16968
|
-
name:
|
|
16969
|
-
extends:
|
|
16970
|
-
description:
|
|
17075
|
+
var ConfigProfileAddInputSchema = z29.strictObject({
|
|
17076
|
+
name: z29.string().min(1),
|
|
17077
|
+
extends: z29.array(z29.string().min(1)).optional(),
|
|
17078
|
+
description: z29.string().optional()
|
|
16971
17079
|
});
|
|
16972
17080
|
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:
|
|
17081
|
+
var ConfigProfileSetInputSchema = z29.strictObject({
|
|
17082
|
+
name: z29.string().min(1),
|
|
17083
|
+
category: z29.record(z29.string(), z29.boolean()).optional(),
|
|
17084
|
+
entry: z29.record(z29.string(), z29.boolean()).optional(),
|
|
17085
|
+
extends: z29.union([z29.array(z29.string().min(1)), z29.literal(false)]).optional(),
|
|
17086
|
+
description: z29.union([z29.string(), z29.literal(false)]).optional(),
|
|
17087
|
+
launch: z29.strictObject({
|
|
17088
|
+
skipPermissions: z29.boolean().optional(),
|
|
17089
|
+
remoteControl: z29.boolean().optional(),
|
|
17090
|
+
headroom: z29.boolean().optional(),
|
|
17091
|
+
trackUsage: z29.boolean().optional(),
|
|
17092
|
+
provider: z29.union([z29.string().min(1), z29.literal(false)]).optional(),
|
|
17093
|
+
claudeVersion: z29.union([z29.string().min(1), z29.literal(false)]).optional(),
|
|
17094
|
+
delay: z29.union([z29.string().regex(DURATION_RE), z29.literal(false)]).optional(),
|
|
17095
|
+
pause: z29.boolean().optional(),
|
|
17096
|
+
explain: z29.boolean().optional(),
|
|
17097
|
+
proxyBypass: z29.union([z29.array(z29.string().min(1)), z29.literal(false)]).optional(),
|
|
17098
|
+
statusline: z29.strictObject({
|
|
17099
|
+
set: z29.record(z29.string(), z29.unknown()).optional(),
|
|
17100
|
+
unset: z29.array(z29.string()).optional()
|
|
17101
|
+
}).optional()
|
|
16991
17102
|
}).optional()
|
|
16992
17103
|
});
|
|
16993
17104
|
var ConfigProfileSetOutputSchema = storedMutationOutput("profile", "updated", ProfileValueSchema);
|
|
16994
|
-
var ConfigProfileRemoveInputSchema =
|
|
17105
|
+
var ConfigProfileRemoveInputSchema = z29.strictObject({ name: z29.string().min(1), confirm: RemovalConfirmationSchema });
|
|
16995
17106
|
var ConfigProfileRemoveOutputSchema = mutationOutput("profile", "removed");
|
|
16996
17107
|
var ConfigProfileUseOutputSchema = mutationOutput("profile", "selected");
|
|
16997
|
-
var PoolMembersInputSchema =
|
|
16998
|
-
var ConfigPoolAddInputSchema =
|
|
16999
|
-
name:
|
|
17108
|
+
var PoolMembersInputSchema = z29.array(z29.string().min(1)).min(1);
|
|
17109
|
+
var ConfigPoolAddInputSchema = z29.strictObject({
|
|
17110
|
+
name: z29.string().min(1),
|
|
17000
17111
|
identities: PoolMembersInputSchema,
|
|
17001
|
-
preference:
|
|
17002
|
-
resumeOnLimit:
|
|
17003
|
-
compactBeforeLimit:
|
|
17112
|
+
preference: z29.enum(POOL_PREFERENCES).optional(),
|
|
17113
|
+
resumeOnLimit: z29.boolean().optional(),
|
|
17114
|
+
compactBeforeLimit: z29.boolean().optional(),
|
|
17004
17115
|
compactAtUtilisation: CompactAtUtilisationSchema.optional()
|
|
17005
17116
|
});
|
|
17006
17117
|
var ConfigPoolAddOutputSchema = storedMutationOutput("pool", "created", PoolSchema);
|
|
17007
|
-
var ConfigPoolSetInputSchema =
|
|
17008
|
-
name:
|
|
17118
|
+
var ConfigPoolSetInputSchema = z29.strictObject({
|
|
17119
|
+
name: z29.string().min(1),
|
|
17009
17120
|
identities: PoolMembersInputSchema.optional(),
|
|
17010
|
-
preference:
|
|
17011
|
-
resumeOnLimit:
|
|
17012
|
-
compactBeforeLimit:
|
|
17013
|
-
compactAtUtilisation:
|
|
17121
|
+
preference: z29.union([z29.enum(POOL_PREFERENCES), z29.literal(false)]).optional(),
|
|
17122
|
+
resumeOnLimit: z29.boolean().optional(),
|
|
17123
|
+
compactBeforeLimit: z29.boolean().optional(),
|
|
17124
|
+
compactAtUtilisation: z29.union([CompactAtUtilisationSchema, z29.literal(false)]).optional()
|
|
17014
17125
|
});
|
|
17015
17126
|
var ConfigPoolSetOutputSchema = storedMutationOutput("pool", "updated", PoolSchema);
|
|
17016
|
-
var ConfigPoolRemoveInputSchema =
|
|
17127
|
+
var ConfigPoolRemoveInputSchema = z29.strictObject({ name: z29.string().min(1), confirm: RemovalConfirmationSchema });
|
|
17017
17128
|
var ConfigPoolRemoveOutputSchema = mutationOutput("pool", "removed");
|
|
17018
17129
|
var ConfigPoolUseOutputSchema = mutationOutput("pool", "selected");
|
|
17019
|
-
var ConfigProviderAddInputSchema =
|
|
17020
|
-
name:
|
|
17021
|
-
kind:
|
|
17022
|
-
displayName:
|
|
17023
|
-
baseUrl:
|
|
17130
|
+
var ConfigProviderAddInputSchema = z29.strictObject({
|
|
17131
|
+
name: z29.string().min(1),
|
|
17132
|
+
kind: z29.enum(PROVIDER_KINDS).optional(),
|
|
17133
|
+
displayName: z29.string().min(1),
|
|
17134
|
+
baseUrl: z29.string().min(1).optional(),
|
|
17024
17135
|
credential: CredentialWriteSchema(PROVIDER_CREDENTIAL_TARGETS).required({ sources: true }),
|
|
17025
17136
|
codex: CodexProviderConfigSchema.optional()
|
|
17026
17137
|
});
|
|
17027
17138
|
var ConfigProviderAddOutputSchema = storedMutationOutput("provider", "created", ProviderValueSchema);
|
|
17028
|
-
var ConfigProviderSetInputSchema =
|
|
17029
|
-
name:
|
|
17030
|
-
displayName:
|
|
17031
|
-
baseUrl:
|
|
17139
|
+
var ConfigProviderSetInputSchema = z29.strictObject({
|
|
17140
|
+
name: z29.string().min(1),
|
|
17141
|
+
displayName: z29.string().min(1).optional(),
|
|
17142
|
+
baseUrl: z29.string().min(1).optional(),
|
|
17032
17143
|
credential: CredentialWriteSchema(PROVIDER_CREDENTIAL_TARGETS).optional(),
|
|
17033
17144
|
codex: CodexProviderConfigSchema.optional()
|
|
17034
17145
|
});
|
|
17035
17146
|
var ConfigProviderSetOutputSchema = storedMutationOutput("provider", "updated", ProviderValueSchema);
|
|
17036
|
-
var ConfigProviderRemoveInputSchema =
|
|
17147
|
+
var ConfigProviderRemoveInputSchema = z29.strictObject({ name: z29.string().min(1), confirm: RemovalConfirmationSchema });
|
|
17037
17148
|
var ConfigProviderRemoveOutputSchema = mutationOutput("provider", "removed");
|
|
17038
|
-
var ConfigRuleAddInputSchema =
|
|
17039
|
-
path:
|
|
17040
|
-
configProfile:
|
|
17041
|
-
identity:
|
|
17149
|
+
var ConfigRuleAddInputSchema = z29.strictObject({
|
|
17150
|
+
path: z29.string().min(1),
|
|
17151
|
+
configProfile: z29.string().min(1).optional(),
|
|
17152
|
+
identity: z29.string().min(1).optional()
|
|
17042
17153
|
});
|
|
17043
17154
|
var ConfigRuleAddOutputSchema = storedMutationOutput("rule", "created", DirectoryRuleSchema);
|
|
17044
|
-
var ConfigRuleSetInputSchema =
|
|
17045
|
-
path:
|
|
17046
|
-
configProfile:
|
|
17047
|
-
identity:
|
|
17155
|
+
var ConfigRuleSetInputSchema = z29.strictObject({
|
|
17156
|
+
path: z29.string().min(1),
|
|
17157
|
+
configProfile: z29.union([z29.string().min(1), z29.literal(false)]).optional(),
|
|
17158
|
+
identity: z29.union([z29.string().min(1), z29.literal(false)]).optional()
|
|
17048
17159
|
});
|
|
17049
17160
|
var ConfigRuleSetOutputSchema = storedMutationOutput("rule", "updated", DirectoryRuleSchema);
|
|
17050
|
-
var ConfigRuleRemoveInputSchema =
|
|
17161
|
+
var ConfigRuleRemoveInputSchema = z29.strictObject({ path: z29.string().min(1), confirm: RemovalConfirmationSchema });
|
|
17051
17162
|
var ConfigRuleRemoveOutputSchema = mutationOutput("rule", "removed");
|
|
17052
17163
|
|
|
17053
17164
|
// src/frontdoor/configApi.ts
|
|
@@ -17360,43 +17471,43 @@ import { openapi as openapi4 } from "@orpc/openapi";
|
|
|
17360
17471
|
import { eventIterator as eventIterator2, withEventMeta as withEventMeta2 } from "@orpc/server";
|
|
17361
17472
|
|
|
17362
17473
|
// src/frontdoor/eventSchemas.ts
|
|
17363
|
-
import { z as
|
|
17474
|
+
import { z as z30 } from "zod";
|
|
17364
17475
|
var DOOR_EVENT_SOURCE_RC = "rc";
|
|
17365
17476
|
var LAUNCH_EVENT_SOURCE = "launch";
|
|
17366
17477
|
var USAGE_EVENT_SOURCE = "usage";
|
|
17367
17478
|
var DOOR_HEALTH_EVENT_SOURCE = "door";
|
|
17368
17479
|
var QUOTA_EXPIRING_EVENT_SOURCE = "quota-expiring";
|
|
17369
|
-
var DoorEventSchema =
|
|
17370
|
-
source:
|
|
17480
|
+
var DoorEventSchema = z30.strictObject({
|
|
17481
|
+
source: z30.string().min(1),
|
|
17371
17482
|
/** A positive integer because the backbone's counters start at one and only ever increase. */
|
|
17372
|
-
sequence:
|
|
17373
|
-
payload:
|
|
17483
|
+
sequence: z30.number().int().positive(),
|
|
17484
|
+
payload: z30.unknown()
|
|
17374
17485
|
});
|
|
17375
|
-
var DoorEventSourceQuerySchema =
|
|
17376
|
-
sources:
|
|
17486
|
+
var DoorEventSourceQuerySchema = z30.strictObject({
|
|
17487
|
+
sources: z30.array(z30.string().min(1)).min(1).optional()
|
|
17377
17488
|
});
|
|
17378
|
-
var LaunchLifecycleEventSchema =
|
|
17379
|
-
kind:
|
|
17380
|
-
pid:
|
|
17381
|
-
startedAt:
|
|
17382
|
-
observedAt:
|
|
17489
|
+
var LaunchLifecycleEventSchema = z30.strictObject({
|
|
17490
|
+
kind: z30.enum(["registered", "pruned", "ended"]),
|
|
17491
|
+
pid: z30.number().int().positive(),
|
|
17492
|
+
startedAt: z30.number(),
|
|
17493
|
+
observedAt: z30.number()
|
|
17383
17494
|
});
|
|
17384
|
-
var DoorHealthEventSchema =
|
|
17385
|
-
|
|
17386
|
-
|
|
17387
|
-
|
|
17388
|
-
|
|
17389
|
-
|
|
17390
|
-
|
|
17495
|
+
var DoorHealthEventSchema = z30.discriminatedUnion("kind", [
|
|
17496
|
+
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() }),
|
|
17497
|
+
z30.strictObject({ kind: z30.literal("listenerFailed"), pid: z30.number().int().positive(), listener: z30.enum(["provider", "connect", "direct"]), message: z30.string(), observedAt: z30.number() }),
|
|
17498
|
+
z30.strictObject({ kind: z30.literal("binaryTurnover"), pid: z30.number().int().positive(), observedAt: z30.number() }),
|
|
17499
|
+
z30.strictObject({ kind: z30.literal("idleShutdown"), pid: z30.number().int().positive(), observedAt: z30.number() }),
|
|
17500
|
+
z30.strictObject({ kind: z30.literal("superseded"), pid: z30.number().int().positive(), ownerPid: z30.number().int().positive(), observedAt: z30.number() }),
|
|
17501
|
+
z30.strictObject({ kind: z30.literal("drained"), pid: z30.number().int().positive(), observedAt: z30.number() })
|
|
17391
17502
|
]);
|
|
17392
|
-
var QuotaExpiringEventSchema =
|
|
17393
|
-
identity:
|
|
17394
|
-
provider:
|
|
17395
|
-
window:
|
|
17503
|
+
var QuotaExpiringEventSchema = z30.strictObject({
|
|
17504
|
+
identity: z30.string().min(1),
|
|
17505
|
+
provider: z30.string().min(1),
|
|
17506
|
+
window: z30.enum(["fiveHour", "sevenDay"]),
|
|
17396
17507
|
/** 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:
|
|
17508
|
+
utilization: z30.number().min(0).max(1),
|
|
17509
|
+
resetsAt: z30.iso.datetime(),
|
|
17510
|
+
observedAt: z30.number()
|
|
17400
17511
|
});
|
|
17401
17512
|
|
|
17402
17513
|
// src/frontdoor/eventsApi.ts
|
|
@@ -17480,60 +17591,60 @@ import { openapi as openapi6 } from "@orpc/openapi";
|
|
|
17480
17591
|
|
|
17481
17592
|
// src/frontdoor/launchSchemas.ts
|
|
17482
17593
|
import path33 from "node:path";
|
|
17483
|
-
import { z as
|
|
17594
|
+
import { z as z31 } from "zod";
|
|
17484
17595
|
init_statusline();
|
|
17485
17596
|
init_claudeVersion();
|
|
17486
17597
|
init_identity();
|
|
17487
|
-
var LaunchResolveInputSchema =
|
|
17488
|
-
path:
|
|
17598
|
+
var LaunchResolveInputSchema = z31.strictObject({
|
|
17599
|
+
path: z31.string().min(1),
|
|
17489
17600
|
/** `@name`, launch flags, then the arguments for `claude`; empty for a bare launch. */
|
|
17490
|
-
argv:
|
|
17601
|
+
argv: z31.readonly(z31.array(z31.string())).optional(),
|
|
17491
17602
|
/** 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:
|
|
17603
|
+
env: z31.record(z31.string(), z31.string()).optional()
|
|
17493
17604
|
}).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:
|
|
17605
|
+
var LaunchPoolDecisionSchema = z31.strictObject({
|
|
17606
|
+
name: z31.string(),
|
|
17607
|
+
reasons: z31.readonly(z31.array(z31.string())),
|
|
17608
|
+
movedOff: z31.strictObject({ identity: z31.string(), reason: z31.string() }).optional()
|
|
17498
17609
|
});
|
|
17499
|
-
var LaunchDecisionSchema =
|
|
17500
|
-
identity:
|
|
17501
|
-
identitySource:
|
|
17610
|
+
var LaunchDecisionSchema = z31.strictObject({
|
|
17611
|
+
identity: z31.string().optional(),
|
|
17612
|
+
identitySource: z31.enum(IDENTITY_DECISION_SOURCES),
|
|
17502
17613
|
pool: LaunchPoolDecisionSchema.optional(),
|
|
17503
|
-
configDirEscapeHatch:
|
|
17504
|
-
configDir:
|
|
17505
|
-
configProfile:
|
|
17506
|
-
configProfileSource:
|
|
17507
|
-
provider:
|
|
17614
|
+
configDirEscapeHatch: z31.boolean(),
|
|
17615
|
+
configDir: z31.string().optional(),
|
|
17616
|
+
configProfile: z31.string().optional(),
|
|
17617
|
+
configProfileSource: z31.enum(CONFIG_PROFILE_DECISION_SOURCES),
|
|
17618
|
+
provider: z31.string().optional()
|
|
17508
17619
|
});
|
|
17509
|
-
var LaunchFlagsSchema =
|
|
17510
|
-
skipPermissions:
|
|
17511
|
-
remoteControl:
|
|
17512
|
-
headroom:
|
|
17513
|
-
trackUsage:
|
|
17514
|
-
pause:
|
|
17515
|
-
explain:
|
|
17620
|
+
var LaunchFlagsSchema = z31.strictObject({
|
|
17621
|
+
skipPermissions: z31.boolean(),
|
|
17622
|
+
remoteControl: z31.boolean(),
|
|
17623
|
+
headroom: z31.boolean(),
|
|
17624
|
+
trackUsage: z31.boolean(),
|
|
17625
|
+
pause: z31.boolean(),
|
|
17626
|
+
explain: z31.boolean(),
|
|
17516
17627
|
/** How long the launch waits after its own output before it starts claude, in milliseconds. */
|
|
17517
|
-
delayMs:
|
|
17628
|
+
delayMs: z31.number(),
|
|
17518
17629
|
/** The hosts the launch keeps off the front door by adding them to the child's `NO_PROXY`. */
|
|
17519
|
-
proxyBypass:
|
|
17630
|
+
proxyBypass: z31.array(z31.string()).readonly(),
|
|
17520
17631
|
/** How the session's built-in statusline looks, when the launch configures any of it. */
|
|
17521
17632
|
statusline: StatuslineSchema.optional()
|
|
17522
17633
|
});
|
|
17523
|
-
var LaunchResolveOutputSchema =
|
|
17634
|
+
var LaunchResolveOutputSchema = z31.strictObject({
|
|
17524
17635
|
decision: LaunchDecisionSchema,
|
|
17525
17636
|
flags: LaunchFlagsSchema,
|
|
17526
|
-
claudeVersion:
|
|
17637
|
+
claudeVersion: z31.strictObject({ version: z31.string(), source: z31.enum(CLAUDE_VERSION_SOURCES) }).optional(),
|
|
17527
17638
|
/** The real `claude` binary the launch would spawn, on the door's host. */
|
|
17528
|
-
bin:
|
|
17639
|
+
bin: z31.string(),
|
|
17529
17640
|
/** The arguments the launch would pass it: the tool's own flags, then `CLAUDE_EXTRA_FLAGS`, then the caller's own. */
|
|
17530
|
-
args:
|
|
17641
|
+
args: z31.readonly(z31.array(z31.string())),
|
|
17531
17642
|
/** The credential the launch would authenticate with, by target and source kinds. Absent when none applies. */
|
|
17532
|
-
credential:
|
|
17533
|
-
routing:
|
|
17643
|
+
credential: z31.strictObject({ subject: z31.enum(["provider", "identity"]), name: z31.string(), summary: CredentialSummarySchema }).optional(),
|
|
17644
|
+
routing: z31.strictObject({ frontDoor: z31.boolean(), headroom: z31.boolean() }),
|
|
17534
17645
|
/** The names of the environment variables the launch would set or unset, sorted. Values are not reported. */
|
|
17535
|
-
environment:
|
|
17536
|
-
warnings:
|
|
17646
|
+
environment: z31.readonly(z31.array(z31.string())),
|
|
17647
|
+
warnings: z31.readonly(z31.array(z31.string()))
|
|
17537
17648
|
});
|
|
17538
17649
|
|
|
17539
17650
|
// src/frontdoor/launchApi.ts
|
|
@@ -17569,22 +17680,22 @@ function createLaunchApiRouter(deps) {
|
|
|
17569
17680
|
// src/frontdoor/agentTreesApi.ts
|
|
17570
17681
|
import { ORPCError as ORPCError6 } from "@orpc/client";
|
|
17571
17682
|
import { openapi as openapi7 } from "@orpc/openapi";
|
|
17572
|
-
import { z as
|
|
17683
|
+
import { z as z32 } from "zod";
|
|
17573
17684
|
init_cliError();
|
|
17574
|
-
var AgentTreesListInputSchema =
|
|
17685
|
+
var AgentTreesListInputSchema = z32.strictObject({
|
|
17575
17686
|
/** Only this identity's sessions. */
|
|
17576
|
-
identity:
|
|
17687
|
+
identity: z32.string().optional(),
|
|
17577
17688
|
/** Include sessions that spawned no agent and ran no workflow. */
|
|
17578
|
-
all:
|
|
17689
|
+
all: z32.boolean().optional()
|
|
17579
17690
|
});
|
|
17580
|
-
var AgentTreesListOutputSchema =
|
|
17581
|
-
var AgentTreesShowInputSchema =
|
|
17691
|
+
var AgentTreesListOutputSchema = z32.array(SessionSummarySchema);
|
|
17692
|
+
var AgentTreesShowInputSchema = z32.strictObject({
|
|
17582
17693
|
/** A session id, or an unambiguous prefix of one. */
|
|
17583
|
-
session:
|
|
17694
|
+
session: z32.string().min(1),
|
|
17584
17695
|
/** Look only in this identity. */
|
|
17585
|
-
identity:
|
|
17696
|
+
identity: z32.string().optional()
|
|
17586
17697
|
});
|
|
17587
|
-
var AgentTreesShowOutputSchema =
|
|
17698
|
+
var AgentTreesShowOutputSchema = z32.strictObject({ identities: z32.array(z32.string()), ...MergedAgentTreeSchema.shape });
|
|
17588
17699
|
function asBadRequest(error) {
|
|
17589
17700
|
if (error instanceof CliError) {
|
|
17590
17701
|
throw new ORPCError6("BAD_REQUEST", { message: error.message });
|
|
@@ -19777,7 +19888,7 @@ init_poolPick();
|
|
|
19777
19888
|
|
|
19778
19889
|
// src/agents/read.ts
|
|
19779
19890
|
import path35 from "node:path";
|
|
19780
|
-
import { z as
|
|
19891
|
+
import { z as z33 } from "zod";
|
|
19781
19892
|
var PROJECTS_DIR = "projects";
|
|
19782
19893
|
var TASKS_DIR = "tasks";
|
|
19783
19894
|
var SUBAGENTS_DIR = "subagents";
|
|
@@ -19896,14 +20007,14 @@ function parseJson2(text) {
|
|
|
19896
20007
|
return void 0;
|
|
19897
20008
|
}
|
|
19898
20009
|
}
|
|
19899
|
-
var TaskFileSchema =
|
|
19900
|
-
var WorkflowRunFileSchema =
|
|
19901
|
-
runId:
|
|
19902
|
-
workflowName:
|
|
19903
|
-
status:
|
|
19904
|
-
startTime:
|
|
19905
|
-
phases:
|
|
19906
|
-
summary:
|
|
20010
|
+
var TaskFileSchema = z33.object({ ...TaskItemSchema.omit({ taskList: true }).shape, blocks: z33.array(z33.string()).default([]), blockedBy: z33.array(z33.string()).default([]) });
|
|
20011
|
+
var WorkflowRunFileSchema = z33.object({
|
|
20012
|
+
runId: z33.string(),
|
|
20013
|
+
workflowName: z33.string().optional(),
|
|
20014
|
+
status: z33.string().optional(),
|
|
20015
|
+
startTime: z33.number().optional(),
|
|
20016
|
+
phases: z33.array(z33.object({ title: z33.string() })).default([]),
|
|
20017
|
+
summary: z33.string().optional()
|
|
19907
20018
|
});
|
|
19908
20019
|
function summariseSession(fs14, configDir, ref) {
|
|
19909
20020
|
const sessionRelative = path35.join(PROJECTS_DIR, ref.project, ref.entry);
|