claude-use 9.17.0 → 9.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/cli.cjs +1089 -761
- package/dist/index.cjs +1235 -836
- package/dist/index.mjs +1197 -816
- package/dist/types/index.d.ts +569 -133
- 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.0",
|
|
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
|
});
|
|
@@ -4817,22 +4817,25 @@ function rankPool(input) {
|
|
|
4817
4817
|
return { ...candidate, feasible: true };
|
|
4818
4818
|
}
|
|
4819
4819
|
const drySpots = [];
|
|
4820
|
+
const dryAfterMs = [];
|
|
4820
4821
|
if (fiveHour !== void 0 && pace !== void 0) {
|
|
4821
4822
|
const runsDryInMs = fiveHour.remaining / pace;
|
|
4822
4823
|
if (runsDryInMs < fiveHour.untilResetMs) {
|
|
4824
|
+
dryAfterMs.push(runsDryInMs);
|
|
4823
4825
|
drySpots.push(`5h window would run dry in ${formatAge(runsDryInMs)}, before it resets in ${formatAge(fiveHour.untilResetMs)}`);
|
|
4824
4826
|
}
|
|
4825
4827
|
}
|
|
4826
4828
|
if (sevenDay !== void 0 && sevenDayBurn !== void 0) {
|
|
4827
4829
|
const runsDryInMs = sevenDay.remaining / sevenDayBurn;
|
|
4828
4830
|
if (runsDryInMs < sevenDay.untilResetMs) {
|
|
4831
|
+
dryAfterMs.push(runsDryInMs);
|
|
4829
4832
|
drySpots.push(`7d window would run dry in ${formatAge(runsDryInMs)}, before it resets in ${formatAge(sevenDay.untilResetMs)}`);
|
|
4830
4833
|
}
|
|
4831
4834
|
}
|
|
4832
4835
|
if (drySpots.length === 0) {
|
|
4833
4836
|
return { ...candidate, feasible: true };
|
|
4834
4837
|
}
|
|
4835
|
-
return { ...candidate, feasible: false, reasons: [...drySpots, ...candidate.reasons] };
|
|
4838
|
+
return { ...candidate, feasible: false, runsDryAtMs: nowMs + Math.min(...dryAfterMs), reasons: [...drySpots, ...candidate.reasons] };
|
|
4836
4839
|
});
|
|
4837
4840
|
const ordered = input.preference === "listed" ? [...candidates] : [...candidates].sort(
|
|
4838
4841
|
(left, right) => CLASS_ORDER[left.class] - CLASS_ORDER[right.class] || Number(left.policyDemoted ?? false) - Number(right.policyDemoted ?? false) || Number(right.feasible) - Number(left.feasible) || (right.headroom ?? 1) - (left.headroom ?? 1) || (right.score ?? 0) - (left.score ?? 0) || left.identity.localeCompare(right.identity)
|
|
@@ -4854,11 +4857,13 @@ function rankPool(input) {
|
|
|
4854
4857
|
const pick = ordered.find((candidate) => candidate.class !== "ineligible");
|
|
4855
4858
|
const returns = ordered.flatMap((candidate) => candidate.blockedUntilMs === void 0 ? [] : [{ identity: candidate.identity, atMs: candidate.blockedUntilMs }]);
|
|
4856
4859
|
const earliestReturn = returns.length === 0 ? void 0 : returns.reduce((soonest, entry) => entry.atMs < soonest.atMs ? entry : soonest);
|
|
4860
|
+
const holdForReturn = pick?.runsDryAtMs === void 0 ? void 0 : returns.filter((entry) => entry.atMs < (pick.runsDryAtMs ?? 0)).reduce((soonest, entry) => soonest === void 0 || entry.atMs < soonest.atMs ? entry : soonest, void 0);
|
|
4857
4861
|
return {
|
|
4858
4862
|
candidates: ordered,
|
|
4859
4863
|
...pick === void 0 ? { ...earliestReturn === void 0 ? {} : { earliestReturn } } : { pick },
|
|
4860
4864
|
...movedOff === void 0 || pick === void 0 ? {} : { movedOff },
|
|
4861
|
-
...pick?.planReturnsAtMs === void 0 ? {} : { planReturn: { identity: pick.identity, atMs: pick.planReturnsAtMs } }
|
|
4865
|
+
...pick?.planReturnsAtMs === void 0 ? {} : { planReturn: { identity: pick.identity, atMs: pick.planReturnsAtMs } },
|
|
4866
|
+
...holdForReturn === void 0 ? {} : { holdForReturn }
|
|
4862
4867
|
};
|
|
4863
4868
|
}
|
|
4864
4869
|
var MS_PER_SECOND4, MS_PER_HOUR2, HOURS_PER_DAY2, FIVE_HOURS, PROMPT_CACHE_TTL_HOURS, PERCENT, SEVEN_DAYS, FIVE_HOUR_WINDOW_MS, SEVEN_DAY_WINDOW_MS, PROMPT_CACHE_TTL_MS, CLASS_ORDER;
|
|
@@ -5253,12 +5258,12 @@ function recordStickyPick(fs12, picksFile, directory, identity, nowMs) {
|
|
|
5253
5258
|
fs12.writeFilePrivate(picksFile, `${JSON.stringify(next, null, 2)}
|
|
5254
5259
|
`);
|
|
5255
5260
|
}
|
|
5256
|
-
var import_node_path20,
|
|
5261
|
+
var import_node_path20, import_zod13, PoolGraphError, SCHEMA_VERSION, PickEntrySchema, PicksFileSchema;
|
|
5257
5262
|
var init_poolPick = __esm({
|
|
5258
5263
|
"src/usage/poolPick.ts"() {
|
|
5259
5264
|
"use strict";
|
|
5260
5265
|
import_node_path20 = __toESM(require("node:path"), 1);
|
|
5261
|
-
|
|
5266
|
+
import_zod13 = require("zod");
|
|
5262
5267
|
init_cliError();
|
|
5263
5268
|
init_identity();
|
|
5264
5269
|
init_schema();
|
|
@@ -5274,10 +5279,10 @@ var init_poolPick = __esm({
|
|
|
5274
5279
|
}
|
|
5275
5280
|
};
|
|
5276
5281
|
SCHEMA_VERSION = 1;
|
|
5277
|
-
PickEntrySchema =
|
|
5278
|
-
PicksFileSchema =
|
|
5279
|
-
schemaVersion:
|
|
5280
|
-
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)
|
|
5281
5286
|
});
|
|
5282
5287
|
}
|
|
5283
5288
|
});
|
|
@@ -5417,17 +5422,17 @@ function formatCachedCredentialState(state) {
|
|
|
5417
5422
|
}
|
|
5418
5423
|
return state.status === "fresh" ? `${age}, expires in ${formatAge(state.expiresInMs)}` : `${age}, expired ${formatAge(-state.expiresInMs)} ago`;
|
|
5419
5424
|
}
|
|
5420
|
-
var
|
|
5425
|
+
var import_zod14, MS_PER_UNIT, CachedCredentialSchema;
|
|
5421
5426
|
var init_credentialCache = __esm({
|
|
5422
5427
|
"src/credentialCache.ts"() {
|
|
5423
5428
|
"use strict";
|
|
5424
|
-
|
|
5429
|
+
import_zod14 = require("zod");
|
|
5425
5430
|
init_schema();
|
|
5426
5431
|
init_preflight();
|
|
5427
5432
|
MS_PER_UNIT = { s: 1e3, m: 6e4, h: 36e5, d: 864e5 };
|
|
5428
|
-
CachedCredentialSchema =
|
|
5429
|
-
token:
|
|
5430
|
-
fetchedAt:
|
|
5433
|
+
CachedCredentialSchema = import_zod14.z.strictObject({
|
|
5434
|
+
token: import_zod14.z.string().min(1),
|
|
5435
|
+
fetchedAt: import_zod14.z.number().int().nonnegative(),
|
|
5431
5436
|
source: CredentialSourceSchema
|
|
5432
5437
|
});
|
|
5433
5438
|
}
|
|
@@ -5698,14 +5703,14 @@ function providerJsonPath(paths, name) {
|
|
|
5698
5703
|
function providerExists(paths, name) {
|
|
5699
5704
|
return import_node_fs6.default.existsSync(providerJsonPath(paths, name));
|
|
5700
5705
|
}
|
|
5701
|
-
function
|
|
5706
|
+
function isRecord5(value) {
|
|
5702
5707
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5703
5708
|
}
|
|
5704
5709
|
function legacyProviderConversion(raw) {
|
|
5705
|
-
if (!
|
|
5710
|
+
if (!isRecord5(raw) || "credential" in raw) {
|
|
5706
5711
|
return void 0;
|
|
5707
5712
|
}
|
|
5708
|
-
const env =
|
|
5713
|
+
const env = isRecord5(raw.env) ? raw.env : void 0;
|
|
5709
5714
|
const legacyEnvKeys = env === void 0 ? [] : Object.keys(env).filter((key) => LEGACY_ENV_CREDENTIAL_KEYS.includes(key));
|
|
5710
5715
|
const fields = [...LEGACY_PROVIDER_FIELDS.filter((field) => field in raw), ...legacyEnvKeys.map((key) => `env.${key}`)];
|
|
5711
5716
|
if (fields.length === 0) {
|
|
@@ -6168,21 +6173,21 @@ function findPathShadow(params) {
|
|
|
6168
6173
|
}
|
|
6169
6174
|
return params.pathDirs.some((dir) => import_node_path26.default.resolve(dir) === resolvedTargetDir) ? { status: "ok" } : { status: "not-on-path" };
|
|
6170
6175
|
}
|
|
6171
|
-
var import_node_fs7, import_node_path26,
|
|
6176
|
+
var import_node_fs7, import_node_path26, import_zod19, ClaudeShimStateSchema, nodeLinkFs;
|
|
6172
6177
|
var init_claudeShim = __esm({
|
|
6173
6178
|
"src/claudeShim.ts"() {
|
|
6174
6179
|
"use strict";
|
|
6175
6180
|
import_node_fs7 = __toESM(require("node:fs"), 1);
|
|
6176
6181
|
import_node_path26 = __toESM(require("node:path"), 1);
|
|
6177
|
-
|
|
6182
|
+
import_zod19 = require("zod");
|
|
6178
6183
|
init_commandDeps();
|
|
6179
6184
|
init_store();
|
|
6180
6185
|
init_realPorts();
|
|
6181
6186
|
init_cliError();
|
|
6182
|
-
ClaudeShimStateSchema =
|
|
6183
|
-
targetPath:
|
|
6184
|
-
method:
|
|
6185
|
-
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()
|
|
6186
6191
|
});
|
|
6187
6192
|
nodeLinkFs = { link: import_node_fs7.default.linkSync, copyFile: import_node_fs7.default.copyFileSync, chmod: import_node_fs7.default.chmodSync };
|
|
6188
6193
|
}
|
|
@@ -6687,7 +6692,7 @@ function buildEnv(params) {
|
|
|
6687
6692
|
const parentCustomHeaders = params.baseEnv.ANTHROPIC_CUSTOM_HEADERS;
|
|
6688
6693
|
let providerCustomHeaders;
|
|
6689
6694
|
if (!params.configDirEscapeHatch && params.resolvedIdentityName !== void 0) {
|
|
6690
|
-
env.CLAUDE_CONFIG_DIR =
|
|
6695
|
+
env.CLAUDE_CONFIG_DIR = import_node_path35.default.join(params.identitiesDir, params.resolvedIdentityName);
|
|
6691
6696
|
}
|
|
6692
6697
|
if (params.provider !== void 0) {
|
|
6693
6698
|
const providerEnv = params.provider.definition.env ?? {};
|
|
@@ -6731,11 +6736,11 @@ function buildEnv(params) {
|
|
|
6731
6736
|
}
|
|
6732
6737
|
return env;
|
|
6733
6738
|
}
|
|
6734
|
-
var
|
|
6739
|
+
var import_node_path35, LOOPBACK_HOSTS;
|
|
6735
6740
|
var init_flags = __esm({
|
|
6736
6741
|
"src/launcher/flags.ts"() {
|
|
6737
6742
|
"use strict";
|
|
6738
|
-
|
|
6743
|
+
import_node_path35 = __toESM(require("node:path"), 1);
|
|
6739
6744
|
init_envBool();
|
|
6740
6745
|
init_credential();
|
|
6741
6746
|
init_headers();
|
|
@@ -6809,12 +6814,17 @@ function resolvePoolLaunch(params) {
|
|
|
6809
6814
|
if (graph.ranking.candidates.length === 0) {
|
|
6810
6815
|
return { ok: false, message: `agent-shim: no member of pool "${poolName}" is an existing identity.` };
|
|
6811
6816
|
}
|
|
6812
|
-
const { pick, earliestReturn, movedOff, planReturn } = graph.ranking;
|
|
6817
|
+
const { pick, earliestReturn, movedOff, planReturn, holdForReturn } = graph.ranking;
|
|
6813
6818
|
if (pick !== void 0 && params.wait && planReturn !== void 0) {
|
|
6814
6819
|
log.info(`agent-shim: pool "${poolName}" would continue ${planReturn.identity} on extra usage; waiting until ${new Date(planReturn.atMs).toISOString()} for its plan window`);
|
|
6815
6820
|
params.sleep(Math.max(planReturn.atMs - nowMs, 0));
|
|
6816
6821
|
continue;
|
|
6817
6822
|
}
|
|
6823
|
+
if (pick !== void 0 && params.wait && holdForReturn !== void 0) {
|
|
6824
|
+
log.info(`agent-shim: pool "${poolName}" pick ${pick.identity} would run dry before its window resets; waiting until ${new Date(holdForReturn.atMs).toISOString()} for ${holdForReturn.identity}`);
|
|
6825
|
+
params.sleep(Math.max(holdForReturn.atMs - nowMs, 0));
|
|
6826
|
+
continue;
|
|
6827
|
+
}
|
|
6818
6828
|
if (pick !== void 0) {
|
|
6819
6829
|
if (params.recordPick) {
|
|
6820
6830
|
recordStickyPick(params.usageFs, params.paths.usagePicksFile, params.cwd, pick.identity, nowMs);
|
|
@@ -7063,7 +7073,7 @@ function decideLaunch(params, readOnly) {
|
|
|
7063
7073
|
identityDefaultConfigProfile: loadedIdentity?.config.defaultConfigProfile,
|
|
7064
7074
|
globalDefaultConfigProfile: params.globalDefaultConfigProfile
|
|
7065
7075
|
});
|
|
7066
|
-
if (configProfileDecision.name !== void 0 && params.allowMissingConfigProfile !== true && fs12.readConfigFile(
|
|
7076
|
+
if (configProfileDecision.name !== void 0 && params.allowMissingConfigProfile !== true && fs12.readConfigFile(import_node_path36.default.join(paths.configProfilesDir, `${configProfileDecision.name}.json`)) === void 0) {
|
|
7067
7077
|
log.error(
|
|
7068
7078
|
`agent-shim: no configuration profile named "${configProfileDecision.name}" (selected via ${configProfileDecision.source}). Run \`agent-shim profile add ${configProfileDecision.name}\` first.`
|
|
7069
7079
|
);
|
|
@@ -7175,7 +7185,7 @@ function decideLaunch(params, readOnly) {
|
|
|
7175
7185
|
extraFlags: splitExtraFlags(env.CLAUDE_EXTRA_FLAGS),
|
|
7176
7186
|
passthrough: parsedArgv.rest
|
|
7177
7187
|
});
|
|
7178
|
-
const configDir = configDirEscapeHatchApplies || identityDecision.name === void 0 ? env.CLAUDE_CONFIG_DIR :
|
|
7188
|
+
const configDir = configDirEscapeHatchApplies || identityDecision.name === void 0 ? env.CLAUDE_CONFIG_DIR : import_node_path36.default.join(paths.identitiesDir, identityDecision.name);
|
|
7179
7189
|
const decision = {
|
|
7180
7190
|
identitySource: identityDecision.source,
|
|
7181
7191
|
configDirEscapeHatch: identityDecision.configDirEscapeHatch,
|
|
@@ -7216,7 +7226,7 @@ function prepareLaunch(params) {
|
|
|
7216
7226
|
);
|
|
7217
7227
|
const updateCheck = runLaunchUpdateCheck({
|
|
7218
7228
|
mode: params.updateMode ?? "off",
|
|
7219
|
-
checkPath:
|
|
7229
|
+
checkPath: import_node_path36.default.join(paths.root, "update.check"),
|
|
7220
7230
|
currentVersion: package_default.version,
|
|
7221
7231
|
port: params.update
|
|
7222
7232
|
});
|
|
@@ -7347,12 +7357,12 @@ function runLaunchPlan(plan, spawn3) {
|
|
|
7347
7357
|
function runLauncher(params) {
|
|
7348
7358
|
params.proc.exit(runLaunchPlan(prepareLaunch(params), params.spawn));
|
|
7349
7359
|
}
|
|
7350
|
-
var import_node_crypto10,
|
|
7360
|
+
var import_node_crypto10, import_node_path36;
|
|
7351
7361
|
var init_launcher = __esm({
|
|
7352
7362
|
"src/launcher.ts"() {
|
|
7353
7363
|
"use strict";
|
|
7354
7364
|
import_node_crypto10 = require("node:crypto");
|
|
7355
|
-
|
|
7365
|
+
import_node_path36 = __toESM(require("node:path"), 1);
|
|
7356
7366
|
init_package();
|
|
7357
7367
|
init_envBool();
|
|
7358
7368
|
init_argv();
|
|
@@ -7383,13 +7393,13 @@ function agentShimCliPath(distDir = typeof __AGENT_SHIM_DIST_DIR__ === "string"
|
|
|
7383
7393
|
if (distDir === void 0) {
|
|
7384
7394
|
throw new OwnCliPathUnknownError();
|
|
7385
7395
|
}
|
|
7386
|
-
return
|
|
7396
|
+
return import_node_path37.default.join(distDir, OWN_CLI_FILE_NAME);
|
|
7387
7397
|
}
|
|
7388
|
-
var
|
|
7398
|
+
var import_node_path37, OWN_CLI_FILE_NAME, OwnCliPathUnknownError;
|
|
7389
7399
|
var init_ownCli = __esm({
|
|
7390
7400
|
"src/ownCli.ts"() {
|
|
7391
7401
|
"use strict";
|
|
7392
|
-
|
|
7402
|
+
import_node_path37 = __toESM(require("node:path"), 1);
|
|
7393
7403
|
init_cliError();
|
|
7394
7404
|
OWN_CLI_FILE_NAME = "cli.cjs";
|
|
7395
7405
|
OwnCliPathUnknownError = class extends CliError {
|
|
@@ -7474,7 +7484,7 @@ request.on("error", (error) => finish(failed, (error.code ? error.code + ": " :
|
|
|
7474
7484
|
// src/frontdoor/trust.ts
|
|
7475
7485
|
function resolveTrustBundle(params) {
|
|
7476
7486
|
const { caCertFile, bundlesDir, variable, inherited, fs: fs12 } = params;
|
|
7477
|
-
if (inherited === void 0 || inherited === "" ||
|
|
7487
|
+
if (inherited === void 0 || inherited === "" || import_node_path38.default.resolve(inherited) === import_node_path38.default.resolve(caCertFile)) {
|
|
7478
7488
|
return { path: caCertFile };
|
|
7479
7489
|
}
|
|
7480
7490
|
const caPem = fs12.readFileUtf8(caCertFile);
|
|
@@ -7492,19 +7502,19 @@ function resolveTrustBundle(params) {
|
|
|
7492
7502
|
}
|
|
7493
7503
|
const combined = `${inheritedPem.trimEnd()}
|
|
7494
7504
|
${caPem}`;
|
|
7495
|
-
const bundle =
|
|
7505
|
+
const bundle = import_node_path38.default.join(bundlesDir, `${(0, import_node_crypto11.createHash)("sha256").update(combined).digest("hex").slice(0, BUNDLE_NAME_HEX_DIGITS)}.pem`);
|
|
7496
7506
|
if (!fs12.exists(bundle)) {
|
|
7497
7507
|
fs12.mkdirp(bundlesDir);
|
|
7498
7508
|
fs12.writeFileAtomic(bundle, combined);
|
|
7499
7509
|
}
|
|
7500
7510
|
return { path: bundle };
|
|
7501
7511
|
}
|
|
7502
|
-
var import_node_crypto11,
|
|
7512
|
+
var import_node_crypto11, import_node_path38, BUNDLE_NAME_HEX_DIGITS;
|
|
7503
7513
|
var init_trust = __esm({
|
|
7504
7514
|
"src/frontdoor/trust.ts"() {
|
|
7505
7515
|
"use strict";
|
|
7506
7516
|
import_node_crypto11 = require("node:crypto");
|
|
7507
|
-
|
|
7517
|
+
import_node_path38 = __toESM(require("node:path"), 1);
|
|
7508
7518
|
BUNDLE_NAME_HEX_DIGITS = 16;
|
|
7509
7519
|
}
|
|
7510
7520
|
});
|
|
@@ -7522,7 +7532,7 @@ function realEnsurePorts(paths, spawnDaemon) {
|
|
|
7522
7532
|
process.kill(pid, "SIGTERM");
|
|
7523
7533
|
},
|
|
7524
7534
|
// Read fresh for each probe: a replacement supervisor may have regenerated an unparseable CA, and the probe must trust exactly what the serving door's leaf chains to.
|
|
7525
|
-
verifyListener: (port) => probeFrontDoorSync(port,
|
|
7535
|
+
verifyListener: (port) => probeFrontDoorSync(port, import_node_fs11.default.readFileSync(paths.frontdoorCaCertFile, "utf8"))
|
|
7526
7536
|
};
|
|
7527
7537
|
}
|
|
7528
7538
|
function realFrontDoorPort(paths, spawnDaemon) {
|
|
@@ -7543,21 +7553,21 @@ function realFrontDoorPort(paths, spawnDaemon) {
|
|
|
7543
7553
|
}
|
|
7544
7554
|
};
|
|
7545
7555
|
}
|
|
7546
|
-
var
|
|
7556
|
+
var import_node_fs11, realTrustBundleFs;
|
|
7547
7557
|
var init_realFrontDoorPort = __esm({
|
|
7548
7558
|
"src/frontdoor/realFrontDoorPort.ts"() {
|
|
7549
7559
|
"use strict";
|
|
7550
|
-
|
|
7560
|
+
import_node_fs11 = __toESM(require("node:fs"), 1);
|
|
7551
7561
|
init_realPorts();
|
|
7552
7562
|
init_ensure2();
|
|
7553
7563
|
init_state();
|
|
7554
7564
|
init_probe();
|
|
7555
7565
|
init_trust();
|
|
7556
7566
|
realTrustBundleFs = {
|
|
7557
|
-
readFileUtf8: (file) =>
|
|
7558
|
-
exists: (file) =>
|
|
7567
|
+
readFileUtf8: (file) => import_node_fs11.default.readFileSync(file, "utf8"),
|
|
7568
|
+
exists: (file) => import_node_fs11.default.existsSync(file),
|
|
7559
7569
|
mkdirp: (dir) => {
|
|
7560
|
-
|
|
7570
|
+
import_node_fs11.default.mkdirSync(dir, { recursive: true });
|
|
7561
7571
|
},
|
|
7562
7572
|
writeFileAtomic: (file, contents) => {
|
|
7563
7573
|
realFarmFs.writeFilePrivate(file, contents);
|
|
@@ -7894,11 +7904,11 @@ var init_identityClaude = __esm({
|
|
|
7894
7904
|
});
|
|
7895
7905
|
|
|
7896
7906
|
// src/usage/providerQuota.ts
|
|
7897
|
-
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;
|
|
7898
7908
|
var init_providerQuota = __esm({
|
|
7899
7909
|
"src/usage/providerQuota.ts"() {
|
|
7900
7910
|
"use strict";
|
|
7901
|
-
|
|
7911
|
+
import_zod29 = require("zod");
|
|
7902
7912
|
init_schema2();
|
|
7903
7913
|
MS_PER_SECOND7 = 1e3;
|
|
7904
7914
|
SECONDS_PER_HOUR = 3600;
|
|
@@ -7912,35 +7922,35 @@ var init_providerQuota = __esm({
|
|
|
7912
7922
|
[ZAI_UNIT_HOURS, SECONDS_PER_HOUR * MS_PER_SECOND7],
|
|
7913
7923
|
[ZAI_UNIT_MONTHS, DAYS_PER_MONTH * HOURS_PER_DAY4 * SECONDS_PER_HOUR * MS_PER_SECOND7]
|
|
7914
7924
|
]);
|
|
7915
|
-
ZaiLimitSchema =
|
|
7916
|
-
type:
|
|
7917
|
-
unit:
|
|
7918
|
-
number:
|
|
7919
|
-
percentage:
|
|
7920
|
-
nextResetTime:
|
|
7921
|
-
usage:
|
|
7922
|
-
currentValue:
|
|
7923
|
-
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()
|
|
7924
7934
|
});
|
|
7925
|
-
ZaiResponseSchema =
|
|
7926
|
-
success:
|
|
7927
|
-
msg:
|
|
7928
|
-
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) })
|
|
7929
7939
|
});
|
|
7930
7940
|
OPENROUTER_HOST = "openrouter.ai";
|
|
7931
7941
|
OPENROUTER_KEY_URL = `https://${OPENROUTER_HOST}/api/v1/key`;
|
|
7932
7942
|
OPENROUTER_CREDITS_URL = `https://${OPENROUTER_HOST}/api/v1/credits`;
|
|
7933
7943
|
MS_PER_DAY3 = HOURS_PER_DAY4 * SECONDS_PER_HOUR * MS_PER_SECOND7;
|
|
7934
|
-
OpenRouterKeySchema =
|
|
7935
|
-
data:
|
|
7936
|
-
limit:
|
|
7937
|
-
limit_remaining:
|
|
7938
|
-
limit_reset:
|
|
7939
|
-
is_free_tier:
|
|
7940
|
-
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()
|
|
7941
7951
|
})
|
|
7942
7952
|
});
|
|
7943
|
-
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() }) });
|
|
7944
7954
|
}
|
|
7945
7955
|
});
|
|
7946
7956
|
|
|
@@ -8029,6 +8039,10 @@ __export(index_exports, {
|
|
|
8029
8039
|
AgentKindSchema: () => AgentKindSchema,
|
|
8030
8040
|
AgentMetaSchema: () => AgentMetaSchema,
|
|
8031
8041
|
AgentNodeSchema: () => AgentNodeSchema,
|
|
8042
|
+
AgentTreesListInputSchema: () => AgentTreesListInputSchema,
|
|
8043
|
+
AgentTreesListOutputSchema: () => AgentTreesListOutputSchema,
|
|
8044
|
+
AgentTreesShowInputSchema: () => AgentTreesShowInputSchema,
|
|
8045
|
+
AgentTreesShowOutputSchema: () => AgentTreesShowOutputSchema,
|
|
8032
8046
|
CHECK_CREDENTIAL_APPLIES: () => CHECK_CREDENTIAL_APPLIES,
|
|
8033
8047
|
CODEX_APP_SERVER_GENERATED_AGAINST: () => CODEX_APP_SERVER_GENERATED_AGAINST,
|
|
8034
8048
|
CODEX_APP_SERVER_TIMEOUT_MS: () => CODEX_APP_SERVER_TIMEOUT_MS,
|
|
@@ -8124,11 +8138,15 @@ __export(index_exports, {
|
|
|
8124
8138
|
InvalidIdentityNameError: () => InvalidIdentityNameError,
|
|
8125
8139
|
InvalidProviderNameError: () => InvalidProviderNameError,
|
|
8126
8140
|
LAUNCH_EVENT_SOURCE: () => LAUNCH_EVENT_SOURCE,
|
|
8141
|
+
LIVE_TASK_CAP: () => LIVE_TASK_CAP,
|
|
8127
8142
|
LaunchLifecycleEventSchema: () => LaunchLifecycleEventSchema,
|
|
8128
8143
|
LaunchRefusedError: () => LaunchRefusedError,
|
|
8129
8144
|
LaunchResolveInputSchema: () => LaunchResolveInputSchema,
|
|
8130
8145
|
LaunchResolveOutputSchema: () => LaunchResolveOutputSchema,
|
|
8131
8146
|
LegacyProviderFileError: () => LegacyProviderFileError,
|
|
8147
|
+
LiveTaskSchema: () => LiveTaskSchema,
|
|
8148
|
+
MergedAgentNodeSchema: () => MergedAgentNodeSchema,
|
|
8149
|
+
MergedAgentTreeSchema: () => MergedAgentTreeSchema,
|
|
8132
8150
|
OWN_CLI_FILE_NAME: () => OWN_CLI_FILE_NAME,
|
|
8133
8151
|
PROMPT_CACHE_TTL_MS: () => PROMPT_CACHE_TTL_MS,
|
|
8134
8152
|
PlanClassSchema: () => PlanClassSchema,
|
|
@@ -8176,6 +8194,8 @@ __export(index_exports, {
|
|
|
8176
8194
|
ResetRowSchema: () => ResetRowSchema,
|
|
8177
8195
|
ResetScheduleSchema: () => ResetScheduleSchema,
|
|
8178
8196
|
SessionAgentTreeSchema: () => SessionAgentTreeSchema,
|
|
8197
|
+
SessionLookupError: () => SessionLookupError,
|
|
8198
|
+
SessionSummarySchema: () => SessionSummarySchema,
|
|
8179
8199
|
TaskItemSchema: () => TaskItemSchema,
|
|
8180
8200
|
USAGE_EVENT_SOURCE: () => USAGE_EVENT_SOURCE,
|
|
8181
8201
|
UpdateCheckOutputSchema: () => UpdateCheckOutputSchema,
|
|
@@ -8194,6 +8214,7 @@ __export(index_exports, {
|
|
|
8194
8214
|
addProvider: () => addProvider,
|
|
8195
8215
|
agentShimCliPath: () => agentShimCliPath,
|
|
8196
8216
|
answerRcControlRequest: () => answerRcControlRequest,
|
|
8217
|
+
applyAgentTaskEvent: () => applyAgentTaskEvent,
|
|
8197
8218
|
authenticateRcSessionMcpServer: () => authenticateRcSessionMcpServer,
|
|
8198
8219
|
buildEntryFacts: () => buildEntryFacts,
|
|
8199
8220
|
buildLayoutPaths: () => buildLayoutPaths,
|
|
@@ -8223,6 +8244,8 @@ __export(index_exports, {
|
|
|
8223
8244
|
collectFrontDoorStatus: () => collectFrontDoorStatus,
|
|
8224
8245
|
collectPoolPick: () => collectPoolPick,
|
|
8225
8246
|
collectResets: () => collectResets,
|
|
8247
|
+
collectSessionList: () => collectSessionList,
|
|
8248
|
+
createAgentTreesApiRouter: () => createAgentTreesApiRouter,
|
|
8226
8249
|
createCodexApiRouter: () => createCodexApiRouter,
|
|
8227
8250
|
createConfigApiRouter: () => createConfigApiRouter,
|
|
8228
8251
|
createControlApiRouter: () => createControlApiRouter,
|
|
@@ -8291,7 +8314,9 @@ __export(index_exports, {
|
|
|
8291
8314
|
listProviders: () => listProviders,
|
|
8292
8315
|
listSessions: () => listSessions2,
|
|
8293
8316
|
listUsageSnapshots: () => listUsageSnapshots,
|
|
8317
|
+
locateSession: () => locateSession,
|
|
8294
8318
|
matchBranch: () => matchBranch,
|
|
8319
|
+
mergeLiveTasks: () => mergeLiveTasks,
|
|
8295
8320
|
mintLeaf: () => mintLeaf,
|
|
8296
8321
|
mintRcSelfHostCredential: () => mintRcSelfHostCredential,
|
|
8297
8322
|
observingRoutedRoute: () => observingRoutedRoute,
|
|
@@ -8333,6 +8358,7 @@ __export(index_exports, {
|
|
|
8333
8358
|
realRcEventDial: () => realRcEventDial,
|
|
8334
8359
|
realRcStreamDial: () => realRcStreamDial,
|
|
8335
8360
|
realRcWebFetch: () => realRcWebFetch,
|
|
8361
|
+
realSessionFs: () => realSessionFs,
|
|
8336
8362
|
reconnectRcSessionMcpServer: () => reconnectRcSessionMcpServer,
|
|
8337
8363
|
recoverFarm: () => recoverFarm,
|
|
8338
8364
|
recoveryDiagnostics: () => recoveryDiagnostics,
|
|
@@ -8374,11 +8400,13 @@ __export(index_exports, {
|
|
|
8374
8400
|
setProfileMetadata: () => setProfileMetadata,
|
|
8375
8401
|
setRcSessionModel: () => setRcSessionModel,
|
|
8376
8402
|
setRcSessionPermissionMode: () => setRcSessionPermissionMode,
|
|
8403
|
+
showSession: () => showSession,
|
|
8377
8404
|
snapshotPath: () => snapshotPath,
|
|
8378
8405
|
spawnClaude: () => spawnClaude,
|
|
8379
8406
|
startConnectServer: () => startConnectServer,
|
|
8380
8407
|
submitRcSessionMcpOAuthCallbackUrl: () => submitRcSessionMcpOAuthCallbackUrl,
|
|
8381
8408
|
suggestRcSessionFiles: () => suggestRcSessionFiles,
|
|
8409
|
+
summariseSession: () => summariseSession,
|
|
8382
8410
|
teleportRcSession: () => teleportRcSession,
|
|
8383
8411
|
topLevelNames: () => topLevelNames,
|
|
8384
8412
|
updateDirectoryRule: () => updateDirectoryRule,
|
|
@@ -8918,8 +8946,8 @@ function parseConnectTarget(authority) {
|
|
|
8918
8946
|
function isInterceptedHost(host, interceptHosts) {
|
|
8919
8947
|
return interceptHosts.includes(host);
|
|
8920
8948
|
}
|
|
8921
|
-
function servedByPipeline(
|
|
8922
|
-
return
|
|
8949
|
+
function servedByPipeline(path39) {
|
|
8950
|
+
return path39?.startsWith(ROUTED_PATH_PREFIX) === true;
|
|
8923
8951
|
}
|
|
8924
8952
|
var HOP_BY_HOP_HEADERS = /* @__PURE__ */ new Set([
|
|
8925
8953
|
"connection",
|
|
@@ -9289,6 +9317,264 @@ var HTTP_STATUS = {
|
|
|
9289
9317
|
badGateway: 502
|
|
9290
9318
|
};
|
|
9291
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
|
+
|
|
9292
9578
|
// src/frontdoor/rcSessions.ts
|
|
9293
9579
|
var RC_SESSIONS_PATH_PREFIX = "/v1/code/sessions";
|
|
9294
9580
|
var RC_SESSION_ID_PREFIX = "cse_";
|
|
@@ -9329,7 +9615,7 @@ function sessionCreateId(body) {
|
|
|
9329
9615
|
const id = session.id;
|
|
9330
9616
|
return typeof id === "string" && id.startsWith(RC_SESSION_ID_PREFIX) ? id : void 0;
|
|
9331
9617
|
}
|
|
9332
|
-
function
|
|
9618
|
+
function isRecord3(value) {
|
|
9333
9619
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9334
9620
|
}
|
|
9335
9621
|
function parseJsonObject(body) {
|
|
@@ -9339,7 +9625,7 @@ function parseJsonObject(body) {
|
|
|
9339
9625
|
} catch {
|
|
9340
9626
|
return void 0;
|
|
9341
9627
|
}
|
|
9342
|
-
return
|
|
9628
|
+
return isRecord3(parsed) ? parsed : void 0;
|
|
9343
9629
|
}
|
|
9344
9630
|
function nonEmptyString(record, field) {
|
|
9345
9631
|
const value = record === void 0 ? void 0 : record[field];
|
|
@@ -9360,11 +9646,11 @@ function payloadEventsOf(body) {
|
|
|
9360
9646
|
}
|
|
9361
9647
|
const payloads = [];
|
|
9362
9648
|
for (const event of events) {
|
|
9363
|
-
if (!
|
|
9649
|
+
if (!isRecord3(event)) {
|
|
9364
9650
|
continue;
|
|
9365
9651
|
}
|
|
9366
9652
|
const payload = event.payload;
|
|
9367
|
-
if (!
|
|
9653
|
+
if (!isRecord3(payload)) {
|
|
9368
9654
|
continue;
|
|
9369
9655
|
}
|
|
9370
9656
|
payloads.push(payload);
|
|
@@ -9379,7 +9665,7 @@ function pendingOfControlRequestPayload(payload) {
|
|
|
9379
9665
|
if (requestId === void 0) {
|
|
9380
9666
|
return void 0;
|
|
9381
9667
|
}
|
|
9382
|
-
const request4 =
|
|
9668
|
+
const request4 = isRecord3(payload.request) ? payload.request : void 0;
|
|
9383
9669
|
const subtype = nonEmptyString(request4, "subtype");
|
|
9384
9670
|
const type = subtype ?? "control_request";
|
|
9385
9671
|
let summary = "";
|
|
@@ -9396,20 +9682,21 @@ function answeredRequestIdsOfControlResponsePayload(payload) {
|
|
|
9396
9682
|
if (payload.type !== "control_response") {
|
|
9397
9683
|
return [];
|
|
9398
9684
|
}
|
|
9399
|
-
const response =
|
|
9685
|
+
const response = isRecord3(payload.response) ? payload.response : void 0;
|
|
9400
9686
|
const id = nonEmptyString(response, "request_id") ?? nonEmptyString(payload, "request_id") ?? nonEmptyString(payload, "uuid");
|
|
9401
9687
|
return id === void 0 ? [] : [id];
|
|
9402
9688
|
}
|
|
9403
9689
|
function parseRcRequestBody(kind, body) {
|
|
9404
9690
|
if (kind === "heartbeat") {
|
|
9405
|
-
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: [] };
|
|
9406
9692
|
}
|
|
9407
9693
|
if (kind === "worker-registration") {
|
|
9408
|
-
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: [] };
|
|
9409
9695
|
}
|
|
9410
9696
|
const controlRequests = [];
|
|
9411
9697
|
const answeredRequestIds = [];
|
|
9412
|
-
|
|
9698
|
+
const payloads = payloadEventsOf(body);
|
|
9699
|
+
for (const payload of payloads) {
|
|
9413
9700
|
const pending = pendingOfControlRequestPayload(payload);
|
|
9414
9701
|
if (pending !== void 0) {
|
|
9415
9702
|
controlRequests.push({ requestId: pending.requestId, type: pending.type, summary: pending.summary });
|
|
@@ -9417,7 +9704,7 @@ function parseRcRequestBody(kind, body) {
|
|
|
9417
9704
|
}
|
|
9418
9705
|
answeredRequestIds.push(...answeredRequestIdsOfControlResponsePayload(payload));
|
|
9419
9706
|
}
|
|
9420
|
-
return { controlRequests, answeredRequestIds, idleSeconds: void 0, workerStatus: void 0 };
|
|
9707
|
+
return { controlRequests, answeredRequestIds, idleSeconds: void 0, workerStatus: void 0, payloads };
|
|
9421
9708
|
}
|
|
9422
9709
|
function createRcSessionTracker(deps) {
|
|
9423
9710
|
const entries = /* @__PURE__ */ new Map();
|
|
@@ -9443,7 +9730,7 @@ function createRcSessionTracker(deps) {
|
|
|
9443
9730
|
const timer = setInterval(sweep, deps.idleMs);
|
|
9444
9731
|
timer.unref();
|
|
9445
9732
|
const birth = (id, facts) => {
|
|
9446
|
-
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() };
|
|
9447
9734
|
entries.set(id, record);
|
|
9448
9735
|
return record;
|
|
9449
9736
|
};
|
|
@@ -9454,11 +9741,11 @@ function createRcSessionTracker(deps) {
|
|
|
9454
9741
|
};
|
|
9455
9742
|
const observeExchange = (request4) => {
|
|
9456
9743
|
const method = (request4.method ?? "").toUpperCase();
|
|
9457
|
-
const
|
|
9458
|
-
if (!
|
|
9744
|
+
const path39 = new URL(request4.url ?? "/", "http://127.0.0.1").pathname;
|
|
9745
|
+
if (!path39.startsWith(RC_SESSIONS_PATH_PREFIX)) {
|
|
9459
9746
|
return void 0;
|
|
9460
9747
|
}
|
|
9461
|
-
const tail =
|
|
9748
|
+
const tail = path39.slice(RC_SESSIONS_PATH_PREFIX.length);
|
|
9462
9749
|
const facts = {
|
|
9463
9750
|
oauthAuthorization: oauthAuthorizationOf(request4.headers),
|
|
9464
9751
|
anthropicVersion: singleHeader(request4.headers, "anthropic-version"),
|
|
@@ -9531,6 +9818,9 @@ function createRcSessionTracker(deps) {
|
|
|
9531
9818
|
for (const requestId of factsOfBody.answeredRequestIds) {
|
|
9532
9819
|
entryNow.pending.delete(requestId);
|
|
9533
9820
|
}
|
|
9821
|
+
for (const payload of factsOfBody.payloads) {
|
|
9822
|
+
entryNow.liveTasks = applyAgentTaskEvent(entryNow.liveTasks, id, payload, now);
|
|
9823
|
+
}
|
|
9534
9824
|
if (factsOfBody.idleSeconds !== void 0) {
|
|
9535
9825
|
entryNow.workerIdleSeconds = { value: factsOfBody.idleSeconds, observedAt: now };
|
|
9536
9826
|
}
|
|
@@ -9621,9 +9911,10 @@ function createRcSessionTracker(deps) {
|
|
|
9621
9911
|
return;
|
|
9622
9912
|
}
|
|
9623
9913
|
entry.sequenceNum = entry.sequenceNum === void 0 || event.sequence_num > entry.sequenceNum ? event.sequence_num : entry.sequenceNum;
|
|
9624
|
-
if (!
|
|
9914
|
+
if (!isRecord3(event.payload)) {
|
|
9625
9915
|
return;
|
|
9626
9916
|
}
|
|
9917
|
+
entry.liveTasks = applyAgentTaskEvent(entry.liveTasks, sessionId, event.payload, deps.now());
|
|
9627
9918
|
const pending = pendingOfControlRequestPayload(event.payload);
|
|
9628
9919
|
if (pending !== void 0) {
|
|
9629
9920
|
if (event.source === RC_STREAM_WORKER_SOURCE) {
|
|
@@ -9635,6 +9926,10 @@ function createRcSessionTracker(deps) {
|
|
|
9635
9926
|
entry.pending.delete(requestId);
|
|
9636
9927
|
}
|
|
9637
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
|
+
},
|
|
9638
9933
|
completePending: (sessionId, requestId) => {
|
|
9639
9934
|
entries.get(sessionId)?.pending.delete(requestId);
|
|
9640
9935
|
},
|
|
@@ -9840,8 +10135,8 @@ var RC_READ_FILE_ENCODINGS = ["utf-8", "base64"];
|
|
|
9840
10135
|
function isRcReadFileEncoding(value) {
|
|
9841
10136
|
return RC_READ_FILE_ENCODINGS.some((encoding) => encoding === value);
|
|
9842
10137
|
}
|
|
9843
|
-
function buildRcReadFilePayload(requestId,
|
|
9844
|
-
return buildRcControlRequestPayload(requestId, { subtype: "read_file", path:
|
|
10138
|
+
function buildRcReadFilePayload(requestId, path39, options) {
|
|
10139
|
+
return buildRcControlRequestPayload(requestId, { subtype: "read_file", path: path39, ...options?.maxBytes === void 0 ? {} : { max_bytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } });
|
|
9845
10140
|
}
|
|
9846
10141
|
function buildRcFileSuggestionsPayload(requestId, query) {
|
|
9847
10142
|
return buildRcControlRequestPayload(requestId, { subtype: "file_suggestions", query });
|
|
@@ -9943,15 +10238,15 @@ async function getRcSessionContextUsage(deps, sessionId, detail) {
|
|
|
9943
10238
|
const result = await deliverRcClientPayload(deps, sessionId, buildRcGetContextUsagePayload(requestId, detail), `request the context usage of session ${sessionId}`);
|
|
9944
10239
|
return result.ok ? { ...result, requestId } : result;
|
|
9945
10240
|
}
|
|
9946
|
-
async function readRcSessionFile(deps, sessionId,
|
|
9947
|
-
if (
|
|
10241
|
+
async function readRcSessionFile(deps, sessionId, path39, options) {
|
|
10242
|
+
if (path39 === "") {
|
|
9948
10243
|
return { ok: false, message: "a read-file write needs a non-empty path: the SDK's own field names the file the worker resolves against the session's cwd, and an empty string names none" };
|
|
9949
10244
|
}
|
|
9950
10245
|
if (options?.maxBytes !== void 0 && (!Number.isInteger(options.maxBytes) || options.maxBytes <= 0)) {
|
|
9951
10246
|
return { ok: false, message: "a read-file write's max-bytes is a positive whole number of bytes: the SDK's own field caps the read, and a zero or negative cap reads nothing" };
|
|
9952
10247
|
}
|
|
9953
10248
|
const requestId = deps.newUuid();
|
|
9954
|
-
const result = await deliverRcClientPayload(deps, sessionId, buildRcReadFilePayload(requestId,
|
|
10249
|
+
const result = await deliverRcClientPayload(deps, sessionId, buildRcReadFilePayload(requestId, path39, options), `read ${path39} from session ${sessionId}`);
|
|
9955
10250
|
return result.ok ? { ...result, requestId } : result;
|
|
9956
10251
|
}
|
|
9957
10252
|
async function suggestRcSessionFiles(deps, sessionId, query) {
|
|
@@ -10120,11 +10415,11 @@ function createRcControlHandler(deps) {
|
|
|
10120
10415
|
path: "read-file",
|
|
10121
10416
|
read: (body) => {
|
|
10122
10417
|
const session = bodyString(body, "session");
|
|
10123
|
-
const
|
|
10418
|
+
const path39 = bodyString(body, "path");
|
|
10124
10419
|
const maxBytes = "maxBytes" in body ? bodyPositiveInteger(body, "maxBytes") : void 0;
|
|
10125
10420
|
const encoding = "encoding" in body && isRcReadFileEncoding(body.encoding) ? body.encoding : void 0;
|
|
10126
|
-
const refused2 = session === void 0 ||
|
|
10127
|
-
return refused2 ? { error: `the read-file body must be JSON naming a non-empty session id and path, maxBytes only as a positive whole number or absent, and an encoding the SDK's own type permits (${RC_READ_FILE_ENCODINGS.join(", ")}) or none` } : { session, run: async () => await deps.readFile(session,
|
|
10421
|
+
const refused2 = session === void 0 || path39 === void 0 || "maxBytes" in body && maxBytes === void 0 || "encoding" in body && encoding === void 0;
|
|
10422
|
+
return refused2 ? { error: `the read-file body must be JSON naming a non-empty session id and path, maxBytes only as a positive whole number or absent, and an encoding the SDK's own type permits (${RC_READ_FILE_ENCODINGS.join(", ")}) or none` } : { session, run: async () => await deps.readFile(session, path39, { ...maxBytes === void 0 ? {} : { maxBytes }, ...encoding === void 0 ? {} : { encoding } }) };
|
|
10128
10423
|
}
|
|
10129
10424
|
},
|
|
10130
10425
|
{
|
|
@@ -10434,9 +10729,9 @@ function requestIdOfBody(body) {
|
|
|
10434
10729
|
}
|
|
10435
10730
|
function frontDoorRcControl(transport, token) {
|
|
10436
10731
|
const headers = { authorization: `Bearer ${token}` };
|
|
10437
|
-
const listAnswerOf = async (
|
|
10732
|
+
const listAnswerOf = async (path39, what) => {
|
|
10438
10733
|
try {
|
|
10439
|
-
return await transport.request({ method: "GET", path:
|
|
10734
|
+
return await transport.request({ method: "GET", path: path39, headers });
|
|
10440
10735
|
} catch (error) {
|
|
10441
10736
|
throw new Error(`${what}: could not reach the front door's control listener: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
10442
10737
|
}
|
|
@@ -10508,10 +10803,10 @@ function frontDoorRcControl(transport, token) {
|
|
|
10508
10803
|
}
|
|
10509
10804
|
return pending;
|
|
10510
10805
|
};
|
|
10511
|
-
const writeOf = async (
|
|
10806
|
+
const writeOf = async (path39, body, describeFailure2) => {
|
|
10512
10807
|
let answer;
|
|
10513
10808
|
try {
|
|
10514
|
-
answer = await transport.request({ method: "POST", path:
|
|
10809
|
+
answer = await transport.request({ method: "POST", path: path39, headers: { ...headers, "content-type": "application/json" }, body });
|
|
10515
10810
|
} catch (error) {
|
|
10516
10811
|
return { ok: false, message: `could not reach the front door's control listener: ${error instanceof Error ? error.message : String(error)}` };
|
|
10517
10812
|
}
|
|
@@ -10542,10 +10837,10 @@ function frontDoorRcControl(transport, token) {
|
|
|
10542
10837
|
endSession: async (sessionId, reason) => await writeOf(`${CONTROL_PATH_PREFIX}/end-session`, JSON.stringify({ session: sessionId, ...reason === void 0 ? {} : { reason } }), (status, message) => `ending ${sessionId} failed (HTTP ${String(status)}): ${message}`),
|
|
10543
10838
|
getUsage: async (sessionId, skipBehaviors) => await writeOf(`${CONTROL_PATH_PREFIX}/get-usage`, JSON.stringify({ session: sessionId, ...skipBehaviors === void 0 ? {} : { skipBehaviors } }), (status, message) => `requesting the usage of ${sessionId} failed (HTTP ${String(status)}): ${message}`),
|
|
10544
10839
|
getContextUsage: async (sessionId, detail) => await writeOf(`${CONTROL_PATH_PREFIX}/get-context-usage`, JSON.stringify({ session: sessionId, ...detail === void 0 ? {} : { detail } }), (status, message) => `requesting the context usage of ${sessionId} failed (HTTP ${String(status)}): ${message}`),
|
|
10545
|
-
readFile: async (sessionId,
|
|
10840
|
+
readFile: async (sessionId, path39, options) => await writeOf(
|
|
10546
10841
|
`${CONTROL_PATH_PREFIX}/read-file`,
|
|
10547
|
-
JSON.stringify({ session: sessionId, path:
|
|
10548
|
-
(status, message) => `reading ${
|
|
10842
|
+
JSON.stringify({ session: sessionId, path: path39, ...options?.maxBytes === void 0 ? {} : { maxBytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } }),
|
|
10843
|
+
(status, message) => `reading ${path39} from ${sessionId} failed (HTTP ${String(status)}): ${message}`
|
|
10549
10844
|
),
|
|
10550
10845
|
fileSuggestions: async (sessionId, query) => await writeOf(`${CONTROL_PATH_PREFIX}/file-suggestions`, JSON.stringify({ session: sessionId, query }), (status, message) => `requesting file suggestions from ${sessionId} failed (HTTP ${String(status)}): ${message}`),
|
|
10551
10846
|
keepAlive: async (sessionId) => await writeOf(`${CONTROL_PATH_PREFIX}/keep-alive`, JSON.stringify({ session: sessionId }), (status, message) => `keeping ${sessionId} alive failed (HTTP ${String(status)}): ${message}`),
|
|
@@ -10704,12 +10999,12 @@ function tlsFacts(options) {
|
|
|
10704
10999
|
}
|
|
10705
11000
|
function realRcEventDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
|
|
10706
11001
|
const agent = new ExemptTlsAgent();
|
|
10707
|
-
const post = async (
|
|
11002
|
+
const post = async (path39, headers, body) => await new Promise((resolve, reject) => {
|
|
10708
11003
|
const options = {
|
|
10709
11004
|
host: target.host,
|
|
10710
11005
|
port: target.port,
|
|
10711
11006
|
method: "POST",
|
|
10712
|
-
path:
|
|
11007
|
+
path: path39,
|
|
10713
11008
|
// The Host header names the host whose API this is, not the address dialled: a redirected test dials a loopback stand-in while still speaking to the API host by name, exactly as the forwarded paths present their SNI.
|
|
10714
11009
|
headers: { ...headers, host: target.servername ?? target.host, "content-length": String(Buffer.byteLength(body, "utf8")) },
|
|
10715
11010
|
agent
|
|
@@ -10774,12 +11069,12 @@ function lateRcStreamDial(resolve) {
|
|
|
10774
11069
|
}
|
|
10775
11070
|
function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
|
|
10776
11071
|
const agent = new ExemptTlsAgent();
|
|
10777
|
-
const request4 = async (method,
|
|
11072
|
+
const request4 = async (method, path39, headers, body, signal) => await new Promise((resolve, reject) => {
|
|
10778
11073
|
const options = {
|
|
10779
11074
|
host: target.host,
|
|
10780
11075
|
port: target.port,
|
|
10781
11076
|
method,
|
|
10782
|
-
path:
|
|
11077
|
+
path: path39,
|
|
10783
11078
|
// The Host header names the host whose API this is, not the address dialled: a redirected test dials a loopback stand-in while still speaking to the API host by name, exactly as the forwarded paths present their SNI.
|
|
10784
11079
|
headers: { ...headers, host: target.servername ?? target.host, ...body === void 0 ? {} : { "content-length": String(Buffer.byteLength(body, "utf8")) } },
|
|
10785
11080
|
agent,
|
|
@@ -10821,9 +11116,9 @@ function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_P
|
|
|
10821
11116
|
return { status, body: await readAll(response) };
|
|
10822
11117
|
},
|
|
10823
11118
|
openStream: async (sessionId, headers, resume, signal) => {
|
|
10824
|
-
const
|
|
11119
|
+
const path39 = resume === void 0 ? `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream` : `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream?from_sequence_num=${String(resume.fromSequenceNum)}`;
|
|
10825
11120
|
const streamHeaders = resume === void 0 ? headers : { ...headers, "last-event-id": String(resume.fromSequenceNum) };
|
|
10826
|
-
const { status, response } = await request4("GET",
|
|
11121
|
+
const { status, response } = await request4("GET", path39, streamHeaders, void 0, signal);
|
|
10827
11122
|
if (!isSuccessful2(status)) {
|
|
10828
11123
|
await readAll(response);
|
|
10829
11124
|
return { status, chunks: NO_CHUNKS };
|
|
@@ -11039,11 +11334,11 @@ var import_node_path10 = __toESM(require("node:path"), 1);
|
|
|
11039
11334
|
function isSafeSessionId(sessionId) {
|
|
11040
11335
|
return /^[A-Za-z0-9_-]+$/.test(sessionId);
|
|
11041
11336
|
}
|
|
11042
|
-
function
|
|
11337
|
+
function isRecord4(value) {
|
|
11043
11338
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
11044
11339
|
}
|
|
11045
11340
|
function credentialOfJson(parsed) {
|
|
11046
|
-
if (!
|
|
11341
|
+
if (!isRecord4(parsed)) {
|
|
11047
11342
|
return void 0;
|
|
11048
11343
|
}
|
|
11049
11344
|
const { authorization, anthropicVersion, anthropicClientPlatform } = parsed;
|
|
@@ -11073,7 +11368,7 @@ function createRcCredentialStore(fs12, dir) {
|
|
|
11073
11368
|
} catch {
|
|
11074
11369
|
return void 0;
|
|
11075
11370
|
}
|
|
11076
|
-
return
|
|
11371
|
+
return isRecord4(parsed) ? parsed : void 0;
|
|
11077
11372
|
};
|
|
11078
11373
|
return {
|
|
11079
11374
|
read: (sessionId) => {
|
|
@@ -11127,162 +11422,162 @@ init_package();
|
|
|
11127
11422
|
init_capability();
|
|
11128
11423
|
|
|
11129
11424
|
// src/frontdoor/rcSchemas.ts
|
|
11130
|
-
var
|
|
11131
|
-
var RcPermissionModeSchema =
|
|
11132
|
-
var RcSessionSummarySchema =
|
|
11133
|
-
id:
|
|
11134
|
-
createdAt:
|
|
11135
|
-
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()
|
|
11136
11431
|
});
|
|
11137
11432
|
function workerFactSchema(value) {
|
|
11138
|
-
return
|
|
11139
|
-
}
|
|
11140
|
-
var RcPendingRequestSummarySchema =
|
|
11141
|
-
sessionId:
|
|
11142
|
-
requestId:
|
|
11143
|
-
type:
|
|
11144
|
-
summary:
|
|
11145
|
-
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()
|
|
11146
11441
|
});
|
|
11147
|
-
var RcSessionStatusSchema =
|
|
11442
|
+
var RcSessionStatusSchema = import_zod6.z.strictObject({
|
|
11148
11443
|
...RcSessionSummarySchema.shape,
|
|
11149
|
-
workerState: workerFactSchema(
|
|
11150
|
-
workerIdleSeconds: workerFactSchema(
|
|
11151
|
-
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))
|
|
11152
11447
|
});
|
|
11153
|
-
var RcStreamEnvelopeSchema =
|
|
11448
|
+
var RcStreamEnvelopeSchema = import_zod6.z.looseObject({
|
|
11154
11449
|
/** The envelope's own event id, when the host sent one. */
|
|
11155
|
-
event_id:
|
|
11450
|
+
event_id: import_zod6.z.string().optional(),
|
|
11156
11451
|
/** The envelope's event type, the discriminator a consumer switches on (`control_request`, `user`, and kin). */
|
|
11157
|
-
event_type:
|
|
11452
|
+
event_type: import_zod6.z.string(),
|
|
11158
11453
|
/** The sequence number the host assigned, the value a resume continues after. */
|
|
11159
|
-
sequence_num:
|
|
11454
|
+
sequence_num: import_zod6.z.int(),
|
|
11160
11455
|
/** Who emitted the event (`worker` for the CLI's half, a client id for a client's). */
|
|
11161
|
-
source:
|
|
11456
|
+
source: import_zod6.z.string(),
|
|
11162
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. */
|
|
11163
|
-
payload:
|
|
11458
|
+
payload: import_zod6.z.unknown().optional(),
|
|
11164
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. */
|
|
11165
|
-
created_at:
|
|
11460
|
+
created_at: import_zod6.z.unknown().optional()
|
|
11166
11461
|
});
|
|
11167
|
-
var RcStreamEventSchema =
|
|
11168
|
-
session:
|
|
11462
|
+
var RcStreamEventSchema = import_zod6.z.strictObject({
|
|
11463
|
+
session: import_zod6.z.string(),
|
|
11169
11464
|
envelope: RcStreamEnvelopeSchema
|
|
11170
11465
|
});
|
|
11171
|
-
var RcRateLimitWindowSchema =
|
|
11466
|
+
var RcRateLimitWindowSchema = import_zod6.z.looseObject({
|
|
11172
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). */
|
|
11173
|
-
utilization:
|
|
11468
|
+
utilization: import_zod6.z.number().optional(),
|
|
11174
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. */
|
|
11175
|
-
resetsAt:
|
|
11470
|
+
resetsAt: import_zod6.z.number().optional()
|
|
11176
11471
|
});
|
|
11177
|
-
var RcRateLimitInfoSchema =
|
|
11472
|
+
var RcRateLimitInfoSchema = import_zod6.z.looseObject({
|
|
11178
11473
|
/** The limiting window's own status (`allowed`, `allowed_warning`, `rejected`), asserted only as a string because the vocabulary grows with the CLI. */
|
|
11179
|
-
status:
|
|
11474
|
+
status: import_zod6.z.string(),
|
|
11180
11475
|
/** When the limiting window resets, in unix epoch seconds. */
|
|
11181
|
-
resetsAt:
|
|
11476
|
+
resetsAt: import_zod6.z.number().optional(),
|
|
11182
11477
|
/** Which window the top-level fields describe (`five_hour`, `seven_day`, and kin), the payload's own name for it. */
|
|
11183
|
-
rateLimitType:
|
|
11478
|
+
rateLimitType: import_zod6.z.string().optional(),
|
|
11184
11479
|
/** The fraction of the limiting window used, on the same scale the per-window utilizations carry. */
|
|
11185
|
-
utilization:
|
|
11480
|
+
utilization: import_zod6.z.number().optional(),
|
|
11186
11481
|
/** Whether usage beyond the plan (extra usage) is currently covering the overflow, the payload's own flag for it. */
|
|
11187
|
-
isUsingOverage:
|
|
11482
|
+
isUsingOverage: import_zod6.z.boolean().optional(),
|
|
11188
11483
|
/** The overage's own status, the same vocabulary the limiting window's `status` carries. */
|
|
11189
|
-
overageStatus:
|
|
11484
|
+
overageStatus: import_zod6.z.string().optional(),
|
|
11190
11485
|
/** When the overage window resets, in unix epoch seconds. */
|
|
11191
|
-
overageResetsAt:
|
|
11486
|
+
overageResetsAt: import_zod6.z.number().optional(),
|
|
11192
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. */
|
|
11193
|
-
unifiedWindows:
|
|
11488
|
+
unifiedWindows: import_zod6.z.looseObject({ five_hour: RcRateLimitWindowSchema.optional(), seven_day: RcRateLimitWindowSchema.optional(), seven_day_overage_included: RcRateLimitWindowSchema.optional() }).optional()
|
|
11194
11489
|
});
|
|
11195
|
-
var RcLiveRateLimitSchema =
|
|
11196
|
-
session:
|
|
11197
|
-
observedAt:
|
|
11490
|
+
var RcLiveRateLimitSchema = import_zod6.z.strictObject({
|
|
11491
|
+
session: import_zod6.z.string(),
|
|
11492
|
+
observedAt: import_zod6.z.number(),
|
|
11198
11493
|
rateLimit: RcRateLimitInfoSchema
|
|
11199
11494
|
});
|
|
11200
|
-
var RcSessionQuerySchema =
|
|
11201
|
-
session:
|
|
11495
|
+
var RcSessionQuerySchema = import_zod6.z.strictObject({
|
|
11496
|
+
session: import_zod6.z.string().min(1).optional()
|
|
11202
11497
|
});
|
|
11203
|
-
var RcSendInputSchema =
|
|
11204
|
-
session:
|
|
11205
|
-
text:
|
|
11498
|
+
var RcSendInputSchema = import_zod6.z.strictObject({
|
|
11499
|
+
session: import_zod6.z.string().min(1),
|
|
11500
|
+
text: import_zod6.z.string().min(1)
|
|
11206
11501
|
});
|
|
11207
|
-
var RcAnswerInputSchema =
|
|
11208
|
-
session:
|
|
11209
|
-
request:
|
|
11210
|
-
approve:
|
|
11211
|
-
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()
|
|
11212
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" });
|
|
11213
|
-
var RcInterruptInputSchema =
|
|
11214
|
-
session:
|
|
11508
|
+
var RcInterruptInputSchema = import_zod6.z.strictObject({
|
|
11509
|
+
session: import_zod6.z.string().min(1)
|
|
11215
11510
|
});
|
|
11216
|
-
var RcSetModelInputSchema =
|
|
11217
|
-
session:
|
|
11218
|
-
model:
|
|
11511
|
+
var RcSetModelInputSchema = import_zod6.z.strictObject({
|
|
11512
|
+
session: import_zod6.z.string().min(1),
|
|
11513
|
+
model: import_zod6.z.string().min(1)
|
|
11219
11514
|
});
|
|
11220
|
-
var RcSetPermissionModeInputSchema =
|
|
11221
|
-
session:
|
|
11515
|
+
var RcSetPermissionModeInputSchema = import_zod6.z.strictObject({
|
|
11516
|
+
session: import_zod6.z.string().min(1),
|
|
11222
11517
|
mode: RcPermissionModeSchema
|
|
11223
11518
|
});
|
|
11224
|
-
var RcEndSessionInputSchema =
|
|
11225
|
-
session:
|
|
11226
|
-
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()
|
|
11227
11522
|
});
|
|
11228
|
-
var RcGetUsageInputSchema =
|
|
11229
|
-
session:
|
|
11230
|
-
skipBehaviors:
|
|
11523
|
+
var RcGetUsageInputSchema = import_zod6.z.strictObject({
|
|
11524
|
+
session: import_zod6.z.string().min(1),
|
|
11525
|
+
skipBehaviors: import_zod6.z.boolean().optional()
|
|
11231
11526
|
});
|
|
11232
|
-
var RcGetContextUsageInputSchema =
|
|
11233
|
-
session:
|
|
11234
|
-
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()
|
|
11235
11530
|
});
|
|
11236
|
-
var RcReadFileInputSchema =
|
|
11237
|
-
session:
|
|
11238
|
-
path:
|
|
11239
|
-
maxBytes:
|
|
11240
|
-
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()
|
|
11241
11536
|
});
|
|
11242
|
-
var RcFileSuggestionsInputSchema =
|
|
11243
|
-
session:
|
|
11244
|
-
query:
|
|
11537
|
+
var RcFileSuggestionsInputSchema = import_zod6.z.strictObject({
|
|
11538
|
+
session: import_zod6.z.string().min(1),
|
|
11539
|
+
query: import_zod6.z.string()
|
|
11245
11540
|
});
|
|
11246
|
-
var RcKeepAliveInputSchema =
|
|
11247
|
-
session:
|
|
11541
|
+
var RcKeepAliveInputSchema = import_zod6.z.strictObject({
|
|
11542
|
+
session: import_zod6.z.string().min(1)
|
|
11248
11543
|
});
|
|
11249
|
-
var RcMcpStatusInputSchema =
|
|
11250
|
-
session:
|
|
11544
|
+
var RcMcpStatusInputSchema = import_zod6.z.strictObject({
|
|
11545
|
+
session: import_zod6.z.string().min(1)
|
|
11251
11546
|
});
|
|
11252
|
-
var RcMcpReconnectInputSchema =
|
|
11253
|
-
session:
|
|
11254
|
-
serverName:
|
|
11547
|
+
var RcMcpReconnectInputSchema = import_zod6.z.strictObject({
|
|
11548
|
+
session: import_zod6.z.string().min(1),
|
|
11549
|
+
serverName: import_zod6.z.string().min(1)
|
|
11255
11550
|
});
|
|
11256
|
-
var RcMcpAuthenticateInputSchema =
|
|
11257
|
-
session:
|
|
11258
|
-
serverName:
|
|
11259
|
-
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)
|
|
11260
11555
|
});
|
|
11261
|
-
var RcMcpOAuthCallbackUrlInputSchema =
|
|
11262
|
-
session:
|
|
11263
|
-
serverName:
|
|
11264
|
-
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)
|
|
11265
11560
|
});
|
|
11266
|
-
var RcTeleportInputSchema =
|
|
11267
|
-
session:
|
|
11268
|
-
marker:
|
|
11561
|
+
var RcTeleportInputSchema = import_zod6.z.strictObject({
|
|
11562
|
+
session: import_zod6.z.string().min(1),
|
|
11563
|
+
marker: import_zod6.z.string().min(1)
|
|
11269
11564
|
});
|
|
11270
|
-
var RcListOutputSchema =
|
|
11271
|
-
var RcStatusOutputSchema =
|
|
11272
|
-
var RcPendingOutputSchema =
|
|
11273
|
-
var RcWriteOutputSchema =
|
|
11274
|
-
session:
|
|
11275
|
-
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()))
|
|
11276
11571
|
});
|
|
11277
|
-
var RcControlWriteOutputSchema =
|
|
11278
|
-
session:
|
|
11279
|
-
request:
|
|
11280
|
-
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()))
|
|
11281
11576
|
});
|
|
11282
|
-
var RcAnswerOutputSchema =
|
|
11283
|
-
session:
|
|
11284
|
-
request:
|
|
11285
|
-
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()))
|
|
11286
11581
|
});
|
|
11287
11582
|
|
|
11288
11583
|
// src/frontdoor/rcApi.ts
|
|
@@ -11290,6 +11585,7 @@ var RC_ORPC_PATH_PREFIX = "/__agent-shim/orpc";
|
|
|
11290
11585
|
var RC_OPENAPI_DOC_PATH = "/openapi.json";
|
|
11291
11586
|
var RC_SUBSCRIBER_BUFFER_EVENTS = 100;
|
|
11292
11587
|
var READ_ONLY_OPERATION_EXTENSION = "x-agent-shim-read-only";
|
|
11588
|
+
var SESSION_HISTORY_TAG = "agent-trees";
|
|
11293
11589
|
function doorApiBearer(headers) {
|
|
11294
11590
|
const presented = headers.authorization;
|
|
11295
11591
|
const bearerPrefix = "bearer ".length;
|
|
@@ -11468,48 +11764,48 @@ init_cliError();
|
|
|
11468
11764
|
init_package();
|
|
11469
11765
|
|
|
11470
11766
|
// src/codex/appServerSchemas.ts
|
|
11471
|
-
var
|
|
11767
|
+
var import_zod7 = require("zod");
|
|
11472
11768
|
var CODEX_APP_SERVER_GENERATED_AGAINST = "0.160.0";
|
|
11473
|
-
var RateLimitWindowSchema =
|
|
11474
|
-
usedPercent:
|
|
11475
|
-
resetsAt:
|
|
11476
|
-
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()
|
|
11477
11773
|
});
|
|
11478
|
-
var RateLimitSnapshotSchema =
|
|
11479
|
-
limitId:
|
|
11480
|
-
limitName:
|
|
11481
|
-
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(),
|
|
11482
11778
|
primary: RateLimitWindowSchema.nullish(),
|
|
11483
11779
|
secondary: RateLimitWindowSchema.nullish(),
|
|
11484
|
-
rateLimitReachedType:
|
|
11485
|
-
spendControlReached:
|
|
11780
|
+
rateLimitReachedType: import_zod7.z.string().nullish(),
|
|
11781
|
+
spendControlReached: import_zod7.z.boolean().nullish()
|
|
11486
11782
|
});
|
|
11487
|
-
var RateLimitResetCreditSchema =
|
|
11488
|
-
id:
|
|
11489
|
-
grantedAt:
|
|
11490
|
-
expiresAt:
|
|
11491
|
-
resetType:
|
|
11492
|
-
status:
|
|
11493
|
-
title:
|
|
11494
|
-
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()
|
|
11495
11791
|
});
|
|
11496
|
-
var CodexAccountSchema =
|
|
11497
|
-
|
|
11498
|
-
|
|
11499
|
-
|
|
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) })
|
|
11500
11796
|
]);
|
|
11501
|
-
var CodexAccountReadSchema =
|
|
11797
|
+
var CodexAccountReadSchema = import_zod7.z.object({
|
|
11502
11798
|
account: CodexAccountSchema.nullable(),
|
|
11503
|
-
requiresOpenaiAuth:
|
|
11799
|
+
requiresOpenaiAuth: import_zod7.z.boolean()
|
|
11504
11800
|
});
|
|
11505
|
-
var CodexRateLimitsReadSchema =
|
|
11801
|
+
var CodexRateLimitsReadSchema = import_zod7.z.object({
|
|
11506
11802
|
rateLimits: RateLimitSnapshotSchema,
|
|
11507
|
-
rateLimitsByLimitId:
|
|
11508
|
-
rateLimitResetCredits:
|
|
11509
|
-
accountId:
|
|
11510
|
-
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()
|
|
11511
11807
|
});
|
|
11512
|
-
var CodexInitializeResultSchema =
|
|
11808
|
+
var CodexInitializeResultSchema = import_zod7.z.object({ userAgent: import_zod7.z.string() });
|
|
11513
11809
|
|
|
11514
11810
|
// src/codex/appServer.ts
|
|
11515
11811
|
var CodexAppServerUnavailableError = class extends CliError {
|
|
@@ -11704,8 +12000,8 @@ init_cliError();
|
|
|
11704
12000
|
init_realPorts();
|
|
11705
12001
|
|
|
11706
12002
|
// src/frontdoor/controlApi.ts
|
|
11707
|
-
var
|
|
11708
|
-
var
|
|
12003
|
+
var import_client7 = require("@orpc/client");
|
|
12004
|
+
var import_openapi8 = require("@orpc/openapi");
|
|
11709
12005
|
|
|
11710
12006
|
// src/checkReport.ts
|
|
11711
12007
|
var import_node_os5 = __toESM(require("node:os"), 1);
|
|
@@ -11974,19 +12270,19 @@ function writePools(paths, pools) {
|
|
|
11974
12270
|
applyPatch(paths.globalConfigFile, GlobalConfigSchema, { pools }, { defaults: {} });
|
|
11975
12271
|
}
|
|
11976
12272
|
function poolCycleOf(pools, name) {
|
|
11977
|
-
const walk = (current,
|
|
12273
|
+
const walk = (current, path39) => {
|
|
11978
12274
|
for (const entry of pools[current]?.identities ?? []) {
|
|
11979
12275
|
const nested = poolNameOf(poolMemberIdentity(entry));
|
|
11980
12276
|
if (nested === void 0) {
|
|
11981
12277
|
continue;
|
|
11982
12278
|
}
|
|
11983
12279
|
if (nested === name) {
|
|
11984
|
-
return [...
|
|
12280
|
+
return [...path39, nested];
|
|
11985
12281
|
}
|
|
11986
|
-
if (
|
|
12282
|
+
if (path39.includes(nested)) {
|
|
11987
12283
|
continue;
|
|
11988
12284
|
}
|
|
11989
|
-
const found = walk(nested, [...
|
|
12285
|
+
const found = walk(nested, [...path39, nested]);
|
|
11990
12286
|
if (found !== void 0) {
|
|
11991
12287
|
return found;
|
|
11992
12288
|
}
|
|
@@ -12086,7 +12382,7 @@ init_realCredentialCache();
|
|
|
12086
12382
|
init_providersStore();
|
|
12087
12383
|
init_realPorts();
|
|
12088
12384
|
var import_node_path25 = __toESM(require("node:path"), 1);
|
|
12089
|
-
var
|
|
12385
|
+
var import_zod15 = require("zod");
|
|
12090
12386
|
init_envBool();
|
|
12091
12387
|
init_load();
|
|
12092
12388
|
init_schema();
|
|
@@ -12174,9 +12470,9 @@ function lookupKeychainService(run, farmRoot) {
|
|
|
12174
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}".`
|
|
12175
12471
|
};
|
|
12176
12472
|
}
|
|
12177
|
-
var SettingsSecretsShapeSchema =
|
|
12178
|
-
env:
|
|
12179
|
-
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()
|
|
12180
12476
|
});
|
|
12181
12477
|
function hookCommandCountOf(group) {
|
|
12182
12478
|
if (typeof group !== "object" || group === null) {
|
|
@@ -12468,7 +12764,7 @@ function collectCheckReport(params) {
|
|
|
12468
12764
|
}
|
|
12469
12765
|
|
|
12470
12766
|
// src/checkReportSchema.ts
|
|
12471
|
-
var
|
|
12767
|
+
var import_zod17 = require("zod");
|
|
12472
12768
|
init_schema();
|
|
12473
12769
|
init_claudeVersion();
|
|
12474
12770
|
init_identity();
|
|
@@ -12532,124 +12828,124 @@ var DIAGNOSTIC_CODES = [
|
|
|
12532
12828
|
var DIAGNOSTIC_SEVERITIES = ["error", "warning", "info"];
|
|
12533
12829
|
|
|
12534
12830
|
// src/usage/pickReportSchema.ts
|
|
12535
|
-
var
|
|
12831
|
+
var import_zod16 = require("zod");
|
|
12536
12832
|
init_plan2();
|
|
12537
|
-
var PoolPickCandidateViewSchema =
|
|
12538
|
-
identity:
|
|
12833
|
+
var PoolPickCandidateViewSchema = import_zod16.z.strictObject({
|
|
12834
|
+
identity: import_zod16.z.string(),
|
|
12539
12835
|
/** In pick order: `scored` has usable quota data, `unknown` has none, `pay-per-use` bills by use, `ineligible` is refused right now. */
|
|
12540
|
-
class:
|
|
12836
|
+
class: import_zod16.z.enum(["scored", "unknown", "pay-per-use", "ineligible"]),
|
|
12541
12837
|
/** Plan-size-weighted remaining quota per hour until its reset; present for `scored` only. */
|
|
12542
|
-
score:
|
|
12838
|
+
score: import_zod16.z.number().optional(),
|
|
12543
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`. */
|
|
12544
|
-
scoreWindow:
|
|
12840
|
+
scoreWindow: import_zod16.z.enum(["sevenDay", "fiveHour"]).optional(),
|
|
12545
12841
|
/** False when the five-hour window would run dry, at the observed pace, before it resets. */
|
|
12546
|
-
feasible:
|
|
12842
|
+
feasible: import_zod16.z.boolean(),
|
|
12547
12843
|
/** When an `ineligible` member can be used again, as an ISO instant. */
|
|
12548
|
-
blockedUntil:
|
|
12844
|
+
blockedUntil: import_zod16.z.iso.datetime().optional(),
|
|
12549
12845
|
plan: PlanClassSchema,
|
|
12550
12846
|
/** The facts behind the class and score, in the order they matter. */
|
|
12551
|
-
reasons:
|
|
12847
|
+
reasons: import_zod16.z.array(import_zod16.z.string())
|
|
12552
12848
|
});
|
|
12553
|
-
var PoolPickReportSchema =
|
|
12554
|
-
pool:
|
|
12555
|
-
directory:
|
|
12849
|
+
var PoolPickReportSchema = import_zod16.z.strictObject({
|
|
12850
|
+
pool: import_zod16.z.string(),
|
|
12851
|
+
directory: import_zod16.z.string(),
|
|
12556
12852
|
/** The member a launch would run as, absent when every member is refused. */
|
|
12557
|
-
pick:
|
|
12558
|
-
candidates:
|
|
12853
|
+
pick: import_zod16.z.string().optional(),
|
|
12854
|
+
candidates: import_zod16.z.array(PoolPickCandidateViewSchema),
|
|
12559
12855
|
/** Identity members anywhere in the pool's graph that do not exist; a launch skips them. */
|
|
12560
|
-
missing:
|
|
12856
|
+
missing: import_zod16.z.array(import_zod16.z.string()),
|
|
12561
12857
|
/** When nothing can be picked, the soonest any member returns. */
|
|
12562
|
-
earliestReturn:
|
|
12858
|
+
earliestReturn: import_zod16.z.strictObject({ identity: import_zod16.z.string(), at: import_zod16.z.iso.datetime() }).optional(),
|
|
12563
12859
|
/** The member a resumed conversation started on but moved off, and why, when the ranking could not keep it. */
|
|
12564
|
-
movedOff:
|
|
12860
|
+
movedOff: import_zod16.z.strictObject({ identity: import_zod16.z.string(), reason: import_zod16.z.string() }).optional(),
|
|
12565
12861
|
/** Why the last-pick record could not be read, when that is the case. */
|
|
12566
|
-
stickyProblem:
|
|
12862
|
+
stickyProblem: import_zod16.z.string().optional()
|
|
12567
12863
|
});
|
|
12568
12864
|
|
|
12569
12865
|
// src/checkReportSchema.ts
|
|
12570
12866
|
var CHECK_CREDENTIAL_APPLIES = ["provider", "identity", "stored-login"];
|
|
12571
|
-
var CheckLayerViewSchema =
|
|
12572
|
-
id:
|
|
12573
|
-
kind:
|
|
12574
|
-
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()
|
|
12575
12871
|
});
|
|
12576
|
-
var CheckEntryViewSchema =
|
|
12577
|
-
path:
|
|
12578
|
-
shared:
|
|
12579
|
-
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),
|
|
12580
12876
|
/** The entry's real category, or null when nothing classifies it. */
|
|
12581
|
-
category:
|
|
12582
|
-
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(),
|
|
12583
12879
|
/** Rules that matched but whose `when` condition failed, each with the conditions that failed. */
|
|
12584
|
-
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()
|
|
12585
12881
|
});
|
|
12586
|
-
var CheckDiagnosticSchema =
|
|
12587
|
-
code:
|
|
12588
|
-
severity:
|
|
12589
|
-
message:
|
|
12590
|
-
subject:
|
|
12591
|
-
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()
|
|
12592
12888
|
});
|
|
12593
|
-
var CheckAmbientCredentialSchema =
|
|
12594
|
-
var CheckKeychainSchema =
|
|
12595
|
-
checked:
|
|
12596
|
-
found:
|
|
12597
|
-
serviceName:
|
|
12598
|
-
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()
|
|
12599
12895
|
});
|
|
12600
|
-
var CheckSettingsExposureSchema =
|
|
12601
|
-
file:
|
|
12602
|
-
envKeyNames:
|
|
12603
|
-
hookEventNames:
|
|
12604
|
-
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()
|
|
12605
12901
|
});
|
|
12606
|
-
var CredentialSourceSummarySchema =
|
|
12607
|
-
|
|
12608
|
-
|
|
12609
|
-
|
|
12610
|
-
|
|
12611
|
-
|
|
12612
|
-
|
|
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") })
|
|
12613
12909
|
]);
|
|
12614
|
-
var CredentialSummarySchema =
|
|
12615
|
-
target:
|
|
12616
|
-
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)),
|
|
12617
12913
|
cache: CredentialCacheSchema.optional()
|
|
12618
12914
|
});
|
|
12619
|
-
var CachedCredentialStateSchema =
|
|
12620
|
-
|
|
12621
|
-
|
|
12622
|
-
|
|
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() })
|
|
12623
12919
|
]);
|
|
12624
|
-
var CheckCredentialProviderSchema =
|
|
12625
|
-
|
|
12626
|
-
|
|
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() })
|
|
12627
12923
|
]);
|
|
12628
|
-
var CheckCredentialSchema =
|
|
12629
|
-
applies:
|
|
12924
|
+
var CheckCredentialSchema = import_zod17.z.strictObject({
|
|
12925
|
+
applies: import_zod17.z.enum(CHECK_CREDENTIAL_APPLIES),
|
|
12630
12926
|
provider: CheckCredentialProviderSchema.optional(),
|
|
12631
12927
|
identity: CredentialSummarySchema.optional(),
|
|
12632
12928
|
identityCached: CachedCredentialStateSchema.optional()
|
|
12633
12929
|
});
|
|
12634
|
-
var CheckClaudeVersionSchema =
|
|
12635
|
-
pinned:
|
|
12636
|
-
highestInstalled:
|
|
12637
|
-
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()))
|
|
12638
12934
|
});
|
|
12639
|
-
var CheckReportJsonSchema =
|
|
12640
|
-
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) }),
|
|
12641
12937
|
/** The pool ranking, when the launch named a pool instead of an identity. */
|
|
12642
12938
|
pool: PoolPickReportSchema.optional(),
|
|
12643
|
-
configProfile:
|
|
12644
|
-
layers:
|
|
12645
|
-
entries:
|
|
12646
|
-
projectEncodingAmbiguities:
|
|
12647
|
-
|
|
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() }))
|
|
12648
12944
|
),
|
|
12649
|
-
diagnostics:
|
|
12945
|
+
diagnostics: import_zod17.z.readonly(import_zod17.z.array(CheckDiagnosticSchema)),
|
|
12650
12946
|
ambientCredential: CheckAmbientCredentialSchema,
|
|
12651
12947
|
keychain: CheckKeychainSchema.optional(),
|
|
12652
|
-
settingsExposure:
|
|
12948
|
+
settingsExposure: import_zod17.z.readonly(import_zod17.z.array(CheckSettingsExposureSchema)),
|
|
12653
12949
|
credential: CheckCredentialSchema,
|
|
12654
12950
|
claudeVersion: CheckClaudeVersionSchema.optional()
|
|
12655
12951
|
});
|
|
@@ -12709,28 +13005,28 @@ function collectResets(snapshots, nowMs) {
|
|
|
12709
13005
|
}
|
|
12710
13006
|
|
|
12711
13007
|
// src/usage/resetsSchema.ts
|
|
12712
|
-
var
|
|
12713
|
-
var ResetRowSchema =
|
|
12714
|
-
identity:
|
|
12715
|
-
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(),
|
|
12716
13012
|
/** What the window is: `5h`, `7d` or `extra usage` for an Anthropic account, or the provider's own measure and period (`tokens 5h`). */
|
|
12717
|
-
window:
|
|
13013
|
+
window: import_zod18.z.string(),
|
|
12718
13014
|
/** When the state the window comes from was observed, as an ISO instant. */
|
|
12719
|
-
observedAt:
|
|
13015
|
+
observedAt: import_zod18.z.iso.datetime(),
|
|
12720
13016
|
/** When the window resets, as an ISO instant; absent when the upstream reported none. */
|
|
12721
|
-
resetsAt:
|
|
13017
|
+
resetsAt: import_zod18.z.iso.datetime().optional(),
|
|
12722
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. */
|
|
12723
|
-
reset:
|
|
13019
|
+
reset: import_zod18.z.boolean(),
|
|
12724
13020
|
/** The fraction used, as `effectiveWindow` reads it at the report's own clock. */
|
|
12725
|
-
utilization:
|
|
13021
|
+
utilization: import_zod18.z.number().optional(),
|
|
12726
13022
|
/** The window's own status, for a window that has not reset yet. */
|
|
12727
|
-
status:
|
|
13023
|
+
status: import_zod18.z.string().optional()
|
|
12728
13024
|
});
|
|
12729
|
-
var ResetScheduleSchema =
|
|
13025
|
+
var ResetScheduleSchema = import_zod18.z.strictObject({ resets: import_zod18.z.readonly(import_zod18.z.array(ResetRowSchema)) });
|
|
12730
13026
|
|
|
12731
13027
|
// src/frontdoor/controlSchemas.ts
|
|
12732
13028
|
var import_node_path30 = __toESM(require("node:path"), 1);
|
|
12733
|
-
var
|
|
13029
|
+
var import_zod23 = require("zod");
|
|
12734
13030
|
|
|
12735
13031
|
// src/doctorReport.ts
|
|
12736
13032
|
init_claudeShim();
|
|
@@ -12931,24 +13227,24 @@ function credentialsFilePath(farmRoot) {
|
|
|
12931
13227
|
}
|
|
12932
13228
|
|
|
12933
13229
|
// src/codex/siwcStore.ts
|
|
12934
|
-
var
|
|
13230
|
+
var import_zod22 = require("zod");
|
|
12935
13231
|
|
|
12936
13232
|
// src/codex/auth.ts
|
|
12937
|
-
var
|
|
12938
|
-
var AuthFileSchema =
|
|
12939
|
-
tokens:
|
|
12940
|
-
access_token:
|
|
12941
|
-
refresh_token:
|
|
12942
|
-
id_token:
|
|
12943
|
-
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()
|
|
12944
13240
|
}).nullish(),
|
|
12945
|
-
last_refresh:
|
|
13241
|
+
last_refresh: import_zod20.z.string().optional()
|
|
12946
13242
|
});
|
|
12947
|
-
var TokenGrantSchema =
|
|
12948
|
-
access_token:
|
|
12949
|
-
refresh_token:
|
|
12950
|
-
id_token:
|
|
12951
|
-
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()
|
|
12952
13248
|
});
|
|
12953
13249
|
var CodexAuthError = class extends Error {
|
|
12954
13250
|
constructor(message) {
|
|
@@ -12958,41 +13254,41 @@ var CodexAuthError = class extends Error {
|
|
|
12958
13254
|
};
|
|
12959
13255
|
|
|
12960
13256
|
// src/codex/siwc.ts
|
|
12961
|
-
var
|
|
13257
|
+
var import_zod21 = require("zod");
|
|
12962
13258
|
var SIWC_RESOURCE = "https://api.openai.com/v1";
|
|
12963
13259
|
var SIWC_RESPONSES_URL = `${SIWC_RESOURCE}/responses`;
|
|
12964
13260
|
var SIWC_PLAN_SCOPE = "chatgpt.tokens.use.direct";
|
|
12965
|
-
var TokenResponseSchema =
|
|
12966
|
-
access_token:
|
|
12967
|
-
refresh_token:
|
|
12968
|
-
id_token:
|
|
12969
|
-
expires_in:
|
|
12970
|
-
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()
|
|
12971
13267
|
});
|
|
12972
|
-
var JwtHeaderSchema =
|
|
12973
|
-
var IdTokenClaimsSchema =
|
|
12974
|
-
iss:
|
|
12975
|
-
sub:
|
|
12976
|
-
aud:
|
|
12977
|
-
exp:
|
|
12978
|
-
nonce:
|
|
12979
|
-
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()
|
|
12980
13276
|
});
|
|
12981
|
-
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() })) });
|
|
12982
13278
|
|
|
12983
13279
|
// src/codex/siwcStore.ts
|
|
12984
|
-
var SiwcGrantSchema =
|
|
12985
|
-
clientId:
|
|
12986
|
-
sub:
|
|
12987
|
-
email:
|
|
12988
|
-
idToken:
|
|
12989
|
-
accessToken:
|
|
12990
|
-
refreshToken:
|
|
12991
|
-
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(),
|
|
12992
13288
|
/** When the access token stops working, in milliseconds since the epoch. */
|
|
12993
|
-
expiresAt:
|
|
13289
|
+
expiresAt: import_zod22.z.number()
|
|
12994
13290
|
});
|
|
12995
|
-
var SiwcFileSchema =
|
|
13291
|
+
var SiwcFileSchema = import_zod22.z.strictObject({ registeredClientId: import_zod22.z.string().min(1).optional(), grant: SiwcGrantSchema.optional() });
|
|
12996
13292
|
function parseSiwcFile(raw, filePath) {
|
|
12997
13293
|
let json;
|
|
12998
13294
|
try {
|
|
@@ -13689,90 +13985,90 @@ function collectDoctorReport(params) {
|
|
|
13689
13985
|
// src/frontdoor/controlSchemas.ts
|
|
13690
13986
|
init_schema2();
|
|
13691
13987
|
init_state();
|
|
13692
|
-
var UsageListOutputSchema =
|
|
13693
|
-
var UsageWindowsInputSchema =
|
|
13694
|
-
identity:
|
|
13695
|
-
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()
|
|
13696
13992
|
});
|
|
13697
|
-
var EffectiveWindowSchema =
|
|
13993
|
+
var EffectiveWindowSchema = import_zod23.z.strictObject({
|
|
13698
13994
|
/** True when the window's reset time has passed, so the recorded observation describes a window that no longer exists. */
|
|
13699
|
-
reset:
|
|
13995
|
+
reset: import_zod23.z.boolean(),
|
|
13700
13996
|
/** The fraction used: 0 for a reset window, otherwise what was last observed, absent when none was reported. */
|
|
13701
|
-
utilization:
|
|
13997
|
+
utilization: import_zod23.z.number().optional(),
|
|
13702
13998
|
/** The reset instant, for a window that has not reset yet and reported one. */
|
|
13703
|
-
resetsAtMs:
|
|
13999
|
+
resetsAtMs: import_zod23.z.number().optional(),
|
|
13704
14000
|
/** The window's own status, for a window that has not reset yet. */
|
|
13705
|
-
status:
|
|
14001
|
+
status: import_zod23.z.string().optional()
|
|
13706
14002
|
});
|
|
13707
|
-
var UsageWindowsOutputSchema =
|
|
13708
|
-
identity:
|
|
13709
|
-
provider:
|
|
14003
|
+
var UsageWindowsOutputSchema = import_zod23.z.strictObject({
|
|
14004
|
+
identity: import_zod23.z.string(),
|
|
14005
|
+
provider: import_zod23.z.string(),
|
|
13710
14006
|
/** When the rate-limit state the windows come from was observed. */
|
|
13711
|
-
observedAt:
|
|
14007
|
+
observedAt: import_zod23.z.iso.datetime().optional(),
|
|
13712
14008
|
fiveHour: EffectiveWindowSchema.optional(),
|
|
13713
14009
|
sevenDay: EffectiveWindowSchema.optional()
|
|
13714
14010
|
});
|
|
13715
|
-
var UsageLiveOutputSchema =
|
|
14011
|
+
var UsageLiveOutputSchema = import_zod23.z.strictObject({
|
|
13716
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. */
|
|
13717
14013
|
latest: RcLiveRateLimitSchema.optional(),
|
|
13718
14014
|
/** One observation per session whose stream has filed a rate_limit_event this door generation. */
|
|
13719
|
-
sessions:
|
|
14015
|
+
sessions: import_zod23.z.readonly(import_zod23.z.array(RcLiveRateLimitSchema))
|
|
13720
14016
|
});
|
|
13721
|
-
var FrontDoorSessionStatusSchema =
|
|
13722
|
-
pid:
|
|
13723
|
-
startedAt:
|
|
13724
|
-
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()
|
|
13725
14021
|
});
|
|
13726
|
-
var HeadroomSocketTargetSchema =
|
|
13727
|
-
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({
|
|
13728
14024
|
state: FrontDoorStateSchema,
|
|
13729
|
-
supervisorAlive:
|
|
13730
|
-
sessions:
|
|
14025
|
+
supervisorAlive: import_zod23.z.boolean(),
|
|
14026
|
+
sessions: import_zod23.z.readonly(import_zod23.z.array(FrontDoorSessionStatusSchema)),
|
|
13731
14027
|
headroomSocket: HeadroomSocketTargetSchema.optional(),
|
|
13732
|
-
logPath:
|
|
13733
|
-
logExists:
|
|
14028
|
+
logPath: import_zod23.z.string(),
|
|
14029
|
+
logExists: import_zod23.z.boolean()
|
|
13734
14030
|
});
|
|
13735
|
-
var FrontDoorSessionsOutputSchema =
|
|
13736
|
-
var CheckRunInputSchema =
|
|
13737
|
-
path:
|
|
13738
|
-
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()
|
|
13739
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" });
|
|
13740
|
-
var PoolPickInputSchema =
|
|
13741
|
-
pool:
|
|
13742
|
-
path:
|
|
14036
|
+
var PoolPickInputSchema = import_zod23.z.strictObject({
|
|
14037
|
+
pool: import_zod23.z.string().min(1),
|
|
14038
|
+
path: import_zod23.z.string().min(1)
|
|
13743
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" });
|
|
13744
|
-
var DoctorFindingSchema =
|
|
13745
|
-
section:
|
|
13746
|
-
subject:
|
|
13747
|
-
severity:
|
|
13748
|
-
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()
|
|
13749
14045
|
});
|
|
13750
|
-
var DoctorRunOutputSchema =
|
|
14046
|
+
var DoctorRunOutputSchema = import_zod23.z.strictObject({
|
|
13751
14047
|
/** False exactly when any finding is a `fail`; a `warn` never fails the report on its own. */
|
|
13752
|
-
ok:
|
|
13753
|
-
findings:
|
|
14048
|
+
ok: import_zod23.z.boolean(),
|
|
14049
|
+
findings: import_zod23.z.readonly(import_zod23.z.array(DoctorFindingSchema))
|
|
13754
14050
|
});
|
|
13755
|
-
var FrontDoorRestartOutputSchema =
|
|
13756
|
-
action:
|
|
13757
|
-
previousPid:
|
|
14051
|
+
var FrontDoorRestartOutputSchema = import_zod23.z.strictObject({
|
|
14052
|
+
action: import_zod23.z.literal("restarting"),
|
|
14053
|
+
previousPid: import_zod23.z.int().positive()
|
|
13758
14054
|
});
|
|
13759
|
-
var UpdateCheckOutputSchema =
|
|
13760
|
-
current:
|
|
13761
|
-
latest:
|
|
13762
|
-
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"])
|
|
13763
14059
|
});
|
|
13764
|
-
var CodexSignInSchema =
|
|
13765
|
-
|
|
13766
|
-
|
|
13767
|
-
|
|
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() })
|
|
13768
14064
|
]);
|
|
13769
|
-
var CodexStatusOutputSchema =
|
|
14065
|
+
var CodexStatusOutputSchema = import_zod23.z.strictObject({
|
|
13770
14066
|
signIn: CodexSignInSchema,
|
|
13771
|
-
codexProviders:
|
|
14067
|
+
codexProviders: import_zod23.z.readonly(import_zod23.z.array(import_zod23.z.string()))
|
|
13772
14068
|
});
|
|
13773
|
-
var CodexLogoutOutputSchema =
|
|
13774
|
-
hadGrant:
|
|
13775
|
-
revoked:
|
|
14069
|
+
var CodexLogoutOutputSchema = import_zod23.z.strictObject({
|
|
14070
|
+
hadGrant: import_zod23.z.boolean(),
|
|
14071
|
+
revoked: import_zod23.z.boolean()
|
|
13776
14072
|
});
|
|
13777
14073
|
|
|
13778
14074
|
// src/frontdoor/codexApi.ts
|
|
@@ -13928,134 +14224,134 @@ init_identity();
|
|
|
13928
14224
|
init_providersStore();
|
|
13929
14225
|
|
|
13930
14226
|
// src/frontdoor/configSchemas.ts
|
|
13931
|
-
var
|
|
14227
|
+
var import_zod24 = require("zod");
|
|
13932
14228
|
init_schema();
|
|
13933
|
-
var RemovalConfirmationSchema =
|
|
13934
|
-
var CredentialWriteSchema = (targets) =>
|
|
13935
|
-
sources:
|
|
13936
|
-
target:
|
|
13937
|
-
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()
|
|
13938
14234
|
});
|
|
13939
|
-
var CredentialSummarySchema2 =
|
|
13940
|
-
target:
|
|
13941
|
-
sources:
|
|
13942
|
-
|
|
13943
|
-
|
|
13944
|
-
|
|
13945
|
-
|
|
13946
|
-
|
|
13947
|
-
|
|
13948
|
-
|
|
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") })
|
|
13949
14245
|
])
|
|
13950
14246
|
)),
|
|
13951
14247
|
cache: CredentialCacheSchema.optional()
|
|
13952
14248
|
});
|
|
13953
|
-
var mutationOutput = (kind, action) =>
|
|
13954
|
-
var storedMutationOutput = (kind, action, value) =>
|
|
13955
|
-
var IdentityValueSchema =
|
|
13956
|
-
name:
|
|
13957
|
-
defaultConfigProfile:
|
|
13958
|
-
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(),
|
|
13959
14255
|
credential: CredentialSummarySchema2.optional(),
|
|
13960
|
-
anchors:
|
|
14256
|
+
anchors: import_zod24.z.array(AnchorSchema).optional()
|
|
13961
14257
|
});
|
|
13962
14258
|
var ProfileValueSchema = ConfigProfileSchema.omit({ $schema: true });
|
|
13963
|
-
var ProviderValueSchema =
|
|
13964
|
-
name:
|
|
13965
|
-
kind:
|
|
13966
|
-
displayName:
|
|
13967
|
-
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(),
|
|
13968
14264
|
codex: CodexProviderConfigSchema.optional(),
|
|
13969
14265
|
credential: CredentialSummarySchema2,
|
|
13970
|
-
env:
|
|
14266
|
+
env: import_zod24.z.record(import_zod24.z.string(), import_zod24.z.string()).optional()
|
|
13971
14267
|
});
|
|
13972
|
-
var ConfigNameInputSchema =
|
|
14268
|
+
var ConfigNameInputSchema = import_zod24.z.strictObject({ name: import_zod24.z.string().min(1) });
|
|
13973
14269
|
var ConfigIdentityAddOutputSchema = storedMutationOutput("identity", "created", IdentityValueSchema);
|
|
13974
|
-
var ConfigIdentitySetInputSchema =
|
|
13975
|
-
name:
|
|
13976
|
-
defaultConfigProfile:
|
|
13977
|
-
allowAmbientCredential:
|
|
13978
|
-
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(),
|
|
13979
14275
|
/** `false` removes the anchors; a list replaces them. */
|
|
13980
|
-
anchors:
|
|
14276
|
+
anchors: import_zod24.z.union([import_zod24.z.literal(false), import_zod24.z.array(AnchorSchema).min(1)]).optional()
|
|
13981
14277
|
});
|
|
13982
14278
|
var ConfigIdentitySetOutputSchema = storedMutationOutput("identity", "updated", IdentityValueSchema);
|
|
13983
|
-
var ConfigIdentityRemoveInputSchema =
|
|
14279
|
+
var ConfigIdentityRemoveInputSchema = import_zod24.z.strictObject({ name: import_zod24.z.string().min(1), confirm: RemovalConfirmationSchema });
|
|
13984
14280
|
var ConfigIdentityRemoveOutputSchema = mutationOutput("identity", "removed");
|
|
13985
14281
|
var ConfigIdentityUseOutputSchema = mutationOutput("identity", "selected");
|
|
13986
|
-
var ConfigProfileAddInputSchema =
|
|
13987
|
-
name:
|
|
13988
|
-
extends:
|
|
13989
|
-
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()
|
|
13990
14286
|
});
|
|
13991
14287
|
var ConfigProfileAddOutputSchema = storedMutationOutput("profile", "created", ProfileValueSchema);
|
|
13992
|
-
var ConfigProfileSetInputSchema =
|
|
13993
|
-
name:
|
|
13994
|
-
category:
|
|
13995
|
-
entry:
|
|
13996
|
-
extends:
|
|
13997
|
-
description:
|
|
13998
|
-
launch:
|
|
13999
|
-
skipPermissions:
|
|
14000
|
-
remoteControl:
|
|
14001
|
-
headroom:
|
|
14002
|
-
trackUsage:
|
|
14003
|
-
provider:
|
|
14004
|
-
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()
|
|
14005
14301
|
}).optional()
|
|
14006
14302
|
});
|
|
14007
14303
|
var ConfigProfileSetOutputSchema = storedMutationOutput("profile", "updated", ProfileValueSchema);
|
|
14008
|
-
var ConfigProfileRemoveInputSchema =
|
|
14304
|
+
var ConfigProfileRemoveInputSchema = import_zod24.z.strictObject({ name: import_zod24.z.string().min(1), confirm: RemovalConfirmationSchema });
|
|
14009
14305
|
var ConfigProfileRemoveOutputSchema = mutationOutput("profile", "removed");
|
|
14010
14306
|
var ConfigProfileUseOutputSchema = mutationOutput("profile", "selected");
|
|
14011
|
-
var PoolMembersInputSchema =
|
|
14012
|
-
var ConfigPoolAddInputSchema =
|
|
14013
|
-
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),
|
|
14014
14310
|
identities: PoolMembersInputSchema,
|
|
14015
|
-
preference:
|
|
14311
|
+
preference: import_zod24.z.enum(POOL_PREFERENCES).optional()
|
|
14016
14312
|
});
|
|
14017
14313
|
var ConfigPoolAddOutputSchema = storedMutationOutput("pool", "created", PoolSchema);
|
|
14018
|
-
var ConfigPoolSetInputSchema =
|
|
14019
|
-
name:
|
|
14314
|
+
var ConfigPoolSetInputSchema = import_zod24.z.strictObject({
|
|
14315
|
+
name: import_zod24.z.string().min(1),
|
|
14020
14316
|
identities: PoolMembersInputSchema.optional(),
|
|
14021
|
-
preference:
|
|
14317
|
+
preference: import_zod24.z.union([import_zod24.z.enum(POOL_PREFERENCES), import_zod24.z.literal(false)]).optional()
|
|
14022
14318
|
});
|
|
14023
14319
|
var ConfigPoolSetOutputSchema = storedMutationOutput("pool", "updated", PoolSchema);
|
|
14024
|
-
var ConfigPoolRemoveInputSchema =
|
|
14320
|
+
var ConfigPoolRemoveInputSchema = import_zod24.z.strictObject({ name: import_zod24.z.string().min(1), confirm: RemovalConfirmationSchema });
|
|
14025
14321
|
var ConfigPoolRemoveOutputSchema = mutationOutput("pool", "removed");
|
|
14026
14322
|
var ConfigPoolUseOutputSchema = mutationOutput("pool", "selected");
|
|
14027
|
-
var ConfigProviderAddInputSchema =
|
|
14028
|
-
name:
|
|
14029
|
-
kind:
|
|
14030
|
-
displayName:
|
|
14031
|
-
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(),
|
|
14032
14328
|
credential: CredentialWriteSchema(PROVIDER_CREDENTIAL_TARGETS).required({ sources: true }),
|
|
14033
14329
|
codex: CodexProviderConfigSchema.optional()
|
|
14034
14330
|
});
|
|
14035
14331
|
var ConfigProviderAddOutputSchema = storedMutationOutput("provider", "created", ProviderValueSchema);
|
|
14036
|
-
var ConfigProviderSetInputSchema =
|
|
14037
|
-
name:
|
|
14038
|
-
displayName:
|
|
14039
|
-
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(),
|
|
14040
14336
|
credential: CredentialWriteSchema(PROVIDER_CREDENTIAL_TARGETS).optional(),
|
|
14041
14337
|
codex: CodexProviderConfigSchema.optional()
|
|
14042
14338
|
});
|
|
14043
14339
|
var ConfigProviderSetOutputSchema = storedMutationOutput("provider", "updated", ProviderValueSchema);
|
|
14044
|
-
var ConfigProviderRemoveInputSchema =
|
|
14340
|
+
var ConfigProviderRemoveInputSchema = import_zod24.z.strictObject({ name: import_zod24.z.string().min(1), confirm: RemovalConfirmationSchema });
|
|
14045
14341
|
var ConfigProviderRemoveOutputSchema = mutationOutput("provider", "removed");
|
|
14046
|
-
var ConfigRuleAddInputSchema =
|
|
14047
|
-
path:
|
|
14048
|
-
configProfile:
|
|
14049
|
-
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()
|
|
14050
14346
|
});
|
|
14051
14347
|
var ConfigRuleAddOutputSchema = storedMutationOutput("rule", "created", DirectoryRuleSchema);
|
|
14052
|
-
var ConfigRuleSetInputSchema =
|
|
14053
|
-
path:
|
|
14054
|
-
configProfile:
|
|
14055
|
-
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()
|
|
14056
14352
|
});
|
|
14057
14353
|
var ConfigRuleSetOutputSchema = storedMutationOutput("rule", "updated", DirectoryRuleSchema);
|
|
14058
|
-
var ConfigRuleRemoveInputSchema =
|
|
14354
|
+
var ConfigRuleRemoveInputSchema = import_zod24.z.strictObject({ path: import_zod24.z.string().min(1), confirm: RemovalConfirmationSchema });
|
|
14059
14355
|
var ConfigRuleRemoveOutputSchema = mutationOutput("rule", "removed");
|
|
14060
14356
|
|
|
14061
14357
|
// src/frontdoor/configApi.ts
|
|
@@ -14120,7 +14416,7 @@ function profileValue(name, paths) {
|
|
|
14120
14416
|
function createConfigApiRouter(deps) {
|
|
14121
14417
|
const authed = doorApiAuth(deps.expectedToken);
|
|
14122
14418
|
const { paths } = deps;
|
|
14123
|
-
const route = (
|
|
14419
|
+
const route = (path39, summary) => authed.meta((0, import_openapi3.openapi)({ method: "POST", path: path39, summary, tags: [CONFIG_API_TAG] }));
|
|
14124
14420
|
return {
|
|
14125
14421
|
config: {
|
|
14126
14422
|
identity: {
|
|
@@ -14365,43 +14661,43 @@ var import_openapi4 = require("@orpc/openapi");
|
|
|
14365
14661
|
var import_server3 = require("@orpc/server");
|
|
14366
14662
|
|
|
14367
14663
|
// src/frontdoor/eventSchemas.ts
|
|
14368
|
-
var
|
|
14664
|
+
var import_zod25 = require("zod");
|
|
14369
14665
|
var DOOR_EVENT_SOURCE_RC = "rc";
|
|
14370
14666
|
var LAUNCH_EVENT_SOURCE = "launch";
|
|
14371
14667
|
var USAGE_EVENT_SOURCE = "usage";
|
|
14372
14668
|
var DOOR_HEALTH_EVENT_SOURCE = "door";
|
|
14373
14669
|
var QUOTA_EXPIRING_EVENT_SOURCE = "quota-expiring";
|
|
14374
|
-
var DoorEventSchema =
|
|
14375
|
-
source:
|
|
14670
|
+
var DoorEventSchema = import_zod25.z.strictObject({
|
|
14671
|
+
source: import_zod25.z.string().min(1),
|
|
14376
14672
|
/** A positive integer because the backbone's counters start at one and only ever increase. */
|
|
14377
|
-
sequence:
|
|
14378
|
-
payload:
|
|
14673
|
+
sequence: import_zod25.z.number().int().positive(),
|
|
14674
|
+
payload: import_zod25.z.unknown()
|
|
14379
14675
|
});
|
|
14380
|
-
var DoorEventSourceQuerySchema =
|
|
14381
|
-
sources:
|
|
14676
|
+
var DoorEventSourceQuerySchema = import_zod25.z.strictObject({
|
|
14677
|
+
sources: import_zod25.z.array(import_zod25.z.string().min(1)).min(1).optional()
|
|
14382
14678
|
});
|
|
14383
|
-
var LaunchLifecycleEventSchema =
|
|
14384
|
-
kind:
|
|
14385
|
-
pid:
|
|
14386
|
-
startedAt:
|
|
14387
|
-
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()
|
|
14388
14684
|
});
|
|
14389
|
-
var DoorHealthEventSchema =
|
|
14390
|
-
|
|
14391
|
-
|
|
14392
|
-
|
|
14393
|
-
|
|
14394
|
-
|
|
14395
|
-
|
|
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() })
|
|
14396
14692
|
]);
|
|
14397
|
-
var QuotaExpiringEventSchema =
|
|
14398
|
-
identity:
|
|
14399
|
-
provider:
|
|
14400
|
-
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"]),
|
|
14401
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. */
|
|
14402
|
-
utilization:
|
|
14403
|
-
resetsAt:
|
|
14404
|
-
observedAt:
|
|
14698
|
+
utilization: import_zod25.z.number().min(0).max(1),
|
|
14699
|
+
resetsAt: import_zod25.z.iso.datetime(),
|
|
14700
|
+
observedAt: import_zod25.z.number()
|
|
14405
14701
|
});
|
|
14406
14702
|
|
|
14407
14703
|
// src/frontdoor/eventsApi.ts
|
|
@@ -14485,51 +14781,51 @@ init_cliError();
|
|
|
14485
14781
|
|
|
14486
14782
|
// src/frontdoor/launchSchemas.ts
|
|
14487
14783
|
var import_node_path31 = __toESM(require("node:path"), 1);
|
|
14488
|
-
var
|
|
14784
|
+
var import_zod26 = require("zod");
|
|
14489
14785
|
init_claudeVersion();
|
|
14490
14786
|
init_identity();
|
|
14491
|
-
var LaunchResolveInputSchema =
|
|
14492
|
-
path:
|
|
14787
|
+
var LaunchResolveInputSchema = import_zod26.z.strictObject({
|
|
14788
|
+
path: import_zod26.z.string().min(1),
|
|
14493
14789
|
/** `@name`, launch flags, then the arguments for `claude`; empty for a bare launch. */
|
|
14494
|
-
argv:
|
|
14790
|
+
argv: import_zod26.z.readonly(import_zod26.z.array(import_zod26.z.string())).optional(),
|
|
14495
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. */
|
|
14496
|
-
env:
|
|
14792
|
+
env: import_zod26.z.record(import_zod26.z.string(), import_zod26.z.string()).optional()
|
|
14497
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" });
|
|
14498
|
-
var LaunchPoolDecisionSchema =
|
|
14499
|
-
name:
|
|
14500
|
-
reasons:
|
|
14501
|
-
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()
|
|
14502
14798
|
});
|
|
14503
|
-
var LaunchDecisionSchema =
|
|
14504
|
-
identity:
|
|
14505
|
-
identitySource:
|
|
14799
|
+
var LaunchDecisionSchema = import_zod26.z.strictObject({
|
|
14800
|
+
identity: import_zod26.z.string().optional(),
|
|
14801
|
+
identitySource: import_zod26.z.enum(IDENTITY_DECISION_SOURCES),
|
|
14506
14802
|
pool: LaunchPoolDecisionSchema.optional(),
|
|
14507
|
-
configDirEscapeHatch:
|
|
14508
|
-
configDir:
|
|
14509
|
-
configProfile:
|
|
14510
|
-
configProfileSource:
|
|
14511
|
-
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()
|
|
14512
14808
|
});
|
|
14513
|
-
var LaunchFlagsSchema =
|
|
14514
|
-
skipPermissions:
|
|
14515
|
-
remoteControl:
|
|
14516
|
-
headroom:
|
|
14517
|
-
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()
|
|
14518
14814
|
});
|
|
14519
|
-
var LaunchResolveOutputSchema =
|
|
14815
|
+
var LaunchResolveOutputSchema = import_zod26.z.strictObject({
|
|
14520
14816
|
decision: LaunchDecisionSchema,
|
|
14521
14817
|
flags: LaunchFlagsSchema,
|
|
14522
|
-
claudeVersion:
|
|
14818
|
+
claudeVersion: import_zod26.z.strictObject({ version: import_zod26.z.string(), source: import_zod26.z.enum(CLAUDE_VERSION_SOURCES) }).optional(),
|
|
14523
14819
|
/** The real `claude` binary the launch would spawn, on the door's host. */
|
|
14524
|
-
bin:
|
|
14820
|
+
bin: import_zod26.z.string(),
|
|
14525
14821
|
/** The arguments the launch would pass it: the tool's own flags, then `CLAUDE_EXTRA_FLAGS`, then the caller's own. */
|
|
14526
|
-
args:
|
|
14822
|
+
args: import_zod26.z.readonly(import_zod26.z.array(import_zod26.z.string())),
|
|
14527
14823
|
/** The credential the launch would authenticate with, by target and source kinds. Absent when none applies. */
|
|
14528
|
-
credential:
|
|
14529
|
-
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() }),
|
|
14530
14826
|
/** The names of the environment variables the launch would set or unset, sorted. Values are not reported. */
|
|
14531
|
-
environment:
|
|
14532
|
-
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()))
|
|
14533
14829
|
});
|
|
14534
14830
|
|
|
14535
14831
|
// src/frontdoor/launchApi.ts
|
|
@@ -14562,6 +14858,71 @@ function createLaunchApiRouter(deps) {
|
|
|
14562
14858
|
};
|
|
14563
14859
|
}
|
|
14564
14860
|
|
|
14861
|
+
// src/frontdoor/agentTreesApi.ts
|
|
14862
|
+
var import_client6 = require("@orpc/client");
|
|
14863
|
+
var import_openapi7 = require("@orpc/openapi");
|
|
14864
|
+
var import_zod27 = require("zod");
|
|
14865
|
+
init_cliError();
|
|
14866
|
+
var AgentTreesListInputSchema = import_zod27.z.strictObject({
|
|
14867
|
+
/** Only this identity's sessions. */
|
|
14868
|
+
identity: import_zod27.z.string().optional(),
|
|
14869
|
+
/** Include sessions that spawned no agent and ran no workflow. */
|
|
14870
|
+
all: import_zod27.z.boolean().optional()
|
|
14871
|
+
});
|
|
14872
|
+
var AgentTreesListOutputSchema = import_zod27.z.array(SessionSummarySchema);
|
|
14873
|
+
var AgentTreesShowInputSchema = import_zod27.z.strictObject({
|
|
14874
|
+
/** A session id, or an unambiguous prefix of one. */
|
|
14875
|
+
session: import_zod27.z.string().min(1),
|
|
14876
|
+
/** Look only in this identity. */
|
|
14877
|
+
identity: import_zod27.z.string().optional()
|
|
14878
|
+
});
|
|
14879
|
+
var AgentTreesShowOutputSchema = import_zod27.z.strictObject({ identities: import_zod27.z.array(import_zod27.z.string()), ...MergedAgentTreeSchema.shape });
|
|
14880
|
+
function asBadRequest(error) {
|
|
14881
|
+
if (error instanceof CliError) {
|
|
14882
|
+
throw new import_client6.ORPCError("BAD_REQUEST", { message: error.message });
|
|
14883
|
+
}
|
|
14884
|
+
throw error;
|
|
14885
|
+
}
|
|
14886
|
+
function createAgentTreesApiRouter(deps) {
|
|
14887
|
+
const authed = doorApiAuth(deps.expectedToken);
|
|
14888
|
+
return {
|
|
14889
|
+
agentTrees: {
|
|
14890
|
+
list: authed.meta(
|
|
14891
|
+
(0, import_openapi7.openapi)({
|
|
14892
|
+
method: "POST",
|
|
14893
|
+
path: "/rest/agent-trees/list",
|
|
14894
|
+
summary: "List the sessions that spawned agents or ran workflows, newest transcript first",
|
|
14895
|
+
tags: [SESSION_HISTORY_TAG],
|
|
14896
|
+
// A POST because the filters are a body, but the answer changes nothing.
|
|
14897
|
+
spec: (current) => ({ ...current, [READ_ONLY_OPERATION_EXTENSION]: true })
|
|
14898
|
+
})
|
|
14899
|
+
).input(AgentTreesListInputSchema).output(AgentTreesListOutputSchema).handler(({ input }) => {
|
|
14900
|
+
try {
|
|
14901
|
+
return deps.sessionList(input).map((session) => ({ ...session, identities: [...session.identities] }));
|
|
14902
|
+
} catch (error) {
|
|
14903
|
+
return asBadRequest(error);
|
|
14904
|
+
}
|
|
14905
|
+
}),
|
|
14906
|
+
show: authed.meta(
|
|
14907
|
+
(0, import_openapi7.openapi)({
|
|
14908
|
+
method: "POST",
|
|
14909
|
+
path: "/rest/agent-trees/show",
|
|
14910
|
+
summary: "Show one session's agent tree, task list and workflow runs, with the live Remote Control tasks merged in",
|
|
14911
|
+
tags: [SESSION_HISTORY_TAG],
|
|
14912
|
+
spec: (current) => ({ ...current, [READ_ONLY_OPERATION_EXTENSION]: true })
|
|
14913
|
+
})
|
|
14914
|
+
).input(AgentTreesShowInputSchema).output(AgentTreesShowOutputSchema).handler(({ input }) => {
|
|
14915
|
+
try {
|
|
14916
|
+
const view = deps.sessionShow(input.session, input.identity);
|
|
14917
|
+
return { identities: [...view.identities], ...mergeLiveTasks(view.tree, deps.liveTasks()) };
|
|
14918
|
+
} catch (error) {
|
|
14919
|
+
return asBadRequest(error);
|
|
14920
|
+
}
|
|
14921
|
+
})
|
|
14922
|
+
}
|
|
14923
|
+
};
|
|
14924
|
+
}
|
|
14925
|
+
|
|
14565
14926
|
// src/frontdoor/controlApi.ts
|
|
14566
14927
|
var USAGE_API_TAG = "usage";
|
|
14567
14928
|
var FRONTDOOR_API_TAG2 = "frontdoor";
|
|
@@ -14572,12 +14933,12 @@ function createControlApiRouter(deps) {
|
|
|
14572
14933
|
const authed = doorApiAuth(deps.expectedToken);
|
|
14573
14934
|
return {
|
|
14574
14935
|
usage: {
|
|
14575
|
-
list: authed.meta((0,
|
|
14576
|
-
resets: authed.meta((0,
|
|
14577
|
-
effectiveWindow: authed.meta((0,
|
|
14936
|
+
list: authed.meta((0, import_openapi8.openapi)({ method: "GET", path: "/rest/usage/snapshots", summary: "List every identity's usage snapshot", tags: [USAGE_API_TAG] })).output(UsageListOutputSchema).handler(() => ({ snapshots: deps.usageSnapshots() })),
|
|
14937
|
+
resets: authed.meta((0, import_openapi8.openapi)({ method: "GET", path: "/rest/usage/resets", summary: "List every recorded quota window with when it resets", tags: [USAGE_API_TAG] })).output(ResetScheduleSchema).handler(() => collectResets(deps.usageSnapshots(), deps.now())),
|
|
14938
|
+
effectiveWindow: authed.meta((0, import_openapi8.openapi)({ method: "GET", path: "/rest/usage/windows", summary: "Read one identity's effective quota windows", tags: [USAGE_API_TAG] })).input(UsageWindowsInputSchema).output(UsageWindowsOutputSchema).handler(({ input }) => {
|
|
14578
14939
|
const snapshot = deps.usageSnapshotOf(input.identity);
|
|
14579
14940
|
if (snapshot === void 0) {
|
|
14580
|
-
throw new
|
|
14941
|
+
throw new import_client7.ORPCError("NOT_FOUND", { message: `identity ${input.identity} has no usage snapshot yet, so no quota window has been observed for it` });
|
|
14581
14942
|
}
|
|
14582
14943
|
const provider = input.provider ?? ANTHROPIC_PROVIDER;
|
|
14583
14944
|
const rateLimit = snapshot.providers[provider]?.rateLimit;
|
|
@@ -14591,34 +14952,34 @@ function createControlApiRouter(deps) {
|
|
|
14591
14952
|
...unified?.sevenDay === void 0 ? {} : { sevenDay: effectiveWindow(unified.sevenDay, now) }
|
|
14592
14953
|
};
|
|
14593
14954
|
}),
|
|
14594
|
-
live: authed.meta((0,
|
|
14955
|
+
live: authed.meta((0, import_openapi8.openapi)({ method: "GET", path: "/rest/usage/live", summary: "Read the live rate-limit observations the event backbone files", tags: [USAGE_API_TAG] })).input(RcSessionQuerySchema).output(UsageLiveOutputSchema).handler(({ input }) => {
|
|
14595
14956
|
const sessions = deps.liveRateLimits(input.session);
|
|
14596
14957
|
if (input.session !== void 0 && sessions.length === 0) {
|
|
14597
14958
|
if (deps.list().some((session) => session.id === input.session)) {
|
|
14598
|
-
throw new
|
|
14959
|
+
throw new import_client7.ORPCError("NOT_FOUND", { message: `session ${input.session} has filed no rate_limit_event on its stream yet: the worker emits one only once a turn has completed, so retry after this session's next turn` });
|
|
14599
14960
|
}
|
|
14600
|
-
throw new
|
|
14961
|
+
throw new import_client7.ORPCError("NOT_FOUND", { message: rcSessionNotObservedMessage(input.session) });
|
|
14601
14962
|
}
|
|
14602
14963
|
return { latest: deps.latestRateLimit(), sessions };
|
|
14603
14964
|
})
|
|
14604
14965
|
},
|
|
14605
14966
|
frontdoor: {
|
|
14606
|
-
status: authed.meta((0,
|
|
14607
|
-
sessions: authed.meta((0,
|
|
14967
|
+
status: authed.meta((0, import_openapi8.openapi)({ method: "GET", path: "/rest/frontdoor/status", summary: "Read the front door's status", tags: [FRONTDOOR_API_TAG2] })).output(FrontDoorStatusOutputSchema).handler(() => deps.frontDoorStatus()),
|
|
14968
|
+
sessions: authed.meta((0, import_openapi8.openapi)({ method: "GET", path: "/rest/frontdoor/sessions", summary: "Read the front door's session registry", tags: [FRONTDOOR_API_TAG2] })).output(FrontDoorSessionsOutputSchema).handler(() => ({ sessions: deps.frontDoorStatus().sessions }))
|
|
14608
14969
|
},
|
|
14609
14970
|
check: {
|
|
14610
14971
|
// The report's own JSON shape is the contract (the same one `check --json` prints and `checkReportSchema.ts` defines), so the procedure returns exactly that conversion.
|
|
14611
|
-
run: authed.meta((0,
|
|
14972
|
+
run: authed.meta((0, import_openapi8.openapi)({ method: "GET", path: "/rest/check", summary: "Run the check report for one directory", tags: [CHECK_API_TAG] })).input(CheckRunInputSchema).output(CheckReportJsonSchema).handler(({ input }) => checkReportToJson(deps.checkReport(input.path, input.identity)))
|
|
14612
14973
|
},
|
|
14613
14974
|
doctor: {
|
|
14614
|
-
run: authed.meta((0,
|
|
14975
|
+
run: authed.meta((0, import_openapi8.openapi)({ method: "GET", path: "/rest/doctor", summary: "Run the doctor report", tags: [DOCTOR_API_TAG] })).output(DoctorRunOutputSchema).handler(() => deps.doctorReport())
|
|
14615
14976
|
},
|
|
14616
14977
|
pool: {
|
|
14617
|
-
pick: authed.meta((0,
|
|
14978
|
+
pick: authed.meta((0, import_openapi8.openapi)({ method: "GET", path: "/rest/pool/pick", summary: "Rank one pool exactly as a launch from a directory would right now", tags: [POOL_API_TAG] })).input(PoolPickInputSchema).output(PoolPickReportSchema).handler(({ input }) => {
|
|
14618
14979
|
const report = deps.poolPick(input.pool, input.path);
|
|
14619
14980
|
if (report === void 0) {
|
|
14620
14981
|
const live = deps.poolNames();
|
|
14621
|
-
throw new
|
|
14982
|
+
throw new import_client7.ORPCError("NOT_FOUND", {
|
|
14622
14983
|
message: live.length === 0 ? `no pools are configured, so none is named ${input.pool}` : `no pool is named ${input.pool}; the live pools are ${live.map((name) => `"${name}"`).join(", ")}`
|
|
14623
14984
|
});
|
|
14624
14985
|
}
|
|
@@ -14630,13 +14991,13 @@ function createControlApiRouter(deps) {
|
|
|
14630
14991
|
function createDoorApiRouter(deps) {
|
|
14631
14992
|
const control = createControlApiRouter(deps);
|
|
14632
14993
|
const lifecycle = createLifecycleApiRouter(deps);
|
|
14633
|
-
return { ...createRcApiRouter(deps), ...control, ...lifecycle, ...createConfigApiRouter(deps), ...createCodexApiRouter(deps), ...createLaunchApiRouter(deps), ...createEventsApiRouter(deps), frontdoor: { ...control.frontdoor, ...lifecycle.frontdoor } };
|
|
14994
|
+
return { ...createRcApiRouter(deps), ...control, ...lifecycle, ...createConfigApiRouter(deps), ...createCodexApiRouter(deps), ...createLaunchApiRouter(deps), ...createAgentTreesApiRouter(deps), ...createEventsApiRouter(deps), frontdoor: { ...control.frontdoor, ...lifecycle.frontdoor } };
|
|
14634
14995
|
}
|
|
14635
14996
|
function createDoorApiNodeHandler(deps) {
|
|
14636
14997
|
return doorApiNodeHandlerOf(createDoorApiRouter(deps), deps.expectedToken);
|
|
14637
14998
|
}
|
|
14638
14999
|
function frontDoorApiClient(port, ca, token) {
|
|
14639
|
-
return (0,
|
|
15000
|
+
return (0, import_client7.createORPCClient)(frontDoorApiLink(port, ca, token));
|
|
14640
15001
|
}
|
|
14641
15002
|
|
|
14642
15003
|
// src/frontdoor/doorClient.ts
|
|
@@ -14961,15 +15322,15 @@ function createQuotaExpiringPublisher(hub, deps) {
|
|
|
14961
15322
|
|
|
14962
15323
|
// src/frontdoor/rcLiveUsage.ts
|
|
14963
15324
|
var RC_RATE_LIMIT_EVENT_TYPE = "rate_limit_event";
|
|
14964
|
-
function
|
|
15325
|
+
function isRecord6(value) {
|
|
14965
15326
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
14966
15327
|
}
|
|
14967
15328
|
function rcRateLimitInfoOf(event) {
|
|
14968
15329
|
const payload = event.envelope.payload;
|
|
14969
|
-
if (!
|
|
15330
|
+
if (!isRecord6(payload) || payload.type !== RC_RATE_LIMIT_EVENT_TYPE) {
|
|
14970
15331
|
return void 0;
|
|
14971
15332
|
}
|
|
14972
|
-
if (!
|
|
15333
|
+
if (!isRecord6(payload.rate_limit_info)) {
|
|
14973
15334
|
return void 0;
|
|
14974
15335
|
}
|
|
14975
15336
|
const parsed = RcRateLimitInfoSchema.safeParse(payload.rate_limit_info);
|
|
@@ -15057,7 +15418,7 @@ function createSseParser() {
|
|
|
15057
15418
|
}
|
|
15058
15419
|
};
|
|
15059
15420
|
}
|
|
15060
|
-
function
|
|
15421
|
+
function isRecord7(value) {
|
|
15061
15422
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
15062
15423
|
}
|
|
15063
15424
|
function sequenceNumOf(value) {
|
|
@@ -15079,7 +15440,7 @@ function parseRcStreamEnvelope(parsed) {
|
|
|
15079
15440
|
} catch {
|
|
15080
15441
|
return void 0;
|
|
15081
15442
|
}
|
|
15082
|
-
if (!
|
|
15443
|
+
if (!isRecord7(data)) {
|
|
15083
15444
|
return void 0;
|
|
15084
15445
|
}
|
|
15085
15446
|
const eventType = data.event_type;
|
|
@@ -15320,7 +15681,7 @@ init_capability();
|
|
|
15320
15681
|
// src/frontdoor/rcSelfHostEndpoints.ts
|
|
15321
15682
|
var RC_SOURCE_WORKER = "worker";
|
|
15322
15683
|
var RC_SOURCE_CLIENT = "client";
|
|
15323
|
-
function
|
|
15684
|
+
function isRecord8(value) {
|
|
15324
15685
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
15325
15686
|
}
|
|
15326
15687
|
function parseJsonObject2(body) {
|
|
@@ -15330,7 +15691,7 @@ function parseJsonObject2(body) {
|
|
|
15330
15691
|
} catch {
|
|
15331
15692
|
return void 0;
|
|
15332
15693
|
}
|
|
15333
|
-
return
|
|
15694
|
+
return isRecord8(parsed) ? parsed : void 0;
|
|
15334
15695
|
}
|
|
15335
15696
|
function nonEmptyString2(record, field) {
|
|
15336
15697
|
const value = record === void 0 ? void 0 : record[field];
|
|
@@ -15404,7 +15765,7 @@ async function serveRcClientChannels(ctx, tail, method, maxBatchEvents) {
|
|
|
15404
15765
|
}
|
|
15405
15766
|
const results = [];
|
|
15406
15767
|
for (const event of events) {
|
|
15407
|
-
if (!
|
|
15768
|
+
if (!isRecord8(event) || !isRecord8(event.payload)) {
|
|
15408
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" } });
|
|
15409
15770
|
return true;
|
|
15410
15771
|
}
|
|
@@ -15504,7 +15865,7 @@ async function serveRcCompatSessions(ctx, pathname, compatPath) {
|
|
|
15504
15865
|
// src/frontdoor/rcSelfHostConversations.ts
|
|
15505
15866
|
var RC_CONVERSATIONS_PATH_PREFIX = "/v1/code/conversations";
|
|
15506
15867
|
var RC_CONVERSATION_ID_PREFIX = "conv_";
|
|
15507
|
-
function
|
|
15868
|
+
function isRecord9(value) {
|
|
15508
15869
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
15509
15870
|
}
|
|
15510
15871
|
function parseJsonObject3(body) {
|
|
@@ -15514,7 +15875,7 @@ function parseJsonObject3(body) {
|
|
|
15514
15875
|
} catch {
|
|
15515
15876
|
return void 0;
|
|
15516
15877
|
}
|
|
15517
|
-
return
|
|
15878
|
+
return isRecord9(parsed) ? parsed : void 0;
|
|
15518
15879
|
}
|
|
15519
15880
|
function nonEmptyString3(record, field) {
|
|
15520
15881
|
const value = record === void 0 ? void 0 : record[field];
|
|
@@ -15568,7 +15929,7 @@ async function serveRcConversations(ctx, pathname, method) {
|
|
|
15568
15929
|
}
|
|
15569
15930
|
const results = [];
|
|
15570
15931
|
for (const event of events) {
|
|
15571
|
-
if (!
|
|
15932
|
+
if (!isRecord9(event) || !isRecord9(event.payload)) {
|
|
15572
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" } });
|
|
15573
15934
|
return;
|
|
15574
15935
|
}
|
|
@@ -15600,7 +15961,7 @@ var RC_SELF_HOST_SCOPE_LIST = ["user:profile", "user:inference", "user:sessions:
|
|
|
15600
15961
|
var RC_SELF_HOST_OAUTH_TOKEN_TTL_SECONDS = 3600;
|
|
15601
15962
|
var MS_PER_SECOND5 = 1e3;
|
|
15602
15963
|
var HTTP_SERVICE_UNAVAILABLE = 503;
|
|
15603
|
-
function
|
|
15964
|
+
function isRecord10(value) {
|
|
15604
15965
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
15605
15966
|
}
|
|
15606
15967
|
function parseJsonObject4(body) {
|
|
@@ -15610,7 +15971,7 @@ function parseJsonObject4(body) {
|
|
|
15610
15971
|
} catch {
|
|
15611
15972
|
return void 0;
|
|
15612
15973
|
}
|
|
15613
|
-
return
|
|
15974
|
+
return isRecord10(parsed) ? parsed : void 0;
|
|
15614
15975
|
}
|
|
15615
15976
|
function growthBookFeatures() {
|
|
15616
15977
|
return {
|
|
@@ -15964,7 +16325,7 @@ var RC_SELF_HOST_WORKER_EPOCH = 1;
|
|
|
15964
16325
|
var RC_STREAM_EVENT_NAME2 = "client_event";
|
|
15965
16326
|
var CONFLICT_REASON_HEADER2 = "x-ccr-conflict-reason";
|
|
15966
16327
|
var CONFLICT_REASON_EPOCH_STALE = "epoch_stale";
|
|
15967
|
-
function
|
|
16328
|
+
function isRecord11(value) {
|
|
15968
16329
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
15969
16330
|
}
|
|
15970
16331
|
function isWebSearchRefusal(value) {
|
|
@@ -16048,7 +16409,7 @@ function parseJsonObject5(body) {
|
|
|
16048
16409
|
} catch {
|
|
16049
16410
|
return void 0;
|
|
16050
16411
|
}
|
|
16051
|
-
return
|
|
16412
|
+
return isRecord11(parsed) ? parsed : void 0;
|
|
16052
16413
|
}
|
|
16053
16414
|
function mintWorkerJwt(randomToken, issuedAt) {
|
|
16054
16415
|
const encode = (value) => Buffer.from(JSON.stringify(value), "utf8").toString("base64url");
|
|
@@ -16308,7 +16669,7 @@ data: ${JSON.stringify(envelope)}
|
|
|
16308
16669
|
if (status !== void 0) {
|
|
16309
16670
|
session.workerStatus = status;
|
|
16310
16671
|
}
|
|
16311
|
-
if (
|
|
16672
|
+
if (isRecord11(body?.external_metadata)) {
|
|
16312
16673
|
session.externalMetadata = body.external_metadata;
|
|
16313
16674
|
}
|
|
16314
16675
|
await answerJson2(response, HTTP_STATUS.ok, {});
|
|
@@ -16338,7 +16699,7 @@ data: ${JSON.stringify(envelope)}
|
|
|
16338
16699
|
}
|
|
16339
16700
|
const results = [];
|
|
16340
16701
|
for (const event of events) {
|
|
16341
|
-
if (!
|
|
16702
|
+
if (!isRecord11(event) || !isRecord11(event.payload)) {
|
|
16342
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" } });
|
|
16343
16704
|
return;
|
|
16344
16705
|
}
|
|
@@ -16371,7 +16732,7 @@ data: ${JSON.stringify(envelope)}
|
|
|
16371
16732
|
return;
|
|
16372
16733
|
}
|
|
16373
16734
|
for (const event of events) {
|
|
16374
|
-
if (
|
|
16735
|
+
if (isRecord11(event)) {
|
|
16375
16736
|
session.internalEvents.push({ eventId: deps.newUuid(), body: event });
|
|
16376
16737
|
}
|
|
16377
16738
|
}
|
|
@@ -16467,7 +16828,7 @@ data: ${JSON.stringify(envelope)}
|
|
|
16467
16828
|
}
|
|
16468
16829
|
const results = [];
|
|
16469
16830
|
for (const event of events) {
|
|
16470
|
-
if (!
|
|
16831
|
+
if (!isRecord11(event) || !isRecord11(event.payload)) {
|
|
16471
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" } });
|
|
16472
16833
|
return;
|
|
16473
16834
|
}
|
|
@@ -16604,7 +16965,7 @@ var RC_SELF_HOST_RECORD_DIR = "rc-selfhost";
|
|
|
16604
16965
|
var RC_SELF_HOST_RECORD_FILE = "credential.json";
|
|
16605
16966
|
var SELF_HOST_EMAIL = "selfhost@agent-shim.invalid";
|
|
16606
16967
|
var SELF_HOST_SUBSCRIPTION_TYPE = "max";
|
|
16607
|
-
function
|
|
16968
|
+
function isRecord12(value) {
|
|
16608
16969
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
16609
16970
|
}
|
|
16610
16971
|
function readJsonObject(fs12, file) {
|
|
@@ -16618,7 +16979,7 @@ function readJsonObject(fs12, file) {
|
|
|
16618
16979
|
} catch {
|
|
16619
16980
|
return void 0;
|
|
16620
16981
|
}
|
|
16621
|
-
return
|
|
16982
|
+
return isRecord12(parsed) ? parsed : void 0;
|
|
16622
16983
|
}
|
|
16623
16984
|
function readRcSelfHostRecord(fs12, frontdoorDir) {
|
|
16624
16985
|
const parsed = readJsonObject(fs12, import_node_path32.default.join(frontdoorDir, RC_SELF_HOST_RECORD_DIR, RC_SELF_HOST_RECORD_FILE));
|
|
@@ -16642,7 +17003,7 @@ function mintRcSelfHostCredential(deps) {
|
|
|
16642
17003
|
const recordFile = import_node_path32.default.join(recordDir, RC_SELF_HOST_RECORD_FILE);
|
|
16643
17004
|
const previousRecord = readRcSelfHostRecord(deps.fs, deps.frontdoorDir);
|
|
16644
17005
|
const existingCredentials = readJsonObject(deps.fs, credentialsFile);
|
|
16645
|
-
const existingOauth =
|
|
17006
|
+
const existingOauth = isRecord12(existingCredentials?.claudeAiOauth) ? existingCredentials.claudeAiOauth : void 0;
|
|
16646
17007
|
const existingToken = typeof existingOauth?.accessToken === "string" && existingOauth.accessToken !== "" ? existingOauth.accessToken : void 0;
|
|
16647
17008
|
const existingIsOwn = existingToken !== void 0 && previousRecord?.accessToken === existingToken;
|
|
16648
17009
|
if (existingToken !== void 0 && !existingIsOwn && !deps.force) {
|
|
@@ -16659,7 +17020,7 @@ function mintRcSelfHostCredential(deps) {
|
|
|
16659
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)}
|
|
16660
17021
|
`);
|
|
16661
17022
|
const claudeJson = readJsonObject(deps.fs, claudeJsonFile) ?? {};
|
|
16662
|
-
const existingBlock = (value) =>
|
|
17023
|
+
const existingBlock = (value) => isRecord12(value) ? value : {};
|
|
16663
17024
|
deps.fs.writeFilePrivate(claudeJsonFile, `${JSON.stringify({
|
|
16664
17025
|
...claudeJson,
|
|
16665
17026
|
oauthAccount: {
|
|
@@ -16698,90 +17059,7 @@ init_poolPick();
|
|
|
16698
17059
|
|
|
16699
17060
|
// src/agents/read.ts
|
|
16700
17061
|
var import_node_path33 = __toESM(require("node:path"), 1);
|
|
16701
|
-
var
|
|
16702
|
-
|
|
16703
|
-
// src/agents/schema.ts
|
|
16704
|
-
var import_zod25 = require("zod");
|
|
16705
|
-
var AgentMetaSchema = import_zod25.z.looseObject({
|
|
16706
|
-
agentType: import_zod25.z.string(),
|
|
16707
|
-
isFork: import_zod25.z.boolean().optional(),
|
|
16708
|
-
description: import_zod25.z.string().optional(),
|
|
16709
|
-
name: import_zod25.z.string().optional(),
|
|
16710
|
-
toolUseId: import_zod25.z.string().optional(),
|
|
16711
|
-
spawnDepth: import_zod25.z.number().int().nonnegative().optional(),
|
|
16712
|
-
parentAgentId: import_zod25.z.string().optional(),
|
|
16713
|
-
model: import_zod25.z.string().optional(),
|
|
16714
|
-
requestShape: import_zod25.z.string().optional(),
|
|
16715
|
-
requestNonInteractive: import_zod25.z.boolean().optional(),
|
|
16716
|
-
workflowPhase: import_zod25.z.string().optional(),
|
|
16717
|
-
taskKind: import_zod25.z.string().optional(),
|
|
16718
|
-
teamName: import_zod25.z.string().optional(),
|
|
16719
|
-
worktreePath: import_zod25.z.string().optional(),
|
|
16720
|
-
worktreeBranch: import_zod25.z.string().optional(),
|
|
16721
|
-
stoppedByUser: import_zod25.z.boolean().optional()
|
|
16722
|
-
});
|
|
16723
|
-
var AgentKindSchema = import_zod25.z.enum(["subagent", "fork", "workflow-agent", "teammate"]);
|
|
16724
|
-
var AgentNodeSchema = import_zod25.z.lazy(
|
|
16725
|
-
() => import_zod25.z.strictObject({
|
|
16726
|
-
id: import_zod25.z.string(),
|
|
16727
|
-
kind: AgentKindSchema,
|
|
16728
|
-
agentType: import_zod25.z.string(),
|
|
16729
|
-
description: import_zod25.z.string().optional(),
|
|
16730
|
-
name: import_zod25.z.string().optional(),
|
|
16731
|
-
toolUseId: import_zod25.z.string().optional(),
|
|
16732
|
-
spawnDepth: import_zod25.z.number().int().nonnegative().optional(),
|
|
16733
|
-
model: import_zod25.z.string().optional(),
|
|
16734
|
-
background: import_zod25.z.boolean().optional(),
|
|
16735
|
-
workflowRunId: import_zod25.z.string().optional(),
|
|
16736
|
-
workflowPhase: import_zod25.z.string().optional(),
|
|
16737
|
-
teamName: import_zod25.z.string().optional(),
|
|
16738
|
-
stoppedByUser: import_zod25.z.boolean().optional(),
|
|
16739
|
-
transcript: import_zod25.z.string(),
|
|
16740
|
-
children: import_zod25.z.array(AgentNodeSchema)
|
|
16741
|
-
})
|
|
16742
|
-
);
|
|
16743
|
-
var TaskItemSchema = import_zod25.z.strictObject({
|
|
16744
|
-
id: import_zod25.z.string(),
|
|
16745
|
-
subject: import_zod25.z.string(),
|
|
16746
|
-
description: import_zod25.z.string().optional(),
|
|
16747
|
-
status: import_zod25.z.string(),
|
|
16748
|
-
/** What a spinner shows while the task runs. */
|
|
16749
|
-
activeForm: import_zod25.z.string().optional(),
|
|
16750
|
-
/** The teammate or agent name the task is assigned to, as Agent Teams writes it. */
|
|
16751
|
-
owner: import_zod25.z.string().optional(),
|
|
16752
|
-
/** Free-form data the harness attaches to a task, kept as written. */
|
|
16753
|
-
metadata: import_zod25.z.record(import_zod25.z.string(), import_zod25.z.unknown()).optional(),
|
|
16754
|
-
blocks: import_zod25.z.array(import_zod25.z.string()),
|
|
16755
|
-
blockedBy: import_zod25.z.array(import_zod25.z.string()),
|
|
16756
|
-
/** 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. */
|
|
16757
|
-
taskList: import_zod25.z.string().optional()
|
|
16758
|
-
});
|
|
16759
|
-
var WorkflowRunSchema = import_zod25.z.strictObject({
|
|
16760
|
-
runId: import_zod25.z.string(),
|
|
16761
|
-
workflowName: import_zod25.z.string().optional(),
|
|
16762
|
-
status: import_zod25.z.string().optional(),
|
|
16763
|
-
startTime: import_zod25.z.number().optional(),
|
|
16764
|
-
phases: import_zod25.z.array(import_zod25.z.string()),
|
|
16765
|
-
summary: import_zod25.z.string().optional()
|
|
16766
|
-
});
|
|
16767
|
-
var AgentTreeProblemSchema = import_zod25.z.strictObject({
|
|
16768
|
-
/** Relative to the identity's configuration directory. */
|
|
16769
|
-
path: import_zod25.z.string(),
|
|
16770
|
-
reason: import_zod25.z.string()
|
|
16771
|
-
});
|
|
16772
|
-
var SessionAgentTreeSchema = import_zod25.z.strictObject({
|
|
16773
|
-
project: import_zod25.z.string(),
|
|
16774
|
-
sessionId: import_zod25.z.string(),
|
|
16775
|
-
/** True for a session directory a resume superseded (`<session-id>.superseded-<epoch-ms>`). */
|
|
16776
|
-
superseded: import_zod25.z.boolean(),
|
|
16777
|
-
/** The agents the session itself spawned, each with its descendants. */
|
|
16778
|
-
agents: import_zod25.z.array(AgentNodeSchema),
|
|
16779
|
-
tasks: import_zod25.z.array(TaskItemSchema),
|
|
16780
|
-
workflowRuns: import_zod25.z.array(WorkflowRunSchema),
|
|
16781
|
-
problems: import_zod25.z.array(AgentTreeProblemSchema)
|
|
16782
|
-
});
|
|
16783
|
-
|
|
16784
|
-
// src/agents/read.ts
|
|
17062
|
+
var import_zod28 = require("zod");
|
|
16785
17063
|
var PROJECTS_DIR = "projects";
|
|
16786
17064
|
var TASKS_DIR = "tasks";
|
|
16787
17065
|
var SUBAGENTS_DIR = "subagents";
|
|
@@ -16900,15 +17178,30 @@ function parseJson2(text) {
|
|
|
16900
17178
|
return void 0;
|
|
16901
17179
|
}
|
|
16902
17180
|
}
|
|
16903
|
-
var TaskFileSchema =
|
|
16904
|
-
var WorkflowRunFileSchema =
|
|
16905
|
-
runId:
|
|
16906
|
-
workflowName:
|
|
16907
|
-
status:
|
|
16908
|
-
startTime:
|
|
16909
|
-
phases:
|
|
16910
|
-
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()
|
|
16911
17189
|
});
|
|
17190
|
+
function summariseSession(fs12, configDir, ref) {
|
|
17191
|
+
const sessionRelative = import_node_path33.default.join(PROJECTS_DIR, ref.project, ref.entry);
|
|
17192
|
+
const subagentsRelative = import_node_path33.default.join(sessionRelative, SUBAGENTS_DIR);
|
|
17193
|
+
const workflowsUnderSubagents = import_node_path33.default.join(subagentsRelative, WORKFLOWS_DIR);
|
|
17194
|
+
const isMeta = (name) => name.startsWith(AGENT_FILE_PREFIX) && name.endsWith(META_SUFFIX);
|
|
17195
|
+
let agentCount = fs12.readdir(import_node_path33.default.join(configDir, subagentsRelative)).filter(isMeta).length;
|
|
17196
|
+
for (const runDir of fs12.readdir(import_node_path33.default.join(configDir, workflowsUnderSubagents))) {
|
|
17197
|
+
if (runDir.startsWith(WORKFLOW_RUN_PREFIX)) {
|
|
17198
|
+
agentCount += fs12.readdir(import_node_path33.default.join(configDir, workflowsUnderSubagents, runDir)).filter(isMeta).length;
|
|
17199
|
+
}
|
|
17200
|
+
}
|
|
17201
|
+
const workflowRunCount = fs12.readdir(import_node_path33.default.join(configDir, sessionRelative, WORKFLOWS_DIR)).filter((name) => name.startsWith(WORKFLOW_RUN_PREFIX) && name.endsWith(JSON_SUFFIX)).length;
|
|
17202
|
+
const transcript = fs12.lstat(import_node_path33.default.join(configDir, PROJECTS_DIR, ref.project, `${ref.entry}${TRANSCRIPT_SUFFIX}`));
|
|
17203
|
+
return { ...ref, agentCount, workflowRunCount, ...transcript === void 0 ? {} : { updatedAt: new Date(transcript.mtimeMs).toISOString() } };
|
|
17204
|
+
}
|
|
16912
17205
|
function readSessionAgentTree(fs12, configDir, ref, options = {}) {
|
|
16913
17206
|
const problems = [];
|
|
16914
17207
|
const report = (problem) => {
|
|
@@ -17064,6 +17357,94 @@ function readWorkflowRuns(fs12, configDir, relativeDir, report) {
|
|
|
17064
17357
|
return runs;
|
|
17065
17358
|
}
|
|
17066
17359
|
|
|
17360
|
+
// src/agents/sessions.ts
|
|
17361
|
+
var import_node_path34 = __toESM(require("node:path"), 1);
|
|
17362
|
+
init_cliError();
|
|
17363
|
+
var SessionLookupError = class extends CliError {
|
|
17364
|
+
constructor(message) {
|
|
17365
|
+
super(message);
|
|
17366
|
+
this.name = "SessionLookupError";
|
|
17367
|
+
}
|
|
17368
|
+
};
|
|
17369
|
+
function identityConfigDir(identitiesDir, identity) {
|
|
17370
|
+
return import_node_path34.default.join(identitiesDir, identity);
|
|
17371
|
+
}
|
|
17372
|
+
function historyStores(fs12, identitiesDir, identities) {
|
|
17373
|
+
const byRealPath = /* @__PURE__ */ new Map();
|
|
17374
|
+
for (const identity of identities) {
|
|
17375
|
+
const configDir = identityConfigDir(identitiesDir, identity);
|
|
17376
|
+
const real = fs12.realpath(import_node_path34.default.join(configDir, "projects"));
|
|
17377
|
+
if (real === void 0) {
|
|
17378
|
+
continue;
|
|
17379
|
+
}
|
|
17380
|
+
const store = byRealPath.get(real);
|
|
17381
|
+
if (store === void 0) {
|
|
17382
|
+
byRealPath.set(real, { configDir, identities: [identity] });
|
|
17383
|
+
} else {
|
|
17384
|
+
store.identities.push(identity);
|
|
17385
|
+
}
|
|
17386
|
+
}
|
|
17387
|
+
return [...byRealPath.values()];
|
|
17388
|
+
}
|
|
17389
|
+
function collectSessionList(fs12, identitiesDir, identities, filters) {
|
|
17390
|
+
const names = filters.identity === void 0 ? identities : identities.filter((name) => name === filters.identity);
|
|
17391
|
+
if (filters.identity !== void 0 && names.length === 0) {
|
|
17392
|
+
throw new SessionLookupError(`no identity named "${filters.identity}"`);
|
|
17393
|
+
}
|
|
17394
|
+
const sessions = [];
|
|
17395
|
+
for (const store of historyStores(fs12, identitiesDir, names)) {
|
|
17396
|
+
for (const ref of listSessions2(fs12, store.configDir)) {
|
|
17397
|
+
const summary = summariseSession(fs12, store.configDir, ref);
|
|
17398
|
+
if (filters.all === true || summary.agentCount > 0 || summary.workflowRunCount > 0) {
|
|
17399
|
+
sessions.push({ ...summary, identities: store.identities });
|
|
17400
|
+
}
|
|
17401
|
+
}
|
|
17402
|
+
}
|
|
17403
|
+
return sessions.sort((left, right) => (right.updatedAt ?? "").localeCompare(left.updatedAt ?? "") || left.sessionId.localeCompare(right.sessionId));
|
|
17404
|
+
}
|
|
17405
|
+
function locateSession(fs12, identitiesDir, identities, query, onlyIdentity) {
|
|
17406
|
+
const names = onlyIdentity === void 0 ? identities : identities.filter((name) => name === onlyIdentity);
|
|
17407
|
+
if (onlyIdentity !== void 0 && names.length === 0) {
|
|
17408
|
+
throw new SessionLookupError(`no identity named "${onlyIdentity}"`);
|
|
17409
|
+
}
|
|
17410
|
+
const matches = [];
|
|
17411
|
+
for (const store of historyStores(fs12, identitiesDir, names)) {
|
|
17412
|
+
for (const ref of listSessions2(fs12, store.configDir)) {
|
|
17413
|
+
if (ref.sessionId.startsWith(query)) {
|
|
17414
|
+
matches.push({ identities: store.identities, configDir: store.configDir, ref });
|
|
17415
|
+
}
|
|
17416
|
+
}
|
|
17417
|
+
}
|
|
17418
|
+
const exact = matches.filter((match) => match.ref.sessionId === query);
|
|
17419
|
+
const candidates = exact.length > 0 ? exact : matches;
|
|
17420
|
+
const only = candidates[0];
|
|
17421
|
+
if (candidates.length === 1 && only !== void 0) {
|
|
17422
|
+
return only;
|
|
17423
|
+
}
|
|
17424
|
+
if (candidates.length === 0) {
|
|
17425
|
+
throw new SessionLookupError(`no session matches "${query}"`);
|
|
17426
|
+
}
|
|
17427
|
+
throw new SessionLookupError(`"${query}" matches ${String(candidates.length)} sessions: ${candidates.map((match) => `${match.ref.sessionId} (${match.identities.join(", ")})`).join("; ")}; give more of the id or pass --identity`);
|
|
17428
|
+
}
|
|
17429
|
+
function showSession(fs12, identitiesDir, identities, query, onlyIdentity) {
|
|
17430
|
+
const located = locateSession(fs12, identitiesDir, identities, query, onlyIdentity);
|
|
17431
|
+
return { identities: located.identities, tree: readSessionAgentTree(fs12, located.configDir, located.ref) };
|
|
17432
|
+
}
|
|
17433
|
+
|
|
17434
|
+
// src/agents/realFs.ts
|
|
17435
|
+
var import_node_fs10 = __toESM(require("node:fs"), 1);
|
|
17436
|
+
init_realPorts();
|
|
17437
|
+
var realSessionFs = {
|
|
17438
|
+
...realFarmFs,
|
|
17439
|
+
realpath: (candidate) => {
|
|
17440
|
+
try {
|
|
17441
|
+
return import_node_fs10.default.realpathSync(candidate);
|
|
17442
|
+
} catch {
|
|
17443
|
+
return void 0;
|
|
17444
|
+
}
|
|
17445
|
+
}
|
|
17446
|
+
};
|
|
17447
|
+
|
|
17067
17448
|
// src/index.ts
|
|
17068
17449
|
init_conditions();
|
|
17069
17450
|
init_ensure();
|
|
@@ -17176,6 +17557,10 @@ init_ownCli();
|
|
|
17176
17557
|
AgentKindSchema,
|
|
17177
17558
|
AgentMetaSchema,
|
|
17178
17559
|
AgentNodeSchema,
|
|
17560
|
+
AgentTreesListInputSchema,
|
|
17561
|
+
AgentTreesListOutputSchema,
|
|
17562
|
+
AgentTreesShowInputSchema,
|
|
17563
|
+
AgentTreesShowOutputSchema,
|
|
17179
17564
|
CHECK_CREDENTIAL_APPLIES,
|
|
17180
17565
|
CODEX_APP_SERVER_GENERATED_AGAINST,
|
|
17181
17566
|
CODEX_APP_SERVER_TIMEOUT_MS,
|
|
@@ -17271,11 +17656,15 @@ init_ownCli();
|
|
|
17271
17656
|
InvalidIdentityNameError,
|
|
17272
17657
|
InvalidProviderNameError,
|
|
17273
17658
|
LAUNCH_EVENT_SOURCE,
|
|
17659
|
+
LIVE_TASK_CAP,
|
|
17274
17660
|
LaunchLifecycleEventSchema,
|
|
17275
17661
|
LaunchRefusedError,
|
|
17276
17662
|
LaunchResolveInputSchema,
|
|
17277
17663
|
LaunchResolveOutputSchema,
|
|
17278
17664
|
LegacyProviderFileError,
|
|
17665
|
+
LiveTaskSchema,
|
|
17666
|
+
MergedAgentNodeSchema,
|
|
17667
|
+
MergedAgentTreeSchema,
|
|
17279
17668
|
OWN_CLI_FILE_NAME,
|
|
17280
17669
|
PROMPT_CACHE_TTL_MS,
|
|
17281
17670
|
PlanClassSchema,
|
|
@@ -17323,6 +17712,8 @@ init_ownCli();
|
|
|
17323
17712
|
ResetRowSchema,
|
|
17324
17713
|
ResetScheduleSchema,
|
|
17325
17714
|
SessionAgentTreeSchema,
|
|
17715
|
+
SessionLookupError,
|
|
17716
|
+
SessionSummarySchema,
|
|
17326
17717
|
TaskItemSchema,
|
|
17327
17718
|
USAGE_EVENT_SOURCE,
|
|
17328
17719
|
UpdateCheckOutputSchema,
|
|
@@ -17341,6 +17732,7 @@ init_ownCli();
|
|
|
17341
17732
|
addProvider,
|
|
17342
17733
|
agentShimCliPath,
|
|
17343
17734
|
answerRcControlRequest,
|
|
17735
|
+
applyAgentTaskEvent,
|
|
17344
17736
|
authenticateRcSessionMcpServer,
|
|
17345
17737
|
buildEntryFacts,
|
|
17346
17738
|
buildLayoutPaths,
|
|
@@ -17370,6 +17762,8 @@ init_ownCli();
|
|
|
17370
17762
|
collectFrontDoorStatus,
|
|
17371
17763
|
collectPoolPick,
|
|
17372
17764
|
collectResets,
|
|
17765
|
+
collectSessionList,
|
|
17766
|
+
createAgentTreesApiRouter,
|
|
17373
17767
|
createCodexApiRouter,
|
|
17374
17768
|
createConfigApiRouter,
|
|
17375
17769
|
createControlApiRouter,
|
|
@@ -17438,7 +17832,9 @@ init_ownCli();
|
|
|
17438
17832
|
listProviders,
|
|
17439
17833
|
listSessions,
|
|
17440
17834
|
listUsageSnapshots,
|
|
17835
|
+
locateSession,
|
|
17441
17836
|
matchBranch,
|
|
17837
|
+
mergeLiveTasks,
|
|
17442
17838
|
mintLeaf,
|
|
17443
17839
|
mintRcSelfHostCredential,
|
|
17444
17840
|
observingRoutedRoute,
|
|
@@ -17480,6 +17876,7 @@ init_ownCli();
|
|
|
17480
17876
|
realRcEventDial,
|
|
17481
17877
|
realRcStreamDial,
|
|
17482
17878
|
realRcWebFetch,
|
|
17879
|
+
realSessionFs,
|
|
17483
17880
|
reconnectRcSessionMcpServer,
|
|
17484
17881
|
recoverFarm,
|
|
17485
17882
|
recoveryDiagnostics,
|
|
@@ -17521,11 +17918,13 @@ init_ownCli();
|
|
|
17521
17918
|
setProfileMetadata,
|
|
17522
17919
|
setRcSessionModel,
|
|
17523
17920
|
setRcSessionPermissionMode,
|
|
17921
|
+
showSession,
|
|
17524
17922
|
snapshotPath,
|
|
17525
17923
|
spawnClaude,
|
|
17526
17924
|
startConnectServer,
|
|
17527
17925
|
submitRcSessionMcpOAuthCallbackUrl,
|
|
17528
17926
|
suggestRcSessionFiles,
|
|
17927
|
+
summariseSession,
|
|
17529
17928
|
teleportRcSession,
|
|
17530
17929
|
topLevelNames,
|
|
17531
17930
|
updateDirectoryRule,
|