claude-use 9.18.0 → 9.19.1
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 +432 -208
- package/dist/index.cjs +971 -787
- package/dist/index.mjs +956 -778
- package/dist/types/index.d.ts +316 -131
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -717,7 +717,7 @@ function compile(pattern, category, source, ordinal) {
|
|
|
717
717
|
matches: isExact ? (name) => name === pattern : (name) => matcher(name)
|
|
718
718
|
};
|
|
719
719
|
}
|
|
720
|
-
function compileClassificationPatterns(defaults,
|
|
720
|
+
function compileClassificationPatterns(defaults, overlay2) {
|
|
721
721
|
const compiled = [];
|
|
722
722
|
let ordinal = 0;
|
|
723
723
|
for (const category of CATEGORY_NAMES) {
|
|
@@ -726,9 +726,9 @@ function compileClassificationPatterns(defaults, overlay) {
|
|
|
726
726
|
ordinal += 1;
|
|
727
727
|
}
|
|
728
728
|
}
|
|
729
|
-
if (
|
|
729
|
+
if (overlay2 !== void 0) {
|
|
730
730
|
for (const category of CATEGORY_NAMES) {
|
|
731
|
-
for (const pattern of
|
|
731
|
+
for (const pattern of overlay2[category] ?? []) {
|
|
732
732
|
compiled.push(compile(pattern, category, "local", ordinal));
|
|
733
733
|
ordinal += 1;
|
|
734
734
|
}
|
|
@@ -749,10 +749,10 @@ function compareClassificationPatterns(a, b) {
|
|
|
749
749
|
return a.ordinal - b.ordinal;
|
|
750
750
|
}
|
|
751
751
|
function loadClassification(paths) {
|
|
752
|
-
const
|
|
752
|
+
const overlay2 = readJson(paths.categoriesLocalFile, CategoryClassificationOverlaySchema);
|
|
753
753
|
return {
|
|
754
754
|
defaults: CategoryClassificationSchema.parse(categories_default_default),
|
|
755
|
-
...
|
|
755
|
+
...overlay2 === void 0 ? {} : { overlay: overlay2 }
|
|
756
756
|
};
|
|
757
757
|
}
|
|
758
758
|
function classifyEntries(names, options) {
|
|
@@ -2693,7 +2693,7 @@ var init_package = __esm({
|
|
|
2693
2693
|
"package.json"() {
|
|
2694
2694
|
package_default = {
|
|
2695
2695
|
name: "claude-use",
|
|
2696
|
-
version: "9.
|
|
2696
|
+
version: "9.19.1",
|
|
2697
2697
|
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.",
|
|
2698
2698
|
license: "MIT",
|
|
2699
2699
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -2951,37 +2951,37 @@ function readStartLock(fs12, lockFile) {
|
|
|
2951
2951
|
return void 0;
|
|
2952
2952
|
}
|
|
2953
2953
|
}
|
|
2954
|
-
var import_node_crypto6, import_node_path11,
|
|
2954
|
+
var import_node_crypto6, import_node_path11, import_zod8, HEADROOM_ANTHROPIC_UPSTREAM, HeadroomStateSchema, HeadroomSessionSchema, HeadroomLockSchema;
|
|
2955
2955
|
var init_state2 = __esm({
|
|
2956
2956
|
"src/headroom/state.ts"() {
|
|
2957
2957
|
"use strict";
|
|
2958
2958
|
import_node_crypto6 = require("node:crypto");
|
|
2959
2959
|
import_node_path11 = __toESM(require("node:path"), 1);
|
|
2960
|
-
|
|
2960
|
+
import_zod8 = require("zod");
|
|
2961
2961
|
init_schema();
|
|
2962
2962
|
HEADROOM_ANTHROPIC_UPSTREAM = "https://api.anthropic.com";
|
|
2963
|
-
HeadroomStateSchema =
|
|
2963
|
+
HeadroomStateSchema = import_zod8.z.strictObject({
|
|
2964
2964
|
/** The supervisor process owning the daemon. Alive means someone is keeping headroom running. */
|
|
2965
|
-
supervisorPid:
|
|
2965
|
+
supervisorPid: import_zod8.z.number().int().positive().optional(),
|
|
2966
2966
|
/** The headroom proxy process itself. Absent while the supervisor is between restarts. */
|
|
2967
|
-
headroomPid:
|
|
2967
|
+
headroomPid: import_zod8.z.number().int().positive().optional(),
|
|
2968
2968
|
/**
|
|
2969
2969
|
* 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.
|
|
2970
2970
|
*/
|
|
2971
|
-
socketPath:
|
|
2971
|
+
socketPath: import_zod8.z.string().min(1).optional(),
|
|
2972
2972
|
/** The `headroom --version` output of the running install. */
|
|
2973
|
-
version:
|
|
2973
|
+
version: import_zod8.z.string().optional(),
|
|
2974
2974
|
/** Hash of the allowlist the running proxy was started with, so a provider-file change is detected as drift. */
|
|
2975
|
-
allowlistHash:
|
|
2975
|
+
allowlistHash: import_zod8.z.string().optional(),
|
|
2976
2976
|
/** Hash of the token-saving settings the running proxy was started with, so a settings change is detected as drift. */
|
|
2977
|
-
settingsHash:
|
|
2977
|
+
settingsHash: import_zod8.z.string().optional(),
|
|
2978
2978
|
/** The install spec the running install was last installed from, so a `source` config change is detected as drift. */
|
|
2979
|
-
installedSource:
|
|
2979
|
+
installedSource: import_zod8.z.string().optional(),
|
|
2980
2980
|
/** The last fatal error, kept across shutdowns so `headroom status` can explain a daemon that is not running. */
|
|
2981
|
-
lastError:
|
|
2981
|
+
lastError: import_zod8.z.string().optional()
|
|
2982
2982
|
});
|
|
2983
|
-
HeadroomSessionSchema =
|
|
2984
|
-
HeadroomLockSchema =
|
|
2983
|
+
HeadroomSessionSchema = import_zod8.z.strictObject({ pid: import_zod8.z.number().int().positive(), startedAt: import_zod8.z.number(), supervisorPid: import_zod8.z.number().int().positive() });
|
|
2984
|
+
HeadroomLockSchema = import_zod8.z.strictObject({ pid: import_zod8.z.number().int().positive(), at: import_zod8.z.number() });
|
|
2985
2985
|
}
|
|
2986
2986
|
});
|
|
2987
2987
|
|
|
@@ -3188,14 +3188,14 @@ function pinnedGitCommit(spec) {
|
|
|
3188
3188
|
const ref = GIT_SPEC_RE.exec(spec)?.[1];
|
|
3189
3189
|
return ref !== void 0 && COMMIT_SHA_RE.test(ref) ? ref.toLowerCase() : void 0;
|
|
3190
3190
|
}
|
|
3191
|
-
var
|
|
3191
|
+
var import_zod9, GIT_SPEC_RE, COMMIT_SHA_RE, DirectUrlSchema;
|
|
3192
3192
|
var init_source = __esm({
|
|
3193
3193
|
"src/headroom/source.ts"() {
|
|
3194
3194
|
"use strict";
|
|
3195
|
-
|
|
3195
|
+
import_zod9 = require("zod");
|
|
3196
3196
|
GIT_SPEC_RE = /git\+[^@\s]+(?:@([^\s#]+))?/;
|
|
3197
3197
|
COMMIT_SHA_RE = /^[0-9a-f]{40}$/i;
|
|
3198
|
-
DirectUrlSchema =
|
|
3198
|
+
DirectUrlSchema = import_zod9.z.object({ vcs_info: import_zod9.z.object({ commit_id: import_zod9.z.string() }) });
|
|
3199
3199
|
}
|
|
3200
3200
|
});
|
|
3201
3201
|
|
|
@@ -4111,149 +4111,149 @@ var init_identity = __esm({
|
|
|
4111
4111
|
});
|
|
4112
4112
|
|
|
4113
4113
|
// src/usage/schema.ts
|
|
4114
|
-
var
|
|
4114
|
+
var import_zod10, USAGE_SCHEMA_VERSION, VersionSchema, InstantSchema, TokenCountSchema, TokenUsageSchema, LIMIT_KINDS, LimitClassificationSchema, UsageRecordSchema, QuotaWindowSchema, ExtraUsageSpendSchema, UnifiedRateLimitSchema, RateLimitStateSchema, LimitEventSchema, ProviderQuotaWindowSchema, ProviderQuotaSchema, ProviderUsageStateSchema, AccountMetadataSchema, UsageSnapshotSchema;
|
|
4115
4115
|
var init_schema2 = __esm({
|
|
4116
4116
|
"src/usage/schema.ts"() {
|
|
4117
4117
|
"use strict";
|
|
4118
|
-
|
|
4118
|
+
import_zod10 = require("zod");
|
|
4119
4119
|
USAGE_SCHEMA_VERSION = 1;
|
|
4120
|
-
VersionSchema =
|
|
4121
|
-
InstantSchema =
|
|
4122
|
-
TokenCountSchema =
|
|
4123
|
-
TokenUsageSchema =
|
|
4120
|
+
VersionSchema = import_zod10.z.literal(USAGE_SCHEMA_VERSION);
|
|
4121
|
+
InstantSchema = import_zod10.z.iso.datetime();
|
|
4122
|
+
TokenCountSchema = import_zod10.z.number().int().nonnegative();
|
|
4123
|
+
TokenUsageSchema = import_zod10.z.strictObject({
|
|
4124
4124
|
inputTokens: TokenCountSchema.optional(),
|
|
4125
4125
|
outputTokens: TokenCountSchema.optional(),
|
|
4126
4126
|
cacheCreationInputTokens: TokenCountSchema.optional(),
|
|
4127
4127
|
cacheReadInputTokens: TokenCountSchema.optional()
|
|
4128
4128
|
});
|
|
4129
4129
|
LIMIT_KINDS = ["rate-limited", "quota-exhausted"];
|
|
4130
|
-
LimitClassificationSchema =
|
|
4131
|
-
kind:
|
|
4130
|
+
LimitClassificationSchema = import_zod10.z.strictObject({
|
|
4131
|
+
kind: import_zod10.z.enum(LIMIT_KINDS),
|
|
4132
4132
|
/** Seconds to wait before retrying, from the response's `retry-after`. */
|
|
4133
|
-
retryAfterSeconds:
|
|
4133
|
+
retryAfterSeconds: import_zod10.z.number().nonnegative().optional(),
|
|
4134
4134
|
/** When the limiting window resets, from the upstream's own reset header. */
|
|
4135
4135
|
resetAt: InstantSchema.optional(),
|
|
4136
4136
|
/** The window the upstream named as the binding one (`anthropic-ratelimit-unified-representative-claim`), such as `five_hour` or `seven_day`. */
|
|
4137
|
-
window:
|
|
4137
|
+
window: import_zod10.z.string().optional(),
|
|
4138
4138
|
/** 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. */
|
|
4139
|
-
evidence:
|
|
4139
|
+
evidence: import_zod10.z.array(import_zod10.z.string())
|
|
4140
4140
|
});
|
|
4141
|
-
UsageRecordSchema =
|
|
4141
|
+
UsageRecordSchema = import_zod10.z.strictObject({
|
|
4142
4142
|
schemaVersion: VersionSchema,
|
|
4143
4143
|
/** When the front door received the request. */
|
|
4144
4144
|
at: InstantSchema,
|
|
4145
4145
|
/** The launching identity, when the launch resolved one. */
|
|
4146
|
-
identity:
|
|
4146
|
+
identity: import_zod10.z.string().optional(),
|
|
4147
4147
|
/** `anthropic` for an OAuth session's request to Claude Code's own API, otherwise the provider's name. */
|
|
4148
|
-
provider:
|
|
4148
|
+
provider: import_zod10.z.string(),
|
|
4149
4149
|
/** The launch's session id, generated per launch. */
|
|
4150
|
-
sessionId:
|
|
4150
|
+
sessionId: import_zod10.z.string().optional(),
|
|
4151
4151
|
/** The project the launch ran in (its git repository root), when the launch sent one: headroom launches do. */
|
|
4152
|
-
project:
|
|
4152
|
+
project: import_zod10.z.string().optional(),
|
|
4153
4153
|
/** The front-door route that served the request. */
|
|
4154
|
-
route:
|
|
4155
|
-
method:
|
|
4154
|
+
route: import_zod10.z.string(),
|
|
4155
|
+
method: import_zod10.z.string(),
|
|
4156
4156
|
/** The API path as the upstream sees it (`/v1/messages`), without the provider prefix or a query string. */
|
|
4157
|
-
endpoint:
|
|
4157
|
+
endpoint: import_zod10.z.string(),
|
|
4158
4158
|
/** The model the response named. */
|
|
4159
|
-
model:
|
|
4160
|
-
status:
|
|
4159
|
+
model: import_zod10.z.string().optional(),
|
|
4160
|
+
status: import_zod10.z.number().int(),
|
|
4161
4161
|
/** Milliseconds from the request's arrival to its response head. */
|
|
4162
|
-
latencyMs:
|
|
4162
|
+
latencyMs: import_zod10.z.number().int().nonnegative(),
|
|
4163
4163
|
/** Milliseconds from the request's arrival to the end of its response body. */
|
|
4164
|
-
durationMs:
|
|
4164
|
+
durationMs: import_zod10.z.number().int().nonnegative(),
|
|
4165
4165
|
/** Whether the client received the whole body. */
|
|
4166
|
-
outcome:
|
|
4166
|
+
outcome: import_zod10.z.enum(["completed", "aborted"]),
|
|
4167
4167
|
usage: TokenUsageSchema.optional(),
|
|
4168
4168
|
/** The response's quota and rate-limit headers, by name (see `isRateLimitHeader`). */
|
|
4169
|
-
rateLimitHeaders:
|
|
4169
|
+
rateLimitHeaders: import_zod10.z.record(import_zod10.z.string(), import_zod10.z.string()).optional(),
|
|
4170
4170
|
limit: LimitClassificationSchema.optional(),
|
|
4171
4171
|
/** The upstream's request id (`request-id`), for matching a record to the provider's own logs. */
|
|
4172
|
-
requestId:
|
|
4172
|
+
requestId: import_zod10.z.string().optional()
|
|
4173
4173
|
});
|
|
4174
|
-
QuotaWindowSchema =
|
|
4174
|
+
QuotaWindowSchema = import_zod10.z.strictObject({
|
|
4175
4175
|
/** The fraction of the window used, as the upstream reports it (0 to 1). */
|
|
4176
|
-
utilization:
|
|
4176
|
+
utilization: import_zod10.z.number().nonnegative().optional(),
|
|
4177
4177
|
resetsAt: InstantSchema.optional(),
|
|
4178
4178
|
/** The window's own status (`allowed`, `allowed_warning`, `rejected`). */
|
|
4179
|
-
status:
|
|
4179
|
+
status: import_zod10.z.string().optional(),
|
|
4180
4180
|
/** 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. */
|
|
4181
|
-
graceUtilization:
|
|
4181
|
+
graceUtilization: import_zod10.z.number().nonnegative().optional()
|
|
4182
4182
|
});
|
|
4183
|
-
ExtraUsageSpendSchema =
|
|
4183
|
+
ExtraUsageSpendSchema = import_zod10.z.strictObject({
|
|
4184
4184
|
/** Spent so far in the allowance's period, in the currency's minor units (pence, cents). */
|
|
4185
|
-
usedMinor:
|
|
4185
|
+
usedMinor: import_zod10.z.number().nonnegative(),
|
|
4186
4186
|
/** The allowance's cap in the same units, when it has one. */
|
|
4187
|
-
limitMinor:
|
|
4187
|
+
limitMinor: import_zod10.z.number().nonnegative().optional(),
|
|
4188
4188
|
/** The ISO 4217 currency code. */
|
|
4189
|
-
currency:
|
|
4189
|
+
currency: import_zod10.z.string()
|
|
4190
4190
|
});
|
|
4191
|
-
UnifiedRateLimitSchema =
|
|
4191
|
+
UnifiedRateLimitSchema = import_zod10.z.strictObject({
|
|
4192
4192
|
/** The overall status: `allowed`, `allowed_warning` or `rejected`. */
|
|
4193
|
-
status:
|
|
4193
|
+
status: import_zod10.z.string().optional(),
|
|
4194
4194
|
fiveHour: QuotaWindowSchema.optional(),
|
|
4195
4195
|
sevenDay: QuotaWindowSchema.optional(),
|
|
4196
4196
|
/** 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. */
|
|
4197
4197
|
sevenDayOverageIncluded: QuotaWindowSchema.optional(),
|
|
4198
4198
|
/** The window that currently binds. */
|
|
4199
|
-
representativeClaim:
|
|
4199
|
+
representativeClaim: import_zod10.z.string().optional(),
|
|
4200
4200
|
/** When the binding window resets. */
|
|
4201
4201
|
resetAt: InstantSchema.optional(),
|
|
4202
4202
|
/** Whether usage beyond the plan (extra usage) is available: `allowed` or `rejected`. */
|
|
4203
|
-
overageStatus:
|
|
4203
|
+
overageStatus: import_zod10.z.string().optional(),
|
|
4204
4204
|
/** 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. */
|
|
4205
|
-
overageUtilization:
|
|
4205
|
+
overageUtilization: import_zod10.z.number().nonnegative().optional(),
|
|
4206
4206
|
/** When the extra-usage allowance resets. */
|
|
4207
4207
|
overageResetsAt: InstantSchema.optional(),
|
|
4208
4208
|
/** Why extra usage is unavailable, as the upstream names it (`out_of_credits`, for one). */
|
|
4209
|
-
overageDisabledReason:
|
|
4209
|
+
overageDisabledReason: import_zod10.z.string().optional(),
|
|
4210
4210
|
/** Whether the response was served on extra usage, as the upstream states it. */
|
|
4211
|
-
overageInUse:
|
|
4211
|
+
overageInUse: import_zod10.z.boolean().optional(),
|
|
4212
4212
|
/** The allowance in money, from the usage endpoint (the response headers state only the fraction). */
|
|
4213
4213
|
extraUsageSpend: ExtraUsageSpendSchema.optional(),
|
|
4214
4214
|
/** True when the upstream offers a fallback while a window is rejected: some requests, by model, are still served, though the rest are refused. */
|
|
4215
|
-
fallbackAvailable:
|
|
4215
|
+
fallbackAvailable: import_zod10.z.boolean().optional()
|
|
4216
4216
|
});
|
|
4217
|
-
RateLimitStateSchema =
|
|
4217
|
+
RateLimitStateSchema = import_zod10.z.strictObject({
|
|
4218
4218
|
observedAt: InstantSchema,
|
|
4219
4219
|
/** Every quota and rate-limit header on that response, by name. */
|
|
4220
|
-
headers:
|
|
4220
|
+
headers: import_zod10.z.record(import_zod10.z.string(), import_zod10.z.string()),
|
|
4221
4221
|
unified: UnifiedRateLimitSchema.optional(),
|
|
4222
4222
|
/** 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. */
|
|
4223
4223
|
planWindowsUnavailableAt: InstantSchema.optional()
|
|
4224
4224
|
});
|
|
4225
4225
|
LimitEventSchema = LimitClassificationSchema.extend({
|
|
4226
4226
|
observedAt: InstantSchema,
|
|
4227
|
-
status:
|
|
4227
|
+
status: import_zod10.z.number().int()
|
|
4228
4228
|
});
|
|
4229
|
-
ProviderQuotaWindowSchema =
|
|
4229
|
+
ProviderQuotaWindowSchema = import_zod10.z.strictObject({
|
|
4230
4230
|
/** What the window measures, in the provider's terms (`tokens`, `tool-calls`). */
|
|
4231
|
-
measures:
|
|
4231
|
+
measures: import_zod10.z.string(),
|
|
4232
4232
|
/** 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. */
|
|
4233
|
-
periodMs:
|
|
4233
|
+
periodMs: import_zod10.z.number().int().positive().optional(),
|
|
4234
4234
|
/** The provider's own description of the period when `periodMs` could not be derived, such as `unit 4 x 1`. */
|
|
4235
|
-
period:
|
|
4235
|
+
period: import_zod10.z.string().optional(),
|
|
4236
4236
|
/** The fraction of the window used (0 to 1). */
|
|
4237
|
-
utilization:
|
|
4237
|
+
utilization: import_zod10.z.number().nonnegative(),
|
|
4238
4238
|
resetsAt: InstantSchema.optional(),
|
|
4239
4239
|
/** Absolute counts, when the provider reports them for this window. */
|
|
4240
|
-
limit:
|
|
4241
|
-
used:
|
|
4242
|
-
remaining:
|
|
4240
|
+
limit: import_zod10.z.number().nonnegative().optional(),
|
|
4241
|
+
used: import_zod10.z.number().nonnegative().optional(),
|
|
4242
|
+
remaining: import_zod10.z.number().nonnegative().optional()
|
|
4243
4243
|
});
|
|
4244
|
-
ProviderQuotaSchema =
|
|
4244
|
+
ProviderQuotaSchema = import_zod10.z.strictObject({
|
|
4245
4245
|
observedAt: InstantSchema,
|
|
4246
4246
|
/** Which usage endpoint produced it (`z.ai`). */
|
|
4247
|
-
source:
|
|
4247
|
+
source: import_zod10.z.string(),
|
|
4248
4248
|
/** The subscription level the endpoint reports, when it does. */
|
|
4249
|
-
level:
|
|
4250
|
-
windows:
|
|
4249
|
+
level: import_zod10.z.string().optional(),
|
|
4250
|
+
windows: import_zod10.z.array(ProviderQuotaWindowSchema)
|
|
4251
4251
|
});
|
|
4252
|
-
ProviderUsageStateSchema =
|
|
4252
|
+
ProviderUsageStateSchema = import_zod10.z.strictObject({
|
|
4253
4253
|
/** 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. */
|
|
4254
4254
|
lastRequestAt: InstantSchema.optional(),
|
|
4255
|
-
lastStatus:
|
|
4256
|
-
lastModel:
|
|
4255
|
+
lastStatus: import_zod10.z.number().int().optional(),
|
|
4256
|
+
lastModel: import_zod10.z.string().optional(),
|
|
4257
4257
|
/** The latest rate-limit state, from the last response that carried any rate-limit header. */
|
|
4258
4258
|
rateLimit: RateLimitStateSchema.optional(),
|
|
4259
4259
|
/** The latest classified refusal. It stays after later successes, so a reader compares its `resetAt` (or `observedAt` plus `retryAfterSeconds`) with the current time. */
|
|
@@ -4261,31 +4261,31 @@ var init_schema2 = __esm({
|
|
|
4261
4261
|
/** The latest quota the provider's usage endpoint reported, for providers whose quota is not visible in response headers. */
|
|
4262
4262
|
quota: ProviderQuotaSchema.optional()
|
|
4263
4263
|
});
|
|
4264
|
-
AccountMetadataSchema =
|
|
4265
|
-
accountUuid:
|
|
4266
|
-
emailAddress:
|
|
4267
|
-
displayName:
|
|
4268
|
-
organizationUuid:
|
|
4269
|
-
organizationName:
|
|
4270
|
-
organizationType:
|
|
4271
|
-
organizationRole:
|
|
4272
|
-
workspaceRole:
|
|
4273
|
-
billingType:
|
|
4274
|
-
seatTier:
|
|
4275
|
-
organizationRateLimitTier:
|
|
4276
|
-
userRateLimitTier:
|
|
4277
|
-
hasExtraUsageEnabled:
|
|
4278
|
-
subscriptionCreatedAt:
|
|
4279
|
-
accountCreatedAt:
|
|
4264
|
+
AccountMetadataSchema = import_zod10.z.strictObject({
|
|
4265
|
+
accountUuid: import_zod10.z.string().optional(),
|
|
4266
|
+
emailAddress: import_zod10.z.string().optional(),
|
|
4267
|
+
displayName: import_zod10.z.string().optional(),
|
|
4268
|
+
organizationUuid: import_zod10.z.string().optional(),
|
|
4269
|
+
organizationName: import_zod10.z.string().optional(),
|
|
4270
|
+
organizationType: import_zod10.z.string().optional(),
|
|
4271
|
+
organizationRole: import_zod10.z.string().optional(),
|
|
4272
|
+
workspaceRole: import_zod10.z.string().optional(),
|
|
4273
|
+
billingType: import_zod10.z.string().optional(),
|
|
4274
|
+
seatTier: import_zod10.z.string().optional(),
|
|
4275
|
+
organizationRateLimitTier: import_zod10.z.string().optional(),
|
|
4276
|
+
userRateLimitTier: import_zod10.z.string().optional(),
|
|
4277
|
+
hasExtraUsageEnabled: import_zod10.z.boolean().optional(),
|
|
4278
|
+
subscriptionCreatedAt: import_zod10.z.string().optional(),
|
|
4279
|
+
accountCreatedAt: import_zod10.z.string().optional()
|
|
4280
4280
|
});
|
|
4281
|
-
UsageSnapshotSchema =
|
|
4281
|
+
UsageSnapshotSchema = import_zod10.z.strictObject({
|
|
4282
4282
|
schemaVersion: VersionSchema,
|
|
4283
|
-
identity:
|
|
4283
|
+
identity: import_zod10.z.string(),
|
|
4284
4284
|
updatedAt: InstantSchema,
|
|
4285
4285
|
/** The identity's account metadata as of `updatedAt`. */
|
|
4286
4286
|
account: AccountMetadataSchema.optional(),
|
|
4287
4287
|
/** Latest state per provider, keyed by provider name (`anthropic` for OAuth sessions). */
|
|
4288
|
-
providers:
|
|
4288
|
+
providers: import_zod10.z.record(import_zod10.z.string(), ProviderUsageStateSchema)
|
|
4289
4289
|
});
|
|
4290
4290
|
}
|
|
4291
4291
|
});
|
|
@@ -4392,24 +4392,24 @@ function planOf(account) {
|
|
|
4392
4392
|
}
|
|
4393
4393
|
return { kind: "subscription", capacity: 1, recognised: BASE_TIER.test(tier), ...tierField };
|
|
4394
4394
|
}
|
|
4395
|
-
var
|
|
4395
|
+
var import_zod11, PlanClassSchema, TIER_MULTIPLIER, ZERO_TIER, BASE_TIER;
|
|
4396
4396
|
var init_plan2 = __esm({
|
|
4397
4397
|
"src/usage/plan.ts"() {
|
|
4398
4398
|
"use strict";
|
|
4399
|
-
|
|
4400
|
-
PlanClassSchema =
|
|
4401
|
-
|
|
4402
|
-
kind:
|
|
4399
|
+
import_zod11 = require("zod");
|
|
4400
|
+
PlanClassSchema = import_zod11.z.union([
|
|
4401
|
+
import_zod11.z.strictObject({
|
|
4402
|
+
kind: import_zod11.z.literal("subscription"),
|
|
4403
4403
|
/** The plan's size as a multiple of the smallest subscription tier (Max 5x is 5, Max 20x is 20). */
|
|
4404
|
-
capacity:
|
|
4404
|
+
capacity: import_zod11.z.number().positive(),
|
|
4405
4405
|
/** False when the tier string named no multiplier and no tier this project knows, so `capacity` is the neutral 1 rather than a reading. */
|
|
4406
|
-
recognised:
|
|
4406
|
+
recognised: import_zod11.z.boolean(),
|
|
4407
4407
|
/** The tier string the classification rests on, when the account had one. */
|
|
4408
|
-
tier:
|
|
4408
|
+
tier: import_zod11.z.string().optional()
|
|
4409
4409
|
}),
|
|
4410
|
-
|
|
4411
|
-
kind:
|
|
4412
|
-
tier:
|
|
4410
|
+
import_zod11.z.strictObject({
|
|
4411
|
+
kind: import_zod11.z.literal("pay-per-use"),
|
|
4412
|
+
tier: import_zod11.z.string().optional()
|
|
4413
4413
|
})
|
|
4414
4414
|
]);
|
|
4415
4415
|
TIER_MULTIPLIER = /(?:^|_)(\d+)x$/;
|
|
@@ -4510,21 +4510,21 @@ var init_rateLimit = __esm({
|
|
|
4510
4510
|
});
|
|
4511
4511
|
|
|
4512
4512
|
// src/usage/scan.ts
|
|
4513
|
-
var
|
|
4513
|
+
var import_zod12, AnthropicUsageSchema, ErrorObjectSchema;
|
|
4514
4514
|
var init_scan = __esm({
|
|
4515
4515
|
"src/usage/scan.ts"() {
|
|
4516
4516
|
"use strict";
|
|
4517
|
-
|
|
4518
|
-
AnthropicUsageSchema =
|
|
4519
|
-
input_tokens:
|
|
4520
|
-
output_tokens:
|
|
4521
|
-
cache_creation_input_tokens:
|
|
4522
|
-
cache_read_input_tokens:
|
|
4517
|
+
import_zod12 = require("zod");
|
|
4518
|
+
AnthropicUsageSchema = import_zod12.z.looseObject({
|
|
4519
|
+
input_tokens: import_zod12.z.number().int().nonnegative().nullish(),
|
|
4520
|
+
output_tokens: import_zod12.z.number().int().nonnegative().nullish(),
|
|
4521
|
+
cache_creation_input_tokens: import_zod12.z.number().int().nonnegative().nullish(),
|
|
4522
|
+
cache_read_input_tokens: import_zod12.z.number().int().nonnegative().nullish()
|
|
4523
4523
|
});
|
|
4524
|
-
ErrorObjectSchema =
|
|
4525
|
-
type:
|
|
4526
|
-
code:
|
|
4527
|
-
message:
|
|
4524
|
+
ErrorObjectSchema = import_zod12.z.looseObject({
|
|
4525
|
+
type: import_zod12.z.string().optional(),
|
|
4526
|
+
code: import_zod12.z.union([import_zod12.z.string(), import_zod12.z.number()]).optional(),
|
|
4527
|
+
message: import_zod12.z.string().optional()
|
|
4528
4528
|
});
|
|
4529
4529
|
}
|
|
4530
4530
|
});
|
|
@@ -5258,12 +5258,12 @@ function recordStickyPick(fs12, picksFile, directory, identity, nowMs) {
|
|
|
5258
5258
|
fs12.writeFilePrivate(picksFile, `${JSON.stringify(next, null, 2)}
|
|
5259
5259
|
`);
|
|
5260
5260
|
}
|
|
5261
|
-
var import_node_path20,
|
|
5261
|
+
var import_node_path20, import_zod13, PoolGraphError, SCHEMA_VERSION, PickEntrySchema, PicksFileSchema;
|
|
5262
5262
|
var init_poolPick = __esm({
|
|
5263
5263
|
"src/usage/poolPick.ts"() {
|
|
5264
5264
|
"use strict";
|
|
5265
5265
|
import_node_path20 = __toESM(require("node:path"), 1);
|
|
5266
|
-
|
|
5266
|
+
import_zod13 = require("zod");
|
|
5267
5267
|
init_cliError();
|
|
5268
5268
|
init_identity();
|
|
5269
5269
|
init_schema();
|
|
@@ -5279,10 +5279,10 @@ var init_poolPick = __esm({
|
|
|
5279
5279
|
}
|
|
5280
5280
|
};
|
|
5281
5281
|
SCHEMA_VERSION = 1;
|
|
5282
|
-
PickEntrySchema =
|
|
5283
|
-
PicksFileSchema =
|
|
5284
|
-
schemaVersion:
|
|
5285
|
-
picks:
|
|
5282
|
+
PickEntrySchema = import_zod13.z.strictObject({ identity: import_zod13.z.string().min(1), at: import_zod13.z.iso.datetime() });
|
|
5283
|
+
PicksFileSchema = import_zod13.z.strictObject({
|
|
5284
|
+
schemaVersion: import_zod13.z.literal(SCHEMA_VERSION),
|
|
5285
|
+
picks: import_zod13.z.record(import_zod13.z.string().min(1), PickEntrySchema)
|
|
5286
5286
|
});
|
|
5287
5287
|
}
|
|
5288
5288
|
});
|
|
@@ -5422,17 +5422,17 @@ function formatCachedCredentialState(state) {
|
|
|
5422
5422
|
}
|
|
5423
5423
|
return state.status === "fresh" ? `${age}, expires in ${formatAge(state.expiresInMs)}` : `${age}, expired ${formatAge(-state.expiresInMs)} ago`;
|
|
5424
5424
|
}
|
|
5425
|
-
var
|
|
5425
|
+
var import_zod14, MS_PER_UNIT, CachedCredentialSchema;
|
|
5426
5426
|
var init_credentialCache = __esm({
|
|
5427
5427
|
"src/credentialCache.ts"() {
|
|
5428
5428
|
"use strict";
|
|
5429
|
-
|
|
5429
|
+
import_zod14 = require("zod");
|
|
5430
5430
|
init_schema();
|
|
5431
5431
|
init_preflight();
|
|
5432
5432
|
MS_PER_UNIT = { s: 1e3, m: 6e4, h: 36e5, d: 864e5 };
|
|
5433
|
-
CachedCredentialSchema =
|
|
5434
|
-
token:
|
|
5435
|
-
fetchedAt:
|
|
5433
|
+
CachedCredentialSchema = import_zod14.z.strictObject({
|
|
5434
|
+
token: import_zod14.z.string().min(1),
|
|
5435
|
+
fetchedAt: import_zod14.z.number().int().nonnegative(),
|
|
5436
5436
|
source: CredentialSourceSchema
|
|
5437
5437
|
});
|
|
5438
5438
|
}
|
|
@@ -5703,14 +5703,14 @@ function providerJsonPath(paths, name) {
|
|
|
5703
5703
|
function providerExists(paths, name) {
|
|
5704
5704
|
return import_node_fs6.default.existsSync(providerJsonPath(paths, name));
|
|
5705
5705
|
}
|
|
5706
|
-
function
|
|
5706
|
+
function isRecord5(value) {
|
|
5707
5707
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5708
5708
|
}
|
|
5709
5709
|
function legacyProviderConversion(raw) {
|
|
5710
|
-
if (!
|
|
5710
|
+
if (!isRecord5(raw) || "credential" in raw) {
|
|
5711
5711
|
return void 0;
|
|
5712
5712
|
}
|
|
5713
|
-
const env =
|
|
5713
|
+
const env = isRecord5(raw.env) ? raw.env : void 0;
|
|
5714
5714
|
const legacyEnvKeys = env === void 0 ? [] : Object.keys(env).filter((key) => LEGACY_ENV_CREDENTIAL_KEYS.includes(key));
|
|
5715
5715
|
const fields = [...LEGACY_PROVIDER_FIELDS.filter((field) => field in raw), ...legacyEnvKeys.map((key) => `env.${key}`)];
|
|
5716
5716
|
if (fields.length === 0) {
|
|
@@ -6173,21 +6173,21 @@ function findPathShadow(params) {
|
|
|
6173
6173
|
}
|
|
6174
6174
|
return params.pathDirs.some((dir) => import_node_path26.default.resolve(dir) === resolvedTargetDir) ? { status: "ok" } : { status: "not-on-path" };
|
|
6175
6175
|
}
|
|
6176
|
-
var import_node_fs7, import_node_path26,
|
|
6176
|
+
var import_node_fs7, import_node_path26, import_zod19, ClaudeShimStateSchema, nodeLinkFs;
|
|
6177
6177
|
var init_claudeShim = __esm({
|
|
6178
6178
|
"src/claudeShim.ts"() {
|
|
6179
6179
|
"use strict";
|
|
6180
6180
|
import_node_fs7 = __toESM(require("node:fs"), 1);
|
|
6181
6181
|
import_node_path26 = __toESM(require("node:path"), 1);
|
|
6182
|
-
|
|
6182
|
+
import_zod19 = require("zod");
|
|
6183
6183
|
init_commandDeps();
|
|
6184
6184
|
init_store();
|
|
6185
6185
|
init_realPorts();
|
|
6186
6186
|
init_cliError();
|
|
6187
|
-
ClaudeShimStateSchema =
|
|
6188
|
-
targetPath:
|
|
6189
|
-
method:
|
|
6190
|
-
installedAtMs:
|
|
6187
|
+
ClaudeShimStateSchema = import_zod19.z.strictObject({
|
|
6188
|
+
targetPath: import_zod19.z.string().min(1),
|
|
6189
|
+
method: import_zod19.z.enum(["hardlink", "copy"]),
|
|
6190
|
+
installedAtMs: import_zod19.z.number()
|
|
6191
6191
|
});
|
|
6192
6192
|
nodeLinkFs = { link: import_node_fs7.default.linkSync, copyFile: import_node_fs7.default.copyFileSync, chmod: import_node_fs7.default.chmodSync };
|
|
6193
6193
|
}
|
|
@@ -7904,11 +7904,11 @@ var init_identityClaude = __esm({
|
|
|
7904
7904
|
});
|
|
7905
7905
|
|
|
7906
7906
|
// src/usage/providerQuota.ts
|
|
7907
|
-
var
|
|
7907
|
+
var import_zod29, MS_PER_SECOND7, SECONDS_PER_HOUR, HOURS_PER_DAY4, 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;
|
|
7908
7908
|
var init_providerQuota = __esm({
|
|
7909
7909
|
"src/usage/providerQuota.ts"() {
|
|
7910
7910
|
"use strict";
|
|
7911
|
-
|
|
7911
|
+
import_zod29 = require("zod");
|
|
7912
7912
|
init_schema2();
|
|
7913
7913
|
MS_PER_SECOND7 = 1e3;
|
|
7914
7914
|
SECONDS_PER_HOUR = 3600;
|
|
@@ -7922,35 +7922,35 @@ var init_providerQuota = __esm({
|
|
|
7922
7922
|
[ZAI_UNIT_HOURS, SECONDS_PER_HOUR * MS_PER_SECOND7],
|
|
7923
7923
|
[ZAI_UNIT_MONTHS, DAYS_PER_MONTH * HOURS_PER_DAY4 * SECONDS_PER_HOUR * MS_PER_SECOND7]
|
|
7924
7924
|
]);
|
|
7925
|
-
ZaiLimitSchema =
|
|
7926
|
-
type:
|
|
7927
|
-
unit:
|
|
7928
|
-
number:
|
|
7929
|
-
percentage:
|
|
7930
|
-
nextResetTime:
|
|
7931
|
-
usage:
|
|
7932
|
-
currentValue:
|
|
7933
|
-
remaining:
|
|
7925
|
+
ZaiLimitSchema = import_zod29.z.object({
|
|
7926
|
+
type: import_zod29.z.string(),
|
|
7927
|
+
unit: import_zod29.z.number().int(),
|
|
7928
|
+
number: import_zod29.z.number().int().positive(),
|
|
7929
|
+
percentage: import_zod29.z.number().nonnegative(),
|
|
7930
|
+
nextResetTime: import_zod29.z.number().positive().optional(),
|
|
7931
|
+
usage: import_zod29.z.number().nonnegative().optional(),
|
|
7932
|
+
currentValue: import_zod29.z.number().nonnegative().optional(),
|
|
7933
|
+
remaining: import_zod29.z.number().nonnegative().optional()
|
|
7934
7934
|
});
|
|
7935
|
-
ZaiResponseSchema =
|
|
7936
|
-
success:
|
|
7937
|
-
msg:
|
|
7938
|
-
data:
|
|
7935
|
+
ZaiResponseSchema = import_zod29.z.object({
|
|
7936
|
+
success: import_zod29.z.boolean(),
|
|
7937
|
+
msg: import_zod29.z.string().optional(),
|
|
7938
|
+
data: import_zod29.z.object({ level: import_zod29.z.string().optional(), limits: import_zod29.z.array(ZaiLimitSchema) })
|
|
7939
7939
|
});
|
|
7940
7940
|
OPENROUTER_HOST = "openrouter.ai";
|
|
7941
7941
|
OPENROUTER_KEY_URL = `https://${OPENROUTER_HOST}/api/v1/key`;
|
|
7942
7942
|
OPENROUTER_CREDITS_URL = `https://${OPENROUTER_HOST}/api/v1/credits`;
|
|
7943
7943
|
MS_PER_DAY3 = HOURS_PER_DAY4 * SECONDS_PER_HOUR * MS_PER_SECOND7;
|
|
7944
|
-
OpenRouterKeySchema =
|
|
7945
|
-
data:
|
|
7946
|
-
limit:
|
|
7947
|
-
limit_remaining:
|
|
7948
|
-
limit_reset:
|
|
7949
|
-
is_free_tier:
|
|
7950
|
-
free_model_daily_requests:
|
|
7944
|
+
OpenRouterKeySchema = import_zod29.z.object({
|
|
7945
|
+
data: import_zod29.z.object({
|
|
7946
|
+
limit: import_zod29.z.number().nonnegative().nullable(),
|
|
7947
|
+
limit_remaining: import_zod29.z.number().nullable(),
|
|
7948
|
+
limit_reset: import_zod29.z.string().nullable(),
|
|
7949
|
+
is_free_tier: import_zod29.z.boolean().optional(),
|
|
7950
|
+
free_model_daily_requests: import_zod29.z.object({ used: import_zod29.z.number().nonnegative(), limit: import_zod29.z.number().nonnegative(), remaining: import_zod29.z.number() }).optional()
|
|
7951
7951
|
})
|
|
7952
7952
|
});
|
|
7953
|
-
OpenRouterCreditsSchema =
|
|
7953
|
+
OpenRouterCreditsSchema = import_zod29.z.object({ data: import_zod29.z.object({ total_credits: import_zod29.z.number().nonnegative(), total_usage: import_zod29.z.number().nonnegative() }) });
|
|
7954
7954
|
}
|
|
7955
7955
|
});
|
|
7956
7956
|
|
|
@@ -8138,11 +8138,15 @@ __export(index_exports, {
|
|
|
8138
8138
|
InvalidIdentityNameError: () => InvalidIdentityNameError,
|
|
8139
8139
|
InvalidProviderNameError: () => InvalidProviderNameError,
|
|
8140
8140
|
LAUNCH_EVENT_SOURCE: () => LAUNCH_EVENT_SOURCE,
|
|
8141
|
+
LIVE_TASK_CAP: () => LIVE_TASK_CAP,
|
|
8141
8142
|
LaunchLifecycleEventSchema: () => LaunchLifecycleEventSchema,
|
|
8142
8143
|
LaunchRefusedError: () => LaunchRefusedError,
|
|
8143
8144
|
LaunchResolveInputSchema: () => LaunchResolveInputSchema,
|
|
8144
8145
|
LaunchResolveOutputSchema: () => LaunchResolveOutputSchema,
|
|
8145
8146
|
LegacyProviderFileError: () => LegacyProviderFileError,
|
|
8147
|
+
LiveTaskSchema: () => LiveTaskSchema,
|
|
8148
|
+
MergedAgentNodeSchema: () => MergedAgentNodeSchema,
|
|
8149
|
+
MergedAgentTreeSchema: () => MergedAgentTreeSchema,
|
|
8146
8150
|
OWN_CLI_FILE_NAME: () => OWN_CLI_FILE_NAME,
|
|
8147
8151
|
PROMPT_CACHE_TTL_MS: () => PROMPT_CACHE_TTL_MS,
|
|
8148
8152
|
PlanClassSchema: () => PlanClassSchema,
|
|
@@ -8210,6 +8214,7 @@ __export(index_exports, {
|
|
|
8210
8214
|
addProvider: () => addProvider,
|
|
8211
8215
|
agentShimCliPath: () => agentShimCliPath,
|
|
8212
8216
|
answerRcControlRequest: () => answerRcControlRequest,
|
|
8217
|
+
applyAgentTaskEvent: () => applyAgentTaskEvent,
|
|
8213
8218
|
authenticateRcSessionMcpServer: () => authenticateRcSessionMcpServer,
|
|
8214
8219
|
buildEntryFacts: () => buildEntryFacts,
|
|
8215
8220
|
buildLayoutPaths: () => buildLayoutPaths,
|
|
@@ -8311,6 +8316,7 @@ __export(index_exports, {
|
|
|
8311
8316
|
listUsageSnapshots: () => listUsageSnapshots,
|
|
8312
8317
|
locateSession: () => locateSession,
|
|
8313
8318
|
matchBranch: () => matchBranch,
|
|
8319
|
+
mergeLiveTasks: () => mergeLiveTasks,
|
|
8314
8320
|
mintLeaf: () => mintLeaf,
|
|
8315
8321
|
mintRcSelfHostCredential: () => mintRcSelfHostCredential,
|
|
8316
8322
|
observingRoutedRoute: () => observingRoutedRoute,
|
|
@@ -9311,6 +9317,264 @@ var HTTP_STATUS = {
|
|
|
9311
9317
|
badGateway: 502
|
|
9312
9318
|
};
|
|
9313
9319
|
|
|
9320
|
+
// src/agents/liveTasks.ts
|
|
9321
|
+
var import_zod5 = require("zod");
|
|
9322
|
+
|
|
9323
|
+
// src/agents/schema.ts
|
|
9324
|
+
var import_zod4 = require("zod");
|
|
9325
|
+
var AgentMetaSchema = import_zod4.z.looseObject({
|
|
9326
|
+
agentType: import_zod4.z.string(),
|
|
9327
|
+
isFork: import_zod4.z.boolean().optional(),
|
|
9328
|
+
description: import_zod4.z.string().optional(),
|
|
9329
|
+
name: import_zod4.z.string().optional(),
|
|
9330
|
+
toolUseId: import_zod4.z.string().optional(),
|
|
9331
|
+
spawnDepth: import_zod4.z.number().int().nonnegative().optional(),
|
|
9332
|
+
parentAgentId: import_zod4.z.string().optional(),
|
|
9333
|
+
model: import_zod4.z.string().optional(),
|
|
9334
|
+
requestShape: import_zod4.z.string().optional(),
|
|
9335
|
+
requestNonInteractive: import_zod4.z.boolean().optional(),
|
|
9336
|
+
workflowPhase: import_zod4.z.string().optional(),
|
|
9337
|
+
taskKind: import_zod4.z.string().optional(),
|
|
9338
|
+
teamName: import_zod4.z.string().optional(),
|
|
9339
|
+
worktreePath: import_zod4.z.string().optional(),
|
|
9340
|
+
worktreeBranch: import_zod4.z.string().optional(),
|
|
9341
|
+
stoppedByUser: import_zod4.z.boolean().optional()
|
|
9342
|
+
});
|
|
9343
|
+
var AgentKindSchema = import_zod4.z.enum(["subagent", "fork", "workflow-agent", "teammate"]);
|
|
9344
|
+
var AgentNodeFields = {
|
|
9345
|
+
id: import_zod4.z.string(),
|
|
9346
|
+
kind: AgentKindSchema,
|
|
9347
|
+
agentType: import_zod4.z.string(),
|
|
9348
|
+
description: import_zod4.z.string().optional(),
|
|
9349
|
+
name: import_zod4.z.string().optional(),
|
|
9350
|
+
toolUseId: import_zod4.z.string().optional(),
|
|
9351
|
+
spawnDepth: import_zod4.z.number().int().nonnegative().optional(),
|
|
9352
|
+
model: import_zod4.z.string().optional(),
|
|
9353
|
+
background: import_zod4.z.boolean().optional(),
|
|
9354
|
+
workflowRunId: import_zod4.z.string().optional(),
|
|
9355
|
+
workflowPhase: import_zod4.z.string().optional(),
|
|
9356
|
+
teamName: import_zod4.z.string().optional(),
|
|
9357
|
+
stoppedByUser: import_zod4.z.boolean().optional(),
|
|
9358
|
+
transcript: import_zod4.z.string()
|
|
9359
|
+
};
|
|
9360
|
+
var AgentNodeSchema = import_zod4.z.lazy(() => import_zod4.z.strictObject({ ...AgentNodeFields, children: import_zod4.z.array(AgentNodeSchema) }));
|
|
9361
|
+
var TaskItemSchema = import_zod4.z.strictObject({
|
|
9362
|
+
id: import_zod4.z.string(),
|
|
9363
|
+
subject: import_zod4.z.string(),
|
|
9364
|
+
description: import_zod4.z.string().optional(),
|
|
9365
|
+
status: import_zod4.z.string(),
|
|
9366
|
+
/** What a spinner shows while the task runs. */
|
|
9367
|
+
activeForm: import_zod4.z.string().optional(),
|
|
9368
|
+
/** The teammate or agent name the task is assigned to, as Agent Teams writes it. */
|
|
9369
|
+
owner: import_zod4.z.string().optional(),
|
|
9370
|
+
/** Free-form data the harness attaches to a task, kept as written. */
|
|
9371
|
+
metadata: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()).optional(),
|
|
9372
|
+
blocks: import_zod4.z.array(import_zod4.z.string()),
|
|
9373
|
+
blockedBy: import_zod4.z.array(import_zod4.z.string()),
|
|
9374
|
+
/** The id of the shared task list this task belongs to (a team's name, or a custom list id), absent for the session's own list. */
|
|
9375
|
+
taskList: import_zod4.z.string().optional()
|
|
9376
|
+
});
|
|
9377
|
+
var WorkflowRunSchema = import_zod4.z.strictObject({
|
|
9378
|
+
runId: import_zod4.z.string(),
|
|
9379
|
+
workflowName: import_zod4.z.string().optional(),
|
|
9380
|
+
status: import_zod4.z.string().optional(),
|
|
9381
|
+
startTime: import_zod4.z.number().optional(),
|
|
9382
|
+
phases: import_zod4.z.array(import_zod4.z.string()),
|
|
9383
|
+
summary: import_zod4.z.string().optional()
|
|
9384
|
+
});
|
|
9385
|
+
var AgentTreeProblemSchema = import_zod4.z.strictObject({
|
|
9386
|
+
/** Relative to the identity's configuration directory. */
|
|
9387
|
+
path: import_zod4.z.string(),
|
|
9388
|
+
reason: import_zod4.z.string()
|
|
9389
|
+
});
|
|
9390
|
+
var SessionSummarySchema = import_zod4.z.strictObject({
|
|
9391
|
+
project: import_zod4.z.string(),
|
|
9392
|
+
sessionId: import_zod4.z.string(),
|
|
9393
|
+
superseded: import_zod4.z.boolean(),
|
|
9394
|
+
/** The directory and transcript stem exactly as on disk, which differs from `sessionId` for a superseded session. */
|
|
9395
|
+
entry: import_zod4.z.string(),
|
|
9396
|
+
agentCount: import_zod4.z.number().int().nonnegative(),
|
|
9397
|
+
workflowRunCount: import_zod4.z.number().int().nonnegative(),
|
|
9398
|
+
/** When the transcript was last written, as an ISO instant; absent when there is no transcript file. */
|
|
9399
|
+
updatedAt: import_zod4.z.iso.datetime().optional(),
|
|
9400
|
+
identities: import_zod4.z.array(import_zod4.z.string())
|
|
9401
|
+
});
|
|
9402
|
+
var SessionAgentTreeSchema = import_zod4.z.strictObject({
|
|
9403
|
+
project: import_zod4.z.string(),
|
|
9404
|
+
sessionId: import_zod4.z.string(),
|
|
9405
|
+
/** True for a session directory a resume superseded (`<session-id>.superseded-<epoch-ms>`). */
|
|
9406
|
+
superseded: import_zod4.z.boolean(),
|
|
9407
|
+
/** The agents the session itself spawned, each with its descendants. */
|
|
9408
|
+
agents: import_zod4.z.array(AgentNodeSchema),
|
|
9409
|
+
tasks: import_zod4.z.array(TaskItemSchema),
|
|
9410
|
+
workflowRuns: import_zod4.z.array(WorkflowRunSchema),
|
|
9411
|
+
problems: import_zod4.z.array(AgentTreeProblemSchema)
|
|
9412
|
+
});
|
|
9413
|
+
|
|
9414
|
+
// src/agents/liveTasks.ts
|
|
9415
|
+
var LIVE_TASK_CAP = 512;
|
|
9416
|
+
var RUNNING_STATUS = "running";
|
|
9417
|
+
var LiveTaskUsageSchema = import_zod5.z.strictObject({
|
|
9418
|
+
totalTokens: import_zod5.z.number().optional(),
|
|
9419
|
+
toolUses: import_zod5.z.number().optional(),
|
|
9420
|
+
durationMs: import_zod5.z.number().optional()
|
|
9421
|
+
});
|
|
9422
|
+
var LiveTaskSchema = import_zod5.z.strictObject({
|
|
9423
|
+
/** The `task_id`: for an unnamed subagent the stem of its `agent-<id>` files on disk. */
|
|
9424
|
+
taskId: import_zod5.z.string(),
|
|
9425
|
+
/** The `cse_` session whose stream carried the task. */
|
|
9426
|
+
sessionId: import_zod5.z.string(),
|
|
9427
|
+
runId: import_zod5.z.string().optional(),
|
|
9428
|
+
/** The `tool_use` block in the spawning transcript, which is the meta file's `toolUseId`. */
|
|
9429
|
+
toolUseId: import_zod5.z.string().optional(),
|
|
9430
|
+
/** `local_agent` for a subagent, `local_bash` for a backgrounded command; open because other kinds may exist. */
|
|
9431
|
+
taskType: import_zod5.z.string().optional(),
|
|
9432
|
+
description: import_zod5.z.string().optional(),
|
|
9433
|
+
subagentType: import_zod5.z.string().optional(),
|
|
9434
|
+
spawnDepth: import_zod5.z.number().int().nonnegative().optional(),
|
|
9435
|
+
parentTaskId: import_zod5.z.string().optional(),
|
|
9436
|
+
backgrounded: import_zod5.z.boolean().optional(),
|
|
9437
|
+
status: import_zod5.z.string(),
|
|
9438
|
+
/** `<tmpdir>/<project-slug>/<local session id>/tasks/<task_id>.output`, which embeds the local session id. */
|
|
9439
|
+
outputFile: import_zod5.z.string().optional(),
|
|
9440
|
+
summary: import_zod5.z.string().optional(),
|
|
9441
|
+
lastToolName: import_zod5.z.string().optional(),
|
|
9442
|
+
usage: LiveTaskUsageSchema.optional(),
|
|
9443
|
+
/** When the door last observed an event for this task, in epoch milliseconds from its injected clock. */
|
|
9444
|
+
observedAt: import_zod5.z.number()
|
|
9445
|
+
});
|
|
9446
|
+
var SYSTEM_SUBTYPES = ["task_started", "task_progress", "task_updated", "task_notification", "background_tasks_changed"];
|
|
9447
|
+
function isRecord2(value) {
|
|
9448
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9449
|
+
}
|
|
9450
|
+
function stringField(record, field) {
|
|
9451
|
+
const value = record[field];
|
|
9452
|
+
return typeof value === "string" && value !== "" ? value : void 0;
|
|
9453
|
+
}
|
|
9454
|
+
function numberField(record, field) {
|
|
9455
|
+
const value = record[field];
|
|
9456
|
+
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
9457
|
+
}
|
|
9458
|
+
function booleanField(record, field) {
|
|
9459
|
+
const value = record[field];
|
|
9460
|
+
return typeof value === "boolean" ? value : void 0;
|
|
9461
|
+
}
|
|
9462
|
+
function usageOf(record) {
|
|
9463
|
+
const raw = record.usage;
|
|
9464
|
+
if (!isRecord2(raw)) {
|
|
9465
|
+
return void 0;
|
|
9466
|
+
}
|
|
9467
|
+
const totalTokens = numberField(raw, "total_tokens");
|
|
9468
|
+
const toolUses = numberField(raw, "tool_uses");
|
|
9469
|
+
const durationMs = numberField(raw, "duration_ms");
|
|
9470
|
+
if (totalTokens === void 0 && toolUses === void 0 && durationMs === void 0) {
|
|
9471
|
+
return void 0;
|
|
9472
|
+
}
|
|
9473
|
+
return { ...totalTokens === void 0 ? {} : { totalTokens }, ...toolUses === void 0 ? {} : { toolUses }, ...durationMs === void 0 ? {} : { durationMs } };
|
|
9474
|
+
}
|
|
9475
|
+
function overlay(base, fields) {
|
|
9476
|
+
const defined = Object.fromEntries(Object.entries(fields).filter(([, value]) => value !== void 0));
|
|
9477
|
+
return LiveTaskSchema.parse({ ...base, ...defined });
|
|
9478
|
+
}
|
|
9479
|
+
function isFinished(task) {
|
|
9480
|
+
return task.status !== RUNNING_STATUS;
|
|
9481
|
+
}
|
|
9482
|
+
function bounded(book) {
|
|
9483
|
+
if (book.size <= LIVE_TASK_CAP) {
|
|
9484
|
+
return book;
|
|
9485
|
+
}
|
|
9486
|
+
const evictable = [...book.values()].filter(isFinished).sort((left, right) => left.observedAt - right.observedAt);
|
|
9487
|
+
for (const task of evictable) {
|
|
9488
|
+
if (book.size <= LIVE_TASK_CAP) {
|
|
9489
|
+
break;
|
|
9490
|
+
}
|
|
9491
|
+
book.delete(task.taskId);
|
|
9492
|
+
}
|
|
9493
|
+
return book;
|
|
9494
|
+
}
|
|
9495
|
+
function applyAgentTaskEvent(book, sessionId, payload, observedAt2) {
|
|
9496
|
+
if (!isRecord2(payload) || payload.type !== "system") {
|
|
9497
|
+
return book;
|
|
9498
|
+
}
|
|
9499
|
+
const subtype = payload.subtype;
|
|
9500
|
+
if (typeof subtype !== "string" || !SYSTEM_SUBTYPES.some((known) => known === subtype)) {
|
|
9501
|
+
return book;
|
|
9502
|
+
}
|
|
9503
|
+
const next = new Map(book);
|
|
9504
|
+
const upsert = (taskId2, fields) => {
|
|
9505
|
+
const existing = next.get(taskId2);
|
|
9506
|
+
const base = existing ?? { taskId: taskId2, sessionId, status: RUNNING_STATUS, observedAt: observedAt2 };
|
|
9507
|
+
next.set(taskId2, overlay(base, { ...fields, observedAt: observedAt2 }));
|
|
9508
|
+
};
|
|
9509
|
+
if (subtype === "background_tasks_changed") {
|
|
9510
|
+
const tasks = Array.isArray(payload.tasks) ? payload.tasks : [];
|
|
9511
|
+
for (const raw of tasks) {
|
|
9512
|
+
const taskId2 = isRecord2(raw) ? stringField(raw, "task_id") : void 0;
|
|
9513
|
+
if (isRecord2(raw) && taskId2 !== void 0) {
|
|
9514
|
+
upsert(taskId2, { runId: stringField(raw, "run_id"), taskType: stringField(raw, "task_type"), description: stringField(raw, "description") });
|
|
9515
|
+
}
|
|
9516
|
+
}
|
|
9517
|
+
return bounded(next);
|
|
9518
|
+
}
|
|
9519
|
+
const taskId = stringField(payload, "task_id");
|
|
9520
|
+
if (taskId === void 0) {
|
|
9521
|
+
return book;
|
|
9522
|
+
}
|
|
9523
|
+
const common = { runId: stringField(payload, "run_id"), toolUseId: stringField(payload, "tool_use_id"), description: stringField(payload, "description") };
|
|
9524
|
+
if (subtype === "task_started") {
|
|
9525
|
+
upsert(taskId, {
|
|
9526
|
+
...common,
|
|
9527
|
+
taskType: stringField(payload, "task_type"),
|
|
9528
|
+
subagentType: stringField(payload, "subagent_type"),
|
|
9529
|
+
spawnDepth: numberField(payload, "spawn_depth"),
|
|
9530
|
+
parentTaskId: stringField(payload, "parent_task_id"),
|
|
9531
|
+
backgrounded: booleanField(payload, "is_backgrounded")
|
|
9532
|
+
});
|
|
9533
|
+
} else if (subtype === "task_progress") {
|
|
9534
|
+
upsert(taskId, { ...common, subagentType: stringField(payload, "subagent_type"), lastToolName: stringField(payload, "last_tool_name"), usage: usageOf(payload) });
|
|
9535
|
+
} else if (subtype === "task_updated") {
|
|
9536
|
+
const patch = isRecord2(payload.patch) ? payload.patch : {};
|
|
9537
|
+
upsert(taskId, { runId: stringField(payload, "run_id"), status: stringField(patch, "status") });
|
|
9538
|
+
} else {
|
|
9539
|
+
upsert(taskId, { ...common, status: stringField(payload, "status"), outputFile: stringField(payload, "output_file"), summary: stringField(payload, "summary"), usage: usageOf(payload) });
|
|
9540
|
+
}
|
|
9541
|
+
return bounded(next);
|
|
9542
|
+
}
|
|
9543
|
+
var MergedProvenanceSchema = import_zod5.z.enum(["disk", "both"]);
|
|
9544
|
+
var MergedAgentNodeSchema = import_zod5.z.lazy(
|
|
9545
|
+
() => import_zod5.z.strictObject({
|
|
9546
|
+
...AgentNodeFields,
|
|
9547
|
+
provenance: MergedProvenanceSchema,
|
|
9548
|
+
live: LiveTaskSchema.optional(),
|
|
9549
|
+
children: import_zod5.z.array(MergedAgentNodeSchema)
|
|
9550
|
+
})
|
|
9551
|
+
);
|
|
9552
|
+
var MergedAgentTreeSchema = import_zod5.z.strictObject({
|
|
9553
|
+
...SessionAgentTreeSchema.shape,
|
|
9554
|
+
agents: import_zod5.z.array(MergedAgentNodeSchema),
|
|
9555
|
+
/** The `cse_` sessions whose live tasks matched this session. Empty when the session is not live or the door has not observed it. */
|
|
9556
|
+
remoteSessions: import_zod5.z.array(import_zod5.z.string()),
|
|
9557
|
+
/** Live tasks of those sessions that match no disk agent (a backgrounded command, or an agent whose files have not appeared yet). */
|
|
9558
|
+
liveOnly: import_zod5.z.array(LiveTaskSchema)
|
|
9559
|
+
});
|
|
9560
|
+
function mergeLiveTasks(tree, live) {
|
|
9561
|
+
const byTaskId = new Map(live.map((task) => [task.taskId, task]));
|
|
9562
|
+
const byToolUseId = new Map(live.flatMap((task) => task.toolUseId === void 0 ? [] : [[task.toolUseId, task]]));
|
|
9563
|
+
const claimed = /* @__PURE__ */ new Set();
|
|
9564
|
+
const merge = (node) => {
|
|
9565
|
+
const task = byTaskId.get(node.id) ?? (node.toolUseId === void 0 ? void 0 : byToolUseId.get(node.toolUseId));
|
|
9566
|
+
if (task !== void 0) {
|
|
9567
|
+
claimed.add(task.taskId);
|
|
9568
|
+
}
|
|
9569
|
+
return { ...node, provenance: task === void 0 ? "disk" : "both", ...task === void 0 ? {} : { live: task }, children: node.children.map(merge) };
|
|
9570
|
+
};
|
|
9571
|
+
const agents = tree.agents.map(merge);
|
|
9572
|
+
const sessionMarker = `/${tree.sessionId}/`;
|
|
9573
|
+
const liveOnly = live.filter((task) => !claimed.has(task.taskId) && task.outputFile?.includes(sessionMarker) === true);
|
|
9574
|
+
const remoteSessions = [...new Set([...claimed, ...liveOnly.map((task) => task.taskId)].flatMap((taskId) => byTaskId.get(taskId)?.sessionId ?? []))].sort();
|
|
9575
|
+
return { ...tree, agents, remoteSessions, liveOnly };
|
|
9576
|
+
}
|
|
9577
|
+
|
|
9314
9578
|
// src/frontdoor/rcSessions.ts
|
|
9315
9579
|
var RC_SESSIONS_PATH_PREFIX = "/v1/code/sessions";
|
|
9316
9580
|
var RC_SESSION_ID_PREFIX = "cse_";
|
|
@@ -9351,7 +9615,7 @@ function sessionCreateId(body) {
|
|
|
9351
9615
|
const id = session.id;
|
|
9352
9616
|
return typeof id === "string" && id.startsWith(RC_SESSION_ID_PREFIX) ? id : void 0;
|
|
9353
9617
|
}
|
|
9354
|
-
function
|
|
9618
|
+
function isRecord3(value) {
|
|
9355
9619
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9356
9620
|
}
|
|
9357
9621
|
function parseJsonObject(body) {
|
|
@@ -9361,7 +9625,7 @@ function parseJsonObject(body) {
|
|
|
9361
9625
|
} catch {
|
|
9362
9626
|
return void 0;
|
|
9363
9627
|
}
|
|
9364
|
-
return
|
|
9628
|
+
return isRecord3(parsed) ? parsed : void 0;
|
|
9365
9629
|
}
|
|
9366
9630
|
function nonEmptyString(record, field) {
|
|
9367
9631
|
const value = record === void 0 ? void 0 : record[field];
|
|
@@ -9382,11 +9646,11 @@ function payloadEventsOf(body) {
|
|
|
9382
9646
|
}
|
|
9383
9647
|
const payloads = [];
|
|
9384
9648
|
for (const event of events) {
|
|
9385
|
-
if (!
|
|
9649
|
+
if (!isRecord3(event)) {
|
|
9386
9650
|
continue;
|
|
9387
9651
|
}
|
|
9388
9652
|
const payload = event.payload;
|
|
9389
|
-
if (!
|
|
9653
|
+
if (!isRecord3(payload)) {
|
|
9390
9654
|
continue;
|
|
9391
9655
|
}
|
|
9392
9656
|
payloads.push(payload);
|
|
@@ -9401,7 +9665,7 @@ function pendingOfControlRequestPayload(payload) {
|
|
|
9401
9665
|
if (requestId === void 0) {
|
|
9402
9666
|
return void 0;
|
|
9403
9667
|
}
|
|
9404
|
-
const request4 =
|
|
9668
|
+
const request4 = isRecord3(payload.request) ? payload.request : void 0;
|
|
9405
9669
|
const subtype = nonEmptyString(request4, "subtype");
|
|
9406
9670
|
const type = subtype ?? "control_request";
|
|
9407
9671
|
let summary = "";
|
|
@@ -9418,20 +9682,21 @@ function answeredRequestIdsOfControlResponsePayload(payload) {
|
|
|
9418
9682
|
if (payload.type !== "control_response") {
|
|
9419
9683
|
return [];
|
|
9420
9684
|
}
|
|
9421
|
-
const response =
|
|
9685
|
+
const response = isRecord3(payload.response) ? payload.response : void 0;
|
|
9422
9686
|
const id = nonEmptyString(response, "request_id") ?? nonEmptyString(payload, "request_id") ?? nonEmptyString(payload, "uuid");
|
|
9423
9687
|
return id === void 0 ? [] : [id];
|
|
9424
9688
|
}
|
|
9425
9689
|
function parseRcRequestBody(kind, body) {
|
|
9426
9690
|
if (kind === "heartbeat") {
|
|
9427
|
-
return { controlRequests: [], answeredRequestIds: [], idleSeconds: finiteNumber(parseJsonObject(body), "idle_seconds"), workerStatus: void 0 };
|
|
9691
|
+
return { controlRequests: [], answeredRequestIds: [], idleSeconds: finiteNumber(parseJsonObject(body), "idle_seconds"), workerStatus: void 0, payloads: [] };
|
|
9428
9692
|
}
|
|
9429
9693
|
if (kind === "worker-registration") {
|
|
9430
|
-
return { controlRequests: [], answeredRequestIds: [], idleSeconds: void 0, workerStatus: nonEmptyString(parseJsonObject(body), "worker_status") };
|
|
9694
|
+
return { controlRequests: [], answeredRequestIds: [], idleSeconds: void 0, workerStatus: nonEmptyString(parseJsonObject(body), "worker_status"), payloads: [] };
|
|
9431
9695
|
}
|
|
9432
9696
|
const controlRequests = [];
|
|
9433
9697
|
const answeredRequestIds = [];
|
|
9434
|
-
|
|
9698
|
+
const payloads = payloadEventsOf(body);
|
|
9699
|
+
for (const payload of payloads) {
|
|
9435
9700
|
const pending = pendingOfControlRequestPayload(payload);
|
|
9436
9701
|
if (pending !== void 0) {
|
|
9437
9702
|
controlRequests.push({ requestId: pending.requestId, type: pending.type, summary: pending.summary });
|
|
@@ -9439,7 +9704,7 @@ function parseRcRequestBody(kind, body) {
|
|
|
9439
9704
|
}
|
|
9440
9705
|
answeredRequestIds.push(...answeredRequestIdsOfControlResponsePayload(payload));
|
|
9441
9706
|
}
|
|
9442
|
-
return { controlRequests, answeredRequestIds, idleSeconds: void 0, workerStatus: void 0 };
|
|
9707
|
+
return { controlRequests, answeredRequestIds, idleSeconds: void 0, workerStatus: void 0, payloads };
|
|
9443
9708
|
}
|
|
9444
9709
|
function createRcSessionTracker(deps) {
|
|
9445
9710
|
const entries = /* @__PURE__ */ new Map();
|
|
@@ -9465,7 +9730,7 @@ function createRcSessionTracker(deps) {
|
|
|
9465
9730
|
const timer = setInterval(sweep, deps.idleMs);
|
|
9466
9731
|
timer.unref();
|
|
9467
9732
|
const birth = (id, facts) => {
|
|
9468
|
-
const record = { id, createdAt: deps.now(), lastSeenAt: deps.now(), ...facts, pending: /* @__PURE__ */ new Map(), workerState: void 0, workerIdleSeconds: void 0, sequenceNum: void 0 };
|
|
9733
|
+
const record = { id, createdAt: deps.now(), lastSeenAt: deps.now(), ...facts, pending: /* @__PURE__ */ new Map(), workerState: void 0, workerIdleSeconds: void 0, sequenceNum: void 0, liveTasks: /* @__PURE__ */ new Map() };
|
|
9469
9734
|
entries.set(id, record);
|
|
9470
9735
|
return record;
|
|
9471
9736
|
};
|
|
@@ -9553,6 +9818,9 @@ function createRcSessionTracker(deps) {
|
|
|
9553
9818
|
for (const requestId of factsOfBody.answeredRequestIds) {
|
|
9554
9819
|
entryNow.pending.delete(requestId);
|
|
9555
9820
|
}
|
|
9821
|
+
for (const payload of factsOfBody.payloads) {
|
|
9822
|
+
entryNow.liveTasks = applyAgentTaskEvent(entryNow.liveTasks, id, payload, now);
|
|
9823
|
+
}
|
|
9556
9824
|
if (factsOfBody.idleSeconds !== void 0) {
|
|
9557
9825
|
entryNow.workerIdleSeconds = { value: factsOfBody.idleSeconds, observedAt: now };
|
|
9558
9826
|
}
|
|
@@ -9643,9 +9911,10 @@ function createRcSessionTracker(deps) {
|
|
|
9643
9911
|
return;
|
|
9644
9912
|
}
|
|
9645
9913
|
entry.sequenceNum = entry.sequenceNum === void 0 || event.sequence_num > entry.sequenceNum ? event.sequence_num : entry.sequenceNum;
|
|
9646
|
-
if (!
|
|
9914
|
+
if (!isRecord3(event.payload)) {
|
|
9647
9915
|
return;
|
|
9648
9916
|
}
|
|
9917
|
+
entry.liveTasks = applyAgentTaskEvent(entry.liveTasks, sessionId, event.payload, deps.now());
|
|
9649
9918
|
const pending = pendingOfControlRequestPayload(event.payload);
|
|
9650
9919
|
if (pending !== void 0) {
|
|
9651
9920
|
if (event.source === RC_STREAM_WORKER_SOURCE) {
|
|
@@ -9657,6 +9926,10 @@ function createRcSessionTracker(deps) {
|
|
|
9657
9926
|
entry.pending.delete(requestId);
|
|
9658
9927
|
}
|
|
9659
9928
|
},
|
|
9929
|
+
liveTasksOf: (sessionId) => {
|
|
9930
|
+
sweep();
|
|
9931
|
+
return sortedEntries().filter((entry) => sessionId === void 0 || entry.id === sessionId).flatMap((entry) => [...entry.liveTasks.values()].sort((left, right) => left.observedAt - right.observedAt || (left.taskId < right.taskId ? -1 : 1)));
|
|
9932
|
+
},
|
|
9660
9933
|
completePending: (sessionId, requestId) => {
|
|
9661
9934
|
entries.get(sessionId)?.pending.delete(requestId);
|
|
9662
9935
|
},
|
|
@@ -11061,11 +11334,11 @@ var import_node_path10 = __toESM(require("node:path"), 1);
|
|
|
11061
11334
|
function isSafeSessionId(sessionId) {
|
|
11062
11335
|
return /^[A-Za-z0-9_-]+$/.test(sessionId);
|
|
11063
11336
|
}
|
|
11064
|
-
function
|
|
11337
|
+
function isRecord4(value) {
|
|
11065
11338
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
11066
11339
|
}
|
|
11067
11340
|
function credentialOfJson(parsed) {
|
|
11068
|
-
if (!
|
|
11341
|
+
if (!isRecord4(parsed)) {
|
|
11069
11342
|
return void 0;
|
|
11070
11343
|
}
|
|
11071
11344
|
const { authorization, anthropicVersion, anthropicClientPlatform } = parsed;
|
|
@@ -11095,7 +11368,7 @@ function createRcCredentialStore(fs12, dir) {
|
|
|
11095
11368
|
} catch {
|
|
11096
11369
|
return void 0;
|
|
11097
11370
|
}
|
|
11098
|
-
return
|
|
11371
|
+
return isRecord4(parsed) ? parsed : void 0;
|
|
11099
11372
|
};
|
|
11100
11373
|
return {
|
|
11101
11374
|
read: (sessionId) => {
|
|
@@ -11149,162 +11422,162 @@ init_package();
|
|
|
11149
11422
|
init_capability();
|
|
11150
11423
|
|
|
11151
11424
|
// src/frontdoor/rcSchemas.ts
|
|
11152
|
-
var
|
|
11153
|
-
var RcPermissionModeSchema =
|
|
11154
|
-
var RcSessionSummarySchema =
|
|
11155
|
-
id:
|
|
11156
|
-
createdAt:
|
|
11157
|
-
lastSeenAt:
|
|
11425
|
+
var import_zod6 = require("zod");
|
|
11426
|
+
var RcPermissionModeSchema = import_zod6.z.enum(RC_PERMISSION_MODES);
|
|
11427
|
+
var RcSessionSummarySchema = import_zod6.z.strictObject({
|
|
11428
|
+
id: import_zod6.z.string(),
|
|
11429
|
+
createdAt: import_zod6.z.number(),
|
|
11430
|
+
lastSeenAt: import_zod6.z.number()
|
|
11158
11431
|
});
|
|
11159
11432
|
function workerFactSchema(value) {
|
|
11160
|
-
return
|
|
11161
|
-
}
|
|
11162
|
-
var RcPendingRequestSummarySchema =
|
|
11163
|
-
sessionId:
|
|
11164
|
-
requestId:
|
|
11165
|
-
type:
|
|
11166
|
-
summary:
|
|
11167
|
-
observedAt:
|
|
11433
|
+
return import_zod6.z.strictObject({ value, observedAt: import_zod6.z.number() });
|
|
11434
|
+
}
|
|
11435
|
+
var RcPendingRequestSummarySchema = import_zod6.z.strictObject({
|
|
11436
|
+
sessionId: import_zod6.z.string(),
|
|
11437
|
+
requestId: import_zod6.z.string(),
|
|
11438
|
+
type: import_zod6.z.string(),
|
|
11439
|
+
summary: import_zod6.z.string(),
|
|
11440
|
+
observedAt: import_zod6.z.number()
|
|
11168
11441
|
});
|
|
11169
|
-
var RcSessionStatusSchema =
|
|
11442
|
+
var RcSessionStatusSchema = import_zod6.z.strictObject({
|
|
11170
11443
|
...RcSessionSummarySchema.shape,
|
|
11171
|
-
workerState: workerFactSchema(
|
|
11172
|
-
workerIdleSeconds: workerFactSchema(
|
|
11173
|
-
pending:
|
|
11444
|
+
workerState: workerFactSchema(import_zod6.z.string()).optional(),
|
|
11445
|
+
workerIdleSeconds: workerFactSchema(import_zod6.z.number()).optional(),
|
|
11446
|
+
pending: import_zod6.z.readonly(import_zod6.z.array(RcPendingRequestSummarySchema))
|
|
11174
11447
|
});
|
|
11175
|
-
var RcStreamEnvelopeSchema =
|
|
11448
|
+
var RcStreamEnvelopeSchema = import_zod6.z.looseObject({
|
|
11176
11449
|
/** The envelope's own event id, when the host sent one. */
|
|
11177
|
-
event_id:
|
|
11450
|
+
event_id: import_zod6.z.string().optional(),
|
|
11178
11451
|
/** The envelope's event type, the discriminator a consumer switches on (`control_request`, `user`, and kin). */
|
|
11179
|
-
event_type:
|
|
11452
|
+
event_type: import_zod6.z.string(),
|
|
11180
11453
|
/** The sequence number the host assigned, the value a resume continues after. */
|
|
11181
|
-
sequence_num:
|
|
11454
|
+
sequence_num: import_zod6.z.int(),
|
|
11182
11455
|
/** Who emitted the event (`worker` for the CLI's half, a client id for a client's). */
|
|
11183
|
-
source:
|
|
11456
|
+
source: import_zod6.z.string(),
|
|
11184
11457
|
/** The event's payload, carried verbatim: its shape is the payload family's, narrowed by whichever consumer needs it. Optional in the schema's own type because the door forwards the host's envelope as it arrived, asserting only the fields it relies on itself. */
|
|
11185
|
-
payload:
|
|
11458
|
+
payload: import_zod6.z.unknown().optional(),
|
|
11186
11459
|
/** When the host created the event; the protocol's own type for this field is not established here, so it is forwarded rather than asserted. */
|
|
11187
|
-
created_at:
|
|
11460
|
+
created_at: import_zod6.z.unknown().optional()
|
|
11188
11461
|
});
|
|
11189
|
-
var RcStreamEventSchema =
|
|
11190
|
-
session:
|
|
11462
|
+
var RcStreamEventSchema = import_zod6.z.strictObject({
|
|
11463
|
+
session: import_zod6.z.string(),
|
|
11191
11464
|
envelope: RcStreamEnvelopeSchema
|
|
11192
11465
|
});
|
|
11193
|
-
var RcRateLimitWindowSchema =
|
|
11466
|
+
var RcRateLimitWindowSchema = import_zod6.z.looseObject({
|
|
11194
11467
|
/** The fraction of the window used, usually between 0 and 1, above 1 when usage legitimately runs past the window's cap (the CLI's own field description states both). */
|
|
11195
|
-
utilization:
|
|
11468
|
+
utilization: import_zod6.z.number().optional(),
|
|
11196
11469
|
/** When the window resets, in unix epoch seconds: the unit is the CLI's own field description, stated in the 2.1.289 bundle's schema. */
|
|
11197
|
-
resetsAt:
|
|
11470
|
+
resetsAt: import_zod6.z.number().optional()
|
|
11198
11471
|
});
|
|
11199
|
-
var RcRateLimitInfoSchema =
|
|
11472
|
+
var RcRateLimitInfoSchema = import_zod6.z.looseObject({
|
|
11200
11473
|
/** The limiting window's own status (`allowed`, `allowed_warning`, `rejected`), asserted only as a string because the vocabulary grows with the CLI. */
|
|
11201
|
-
status:
|
|
11474
|
+
status: import_zod6.z.string(),
|
|
11202
11475
|
/** When the limiting window resets, in unix epoch seconds. */
|
|
11203
|
-
resetsAt:
|
|
11476
|
+
resetsAt: import_zod6.z.number().optional(),
|
|
11204
11477
|
/** Which window the top-level fields describe (`five_hour`, `seven_day`, and kin), the payload's own name for it. */
|
|
11205
|
-
rateLimitType:
|
|
11478
|
+
rateLimitType: import_zod6.z.string().optional(),
|
|
11206
11479
|
/** The fraction of the limiting window used, on the same scale the per-window utilizations carry. */
|
|
11207
|
-
utilization:
|
|
11480
|
+
utilization: import_zod6.z.number().optional(),
|
|
11208
11481
|
/** Whether usage beyond the plan (extra usage) is currently covering the overflow, the payload's own flag for it. */
|
|
11209
|
-
isUsingOverage:
|
|
11482
|
+
isUsingOverage: import_zod6.z.boolean().optional(),
|
|
11210
11483
|
/** The overage's own status, the same vocabulary the limiting window's `status` carries. */
|
|
11211
|
-
overageStatus:
|
|
11484
|
+
overageStatus: import_zod6.z.string().optional(),
|
|
11212
11485
|
/** When the overage window resets, in unix epoch seconds. */
|
|
11213
|
-
overageResetsAt:
|
|
11486
|
+
overageResetsAt: import_zod6.z.number().optional(),
|
|
11214
11487
|
/** Each subscription window the account's response headers carried: the session (five-hour), weekly (seven-day), and overage-included weekly windows, each present only when the account's responses carry it. */
|
|
11215
|
-
unifiedWindows:
|
|
11488
|
+
unifiedWindows: import_zod6.z.looseObject({ five_hour: RcRateLimitWindowSchema.optional(), seven_day: RcRateLimitWindowSchema.optional(), seven_day_overage_included: RcRateLimitWindowSchema.optional() }).optional()
|
|
11216
11489
|
});
|
|
11217
|
-
var RcLiveRateLimitSchema =
|
|
11218
|
-
session:
|
|
11219
|
-
observedAt:
|
|
11490
|
+
var RcLiveRateLimitSchema = import_zod6.z.strictObject({
|
|
11491
|
+
session: import_zod6.z.string(),
|
|
11492
|
+
observedAt: import_zod6.z.number(),
|
|
11220
11493
|
rateLimit: RcRateLimitInfoSchema
|
|
11221
11494
|
});
|
|
11222
|
-
var RcSessionQuerySchema =
|
|
11223
|
-
session:
|
|
11495
|
+
var RcSessionQuerySchema = import_zod6.z.strictObject({
|
|
11496
|
+
session: import_zod6.z.string().min(1).optional()
|
|
11224
11497
|
});
|
|
11225
|
-
var RcSendInputSchema =
|
|
11226
|
-
session:
|
|
11227
|
-
text:
|
|
11498
|
+
var RcSendInputSchema = import_zod6.z.strictObject({
|
|
11499
|
+
session: import_zod6.z.string().min(1),
|
|
11500
|
+
text: import_zod6.z.string().min(1)
|
|
11228
11501
|
});
|
|
11229
|
-
var RcAnswerInputSchema =
|
|
11230
|
-
session:
|
|
11231
|
-
request:
|
|
11232
|
-
approve:
|
|
11233
|
-
text:
|
|
11502
|
+
var RcAnswerInputSchema = import_zod6.z.strictObject({
|
|
11503
|
+
session: import_zod6.z.string().min(1),
|
|
11504
|
+
request: import_zod6.z.string().min(1),
|
|
11505
|
+
approve: import_zod6.z.boolean(),
|
|
11506
|
+
text: import_zod6.z.string().optional()
|
|
11234
11507
|
}).refine((input) => !input.approve || input.text === void 0 || input.text === "", { message: "an approval carries no text (the protocol's allow result has no message field); text is the denial message" });
|
|
11235
|
-
var RcInterruptInputSchema =
|
|
11236
|
-
session:
|
|
11508
|
+
var RcInterruptInputSchema = import_zod6.z.strictObject({
|
|
11509
|
+
session: import_zod6.z.string().min(1)
|
|
11237
11510
|
});
|
|
11238
|
-
var RcSetModelInputSchema =
|
|
11239
|
-
session:
|
|
11240
|
-
model:
|
|
11511
|
+
var RcSetModelInputSchema = import_zod6.z.strictObject({
|
|
11512
|
+
session: import_zod6.z.string().min(1),
|
|
11513
|
+
model: import_zod6.z.string().min(1)
|
|
11241
11514
|
});
|
|
11242
|
-
var RcSetPermissionModeInputSchema =
|
|
11243
|
-
session:
|
|
11515
|
+
var RcSetPermissionModeInputSchema = import_zod6.z.strictObject({
|
|
11516
|
+
session: import_zod6.z.string().min(1),
|
|
11244
11517
|
mode: RcPermissionModeSchema
|
|
11245
11518
|
});
|
|
11246
|
-
var RcEndSessionInputSchema =
|
|
11247
|
-
session:
|
|
11248
|
-
reason:
|
|
11519
|
+
var RcEndSessionInputSchema = import_zod6.z.strictObject({
|
|
11520
|
+
session: import_zod6.z.string().min(1),
|
|
11521
|
+
reason: import_zod6.z.string().min(1).optional()
|
|
11249
11522
|
});
|
|
11250
|
-
var RcGetUsageInputSchema =
|
|
11251
|
-
session:
|
|
11252
|
-
skipBehaviors:
|
|
11523
|
+
var RcGetUsageInputSchema = import_zod6.z.strictObject({
|
|
11524
|
+
session: import_zod6.z.string().min(1),
|
|
11525
|
+
skipBehaviors: import_zod6.z.boolean().optional()
|
|
11253
11526
|
});
|
|
11254
|
-
var RcGetContextUsageInputSchema =
|
|
11255
|
-
session:
|
|
11256
|
-
detail:
|
|
11527
|
+
var RcGetContextUsageInputSchema = import_zod6.z.strictObject({
|
|
11528
|
+
session: import_zod6.z.string().min(1),
|
|
11529
|
+
detail: import_zod6.z.enum(RC_CONTEXT_USAGE_DETAILS).optional()
|
|
11257
11530
|
});
|
|
11258
|
-
var RcReadFileInputSchema =
|
|
11259
|
-
session:
|
|
11260
|
-
path:
|
|
11261
|
-
maxBytes:
|
|
11262
|
-
encoding:
|
|
11531
|
+
var RcReadFileInputSchema = import_zod6.z.strictObject({
|
|
11532
|
+
session: import_zod6.z.string().min(1),
|
|
11533
|
+
path: import_zod6.z.string().min(1),
|
|
11534
|
+
maxBytes: import_zod6.z.number().int().positive().optional(),
|
|
11535
|
+
encoding: import_zod6.z.enum(RC_READ_FILE_ENCODINGS).optional()
|
|
11263
11536
|
});
|
|
11264
|
-
var RcFileSuggestionsInputSchema =
|
|
11265
|
-
session:
|
|
11266
|
-
query:
|
|
11537
|
+
var RcFileSuggestionsInputSchema = import_zod6.z.strictObject({
|
|
11538
|
+
session: import_zod6.z.string().min(1),
|
|
11539
|
+
query: import_zod6.z.string()
|
|
11267
11540
|
});
|
|
11268
|
-
var RcKeepAliveInputSchema =
|
|
11269
|
-
session:
|
|
11541
|
+
var RcKeepAliveInputSchema = import_zod6.z.strictObject({
|
|
11542
|
+
session: import_zod6.z.string().min(1)
|
|
11270
11543
|
});
|
|
11271
|
-
var RcMcpStatusInputSchema =
|
|
11272
|
-
session:
|
|
11544
|
+
var RcMcpStatusInputSchema = import_zod6.z.strictObject({
|
|
11545
|
+
session: import_zod6.z.string().min(1)
|
|
11273
11546
|
});
|
|
11274
|
-
var RcMcpReconnectInputSchema =
|
|
11275
|
-
session:
|
|
11276
|
-
serverName:
|
|
11547
|
+
var RcMcpReconnectInputSchema = import_zod6.z.strictObject({
|
|
11548
|
+
session: import_zod6.z.string().min(1),
|
|
11549
|
+
serverName: import_zod6.z.string().min(1)
|
|
11277
11550
|
});
|
|
11278
|
-
var RcMcpAuthenticateInputSchema =
|
|
11279
|
-
session:
|
|
11280
|
-
serverName:
|
|
11281
|
-
redirectUri:
|
|
11551
|
+
var RcMcpAuthenticateInputSchema = import_zod6.z.strictObject({
|
|
11552
|
+
session: import_zod6.z.string().min(1),
|
|
11553
|
+
serverName: import_zod6.z.string().min(1),
|
|
11554
|
+
redirectUri: import_zod6.z.string().min(1)
|
|
11282
11555
|
});
|
|
11283
|
-
var RcMcpOAuthCallbackUrlInputSchema =
|
|
11284
|
-
session:
|
|
11285
|
-
serverName:
|
|
11286
|
-
callbackUrl:
|
|
11556
|
+
var RcMcpOAuthCallbackUrlInputSchema = import_zod6.z.strictObject({
|
|
11557
|
+
session: import_zod6.z.string().min(1),
|
|
11558
|
+
serverName: import_zod6.z.string().min(1),
|
|
11559
|
+
callbackUrl: import_zod6.z.string().min(1)
|
|
11287
11560
|
});
|
|
11288
|
-
var RcTeleportInputSchema =
|
|
11289
|
-
session:
|
|
11290
|
-
marker:
|
|
11561
|
+
var RcTeleportInputSchema = import_zod6.z.strictObject({
|
|
11562
|
+
session: import_zod6.z.string().min(1),
|
|
11563
|
+
marker: import_zod6.z.string().min(1)
|
|
11291
11564
|
});
|
|
11292
|
-
var RcListOutputSchema =
|
|
11293
|
-
var RcStatusOutputSchema =
|
|
11294
|
-
var RcPendingOutputSchema =
|
|
11295
|
-
var RcWriteOutputSchema =
|
|
11296
|
-
session:
|
|
11297
|
-
sequenceNums:
|
|
11565
|
+
var RcListOutputSchema = import_zod6.z.strictObject({ sessions: import_zod6.z.readonly(import_zod6.z.array(RcSessionSummarySchema)) });
|
|
11566
|
+
var RcStatusOutputSchema = import_zod6.z.strictObject({ statuses: import_zod6.z.readonly(import_zod6.z.array(RcSessionStatusSchema)) });
|
|
11567
|
+
var RcPendingOutputSchema = import_zod6.z.strictObject({ pending: import_zod6.z.readonly(import_zod6.z.array(RcPendingRequestSummarySchema)) });
|
|
11568
|
+
var RcWriteOutputSchema = import_zod6.z.strictObject({
|
|
11569
|
+
session: import_zod6.z.string(),
|
|
11570
|
+
sequenceNums: import_zod6.z.readonly(import_zod6.z.array(import_zod6.z.number()))
|
|
11298
11571
|
});
|
|
11299
|
-
var RcControlWriteOutputSchema =
|
|
11300
|
-
session:
|
|
11301
|
-
request:
|
|
11302
|
-
sequenceNums:
|
|
11572
|
+
var RcControlWriteOutputSchema = import_zod6.z.strictObject({
|
|
11573
|
+
session: import_zod6.z.string(),
|
|
11574
|
+
request: import_zod6.z.string(),
|
|
11575
|
+
sequenceNums: import_zod6.z.readonly(import_zod6.z.array(import_zod6.z.number()))
|
|
11303
11576
|
});
|
|
11304
|
-
var RcAnswerOutputSchema =
|
|
11305
|
-
session:
|
|
11306
|
-
request:
|
|
11307
|
-
sequenceNums:
|
|
11577
|
+
var RcAnswerOutputSchema = import_zod6.z.strictObject({
|
|
11578
|
+
session: import_zod6.z.string(),
|
|
11579
|
+
request: import_zod6.z.string(),
|
|
11580
|
+
sequenceNums: import_zod6.z.readonly(import_zod6.z.array(import_zod6.z.number()))
|
|
11308
11581
|
});
|
|
11309
11582
|
|
|
11310
11583
|
// src/frontdoor/rcApi.ts
|
|
@@ -11491,48 +11764,48 @@ init_cliError();
|
|
|
11491
11764
|
init_package();
|
|
11492
11765
|
|
|
11493
11766
|
// src/codex/appServerSchemas.ts
|
|
11494
|
-
var
|
|
11767
|
+
var import_zod7 = require("zod");
|
|
11495
11768
|
var CODEX_APP_SERVER_GENERATED_AGAINST = "0.160.0";
|
|
11496
|
-
var RateLimitWindowSchema =
|
|
11497
|
-
usedPercent:
|
|
11498
|
-
resetsAt:
|
|
11499
|
-
windowDurationMins:
|
|
11769
|
+
var RateLimitWindowSchema = import_zod7.z.object({
|
|
11770
|
+
usedPercent: import_zod7.z.number(),
|
|
11771
|
+
resetsAt: import_zod7.z.number().nullish(),
|
|
11772
|
+
windowDurationMins: import_zod7.z.number().nullish()
|
|
11500
11773
|
});
|
|
11501
|
-
var RateLimitSnapshotSchema =
|
|
11502
|
-
limitId:
|
|
11503
|
-
limitName:
|
|
11504
|
-
planType:
|
|
11774
|
+
var RateLimitSnapshotSchema = import_zod7.z.object({
|
|
11775
|
+
limitId: import_zod7.z.string().nullish(),
|
|
11776
|
+
limitName: import_zod7.z.string().nullish(),
|
|
11777
|
+
planType: import_zod7.z.string().nullish(),
|
|
11505
11778
|
primary: RateLimitWindowSchema.nullish(),
|
|
11506
11779
|
secondary: RateLimitWindowSchema.nullish(),
|
|
11507
|
-
rateLimitReachedType:
|
|
11508
|
-
spendControlReached:
|
|
11780
|
+
rateLimitReachedType: import_zod7.z.string().nullish(),
|
|
11781
|
+
spendControlReached: import_zod7.z.boolean().nullish()
|
|
11509
11782
|
});
|
|
11510
|
-
var RateLimitResetCreditSchema =
|
|
11511
|
-
id:
|
|
11512
|
-
grantedAt:
|
|
11513
|
-
expiresAt:
|
|
11514
|
-
resetType:
|
|
11515
|
-
status:
|
|
11516
|
-
title:
|
|
11517
|
-
description:
|
|
11783
|
+
var RateLimitResetCreditSchema = import_zod7.z.object({
|
|
11784
|
+
id: import_zod7.z.string(),
|
|
11785
|
+
grantedAt: import_zod7.z.number(),
|
|
11786
|
+
expiresAt: import_zod7.z.number().nullish(),
|
|
11787
|
+
resetType: import_zod7.z.string(),
|
|
11788
|
+
status: import_zod7.z.string(),
|
|
11789
|
+
title: import_zod7.z.string().nullish(),
|
|
11790
|
+
description: import_zod7.z.string().nullish()
|
|
11518
11791
|
});
|
|
11519
|
-
var CodexAccountSchema =
|
|
11520
|
-
|
|
11521
|
-
|
|
11522
|
-
|
|
11792
|
+
var CodexAccountSchema = import_zod7.z.discriminatedUnion("type", [
|
|
11793
|
+
import_zod7.z.object({ type: import_zod7.z.literal("apiKey") }),
|
|
11794
|
+
import_zod7.z.object({ type: import_zod7.z.literal("chatgpt"), email: import_zod7.z.string().nullable(), planType: import_zod7.z.string() }),
|
|
11795
|
+
import_zod7.z.object({ type: import_zod7.z.literal("amazonBedrock"), usesCodexManagedCredentials: import_zod7.z.boolean().default(false) })
|
|
11523
11796
|
]);
|
|
11524
|
-
var CodexAccountReadSchema =
|
|
11797
|
+
var CodexAccountReadSchema = import_zod7.z.object({
|
|
11525
11798
|
account: CodexAccountSchema.nullable(),
|
|
11526
|
-
requiresOpenaiAuth:
|
|
11799
|
+
requiresOpenaiAuth: import_zod7.z.boolean()
|
|
11527
11800
|
});
|
|
11528
|
-
var CodexRateLimitsReadSchema =
|
|
11801
|
+
var CodexRateLimitsReadSchema = import_zod7.z.object({
|
|
11529
11802
|
rateLimits: RateLimitSnapshotSchema,
|
|
11530
|
-
rateLimitsByLimitId:
|
|
11531
|
-
rateLimitResetCredits:
|
|
11532
|
-
accountId:
|
|
11533
|
-
ordinaryUsageAllowed:
|
|
11803
|
+
rateLimitsByLimitId: import_zod7.z.record(import_zod7.z.string(), RateLimitSnapshotSchema).nullish(),
|
|
11804
|
+
rateLimitResetCredits: import_zod7.z.object({ availableCount: import_zod7.z.number(), credits: import_zod7.z.array(RateLimitResetCreditSchema).nullish() }).nullish(),
|
|
11805
|
+
accountId: import_zod7.z.string().nullish(),
|
|
11806
|
+
ordinaryUsageAllowed: import_zod7.z.boolean().nullish()
|
|
11534
11807
|
});
|
|
11535
|
-
var CodexInitializeResultSchema =
|
|
11808
|
+
var CodexInitializeResultSchema = import_zod7.z.object({ userAgent: import_zod7.z.string() });
|
|
11536
11809
|
|
|
11537
11810
|
// src/codex/appServer.ts
|
|
11538
11811
|
var CodexAppServerUnavailableError = class extends CliError {
|
|
@@ -12109,7 +12382,7 @@ init_realCredentialCache();
|
|
|
12109
12382
|
init_providersStore();
|
|
12110
12383
|
init_realPorts();
|
|
12111
12384
|
var import_node_path25 = __toESM(require("node:path"), 1);
|
|
12112
|
-
var
|
|
12385
|
+
var import_zod15 = require("zod");
|
|
12113
12386
|
init_envBool();
|
|
12114
12387
|
init_load();
|
|
12115
12388
|
init_schema();
|
|
@@ -12197,9 +12470,9 @@ function lookupKeychainService(run, farmRoot) {
|
|
|
12197
12470
|
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}".`
|
|
12198
12471
|
};
|
|
12199
12472
|
}
|
|
12200
|
-
var SettingsSecretsShapeSchema =
|
|
12201
|
-
env:
|
|
12202
|
-
hooks:
|
|
12473
|
+
var SettingsSecretsShapeSchema = import_zod15.z.looseObject({
|
|
12474
|
+
env: import_zod15.z.record(import_zod15.z.string(), import_zod15.z.unknown()).optional(),
|
|
12475
|
+
hooks: import_zod15.z.record(import_zod15.z.string(), import_zod15.z.array(import_zod15.z.unknown())).optional()
|
|
12203
12476
|
});
|
|
12204
12477
|
function hookCommandCountOf(group) {
|
|
12205
12478
|
if (typeof group !== "object" || group === null) {
|
|
@@ -12491,7 +12764,7 @@ function collectCheckReport(params) {
|
|
|
12491
12764
|
}
|
|
12492
12765
|
|
|
12493
12766
|
// src/checkReportSchema.ts
|
|
12494
|
-
var
|
|
12767
|
+
var import_zod17 = require("zod");
|
|
12495
12768
|
init_schema();
|
|
12496
12769
|
init_claudeVersion();
|
|
12497
12770
|
init_identity();
|
|
@@ -12555,124 +12828,124 @@ var DIAGNOSTIC_CODES = [
|
|
|
12555
12828
|
var DIAGNOSTIC_SEVERITIES = ["error", "warning", "info"];
|
|
12556
12829
|
|
|
12557
12830
|
// src/usage/pickReportSchema.ts
|
|
12558
|
-
var
|
|
12831
|
+
var import_zod16 = require("zod");
|
|
12559
12832
|
init_plan2();
|
|
12560
|
-
var PoolPickCandidateViewSchema =
|
|
12561
|
-
identity:
|
|
12833
|
+
var PoolPickCandidateViewSchema = import_zod16.z.strictObject({
|
|
12834
|
+
identity: import_zod16.z.string(),
|
|
12562
12835
|
/** In pick order: `scored` has usable quota data, `unknown` has none, `pay-per-use` bills by use, `ineligible` is refused right now. */
|
|
12563
|
-
class:
|
|
12836
|
+
class: import_zod16.z.enum(["scored", "unknown", "pay-per-use", "ineligible"]),
|
|
12564
12837
|
/** Plan-size-weighted remaining quota per hour until its reset; present for `scored` only. */
|
|
12565
|
-
score:
|
|
12838
|
+
score: import_zod16.z.number().optional(),
|
|
12566
12839
|
/** Which window's reset divides the score: the seven-day window, or the five-hour one when the member reports no seven-day utilisation or its measured-ratio five-hour term outranks the weekly one; present with `score`. */
|
|
12567
|
-
scoreWindow:
|
|
12840
|
+
scoreWindow: import_zod16.z.enum(["sevenDay", "fiveHour"]).optional(),
|
|
12568
12841
|
/** False when the five-hour window would run dry, at the observed pace, before it resets. */
|
|
12569
|
-
feasible:
|
|
12842
|
+
feasible: import_zod16.z.boolean(),
|
|
12570
12843
|
/** When an `ineligible` member can be used again, as an ISO instant. */
|
|
12571
|
-
blockedUntil:
|
|
12844
|
+
blockedUntil: import_zod16.z.iso.datetime().optional(),
|
|
12572
12845
|
plan: PlanClassSchema,
|
|
12573
12846
|
/** The facts behind the class and score, in the order they matter. */
|
|
12574
|
-
reasons:
|
|
12847
|
+
reasons: import_zod16.z.array(import_zod16.z.string())
|
|
12575
12848
|
});
|
|
12576
|
-
var PoolPickReportSchema =
|
|
12577
|
-
pool:
|
|
12578
|
-
directory:
|
|
12849
|
+
var PoolPickReportSchema = import_zod16.z.strictObject({
|
|
12850
|
+
pool: import_zod16.z.string(),
|
|
12851
|
+
directory: import_zod16.z.string(),
|
|
12579
12852
|
/** The member a launch would run as, absent when every member is refused. */
|
|
12580
|
-
pick:
|
|
12581
|
-
candidates:
|
|
12853
|
+
pick: import_zod16.z.string().optional(),
|
|
12854
|
+
candidates: import_zod16.z.array(PoolPickCandidateViewSchema),
|
|
12582
12855
|
/** Identity members anywhere in the pool's graph that do not exist; a launch skips them. */
|
|
12583
|
-
missing:
|
|
12856
|
+
missing: import_zod16.z.array(import_zod16.z.string()),
|
|
12584
12857
|
/** When nothing can be picked, the soonest any member returns. */
|
|
12585
|
-
earliestReturn:
|
|
12858
|
+
earliestReturn: import_zod16.z.strictObject({ identity: import_zod16.z.string(), at: import_zod16.z.iso.datetime() }).optional(),
|
|
12586
12859
|
/** The member a resumed conversation started on but moved off, and why, when the ranking could not keep it. */
|
|
12587
|
-
movedOff:
|
|
12860
|
+
movedOff: import_zod16.z.strictObject({ identity: import_zod16.z.string(), reason: import_zod16.z.string() }).optional(),
|
|
12588
12861
|
/** Why the last-pick record could not be read, when that is the case. */
|
|
12589
|
-
stickyProblem:
|
|
12862
|
+
stickyProblem: import_zod16.z.string().optional()
|
|
12590
12863
|
});
|
|
12591
12864
|
|
|
12592
12865
|
// src/checkReportSchema.ts
|
|
12593
12866
|
var CHECK_CREDENTIAL_APPLIES = ["provider", "identity", "stored-login"];
|
|
12594
|
-
var CheckLayerViewSchema =
|
|
12595
|
-
id:
|
|
12596
|
-
kind:
|
|
12597
|
-
source:
|
|
12867
|
+
var CheckLayerViewSchema = import_zod17.z.strictObject({
|
|
12868
|
+
id: import_zod17.z.int(),
|
|
12869
|
+
kind: import_zod17.z.enum(LAYER_KINDS),
|
|
12870
|
+
source: import_zod17.z.string()
|
|
12598
12871
|
});
|
|
12599
|
-
var CheckEntryViewSchema =
|
|
12600
|
-
path:
|
|
12601
|
-
shared:
|
|
12602
|
-
via:
|
|
12872
|
+
var CheckEntryViewSchema = import_zod17.z.strictObject({
|
|
12873
|
+
path: import_zod17.z.string(),
|
|
12874
|
+
shared: import_zod17.z.boolean(),
|
|
12875
|
+
via: import_zod17.z.enum(DECISION_VIAS),
|
|
12603
12876
|
/** The entry's real category, or null when nothing classifies it. */
|
|
12604
|
-
category:
|
|
12605
|
-
rule:
|
|
12877
|
+
category: import_zod17.z.enum(CATEGORY_NAMES).nullable(),
|
|
12878
|
+
rule: import_zod17.z.strictObject({ key: import_zod17.z.string(), layer: import_zod17.z.int() }).optional(),
|
|
12606
12879
|
/** Rules that matched but whose `when` condition failed, each with the conditions that failed. */
|
|
12607
|
-
eliminated:
|
|
12880
|
+
eliminated: import_zod17.z.readonly(import_zod17.z.array(import_zod17.z.strictObject({ key: import_zod17.z.string(), failed: import_zod17.z.readonly(import_zod17.z.array(import_zod17.z.string())) }))).optional()
|
|
12608
12881
|
});
|
|
12609
|
-
var CheckDiagnosticSchema =
|
|
12610
|
-
code:
|
|
12611
|
-
severity:
|
|
12612
|
-
message:
|
|
12613
|
-
subject:
|
|
12614
|
-
layer:
|
|
12882
|
+
var CheckDiagnosticSchema = import_zod17.z.strictObject({
|
|
12883
|
+
code: import_zod17.z.enum(DIAGNOSTIC_CODES),
|
|
12884
|
+
severity: import_zod17.z.enum(DIAGNOSTIC_SEVERITIES),
|
|
12885
|
+
message: import_zod17.z.string(),
|
|
12886
|
+
subject: import_zod17.z.string().optional(),
|
|
12887
|
+
layer: import_zod17.z.int().optional()
|
|
12615
12888
|
});
|
|
12616
|
-
var CheckAmbientCredentialSchema =
|
|
12617
|
-
var CheckKeychainSchema =
|
|
12618
|
-
checked:
|
|
12619
|
-
found:
|
|
12620
|
-
serviceName:
|
|
12621
|
-
note:
|
|
12889
|
+
var CheckAmbientCredentialSchema = import_zod17.z.union([import_zod17.z.strictObject({ ok: import_zod17.z.literal(true) }), import_zod17.z.strictObject({ ok: import_zod17.z.literal(false), variable: import_zod17.z.string(), message: import_zod17.z.string() })]);
|
|
12890
|
+
var CheckKeychainSchema = import_zod17.z.strictObject({
|
|
12891
|
+
checked: import_zod17.z.literal(true),
|
|
12892
|
+
found: import_zod17.z.boolean(),
|
|
12893
|
+
serviceName: import_zod17.z.string().optional(),
|
|
12894
|
+
note: import_zod17.z.string()
|
|
12622
12895
|
});
|
|
12623
|
-
var CheckSettingsExposureSchema =
|
|
12624
|
-
file:
|
|
12625
|
-
envKeyNames:
|
|
12626
|
-
hookEventNames:
|
|
12627
|
-
hookCommandCount:
|
|
12896
|
+
var CheckSettingsExposureSchema = import_zod17.z.strictObject({
|
|
12897
|
+
file: import_zod17.z.string(),
|
|
12898
|
+
envKeyNames: import_zod17.z.readonly(import_zod17.z.array(import_zod17.z.string())),
|
|
12899
|
+
hookEventNames: import_zod17.z.readonly(import_zod17.z.array(import_zod17.z.string())),
|
|
12900
|
+
hookCommandCount: import_zod17.z.int().nonnegative()
|
|
12628
12901
|
});
|
|
12629
|
-
var CredentialSourceSummarySchema =
|
|
12630
|
-
|
|
12631
|
-
|
|
12632
|
-
|
|
12633
|
-
|
|
12634
|
-
|
|
12635
|
-
|
|
12902
|
+
var CredentialSourceSummarySchema = import_zod17.z.union([
|
|
12903
|
+
import_zod17.z.strictObject({ kind: import_zod17.z.literal("env"), variable: import_zod17.z.string() }),
|
|
12904
|
+
import_zod17.z.strictObject({ kind: import_zod17.z.literal("file"), path: import_zod17.z.string() }),
|
|
12905
|
+
import_zod17.z.strictObject({ kind: import_zod17.z.literal("command"), program: import_zod17.z.string() }),
|
|
12906
|
+
import_zod17.z.strictObject({ kind: import_zod17.z.literal("op"), reference: import_zod17.z.string() }),
|
|
12907
|
+
import_zod17.z.strictObject({ kind: import_zod17.z.literal("keychain"), service: import_zod17.z.string(), account: import_zod17.z.string().optional() }),
|
|
12908
|
+
import_zod17.z.strictObject({ kind: import_zod17.z.literal("literal") })
|
|
12636
12909
|
]);
|
|
12637
|
-
var CredentialSummarySchema =
|
|
12638
|
-
target:
|
|
12639
|
-
sources:
|
|
12910
|
+
var CredentialSummarySchema = import_zod17.z.strictObject({
|
|
12911
|
+
target: import_zod17.z.enum(CREDENTIAL_TARGETS),
|
|
12912
|
+
sources: import_zod17.z.readonly(import_zod17.z.array(CredentialSourceSummarySchema)),
|
|
12640
12913
|
cache: CredentialCacheSchema.optional()
|
|
12641
12914
|
});
|
|
12642
|
-
var CachedCredentialStateSchema =
|
|
12643
|
-
|
|
12644
|
-
|
|
12645
|
-
|
|
12915
|
+
var CachedCredentialStateSchema = import_zod17.z.union([
|
|
12916
|
+
import_zod17.z.strictObject({ store: import_zod17.z.enum(CREDENTIAL_CACHE_STORES), status: import_zod17.z.literal("empty") }),
|
|
12917
|
+
import_zod17.z.strictObject({ store: import_zod17.z.enum(CREDENTIAL_CACHE_STORES), status: import_zod17.z.literal("unreadable"), reason: import_zod17.z.string() }),
|
|
12918
|
+
import_zod17.z.strictObject({ store: import_zod17.z.enum(CREDENTIAL_CACHE_STORES), status: import_zod17.z.enum(["fresh", "expired"]), ageMs: import_zod17.z.number(), expiresInMs: import_zod17.z.number().optional() })
|
|
12646
12919
|
]);
|
|
12647
|
-
var CheckCredentialProviderSchema =
|
|
12648
|
-
|
|
12649
|
-
|
|
12920
|
+
var CheckCredentialProviderSchema = import_zod17.z.union([
|
|
12921
|
+
import_zod17.z.strictObject({ name: import_zod17.z.string(), credential: CredentialSummarySchema, cached: CachedCredentialStateSchema.optional() }),
|
|
12922
|
+
import_zod17.z.strictObject({ name: import_zod17.z.string(), problem: import_zod17.z.string() })
|
|
12650
12923
|
]);
|
|
12651
|
-
var CheckCredentialSchema =
|
|
12652
|
-
applies:
|
|
12924
|
+
var CheckCredentialSchema = import_zod17.z.strictObject({
|
|
12925
|
+
applies: import_zod17.z.enum(CHECK_CREDENTIAL_APPLIES),
|
|
12653
12926
|
provider: CheckCredentialProviderSchema.optional(),
|
|
12654
12927
|
identity: CredentialSummarySchema.optional(),
|
|
12655
12928
|
identityCached: CachedCredentialStateSchema.optional()
|
|
12656
12929
|
});
|
|
12657
|
-
var CheckClaudeVersionSchema =
|
|
12658
|
-
pinned:
|
|
12659
|
-
highestInstalled:
|
|
12660
|
-
installed:
|
|
12930
|
+
var CheckClaudeVersionSchema = import_zod17.z.strictObject({
|
|
12931
|
+
pinned: import_zod17.z.strictObject({ version: import_zod17.z.string(), source: import_zod17.z.enum(CLAUDE_VERSION_SOURCES), installed: import_zod17.z.boolean() }).optional(),
|
|
12932
|
+
highestInstalled: import_zod17.z.string().optional(),
|
|
12933
|
+
installed: import_zod17.z.readonly(import_zod17.z.array(import_zod17.z.string()))
|
|
12661
12934
|
});
|
|
12662
|
-
var CheckReportJsonSchema =
|
|
12663
|
-
identity:
|
|
12935
|
+
var CheckReportJsonSchema = import_zod17.z.strictObject({
|
|
12936
|
+
identity: import_zod17.z.strictObject({ name: import_zod17.z.string().nullable(), source: import_zod17.z.enum(IDENTITY_DECISION_SOURCES) }),
|
|
12664
12937
|
/** The pool ranking, when the launch named a pool instead of an identity. */
|
|
12665
12938
|
pool: PoolPickReportSchema.optional(),
|
|
12666
|
-
configProfile:
|
|
12667
|
-
layers:
|
|
12668
|
-
entries:
|
|
12669
|
-
projectEncodingAmbiguities:
|
|
12670
|
-
|
|
12939
|
+
configProfile: import_zod17.z.strictObject({ name: import_zod17.z.string().nullable(), source: import_zod17.z.enum(CONFIG_PROFILE_DECISION_SOURCES) }),
|
|
12940
|
+
layers: import_zod17.z.readonly(import_zod17.z.array(CheckLayerViewSchema)),
|
|
12941
|
+
entries: import_zod17.z.readonly(import_zod17.z.array(CheckEntryViewSchema)),
|
|
12942
|
+
projectEncodingAmbiguities: import_zod17.z.readonly(
|
|
12943
|
+
import_zod17.z.array(import_zod17.z.strictObject({ fragment: import_zod17.z.string(), encoded: import_zod17.z.string(), reason: import_zod17.z.enum(ENCODING_AMBIGUITY_REASONS), detail: import_zod17.z.string() }))
|
|
12671
12944
|
),
|
|
12672
|
-
diagnostics:
|
|
12945
|
+
diagnostics: import_zod17.z.readonly(import_zod17.z.array(CheckDiagnosticSchema)),
|
|
12673
12946
|
ambientCredential: CheckAmbientCredentialSchema,
|
|
12674
12947
|
keychain: CheckKeychainSchema.optional(),
|
|
12675
|
-
settingsExposure:
|
|
12948
|
+
settingsExposure: import_zod17.z.readonly(import_zod17.z.array(CheckSettingsExposureSchema)),
|
|
12676
12949
|
credential: CheckCredentialSchema,
|
|
12677
12950
|
claudeVersion: CheckClaudeVersionSchema.optional()
|
|
12678
12951
|
});
|
|
@@ -12732,28 +13005,28 @@ function collectResets(snapshots, nowMs) {
|
|
|
12732
13005
|
}
|
|
12733
13006
|
|
|
12734
13007
|
// src/usage/resetsSchema.ts
|
|
12735
|
-
var
|
|
12736
|
-
var ResetRowSchema =
|
|
12737
|
-
identity:
|
|
12738
|
-
provider:
|
|
13008
|
+
var import_zod18 = require("zod");
|
|
13009
|
+
var ResetRowSchema = import_zod18.z.strictObject({
|
|
13010
|
+
identity: import_zod18.z.string(),
|
|
13011
|
+
provider: import_zod18.z.string(),
|
|
12739
13012
|
/** What the window is: `5h`, `7d` or `extra usage` for an Anthropic account, or the provider's own measure and period (`tokens 5h`). */
|
|
12740
|
-
window:
|
|
13013
|
+
window: import_zod18.z.string(),
|
|
12741
13014
|
/** When the state the window comes from was observed, as an ISO instant. */
|
|
12742
|
-
observedAt:
|
|
13015
|
+
observedAt: import_zod18.z.iso.datetime(),
|
|
12743
13016
|
/** When the window resets, as an ISO instant; absent when the upstream reported none. */
|
|
12744
|
-
resetsAt:
|
|
13017
|
+
resetsAt: import_zod18.z.iso.datetime().optional(),
|
|
12745
13018
|
/** True when the reset time has passed, so the recorded observation describes a window that no longer exists and its utilisation reads as 0. */
|
|
12746
|
-
reset:
|
|
13019
|
+
reset: import_zod18.z.boolean(),
|
|
12747
13020
|
/** The fraction used, as `effectiveWindow` reads it at the report's own clock. */
|
|
12748
|
-
utilization:
|
|
13021
|
+
utilization: import_zod18.z.number().optional(),
|
|
12749
13022
|
/** The window's own status, for a window that has not reset yet. */
|
|
12750
|
-
status:
|
|
13023
|
+
status: import_zod18.z.string().optional()
|
|
12751
13024
|
});
|
|
12752
|
-
var ResetScheduleSchema =
|
|
13025
|
+
var ResetScheduleSchema = import_zod18.z.strictObject({ resets: import_zod18.z.readonly(import_zod18.z.array(ResetRowSchema)) });
|
|
12753
13026
|
|
|
12754
13027
|
// src/frontdoor/controlSchemas.ts
|
|
12755
13028
|
var import_node_path30 = __toESM(require("node:path"), 1);
|
|
12756
|
-
var
|
|
13029
|
+
var import_zod23 = require("zod");
|
|
12757
13030
|
|
|
12758
13031
|
// src/doctorReport.ts
|
|
12759
13032
|
init_claudeShim();
|
|
@@ -12954,24 +13227,24 @@ function credentialsFilePath(farmRoot) {
|
|
|
12954
13227
|
}
|
|
12955
13228
|
|
|
12956
13229
|
// src/codex/siwcStore.ts
|
|
12957
|
-
var
|
|
13230
|
+
var import_zod22 = require("zod");
|
|
12958
13231
|
|
|
12959
13232
|
// src/codex/auth.ts
|
|
12960
|
-
var
|
|
12961
|
-
var AuthFileSchema =
|
|
12962
|
-
tokens:
|
|
12963
|
-
access_token:
|
|
12964
|
-
refresh_token:
|
|
12965
|
-
id_token:
|
|
12966
|
-
account_id:
|
|
13233
|
+
var import_zod20 = require("zod");
|
|
13234
|
+
var AuthFileSchema = import_zod20.z.looseObject({
|
|
13235
|
+
tokens: import_zod20.z.looseObject({
|
|
13236
|
+
access_token: import_zod20.z.string().optional(),
|
|
13237
|
+
refresh_token: import_zod20.z.string().optional(),
|
|
13238
|
+
id_token: import_zod20.z.string().optional(),
|
|
13239
|
+
account_id: import_zod20.z.string().optional()
|
|
12967
13240
|
}).nullish(),
|
|
12968
|
-
last_refresh:
|
|
13241
|
+
last_refresh: import_zod20.z.string().optional()
|
|
12969
13242
|
});
|
|
12970
|
-
var TokenGrantSchema =
|
|
12971
|
-
access_token:
|
|
12972
|
-
refresh_token:
|
|
12973
|
-
id_token:
|
|
12974
|
-
account_id:
|
|
13243
|
+
var TokenGrantSchema = import_zod20.z.looseObject({
|
|
13244
|
+
access_token: import_zod20.z.string().min(1).optional(),
|
|
13245
|
+
refresh_token: import_zod20.z.string().min(1).optional(),
|
|
13246
|
+
id_token: import_zod20.z.string().min(1).optional(),
|
|
13247
|
+
account_id: import_zod20.z.string().min(1).optional()
|
|
12975
13248
|
});
|
|
12976
13249
|
var CodexAuthError = class extends Error {
|
|
12977
13250
|
constructor(message) {
|
|
@@ -12981,41 +13254,41 @@ var CodexAuthError = class extends Error {
|
|
|
12981
13254
|
};
|
|
12982
13255
|
|
|
12983
13256
|
// src/codex/siwc.ts
|
|
12984
|
-
var
|
|
13257
|
+
var import_zod21 = require("zod");
|
|
12985
13258
|
var SIWC_RESOURCE = "https://api.openai.com/v1";
|
|
12986
13259
|
var SIWC_RESPONSES_URL = `${SIWC_RESOURCE}/responses`;
|
|
12987
13260
|
var SIWC_PLAN_SCOPE = "chatgpt.tokens.use.direct";
|
|
12988
|
-
var TokenResponseSchema =
|
|
12989
|
-
access_token:
|
|
12990
|
-
refresh_token:
|
|
12991
|
-
id_token:
|
|
12992
|
-
expires_in:
|
|
12993
|
-
scope:
|
|
13261
|
+
var TokenResponseSchema = import_zod21.z.looseObject({
|
|
13262
|
+
access_token: import_zod21.z.string().min(1),
|
|
13263
|
+
refresh_token: import_zod21.z.string().min(1).optional(),
|
|
13264
|
+
id_token: import_zod21.z.string().min(1).optional(),
|
|
13265
|
+
expires_in: import_zod21.z.number().positive(),
|
|
13266
|
+
scope: import_zod21.z.string().optional()
|
|
12994
13267
|
});
|
|
12995
|
-
var JwtHeaderSchema =
|
|
12996
|
-
var IdTokenClaimsSchema =
|
|
12997
|
-
iss:
|
|
12998
|
-
sub:
|
|
12999
|
-
aud:
|
|
13000
|
-
exp:
|
|
13001
|
-
nonce:
|
|
13002
|
-
email:
|
|
13268
|
+
var JwtHeaderSchema = import_zod21.z.looseObject({ alg: import_zod21.z.string(), kid: import_zod21.z.string().optional() });
|
|
13269
|
+
var IdTokenClaimsSchema = import_zod21.z.looseObject({
|
|
13270
|
+
iss: import_zod21.z.string(),
|
|
13271
|
+
sub: import_zod21.z.string().min(1),
|
|
13272
|
+
aud: import_zod21.z.union([import_zod21.z.string(), import_zod21.z.array(import_zod21.z.string())]),
|
|
13273
|
+
exp: import_zod21.z.number(),
|
|
13274
|
+
nonce: import_zod21.z.string().optional(),
|
|
13275
|
+
email: import_zod21.z.string().optional()
|
|
13003
13276
|
});
|
|
13004
|
-
var JwksSchema =
|
|
13277
|
+
var JwksSchema = import_zod21.z.object({ keys: import_zod21.z.array(import_zod21.z.looseObject({ kid: import_zod21.z.string().optional(), kty: import_zod21.z.string() })) });
|
|
13005
13278
|
|
|
13006
13279
|
// src/codex/siwcStore.ts
|
|
13007
|
-
var SiwcGrantSchema =
|
|
13008
|
-
clientId:
|
|
13009
|
-
sub:
|
|
13010
|
-
email:
|
|
13011
|
-
idToken:
|
|
13012
|
-
accessToken:
|
|
13013
|
-
refreshToken:
|
|
13014
|
-
scopes:
|
|
13280
|
+
var SiwcGrantSchema = import_zod22.z.strictObject({
|
|
13281
|
+
clientId: import_zod22.z.string().min(1),
|
|
13282
|
+
sub: import_zod22.z.string().min(1),
|
|
13283
|
+
email: import_zod22.z.string().optional(),
|
|
13284
|
+
idToken: import_zod22.z.string().min(1),
|
|
13285
|
+
accessToken: import_zod22.z.string().min(1),
|
|
13286
|
+
refreshToken: import_zod22.z.string().min(1),
|
|
13287
|
+
scopes: import_zod22.z.array(import_zod22.z.string()).readonly(),
|
|
13015
13288
|
/** When the access token stops working, in milliseconds since the epoch. */
|
|
13016
|
-
expiresAt:
|
|
13289
|
+
expiresAt: import_zod22.z.number()
|
|
13017
13290
|
});
|
|
13018
|
-
var SiwcFileSchema =
|
|
13291
|
+
var SiwcFileSchema = import_zod22.z.strictObject({ registeredClientId: import_zod22.z.string().min(1).optional(), grant: SiwcGrantSchema.optional() });
|
|
13019
13292
|
function parseSiwcFile(raw, filePath) {
|
|
13020
13293
|
let json;
|
|
13021
13294
|
try {
|
|
@@ -13712,90 +13985,90 @@ function collectDoctorReport(params) {
|
|
|
13712
13985
|
// src/frontdoor/controlSchemas.ts
|
|
13713
13986
|
init_schema2();
|
|
13714
13987
|
init_state();
|
|
13715
|
-
var UsageListOutputSchema =
|
|
13716
|
-
var UsageWindowsInputSchema =
|
|
13717
|
-
identity:
|
|
13718
|
-
provider:
|
|
13988
|
+
var UsageListOutputSchema = import_zod23.z.strictObject({ snapshots: import_zod23.z.readonly(import_zod23.z.array(UsageSnapshotSchema)) });
|
|
13989
|
+
var UsageWindowsInputSchema = import_zod23.z.strictObject({
|
|
13990
|
+
identity: import_zod23.z.string().min(1),
|
|
13991
|
+
provider: import_zod23.z.string().min(1).optional()
|
|
13719
13992
|
});
|
|
13720
|
-
var EffectiveWindowSchema =
|
|
13993
|
+
var EffectiveWindowSchema = import_zod23.z.strictObject({
|
|
13721
13994
|
/** True when the window's reset time has passed, so the recorded observation describes a window that no longer exists. */
|
|
13722
|
-
reset:
|
|
13995
|
+
reset: import_zod23.z.boolean(),
|
|
13723
13996
|
/** The fraction used: 0 for a reset window, otherwise what was last observed, absent when none was reported. */
|
|
13724
|
-
utilization:
|
|
13997
|
+
utilization: import_zod23.z.number().optional(),
|
|
13725
13998
|
/** The reset instant, for a window that has not reset yet and reported one. */
|
|
13726
|
-
resetsAtMs:
|
|
13999
|
+
resetsAtMs: import_zod23.z.number().optional(),
|
|
13727
14000
|
/** The window's own status, for a window that has not reset yet. */
|
|
13728
|
-
status:
|
|
14001
|
+
status: import_zod23.z.string().optional()
|
|
13729
14002
|
});
|
|
13730
|
-
var UsageWindowsOutputSchema =
|
|
13731
|
-
identity:
|
|
13732
|
-
provider:
|
|
14003
|
+
var UsageWindowsOutputSchema = import_zod23.z.strictObject({
|
|
14004
|
+
identity: import_zod23.z.string(),
|
|
14005
|
+
provider: import_zod23.z.string(),
|
|
13733
14006
|
/** When the rate-limit state the windows come from was observed. */
|
|
13734
|
-
observedAt:
|
|
14007
|
+
observedAt: import_zod23.z.iso.datetime().optional(),
|
|
13735
14008
|
fiveHour: EffectiveWindowSchema.optional(),
|
|
13736
14009
|
sevenDay: EffectiveWindowSchema.optional()
|
|
13737
14010
|
});
|
|
13738
|
-
var UsageLiveOutputSchema =
|
|
14011
|
+
var UsageLiveOutputSchema = import_zod23.z.strictObject({
|
|
13739
14012
|
/** 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. */
|
|
13740
14013
|
latest: RcLiveRateLimitSchema.optional(),
|
|
13741
14014
|
/** One observation per session whose stream has filed a rate_limit_event this door generation. */
|
|
13742
|
-
sessions:
|
|
14015
|
+
sessions: import_zod23.z.readonly(import_zod23.z.array(RcLiveRateLimitSchema))
|
|
13743
14016
|
});
|
|
13744
|
-
var FrontDoorSessionStatusSchema =
|
|
13745
|
-
pid:
|
|
13746
|
-
startedAt:
|
|
13747
|
-
alive:
|
|
14017
|
+
var FrontDoorSessionStatusSchema = import_zod23.z.strictObject({
|
|
14018
|
+
pid: import_zod23.z.int().positive(),
|
|
14019
|
+
startedAt: import_zod23.z.number(),
|
|
14020
|
+
alive: import_zod23.z.boolean()
|
|
13748
14021
|
});
|
|
13749
|
-
var HeadroomSocketTargetSchema =
|
|
13750
|
-
var FrontDoorStatusOutputSchema =
|
|
14022
|
+
var HeadroomSocketTargetSchema = import_zod23.z.union([import_zod23.z.strictObject({ socketPath: import_zod23.z.string() }), import_zod23.z.strictObject({ refused: import_zod23.z.string() })]);
|
|
14023
|
+
var FrontDoorStatusOutputSchema = import_zod23.z.strictObject({
|
|
13751
14024
|
state: FrontDoorStateSchema,
|
|
13752
|
-
supervisorAlive:
|
|
13753
|
-
sessions:
|
|
14025
|
+
supervisorAlive: import_zod23.z.boolean(),
|
|
14026
|
+
sessions: import_zod23.z.readonly(import_zod23.z.array(FrontDoorSessionStatusSchema)),
|
|
13754
14027
|
headroomSocket: HeadroomSocketTargetSchema.optional(),
|
|
13755
|
-
logPath:
|
|
13756
|
-
logExists:
|
|
14028
|
+
logPath: import_zod23.z.string(),
|
|
14029
|
+
logExists: import_zod23.z.boolean()
|
|
13757
14030
|
});
|
|
13758
|
-
var FrontDoorSessionsOutputSchema =
|
|
13759
|
-
var CheckRunInputSchema =
|
|
13760
|
-
path:
|
|
13761
|
-
identity:
|
|
14031
|
+
var FrontDoorSessionsOutputSchema = import_zod23.z.strictObject({ sessions: import_zod23.z.readonly(import_zod23.z.array(FrontDoorSessionStatusSchema)) });
|
|
14032
|
+
var CheckRunInputSchema = import_zod23.z.strictObject({
|
|
14033
|
+
path: import_zod23.z.string().min(1),
|
|
14034
|
+
identity: import_zod23.z.string().min(1).optional()
|
|
13762
14035
|
}).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" });
|
|
13763
|
-
var PoolPickInputSchema =
|
|
13764
|
-
pool:
|
|
13765
|
-
path:
|
|
14036
|
+
var PoolPickInputSchema = import_zod23.z.strictObject({
|
|
14037
|
+
pool: import_zod23.z.string().min(1),
|
|
14038
|
+
path: import_zod23.z.string().min(1)
|
|
13766
14039
|
}).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" });
|
|
13767
|
-
var DoctorFindingSchema =
|
|
13768
|
-
section:
|
|
13769
|
-
subject:
|
|
13770
|
-
severity:
|
|
13771
|
-
message:
|
|
14040
|
+
var DoctorFindingSchema = import_zod23.z.strictObject({
|
|
14041
|
+
section: import_zod23.z.enum(DOCTOR_SECTIONS),
|
|
14042
|
+
subject: import_zod23.z.string().optional(),
|
|
14043
|
+
severity: import_zod23.z.enum(DOCTOR_SEVERITIES),
|
|
14044
|
+
message: import_zod23.z.string()
|
|
13772
14045
|
});
|
|
13773
|
-
var DoctorRunOutputSchema =
|
|
14046
|
+
var DoctorRunOutputSchema = import_zod23.z.strictObject({
|
|
13774
14047
|
/** False exactly when any finding is a `fail`; a `warn` never fails the report on its own. */
|
|
13775
|
-
ok:
|
|
13776
|
-
findings:
|
|
14048
|
+
ok: import_zod23.z.boolean(),
|
|
14049
|
+
findings: import_zod23.z.readonly(import_zod23.z.array(DoctorFindingSchema))
|
|
13777
14050
|
});
|
|
13778
|
-
var FrontDoorRestartOutputSchema =
|
|
13779
|
-
action:
|
|
13780
|
-
previousPid:
|
|
14051
|
+
var FrontDoorRestartOutputSchema = import_zod23.z.strictObject({
|
|
14052
|
+
action: import_zod23.z.literal("restarting"),
|
|
14053
|
+
previousPid: import_zod23.z.int().positive()
|
|
13781
14054
|
});
|
|
13782
|
-
var UpdateCheckOutputSchema =
|
|
13783
|
-
current:
|
|
13784
|
-
latest:
|
|
13785
|
-
action:
|
|
14055
|
+
var UpdateCheckOutputSchema = import_zod23.z.strictObject({
|
|
14056
|
+
current: import_zod23.z.string(),
|
|
14057
|
+
latest: import_zod23.z.string(),
|
|
14058
|
+
action: import_zod23.z.enum(["current", "available", "updated"])
|
|
13786
14059
|
});
|
|
13787
|
-
var CodexSignInSchema =
|
|
13788
|
-
|
|
13789
|
-
|
|
13790
|
-
|
|
14060
|
+
var CodexSignInSchema = import_zod23.z.discriminatedUnion("state", [
|
|
14061
|
+
import_zod23.z.strictObject({ state: import_zod23.z.literal("none") }),
|
|
14062
|
+
import_zod23.z.strictObject({ state: import_zod23.z.literal("signed-in"), email: import_zod23.z.string().optional(), planScope: import_zod23.z.boolean(), accessTokenExpiresAt: import_zod23.z.number() }),
|
|
14063
|
+
import_zod23.z.strictObject({ state: import_zod23.z.literal("unreadable"), message: import_zod23.z.string() })
|
|
13791
14064
|
]);
|
|
13792
|
-
var CodexStatusOutputSchema =
|
|
14065
|
+
var CodexStatusOutputSchema = import_zod23.z.strictObject({
|
|
13793
14066
|
signIn: CodexSignInSchema,
|
|
13794
|
-
codexProviders:
|
|
14067
|
+
codexProviders: import_zod23.z.readonly(import_zod23.z.array(import_zod23.z.string()))
|
|
13795
14068
|
});
|
|
13796
|
-
var CodexLogoutOutputSchema =
|
|
13797
|
-
hadGrant:
|
|
13798
|
-
revoked:
|
|
14069
|
+
var CodexLogoutOutputSchema = import_zod23.z.strictObject({
|
|
14070
|
+
hadGrant: import_zod23.z.boolean(),
|
|
14071
|
+
revoked: import_zod23.z.boolean()
|
|
13799
14072
|
});
|
|
13800
14073
|
|
|
13801
14074
|
// src/frontdoor/codexApi.ts
|
|
@@ -13951,134 +14224,134 @@ init_identity();
|
|
|
13951
14224
|
init_providersStore();
|
|
13952
14225
|
|
|
13953
14226
|
// src/frontdoor/configSchemas.ts
|
|
13954
|
-
var
|
|
14227
|
+
var import_zod24 = require("zod");
|
|
13955
14228
|
init_schema();
|
|
13956
|
-
var RemovalConfirmationSchema =
|
|
13957
|
-
var CredentialWriteSchema = (targets) =>
|
|
13958
|
-
sources:
|
|
13959
|
-
target:
|
|
13960
|
-
cache:
|
|
14229
|
+
var RemovalConfirmationSchema = import_zod24.z.boolean();
|
|
14230
|
+
var CredentialWriteSchema = (targets) => import_zod24.z.strictObject({
|
|
14231
|
+
sources: import_zod24.z.array(RemoteCredentialSourceSchema).min(1).optional(),
|
|
14232
|
+
target: import_zod24.z.enum(targets).optional(),
|
|
14233
|
+
cache: import_zod24.z.union([import_zod24.z.literal(false), CredentialCacheSchema]).optional()
|
|
13961
14234
|
});
|
|
13962
|
-
var CredentialSummarySchema2 =
|
|
13963
|
-
target:
|
|
13964
|
-
sources:
|
|
13965
|
-
|
|
13966
|
-
|
|
13967
|
-
|
|
13968
|
-
|
|
13969
|
-
|
|
13970
|
-
|
|
13971
|
-
|
|
14235
|
+
var CredentialSummarySchema2 = import_zod24.z.strictObject({
|
|
14236
|
+
target: import_zod24.z.enum(CREDENTIAL_TARGETS),
|
|
14237
|
+
sources: import_zod24.z.readonly(import_zod24.z.array(
|
|
14238
|
+
import_zod24.z.discriminatedUnion("kind", [
|
|
14239
|
+
import_zod24.z.strictObject({ kind: import_zod24.z.literal("env"), variable: import_zod24.z.string() }),
|
|
14240
|
+
import_zod24.z.strictObject({ kind: import_zod24.z.literal("file"), path: import_zod24.z.string() }),
|
|
14241
|
+
import_zod24.z.strictObject({ kind: import_zod24.z.literal("command"), program: import_zod24.z.string() }),
|
|
14242
|
+
import_zod24.z.strictObject({ kind: import_zod24.z.literal("op"), reference: import_zod24.z.string() }),
|
|
14243
|
+
import_zod24.z.strictObject({ kind: import_zod24.z.literal("keychain"), service: import_zod24.z.string(), account: import_zod24.z.string().optional() }),
|
|
14244
|
+
import_zod24.z.strictObject({ kind: import_zod24.z.literal("literal") })
|
|
13972
14245
|
])
|
|
13973
14246
|
)),
|
|
13974
14247
|
cache: CredentialCacheSchema.optional()
|
|
13975
14248
|
});
|
|
13976
|
-
var mutationOutput = (kind, action) =>
|
|
13977
|
-
var storedMutationOutput = (kind, action, value) =>
|
|
13978
|
-
var IdentityValueSchema =
|
|
13979
|
-
name:
|
|
13980
|
-
defaultConfigProfile:
|
|
13981
|
-
allowAmbientCredential:
|
|
14249
|
+
var mutationOutput = (kind, action) => import_zod24.z.strictObject({ action: import_zod24.z.literal(action), kind: import_zod24.z.literal(kind), name: import_zod24.z.string() });
|
|
14250
|
+
var storedMutationOutput = (kind, action, value) => import_zod24.z.strictObject({ action: import_zod24.z.literal(action), kind: import_zod24.z.literal(kind), name: import_zod24.z.string(), value });
|
|
14251
|
+
var IdentityValueSchema = import_zod24.z.strictObject({
|
|
14252
|
+
name: import_zod24.z.string(),
|
|
14253
|
+
defaultConfigProfile: import_zod24.z.string().optional(),
|
|
14254
|
+
allowAmbientCredential: import_zod24.z.boolean(),
|
|
13982
14255
|
credential: CredentialSummarySchema2.optional(),
|
|
13983
|
-
anchors:
|
|
14256
|
+
anchors: import_zod24.z.array(AnchorSchema).optional()
|
|
13984
14257
|
});
|
|
13985
14258
|
var ProfileValueSchema = ConfigProfileSchema.omit({ $schema: true });
|
|
13986
|
-
var ProviderValueSchema =
|
|
13987
|
-
name:
|
|
13988
|
-
kind:
|
|
13989
|
-
displayName:
|
|
13990
|
-
baseUrl:
|
|
14259
|
+
var ProviderValueSchema = import_zod24.z.strictObject({
|
|
14260
|
+
name: import_zod24.z.string(),
|
|
14261
|
+
kind: import_zod24.z.enum(PROVIDER_KINDS),
|
|
14262
|
+
displayName: import_zod24.z.string(),
|
|
14263
|
+
baseUrl: import_zod24.z.string().optional(),
|
|
13991
14264
|
codex: CodexProviderConfigSchema.optional(),
|
|
13992
14265
|
credential: CredentialSummarySchema2,
|
|
13993
|
-
env:
|
|
14266
|
+
env: import_zod24.z.record(import_zod24.z.string(), import_zod24.z.string()).optional()
|
|
13994
14267
|
});
|
|
13995
|
-
var ConfigNameInputSchema =
|
|
14268
|
+
var ConfigNameInputSchema = import_zod24.z.strictObject({ name: import_zod24.z.string().min(1) });
|
|
13996
14269
|
var ConfigIdentityAddOutputSchema = storedMutationOutput("identity", "created", IdentityValueSchema);
|
|
13997
|
-
var ConfigIdentitySetInputSchema =
|
|
13998
|
-
name:
|
|
13999
|
-
defaultConfigProfile:
|
|
14000
|
-
allowAmbientCredential:
|
|
14001
|
-
credential:
|
|
14270
|
+
var ConfigIdentitySetInputSchema = import_zod24.z.strictObject({
|
|
14271
|
+
name: import_zod24.z.string().min(1),
|
|
14272
|
+
defaultConfigProfile: import_zod24.z.union([import_zod24.z.string().min(1), import_zod24.z.literal(false)]).optional(),
|
|
14273
|
+
allowAmbientCredential: import_zod24.z.boolean().optional(),
|
|
14274
|
+
credential: import_zod24.z.union([import_zod24.z.literal(false), CredentialWriteSchema(CREDENTIAL_TARGETS)]).optional(),
|
|
14002
14275
|
/** `false` removes the anchors; a list replaces them. */
|
|
14003
|
-
anchors:
|
|
14276
|
+
anchors: import_zod24.z.union([import_zod24.z.literal(false), import_zod24.z.array(AnchorSchema).min(1)]).optional()
|
|
14004
14277
|
});
|
|
14005
14278
|
var ConfigIdentitySetOutputSchema = storedMutationOutput("identity", "updated", IdentityValueSchema);
|
|
14006
|
-
var ConfigIdentityRemoveInputSchema =
|
|
14279
|
+
var ConfigIdentityRemoveInputSchema = import_zod24.z.strictObject({ name: import_zod24.z.string().min(1), confirm: RemovalConfirmationSchema });
|
|
14007
14280
|
var ConfigIdentityRemoveOutputSchema = mutationOutput("identity", "removed");
|
|
14008
14281
|
var ConfigIdentityUseOutputSchema = mutationOutput("identity", "selected");
|
|
14009
|
-
var ConfigProfileAddInputSchema =
|
|
14010
|
-
name:
|
|
14011
|
-
extends:
|
|
14012
|
-
description:
|
|
14282
|
+
var ConfigProfileAddInputSchema = import_zod24.z.strictObject({
|
|
14283
|
+
name: import_zod24.z.string().min(1),
|
|
14284
|
+
extends: import_zod24.z.array(import_zod24.z.string().min(1)).optional(),
|
|
14285
|
+
description: import_zod24.z.string().optional()
|
|
14013
14286
|
});
|
|
14014
14287
|
var ConfigProfileAddOutputSchema = storedMutationOutput("profile", "created", ProfileValueSchema);
|
|
14015
|
-
var ConfigProfileSetInputSchema =
|
|
14016
|
-
name:
|
|
14017
|
-
category:
|
|
14018
|
-
entry:
|
|
14019
|
-
extends:
|
|
14020
|
-
description:
|
|
14021
|
-
launch:
|
|
14022
|
-
skipPermissions:
|
|
14023
|
-
remoteControl:
|
|
14024
|
-
headroom:
|
|
14025
|
-
trackUsage:
|
|
14026
|
-
provider:
|
|
14027
|
-
claudeVersion:
|
|
14288
|
+
var ConfigProfileSetInputSchema = import_zod24.z.strictObject({
|
|
14289
|
+
name: import_zod24.z.string().min(1),
|
|
14290
|
+
category: import_zod24.z.record(import_zod24.z.string(), import_zod24.z.boolean()).optional(),
|
|
14291
|
+
entry: import_zod24.z.record(import_zod24.z.string(), import_zod24.z.boolean()).optional(),
|
|
14292
|
+
extends: import_zod24.z.union([import_zod24.z.array(import_zod24.z.string().min(1)), import_zod24.z.literal(false)]).optional(),
|
|
14293
|
+
description: import_zod24.z.union([import_zod24.z.string(), import_zod24.z.literal(false)]).optional(),
|
|
14294
|
+
launch: import_zod24.z.strictObject({
|
|
14295
|
+
skipPermissions: import_zod24.z.boolean().optional(),
|
|
14296
|
+
remoteControl: import_zod24.z.boolean().optional(),
|
|
14297
|
+
headroom: import_zod24.z.boolean().optional(),
|
|
14298
|
+
trackUsage: import_zod24.z.boolean().optional(),
|
|
14299
|
+
provider: import_zod24.z.union([import_zod24.z.string().min(1), import_zod24.z.literal(false)]).optional(),
|
|
14300
|
+
claudeVersion: import_zod24.z.union([import_zod24.z.string().min(1), import_zod24.z.literal(false)]).optional()
|
|
14028
14301
|
}).optional()
|
|
14029
14302
|
});
|
|
14030
14303
|
var ConfigProfileSetOutputSchema = storedMutationOutput("profile", "updated", ProfileValueSchema);
|
|
14031
|
-
var ConfigProfileRemoveInputSchema =
|
|
14304
|
+
var ConfigProfileRemoveInputSchema = import_zod24.z.strictObject({ name: import_zod24.z.string().min(1), confirm: RemovalConfirmationSchema });
|
|
14032
14305
|
var ConfigProfileRemoveOutputSchema = mutationOutput("profile", "removed");
|
|
14033
14306
|
var ConfigProfileUseOutputSchema = mutationOutput("profile", "selected");
|
|
14034
|
-
var PoolMembersInputSchema =
|
|
14035
|
-
var ConfigPoolAddInputSchema =
|
|
14036
|
-
name:
|
|
14307
|
+
var PoolMembersInputSchema = import_zod24.z.array(import_zod24.z.string().min(1)).min(1);
|
|
14308
|
+
var ConfigPoolAddInputSchema = import_zod24.z.strictObject({
|
|
14309
|
+
name: import_zod24.z.string().min(1),
|
|
14037
14310
|
identities: PoolMembersInputSchema,
|
|
14038
|
-
preference:
|
|
14311
|
+
preference: import_zod24.z.enum(POOL_PREFERENCES).optional()
|
|
14039
14312
|
});
|
|
14040
14313
|
var ConfigPoolAddOutputSchema = storedMutationOutput("pool", "created", PoolSchema);
|
|
14041
|
-
var ConfigPoolSetInputSchema =
|
|
14042
|
-
name:
|
|
14314
|
+
var ConfigPoolSetInputSchema = import_zod24.z.strictObject({
|
|
14315
|
+
name: import_zod24.z.string().min(1),
|
|
14043
14316
|
identities: PoolMembersInputSchema.optional(),
|
|
14044
|
-
preference:
|
|
14317
|
+
preference: import_zod24.z.union([import_zod24.z.enum(POOL_PREFERENCES), import_zod24.z.literal(false)]).optional()
|
|
14045
14318
|
});
|
|
14046
14319
|
var ConfigPoolSetOutputSchema = storedMutationOutput("pool", "updated", PoolSchema);
|
|
14047
|
-
var ConfigPoolRemoveInputSchema =
|
|
14320
|
+
var ConfigPoolRemoveInputSchema = import_zod24.z.strictObject({ name: import_zod24.z.string().min(1), confirm: RemovalConfirmationSchema });
|
|
14048
14321
|
var ConfigPoolRemoveOutputSchema = mutationOutput("pool", "removed");
|
|
14049
14322
|
var ConfigPoolUseOutputSchema = mutationOutput("pool", "selected");
|
|
14050
|
-
var ConfigProviderAddInputSchema =
|
|
14051
|
-
name:
|
|
14052
|
-
kind:
|
|
14053
|
-
displayName:
|
|
14054
|
-
baseUrl:
|
|
14323
|
+
var ConfigProviderAddInputSchema = import_zod24.z.strictObject({
|
|
14324
|
+
name: import_zod24.z.string().min(1),
|
|
14325
|
+
kind: import_zod24.z.enum(PROVIDER_KINDS).optional(),
|
|
14326
|
+
displayName: import_zod24.z.string().min(1),
|
|
14327
|
+
baseUrl: import_zod24.z.string().min(1).optional(),
|
|
14055
14328
|
credential: CredentialWriteSchema(PROVIDER_CREDENTIAL_TARGETS).required({ sources: true }),
|
|
14056
14329
|
codex: CodexProviderConfigSchema.optional()
|
|
14057
14330
|
});
|
|
14058
14331
|
var ConfigProviderAddOutputSchema = storedMutationOutput("provider", "created", ProviderValueSchema);
|
|
14059
|
-
var ConfigProviderSetInputSchema =
|
|
14060
|
-
name:
|
|
14061
|
-
displayName:
|
|
14062
|
-
baseUrl:
|
|
14332
|
+
var ConfigProviderSetInputSchema = import_zod24.z.strictObject({
|
|
14333
|
+
name: import_zod24.z.string().min(1),
|
|
14334
|
+
displayName: import_zod24.z.string().min(1).optional(),
|
|
14335
|
+
baseUrl: import_zod24.z.string().min(1).optional(),
|
|
14063
14336
|
credential: CredentialWriteSchema(PROVIDER_CREDENTIAL_TARGETS).optional(),
|
|
14064
14337
|
codex: CodexProviderConfigSchema.optional()
|
|
14065
14338
|
});
|
|
14066
14339
|
var ConfigProviderSetOutputSchema = storedMutationOutput("provider", "updated", ProviderValueSchema);
|
|
14067
|
-
var ConfigProviderRemoveInputSchema =
|
|
14340
|
+
var ConfigProviderRemoveInputSchema = import_zod24.z.strictObject({ name: import_zod24.z.string().min(1), confirm: RemovalConfirmationSchema });
|
|
14068
14341
|
var ConfigProviderRemoveOutputSchema = mutationOutput("provider", "removed");
|
|
14069
|
-
var ConfigRuleAddInputSchema =
|
|
14070
|
-
path:
|
|
14071
|
-
configProfile:
|
|
14072
|
-
identity:
|
|
14342
|
+
var ConfigRuleAddInputSchema = import_zod24.z.strictObject({
|
|
14343
|
+
path: import_zod24.z.string().min(1),
|
|
14344
|
+
configProfile: import_zod24.z.string().min(1).optional(),
|
|
14345
|
+
identity: import_zod24.z.string().min(1).optional()
|
|
14073
14346
|
});
|
|
14074
14347
|
var ConfigRuleAddOutputSchema = storedMutationOutput("rule", "created", DirectoryRuleSchema);
|
|
14075
|
-
var ConfigRuleSetInputSchema =
|
|
14076
|
-
path:
|
|
14077
|
-
configProfile:
|
|
14078
|
-
identity:
|
|
14348
|
+
var ConfigRuleSetInputSchema = import_zod24.z.strictObject({
|
|
14349
|
+
path: import_zod24.z.string().min(1),
|
|
14350
|
+
configProfile: import_zod24.z.union([import_zod24.z.string().min(1), import_zod24.z.literal(false)]).optional(),
|
|
14351
|
+
identity: import_zod24.z.union([import_zod24.z.string().min(1), import_zod24.z.literal(false)]).optional()
|
|
14079
14352
|
});
|
|
14080
14353
|
var ConfigRuleSetOutputSchema = storedMutationOutput("rule", "updated", DirectoryRuleSchema);
|
|
14081
|
-
var ConfigRuleRemoveInputSchema =
|
|
14354
|
+
var ConfigRuleRemoveInputSchema = import_zod24.z.strictObject({ path: import_zod24.z.string().min(1), confirm: RemovalConfirmationSchema });
|
|
14082
14355
|
var ConfigRuleRemoveOutputSchema = mutationOutput("rule", "removed");
|
|
14083
14356
|
|
|
14084
14357
|
// src/frontdoor/configApi.ts
|
|
@@ -14388,43 +14661,43 @@ var import_openapi4 = require("@orpc/openapi");
|
|
|
14388
14661
|
var import_server3 = require("@orpc/server");
|
|
14389
14662
|
|
|
14390
14663
|
// src/frontdoor/eventSchemas.ts
|
|
14391
|
-
var
|
|
14664
|
+
var import_zod25 = require("zod");
|
|
14392
14665
|
var DOOR_EVENT_SOURCE_RC = "rc";
|
|
14393
14666
|
var LAUNCH_EVENT_SOURCE = "launch";
|
|
14394
14667
|
var USAGE_EVENT_SOURCE = "usage";
|
|
14395
14668
|
var DOOR_HEALTH_EVENT_SOURCE = "door";
|
|
14396
14669
|
var QUOTA_EXPIRING_EVENT_SOURCE = "quota-expiring";
|
|
14397
|
-
var DoorEventSchema =
|
|
14398
|
-
source:
|
|
14670
|
+
var DoorEventSchema = import_zod25.z.strictObject({
|
|
14671
|
+
source: import_zod25.z.string().min(1),
|
|
14399
14672
|
/** A positive integer because the backbone's counters start at one and only ever increase. */
|
|
14400
|
-
sequence:
|
|
14401
|
-
payload:
|
|
14673
|
+
sequence: import_zod25.z.number().int().positive(),
|
|
14674
|
+
payload: import_zod25.z.unknown()
|
|
14402
14675
|
});
|
|
14403
|
-
var DoorEventSourceQuerySchema =
|
|
14404
|
-
sources:
|
|
14676
|
+
var DoorEventSourceQuerySchema = import_zod25.z.strictObject({
|
|
14677
|
+
sources: import_zod25.z.array(import_zod25.z.string().min(1)).min(1).optional()
|
|
14405
14678
|
});
|
|
14406
|
-
var LaunchLifecycleEventSchema =
|
|
14407
|
-
kind:
|
|
14408
|
-
pid:
|
|
14409
|
-
startedAt:
|
|
14410
|
-
observedAt:
|
|
14679
|
+
var LaunchLifecycleEventSchema = import_zod25.z.strictObject({
|
|
14680
|
+
kind: import_zod25.z.enum(["registered", "pruned", "ended"]),
|
|
14681
|
+
pid: import_zod25.z.number().int().positive(),
|
|
14682
|
+
startedAt: import_zod25.z.number(),
|
|
14683
|
+
observedAt: import_zod25.z.number()
|
|
14411
14684
|
});
|
|
14412
|
-
var DoorHealthEventSchema =
|
|
14413
|
-
|
|
14414
|
-
|
|
14415
|
-
|
|
14416
|
-
|
|
14417
|
-
|
|
14418
|
-
|
|
14685
|
+
var DoorHealthEventSchema = import_zod25.z.discriminatedUnion("kind", [
|
|
14686
|
+
import_zod25.z.strictObject({ kind: import_zod25.z.literal("generation"), pid: import_zod25.z.number().int().positive(), providerPort: import_zod25.z.number().int().positive(), connectPort: import_zod25.z.number().int().positive(), directPort: import_zod25.z.number().int().positive(), observedAt: import_zod25.z.number() }),
|
|
14687
|
+
import_zod25.z.strictObject({ kind: import_zod25.z.literal("listenerFailed"), pid: import_zod25.z.number().int().positive(), listener: import_zod25.z.enum(["provider", "connect", "direct"]), message: import_zod25.z.string(), observedAt: import_zod25.z.number() }),
|
|
14688
|
+
import_zod25.z.strictObject({ kind: import_zod25.z.literal("binaryTurnover"), pid: import_zod25.z.number().int().positive(), observedAt: import_zod25.z.number() }),
|
|
14689
|
+
import_zod25.z.strictObject({ kind: import_zod25.z.literal("idleShutdown"), pid: import_zod25.z.number().int().positive(), observedAt: import_zod25.z.number() }),
|
|
14690
|
+
import_zod25.z.strictObject({ kind: import_zod25.z.literal("superseded"), pid: import_zod25.z.number().int().positive(), ownerPid: import_zod25.z.number().int().positive(), observedAt: import_zod25.z.number() }),
|
|
14691
|
+
import_zod25.z.strictObject({ kind: import_zod25.z.literal("drained"), pid: import_zod25.z.number().int().positive(), observedAt: import_zod25.z.number() })
|
|
14419
14692
|
]);
|
|
14420
|
-
var QuotaExpiringEventSchema =
|
|
14421
|
-
identity:
|
|
14422
|
-
provider:
|
|
14423
|
-
window:
|
|
14693
|
+
var QuotaExpiringEventSchema = import_zod25.z.strictObject({
|
|
14694
|
+
identity: import_zod25.z.string().min(1),
|
|
14695
|
+
provider: import_zod25.z.string().min(1),
|
|
14696
|
+
window: import_zod25.z.enum(["fiveHour", "sevenDay"]),
|
|
14424
14697
|
/** 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. */
|
|
14425
|
-
utilization:
|
|
14426
|
-
resetsAt:
|
|
14427
|
-
observedAt:
|
|
14698
|
+
utilization: import_zod25.z.number().min(0).max(1),
|
|
14699
|
+
resetsAt: import_zod25.z.iso.datetime(),
|
|
14700
|
+
observedAt: import_zod25.z.number()
|
|
14428
14701
|
});
|
|
14429
14702
|
|
|
14430
14703
|
// src/frontdoor/eventsApi.ts
|
|
@@ -14508,51 +14781,51 @@ init_cliError();
|
|
|
14508
14781
|
|
|
14509
14782
|
// src/frontdoor/launchSchemas.ts
|
|
14510
14783
|
var import_node_path31 = __toESM(require("node:path"), 1);
|
|
14511
|
-
var
|
|
14784
|
+
var import_zod26 = require("zod");
|
|
14512
14785
|
init_claudeVersion();
|
|
14513
14786
|
init_identity();
|
|
14514
|
-
var LaunchResolveInputSchema =
|
|
14515
|
-
path:
|
|
14787
|
+
var LaunchResolveInputSchema = import_zod26.z.strictObject({
|
|
14788
|
+
path: import_zod26.z.string().min(1),
|
|
14516
14789
|
/** `@name`, launch flags, then the arguments for `claude`; empty for a bare launch. */
|
|
14517
|
-
argv:
|
|
14790
|
+
argv: import_zod26.z.readonly(import_zod26.z.array(import_zod26.z.string())).optional(),
|
|
14518
14791
|
/** 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. */
|
|
14519
|
-
env:
|
|
14792
|
+
env: import_zod26.z.record(import_zod26.z.string(), import_zod26.z.string()).optional()
|
|
14520
14793
|
}).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" });
|
|
14521
|
-
var LaunchPoolDecisionSchema =
|
|
14522
|
-
name:
|
|
14523
|
-
reasons:
|
|
14524
|
-
movedOff:
|
|
14794
|
+
var LaunchPoolDecisionSchema = import_zod26.z.strictObject({
|
|
14795
|
+
name: import_zod26.z.string(),
|
|
14796
|
+
reasons: import_zod26.z.readonly(import_zod26.z.array(import_zod26.z.string())),
|
|
14797
|
+
movedOff: import_zod26.z.strictObject({ identity: import_zod26.z.string(), reason: import_zod26.z.string() }).optional()
|
|
14525
14798
|
});
|
|
14526
|
-
var LaunchDecisionSchema =
|
|
14527
|
-
identity:
|
|
14528
|
-
identitySource:
|
|
14799
|
+
var LaunchDecisionSchema = import_zod26.z.strictObject({
|
|
14800
|
+
identity: import_zod26.z.string().optional(),
|
|
14801
|
+
identitySource: import_zod26.z.enum(IDENTITY_DECISION_SOURCES),
|
|
14529
14802
|
pool: LaunchPoolDecisionSchema.optional(),
|
|
14530
|
-
configDirEscapeHatch:
|
|
14531
|
-
configDir:
|
|
14532
|
-
configProfile:
|
|
14533
|
-
configProfileSource:
|
|
14534
|
-
provider:
|
|
14803
|
+
configDirEscapeHatch: import_zod26.z.boolean(),
|
|
14804
|
+
configDir: import_zod26.z.string().optional(),
|
|
14805
|
+
configProfile: import_zod26.z.string().optional(),
|
|
14806
|
+
configProfileSource: import_zod26.z.enum(CONFIG_PROFILE_DECISION_SOURCES),
|
|
14807
|
+
provider: import_zod26.z.string().optional()
|
|
14535
14808
|
});
|
|
14536
|
-
var LaunchFlagsSchema =
|
|
14537
|
-
skipPermissions:
|
|
14538
|
-
remoteControl:
|
|
14539
|
-
headroom:
|
|
14540
|
-
trackUsage:
|
|
14809
|
+
var LaunchFlagsSchema = import_zod26.z.strictObject({
|
|
14810
|
+
skipPermissions: import_zod26.z.boolean(),
|
|
14811
|
+
remoteControl: import_zod26.z.boolean(),
|
|
14812
|
+
headroom: import_zod26.z.boolean(),
|
|
14813
|
+
trackUsage: import_zod26.z.boolean()
|
|
14541
14814
|
});
|
|
14542
|
-
var LaunchResolveOutputSchema =
|
|
14815
|
+
var LaunchResolveOutputSchema = import_zod26.z.strictObject({
|
|
14543
14816
|
decision: LaunchDecisionSchema,
|
|
14544
14817
|
flags: LaunchFlagsSchema,
|
|
14545
|
-
claudeVersion:
|
|
14818
|
+
claudeVersion: import_zod26.z.strictObject({ version: import_zod26.z.string(), source: import_zod26.z.enum(CLAUDE_VERSION_SOURCES) }).optional(),
|
|
14546
14819
|
/** The real `claude` binary the launch would spawn, on the door's host. */
|
|
14547
|
-
bin:
|
|
14820
|
+
bin: import_zod26.z.string(),
|
|
14548
14821
|
/** The arguments the launch would pass it: the tool's own flags, then `CLAUDE_EXTRA_FLAGS`, then the caller's own. */
|
|
14549
|
-
args:
|
|
14822
|
+
args: import_zod26.z.readonly(import_zod26.z.array(import_zod26.z.string())),
|
|
14550
14823
|
/** The credential the launch would authenticate with, by target and source kinds. Absent when none applies. */
|
|
14551
|
-
credential:
|
|
14552
|
-
routing:
|
|
14824
|
+
credential: import_zod26.z.strictObject({ subject: import_zod26.z.enum(["provider", "identity"]), name: import_zod26.z.string(), summary: CredentialSummarySchema }).optional(),
|
|
14825
|
+
routing: import_zod26.z.strictObject({ frontDoor: import_zod26.z.boolean(), headroom: import_zod26.z.boolean() }),
|
|
14553
14826
|
/** The names of the environment variables the launch would set or unset, sorted. Values are not reported. */
|
|
14554
|
-
environment:
|
|
14555
|
-
warnings:
|
|
14827
|
+
environment: import_zod26.z.readonly(import_zod26.z.array(import_zod26.z.string())),
|
|
14828
|
+
warnings: import_zod26.z.readonly(import_zod26.z.array(import_zod26.z.string()))
|
|
14556
14829
|
});
|
|
14557
14830
|
|
|
14558
14831
|
// src/frontdoor/launchApi.ts
|
|
@@ -14588,117 +14861,22 @@ function createLaunchApiRouter(deps) {
|
|
|
14588
14861
|
// src/frontdoor/agentTreesApi.ts
|
|
14589
14862
|
var import_client6 = require("@orpc/client");
|
|
14590
14863
|
var import_openapi7 = require("@orpc/openapi");
|
|
14591
|
-
var
|
|
14592
|
-
|
|
14593
|
-
// src/agents/schema.ts
|
|
14594
|
-
var import_zod25 = require("zod");
|
|
14595
|
-
var AgentMetaSchema = import_zod25.z.looseObject({
|
|
14596
|
-
agentType: import_zod25.z.string(),
|
|
14597
|
-
isFork: import_zod25.z.boolean().optional(),
|
|
14598
|
-
description: import_zod25.z.string().optional(),
|
|
14599
|
-
name: import_zod25.z.string().optional(),
|
|
14600
|
-
toolUseId: import_zod25.z.string().optional(),
|
|
14601
|
-
spawnDepth: import_zod25.z.number().int().nonnegative().optional(),
|
|
14602
|
-
parentAgentId: import_zod25.z.string().optional(),
|
|
14603
|
-
model: import_zod25.z.string().optional(),
|
|
14604
|
-
requestShape: import_zod25.z.string().optional(),
|
|
14605
|
-
requestNonInteractive: import_zod25.z.boolean().optional(),
|
|
14606
|
-
workflowPhase: import_zod25.z.string().optional(),
|
|
14607
|
-
taskKind: import_zod25.z.string().optional(),
|
|
14608
|
-
teamName: import_zod25.z.string().optional(),
|
|
14609
|
-
worktreePath: import_zod25.z.string().optional(),
|
|
14610
|
-
worktreeBranch: import_zod25.z.string().optional(),
|
|
14611
|
-
stoppedByUser: import_zod25.z.boolean().optional()
|
|
14612
|
-
});
|
|
14613
|
-
var AgentKindSchema = import_zod25.z.enum(["subagent", "fork", "workflow-agent", "teammate"]);
|
|
14614
|
-
var AgentNodeSchema = import_zod25.z.lazy(
|
|
14615
|
-
() => import_zod25.z.strictObject({
|
|
14616
|
-
id: import_zod25.z.string(),
|
|
14617
|
-
kind: AgentKindSchema,
|
|
14618
|
-
agentType: import_zod25.z.string(),
|
|
14619
|
-
description: import_zod25.z.string().optional(),
|
|
14620
|
-
name: import_zod25.z.string().optional(),
|
|
14621
|
-
toolUseId: import_zod25.z.string().optional(),
|
|
14622
|
-
spawnDepth: import_zod25.z.number().int().nonnegative().optional(),
|
|
14623
|
-
model: import_zod25.z.string().optional(),
|
|
14624
|
-
background: import_zod25.z.boolean().optional(),
|
|
14625
|
-
workflowRunId: import_zod25.z.string().optional(),
|
|
14626
|
-
workflowPhase: import_zod25.z.string().optional(),
|
|
14627
|
-
teamName: import_zod25.z.string().optional(),
|
|
14628
|
-
stoppedByUser: import_zod25.z.boolean().optional(),
|
|
14629
|
-
transcript: import_zod25.z.string(),
|
|
14630
|
-
children: import_zod25.z.array(AgentNodeSchema)
|
|
14631
|
-
})
|
|
14632
|
-
);
|
|
14633
|
-
var TaskItemSchema = import_zod25.z.strictObject({
|
|
14634
|
-
id: import_zod25.z.string(),
|
|
14635
|
-
subject: import_zod25.z.string(),
|
|
14636
|
-
description: import_zod25.z.string().optional(),
|
|
14637
|
-
status: import_zod25.z.string(),
|
|
14638
|
-
/** What a spinner shows while the task runs. */
|
|
14639
|
-
activeForm: import_zod25.z.string().optional(),
|
|
14640
|
-
/** The teammate or agent name the task is assigned to, as Agent Teams writes it. */
|
|
14641
|
-
owner: import_zod25.z.string().optional(),
|
|
14642
|
-
/** Free-form data the harness attaches to a task, kept as written. */
|
|
14643
|
-
metadata: import_zod25.z.record(import_zod25.z.string(), import_zod25.z.unknown()).optional(),
|
|
14644
|
-
blocks: import_zod25.z.array(import_zod25.z.string()),
|
|
14645
|
-
blockedBy: import_zod25.z.array(import_zod25.z.string()),
|
|
14646
|
-
/** The id of the shared task list this task belongs to (a team's name, or a custom list id), absent for the session's own list. */
|
|
14647
|
-
taskList: import_zod25.z.string().optional()
|
|
14648
|
-
});
|
|
14649
|
-
var WorkflowRunSchema = import_zod25.z.strictObject({
|
|
14650
|
-
runId: import_zod25.z.string(),
|
|
14651
|
-
workflowName: import_zod25.z.string().optional(),
|
|
14652
|
-
status: import_zod25.z.string().optional(),
|
|
14653
|
-
startTime: import_zod25.z.number().optional(),
|
|
14654
|
-
phases: import_zod25.z.array(import_zod25.z.string()),
|
|
14655
|
-
summary: import_zod25.z.string().optional()
|
|
14656
|
-
});
|
|
14657
|
-
var AgentTreeProblemSchema = import_zod25.z.strictObject({
|
|
14658
|
-
/** Relative to the identity's configuration directory. */
|
|
14659
|
-
path: import_zod25.z.string(),
|
|
14660
|
-
reason: import_zod25.z.string()
|
|
14661
|
-
});
|
|
14662
|
-
var SessionSummarySchema = import_zod25.z.strictObject({
|
|
14663
|
-
project: import_zod25.z.string(),
|
|
14664
|
-
sessionId: import_zod25.z.string(),
|
|
14665
|
-
superseded: import_zod25.z.boolean(),
|
|
14666
|
-
/** The directory and transcript stem exactly as on disk, which differs from `sessionId` for a superseded session. */
|
|
14667
|
-
entry: import_zod25.z.string(),
|
|
14668
|
-
agentCount: import_zod25.z.number().int().nonnegative(),
|
|
14669
|
-
workflowRunCount: import_zod25.z.number().int().nonnegative(),
|
|
14670
|
-
/** When the transcript was last written, as an ISO instant; absent when there is no transcript file. */
|
|
14671
|
-
updatedAt: import_zod25.z.iso.datetime().optional(),
|
|
14672
|
-
identities: import_zod25.z.array(import_zod25.z.string())
|
|
14673
|
-
});
|
|
14674
|
-
var SessionAgentTreeSchema = import_zod25.z.strictObject({
|
|
14675
|
-
project: import_zod25.z.string(),
|
|
14676
|
-
sessionId: import_zod25.z.string(),
|
|
14677
|
-
/** True for a session directory a resume superseded (`<session-id>.superseded-<epoch-ms>`). */
|
|
14678
|
-
superseded: import_zod25.z.boolean(),
|
|
14679
|
-
/** The agents the session itself spawned, each with its descendants. */
|
|
14680
|
-
agents: import_zod25.z.array(AgentNodeSchema),
|
|
14681
|
-
tasks: import_zod25.z.array(TaskItemSchema),
|
|
14682
|
-
workflowRuns: import_zod25.z.array(WorkflowRunSchema),
|
|
14683
|
-
problems: import_zod25.z.array(AgentTreeProblemSchema)
|
|
14684
|
-
});
|
|
14685
|
-
|
|
14686
|
-
// src/frontdoor/agentTreesApi.ts
|
|
14864
|
+
var import_zod27 = require("zod");
|
|
14687
14865
|
init_cliError();
|
|
14688
|
-
var AgentTreesListInputSchema =
|
|
14866
|
+
var AgentTreesListInputSchema = import_zod27.z.strictObject({
|
|
14689
14867
|
/** Only this identity's sessions. */
|
|
14690
|
-
identity:
|
|
14868
|
+
identity: import_zod27.z.string().optional(),
|
|
14691
14869
|
/** Include sessions that spawned no agent and ran no workflow. */
|
|
14692
|
-
all:
|
|
14870
|
+
all: import_zod27.z.boolean().optional()
|
|
14693
14871
|
});
|
|
14694
|
-
var AgentTreesListOutputSchema =
|
|
14695
|
-
var AgentTreesShowInputSchema =
|
|
14872
|
+
var AgentTreesListOutputSchema = import_zod27.z.array(SessionSummarySchema);
|
|
14873
|
+
var AgentTreesShowInputSchema = import_zod27.z.strictObject({
|
|
14696
14874
|
/** A session id, or an unambiguous prefix of one. */
|
|
14697
|
-
session:
|
|
14875
|
+
session: import_zod27.z.string().min(1),
|
|
14698
14876
|
/** Look only in this identity. */
|
|
14699
|
-
identity:
|
|
14877
|
+
identity: import_zod27.z.string().optional()
|
|
14700
14878
|
});
|
|
14701
|
-
var AgentTreesShowOutputSchema =
|
|
14879
|
+
var AgentTreesShowOutputSchema = import_zod27.z.strictObject({ identities: import_zod27.z.array(import_zod27.z.string()), ...MergedAgentTreeSchema.shape });
|
|
14702
14880
|
function asBadRequest(error) {
|
|
14703
14881
|
if (error instanceof CliError) {
|
|
14704
14882
|
throw new import_client6.ORPCError("BAD_REQUEST", { message: error.message });
|
|
@@ -14729,14 +14907,14 @@ function createAgentTreesApiRouter(deps) {
|
|
|
14729
14907
|
(0, import_openapi7.openapi)({
|
|
14730
14908
|
method: "POST",
|
|
14731
14909
|
path: "/rest/agent-trees/show",
|
|
14732
|
-
summary: "Show one session's agent tree, task list and workflow runs",
|
|
14910
|
+
summary: "Show one session's agent tree, task list and workflow runs, with the live Remote Control tasks merged in",
|
|
14733
14911
|
tags: [SESSION_HISTORY_TAG],
|
|
14734
14912
|
spec: (current) => ({ ...current, [READ_ONLY_OPERATION_EXTENSION]: true })
|
|
14735
14913
|
})
|
|
14736
14914
|
).input(AgentTreesShowInputSchema).output(AgentTreesShowOutputSchema).handler(({ input }) => {
|
|
14737
14915
|
try {
|
|
14738
14916
|
const view = deps.sessionShow(input.session, input.identity);
|
|
14739
|
-
return { identities: [...view.identities], ...view.tree };
|
|
14917
|
+
return { identities: [...view.identities], ...mergeLiveTasks(view.tree, deps.liveTasks()) };
|
|
14740
14918
|
} catch (error) {
|
|
14741
14919
|
return asBadRequest(error);
|
|
14742
14920
|
}
|
|
@@ -15144,15 +15322,15 @@ function createQuotaExpiringPublisher(hub, deps) {
|
|
|
15144
15322
|
|
|
15145
15323
|
// src/frontdoor/rcLiveUsage.ts
|
|
15146
15324
|
var RC_RATE_LIMIT_EVENT_TYPE = "rate_limit_event";
|
|
15147
|
-
function
|
|
15325
|
+
function isRecord6(value) {
|
|
15148
15326
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
15149
15327
|
}
|
|
15150
15328
|
function rcRateLimitInfoOf(event) {
|
|
15151
15329
|
const payload = event.envelope.payload;
|
|
15152
|
-
if (!
|
|
15330
|
+
if (!isRecord6(payload) || payload.type !== RC_RATE_LIMIT_EVENT_TYPE) {
|
|
15153
15331
|
return void 0;
|
|
15154
15332
|
}
|
|
15155
|
-
if (!
|
|
15333
|
+
if (!isRecord6(payload.rate_limit_info)) {
|
|
15156
15334
|
return void 0;
|
|
15157
15335
|
}
|
|
15158
15336
|
const parsed = RcRateLimitInfoSchema.safeParse(payload.rate_limit_info);
|
|
@@ -15240,7 +15418,7 @@ function createSseParser() {
|
|
|
15240
15418
|
}
|
|
15241
15419
|
};
|
|
15242
15420
|
}
|
|
15243
|
-
function
|
|
15421
|
+
function isRecord7(value) {
|
|
15244
15422
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
15245
15423
|
}
|
|
15246
15424
|
function sequenceNumOf(value) {
|
|
@@ -15262,7 +15440,7 @@ function parseRcStreamEnvelope(parsed) {
|
|
|
15262
15440
|
} catch {
|
|
15263
15441
|
return void 0;
|
|
15264
15442
|
}
|
|
15265
|
-
if (!
|
|
15443
|
+
if (!isRecord7(data)) {
|
|
15266
15444
|
return void 0;
|
|
15267
15445
|
}
|
|
15268
15446
|
const eventType = data.event_type;
|
|
@@ -15503,7 +15681,7 @@ init_capability();
|
|
|
15503
15681
|
// src/frontdoor/rcSelfHostEndpoints.ts
|
|
15504
15682
|
var RC_SOURCE_WORKER = "worker";
|
|
15505
15683
|
var RC_SOURCE_CLIENT = "client";
|
|
15506
|
-
function
|
|
15684
|
+
function isRecord8(value) {
|
|
15507
15685
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
15508
15686
|
}
|
|
15509
15687
|
function parseJsonObject2(body) {
|
|
@@ -15513,7 +15691,7 @@ function parseJsonObject2(body) {
|
|
|
15513
15691
|
} catch {
|
|
15514
15692
|
return void 0;
|
|
15515
15693
|
}
|
|
15516
|
-
return
|
|
15694
|
+
return isRecord8(parsed) ? parsed : void 0;
|
|
15517
15695
|
}
|
|
15518
15696
|
function nonEmptyString2(record, field) {
|
|
15519
15697
|
const value = record === void 0 ? void 0 : record[field];
|
|
@@ -15587,7 +15765,7 @@ async function serveRcClientChannels(ctx, tail, method, maxBatchEvents) {
|
|
|
15587
15765
|
}
|
|
15588
15766
|
const results = [];
|
|
15589
15767
|
for (const event of events) {
|
|
15590
|
-
if (!
|
|
15768
|
+
if (!isRecord8(event) || !isRecord8(event.payload)) {
|
|
15591
15769
|
await ctx.answerJson(response, HTTP_STATUS.badRequest, { type: "error", error: { type: "invalid_request_error", message: "every event in a teleport write is an object carrying one payload object" } });
|
|
15592
15770
|
return true;
|
|
15593
15771
|
}
|
|
@@ -15687,7 +15865,7 @@ async function serveRcCompatSessions(ctx, pathname, compatPath) {
|
|
|
15687
15865
|
// src/frontdoor/rcSelfHostConversations.ts
|
|
15688
15866
|
var RC_CONVERSATIONS_PATH_PREFIX = "/v1/code/conversations";
|
|
15689
15867
|
var RC_CONVERSATION_ID_PREFIX = "conv_";
|
|
15690
|
-
function
|
|
15868
|
+
function isRecord9(value) {
|
|
15691
15869
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
15692
15870
|
}
|
|
15693
15871
|
function parseJsonObject3(body) {
|
|
@@ -15697,7 +15875,7 @@ function parseJsonObject3(body) {
|
|
|
15697
15875
|
} catch {
|
|
15698
15876
|
return void 0;
|
|
15699
15877
|
}
|
|
15700
|
-
return
|
|
15878
|
+
return isRecord9(parsed) ? parsed : void 0;
|
|
15701
15879
|
}
|
|
15702
15880
|
function nonEmptyString3(record, field) {
|
|
15703
15881
|
const value = record === void 0 ? void 0 : record[field];
|
|
@@ -15751,7 +15929,7 @@ async function serveRcConversations(ctx, pathname, method) {
|
|
|
15751
15929
|
}
|
|
15752
15930
|
const results = [];
|
|
15753
15931
|
for (const event of events) {
|
|
15754
|
-
if (!
|
|
15932
|
+
if (!isRecord9(event) || !isRecord9(event.payload)) {
|
|
15755
15933
|
await ctx.answerJson(response, HTTP_STATUS.badRequest, { type: "error", error: { type: "invalid_request_error", message: "every event in a write is an object carrying one payload object" } });
|
|
15756
15934
|
return;
|
|
15757
15935
|
}
|
|
@@ -15783,7 +15961,7 @@ var RC_SELF_HOST_SCOPE_LIST = ["user:profile", "user:inference", "user:sessions:
|
|
|
15783
15961
|
var RC_SELF_HOST_OAUTH_TOKEN_TTL_SECONDS = 3600;
|
|
15784
15962
|
var MS_PER_SECOND5 = 1e3;
|
|
15785
15963
|
var HTTP_SERVICE_UNAVAILABLE = 503;
|
|
15786
|
-
function
|
|
15964
|
+
function isRecord10(value) {
|
|
15787
15965
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
15788
15966
|
}
|
|
15789
15967
|
function parseJsonObject4(body) {
|
|
@@ -15793,7 +15971,7 @@ function parseJsonObject4(body) {
|
|
|
15793
15971
|
} catch {
|
|
15794
15972
|
return void 0;
|
|
15795
15973
|
}
|
|
15796
|
-
return
|
|
15974
|
+
return isRecord10(parsed) ? parsed : void 0;
|
|
15797
15975
|
}
|
|
15798
15976
|
function growthBookFeatures() {
|
|
15799
15977
|
return {
|
|
@@ -16147,7 +16325,7 @@ var RC_SELF_HOST_WORKER_EPOCH = 1;
|
|
|
16147
16325
|
var RC_STREAM_EVENT_NAME2 = "client_event";
|
|
16148
16326
|
var CONFLICT_REASON_HEADER2 = "x-ccr-conflict-reason";
|
|
16149
16327
|
var CONFLICT_REASON_EPOCH_STALE = "epoch_stale";
|
|
16150
|
-
function
|
|
16328
|
+
function isRecord11(value) {
|
|
16151
16329
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
16152
16330
|
}
|
|
16153
16331
|
function isWebSearchRefusal(value) {
|
|
@@ -16231,7 +16409,7 @@ function parseJsonObject5(body) {
|
|
|
16231
16409
|
} catch {
|
|
16232
16410
|
return void 0;
|
|
16233
16411
|
}
|
|
16234
|
-
return
|
|
16412
|
+
return isRecord11(parsed) ? parsed : void 0;
|
|
16235
16413
|
}
|
|
16236
16414
|
function mintWorkerJwt(randomToken, issuedAt) {
|
|
16237
16415
|
const encode = (value) => Buffer.from(JSON.stringify(value), "utf8").toString("base64url");
|
|
@@ -16491,7 +16669,7 @@ data: ${JSON.stringify(envelope)}
|
|
|
16491
16669
|
if (status !== void 0) {
|
|
16492
16670
|
session.workerStatus = status;
|
|
16493
16671
|
}
|
|
16494
|
-
if (
|
|
16672
|
+
if (isRecord11(body?.external_metadata)) {
|
|
16495
16673
|
session.externalMetadata = body.external_metadata;
|
|
16496
16674
|
}
|
|
16497
16675
|
await answerJson2(response, HTTP_STATUS.ok, {});
|
|
@@ -16521,7 +16699,7 @@ data: ${JSON.stringify(envelope)}
|
|
|
16521
16699
|
}
|
|
16522
16700
|
const results = [];
|
|
16523
16701
|
for (const event of events) {
|
|
16524
|
-
if (!
|
|
16702
|
+
if (!isRecord11(event) || !isRecord11(event.payload)) {
|
|
16525
16703
|
await answerJson2(response, HTTP_STATUS.badRequest, { type: "error", error: { type: "invalid_request_error", message: "every event in a batch is an object carrying one payload object" } });
|
|
16526
16704
|
return;
|
|
16527
16705
|
}
|
|
@@ -16554,7 +16732,7 @@ data: ${JSON.stringify(envelope)}
|
|
|
16554
16732
|
return;
|
|
16555
16733
|
}
|
|
16556
16734
|
for (const event of events) {
|
|
16557
|
-
if (
|
|
16735
|
+
if (isRecord11(event)) {
|
|
16558
16736
|
session.internalEvents.push({ eventId: deps.newUuid(), body: event });
|
|
16559
16737
|
}
|
|
16560
16738
|
}
|
|
@@ -16650,7 +16828,7 @@ data: ${JSON.stringify(envelope)}
|
|
|
16650
16828
|
}
|
|
16651
16829
|
const results = [];
|
|
16652
16830
|
for (const event of events) {
|
|
16653
|
-
if (!
|
|
16831
|
+
if (!isRecord11(event) || !isRecord11(event.payload)) {
|
|
16654
16832
|
await answerJson2(response, HTTP_STATUS.badRequest, { type: "error", error: { type: "invalid_request_error", message: "every event in a write is an object carrying one payload object" } });
|
|
16655
16833
|
return;
|
|
16656
16834
|
}
|
|
@@ -16787,7 +16965,7 @@ var RC_SELF_HOST_RECORD_DIR = "rc-selfhost";
|
|
|
16787
16965
|
var RC_SELF_HOST_RECORD_FILE = "credential.json";
|
|
16788
16966
|
var SELF_HOST_EMAIL = "selfhost@agent-shim.invalid";
|
|
16789
16967
|
var SELF_HOST_SUBSCRIPTION_TYPE = "max";
|
|
16790
|
-
function
|
|
16968
|
+
function isRecord12(value) {
|
|
16791
16969
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
16792
16970
|
}
|
|
16793
16971
|
function readJsonObject(fs12, file) {
|
|
@@ -16801,7 +16979,7 @@ function readJsonObject(fs12, file) {
|
|
|
16801
16979
|
} catch {
|
|
16802
16980
|
return void 0;
|
|
16803
16981
|
}
|
|
16804
|
-
return
|
|
16982
|
+
return isRecord12(parsed) ? parsed : void 0;
|
|
16805
16983
|
}
|
|
16806
16984
|
function readRcSelfHostRecord(fs12, frontdoorDir) {
|
|
16807
16985
|
const parsed = readJsonObject(fs12, import_node_path32.default.join(frontdoorDir, RC_SELF_HOST_RECORD_DIR, RC_SELF_HOST_RECORD_FILE));
|
|
@@ -16825,7 +17003,7 @@ function mintRcSelfHostCredential(deps) {
|
|
|
16825
17003
|
const recordFile = import_node_path32.default.join(recordDir, RC_SELF_HOST_RECORD_FILE);
|
|
16826
17004
|
const previousRecord = readRcSelfHostRecord(deps.fs, deps.frontdoorDir);
|
|
16827
17005
|
const existingCredentials = readJsonObject(deps.fs, credentialsFile);
|
|
16828
|
-
const existingOauth =
|
|
17006
|
+
const existingOauth = isRecord12(existingCredentials?.claudeAiOauth) ? existingCredentials.claudeAiOauth : void 0;
|
|
16829
17007
|
const existingToken = typeof existingOauth?.accessToken === "string" && existingOauth.accessToken !== "" ? existingOauth.accessToken : void 0;
|
|
16830
17008
|
const existingIsOwn = existingToken !== void 0 && previousRecord?.accessToken === existingToken;
|
|
16831
17009
|
if (existingToken !== void 0 && !existingIsOwn && !deps.force) {
|
|
@@ -16842,7 +17020,7 @@ function mintRcSelfHostCredential(deps) {
|
|
|
16842
17020
|
deps.fs.writeFilePrivate(credentialsFile, `${JSON.stringify({ ...existingCredentials, claudeAiOauth: { accessToken, refreshToken, expiresAt: null, scopes: [...RC_SELF_HOST_SCOPE_LIST], subscriptionType: SELF_HOST_SUBSCRIPTION_TYPE, rateLimitTier: null } }, null, 2)}
|
|
16843
17021
|
`);
|
|
16844
17022
|
const claudeJson = readJsonObject(deps.fs, claudeJsonFile) ?? {};
|
|
16845
|
-
const existingBlock = (value) =>
|
|
17023
|
+
const existingBlock = (value) => isRecord12(value) ? value : {};
|
|
16846
17024
|
deps.fs.writeFilePrivate(claudeJsonFile, `${JSON.stringify({
|
|
16847
17025
|
...claudeJson,
|
|
16848
17026
|
oauthAccount: {
|
|
@@ -16881,7 +17059,7 @@ init_poolPick();
|
|
|
16881
17059
|
|
|
16882
17060
|
// src/agents/read.ts
|
|
16883
17061
|
var import_node_path33 = __toESM(require("node:path"), 1);
|
|
16884
|
-
var
|
|
17062
|
+
var import_zod28 = require("zod");
|
|
16885
17063
|
var PROJECTS_DIR = "projects";
|
|
16886
17064
|
var TASKS_DIR = "tasks";
|
|
16887
17065
|
var SUBAGENTS_DIR = "subagents";
|
|
@@ -17000,14 +17178,14 @@ function parseJson2(text) {
|
|
|
17000
17178
|
return void 0;
|
|
17001
17179
|
}
|
|
17002
17180
|
}
|
|
17003
|
-
var TaskFileSchema =
|
|
17004
|
-
var WorkflowRunFileSchema =
|
|
17005
|
-
runId:
|
|
17006
|
-
workflowName:
|
|
17007
|
-
status:
|
|
17008
|
-
startTime:
|
|
17009
|
-
phases:
|
|
17010
|
-
summary:
|
|
17181
|
+
var TaskFileSchema = import_zod28.z.object({ ...TaskItemSchema.omit({ taskList: true }).shape, blocks: import_zod28.z.array(import_zod28.z.string()).default([]), blockedBy: import_zod28.z.array(import_zod28.z.string()).default([]) });
|
|
17182
|
+
var WorkflowRunFileSchema = import_zod28.z.object({
|
|
17183
|
+
runId: import_zod28.z.string(),
|
|
17184
|
+
workflowName: import_zod28.z.string().optional(),
|
|
17185
|
+
status: import_zod28.z.string().optional(),
|
|
17186
|
+
startTime: import_zod28.z.number().optional(),
|
|
17187
|
+
phases: import_zod28.z.array(import_zod28.z.object({ title: import_zod28.z.string() })).default([]),
|
|
17188
|
+
summary: import_zod28.z.string().optional()
|
|
17011
17189
|
});
|
|
17012
17190
|
function summariseSession(fs12, configDir, ref) {
|
|
17013
17191
|
const sessionRelative = import_node_path33.default.join(PROJECTS_DIR, ref.project, ref.entry);
|
|
@@ -17478,11 +17656,15 @@ init_ownCli();
|
|
|
17478
17656
|
InvalidIdentityNameError,
|
|
17479
17657
|
InvalidProviderNameError,
|
|
17480
17658
|
LAUNCH_EVENT_SOURCE,
|
|
17659
|
+
LIVE_TASK_CAP,
|
|
17481
17660
|
LaunchLifecycleEventSchema,
|
|
17482
17661
|
LaunchRefusedError,
|
|
17483
17662
|
LaunchResolveInputSchema,
|
|
17484
17663
|
LaunchResolveOutputSchema,
|
|
17485
17664
|
LegacyProviderFileError,
|
|
17665
|
+
LiveTaskSchema,
|
|
17666
|
+
MergedAgentNodeSchema,
|
|
17667
|
+
MergedAgentTreeSchema,
|
|
17486
17668
|
OWN_CLI_FILE_NAME,
|
|
17487
17669
|
PROMPT_CACHE_TTL_MS,
|
|
17488
17670
|
PlanClassSchema,
|
|
@@ -17550,6 +17732,7 @@ init_ownCli();
|
|
|
17550
17732
|
addProvider,
|
|
17551
17733
|
agentShimCliPath,
|
|
17552
17734
|
answerRcControlRequest,
|
|
17735
|
+
applyAgentTaskEvent,
|
|
17553
17736
|
authenticateRcSessionMcpServer,
|
|
17554
17737
|
buildEntryFacts,
|
|
17555
17738
|
buildLayoutPaths,
|
|
@@ -17651,6 +17834,7 @@ init_ownCli();
|
|
|
17651
17834
|
listUsageSnapshots,
|
|
17652
17835
|
locateSession,
|
|
17653
17836
|
matchBranch,
|
|
17837
|
+
mergeLiveTasks,
|
|
17654
17838
|
mintLeaf,
|
|
17655
17839
|
mintRcSelfHostCredential,
|
|
17656
17840
|
observingRoutedRoute,
|