claude-use 9.8.0 → 9.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +1 -1
- package/dist/index.cjs +780 -524
- package/dist/index.mjs +767 -521
- package/dist/types/index.d.ts +137 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -626,9 +626,9 @@ function applyPatch(filePath, schema, patch, options = {}) {
|
|
|
626
626
|
if (!result.success) {
|
|
627
627
|
throw new ConfigValidationError(filePath, result.error.issues);
|
|
628
628
|
}
|
|
629
|
-
const
|
|
630
|
-
writeJsonAtomic(filePath,
|
|
631
|
-
return
|
|
629
|
+
const validated3 = result.data;
|
|
630
|
+
writeJsonAtomic(filePath, validated3, storeFs);
|
|
631
|
+
return validated3;
|
|
632
632
|
}
|
|
633
633
|
var import_node_fs, import_node_path3, import_node_crypto, nodeStoreFs;
|
|
634
634
|
var init_store = __esm({
|
|
@@ -2663,7 +2663,7 @@ var init_package = __esm({
|
|
|
2663
2663
|
"package.json"() {
|
|
2664
2664
|
package_default = {
|
|
2665
2665
|
name: "claude-use",
|
|
2666
|
-
version: "9.
|
|
2666
|
+
version: "9.9.0",
|
|
2667
2667
|
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.",
|
|
2668
2668
|
license: "MIT",
|
|
2669
2669
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -2891,37 +2891,37 @@ function readStartLock(fs12, lockFile) {
|
|
|
2891
2891
|
return void 0;
|
|
2892
2892
|
}
|
|
2893
2893
|
}
|
|
2894
|
-
var import_node_crypto6, import_node_path11,
|
|
2894
|
+
var import_node_crypto6, import_node_path11, import_zod6, HEADROOM_ANTHROPIC_UPSTREAM, HeadroomStateSchema, HeadroomSessionSchema, HeadroomLockSchema;
|
|
2895
2895
|
var init_state2 = __esm({
|
|
2896
2896
|
"src/headroom/state.ts"() {
|
|
2897
2897
|
"use strict";
|
|
2898
2898
|
import_node_crypto6 = require("node:crypto");
|
|
2899
2899
|
import_node_path11 = __toESM(require("node:path"), 1);
|
|
2900
|
-
|
|
2900
|
+
import_zod6 = require("zod");
|
|
2901
2901
|
init_schema();
|
|
2902
2902
|
HEADROOM_ANTHROPIC_UPSTREAM = "https://api.anthropic.com";
|
|
2903
|
-
HeadroomStateSchema =
|
|
2903
|
+
HeadroomStateSchema = import_zod6.z.strictObject({
|
|
2904
2904
|
/** The supervisor process owning the daemon. Alive means someone is keeping headroom running. */
|
|
2905
|
-
supervisorPid:
|
|
2905
|
+
supervisorPid: import_zod6.z.number().int().positive().optional(),
|
|
2906
2906
|
/** The headroom proxy process itself. Absent while the supervisor is between restarts. */
|
|
2907
|
-
headroomPid:
|
|
2907
|
+
headroomPid: import_zod6.z.number().int().positive().optional(),
|
|
2908
2908
|
/**
|
|
2909
2909
|
* The unix socket the proxy serves on, inside the owner-only socket directory. Absent until the proxy has passed its readiness check, so "socketPath is set" is itself the ready signal a launcher polls for. The front door reads it on every hop, so a restart (which keeps the generation's path) is followed without anything being relaunched.
|
|
2910
2910
|
*/
|
|
2911
|
-
socketPath:
|
|
2911
|
+
socketPath: import_zod6.z.string().min(1).optional(),
|
|
2912
2912
|
/** The `headroom --version` output of the running install. */
|
|
2913
|
-
version:
|
|
2913
|
+
version: import_zod6.z.string().optional(),
|
|
2914
2914
|
/** Hash of the allowlist the running proxy was started with, so a provider-file change is detected as drift. */
|
|
2915
|
-
allowlistHash:
|
|
2915
|
+
allowlistHash: import_zod6.z.string().optional(),
|
|
2916
2916
|
/** Hash of the token-saving settings the running proxy was started with, so a settings change is detected as drift. */
|
|
2917
|
-
settingsHash:
|
|
2917
|
+
settingsHash: import_zod6.z.string().optional(),
|
|
2918
2918
|
/** The install spec the running install was last installed from, so a `source` config change is detected as drift. */
|
|
2919
|
-
installedSource:
|
|
2919
|
+
installedSource: import_zod6.z.string().optional(),
|
|
2920
2920
|
/** The last fatal error, kept across shutdowns so `headroom status` can explain a daemon that is not running. */
|
|
2921
|
-
lastError:
|
|
2921
|
+
lastError: import_zod6.z.string().optional()
|
|
2922
2922
|
});
|
|
2923
|
-
HeadroomSessionSchema =
|
|
2924
|
-
HeadroomLockSchema =
|
|
2923
|
+
HeadroomSessionSchema = import_zod6.z.strictObject({ pid: import_zod6.z.number().int().positive(), startedAt: import_zod6.z.number(), supervisorPid: import_zod6.z.number().int().positive() });
|
|
2924
|
+
HeadroomLockSchema = import_zod6.z.strictObject({ pid: import_zod6.z.number().int().positive(), at: import_zod6.z.number() });
|
|
2925
2925
|
}
|
|
2926
2926
|
});
|
|
2927
2927
|
|
|
@@ -3128,14 +3128,14 @@ function pinnedGitCommit(spec) {
|
|
|
3128
3128
|
const ref = GIT_SPEC_RE.exec(spec)?.[1];
|
|
3129
3129
|
return ref !== void 0 && COMMIT_SHA_RE.test(ref) ? ref.toLowerCase() : void 0;
|
|
3130
3130
|
}
|
|
3131
|
-
var
|
|
3131
|
+
var import_zod7, GIT_SPEC_RE, COMMIT_SHA_RE, DirectUrlSchema;
|
|
3132
3132
|
var init_source = __esm({
|
|
3133
3133
|
"src/headroom/source.ts"() {
|
|
3134
3134
|
"use strict";
|
|
3135
|
-
|
|
3135
|
+
import_zod7 = require("zod");
|
|
3136
3136
|
GIT_SPEC_RE = /git\+[^@\s]+(?:@([^\s#]+))?/;
|
|
3137
3137
|
COMMIT_SHA_RE = /^[0-9a-f]{40}$/i;
|
|
3138
|
-
DirectUrlSchema =
|
|
3138
|
+
DirectUrlSchema = import_zod7.z.object({ vcs_info: import_zod7.z.object({ commit_id: import_zod7.z.string() }) });
|
|
3139
3139
|
}
|
|
3140
3140
|
});
|
|
3141
3141
|
|
|
@@ -3421,7 +3421,7 @@ function realIsProcessAlive(pid) {
|
|
|
3421
3421
|
}
|
|
3422
3422
|
}
|
|
3423
3423
|
function realIsProcessZombie(pid) {
|
|
3424
|
-
const result = (0,
|
|
3424
|
+
const result = (0, import_node_child_process2.spawnSync)("ps", ["-o", "stat=", "-p", String(pid)], { encoding: "utf8" });
|
|
3425
3425
|
return result.status === 0 && result.stdout.trim().startsWith("Z");
|
|
3426
3426
|
}
|
|
3427
3427
|
function realIsProcessRunning(pid) {
|
|
@@ -3432,7 +3432,7 @@ function expandHome2(filePath) {
|
|
|
3432
3432
|
}
|
|
3433
3433
|
function hasDesktopSession() {
|
|
3434
3434
|
if (process.platform === "darwin") {
|
|
3435
|
-
const result = (0,
|
|
3435
|
+
const result = (0, import_node_child_process2.spawnSync)("launchctl", ["managername"], { encoding: "utf8" });
|
|
3436
3436
|
return result.status === 0 && result.stdout.trim() === MACOS_GUI_SESSION_MANAGER;
|
|
3437
3437
|
}
|
|
3438
3438
|
if (process.platform === "win32") {
|
|
@@ -3475,7 +3475,7 @@ function spawnDetachedDaemon(invocation, paths, subcommand, logPath) {
|
|
|
3475
3475
|
import_node_fs2.default.mkdirSync(import_node_path13.default.dirname(logPath), { recursive: true });
|
|
3476
3476
|
const logFd = import_node_fs2.default.openSync(logPath, "a");
|
|
3477
3477
|
try {
|
|
3478
|
-
const child = (0,
|
|
3478
|
+
const child = (0, import_node_child_process2.spawn)(invocation.command, invocation.args, detachedDaemonSpawnOptions(logFd, { ...process.env, AGENT_SHIM_HOME: paths.root }));
|
|
3479
3479
|
child.unref();
|
|
3480
3480
|
if (child.pid === void 0) {
|
|
3481
3481
|
throw new Error(`spawning ${subcommand} returned no pid`);
|
|
@@ -3624,11 +3624,11 @@ function realResolveClaudeBinary(isOwnBinary) {
|
|
|
3624
3624
|
function realInstalledClaudeVersions() {
|
|
3625
3625
|
return installedVersions(listVersionsDir(defaultVersionsDir()));
|
|
3626
3626
|
}
|
|
3627
|
-
var
|
|
3627
|
+
var import_node_child_process2, import_node_crypto8, import_node_fs2, import_node_os2, import_node_path13, import_node_sea, realFsPort, OWNER_ONLY_DIR_MODE, OWNER_ONLY_FILE_MODE, PERMISSION_BITS, realFarmFs, INT32_BYTE_LENGTH, realRunPort, MACOS_GUI_SESSION_MANAGER, realCredentialPort, SOCKET_PERMISSION_BITS, realHeadroomSocketTrust, realSpawnPort, realProcPort, EXECUTE_BITS_MASK, WINDOWS_DEFAULT_PATHEXT;
|
|
3628
3628
|
var init_realPorts = __esm({
|
|
3629
3629
|
"src/realPorts.ts"() {
|
|
3630
3630
|
"use strict";
|
|
3631
|
-
|
|
3631
|
+
import_node_child_process2 = require("node:child_process");
|
|
3632
3632
|
import_node_crypto8 = require("node:crypto");
|
|
3633
3633
|
import_node_fs2 = __toESM(require("node:fs"), 1);
|
|
3634
3634
|
import_node_os2 = __toESM(require("node:os"), 1);
|
|
@@ -3767,7 +3767,7 @@ var init_realPorts = __esm({
|
|
|
3767
3767
|
INT32_BYTE_LENGTH = 4;
|
|
3768
3768
|
realRunPort = {
|
|
3769
3769
|
run(command, args) {
|
|
3770
|
-
const result = (0,
|
|
3770
|
+
const result = (0, import_node_child_process2.spawnSync)(command, [...args], { encoding: "utf8" });
|
|
3771
3771
|
return { status: result.status, stdout: result.stdout, stderr: result.stderr };
|
|
3772
3772
|
}
|
|
3773
3773
|
};
|
|
@@ -3790,7 +3790,7 @@ var init_realPorts = __esm({
|
|
|
3790
3790
|
},
|
|
3791
3791
|
runCommand(argv, options) {
|
|
3792
3792
|
const [command, ...args] = argv;
|
|
3793
|
-
const result = (0,
|
|
3793
|
+
const result = (0, import_node_child_process2.spawnSync)(command, args, {
|
|
3794
3794
|
encoding: "utf8",
|
|
3795
3795
|
timeout: options.timeoutMs,
|
|
3796
3796
|
stdio: options.interactive ? ["inherit", "pipe", "inherit"] : ["ignore", "pipe", "pipe"]
|
|
@@ -3828,7 +3828,7 @@ var init_realPorts = __esm({
|
|
|
3828
3828
|
};
|
|
3829
3829
|
realSpawnPort = {
|
|
3830
3830
|
spawnSync(command, args, options) {
|
|
3831
|
-
const result = (0,
|
|
3831
|
+
const result = (0, import_node_child_process2.spawnSync)(command, args, options);
|
|
3832
3832
|
return { status: result.status, signal: result.signal, ...result.error === void 0 ? {} : { error: result.error } };
|
|
3833
3833
|
}
|
|
3834
3834
|
};
|
|
@@ -4040,149 +4040,149 @@ var init_identity = __esm({
|
|
|
4040
4040
|
});
|
|
4041
4041
|
|
|
4042
4042
|
// src/usage/schema.ts
|
|
4043
|
-
var
|
|
4043
|
+
var import_zod8, USAGE_SCHEMA_VERSION, VersionSchema, InstantSchema, TokenCountSchema, TokenUsageSchema, LIMIT_KINDS, LimitClassificationSchema, UsageRecordSchema, QuotaWindowSchema, ExtraUsageSpendSchema, UnifiedRateLimitSchema, RateLimitStateSchema, LimitEventSchema, ProviderQuotaWindowSchema, ProviderQuotaSchema, ProviderUsageStateSchema, AccountMetadataSchema, UsageSnapshotSchema;
|
|
4044
4044
|
var init_schema2 = __esm({
|
|
4045
4045
|
"src/usage/schema.ts"() {
|
|
4046
4046
|
"use strict";
|
|
4047
|
-
|
|
4047
|
+
import_zod8 = require("zod");
|
|
4048
4048
|
USAGE_SCHEMA_VERSION = 1;
|
|
4049
|
-
VersionSchema =
|
|
4050
|
-
InstantSchema =
|
|
4051
|
-
TokenCountSchema =
|
|
4052
|
-
TokenUsageSchema =
|
|
4049
|
+
VersionSchema = import_zod8.z.literal(USAGE_SCHEMA_VERSION);
|
|
4050
|
+
InstantSchema = import_zod8.z.iso.datetime();
|
|
4051
|
+
TokenCountSchema = import_zod8.z.number().int().nonnegative();
|
|
4052
|
+
TokenUsageSchema = import_zod8.z.strictObject({
|
|
4053
4053
|
inputTokens: TokenCountSchema.optional(),
|
|
4054
4054
|
outputTokens: TokenCountSchema.optional(),
|
|
4055
4055
|
cacheCreationInputTokens: TokenCountSchema.optional(),
|
|
4056
4056
|
cacheReadInputTokens: TokenCountSchema.optional()
|
|
4057
4057
|
});
|
|
4058
4058
|
LIMIT_KINDS = ["rate-limited", "quota-exhausted"];
|
|
4059
|
-
LimitClassificationSchema =
|
|
4060
|
-
kind:
|
|
4059
|
+
LimitClassificationSchema = import_zod8.z.strictObject({
|
|
4060
|
+
kind: import_zod8.z.enum(LIMIT_KINDS),
|
|
4061
4061
|
/** Seconds to wait before retrying, from the response's `retry-after`. */
|
|
4062
|
-
retryAfterSeconds:
|
|
4062
|
+
retryAfterSeconds: import_zod8.z.number().nonnegative().optional(),
|
|
4063
4063
|
/** When the limiting window resets, from the upstream's own reset header. */
|
|
4064
4064
|
resetAt: InstantSchema.optional(),
|
|
4065
4065
|
/** The window the upstream named as the binding one (`anthropic-ratelimit-unified-representative-claim`), such as `five_hour` or `seven_day`. */
|
|
4066
|
-
window:
|
|
4066
|
+
window: import_zod8.z.string().optional(),
|
|
4067
4067
|
/** The signals the classification rests on, each `<name>=<value>` from a response header or the error body's `type` or `code`. Never the error message. */
|
|
4068
|
-
evidence:
|
|
4068
|
+
evidence: import_zod8.z.array(import_zod8.z.string())
|
|
4069
4069
|
});
|
|
4070
|
-
UsageRecordSchema =
|
|
4070
|
+
UsageRecordSchema = import_zod8.z.strictObject({
|
|
4071
4071
|
schemaVersion: VersionSchema,
|
|
4072
4072
|
/** When the front door received the request. */
|
|
4073
4073
|
at: InstantSchema,
|
|
4074
4074
|
/** The launching identity, when the launch resolved one. */
|
|
4075
|
-
identity:
|
|
4075
|
+
identity: import_zod8.z.string().optional(),
|
|
4076
4076
|
/** `anthropic` for an OAuth session's request to Claude Code's own API, otherwise the provider's name. */
|
|
4077
|
-
provider:
|
|
4077
|
+
provider: import_zod8.z.string(),
|
|
4078
4078
|
/** The launch's session id, generated per launch. */
|
|
4079
|
-
sessionId:
|
|
4079
|
+
sessionId: import_zod8.z.string().optional(),
|
|
4080
4080
|
/** The project the launch ran in (its git repository root), when the launch sent one: headroom launches do. */
|
|
4081
|
-
project:
|
|
4081
|
+
project: import_zod8.z.string().optional(),
|
|
4082
4082
|
/** The front-door route that served the request. */
|
|
4083
|
-
route:
|
|
4084
|
-
method:
|
|
4083
|
+
route: import_zod8.z.string(),
|
|
4084
|
+
method: import_zod8.z.string(),
|
|
4085
4085
|
/** The API path as the upstream sees it (`/v1/messages`), without the provider prefix or a query string. */
|
|
4086
|
-
endpoint:
|
|
4086
|
+
endpoint: import_zod8.z.string(),
|
|
4087
4087
|
/** The model the response named. */
|
|
4088
|
-
model:
|
|
4089
|
-
status:
|
|
4088
|
+
model: import_zod8.z.string().optional(),
|
|
4089
|
+
status: import_zod8.z.number().int(),
|
|
4090
4090
|
/** Milliseconds from the request's arrival to its response head. */
|
|
4091
|
-
latencyMs:
|
|
4091
|
+
latencyMs: import_zod8.z.number().int().nonnegative(),
|
|
4092
4092
|
/** Milliseconds from the request's arrival to the end of its response body. */
|
|
4093
|
-
durationMs:
|
|
4093
|
+
durationMs: import_zod8.z.number().int().nonnegative(),
|
|
4094
4094
|
/** Whether the client received the whole body. */
|
|
4095
|
-
outcome:
|
|
4095
|
+
outcome: import_zod8.z.enum(["completed", "aborted"]),
|
|
4096
4096
|
usage: TokenUsageSchema.optional(),
|
|
4097
4097
|
/** The response's quota and rate-limit headers, by name (see `isRateLimitHeader`). */
|
|
4098
|
-
rateLimitHeaders:
|
|
4098
|
+
rateLimitHeaders: import_zod8.z.record(import_zod8.z.string(), import_zod8.z.string()).optional(),
|
|
4099
4099
|
limit: LimitClassificationSchema.optional(),
|
|
4100
4100
|
/** The upstream's request id (`request-id`), for matching a record to the provider's own logs. */
|
|
4101
|
-
requestId:
|
|
4101
|
+
requestId: import_zod8.z.string().optional()
|
|
4102
4102
|
});
|
|
4103
|
-
QuotaWindowSchema =
|
|
4103
|
+
QuotaWindowSchema = import_zod8.z.strictObject({
|
|
4104
4104
|
/** The fraction of the window used, as the upstream reports it (0 to 1). */
|
|
4105
|
-
utilization:
|
|
4105
|
+
utilization: import_zod8.z.number().nonnegative().optional(),
|
|
4106
4106
|
resetsAt: InstantSchema.optional(),
|
|
4107
4107
|
/** The window's own status (`allowed`, `allowed_warning`, `rejected`). */
|
|
4108
|
-
status:
|
|
4108
|
+
status: import_zod8.z.string().optional(),
|
|
4109
4109
|
/** The fraction of the window's grace allowance used, while the upstream reports the window in grace (the five-hour window only). Requests are served beyond the window's own full mark while it grows, but refusals have been seen at a small value, so nothing ranks on it. */
|
|
4110
|
-
graceUtilization:
|
|
4110
|
+
graceUtilization: import_zod8.z.number().nonnegative().optional()
|
|
4111
4111
|
});
|
|
4112
|
-
ExtraUsageSpendSchema =
|
|
4112
|
+
ExtraUsageSpendSchema = import_zod8.z.strictObject({
|
|
4113
4113
|
/** Spent so far in the allowance's period, in the currency's minor units (pence, cents). */
|
|
4114
|
-
usedMinor:
|
|
4114
|
+
usedMinor: import_zod8.z.number().nonnegative(),
|
|
4115
4115
|
/** The allowance's cap in the same units, when it has one. */
|
|
4116
|
-
limitMinor:
|
|
4116
|
+
limitMinor: import_zod8.z.number().nonnegative().optional(),
|
|
4117
4117
|
/** The ISO 4217 currency code. */
|
|
4118
|
-
currency:
|
|
4118
|
+
currency: import_zod8.z.string()
|
|
4119
4119
|
});
|
|
4120
|
-
UnifiedRateLimitSchema =
|
|
4120
|
+
UnifiedRateLimitSchema = import_zod8.z.strictObject({
|
|
4121
4121
|
/** The overall status: `allowed`, `allowed_warning` or `rejected`. */
|
|
4122
|
-
status:
|
|
4122
|
+
status: import_zod8.z.string().optional(),
|
|
4123
4123
|
fiveHour: QuotaWindowSchema.optional(),
|
|
4124
4124
|
sevenDay: QuotaWindowSchema.optional(),
|
|
4125
4125
|
/** The weekly window of the models whose usage may continue as extra usage (`7d_oi`), reported by some plans beside the all-models weekly window. */
|
|
4126
4126
|
sevenDayOverageIncluded: QuotaWindowSchema.optional(),
|
|
4127
4127
|
/** The window that currently binds. */
|
|
4128
|
-
representativeClaim:
|
|
4128
|
+
representativeClaim: import_zod8.z.string().optional(),
|
|
4129
4129
|
/** When the binding window resets. */
|
|
4130
4130
|
resetAt: InstantSchema.optional(),
|
|
4131
4131
|
/** Whether usage beyond the plan (extra usage) is available: `allowed` or `rejected`. */
|
|
4132
|
-
overageStatus:
|
|
4132
|
+
overageStatus: import_zod8.z.string().optional(),
|
|
4133
4133
|
/** The fraction of the extra-usage allowance used, as the upstream reports it (0 to 1). An account with no plan windows, such as an Enterprise one, is metered by this alone. */
|
|
4134
|
-
overageUtilization:
|
|
4134
|
+
overageUtilization: import_zod8.z.number().nonnegative().optional(),
|
|
4135
4135
|
/** When the extra-usage allowance resets. */
|
|
4136
4136
|
overageResetsAt: InstantSchema.optional(),
|
|
4137
4137
|
/** Why extra usage is unavailable, as the upstream names it (`out_of_credits`, for one). */
|
|
4138
|
-
overageDisabledReason:
|
|
4138
|
+
overageDisabledReason: import_zod8.z.string().optional(),
|
|
4139
4139
|
/** Whether the response was served on extra usage, as the upstream states it. */
|
|
4140
|
-
overageInUse:
|
|
4140
|
+
overageInUse: import_zod8.z.boolean().optional(),
|
|
4141
4141
|
/** The allowance in money, from the usage endpoint (the response headers state only the fraction). */
|
|
4142
4142
|
extraUsageSpend: ExtraUsageSpendSchema.optional(),
|
|
4143
4143
|
/** True when the upstream offers a fallback while a window is rejected: some requests, by model, are still served, though the rest are refused. */
|
|
4144
|
-
fallbackAvailable:
|
|
4144
|
+
fallbackAvailable: import_zod8.z.boolean().optional()
|
|
4145
4145
|
});
|
|
4146
|
-
RateLimitStateSchema =
|
|
4146
|
+
RateLimitStateSchema = import_zod8.z.strictObject({
|
|
4147
4147
|
observedAt: InstantSchema,
|
|
4148
4148
|
/** Every quota and rate-limit header on that response, by name. */
|
|
4149
|
-
headers:
|
|
4149
|
+
headers: import_zod8.z.record(import_zod8.z.string(), import_zod8.z.string()),
|
|
4150
4150
|
unified: UnifiedRateLimitSchema.optional(),
|
|
4151
4151
|
/** When the usage endpoint last answered that it has no plan windows for the account, which a later response replaces. Its answer leaves the recorded `unified` state alone (a response's headers may be the only source of it), so this alone says the question was asked. */
|
|
4152
4152
|
planWindowsUnavailableAt: InstantSchema.optional()
|
|
4153
4153
|
});
|
|
4154
4154
|
LimitEventSchema = LimitClassificationSchema.extend({
|
|
4155
4155
|
observedAt: InstantSchema,
|
|
4156
|
-
status:
|
|
4156
|
+
status: import_zod8.z.number().int()
|
|
4157
4157
|
});
|
|
4158
|
-
ProviderQuotaWindowSchema =
|
|
4158
|
+
ProviderQuotaWindowSchema = import_zod8.z.strictObject({
|
|
4159
4159
|
/** What the window measures, in the provider's terms (`tokens`, `tool-calls`). */
|
|
4160
|
-
measures:
|
|
4160
|
+
measures: import_zod8.z.string(),
|
|
4161
4161
|
/** The window's length in milliseconds, when the provider's unit is one this project knows; absent for an unrecognised unit, with `period` carrying the raw code. */
|
|
4162
|
-
periodMs:
|
|
4162
|
+
periodMs: import_zod8.z.number().int().positive().optional(),
|
|
4163
4163
|
/** The provider's own description of the period when `periodMs` could not be derived, such as `unit 4 x 1`. */
|
|
4164
|
-
period:
|
|
4164
|
+
period: import_zod8.z.string().optional(),
|
|
4165
4165
|
/** The fraction of the window used (0 to 1). */
|
|
4166
|
-
utilization:
|
|
4166
|
+
utilization: import_zod8.z.number().nonnegative(),
|
|
4167
4167
|
resetsAt: InstantSchema.optional(),
|
|
4168
4168
|
/** Absolute counts, when the provider reports them for this window. */
|
|
4169
|
-
limit:
|
|
4170
|
-
used:
|
|
4171
|
-
remaining:
|
|
4169
|
+
limit: import_zod8.z.number().nonnegative().optional(),
|
|
4170
|
+
used: import_zod8.z.number().nonnegative().optional(),
|
|
4171
|
+
remaining: import_zod8.z.number().nonnegative().optional()
|
|
4172
4172
|
});
|
|
4173
|
-
ProviderQuotaSchema =
|
|
4173
|
+
ProviderQuotaSchema = import_zod8.z.strictObject({
|
|
4174
4174
|
observedAt: InstantSchema,
|
|
4175
4175
|
/** Which usage endpoint produced it (`z.ai`). */
|
|
4176
|
-
source:
|
|
4176
|
+
source: import_zod8.z.string(),
|
|
4177
4177
|
/** The subscription level the endpoint reports, when it does. */
|
|
4178
|
-
level:
|
|
4179
|
-
windows:
|
|
4178
|
+
level: import_zod8.z.string().optional(),
|
|
4179
|
+
windows: import_zod8.z.array(ProviderQuotaWindowSchema)
|
|
4180
4180
|
});
|
|
4181
|
-
ProviderUsageStateSchema =
|
|
4181
|
+
ProviderUsageStateSchema = import_zod8.z.strictObject({
|
|
4182
4182
|
/** When the provider last served a request for the identity through the front door. Absent while the state holds only a rate-limit state fetched from the provider's usage endpoint, for an identity that has made no request. */
|
|
4183
4183
|
lastRequestAt: InstantSchema.optional(),
|
|
4184
|
-
lastStatus:
|
|
4185
|
-
lastModel:
|
|
4184
|
+
lastStatus: import_zod8.z.number().int().optional(),
|
|
4185
|
+
lastModel: import_zod8.z.string().optional(),
|
|
4186
4186
|
/** The latest rate-limit state, from the last response that carried any rate-limit header. */
|
|
4187
4187
|
rateLimit: RateLimitStateSchema.optional(),
|
|
4188
4188
|
/** The latest classified refusal. It stays after later successes, so a reader compares its `resetAt` (or `observedAt` plus `retryAfterSeconds`) with the current time. */
|
|
@@ -4190,31 +4190,31 @@ var init_schema2 = __esm({
|
|
|
4190
4190
|
/** The latest quota the provider's usage endpoint reported, for providers whose quota is not visible in response headers. */
|
|
4191
4191
|
quota: ProviderQuotaSchema.optional()
|
|
4192
4192
|
});
|
|
4193
|
-
AccountMetadataSchema =
|
|
4194
|
-
accountUuid:
|
|
4195
|
-
emailAddress:
|
|
4196
|
-
displayName:
|
|
4197
|
-
organizationUuid:
|
|
4198
|
-
organizationName:
|
|
4199
|
-
organizationType:
|
|
4200
|
-
organizationRole:
|
|
4201
|
-
workspaceRole:
|
|
4202
|
-
billingType:
|
|
4203
|
-
seatTier:
|
|
4204
|
-
organizationRateLimitTier:
|
|
4205
|
-
userRateLimitTier:
|
|
4206
|
-
hasExtraUsageEnabled:
|
|
4207
|
-
subscriptionCreatedAt:
|
|
4208
|
-
accountCreatedAt:
|
|
4193
|
+
AccountMetadataSchema = import_zod8.z.strictObject({
|
|
4194
|
+
accountUuid: import_zod8.z.string().optional(),
|
|
4195
|
+
emailAddress: import_zod8.z.string().optional(),
|
|
4196
|
+
displayName: import_zod8.z.string().optional(),
|
|
4197
|
+
organizationUuid: import_zod8.z.string().optional(),
|
|
4198
|
+
organizationName: import_zod8.z.string().optional(),
|
|
4199
|
+
organizationType: import_zod8.z.string().optional(),
|
|
4200
|
+
organizationRole: import_zod8.z.string().optional(),
|
|
4201
|
+
workspaceRole: import_zod8.z.string().optional(),
|
|
4202
|
+
billingType: import_zod8.z.string().optional(),
|
|
4203
|
+
seatTier: import_zod8.z.string().optional(),
|
|
4204
|
+
organizationRateLimitTier: import_zod8.z.string().optional(),
|
|
4205
|
+
userRateLimitTier: import_zod8.z.string().optional(),
|
|
4206
|
+
hasExtraUsageEnabled: import_zod8.z.boolean().optional(),
|
|
4207
|
+
subscriptionCreatedAt: import_zod8.z.string().optional(),
|
|
4208
|
+
accountCreatedAt: import_zod8.z.string().optional()
|
|
4209
4209
|
});
|
|
4210
|
-
UsageSnapshotSchema =
|
|
4210
|
+
UsageSnapshotSchema = import_zod8.z.strictObject({
|
|
4211
4211
|
schemaVersion: VersionSchema,
|
|
4212
|
-
identity:
|
|
4212
|
+
identity: import_zod8.z.string(),
|
|
4213
4213
|
updatedAt: InstantSchema,
|
|
4214
4214
|
/** The identity's account metadata as of `updatedAt`. */
|
|
4215
4215
|
account: AccountMetadataSchema.optional(),
|
|
4216
4216
|
/** Latest state per provider, keyed by provider name (`anthropic` for OAuth sessions). */
|
|
4217
|
-
providers:
|
|
4217
|
+
providers: import_zod8.z.record(import_zod8.z.string(), ProviderUsageStateSchema)
|
|
4218
4218
|
});
|
|
4219
4219
|
}
|
|
4220
4220
|
});
|
|
@@ -4321,24 +4321,24 @@ function planOf(account) {
|
|
|
4321
4321
|
}
|
|
4322
4322
|
return { kind: "subscription", capacity: 1, recognised: BASE_TIER.test(tier), ...tierField };
|
|
4323
4323
|
}
|
|
4324
|
-
var
|
|
4324
|
+
var import_zod9, PlanClassSchema, TIER_MULTIPLIER, ZERO_TIER, BASE_TIER;
|
|
4325
4325
|
var init_plan2 = __esm({
|
|
4326
4326
|
"src/usage/plan.ts"() {
|
|
4327
4327
|
"use strict";
|
|
4328
|
-
|
|
4329
|
-
PlanClassSchema =
|
|
4330
|
-
|
|
4331
|
-
kind:
|
|
4328
|
+
import_zod9 = require("zod");
|
|
4329
|
+
PlanClassSchema = import_zod9.z.union([
|
|
4330
|
+
import_zod9.z.strictObject({
|
|
4331
|
+
kind: import_zod9.z.literal("subscription"),
|
|
4332
4332
|
/** The plan's size as a multiple of the smallest subscription tier (Max 5x is 5, Max 20x is 20). */
|
|
4333
|
-
capacity:
|
|
4333
|
+
capacity: import_zod9.z.number().positive(),
|
|
4334
4334
|
/** False when the tier string named no multiplier and no tier this project knows, so `capacity` is the neutral 1 rather than a reading. */
|
|
4335
|
-
recognised:
|
|
4335
|
+
recognised: import_zod9.z.boolean(),
|
|
4336
4336
|
/** The tier string the classification rests on, when the account had one. */
|
|
4337
|
-
tier:
|
|
4337
|
+
tier: import_zod9.z.string().optional()
|
|
4338
4338
|
}),
|
|
4339
|
-
|
|
4340
|
-
kind:
|
|
4341
|
-
tier:
|
|
4339
|
+
import_zod9.z.strictObject({
|
|
4340
|
+
kind: import_zod9.z.literal("pay-per-use"),
|
|
4341
|
+
tier: import_zod9.z.string().optional()
|
|
4342
4342
|
})
|
|
4343
4343
|
]);
|
|
4344
4344
|
TIER_MULTIPLIER = /(?:^|_)(\d+)x$/;
|
|
@@ -4439,21 +4439,21 @@ var init_rateLimit = __esm({
|
|
|
4439
4439
|
});
|
|
4440
4440
|
|
|
4441
4441
|
// src/usage/scan.ts
|
|
4442
|
-
var
|
|
4442
|
+
var import_zod10, AnthropicUsageSchema, ErrorObjectSchema;
|
|
4443
4443
|
var init_scan = __esm({
|
|
4444
4444
|
"src/usage/scan.ts"() {
|
|
4445
4445
|
"use strict";
|
|
4446
|
-
|
|
4447
|
-
AnthropicUsageSchema =
|
|
4448
|
-
input_tokens:
|
|
4449
|
-
output_tokens:
|
|
4450
|
-
cache_creation_input_tokens:
|
|
4451
|
-
cache_read_input_tokens:
|
|
4446
|
+
import_zod10 = require("zod");
|
|
4447
|
+
AnthropicUsageSchema = import_zod10.z.looseObject({
|
|
4448
|
+
input_tokens: import_zod10.z.number().int().nonnegative().nullish(),
|
|
4449
|
+
output_tokens: import_zod10.z.number().int().nonnegative().nullish(),
|
|
4450
|
+
cache_creation_input_tokens: import_zod10.z.number().int().nonnegative().nullish(),
|
|
4451
|
+
cache_read_input_tokens: import_zod10.z.number().int().nonnegative().nullish()
|
|
4452
4452
|
});
|
|
4453
|
-
ErrorObjectSchema =
|
|
4454
|
-
type:
|
|
4455
|
-
code:
|
|
4456
|
-
message:
|
|
4453
|
+
ErrorObjectSchema = import_zod10.z.looseObject({
|
|
4454
|
+
type: import_zod10.z.string().optional(),
|
|
4455
|
+
code: import_zod10.z.union([import_zod10.z.string(), import_zod10.z.number()]).optional(),
|
|
4456
|
+
message: import_zod10.z.string().optional()
|
|
4457
4457
|
});
|
|
4458
4458
|
}
|
|
4459
4459
|
});
|
|
@@ -5156,12 +5156,12 @@ function recordStickyPick(fs12, picksFile, directory, identity, nowMs) {
|
|
|
5156
5156
|
fs12.writeFilePrivate(picksFile, `${JSON.stringify(next, null, 2)}
|
|
5157
5157
|
`);
|
|
5158
5158
|
}
|
|
5159
|
-
var import_node_path20,
|
|
5159
|
+
var import_node_path20, import_zod11, PoolGraphError, SCHEMA_VERSION, PickEntrySchema, PicksFileSchema;
|
|
5160
5160
|
var init_poolPick = __esm({
|
|
5161
5161
|
"src/usage/poolPick.ts"() {
|
|
5162
5162
|
"use strict";
|
|
5163
5163
|
import_node_path20 = __toESM(require("node:path"), 1);
|
|
5164
|
-
|
|
5164
|
+
import_zod11 = require("zod");
|
|
5165
5165
|
init_cliError();
|
|
5166
5166
|
init_identity();
|
|
5167
5167
|
init_schema();
|
|
@@ -5177,10 +5177,10 @@ var init_poolPick = __esm({
|
|
|
5177
5177
|
}
|
|
5178
5178
|
};
|
|
5179
5179
|
SCHEMA_VERSION = 1;
|
|
5180
|
-
PickEntrySchema =
|
|
5181
|
-
PicksFileSchema =
|
|
5182
|
-
schemaVersion:
|
|
5183
|
-
picks:
|
|
5180
|
+
PickEntrySchema = import_zod11.z.strictObject({ identity: import_zod11.z.string().min(1), at: import_zod11.z.iso.datetime() });
|
|
5181
|
+
PicksFileSchema = import_zod11.z.strictObject({
|
|
5182
|
+
schemaVersion: import_zod11.z.literal(SCHEMA_VERSION),
|
|
5183
|
+
picks: import_zod11.z.record(import_zod11.z.string().min(1), PickEntrySchema)
|
|
5184
5184
|
});
|
|
5185
5185
|
}
|
|
5186
5186
|
});
|
|
@@ -5316,17 +5316,17 @@ function formatCachedCredentialState(state) {
|
|
|
5316
5316
|
}
|
|
5317
5317
|
return state.status === "fresh" ? `${age}, expires in ${formatAge(state.expiresInMs)}` : `${age}, expired ${formatAge(-state.expiresInMs)} ago`;
|
|
5318
5318
|
}
|
|
5319
|
-
var
|
|
5319
|
+
var import_zod12, MS_PER_UNIT, CachedCredentialSchema;
|
|
5320
5320
|
var init_credentialCache = __esm({
|
|
5321
5321
|
"src/credentialCache.ts"() {
|
|
5322
5322
|
"use strict";
|
|
5323
|
-
|
|
5323
|
+
import_zod12 = require("zod");
|
|
5324
5324
|
init_schema();
|
|
5325
5325
|
init_preflight();
|
|
5326
5326
|
MS_PER_UNIT = { s: 1e3, m: 6e4, h: 36e5, d: 864e5 };
|
|
5327
|
-
CachedCredentialSchema =
|
|
5328
|
-
token:
|
|
5329
|
-
fetchedAt:
|
|
5327
|
+
CachedCredentialSchema = import_zod12.z.strictObject({
|
|
5328
|
+
token: import_zod12.z.string().min(1),
|
|
5329
|
+
fetchedAt: import_zod12.z.number().int().nonnegative(),
|
|
5330
5330
|
source: CredentialSourceSchema
|
|
5331
5331
|
});
|
|
5332
5332
|
}
|
|
@@ -5352,7 +5352,7 @@ function requireKeychain() {
|
|
|
5352
5352
|
}
|
|
5353
5353
|
}
|
|
5354
5354
|
function security(args, stdin) {
|
|
5355
|
-
const result = (0,
|
|
5355
|
+
const result = (0, import_node_child_process3.spawnSync)("security", args, { encoding: "utf8", ...stdin === void 0 ? {} : { input: stdin }, stdio: ["pipe", "pipe", "ignore"] });
|
|
5356
5356
|
return { status: result.status, stdout: result.stdout };
|
|
5357
5357
|
}
|
|
5358
5358
|
function createRealCredentialCache(root) {
|
|
@@ -5403,11 +5403,11 @@ function createRealCredentialCache(root) {
|
|
|
5403
5403
|
function realCredentialCacheEnv(paths) {
|
|
5404
5404
|
return { port: createRealCredentialCache(paths.root), platform: process.platform, now: () => Date.now() };
|
|
5405
5405
|
}
|
|
5406
|
-
var
|
|
5406
|
+
var import_node_child_process3, import_node_fs5, import_node_path23, KEYCHAIN_CACHE_SERVICE, CACHE_DIR_MODE, CACHE_FILE_MODE;
|
|
5407
5407
|
var init_realCredentialCache = __esm({
|
|
5408
5408
|
"src/realCredentialCache.ts"() {
|
|
5409
5409
|
"use strict";
|
|
5410
|
-
|
|
5410
|
+
import_node_child_process3 = require("node:child_process");
|
|
5411
5411
|
import_node_fs5 = __toESM(require("node:fs"), 1);
|
|
5412
5412
|
import_node_path23 = __toESM(require("node:path"), 1);
|
|
5413
5413
|
init_credentialCache();
|
|
@@ -5928,7 +5928,7 @@ var init_envBool = __esm({
|
|
|
5928
5928
|
});
|
|
5929
5929
|
|
|
5930
5930
|
// src/launcher/claudeVersion.ts
|
|
5931
|
-
function
|
|
5931
|
+
function validated2(value, origin) {
|
|
5932
5932
|
if (!NUMERIC_DOTTED_VERSION_RE.test(value)) {
|
|
5933
5933
|
throw new InvalidClaudeVersionError(value, origin);
|
|
5934
5934
|
}
|
|
@@ -5936,11 +5936,11 @@ function validated(value, origin) {
|
|
|
5936
5936
|
}
|
|
5937
5937
|
function resolveClaudeVersion(params) {
|
|
5938
5938
|
if (params.flag !== void 0) {
|
|
5939
|
-
return { version:
|
|
5939
|
+
return { version: validated2(params.flag, "--claude-version"), source: "flag" };
|
|
5940
5940
|
}
|
|
5941
5941
|
const fromEnv = params.env.AGENT_SHIM_CLAUDE_VERSION;
|
|
5942
5942
|
if (fromEnv !== void 0 && fromEnv !== "") {
|
|
5943
|
-
return { version:
|
|
5943
|
+
return { version: validated2(fromEnv, "AGENT_SHIM_CLAUDE_VERSION"), source: "environment" };
|
|
5944
5944
|
}
|
|
5945
5945
|
return params.cascade === void 0 ? void 0 : { version: params.cascade, source: "cascade" };
|
|
5946
5946
|
}
|
|
@@ -6067,21 +6067,21 @@ function findPathShadow(params) {
|
|
|
6067
6067
|
}
|
|
6068
6068
|
return params.pathDirs.some((dir) => import_node_path26.default.resolve(dir) === resolvedTargetDir) ? { status: "ok" } : { status: "not-on-path" };
|
|
6069
6069
|
}
|
|
6070
|
-
var import_node_fs7, import_node_path26,
|
|
6070
|
+
var import_node_fs7, import_node_path26, import_zod16, ClaudeShimStateSchema, nodeLinkFs;
|
|
6071
6071
|
var init_claudeShim = __esm({
|
|
6072
6072
|
"src/claudeShim.ts"() {
|
|
6073
6073
|
"use strict";
|
|
6074
6074
|
import_node_fs7 = __toESM(require("node:fs"), 1);
|
|
6075
6075
|
import_node_path26 = __toESM(require("node:path"), 1);
|
|
6076
|
-
|
|
6076
|
+
import_zod16 = require("zod");
|
|
6077
6077
|
init_commandDeps();
|
|
6078
6078
|
init_store();
|
|
6079
6079
|
init_realPorts();
|
|
6080
6080
|
init_cliError();
|
|
6081
|
-
ClaudeShimStateSchema =
|
|
6082
|
-
targetPath:
|
|
6083
|
-
method:
|
|
6084
|
-
installedAtMs:
|
|
6081
|
+
ClaudeShimStateSchema = import_zod16.z.strictObject({
|
|
6082
|
+
targetPath: import_zod16.z.string().min(1),
|
|
6083
|
+
method: import_zod16.z.enum(["hardlink", "copy"]),
|
|
6084
|
+
installedAtMs: import_zod16.z.number()
|
|
6085
6085
|
});
|
|
6086
6086
|
nodeLinkFs = { link: import_node_fs7.default.linkSync, copyFile: import_node_fs7.default.copyFileSync, chmod: import_node_fs7.default.chmodSync };
|
|
6087
6087
|
}
|
|
@@ -7207,10 +7207,10 @@ function resolveLaunch(params) {
|
|
|
7207
7207
|
environment
|
|
7208
7208
|
};
|
|
7209
7209
|
}
|
|
7210
|
-
function runLaunchPlan(plan,
|
|
7210
|
+
function runLaunchPlan(plan, spawn3) {
|
|
7211
7211
|
try {
|
|
7212
7212
|
plan.markChildStarted();
|
|
7213
|
-
const result =
|
|
7213
|
+
const result = spawn3.spawnSync(plan.bin, plan.args, { stdio: "inherit", env: plan.env });
|
|
7214
7214
|
if (result.error !== void 0) {
|
|
7215
7215
|
throw result.error;
|
|
7216
7216
|
}
|
|
@@ -7717,11 +7717,11 @@ var init_anthropicUsageRefresh = __esm({
|
|
|
7717
7717
|
});
|
|
7718
7718
|
|
|
7719
7719
|
// src/usage/providerQuota.ts
|
|
7720
|
-
var
|
|
7720
|
+
var import_zod24, MS_PER_SECOND7, SECONDS_PER_HOUR, HOURS_PER_DAY3, 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;
|
|
7721
7721
|
var init_providerQuota = __esm({
|
|
7722
7722
|
"src/usage/providerQuota.ts"() {
|
|
7723
7723
|
"use strict";
|
|
7724
|
-
|
|
7724
|
+
import_zod24 = require("zod");
|
|
7725
7725
|
init_schema2();
|
|
7726
7726
|
MS_PER_SECOND7 = 1e3;
|
|
7727
7727
|
SECONDS_PER_HOUR = 3600;
|
|
@@ -7735,35 +7735,35 @@ var init_providerQuota = __esm({
|
|
|
7735
7735
|
[ZAI_UNIT_HOURS, SECONDS_PER_HOUR * MS_PER_SECOND7],
|
|
7736
7736
|
[ZAI_UNIT_MONTHS, DAYS_PER_MONTH * HOURS_PER_DAY3 * SECONDS_PER_HOUR * MS_PER_SECOND7]
|
|
7737
7737
|
]);
|
|
7738
|
-
ZaiLimitSchema =
|
|
7739
|
-
type:
|
|
7740
|
-
unit:
|
|
7741
|
-
number:
|
|
7742
|
-
percentage:
|
|
7743
|
-
nextResetTime:
|
|
7744
|
-
usage:
|
|
7745
|
-
currentValue:
|
|
7746
|
-
remaining:
|
|
7738
|
+
ZaiLimitSchema = import_zod24.z.object({
|
|
7739
|
+
type: import_zod24.z.string(),
|
|
7740
|
+
unit: import_zod24.z.number().int(),
|
|
7741
|
+
number: import_zod24.z.number().int().positive(),
|
|
7742
|
+
percentage: import_zod24.z.number().nonnegative(),
|
|
7743
|
+
nextResetTime: import_zod24.z.number().positive().optional(),
|
|
7744
|
+
usage: import_zod24.z.number().nonnegative().optional(),
|
|
7745
|
+
currentValue: import_zod24.z.number().nonnegative().optional(),
|
|
7746
|
+
remaining: import_zod24.z.number().nonnegative().optional()
|
|
7747
7747
|
});
|
|
7748
|
-
ZaiResponseSchema =
|
|
7749
|
-
success:
|
|
7750
|
-
msg:
|
|
7751
|
-
data:
|
|
7748
|
+
ZaiResponseSchema = import_zod24.z.object({
|
|
7749
|
+
success: import_zod24.z.boolean(),
|
|
7750
|
+
msg: import_zod24.z.string().optional(),
|
|
7751
|
+
data: import_zod24.z.object({ level: import_zod24.z.string().optional(), limits: import_zod24.z.array(ZaiLimitSchema) })
|
|
7752
7752
|
});
|
|
7753
7753
|
OPENROUTER_HOST = "openrouter.ai";
|
|
7754
7754
|
OPENROUTER_KEY_URL = `https://${OPENROUTER_HOST}/api/v1/key`;
|
|
7755
7755
|
OPENROUTER_CREDITS_URL = `https://${OPENROUTER_HOST}/api/v1/credits`;
|
|
7756
7756
|
MS_PER_DAY3 = HOURS_PER_DAY3 * SECONDS_PER_HOUR * MS_PER_SECOND7;
|
|
7757
|
-
OpenRouterKeySchema =
|
|
7758
|
-
data:
|
|
7759
|
-
limit:
|
|
7760
|
-
limit_remaining:
|
|
7761
|
-
limit_reset:
|
|
7762
|
-
is_free_tier:
|
|
7763
|
-
free_model_daily_requests:
|
|
7757
|
+
OpenRouterKeySchema = import_zod24.z.object({
|
|
7758
|
+
data: import_zod24.z.object({
|
|
7759
|
+
limit: import_zod24.z.number().nonnegative().nullable(),
|
|
7760
|
+
limit_remaining: import_zod24.z.number().nullable(),
|
|
7761
|
+
limit_reset: import_zod24.z.string().nullable(),
|
|
7762
|
+
is_free_tier: import_zod24.z.boolean().optional(),
|
|
7763
|
+
free_model_daily_requests: import_zod24.z.object({ used: import_zod24.z.number().nonnegative(), limit: import_zod24.z.number().nonnegative(), remaining: import_zod24.z.number() }).optional()
|
|
7764
7764
|
})
|
|
7765
7765
|
});
|
|
7766
|
-
OpenRouterCreditsSchema =
|
|
7766
|
+
OpenRouterCreditsSchema = import_zod24.z.object({ data: import_zod24.z.object({ total_credits: import_zod24.z.number().nonnegative(), total_usage: import_zod24.z.number().nonnegative() }) });
|
|
7767
7767
|
}
|
|
7768
7768
|
});
|
|
7769
7769
|
|
|
@@ -7885,6 +7885,8 @@ var index_exports = {};
|
|
|
7885
7885
|
__export(index_exports, {
|
|
7886
7886
|
AMBIENT_CREDENTIAL_VARS: () => AMBIENT_CREDENTIAL_VARS,
|
|
7887
7887
|
CHECK_CREDENTIAL_APPLIES: () => CHECK_CREDENTIAL_APPLIES,
|
|
7888
|
+
CODEX_APP_SERVER_GENERATED_AGAINST: () => CODEX_APP_SERVER_GENERATED_AGAINST,
|
|
7889
|
+
CODEX_APP_SERVER_TIMEOUT_MS: () => CODEX_APP_SERVER_TIMEOUT_MS,
|
|
7888
7890
|
CONNECT_INTERCEPT_HOST: () => CONNECT_INTERCEPT_HOST,
|
|
7889
7891
|
CONNECT_INTERCEPT_HOSTS: () => CONNECT_INTERCEPT_HOSTS,
|
|
7890
7892
|
CONNECT_LIMITS: () => CONNECT_LIMITS,
|
|
@@ -7895,7 +7897,12 @@ __export(index_exports, {
|
|
|
7895
7897
|
CheckReportJsonSchema: () => CheckReportJsonSchema,
|
|
7896
7898
|
CheckRunInputSchema: () => CheckRunInputSchema,
|
|
7897
7899
|
CliError: () => CliError,
|
|
7900
|
+
CodexAccountReadSchema: () => CodexAccountReadSchema,
|
|
7901
|
+
CodexAppServerProtocolError: () => CodexAppServerProtocolError,
|
|
7902
|
+
CodexAppServerRequestError: () => CodexAppServerRequestError,
|
|
7903
|
+
CodexAppServerUnavailableError: () => CodexAppServerUnavailableError,
|
|
7898
7904
|
CodexLogoutOutputSchema: () => CodexLogoutOutputSchema,
|
|
7905
|
+
CodexRateLimitsReadSchema: () => CodexRateLimitsReadSchema,
|
|
7899
7906
|
CodexSignInSchema: () => CodexSignInSchema,
|
|
7900
7907
|
CodexStatusOutputSchema: () => CodexStatusOutputSchema,
|
|
7901
7908
|
ConfigIdentityAddOutputSchema: () => ConfigIdentityAddOutputSchema,
|
|
@@ -8153,6 +8160,8 @@ __export(index_exports, {
|
|
|
8153
8160
|
rcSelfHostFromEnv: () => rcSelfHostFromEnv,
|
|
8154
8161
|
rcWebFetchAllowsPrivateFromEnv: () => rcWebFetchAllowsPrivateFromEnv,
|
|
8155
8162
|
readActiveIdentity: () => readActiveIdentity2,
|
|
8163
|
+
readCodexAccount: () => readCodexAccount,
|
|
8164
|
+
readCodexRateLimits: () => readCodexRateLimits,
|
|
8156
8165
|
readDirectoryRules: () => readDirectoryRules,
|
|
8157
8166
|
readFarmManifest: () => readFarmManifest,
|
|
8158
8167
|
readFrontDoorControlMaterial: () => readFrontDoorControlMaterial,
|
|
@@ -8164,6 +8173,7 @@ __export(index_exports, {
|
|
|
8164
8173
|
readRcSelfHostRecord: () => readRcSelfHostRecord,
|
|
8165
8174
|
readRcSessionFile: () => readRcSessionFile,
|
|
8166
8175
|
readUsageSnapshot: () => readUsageSnapshot,
|
|
8176
|
+
realCodexAppServerPort: () => realCodexAppServerPort,
|
|
8167
8177
|
realConnectCertStore: () => realConnectCertStore,
|
|
8168
8178
|
realConnectEffects: () => realConnectEffects,
|
|
8169
8179
|
realRcControlTransport: () => realRcControlTransport,
|
|
@@ -11268,6 +11278,242 @@ function frontDoorRcApiClient(port, ca, token) {
|
|
|
11268
11278
|
return (0, import_client.createORPCClient)(frontDoorApiLink(port, ca, token));
|
|
11269
11279
|
}
|
|
11270
11280
|
|
|
11281
|
+
// src/codex/appServer.ts
|
|
11282
|
+
init_cliError();
|
|
11283
|
+
init_package();
|
|
11284
|
+
|
|
11285
|
+
// src/codex/appServerSchemas.ts
|
|
11286
|
+
var import_zod5 = require("zod");
|
|
11287
|
+
var CODEX_APP_SERVER_GENERATED_AGAINST = "0.160.0";
|
|
11288
|
+
var RateLimitWindowSchema = import_zod5.z.object({
|
|
11289
|
+
usedPercent: import_zod5.z.number(),
|
|
11290
|
+
resetsAt: import_zod5.z.number().nullish(),
|
|
11291
|
+
windowDurationMins: import_zod5.z.number().nullish()
|
|
11292
|
+
});
|
|
11293
|
+
var RateLimitSnapshotSchema = import_zod5.z.object({
|
|
11294
|
+
limitId: import_zod5.z.string().nullish(),
|
|
11295
|
+
limitName: import_zod5.z.string().nullish(),
|
|
11296
|
+
planType: import_zod5.z.string().nullish(),
|
|
11297
|
+
primary: RateLimitWindowSchema.nullish(),
|
|
11298
|
+
secondary: RateLimitWindowSchema.nullish(),
|
|
11299
|
+
rateLimitReachedType: import_zod5.z.string().nullish(),
|
|
11300
|
+
spendControlReached: import_zod5.z.boolean().nullish()
|
|
11301
|
+
});
|
|
11302
|
+
var RateLimitResetCreditSchema = import_zod5.z.object({
|
|
11303
|
+
id: import_zod5.z.string(),
|
|
11304
|
+
grantedAt: import_zod5.z.number(),
|
|
11305
|
+
expiresAt: import_zod5.z.number().nullish(),
|
|
11306
|
+
resetType: import_zod5.z.string(),
|
|
11307
|
+
status: import_zod5.z.string(),
|
|
11308
|
+
title: import_zod5.z.string().nullish(),
|
|
11309
|
+
description: import_zod5.z.string().nullish()
|
|
11310
|
+
});
|
|
11311
|
+
var CodexAccountSchema = import_zod5.z.discriminatedUnion("type", [
|
|
11312
|
+
import_zod5.z.object({ type: import_zod5.z.literal("apiKey") }),
|
|
11313
|
+
import_zod5.z.object({ type: import_zod5.z.literal("chatgpt"), email: import_zod5.z.string().nullable(), planType: import_zod5.z.string() }),
|
|
11314
|
+
import_zod5.z.object({ type: import_zod5.z.literal("amazonBedrock"), usesCodexManagedCredentials: import_zod5.z.boolean().default(false) })
|
|
11315
|
+
]);
|
|
11316
|
+
var CodexAccountReadSchema = import_zod5.z.object({
|
|
11317
|
+
account: CodexAccountSchema.nullable(),
|
|
11318
|
+
requiresOpenaiAuth: import_zod5.z.boolean()
|
|
11319
|
+
});
|
|
11320
|
+
var CodexRateLimitsReadSchema = import_zod5.z.object({
|
|
11321
|
+
rateLimits: RateLimitSnapshotSchema,
|
|
11322
|
+
rateLimitsByLimitId: import_zod5.z.record(import_zod5.z.string(), RateLimitSnapshotSchema).nullish(),
|
|
11323
|
+
rateLimitResetCredits: import_zod5.z.object({ availableCount: import_zod5.z.number(), credits: import_zod5.z.array(RateLimitResetCreditSchema).nullish() }).nullish(),
|
|
11324
|
+
accountId: import_zod5.z.string().nullish(),
|
|
11325
|
+
ordinaryUsageAllowed: import_zod5.z.boolean().nullish()
|
|
11326
|
+
});
|
|
11327
|
+
var CodexInitializeResultSchema = import_zod5.z.object({ userAgent: import_zod5.z.string() });
|
|
11328
|
+
|
|
11329
|
+
// src/codex/appServer.ts
|
|
11330
|
+
var CodexAppServerUnavailableError = class extends CliError {
|
|
11331
|
+
constructor(detail) {
|
|
11332
|
+
super(`The Codex app-server is not available: ${detail}.`);
|
|
11333
|
+
this.name = "CodexAppServerUnavailableError";
|
|
11334
|
+
}
|
|
11335
|
+
};
|
|
11336
|
+
var CodexAppServerRequestError = class extends CliError {
|
|
11337
|
+
constructor(method, rpcCode, detail) {
|
|
11338
|
+
super(`Codex app-server ${method} failed (${String(rpcCode)}): ${detail}`);
|
|
11339
|
+
this.method = method;
|
|
11340
|
+
this.rpcCode = rpcCode;
|
|
11341
|
+
this.name = "CodexAppServerRequestError";
|
|
11342
|
+
}
|
|
11343
|
+
method;
|
|
11344
|
+
rpcCode;
|
|
11345
|
+
};
|
|
11346
|
+
var CodexAppServerProtocolError = class extends CliError {
|
|
11347
|
+
constructor(method, installedVersion, detail) {
|
|
11348
|
+
super(
|
|
11349
|
+
`Codex app-server ${method} answered in a shape this reader does not know (installed Codex ${installedVersion ?? "of unknown version"}, shapes generated against ${CODEX_APP_SERVER_GENERATED_AGAINST}): ${detail}`
|
|
11350
|
+
);
|
|
11351
|
+
this.method = method;
|
|
11352
|
+
this.installedVersion = installedVersion;
|
|
11353
|
+
this.name = "CodexAppServerProtocolError";
|
|
11354
|
+
}
|
|
11355
|
+
method;
|
|
11356
|
+
installedVersion;
|
|
11357
|
+
};
|
|
11358
|
+
var CODEX_APP_SERVER_TIMEOUT_MS = 3e4;
|
|
11359
|
+
var CLIENT_NAME = "agent-shim";
|
|
11360
|
+
function installedVersionOf(userAgent) {
|
|
11361
|
+
return /^[^/\s]+\/(\S+)/.exec(userAgent)?.[1];
|
|
11362
|
+
}
|
|
11363
|
+
function responseTo(message, id) {
|
|
11364
|
+
if (typeof message !== "object" || message === null || !("id" in message) || message.id !== id) {
|
|
11365
|
+
return void 0;
|
|
11366
|
+
}
|
|
11367
|
+
if ("error" in message && typeof message.error === "object" && message.error !== null) {
|
|
11368
|
+
const { error } = message;
|
|
11369
|
+
const code = "code" in error && typeof error.code === "number" ? error.code : 0;
|
|
11370
|
+
const detail = "message" in error && typeof error.message === "string" ? error.message : "no message";
|
|
11371
|
+
return { error: { code, message: detail } };
|
|
11372
|
+
}
|
|
11373
|
+
return "result" in message ? { result: message.result } : void 0;
|
|
11374
|
+
}
|
|
11375
|
+
async function withAppServer(port, options, ask) {
|
|
11376
|
+
const connection = await port.open({ bin: options.bin ?? "codex", codexHome: options.codexHome });
|
|
11377
|
+
let nextId = 0;
|
|
11378
|
+
const timeoutMs = options.timeoutMs ?? CODEX_APP_SERVER_TIMEOUT_MS;
|
|
11379
|
+
const stopper = AbortSignal.any([...options.signal === void 0 ? [] : [options.signal], AbortSignal.timeout(timeoutMs)]);
|
|
11380
|
+
const stopReason = () => {
|
|
11381
|
+
if (options.signal?.aborted !== true) {
|
|
11382
|
+
return new CodexAppServerUnavailableError(`it did not answer within ${String(timeoutMs)} ms`);
|
|
11383
|
+
}
|
|
11384
|
+
const reason = options.signal.reason;
|
|
11385
|
+
return reason instanceof Error ? reason : new Error(`the Codex app-server read was aborted: ${String(reason)}`);
|
|
11386
|
+
};
|
|
11387
|
+
const aborted = new Promise((_resolve, reject) => {
|
|
11388
|
+
if (stopper.aborted) {
|
|
11389
|
+
reject(stopReason());
|
|
11390
|
+
return;
|
|
11391
|
+
}
|
|
11392
|
+
stopper.addEventListener(
|
|
11393
|
+
"abort",
|
|
11394
|
+
() => {
|
|
11395
|
+
reject(stopReason());
|
|
11396
|
+
},
|
|
11397
|
+
{ once: true }
|
|
11398
|
+
);
|
|
11399
|
+
});
|
|
11400
|
+
aborted.catch(() => void 0);
|
|
11401
|
+
const request4 = async (method, params) => {
|
|
11402
|
+
nextId += 1;
|
|
11403
|
+
const id = nextId;
|
|
11404
|
+
connection.send({ jsonrpc: "2.0", id, method, params });
|
|
11405
|
+
for (; ; ) {
|
|
11406
|
+
const message = await Promise.race([connection.receive(), aborted]);
|
|
11407
|
+
if (message === void 0) {
|
|
11408
|
+
throw new CodexAppServerUnavailableError(`it ended before answering ${method}`);
|
|
11409
|
+
}
|
|
11410
|
+
const response = responseTo(message, id);
|
|
11411
|
+
if (response === void 0) {
|
|
11412
|
+
continue;
|
|
11413
|
+
}
|
|
11414
|
+
if ("error" in response) {
|
|
11415
|
+
throw new CodexAppServerRequestError(method, response.error.code, response.error.message);
|
|
11416
|
+
}
|
|
11417
|
+
return response.result;
|
|
11418
|
+
}
|
|
11419
|
+
};
|
|
11420
|
+
try {
|
|
11421
|
+
const initialised = CodexInitializeResultSchema.safeParse(await request4("initialize", { clientInfo: { name: CLIENT_NAME, title: null, version: package_default.version } }));
|
|
11422
|
+
if (!initialised.success) {
|
|
11423
|
+
throw new CodexAppServerProtocolError("initialize", void 0, initialised.error.message);
|
|
11424
|
+
}
|
|
11425
|
+
connection.send({ jsonrpc: "2.0", method: "initialized" });
|
|
11426
|
+
return await ask(request4, installedVersionOf(initialised.data.userAgent));
|
|
11427
|
+
} finally {
|
|
11428
|
+
await connection.close();
|
|
11429
|
+
}
|
|
11430
|
+
}
|
|
11431
|
+
function validated(method, installedVersion, schema, value) {
|
|
11432
|
+
const parsed = schema.safeParse(value);
|
|
11433
|
+
if (!parsed.success) {
|
|
11434
|
+
throw new CodexAppServerProtocolError(method, installedVersion, parsed.error.message);
|
|
11435
|
+
}
|
|
11436
|
+
return parsed.data;
|
|
11437
|
+
}
|
|
11438
|
+
async function readCodexAccount(port, options) {
|
|
11439
|
+
return await withAppServer(port, options, async (request4, version) => validated("account/read", version, CodexAccountReadSchema, await request4("account/read", { refreshToken: false })));
|
|
11440
|
+
}
|
|
11441
|
+
async function readCodexRateLimits(port, options) {
|
|
11442
|
+
return await withAppServer(port, options, async (request4, version) => validated("account/rateLimits/read", version, CodexRateLimitsReadSchema, await request4("account/rateLimits/read", void 0)));
|
|
11443
|
+
}
|
|
11444
|
+
|
|
11445
|
+
// src/codex/realAppServer.ts
|
|
11446
|
+
var import_node_child_process = require("node:child_process");
|
|
11447
|
+
var import_node_readline = __toESM(require("node:readline"), 1);
|
|
11448
|
+
var SHUTDOWN_GRACE_MS = 5e3;
|
|
11449
|
+
var realCodexAppServerPort = {
|
|
11450
|
+
open: async ({ bin, codexHome }) => {
|
|
11451
|
+
const child = (0, import_node_child_process.spawn)(bin, ["app-server"], { stdio: ["pipe", "pipe", "ignore"], env: { ...process.env, CODEX_HOME: codexHome } });
|
|
11452
|
+
await new Promise((resolve, reject) => {
|
|
11453
|
+
child.once("spawn", resolve);
|
|
11454
|
+
child.once("error", (error) => {
|
|
11455
|
+
reject(new CodexAppServerUnavailableError(`${bin} could not be started (${error.message})`));
|
|
11456
|
+
});
|
|
11457
|
+
});
|
|
11458
|
+
const exited = new Promise((resolve) => {
|
|
11459
|
+
child.once("exit", () => {
|
|
11460
|
+
resolve();
|
|
11461
|
+
});
|
|
11462
|
+
});
|
|
11463
|
+
const pending = [];
|
|
11464
|
+
const waiting = [];
|
|
11465
|
+
let ended = false;
|
|
11466
|
+
const deliver = (message) => {
|
|
11467
|
+
const waiter = waiting.shift();
|
|
11468
|
+
if (waiter === void 0) {
|
|
11469
|
+
pending.push(message);
|
|
11470
|
+
} else {
|
|
11471
|
+
waiter(message);
|
|
11472
|
+
}
|
|
11473
|
+
};
|
|
11474
|
+
const lines = import_node_readline.default.createInterface({ input: child.stdout });
|
|
11475
|
+
lines.on("line", (line) => {
|
|
11476
|
+
try {
|
|
11477
|
+
deliver(JSON.parse(line));
|
|
11478
|
+
} catch {
|
|
11479
|
+
}
|
|
11480
|
+
});
|
|
11481
|
+
lines.on("close", () => {
|
|
11482
|
+
ended = true;
|
|
11483
|
+
for (const waiter of waiting.splice(0)) {
|
|
11484
|
+
waiter(void 0);
|
|
11485
|
+
}
|
|
11486
|
+
});
|
|
11487
|
+
const connection = {
|
|
11488
|
+
send: (message) => {
|
|
11489
|
+
child.stdin.write(`${JSON.stringify(message)}
|
|
11490
|
+
`);
|
|
11491
|
+
},
|
|
11492
|
+
receive: async () => {
|
|
11493
|
+
if (pending.length > 0) {
|
|
11494
|
+
return pending.shift();
|
|
11495
|
+
}
|
|
11496
|
+
if (ended) {
|
|
11497
|
+
return void 0;
|
|
11498
|
+
}
|
|
11499
|
+
return await new Promise((resolve) => {
|
|
11500
|
+
waiting.push(resolve);
|
|
11501
|
+
});
|
|
11502
|
+
},
|
|
11503
|
+
close: async () => {
|
|
11504
|
+
child.stdin.end();
|
|
11505
|
+
const timer = setTimeout(() => {
|
|
11506
|
+
child.kill("SIGKILL");
|
|
11507
|
+
}, SHUTDOWN_GRACE_MS);
|
|
11508
|
+
await exited;
|
|
11509
|
+
clearTimeout(timer);
|
|
11510
|
+
lines.close();
|
|
11511
|
+
}
|
|
11512
|
+
};
|
|
11513
|
+
return connection;
|
|
11514
|
+
}
|
|
11515
|
+
};
|
|
11516
|
+
|
|
11271
11517
|
// src/frontdoor/doorClient.ts
|
|
11272
11518
|
init_cliError();
|
|
11273
11519
|
init_realPorts();
|
|
@@ -11655,7 +11901,7 @@ init_realCredentialCache();
|
|
|
11655
11901
|
init_providersStore();
|
|
11656
11902
|
init_realPorts();
|
|
11657
11903
|
var import_node_path25 = __toESM(require("node:path"), 1);
|
|
11658
|
-
var
|
|
11904
|
+
var import_zod13 = require("zod");
|
|
11659
11905
|
init_envBool();
|
|
11660
11906
|
init_load();
|
|
11661
11907
|
init_schema();
|
|
@@ -11743,9 +11989,9 @@ function lookupKeychainService(run, farmRoot) {
|
|
|
11743
11989
|
note: serviceName === void 0 ? `A Keychain entry was found for account "${farmRoot}" but its service name could not be parsed from security's output.` : `Keychain service name for this identity: "${serviceName}".`
|
|
11744
11990
|
};
|
|
11745
11991
|
}
|
|
11746
|
-
var SettingsSecretsShapeSchema =
|
|
11747
|
-
env:
|
|
11748
|
-
hooks:
|
|
11992
|
+
var SettingsSecretsShapeSchema = import_zod13.z.looseObject({
|
|
11993
|
+
env: import_zod13.z.record(import_zod13.z.string(), import_zod13.z.unknown()).optional(),
|
|
11994
|
+
hooks: import_zod13.z.record(import_zod13.z.string(), import_zod13.z.array(import_zod13.z.unknown())).optional()
|
|
11749
11995
|
});
|
|
11750
11996
|
function hookCommandCountOf(group) {
|
|
11751
11997
|
if (typeof group !== "object" || group === null) {
|
|
@@ -12037,7 +12283,7 @@ function collectCheckReport(params) {
|
|
|
12037
12283
|
}
|
|
12038
12284
|
|
|
12039
12285
|
// src/checkReportSchema.ts
|
|
12040
|
-
var
|
|
12286
|
+
var import_zod15 = require("zod");
|
|
12041
12287
|
init_schema();
|
|
12042
12288
|
init_claudeVersion();
|
|
12043
12289
|
init_identity();
|
|
@@ -12101,124 +12347,124 @@ var DIAGNOSTIC_CODES = [
|
|
|
12101
12347
|
var DIAGNOSTIC_SEVERITIES = ["error", "warning", "info"];
|
|
12102
12348
|
|
|
12103
12349
|
// src/usage/pickReportSchema.ts
|
|
12104
|
-
var
|
|
12350
|
+
var import_zod14 = require("zod");
|
|
12105
12351
|
init_plan2();
|
|
12106
|
-
var PoolPickCandidateViewSchema =
|
|
12107
|
-
identity:
|
|
12352
|
+
var PoolPickCandidateViewSchema = import_zod14.z.strictObject({
|
|
12353
|
+
identity: import_zod14.z.string(),
|
|
12108
12354
|
/** In pick order: `scored` has usable quota data, `unknown` has none, `pay-per-use` bills by use, `ineligible` is refused right now. */
|
|
12109
|
-
class:
|
|
12355
|
+
class: import_zod14.z.enum(["scored", "unknown", "pay-per-use", "ineligible"]),
|
|
12110
12356
|
/** Plan-size-weighted remaining quota per hour until its reset; present for `scored` only. */
|
|
12111
|
-
score:
|
|
12357
|
+
score: import_zod14.z.number().optional(),
|
|
12112
12358
|
/** Which window's reset divides the score: the seven-day window, or the five-hour one when the member reports no seven-day utilisation; present with `score`. */
|
|
12113
|
-
scoreWindow:
|
|
12359
|
+
scoreWindow: import_zod14.z.enum(["sevenDay", "fiveHour"]).optional(),
|
|
12114
12360
|
/** False when the five-hour window would run dry, at the observed pace, before it resets. */
|
|
12115
|
-
feasible:
|
|
12361
|
+
feasible: import_zod14.z.boolean(),
|
|
12116
12362
|
/** When an `ineligible` member can be used again, as an ISO instant. */
|
|
12117
|
-
blockedUntil:
|
|
12363
|
+
blockedUntil: import_zod14.z.iso.datetime().optional(),
|
|
12118
12364
|
plan: PlanClassSchema,
|
|
12119
12365
|
/** The facts behind the class and score, in the order they matter. */
|
|
12120
|
-
reasons:
|
|
12366
|
+
reasons: import_zod14.z.array(import_zod14.z.string())
|
|
12121
12367
|
});
|
|
12122
|
-
var PoolPickReportSchema =
|
|
12123
|
-
pool:
|
|
12124
|
-
directory:
|
|
12368
|
+
var PoolPickReportSchema = import_zod14.z.strictObject({
|
|
12369
|
+
pool: import_zod14.z.string(),
|
|
12370
|
+
directory: import_zod14.z.string(),
|
|
12125
12371
|
/** The member a launch would run as, absent when every member is refused. */
|
|
12126
|
-
pick:
|
|
12127
|
-
candidates:
|
|
12372
|
+
pick: import_zod14.z.string().optional(),
|
|
12373
|
+
candidates: import_zod14.z.array(PoolPickCandidateViewSchema),
|
|
12128
12374
|
/** Identity members anywhere in the pool's graph that do not exist; a launch skips them. */
|
|
12129
|
-
missing:
|
|
12375
|
+
missing: import_zod14.z.array(import_zod14.z.string()),
|
|
12130
12376
|
/** When nothing can be picked, the soonest any member returns. */
|
|
12131
|
-
earliestReturn:
|
|
12377
|
+
earliestReturn: import_zod14.z.strictObject({ identity: import_zod14.z.string(), at: import_zod14.z.iso.datetime() }).optional(),
|
|
12132
12378
|
/** The member a resumed conversation started on but moved off, and why, when the ranking could not keep it. */
|
|
12133
|
-
movedOff:
|
|
12379
|
+
movedOff: import_zod14.z.strictObject({ identity: import_zod14.z.string(), reason: import_zod14.z.string() }).optional(),
|
|
12134
12380
|
/** Why the last-pick record could not be read, when that is the case. */
|
|
12135
|
-
stickyProblem:
|
|
12381
|
+
stickyProblem: import_zod14.z.string().optional()
|
|
12136
12382
|
});
|
|
12137
12383
|
|
|
12138
12384
|
// src/checkReportSchema.ts
|
|
12139
12385
|
var CHECK_CREDENTIAL_APPLIES = ["provider", "identity", "stored-login"];
|
|
12140
|
-
var CheckLayerViewSchema =
|
|
12141
|
-
id:
|
|
12142
|
-
kind:
|
|
12143
|
-
source:
|
|
12386
|
+
var CheckLayerViewSchema = import_zod15.z.strictObject({
|
|
12387
|
+
id: import_zod15.z.int(),
|
|
12388
|
+
kind: import_zod15.z.enum(LAYER_KINDS),
|
|
12389
|
+
source: import_zod15.z.string()
|
|
12144
12390
|
});
|
|
12145
|
-
var CheckEntryViewSchema =
|
|
12146
|
-
path:
|
|
12147
|
-
shared:
|
|
12148
|
-
via:
|
|
12391
|
+
var CheckEntryViewSchema = import_zod15.z.strictObject({
|
|
12392
|
+
path: import_zod15.z.string(),
|
|
12393
|
+
shared: import_zod15.z.boolean(),
|
|
12394
|
+
via: import_zod15.z.enum(DECISION_VIAS),
|
|
12149
12395
|
/** The entry's real category, or null when nothing classifies it. */
|
|
12150
|
-
category:
|
|
12151
|
-
rule:
|
|
12396
|
+
category: import_zod15.z.enum(CATEGORY_NAMES).nullable(),
|
|
12397
|
+
rule: import_zod15.z.strictObject({ key: import_zod15.z.string(), layer: import_zod15.z.int() }).optional(),
|
|
12152
12398
|
/** Rules that matched but whose `when` condition failed, each with the conditions that failed. */
|
|
12153
|
-
eliminated:
|
|
12399
|
+
eliminated: import_zod15.z.readonly(import_zod15.z.array(import_zod15.z.strictObject({ key: import_zod15.z.string(), failed: import_zod15.z.readonly(import_zod15.z.array(import_zod15.z.string())) }))).optional()
|
|
12154
12400
|
});
|
|
12155
|
-
var CheckDiagnosticSchema =
|
|
12156
|
-
code:
|
|
12157
|
-
severity:
|
|
12158
|
-
message:
|
|
12159
|
-
subject:
|
|
12160
|
-
layer:
|
|
12401
|
+
var CheckDiagnosticSchema = import_zod15.z.strictObject({
|
|
12402
|
+
code: import_zod15.z.enum(DIAGNOSTIC_CODES),
|
|
12403
|
+
severity: import_zod15.z.enum(DIAGNOSTIC_SEVERITIES),
|
|
12404
|
+
message: import_zod15.z.string(),
|
|
12405
|
+
subject: import_zod15.z.string().optional(),
|
|
12406
|
+
layer: import_zod15.z.int().optional()
|
|
12161
12407
|
});
|
|
12162
|
-
var CheckAmbientCredentialSchema =
|
|
12163
|
-
var CheckKeychainSchema =
|
|
12164
|
-
checked:
|
|
12165
|
-
found:
|
|
12166
|
-
serviceName:
|
|
12167
|
-
note:
|
|
12408
|
+
var CheckAmbientCredentialSchema = import_zod15.z.union([import_zod15.z.strictObject({ ok: import_zod15.z.literal(true) }), import_zod15.z.strictObject({ ok: import_zod15.z.literal(false), variable: import_zod15.z.string(), message: import_zod15.z.string() })]);
|
|
12409
|
+
var CheckKeychainSchema = import_zod15.z.strictObject({
|
|
12410
|
+
checked: import_zod15.z.literal(true),
|
|
12411
|
+
found: import_zod15.z.boolean(),
|
|
12412
|
+
serviceName: import_zod15.z.string().optional(),
|
|
12413
|
+
note: import_zod15.z.string()
|
|
12168
12414
|
});
|
|
12169
|
-
var CheckSettingsExposureSchema =
|
|
12170
|
-
file:
|
|
12171
|
-
envKeyNames:
|
|
12172
|
-
hookEventNames:
|
|
12173
|
-
hookCommandCount:
|
|
12415
|
+
var CheckSettingsExposureSchema = import_zod15.z.strictObject({
|
|
12416
|
+
file: import_zod15.z.string(),
|
|
12417
|
+
envKeyNames: import_zod15.z.readonly(import_zod15.z.array(import_zod15.z.string())),
|
|
12418
|
+
hookEventNames: import_zod15.z.readonly(import_zod15.z.array(import_zod15.z.string())),
|
|
12419
|
+
hookCommandCount: import_zod15.z.int().nonnegative()
|
|
12174
12420
|
});
|
|
12175
|
-
var CredentialSourceSummarySchema =
|
|
12176
|
-
|
|
12177
|
-
|
|
12178
|
-
|
|
12179
|
-
|
|
12180
|
-
|
|
12181
|
-
|
|
12421
|
+
var CredentialSourceSummarySchema = import_zod15.z.union([
|
|
12422
|
+
import_zod15.z.strictObject({ kind: import_zod15.z.literal("env"), variable: import_zod15.z.string() }),
|
|
12423
|
+
import_zod15.z.strictObject({ kind: import_zod15.z.literal("file"), path: import_zod15.z.string() }),
|
|
12424
|
+
import_zod15.z.strictObject({ kind: import_zod15.z.literal("command"), program: import_zod15.z.string() }),
|
|
12425
|
+
import_zod15.z.strictObject({ kind: import_zod15.z.literal("op"), reference: import_zod15.z.string() }),
|
|
12426
|
+
import_zod15.z.strictObject({ kind: import_zod15.z.literal("keychain"), service: import_zod15.z.string(), account: import_zod15.z.string().optional() }),
|
|
12427
|
+
import_zod15.z.strictObject({ kind: import_zod15.z.literal("literal") })
|
|
12182
12428
|
]);
|
|
12183
|
-
var CredentialSummarySchema =
|
|
12184
|
-
target:
|
|
12185
|
-
sources:
|
|
12429
|
+
var CredentialSummarySchema = import_zod15.z.strictObject({
|
|
12430
|
+
target: import_zod15.z.enum(CREDENTIAL_TARGETS),
|
|
12431
|
+
sources: import_zod15.z.readonly(import_zod15.z.array(CredentialSourceSummarySchema)),
|
|
12186
12432
|
cache: CredentialCacheSchema.optional()
|
|
12187
12433
|
});
|
|
12188
|
-
var CachedCredentialStateSchema =
|
|
12189
|
-
|
|
12190
|
-
|
|
12191
|
-
|
|
12434
|
+
var CachedCredentialStateSchema = import_zod15.z.union([
|
|
12435
|
+
import_zod15.z.strictObject({ store: import_zod15.z.enum(CREDENTIAL_CACHE_STORES), status: import_zod15.z.literal("empty") }),
|
|
12436
|
+
import_zod15.z.strictObject({ store: import_zod15.z.enum(CREDENTIAL_CACHE_STORES), status: import_zod15.z.literal("unreadable"), reason: import_zod15.z.string() }),
|
|
12437
|
+
import_zod15.z.strictObject({ store: import_zod15.z.enum(CREDENTIAL_CACHE_STORES), status: import_zod15.z.enum(["fresh", "expired"]), ageMs: import_zod15.z.number(), expiresInMs: import_zod15.z.number().optional() })
|
|
12192
12438
|
]);
|
|
12193
|
-
var CheckCredentialProviderSchema =
|
|
12194
|
-
|
|
12195
|
-
|
|
12439
|
+
var CheckCredentialProviderSchema = import_zod15.z.union([
|
|
12440
|
+
import_zod15.z.strictObject({ name: import_zod15.z.string(), credential: CredentialSummarySchema, cached: CachedCredentialStateSchema.optional() }),
|
|
12441
|
+
import_zod15.z.strictObject({ name: import_zod15.z.string(), problem: import_zod15.z.string() })
|
|
12196
12442
|
]);
|
|
12197
|
-
var CheckCredentialSchema =
|
|
12198
|
-
applies:
|
|
12443
|
+
var CheckCredentialSchema = import_zod15.z.strictObject({
|
|
12444
|
+
applies: import_zod15.z.enum(CHECK_CREDENTIAL_APPLIES),
|
|
12199
12445
|
provider: CheckCredentialProviderSchema.optional(),
|
|
12200
12446
|
identity: CredentialSummarySchema.optional(),
|
|
12201
12447
|
identityCached: CachedCredentialStateSchema.optional()
|
|
12202
12448
|
});
|
|
12203
|
-
var CheckClaudeVersionSchema =
|
|
12204
|
-
pinned:
|
|
12205
|
-
highestInstalled:
|
|
12206
|
-
installed:
|
|
12449
|
+
var CheckClaudeVersionSchema = import_zod15.z.strictObject({
|
|
12450
|
+
pinned: import_zod15.z.strictObject({ version: import_zod15.z.string(), source: import_zod15.z.enum(CLAUDE_VERSION_SOURCES), installed: import_zod15.z.boolean() }).optional(),
|
|
12451
|
+
highestInstalled: import_zod15.z.string().optional(),
|
|
12452
|
+
installed: import_zod15.z.readonly(import_zod15.z.array(import_zod15.z.string()))
|
|
12207
12453
|
});
|
|
12208
|
-
var CheckReportJsonSchema =
|
|
12209
|
-
identity:
|
|
12454
|
+
var CheckReportJsonSchema = import_zod15.z.strictObject({
|
|
12455
|
+
identity: import_zod15.z.strictObject({ name: import_zod15.z.string().nullable(), source: import_zod15.z.enum(IDENTITY_DECISION_SOURCES) }),
|
|
12210
12456
|
/** The pool ranking, when the launch named a pool instead of an identity. */
|
|
12211
12457
|
pool: PoolPickReportSchema.optional(),
|
|
12212
|
-
configProfile:
|
|
12213
|
-
layers:
|
|
12214
|
-
entries:
|
|
12215
|
-
projectEncodingAmbiguities:
|
|
12216
|
-
|
|
12458
|
+
configProfile: import_zod15.z.strictObject({ name: import_zod15.z.string().nullable(), source: import_zod15.z.enum(CONFIG_PROFILE_DECISION_SOURCES) }),
|
|
12459
|
+
layers: import_zod15.z.readonly(import_zod15.z.array(CheckLayerViewSchema)),
|
|
12460
|
+
entries: import_zod15.z.readonly(import_zod15.z.array(CheckEntryViewSchema)),
|
|
12461
|
+
projectEncodingAmbiguities: import_zod15.z.readonly(
|
|
12462
|
+
import_zod15.z.array(import_zod15.z.strictObject({ fragment: import_zod15.z.string(), encoded: import_zod15.z.string(), reason: import_zod15.z.enum(ENCODING_AMBIGUITY_REASONS), detail: import_zod15.z.string() }))
|
|
12217
12463
|
),
|
|
12218
|
-
diagnostics:
|
|
12464
|
+
diagnostics: import_zod15.z.readonly(import_zod15.z.array(CheckDiagnosticSchema)),
|
|
12219
12465
|
ambientCredential: CheckAmbientCredentialSchema,
|
|
12220
12466
|
keychain: CheckKeychainSchema.optional(),
|
|
12221
|
-
settingsExposure:
|
|
12467
|
+
settingsExposure: import_zod15.z.readonly(import_zod15.z.array(CheckSettingsExposureSchema)),
|
|
12222
12468
|
credential: CheckCredentialSchema,
|
|
12223
12469
|
claudeVersion: CheckClaudeVersionSchema.optional()
|
|
12224
12470
|
});
|
|
@@ -12229,7 +12475,7 @@ init_preflight();
|
|
|
12229
12475
|
|
|
12230
12476
|
// src/frontdoor/controlSchemas.ts
|
|
12231
12477
|
var import_node_path30 = __toESM(require("node:path"), 1);
|
|
12232
|
-
var
|
|
12478
|
+
var import_zod20 = require("zod");
|
|
12233
12479
|
|
|
12234
12480
|
// src/doctorReport.ts
|
|
12235
12481
|
init_claudeShim();
|
|
@@ -12424,24 +12670,24 @@ function credentialsFilePath(farmRoot) {
|
|
|
12424
12670
|
}
|
|
12425
12671
|
|
|
12426
12672
|
// src/codex/siwcStore.ts
|
|
12427
|
-
var
|
|
12673
|
+
var import_zod19 = require("zod");
|
|
12428
12674
|
|
|
12429
12675
|
// src/codex/auth.ts
|
|
12430
|
-
var
|
|
12431
|
-
var AuthFileSchema =
|
|
12432
|
-
tokens:
|
|
12433
|
-
access_token:
|
|
12434
|
-
refresh_token:
|
|
12435
|
-
id_token:
|
|
12436
|
-
account_id:
|
|
12676
|
+
var import_zod17 = require("zod");
|
|
12677
|
+
var AuthFileSchema = import_zod17.z.looseObject({
|
|
12678
|
+
tokens: import_zod17.z.looseObject({
|
|
12679
|
+
access_token: import_zod17.z.string().optional(),
|
|
12680
|
+
refresh_token: import_zod17.z.string().optional(),
|
|
12681
|
+
id_token: import_zod17.z.string().optional(),
|
|
12682
|
+
account_id: import_zod17.z.string().optional()
|
|
12437
12683
|
}).nullish(),
|
|
12438
|
-
last_refresh:
|
|
12684
|
+
last_refresh: import_zod17.z.string().optional()
|
|
12439
12685
|
});
|
|
12440
|
-
var TokenGrantSchema =
|
|
12441
|
-
access_token:
|
|
12442
|
-
refresh_token:
|
|
12443
|
-
id_token:
|
|
12444
|
-
account_id:
|
|
12686
|
+
var TokenGrantSchema = import_zod17.z.looseObject({
|
|
12687
|
+
access_token: import_zod17.z.string().min(1).optional(),
|
|
12688
|
+
refresh_token: import_zod17.z.string().min(1).optional(),
|
|
12689
|
+
id_token: import_zod17.z.string().min(1).optional(),
|
|
12690
|
+
account_id: import_zod17.z.string().min(1).optional()
|
|
12445
12691
|
});
|
|
12446
12692
|
var CodexAuthError = class extends Error {
|
|
12447
12693
|
constructor(message) {
|
|
@@ -12451,41 +12697,41 @@ var CodexAuthError = class extends Error {
|
|
|
12451
12697
|
};
|
|
12452
12698
|
|
|
12453
12699
|
// src/codex/siwc.ts
|
|
12454
|
-
var
|
|
12700
|
+
var import_zod18 = require("zod");
|
|
12455
12701
|
var SIWC_RESOURCE = "https://api.openai.com/v1";
|
|
12456
12702
|
var SIWC_RESPONSES_URL = `${SIWC_RESOURCE}/responses`;
|
|
12457
12703
|
var SIWC_PLAN_SCOPE = "chatgpt.tokens.use.direct";
|
|
12458
|
-
var TokenResponseSchema =
|
|
12459
|
-
access_token:
|
|
12460
|
-
refresh_token:
|
|
12461
|
-
id_token:
|
|
12462
|
-
expires_in:
|
|
12463
|
-
scope:
|
|
12704
|
+
var TokenResponseSchema = import_zod18.z.looseObject({
|
|
12705
|
+
access_token: import_zod18.z.string().min(1),
|
|
12706
|
+
refresh_token: import_zod18.z.string().min(1).optional(),
|
|
12707
|
+
id_token: import_zod18.z.string().min(1).optional(),
|
|
12708
|
+
expires_in: import_zod18.z.number().positive(),
|
|
12709
|
+
scope: import_zod18.z.string().optional()
|
|
12464
12710
|
});
|
|
12465
|
-
var JwtHeaderSchema =
|
|
12466
|
-
var IdTokenClaimsSchema =
|
|
12467
|
-
iss:
|
|
12468
|
-
sub:
|
|
12469
|
-
aud:
|
|
12470
|
-
exp:
|
|
12471
|
-
nonce:
|
|
12472
|
-
email:
|
|
12711
|
+
var JwtHeaderSchema = import_zod18.z.looseObject({ alg: import_zod18.z.string(), kid: import_zod18.z.string().optional() });
|
|
12712
|
+
var IdTokenClaimsSchema = import_zod18.z.looseObject({
|
|
12713
|
+
iss: import_zod18.z.string(),
|
|
12714
|
+
sub: import_zod18.z.string().min(1),
|
|
12715
|
+
aud: import_zod18.z.union([import_zod18.z.string(), import_zod18.z.array(import_zod18.z.string())]),
|
|
12716
|
+
exp: import_zod18.z.number(),
|
|
12717
|
+
nonce: import_zod18.z.string().optional(),
|
|
12718
|
+
email: import_zod18.z.string().optional()
|
|
12473
12719
|
});
|
|
12474
|
-
var JwksSchema =
|
|
12720
|
+
var JwksSchema = import_zod18.z.object({ keys: import_zod18.z.array(import_zod18.z.looseObject({ kid: import_zod18.z.string().optional(), kty: import_zod18.z.string() })) });
|
|
12475
12721
|
|
|
12476
12722
|
// src/codex/siwcStore.ts
|
|
12477
|
-
var SiwcGrantSchema =
|
|
12478
|
-
clientId:
|
|
12479
|
-
sub:
|
|
12480
|
-
email:
|
|
12481
|
-
idToken:
|
|
12482
|
-
accessToken:
|
|
12483
|
-
refreshToken:
|
|
12484
|
-
scopes:
|
|
12723
|
+
var SiwcGrantSchema = import_zod19.z.strictObject({
|
|
12724
|
+
clientId: import_zod19.z.string().min(1),
|
|
12725
|
+
sub: import_zod19.z.string().min(1),
|
|
12726
|
+
email: import_zod19.z.string().optional(),
|
|
12727
|
+
idToken: import_zod19.z.string().min(1),
|
|
12728
|
+
accessToken: import_zod19.z.string().min(1),
|
|
12729
|
+
refreshToken: import_zod19.z.string().min(1),
|
|
12730
|
+
scopes: import_zod19.z.array(import_zod19.z.string()).readonly(),
|
|
12485
12731
|
/** When the access token stops working, in milliseconds since the epoch. */
|
|
12486
|
-
expiresAt:
|
|
12732
|
+
expiresAt: import_zod19.z.number()
|
|
12487
12733
|
});
|
|
12488
|
-
var SiwcFileSchema =
|
|
12734
|
+
var SiwcFileSchema = import_zod19.z.strictObject({ registeredClientId: import_zod19.z.string().min(1).optional(), grant: SiwcGrantSchema.optional() });
|
|
12489
12735
|
function parseSiwcFile(raw, filePath) {
|
|
12490
12736
|
let json;
|
|
12491
12737
|
try {
|
|
@@ -12645,17 +12891,17 @@ function pushProvider(push, entry, cacheEnv, signIn) {
|
|
|
12645
12891
|
push("provider", "fail", new LegacyProviderFileError(entry.path, conversion).message, entry.name);
|
|
12646
12892
|
return;
|
|
12647
12893
|
}
|
|
12648
|
-
const
|
|
12649
|
-
if (!
|
|
12650
|
-
push("provider", "fail", new ConfigValidationError(entry.path,
|
|
12894
|
+
const validated3 = ProviderSchema.safeParse(parsed);
|
|
12895
|
+
if (!validated3.success) {
|
|
12896
|
+
push("provider", "fail", new ConfigValidationError(entry.path, validated3.error.issues).message, entry.name);
|
|
12651
12897
|
return;
|
|
12652
12898
|
}
|
|
12653
|
-
const cache = cacheClause(cacheEnv, `provider ${entry.name}`,
|
|
12654
|
-
push("provider", cache.unreadable ? "fail" : "pass", `${entry.name} is valid (${describeProviderEndpoint(
|
|
12655
|
-
if (
|
|
12899
|
+
const cache = cacheClause(cacheEnv, `provider ${entry.name}`, validated3.data.credential);
|
|
12900
|
+
push("provider", cache.unreadable ? "fail" : "pass", `${entry.name} is valid (${describeProviderEndpoint(validated3.data)}, credential ${describeCredential(validated3.data.credential)})${cache.text}.`, entry.name);
|
|
12901
|
+
if (validated3.data.env?.ENABLE_TOOL_SEARCH === void 0) {
|
|
12656
12902
|
push("provider", "warn", `${entry.name} does not set ENABLE_TOOL_SEARCH: a session on this provider keeps Claude Code's own API as its base URL, so it defers MCP tool loading and sends tool_reference payloads the upstream backend must understand. Set ENABLE_TOOL_SEARCH=false in the provider's env block to load tools upfront instead, when the backend does not support them.`, entry.name);
|
|
12657
12903
|
}
|
|
12658
|
-
if (signIn !== void 0 && isCodexProvider(
|
|
12904
|
+
if (signIn !== void 0 && isCodexProvider(validated3.data) && validated3.data.codex?.login === "chatgpt-sign-in") {
|
|
12659
12905
|
const problem = signInProblem(signIn);
|
|
12660
12906
|
if (problem !== void 0) {
|
|
12661
12907
|
push("provider", "warn", `${entry.name} uses the Sign in with ChatGPT login, but ${problem}`, entry.name);
|
|
@@ -12723,13 +12969,13 @@ function runDoctor(params) {
|
|
|
12723
12969
|
pushLegacyName(push, params);
|
|
12724
12970
|
const profileSources = /* @__PURE__ */ new Map();
|
|
12725
12971
|
for (const entry of params.configProfiles) {
|
|
12726
|
-
const
|
|
12727
|
-
if (!
|
|
12728
|
-
push("config-profile", "fail",
|
|
12972
|
+
const validated3 = validateJson(ConfigProfileSchema, entry);
|
|
12973
|
+
if (!validated3.ok) {
|
|
12974
|
+
push("config-profile", "fail", validated3.message, entry.name);
|
|
12729
12975
|
continue;
|
|
12730
12976
|
}
|
|
12731
|
-
profileSources.set(entry.name, { name: entry.name, profile:
|
|
12732
|
-
checkPin("config-profile", entry.name, `Configuration profile "${entry.name}"`,
|
|
12977
|
+
profileSources.set(entry.name, { name: entry.name, profile: validated3.data });
|
|
12978
|
+
checkPin("config-profile", entry.name, `Configuration profile "${entry.name}"`, validated3.data.launch?.claudeVersion);
|
|
12733
12979
|
}
|
|
12734
12980
|
const loadProfile = (name) => profileSources.get(name);
|
|
12735
12981
|
for (const name of profileSources.keys()) {
|
|
@@ -12745,13 +12991,13 @@ function runDoctor(params) {
|
|
|
12745
12991
|
const validProfileNames = new Set(profileSources.keys());
|
|
12746
12992
|
const validIdentityNames = /* @__PURE__ */ new Set();
|
|
12747
12993
|
for (const entry of params.identities) {
|
|
12748
|
-
const
|
|
12749
|
-
if (!
|
|
12750
|
-
push("identity", "fail",
|
|
12994
|
+
const validated3 = validateJson(IdentitySchema, entry);
|
|
12995
|
+
if (!validated3.ok) {
|
|
12996
|
+
push("identity", "fail", validated3.message, entry.name);
|
|
12751
12997
|
continue;
|
|
12752
12998
|
}
|
|
12753
12999
|
validIdentityNames.add(entry.name);
|
|
12754
|
-
const defaultProfile =
|
|
13000
|
+
const defaultProfile = validated3.data.defaultConfigProfile;
|
|
12755
13001
|
if (defaultProfile !== void 0 && !validProfileNames.has(defaultProfile)) {
|
|
12756
13002
|
push(
|
|
12757
13003
|
"identity",
|
|
@@ -12760,7 +13006,7 @@ function runDoctor(params) {
|
|
|
12760
13006
|
entry.name
|
|
12761
13007
|
);
|
|
12762
13008
|
} else {
|
|
12763
|
-
const credential =
|
|
13009
|
+
const credential = validated3.data.credential;
|
|
12764
13010
|
const cache = credential === void 0 ? { text: "", unreadable: false } : cacheClause(params.credentialCache, `identity ${entry.name}`, credential);
|
|
12765
13011
|
push(
|
|
12766
13012
|
"identity",
|
|
@@ -12831,12 +13077,12 @@ function runDoctor(params) {
|
|
|
12831
13077
|
if (params.directoryRules.raw === void 0) {
|
|
12832
13078
|
push("directory-rules", "pass", "No directory-rules.json configured.");
|
|
12833
13079
|
} else {
|
|
12834
|
-
const
|
|
12835
|
-
if (!
|
|
12836
|
-
push("directory-rules", "fail",
|
|
13080
|
+
const validated3 = validateJson(DirectoryRulesSchema, params.directoryRules);
|
|
13081
|
+
if (!validated3.ok) {
|
|
13082
|
+
push("directory-rules", "fail", validated3.message);
|
|
12837
13083
|
} else {
|
|
12838
13084
|
push("directory-rules", "pass", `${params.directoryRules.path} is valid.`);
|
|
12839
|
-
for (const rule of
|
|
13085
|
+
for (const rule of validated3.data.rules) {
|
|
12840
13086
|
const badRefs = [];
|
|
12841
13087
|
if (rule.identity !== void 0 && !selectionExists(rule.identity)) {
|
|
12842
13088
|
badRefs.push(poolNameOf(rule.identity) === void 0 ? `identity "${rule.identity}"` : `pool "${poolNameOf(rule.identity) ?? ""}"`);
|
|
@@ -12856,11 +13102,11 @@ function runDoctor(params) {
|
|
|
12856
13102
|
if (params.globalConfig.raw === void 0) {
|
|
12857
13103
|
push("global-config", "pass", "No config.json configured.");
|
|
12858
13104
|
} else {
|
|
12859
|
-
const
|
|
12860
|
-
if (!
|
|
12861
|
-
push("global-config", "fail",
|
|
13105
|
+
const validated3 = validateJson(GlobalConfigSchema, params.globalConfig);
|
|
13106
|
+
if (!validated3.ok) {
|
|
13107
|
+
push("global-config", "fail", validated3.message);
|
|
12862
13108
|
} else {
|
|
12863
|
-
const defaultProfile =
|
|
13109
|
+
const defaultProfile = validated3.data.defaultConfigProfile;
|
|
12864
13110
|
if (defaultProfile !== void 0 && !validProfileNames.has(defaultProfile)) {
|
|
12865
13111
|
push(
|
|
12866
13112
|
"global-config",
|
|
@@ -12869,18 +13115,18 @@ function runDoctor(params) {
|
|
|
12869
13115
|
);
|
|
12870
13116
|
} else {
|
|
12871
13117
|
push("global-config", "pass", `${params.globalConfig.path} is valid.`);
|
|
12872
|
-
checkPin("global-config", void 0, "config.json",
|
|
13118
|
+
checkPin("global-config", void 0, "config.json", validated3.data.launch?.claudeVersion);
|
|
12873
13119
|
}
|
|
12874
13120
|
}
|
|
12875
13121
|
}
|
|
12876
13122
|
if (params.categoriesLocal.raw === void 0) {
|
|
12877
13123
|
push("categories-local", "pass", "No categories.local.json configured.");
|
|
12878
13124
|
} else {
|
|
12879
|
-
const
|
|
13125
|
+
const validated3 = validateJson(CategoryClassificationOverlaySchema, params.categoriesLocal);
|
|
12880
13126
|
push(
|
|
12881
13127
|
"categories-local",
|
|
12882
|
-
|
|
12883
|
-
|
|
13128
|
+
validated3.ok ? "pass" : "fail",
|
|
13129
|
+
validated3.ok ? `${params.categoriesLocal.path} is valid.` : validated3.message
|
|
12884
13130
|
);
|
|
12885
13131
|
}
|
|
12886
13132
|
if (params.headroom.state.raw === void 0) {
|
|
@@ -12888,11 +13134,11 @@ function runDoctor(params) {
|
|
|
12888
13134
|
} else if (tcpPortEraRecord(params.headroom.state.raw)) {
|
|
12889
13135
|
push("headroom", "pass", `${params.headroom.state.path} holds a previous release's TCP-port state record; the next launch through headroom claims over it.`);
|
|
12890
13136
|
} else {
|
|
12891
|
-
const
|
|
12892
|
-
if (!
|
|
12893
|
-
push("headroom", "fail",
|
|
13137
|
+
const validated3 = validateJson(HeadroomStateSchema, params.headroom.state);
|
|
13138
|
+
if (!validated3.ok) {
|
|
13139
|
+
push("headroom", "fail", validated3.message);
|
|
12894
13140
|
} else {
|
|
12895
|
-
const state =
|
|
13141
|
+
const state = validated3.data;
|
|
12896
13142
|
const supervisorAlive = state.supervisorPid !== void 0 && params.headroom.isRunning(state.supervisorPid);
|
|
12897
13143
|
const headroomAlive = state.headroomPid !== void 0 && params.headroom.isRunning(state.headroomPid);
|
|
12898
13144
|
if (state.supervisorPid === void 0) {
|
|
@@ -13108,90 +13354,90 @@ function collectDoctorReport(params) {
|
|
|
13108
13354
|
// src/frontdoor/controlSchemas.ts
|
|
13109
13355
|
init_schema2();
|
|
13110
13356
|
init_state();
|
|
13111
|
-
var UsageListOutputSchema =
|
|
13112
|
-
var UsageWindowsInputSchema =
|
|
13113
|
-
identity:
|
|
13114
|
-
provider:
|
|
13357
|
+
var UsageListOutputSchema = import_zod20.z.strictObject({ snapshots: import_zod20.z.readonly(import_zod20.z.array(UsageSnapshotSchema)) });
|
|
13358
|
+
var UsageWindowsInputSchema = import_zod20.z.strictObject({
|
|
13359
|
+
identity: import_zod20.z.string().min(1),
|
|
13360
|
+
provider: import_zod20.z.string().min(1).optional()
|
|
13115
13361
|
});
|
|
13116
|
-
var EffectiveWindowSchema =
|
|
13362
|
+
var EffectiveWindowSchema = import_zod20.z.strictObject({
|
|
13117
13363
|
/** True when the window's reset time has passed, so the recorded observation describes a window that no longer exists. */
|
|
13118
|
-
reset:
|
|
13364
|
+
reset: import_zod20.z.boolean(),
|
|
13119
13365
|
/** The fraction used: 0 for a reset window, otherwise what was last observed, absent when none was reported. */
|
|
13120
|
-
utilization:
|
|
13366
|
+
utilization: import_zod20.z.number().optional(),
|
|
13121
13367
|
/** The reset instant, for a window that has not reset yet and reported one. */
|
|
13122
|
-
resetsAtMs:
|
|
13368
|
+
resetsAtMs: import_zod20.z.number().optional(),
|
|
13123
13369
|
/** The window's own status, for a window that has not reset yet. */
|
|
13124
|
-
status:
|
|
13370
|
+
status: import_zod20.z.string().optional()
|
|
13125
13371
|
});
|
|
13126
|
-
var UsageWindowsOutputSchema =
|
|
13127
|
-
identity:
|
|
13128
|
-
provider:
|
|
13372
|
+
var UsageWindowsOutputSchema = import_zod20.z.strictObject({
|
|
13373
|
+
identity: import_zod20.z.string(),
|
|
13374
|
+
provider: import_zod20.z.string(),
|
|
13129
13375
|
/** When the rate-limit state the windows come from was observed. */
|
|
13130
|
-
observedAt:
|
|
13376
|
+
observedAt: import_zod20.z.iso.datetime().optional(),
|
|
13131
13377
|
fiveHour: EffectiveWindowSchema.optional(),
|
|
13132
13378
|
sevenDay: EffectiveWindowSchema.optional()
|
|
13133
13379
|
});
|
|
13134
|
-
var UsageLiveOutputSchema =
|
|
13380
|
+
var UsageLiveOutputSchema = import_zod20.z.strictObject({
|
|
13135
13381
|
/** 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. */
|
|
13136
13382
|
latest: RcLiveRateLimitSchema.optional(),
|
|
13137
13383
|
/** One observation per session whose stream has filed a rate_limit_event this door generation. */
|
|
13138
|
-
sessions:
|
|
13384
|
+
sessions: import_zod20.z.readonly(import_zod20.z.array(RcLiveRateLimitSchema))
|
|
13139
13385
|
});
|
|
13140
|
-
var FrontDoorSessionStatusSchema =
|
|
13141
|
-
pid:
|
|
13142
|
-
startedAt:
|
|
13143
|
-
alive:
|
|
13386
|
+
var FrontDoorSessionStatusSchema = import_zod20.z.strictObject({
|
|
13387
|
+
pid: import_zod20.z.int().positive(),
|
|
13388
|
+
startedAt: import_zod20.z.number(),
|
|
13389
|
+
alive: import_zod20.z.boolean()
|
|
13144
13390
|
});
|
|
13145
|
-
var HeadroomSocketTargetSchema =
|
|
13146
|
-
var FrontDoorStatusOutputSchema =
|
|
13391
|
+
var HeadroomSocketTargetSchema = import_zod20.z.union([import_zod20.z.strictObject({ socketPath: import_zod20.z.string() }), import_zod20.z.strictObject({ refused: import_zod20.z.string() })]);
|
|
13392
|
+
var FrontDoorStatusOutputSchema = import_zod20.z.strictObject({
|
|
13147
13393
|
state: FrontDoorStateSchema,
|
|
13148
|
-
supervisorAlive:
|
|
13149
|
-
sessions:
|
|
13394
|
+
supervisorAlive: import_zod20.z.boolean(),
|
|
13395
|
+
sessions: import_zod20.z.readonly(import_zod20.z.array(FrontDoorSessionStatusSchema)),
|
|
13150
13396
|
headroomSocket: HeadroomSocketTargetSchema.optional(),
|
|
13151
|
-
logPath:
|
|
13152
|
-
logExists:
|
|
13397
|
+
logPath: import_zod20.z.string(),
|
|
13398
|
+
logExists: import_zod20.z.boolean()
|
|
13153
13399
|
});
|
|
13154
|
-
var FrontDoorSessionsOutputSchema =
|
|
13155
|
-
var CheckRunInputSchema =
|
|
13156
|
-
path:
|
|
13157
|
-
identity:
|
|
13400
|
+
var FrontDoorSessionsOutputSchema = import_zod20.z.strictObject({ sessions: import_zod20.z.readonly(import_zod20.z.array(FrontDoorSessionStatusSchema)) });
|
|
13401
|
+
var CheckRunInputSchema = import_zod20.z.strictObject({
|
|
13402
|
+
path: import_zod20.z.string().min(1),
|
|
13403
|
+
identity: import_zod20.z.string().min(1).optional()
|
|
13158
13404
|
}).refine((input) => import_node_path30.default.isAbsolute(input.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
|
|
13159
|
-
var PoolPickInputSchema =
|
|
13160
|
-
pool:
|
|
13161
|
-
path:
|
|
13405
|
+
var PoolPickInputSchema = import_zod20.z.strictObject({
|
|
13406
|
+
pool: import_zod20.z.string().min(1),
|
|
13407
|
+
path: import_zod20.z.string().min(1)
|
|
13162
13408
|
}).refine((input) => import_node_path30.default.isAbsolute(input.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
|
|
13163
|
-
var DoctorFindingSchema =
|
|
13164
|
-
section:
|
|
13165
|
-
subject:
|
|
13166
|
-
severity:
|
|
13167
|
-
message:
|
|
13409
|
+
var DoctorFindingSchema = import_zod20.z.strictObject({
|
|
13410
|
+
section: import_zod20.z.enum(DOCTOR_SECTIONS),
|
|
13411
|
+
subject: import_zod20.z.string().optional(),
|
|
13412
|
+
severity: import_zod20.z.enum(DOCTOR_SEVERITIES),
|
|
13413
|
+
message: import_zod20.z.string()
|
|
13168
13414
|
});
|
|
13169
|
-
var DoctorRunOutputSchema =
|
|
13415
|
+
var DoctorRunOutputSchema = import_zod20.z.strictObject({
|
|
13170
13416
|
/** False exactly when any finding is a `fail`; a `warn` never fails the report on its own. */
|
|
13171
|
-
ok:
|
|
13172
|
-
findings:
|
|
13417
|
+
ok: import_zod20.z.boolean(),
|
|
13418
|
+
findings: import_zod20.z.readonly(import_zod20.z.array(DoctorFindingSchema))
|
|
13173
13419
|
});
|
|
13174
|
-
var FrontDoorRestartOutputSchema =
|
|
13175
|
-
action:
|
|
13176
|
-
previousPid:
|
|
13420
|
+
var FrontDoorRestartOutputSchema = import_zod20.z.strictObject({
|
|
13421
|
+
action: import_zod20.z.literal("restarting"),
|
|
13422
|
+
previousPid: import_zod20.z.int().positive()
|
|
13177
13423
|
});
|
|
13178
|
-
var UpdateCheckOutputSchema =
|
|
13179
|
-
current:
|
|
13180
|
-
latest:
|
|
13181
|
-
action:
|
|
13424
|
+
var UpdateCheckOutputSchema = import_zod20.z.strictObject({
|
|
13425
|
+
current: import_zod20.z.string(),
|
|
13426
|
+
latest: import_zod20.z.string(),
|
|
13427
|
+
action: import_zod20.z.enum(["current", "available", "updated"])
|
|
13182
13428
|
});
|
|
13183
|
-
var CodexSignInSchema =
|
|
13184
|
-
|
|
13185
|
-
|
|
13186
|
-
|
|
13429
|
+
var CodexSignInSchema = import_zod20.z.discriminatedUnion("state", [
|
|
13430
|
+
import_zod20.z.strictObject({ state: import_zod20.z.literal("none") }),
|
|
13431
|
+
import_zod20.z.strictObject({ state: import_zod20.z.literal("signed-in"), email: import_zod20.z.string().optional(), planScope: import_zod20.z.boolean(), accessTokenExpiresAt: import_zod20.z.number() }),
|
|
13432
|
+
import_zod20.z.strictObject({ state: import_zod20.z.literal("unreadable"), message: import_zod20.z.string() })
|
|
13187
13433
|
]);
|
|
13188
|
-
var CodexStatusOutputSchema =
|
|
13434
|
+
var CodexStatusOutputSchema = import_zod20.z.strictObject({
|
|
13189
13435
|
signIn: CodexSignInSchema,
|
|
13190
|
-
codexProviders:
|
|
13436
|
+
codexProviders: import_zod20.z.readonly(import_zod20.z.array(import_zod20.z.string()))
|
|
13191
13437
|
});
|
|
13192
|
-
var CodexLogoutOutputSchema =
|
|
13193
|
-
hadGrant:
|
|
13194
|
-
revoked:
|
|
13438
|
+
var CodexLogoutOutputSchema = import_zod20.z.strictObject({
|
|
13439
|
+
hadGrant: import_zod20.z.boolean(),
|
|
13440
|
+
revoked: import_zod20.z.boolean()
|
|
13195
13441
|
});
|
|
13196
13442
|
|
|
13197
13443
|
// src/frontdoor/codexApi.ts
|
|
@@ -13347,131 +13593,131 @@ init_identity();
|
|
|
13347
13593
|
init_providersStore();
|
|
13348
13594
|
|
|
13349
13595
|
// src/frontdoor/configSchemas.ts
|
|
13350
|
-
var
|
|
13596
|
+
var import_zod21 = require("zod");
|
|
13351
13597
|
init_schema();
|
|
13352
|
-
var RemovalConfirmationSchema =
|
|
13353
|
-
var CredentialWriteSchema = (targets) =>
|
|
13354
|
-
sources:
|
|
13355
|
-
target:
|
|
13356
|
-
cache:
|
|
13598
|
+
var RemovalConfirmationSchema = import_zod21.z.boolean();
|
|
13599
|
+
var CredentialWriteSchema = (targets) => import_zod21.z.strictObject({
|
|
13600
|
+
sources: import_zod21.z.array(RemoteCredentialSourceSchema).min(1).optional(),
|
|
13601
|
+
target: import_zod21.z.enum(targets).optional(),
|
|
13602
|
+
cache: import_zod21.z.union([import_zod21.z.literal(false), CredentialCacheSchema]).optional()
|
|
13357
13603
|
});
|
|
13358
|
-
var CredentialSummarySchema2 =
|
|
13359
|
-
target:
|
|
13360
|
-
sources:
|
|
13361
|
-
|
|
13362
|
-
|
|
13363
|
-
|
|
13364
|
-
|
|
13365
|
-
|
|
13366
|
-
|
|
13367
|
-
|
|
13604
|
+
var CredentialSummarySchema2 = import_zod21.z.strictObject({
|
|
13605
|
+
target: import_zod21.z.enum(CREDENTIAL_TARGETS),
|
|
13606
|
+
sources: import_zod21.z.readonly(import_zod21.z.array(
|
|
13607
|
+
import_zod21.z.discriminatedUnion("kind", [
|
|
13608
|
+
import_zod21.z.strictObject({ kind: import_zod21.z.literal("env"), variable: import_zod21.z.string() }),
|
|
13609
|
+
import_zod21.z.strictObject({ kind: import_zod21.z.literal("file"), path: import_zod21.z.string() }),
|
|
13610
|
+
import_zod21.z.strictObject({ kind: import_zod21.z.literal("command"), program: import_zod21.z.string() }),
|
|
13611
|
+
import_zod21.z.strictObject({ kind: import_zod21.z.literal("op"), reference: import_zod21.z.string() }),
|
|
13612
|
+
import_zod21.z.strictObject({ kind: import_zod21.z.literal("keychain"), service: import_zod21.z.string(), account: import_zod21.z.string().optional() }),
|
|
13613
|
+
import_zod21.z.strictObject({ kind: import_zod21.z.literal("literal") })
|
|
13368
13614
|
])
|
|
13369
13615
|
)),
|
|
13370
13616
|
cache: CredentialCacheSchema.optional()
|
|
13371
13617
|
});
|
|
13372
|
-
var mutationOutput = (kind, action) =>
|
|
13373
|
-
var storedMutationOutput = (kind, action, value) =>
|
|
13374
|
-
var IdentityValueSchema =
|
|
13375
|
-
name:
|
|
13376
|
-
defaultConfigProfile:
|
|
13377
|
-
allowAmbientCredential:
|
|
13618
|
+
var mutationOutput = (kind, action) => import_zod21.z.strictObject({ action: import_zod21.z.literal(action), kind: import_zod21.z.literal(kind), name: import_zod21.z.string() });
|
|
13619
|
+
var storedMutationOutput = (kind, action, value) => import_zod21.z.strictObject({ action: import_zod21.z.literal(action), kind: import_zod21.z.literal(kind), name: import_zod21.z.string(), value });
|
|
13620
|
+
var IdentityValueSchema = import_zod21.z.strictObject({
|
|
13621
|
+
name: import_zod21.z.string(),
|
|
13622
|
+
defaultConfigProfile: import_zod21.z.string().optional(),
|
|
13623
|
+
allowAmbientCredential: import_zod21.z.boolean(),
|
|
13378
13624
|
credential: CredentialSummarySchema2.optional()
|
|
13379
13625
|
});
|
|
13380
13626
|
var ProfileValueSchema = ConfigProfileSchema.omit({ $schema: true });
|
|
13381
|
-
var ProviderValueSchema =
|
|
13382
|
-
name:
|
|
13383
|
-
kind:
|
|
13384
|
-
displayName:
|
|
13385
|
-
baseUrl:
|
|
13627
|
+
var ProviderValueSchema = import_zod21.z.strictObject({
|
|
13628
|
+
name: import_zod21.z.string(),
|
|
13629
|
+
kind: import_zod21.z.enum(PROVIDER_KINDS),
|
|
13630
|
+
displayName: import_zod21.z.string(),
|
|
13631
|
+
baseUrl: import_zod21.z.string().optional(),
|
|
13386
13632
|
codex: CodexProviderConfigSchema.optional(),
|
|
13387
13633
|
credential: CredentialSummarySchema2,
|
|
13388
|
-
env:
|
|
13634
|
+
env: import_zod21.z.record(import_zod21.z.string(), import_zod21.z.string()).optional()
|
|
13389
13635
|
});
|
|
13390
|
-
var ConfigNameInputSchema =
|
|
13636
|
+
var ConfigNameInputSchema = import_zod21.z.strictObject({ name: import_zod21.z.string().min(1) });
|
|
13391
13637
|
var ConfigIdentityAddOutputSchema = storedMutationOutput("identity", "created", IdentityValueSchema);
|
|
13392
|
-
var ConfigIdentitySetInputSchema =
|
|
13393
|
-
name:
|
|
13394
|
-
defaultConfigProfile:
|
|
13395
|
-
allowAmbientCredential:
|
|
13396
|
-
credential:
|
|
13638
|
+
var ConfigIdentitySetInputSchema = import_zod21.z.strictObject({
|
|
13639
|
+
name: import_zod21.z.string().min(1),
|
|
13640
|
+
defaultConfigProfile: import_zod21.z.union([import_zod21.z.string().min(1), import_zod21.z.literal(false)]).optional(),
|
|
13641
|
+
allowAmbientCredential: import_zod21.z.boolean().optional(),
|
|
13642
|
+
credential: import_zod21.z.union([import_zod21.z.literal(false), CredentialWriteSchema(CREDENTIAL_TARGETS)]).optional()
|
|
13397
13643
|
});
|
|
13398
13644
|
var ConfigIdentitySetOutputSchema = storedMutationOutput("identity", "updated", IdentityValueSchema);
|
|
13399
|
-
var ConfigIdentityRemoveInputSchema =
|
|
13645
|
+
var ConfigIdentityRemoveInputSchema = import_zod21.z.strictObject({ name: import_zod21.z.string().min(1), confirm: RemovalConfirmationSchema });
|
|
13400
13646
|
var ConfigIdentityRemoveOutputSchema = mutationOutput("identity", "removed");
|
|
13401
13647
|
var ConfigIdentityUseOutputSchema = mutationOutput("identity", "selected");
|
|
13402
|
-
var ConfigProfileAddInputSchema =
|
|
13403
|
-
name:
|
|
13404
|
-
extends:
|
|
13405
|
-
description:
|
|
13648
|
+
var ConfigProfileAddInputSchema = import_zod21.z.strictObject({
|
|
13649
|
+
name: import_zod21.z.string().min(1),
|
|
13650
|
+
extends: import_zod21.z.array(import_zod21.z.string().min(1)).optional(),
|
|
13651
|
+
description: import_zod21.z.string().optional()
|
|
13406
13652
|
});
|
|
13407
13653
|
var ConfigProfileAddOutputSchema = storedMutationOutput("profile", "created", ProfileValueSchema);
|
|
13408
|
-
var ConfigProfileSetInputSchema =
|
|
13409
|
-
name:
|
|
13410
|
-
category:
|
|
13411
|
-
entry:
|
|
13412
|
-
extends:
|
|
13413
|
-
description:
|
|
13414
|
-
launch:
|
|
13415
|
-
skipPermissions:
|
|
13416
|
-
remoteControl:
|
|
13417
|
-
headroom:
|
|
13418
|
-
trackUsage:
|
|
13419
|
-
provider:
|
|
13420
|
-
claudeVersion:
|
|
13654
|
+
var ConfigProfileSetInputSchema = import_zod21.z.strictObject({
|
|
13655
|
+
name: import_zod21.z.string().min(1),
|
|
13656
|
+
category: import_zod21.z.record(import_zod21.z.string(), import_zod21.z.boolean()).optional(),
|
|
13657
|
+
entry: import_zod21.z.record(import_zod21.z.string(), import_zod21.z.boolean()).optional(),
|
|
13658
|
+
extends: import_zod21.z.union([import_zod21.z.array(import_zod21.z.string().min(1)), import_zod21.z.literal(false)]).optional(),
|
|
13659
|
+
description: import_zod21.z.union([import_zod21.z.string(), import_zod21.z.literal(false)]).optional(),
|
|
13660
|
+
launch: import_zod21.z.strictObject({
|
|
13661
|
+
skipPermissions: import_zod21.z.boolean().optional(),
|
|
13662
|
+
remoteControl: import_zod21.z.boolean().optional(),
|
|
13663
|
+
headroom: import_zod21.z.boolean().optional(),
|
|
13664
|
+
trackUsage: import_zod21.z.boolean().optional(),
|
|
13665
|
+
provider: import_zod21.z.union([import_zod21.z.string().min(1), import_zod21.z.literal(false)]).optional(),
|
|
13666
|
+
claudeVersion: import_zod21.z.union([import_zod21.z.string().min(1), import_zod21.z.literal(false)]).optional()
|
|
13421
13667
|
}).optional()
|
|
13422
13668
|
});
|
|
13423
13669
|
var ConfigProfileSetOutputSchema = storedMutationOutput("profile", "updated", ProfileValueSchema);
|
|
13424
|
-
var ConfigProfileRemoveInputSchema =
|
|
13670
|
+
var ConfigProfileRemoveInputSchema = import_zod21.z.strictObject({ name: import_zod21.z.string().min(1), confirm: RemovalConfirmationSchema });
|
|
13425
13671
|
var ConfigProfileRemoveOutputSchema = mutationOutput("profile", "removed");
|
|
13426
13672
|
var ConfigProfileUseOutputSchema = mutationOutput("profile", "selected");
|
|
13427
|
-
var PoolMembersInputSchema =
|
|
13428
|
-
var ConfigPoolAddInputSchema =
|
|
13429
|
-
name:
|
|
13673
|
+
var PoolMembersInputSchema = import_zod21.z.array(import_zod21.z.string().min(1)).min(1);
|
|
13674
|
+
var ConfigPoolAddInputSchema = import_zod21.z.strictObject({
|
|
13675
|
+
name: import_zod21.z.string().min(1),
|
|
13430
13676
|
identities: PoolMembersInputSchema,
|
|
13431
|
-
preference:
|
|
13677
|
+
preference: import_zod21.z.enum(POOL_PREFERENCES).optional()
|
|
13432
13678
|
});
|
|
13433
13679
|
var ConfigPoolAddOutputSchema = storedMutationOutput("pool", "created", PoolSchema);
|
|
13434
|
-
var ConfigPoolSetInputSchema =
|
|
13435
|
-
name:
|
|
13680
|
+
var ConfigPoolSetInputSchema = import_zod21.z.strictObject({
|
|
13681
|
+
name: import_zod21.z.string().min(1),
|
|
13436
13682
|
identities: PoolMembersInputSchema.optional(),
|
|
13437
|
-
preference:
|
|
13683
|
+
preference: import_zod21.z.union([import_zod21.z.enum(POOL_PREFERENCES), import_zod21.z.literal(false)]).optional()
|
|
13438
13684
|
});
|
|
13439
13685
|
var ConfigPoolSetOutputSchema = storedMutationOutput("pool", "updated", PoolSchema);
|
|
13440
|
-
var ConfigPoolRemoveInputSchema =
|
|
13686
|
+
var ConfigPoolRemoveInputSchema = import_zod21.z.strictObject({ name: import_zod21.z.string().min(1), confirm: RemovalConfirmationSchema });
|
|
13441
13687
|
var ConfigPoolRemoveOutputSchema = mutationOutput("pool", "removed");
|
|
13442
13688
|
var ConfigPoolUseOutputSchema = mutationOutput("pool", "selected");
|
|
13443
|
-
var ConfigProviderAddInputSchema =
|
|
13444
|
-
name:
|
|
13445
|
-
kind:
|
|
13446
|
-
displayName:
|
|
13447
|
-
baseUrl:
|
|
13689
|
+
var ConfigProviderAddInputSchema = import_zod21.z.strictObject({
|
|
13690
|
+
name: import_zod21.z.string().min(1),
|
|
13691
|
+
kind: import_zod21.z.enum(PROVIDER_KINDS).optional(),
|
|
13692
|
+
displayName: import_zod21.z.string().min(1),
|
|
13693
|
+
baseUrl: import_zod21.z.string().min(1).optional(),
|
|
13448
13694
|
credential: CredentialWriteSchema(PROVIDER_CREDENTIAL_TARGETS).required({ sources: true }),
|
|
13449
13695
|
codex: CodexProviderConfigSchema.optional()
|
|
13450
13696
|
});
|
|
13451
13697
|
var ConfigProviderAddOutputSchema = storedMutationOutput("provider", "created", ProviderValueSchema);
|
|
13452
|
-
var ConfigProviderSetInputSchema =
|
|
13453
|
-
name:
|
|
13454
|
-
displayName:
|
|
13455
|
-
baseUrl:
|
|
13698
|
+
var ConfigProviderSetInputSchema = import_zod21.z.strictObject({
|
|
13699
|
+
name: import_zod21.z.string().min(1),
|
|
13700
|
+
displayName: import_zod21.z.string().min(1).optional(),
|
|
13701
|
+
baseUrl: import_zod21.z.string().min(1).optional(),
|
|
13456
13702
|
credential: CredentialWriteSchema(PROVIDER_CREDENTIAL_TARGETS).optional(),
|
|
13457
13703
|
codex: CodexProviderConfigSchema.optional()
|
|
13458
13704
|
});
|
|
13459
13705
|
var ConfigProviderSetOutputSchema = storedMutationOutput("provider", "updated", ProviderValueSchema);
|
|
13460
|
-
var ConfigProviderRemoveInputSchema =
|
|
13706
|
+
var ConfigProviderRemoveInputSchema = import_zod21.z.strictObject({ name: import_zod21.z.string().min(1), confirm: RemovalConfirmationSchema });
|
|
13461
13707
|
var ConfigProviderRemoveOutputSchema = mutationOutput("provider", "removed");
|
|
13462
|
-
var ConfigRuleAddInputSchema =
|
|
13463
|
-
path:
|
|
13464
|
-
configProfile:
|
|
13465
|
-
identity:
|
|
13708
|
+
var ConfigRuleAddInputSchema = import_zod21.z.strictObject({
|
|
13709
|
+
path: import_zod21.z.string().min(1),
|
|
13710
|
+
configProfile: import_zod21.z.string().min(1).optional(),
|
|
13711
|
+
identity: import_zod21.z.string().min(1).optional()
|
|
13466
13712
|
});
|
|
13467
13713
|
var ConfigRuleAddOutputSchema = storedMutationOutput("rule", "created", DirectoryRuleSchema);
|
|
13468
|
-
var ConfigRuleSetInputSchema =
|
|
13469
|
-
path:
|
|
13470
|
-
configProfile:
|
|
13471
|
-
identity:
|
|
13714
|
+
var ConfigRuleSetInputSchema = import_zod21.z.strictObject({
|
|
13715
|
+
path: import_zod21.z.string().min(1),
|
|
13716
|
+
configProfile: import_zod21.z.union([import_zod21.z.string().min(1), import_zod21.z.literal(false)]).optional(),
|
|
13717
|
+
identity: import_zod21.z.union([import_zod21.z.string().min(1), import_zod21.z.literal(false)]).optional()
|
|
13472
13718
|
});
|
|
13473
13719
|
var ConfigRuleSetOutputSchema = storedMutationOutput("rule", "updated", DirectoryRuleSchema);
|
|
13474
|
-
var ConfigRuleRemoveInputSchema =
|
|
13720
|
+
var ConfigRuleRemoveInputSchema = import_zod21.z.strictObject({ path: import_zod21.z.string().min(1), confirm: RemovalConfirmationSchema });
|
|
13475
13721
|
var ConfigRuleRemoveOutputSchema = mutationOutput("rule", "removed");
|
|
13476
13722
|
|
|
13477
13723
|
// src/frontdoor/configApi.ts
|
|
@@ -13777,41 +14023,41 @@ var import_openapi4 = require("@orpc/openapi");
|
|
|
13777
14023
|
var import_server3 = require("@orpc/server");
|
|
13778
14024
|
|
|
13779
14025
|
// src/frontdoor/eventSchemas.ts
|
|
13780
|
-
var
|
|
14026
|
+
var import_zod22 = require("zod");
|
|
13781
14027
|
var DOOR_EVENT_SOURCE_RC = "rc";
|
|
13782
14028
|
var LAUNCH_EVENT_SOURCE = "launch";
|
|
13783
14029
|
var USAGE_EVENT_SOURCE = "usage";
|
|
13784
14030
|
var DOOR_HEALTH_EVENT_SOURCE = "door";
|
|
13785
14031
|
var QUOTA_EXPIRING_EVENT_SOURCE = "quota-expiring";
|
|
13786
|
-
var DoorEventSchema =
|
|
13787
|
-
source:
|
|
14032
|
+
var DoorEventSchema = import_zod22.z.strictObject({
|
|
14033
|
+
source: import_zod22.z.string().min(1),
|
|
13788
14034
|
/** A positive integer because the backbone's counters start at one and only ever increase. */
|
|
13789
|
-
sequence:
|
|
13790
|
-
payload:
|
|
14035
|
+
sequence: import_zod22.z.number().int().positive(),
|
|
14036
|
+
payload: import_zod22.z.unknown()
|
|
13791
14037
|
});
|
|
13792
|
-
var DoorEventSourceQuerySchema =
|
|
13793
|
-
sources:
|
|
14038
|
+
var DoorEventSourceQuerySchema = import_zod22.z.strictObject({
|
|
14039
|
+
sources: import_zod22.z.array(import_zod22.z.string().min(1)).min(1).optional()
|
|
13794
14040
|
});
|
|
13795
|
-
var LaunchLifecycleEventSchema =
|
|
13796
|
-
kind:
|
|
13797
|
-
pid:
|
|
13798
|
-
startedAt:
|
|
13799
|
-
observedAt:
|
|
14041
|
+
var LaunchLifecycleEventSchema = import_zod22.z.strictObject({
|
|
14042
|
+
kind: import_zod22.z.enum(["registered", "pruned", "ended"]),
|
|
14043
|
+
pid: import_zod22.z.number().int().positive(),
|
|
14044
|
+
startedAt: import_zod22.z.number(),
|
|
14045
|
+
observedAt: import_zod22.z.number()
|
|
13800
14046
|
});
|
|
13801
|
-
var DoorHealthEventSchema =
|
|
13802
|
-
|
|
13803
|
-
|
|
13804
|
-
|
|
13805
|
-
|
|
14047
|
+
var DoorHealthEventSchema = import_zod22.z.discriminatedUnion("kind", [
|
|
14048
|
+
import_zod22.z.strictObject({ kind: import_zod22.z.literal("generation"), pid: import_zod22.z.number().int().positive(), providerPort: import_zod22.z.number().int().positive(), connectPort: import_zod22.z.number().int().positive(), directPort: import_zod22.z.number().int().positive(), observedAt: import_zod22.z.number() }),
|
|
14049
|
+
import_zod22.z.strictObject({ kind: import_zod22.z.literal("listenerFailed"), pid: import_zod22.z.number().int().positive(), listener: import_zod22.z.enum(["provider", "connect", "direct"]), message: import_zod22.z.string(), observedAt: import_zod22.z.number() }),
|
|
14050
|
+
import_zod22.z.strictObject({ kind: import_zod22.z.literal("binaryTurnover"), pid: import_zod22.z.number().int().positive(), observedAt: import_zod22.z.number() }),
|
|
14051
|
+
import_zod22.z.strictObject({ kind: import_zod22.z.literal("idleShutdown"), pid: import_zod22.z.number().int().positive(), observedAt: import_zod22.z.number() })
|
|
13806
14052
|
]);
|
|
13807
|
-
var QuotaExpiringEventSchema =
|
|
13808
|
-
identity:
|
|
13809
|
-
provider:
|
|
13810
|
-
window:
|
|
14053
|
+
var QuotaExpiringEventSchema = import_zod22.z.strictObject({
|
|
14054
|
+
identity: import_zod22.z.string().min(1),
|
|
14055
|
+
provider: import_zod22.z.string().min(1),
|
|
14056
|
+
window: import_zod22.z.enum(["fiveHour", "sevenDay"]),
|
|
13811
14057
|
/** 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. */
|
|
13812
|
-
utilization:
|
|
13813
|
-
resetsAt:
|
|
13814
|
-
observedAt:
|
|
14058
|
+
utilization: import_zod22.z.number().min(0).max(1),
|
|
14059
|
+
resetsAt: import_zod22.z.iso.datetime(),
|
|
14060
|
+
observedAt: import_zod22.z.number()
|
|
13815
14061
|
});
|
|
13816
14062
|
|
|
13817
14063
|
// src/frontdoor/eventsApi.ts
|
|
@@ -13895,51 +14141,51 @@ init_cliError();
|
|
|
13895
14141
|
|
|
13896
14142
|
// src/frontdoor/launchSchemas.ts
|
|
13897
14143
|
var import_node_path31 = __toESM(require("node:path"), 1);
|
|
13898
|
-
var
|
|
14144
|
+
var import_zod23 = require("zod");
|
|
13899
14145
|
init_claudeVersion();
|
|
13900
14146
|
init_identity();
|
|
13901
|
-
var LaunchResolveInputSchema =
|
|
13902
|
-
path:
|
|
14147
|
+
var LaunchResolveInputSchema = import_zod23.z.strictObject({
|
|
14148
|
+
path: import_zod23.z.string().min(1),
|
|
13903
14149
|
/** `@name`, launch flags, then the arguments for `claude`; empty for a bare launch. */
|
|
13904
|
-
argv:
|
|
14150
|
+
argv: import_zod23.z.readonly(import_zod23.z.array(import_zod23.z.string())).optional(),
|
|
13905
14151
|
/** 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. */
|
|
13906
|
-
env:
|
|
14152
|
+
env: import_zod23.z.record(import_zod23.z.string(), import_zod23.z.string()).optional()
|
|
13907
14153
|
}).refine((input) => import_node_path31.default.isAbsolute(input.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
|
|
13908
|
-
var LaunchPoolDecisionSchema =
|
|
13909
|
-
name:
|
|
13910
|
-
reasons:
|
|
13911
|
-
movedOff:
|
|
14154
|
+
var LaunchPoolDecisionSchema = import_zod23.z.strictObject({
|
|
14155
|
+
name: import_zod23.z.string(),
|
|
14156
|
+
reasons: import_zod23.z.readonly(import_zod23.z.array(import_zod23.z.string())),
|
|
14157
|
+
movedOff: import_zod23.z.strictObject({ identity: import_zod23.z.string(), reason: import_zod23.z.string() }).optional()
|
|
13912
14158
|
});
|
|
13913
|
-
var LaunchDecisionSchema =
|
|
13914
|
-
identity:
|
|
13915
|
-
identitySource:
|
|
14159
|
+
var LaunchDecisionSchema = import_zod23.z.strictObject({
|
|
14160
|
+
identity: import_zod23.z.string().optional(),
|
|
14161
|
+
identitySource: import_zod23.z.enum(IDENTITY_DECISION_SOURCES),
|
|
13916
14162
|
pool: LaunchPoolDecisionSchema.optional(),
|
|
13917
|
-
configDirEscapeHatch:
|
|
13918
|
-
configDir:
|
|
13919
|
-
configProfile:
|
|
13920
|
-
configProfileSource:
|
|
13921
|
-
provider:
|
|
14163
|
+
configDirEscapeHatch: import_zod23.z.boolean(),
|
|
14164
|
+
configDir: import_zod23.z.string().optional(),
|
|
14165
|
+
configProfile: import_zod23.z.string().optional(),
|
|
14166
|
+
configProfileSource: import_zod23.z.enum(CONFIG_PROFILE_DECISION_SOURCES),
|
|
14167
|
+
provider: import_zod23.z.string().optional()
|
|
13922
14168
|
});
|
|
13923
|
-
var LaunchFlagsSchema =
|
|
13924
|
-
skipPermissions:
|
|
13925
|
-
remoteControl:
|
|
13926
|
-
headroom:
|
|
13927
|
-
trackUsage:
|
|
14169
|
+
var LaunchFlagsSchema = import_zod23.z.strictObject({
|
|
14170
|
+
skipPermissions: import_zod23.z.boolean(),
|
|
14171
|
+
remoteControl: import_zod23.z.boolean(),
|
|
14172
|
+
headroom: import_zod23.z.boolean(),
|
|
14173
|
+
trackUsage: import_zod23.z.boolean()
|
|
13928
14174
|
});
|
|
13929
|
-
var LaunchResolveOutputSchema =
|
|
14175
|
+
var LaunchResolveOutputSchema = import_zod23.z.strictObject({
|
|
13930
14176
|
decision: LaunchDecisionSchema,
|
|
13931
14177
|
flags: LaunchFlagsSchema,
|
|
13932
|
-
claudeVersion:
|
|
14178
|
+
claudeVersion: import_zod23.z.strictObject({ version: import_zod23.z.string(), source: import_zod23.z.enum(CLAUDE_VERSION_SOURCES) }).optional(),
|
|
13933
14179
|
/** The real `claude` binary the launch would spawn, on the door's host. */
|
|
13934
|
-
bin:
|
|
14180
|
+
bin: import_zod23.z.string(),
|
|
13935
14181
|
/** The arguments the launch would pass it: the tool's own flags, then `CLAUDE_EXTRA_FLAGS`, then the caller's own. */
|
|
13936
|
-
args:
|
|
14182
|
+
args: import_zod23.z.readonly(import_zod23.z.array(import_zod23.z.string())),
|
|
13937
14183
|
/** The credential the launch would authenticate with, by target and source kinds. Absent when none applies. */
|
|
13938
|
-
credential:
|
|
13939
|
-
routing:
|
|
14184
|
+
credential: import_zod23.z.strictObject({ subject: import_zod23.z.enum(["provider", "identity"]), name: import_zod23.z.string(), summary: CredentialSummarySchema }).optional(),
|
|
14185
|
+
routing: import_zod23.z.strictObject({ frontDoor: import_zod23.z.boolean(), headroom: import_zod23.z.boolean() }),
|
|
13940
14186
|
/** The names of the environment variables the launch would set or unset, sorted. Values are not reported. */
|
|
13941
|
-
environment:
|
|
13942
|
-
warnings:
|
|
14187
|
+
environment: import_zod23.z.readonly(import_zod23.z.array(import_zod23.z.string())),
|
|
14188
|
+
warnings: import_zod23.z.readonly(import_zod23.z.array(import_zod23.z.string()))
|
|
13943
14189
|
});
|
|
13944
14190
|
|
|
13945
14191
|
// src/frontdoor/launchApi.ts
|
|
@@ -16207,6 +16453,8 @@ init_ownCli();
|
|
|
16207
16453
|
0 && (module.exports = {
|
|
16208
16454
|
AMBIENT_CREDENTIAL_VARS,
|
|
16209
16455
|
CHECK_CREDENTIAL_APPLIES,
|
|
16456
|
+
CODEX_APP_SERVER_GENERATED_AGAINST,
|
|
16457
|
+
CODEX_APP_SERVER_TIMEOUT_MS,
|
|
16210
16458
|
CONNECT_INTERCEPT_HOST,
|
|
16211
16459
|
CONNECT_INTERCEPT_HOSTS,
|
|
16212
16460
|
CONNECT_LIMITS,
|
|
@@ -16217,7 +16465,12 @@ init_ownCli();
|
|
|
16217
16465
|
CheckReportJsonSchema,
|
|
16218
16466
|
CheckRunInputSchema,
|
|
16219
16467
|
CliError,
|
|
16468
|
+
CodexAccountReadSchema,
|
|
16469
|
+
CodexAppServerProtocolError,
|
|
16470
|
+
CodexAppServerRequestError,
|
|
16471
|
+
CodexAppServerUnavailableError,
|
|
16220
16472
|
CodexLogoutOutputSchema,
|
|
16473
|
+
CodexRateLimitsReadSchema,
|
|
16221
16474
|
CodexSignInSchema,
|
|
16222
16475
|
CodexStatusOutputSchema,
|
|
16223
16476
|
ConfigIdentityAddOutputSchema,
|
|
@@ -16475,6 +16728,8 @@ init_ownCli();
|
|
|
16475
16728
|
rcSelfHostFromEnv,
|
|
16476
16729
|
rcWebFetchAllowsPrivateFromEnv,
|
|
16477
16730
|
readActiveIdentity,
|
|
16731
|
+
readCodexAccount,
|
|
16732
|
+
readCodexRateLimits,
|
|
16478
16733
|
readDirectoryRules,
|
|
16479
16734
|
readFarmManifest,
|
|
16480
16735
|
readFrontDoorControlMaterial,
|
|
@@ -16486,6 +16741,7 @@ init_ownCli();
|
|
|
16486
16741
|
readRcSelfHostRecord,
|
|
16487
16742
|
readRcSessionFile,
|
|
16488
16743
|
readUsageSnapshot,
|
|
16744
|
+
realCodexAppServerPort,
|
|
16489
16745
|
realConnectCertStore,
|
|
16490
16746
|
realConnectEffects,
|
|
16491
16747
|
realRcControlTransport,
|