claude-use 9.18.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/dist/index.mjs CHANGED
@@ -696,7 +696,7 @@ function compile(pattern, category, source, ordinal) {
696
696
  matches: isExact ? (name) => name === pattern : (name) => matcher(name)
697
697
  };
698
698
  }
699
- function compileClassificationPatterns(defaults, overlay) {
699
+ function compileClassificationPatterns(defaults, overlay2) {
700
700
  const compiled = [];
701
701
  let ordinal = 0;
702
702
  for (const category of CATEGORY_NAMES) {
@@ -705,9 +705,9 @@ function compileClassificationPatterns(defaults, overlay) {
705
705
  ordinal += 1;
706
706
  }
707
707
  }
708
- if (overlay !== void 0) {
708
+ if (overlay2 !== void 0) {
709
709
  for (const category of CATEGORY_NAMES) {
710
- for (const pattern of overlay[category] ?? []) {
710
+ for (const pattern of overlay2[category] ?? []) {
711
711
  compiled.push(compile(pattern, category, "local", ordinal));
712
712
  ordinal += 1;
713
713
  }
@@ -728,10 +728,10 @@ function compareClassificationPatterns(a, b) {
728
728
  return a.ordinal - b.ordinal;
729
729
  }
730
730
  function loadClassification(paths) {
731
- const overlay = readJson(paths.categoriesLocalFile, CategoryClassificationOverlaySchema);
731
+ const overlay2 = readJson(paths.categoriesLocalFile, CategoryClassificationOverlaySchema);
732
732
  return {
733
733
  defaults: CategoryClassificationSchema.parse(categories_default_default),
734
- ...overlay === void 0 ? {} : { overlay }
734
+ ...overlay2 === void 0 ? {} : { overlay: overlay2 }
735
735
  };
736
736
  }
737
737
  function classifyEntries(names, options) {
@@ -2669,7 +2669,7 @@ var init_package = __esm({
2669
2669
  "package.json"() {
2670
2670
  package_default = {
2671
2671
  name: "claude-use",
2672
- version: "9.18.0",
2672
+ version: "9.19.0",
2673
2673
  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.",
2674
2674
  license: "MIT",
2675
2675
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -2805,7 +2805,7 @@ var init_supervisorProcesses = __esm({
2805
2805
  // src/headroom/state.ts
2806
2806
  import { createHash as createHash3 } from "node:crypto";
2807
2807
  import path11 from "node:path";
2808
- import { z as z6 } from "zod";
2808
+ import { z as z8 } from "zod";
2809
2809
  function parseJson(raw, schema) {
2810
2810
  if (raw === void 0 || raw.trim() === "") {
2811
2811
  return void 0;
@@ -2936,28 +2936,28 @@ var init_state2 = __esm({
2936
2936
  "use strict";
2937
2937
  init_schema();
2938
2938
  HEADROOM_ANTHROPIC_UPSTREAM = "https://api.anthropic.com";
2939
- HeadroomStateSchema = z6.strictObject({
2939
+ HeadroomStateSchema = z8.strictObject({
2940
2940
  /** The supervisor process owning the daemon. Alive means someone is keeping headroom running. */
2941
- supervisorPid: z6.number().int().positive().optional(),
2941
+ supervisorPid: z8.number().int().positive().optional(),
2942
2942
  /** The headroom proxy process itself. Absent while the supervisor is between restarts. */
2943
- headroomPid: z6.number().int().positive().optional(),
2943
+ headroomPid: z8.number().int().positive().optional(),
2944
2944
  /**
2945
2945
  * 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.
2946
2946
  */
2947
- socketPath: z6.string().min(1).optional(),
2947
+ socketPath: z8.string().min(1).optional(),
2948
2948
  /** The `headroom --version` output of the running install. */
2949
- version: z6.string().optional(),
2949
+ version: z8.string().optional(),
2950
2950
  /** Hash of the allowlist the running proxy was started with, so a provider-file change is detected as drift. */
2951
- allowlistHash: z6.string().optional(),
2951
+ allowlistHash: z8.string().optional(),
2952
2952
  /** Hash of the token-saving settings the running proxy was started with, so a settings change is detected as drift. */
2953
- settingsHash: z6.string().optional(),
2953
+ settingsHash: z8.string().optional(),
2954
2954
  /** The install spec the running install was last installed from, so a `source` config change is detected as drift. */
2955
- installedSource: z6.string().optional(),
2955
+ installedSource: z8.string().optional(),
2956
2956
  /** The last fatal error, kept across shutdowns so `headroom status` can explain a daemon that is not running. */
2957
- lastError: z6.string().optional()
2957
+ lastError: z8.string().optional()
2958
2958
  });
2959
- HeadroomSessionSchema = z6.strictObject({ pid: z6.number().int().positive(), startedAt: z6.number(), supervisorPid: z6.number().int().positive() });
2960
- HeadroomLockSchema = z6.strictObject({ pid: z6.number().int().positive(), at: z6.number() });
2959
+ HeadroomSessionSchema = z8.strictObject({ pid: z8.number().int().positive(), startedAt: z8.number(), supervisorPid: z8.number().int().positive() });
2960
+ HeadroomLockSchema = z8.strictObject({ pid: z8.number().int().positive(), at: z8.number() });
2961
2961
  }
2962
2962
  });
2963
2963
 
@@ -3151,7 +3151,7 @@ var init_socket = __esm({
3151
3151
  });
3152
3152
 
3153
3153
  // src/headroom/source.ts
3154
- import { z as z7 } from "zod";
3154
+ import { z as z9 } from "zod";
3155
3155
  function isMovingGitSource(spec) {
3156
3156
  const match = GIT_SPEC_RE.exec(spec);
3157
3157
  if (match === null) {
@@ -3170,7 +3170,7 @@ var init_source = __esm({
3170
3170
  "use strict";
3171
3171
  GIT_SPEC_RE = /git\+[^@\s]+(?:@([^\s#]+))?/;
3172
3172
  COMMIT_SHA_RE = /^[0-9a-f]{40}$/i;
3173
- DirectUrlSchema = z7.object({ vcs_info: z7.object({ commit_id: z7.string() }) });
3173
+ DirectUrlSchema = z9.object({ vcs_info: z9.object({ commit_id: z9.string() }) });
3174
3174
  }
3175
3175
  });
3176
3176
 
@@ -4085,149 +4085,149 @@ var init_identity = __esm({
4085
4085
  });
4086
4086
 
4087
4087
  // src/usage/schema.ts
4088
- import { z as z8 } from "zod";
4088
+ import { z as z10 } from "zod";
4089
4089
  var USAGE_SCHEMA_VERSION, VersionSchema, InstantSchema, TokenCountSchema, TokenUsageSchema, LIMIT_KINDS, LimitClassificationSchema, UsageRecordSchema, QuotaWindowSchema, ExtraUsageSpendSchema, UnifiedRateLimitSchema, RateLimitStateSchema, LimitEventSchema, ProviderQuotaWindowSchema, ProviderQuotaSchema, ProviderUsageStateSchema, AccountMetadataSchema, UsageSnapshotSchema;
4090
4090
  var init_schema2 = __esm({
4091
4091
  "src/usage/schema.ts"() {
4092
4092
  "use strict";
4093
4093
  USAGE_SCHEMA_VERSION = 1;
4094
- VersionSchema = z8.literal(USAGE_SCHEMA_VERSION);
4095
- InstantSchema = z8.iso.datetime();
4096
- TokenCountSchema = z8.number().int().nonnegative();
4097
- TokenUsageSchema = z8.strictObject({
4094
+ VersionSchema = z10.literal(USAGE_SCHEMA_VERSION);
4095
+ InstantSchema = z10.iso.datetime();
4096
+ TokenCountSchema = z10.number().int().nonnegative();
4097
+ TokenUsageSchema = z10.strictObject({
4098
4098
  inputTokens: TokenCountSchema.optional(),
4099
4099
  outputTokens: TokenCountSchema.optional(),
4100
4100
  cacheCreationInputTokens: TokenCountSchema.optional(),
4101
4101
  cacheReadInputTokens: TokenCountSchema.optional()
4102
4102
  });
4103
4103
  LIMIT_KINDS = ["rate-limited", "quota-exhausted"];
4104
- LimitClassificationSchema = z8.strictObject({
4105
- kind: z8.enum(LIMIT_KINDS),
4104
+ LimitClassificationSchema = z10.strictObject({
4105
+ kind: z10.enum(LIMIT_KINDS),
4106
4106
  /** Seconds to wait before retrying, from the response's `retry-after`. */
4107
- retryAfterSeconds: z8.number().nonnegative().optional(),
4107
+ retryAfterSeconds: z10.number().nonnegative().optional(),
4108
4108
  /** When the limiting window resets, from the upstream's own reset header. */
4109
4109
  resetAt: InstantSchema.optional(),
4110
4110
  /** The window the upstream named as the binding one (`anthropic-ratelimit-unified-representative-claim`), such as `five_hour` or `seven_day`. */
4111
- window: z8.string().optional(),
4111
+ window: z10.string().optional(),
4112
4112
  /** 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. */
4113
- evidence: z8.array(z8.string())
4113
+ evidence: z10.array(z10.string())
4114
4114
  });
4115
- UsageRecordSchema = z8.strictObject({
4115
+ UsageRecordSchema = z10.strictObject({
4116
4116
  schemaVersion: VersionSchema,
4117
4117
  /** When the front door received the request. */
4118
4118
  at: InstantSchema,
4119
4119
  /** The launching identity, when the launch resolved one. */
4120
- identity: z8.string().optional(),
4120
+ identity: z10.string().optional(),
4121
4121
  /** `anthropic` for an OAuth session's request to Claude Code's own API, otherwise the provider's name. */
4122
- provider: z8.string(),
4122
+ provider: z10.string(),
4123
4123
  /** The launch's session id, generated per launch. */
4124
- sessionId: z8.string().optional(),
4124
+ sessionId: z10.string().optional(),
4125
4125
  /** The project the launch ran in (its git repository root), when the launch sent one: headroom launches do. */
4126
- project: z8.string().optional(),
4126
+ project: z10.string().optional(),
4127
4127
  /** The front-door route that served the request. */
4128
- route: z8.string(),
4129
- method: z8.string(),
4128
+ route: z10.string(),
4129
+ method: z10.string(),
4130
4130
  /** The API path as the upstream sees it (`/v1/messages`), without the provider prefix or a query string. */
4131
- endpoint: z8.string(),
4131
+ endpoint: z10.string(),
4132
4132
  /** The model the response named. */
4133
- model: z8.string().optional(),
4134
- status: z8.number().int(),
4133
+ model: z10.string().optional(),
4134
+ status: z10.number().int(),
4135
4135
  /** Milliseconds from the request's arrival to its response head. */
4136
- latencyMs: z8.number().int().nonnegative(),
4136
+ latencyMs: z10.number().int().nonnegative(),
4137
4137
  /** Milliseconds from the request's arrival to the end of its response body. */
4138
- durationMs: z8.number().int().nonnegative(),
4138
+ durationMs: z10.number().int().nonnegative(),
4139
4139
  /** Whether the client received the whole body. */
4140
- outcome: z8.enum(["completed", "aborted"]),
4140
+ outcome: z10.enum(["completed", "aborted"]),
4141
4141
  usage: TokenUsageSchema.optional(),
4142
4142
  /** The response's quota and rate-limit headers, by name (see `isRateLimitHeader`). */
4143
- rateLimitHeaders: z8.record(z8.string(), z8.string()).optional(),
4143
+ rateLimitHeaders: z10.record(z10.string(), z10.string()).optional(),
4144
4144
  limit: LimitClassificationSchema.optional(),
4145
4145
  /** The upstream's request id (`request-id`), for matching a record to the provider's own logs. */
4146
- requestId: z8.string().optional()
4146
+ requestId: z10.string().optional()
4147
4147
  });
4148
- QuotaWindowSchema = z8.strictObject({
4148
+ QuotaWindowSchema = z10.strictObject({
4149
4149
  /** The fraction of the window used, as the upstream reports it (0 to 1). */
4150
- utilization: z8.number().nonnegative().optional(),
4150
+ utilization: z10.number().nonnegative().optional(),
4151
4151
  resetsAt: InstantSchema.optional(),
4152
4152
  /** The window's own status (`allowed`, `allowed_warning`, `rejected`). */
4153
- status: z8.string().optional(),
4153
+ status: z10.string().optional(),
4154
4154
  /** 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. */
4155
- graceUtilization: z8.number().nonnegative().optional()
4155
+ graceUtilization: z10.number().nonnegative().optional()
4156
4156
  });
4157
- ExtraUsageSpendSchema = z8.strictObject({
4157
+ ExtraUsageSpendSchema = z10.strictObject({
4158
4158
  /** Spent so far in the allowance's period, in the currency's minor units (pence, cents). */
4159
- usedMinor: z8.number().nonnegative(),
4159
+ usedMinor: z10.number().nonnegative(),
4160
4160
  /** The allowance's cap in the same units, when it has one. */
4161
- limitMinor: z8.number().nonnegative().optional(),
4161
+ limitMinor: z10.number().nonnegative().optional(),
4162
4162
  /** The ISO 4217 currency code. */
4163
- currency: z8.string()
4163
+ currency: z10.string()
4164
4164
  });
4165
- UnifiedRateLimitSchema = z8.strictObject({
4165
+ UnifiedRateLimitSchema = z10.strictObject({
4166
4166
  /** The overall status: `allowed`, `allowed_warning` or `rejected`. */
4167
- status: z8.string().optional(),
4167
+ status: z10.string().optional(),
4168
4168
  fiveHour: QuotaWindowSchema.optional(),
4169
4169
  sevenDay: QuotaWindowSchema.optional(),
4170
4170
  /** 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. */
4171
4171
  sevenDayOverageIncluded: QuotaWindowSchema.optional(),
4172
4172
  /** The window that currently binds. */
4173
- representativeClaim: z8.string().optional(),
4173
+ representativeClaim: z10.string().optional(),
4174
4174
  /** When the binding window resets. */
4175
4175
  resetAt: InstantSchema.optional(),
4176
4176
  /** Whether usage beyond the plan (extra usage) is available: `allowed` or `rejected`. */
4177
- overageStatus: z8.string().optional(),
4177
+ overageStatus: z10.string().optional(),
4178
4178
  /** 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. */
4179
- overageUtilization: z8.number().nonnegative().optional(),
4179
+ overageUtilization: z10.number().nonnegative().optional(),
4180
4180
  /** When the extra-usage allowance resets. */
4181
4181
  overageResetsAt: InstantSchema.optional(),
4182
4182
  /** Why extra usage is unavailable, as the upstream names it (`out_of_credits`, for one). */
4183
- overageDisabledReason: z8.string().optional(),
4183
+ overageDisabledReason: z10.string().optional(),
4184
4184
  /** Whether the response was served on extra usage, as the upstream states it. */
4185
- overageInUse: z8.boolean().optional(),
4185
+ overageInUse: z10.boolean().optional(),
4186
4186
  /** The allowance in money, from the usage endpoint (the response headers state only the fraction). */
4187
4187
  extraUsageSpend: ExtraUsageSpendSchema.optional(),
4188
4188
  /** True when the upstream offers a fallback while a window is rejected: some requests, by model, are still served, though the rest are refused. */
4189
- fallbackAvailable: z8.boolean().optional()
4189
+ fallbackAvailable: z10.boolean().optional()
4190
4190
  });
4191
- RateLimitStateSchema = z8.strictObject({
4191
+ RateLimitStateSchema = z10.strictObject({
4192
4192
  observedAt: InstantSchema,
4193
4193
  /** Every quota and rate-limit header on that response, by name. */
4194
- headers: z8.record(z8.string(), z8.string()),
4194
+ headers: z10.record(z10.string(), z10.string()),
4195
4195
  unified: UnifiedRateLimitSchema.optional(),
4196
4196
  /** 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. */
4197
4197
  planWindowsUnavailableAt: InstantSchema.optional()
4198
4198
  });
4199
4199
  LimitEventSchema = LimitClassificationSchema.extend({
4200
4200
  observedAt: InstantSchema,
4201
- status: z8.number().int()
4201
+ status: z10.number().int()
4202
4202
  });
4203
- ProviderQuotaWindowSchema = z8.strictObject({
4203
+ ProviderQuotaWindowSchema = z10.strictObject({
4204
4204
  /** What the window measures, in the provider's terms (`tokens`, `tool-calls`). */
4205
- measures: z8.string(),
4205
+ measures: z10.string(),
4206
4206
  /** 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. */
4207
- periodMs: z8.number().int().positive().optional(),
4207
+ periodMs: z10.number().int().positive().optional(),
4208
4208
  /** The provider's own description of the period when `periodMs` could not be derived, such as `unit 4 x 1`. */
4209
- period: z8.string().optional(),
4209
+ period: z10.string().optional(),
4210
4210
  /** The fraction of the window used (0 to 1). */
4211
- utilization: z8.number().nonnegative(),
4211
+ utilization: z10.number().nonnegative(),
4212
4212
  resetsAt: InstantSchema.optional(),
4213
4213
  /** Absolute counts, when the provider reports them for this window. */
4214
- limit: z8.number().nonnegative().optional(),
4215
- used: z8.number().nonnegative().optional(),
4216
- remaining: z8.number().nonnegative().optional()
4214
+ limit: z10.number().nonnegative().optional(),
4215
+ used: z10.number().nonnegative().optional(),
4216
+ remaining: z10.number().nonnegative().optional()
4217
4217
  });
4218
- ProviderQuotaSchema = z8.strictObject({
4218
+ ProviderQuotaSchema = z10.strictObject({
4219
4219
  observedAt: InstantSchema,
4220
4220
  /** Which usage endpoint produced it (`z.ai`). */
4221
- source: z8.string(),
4221
+ source: z10.string(),
4222
4222
  /** The subscription level the endpoint reports, when it does. */
4223
- level: z8.string().optional(),
4224
- windows: z8.array(ProviderQuotaWindowSchema)
4223
+ level: z10.string().optional(),
4224
+ windows: z10.array(ProviderQuotaWindowSchema)
4225
4225
  });
4226
- ProviderUsageStateSchema = z8.strictObject({
4226
+ ProviderUsageStateSchema = z10.strictObject({
4227
4227
  /** 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. */
4228
4228
  lastRequestAt: InstantSchema.optional(),
4229
- lastStatus: z8.number().int().optional(),
4230
- lastModel: z8.string().optional(),
4229
+ lastStatus: z10.number().int().optional(),
4230
+ lastModel: z10.string().optional(),
4231
4231
  /** The latest rate-limit state, from the last response that carried any rate-limit header. */
4232
4232
  rateLimit: RateLimitStateSchema.optional(),
4233
4233
  /** The latest classified refusal. It stays after later successes, so a reader compares its `resetAt` (or `observedAt` plus `retryAfterSeconds`) with the current time. */
@@ -4235,31 +4235,31 @@ var init_schema2 = __esm({
4235
4235
  /** The latest quota the provider's usage endpoint reported, for providers whose quota is not visible in response headers. */
4236
4236
  quota: ProviderQuotaSchema.optional()
4237
4237
  });
4238
- AccountMetadataSchema = z8.strictObject({
4239
- accountUuid: z8.string().optional(),
4240
- emailAddress: z8.string().optional(),
4241
- displayName: z8.string().optional(),
4242
- organizationUuid: z8.string().optional(),
4243
- organizationName: z8.string().optional(),
4244
- organizationType: z8.string().optional(),
4245
- organizationRole: z8.string().optional(),
4246
- workspaceRole: z8.string().optional(),
4247
- billingType: z8.string().optional(),
4248
- seatTier: z8.string().optional(),
4249
- organizationRateLimitTier: z8.string().optional(),
4250
- userRateLimitTier: z8.string().optional(),
4251
- hasExtraUsageEnabled: z8.boolean().optional(),
4252
- subscriptionCreatedAt: z8.string().optional(),
4253
- accountCreatedAt: z8.string().optional()
4238
+ AccountMetadataSchema = z10.strictObject({
4239
+ accountUuid: z10.string().optional(),
4240
+ emailAddress: z10.string().optional(),
4241
+ displayName: z10.string().optional(),
4242
+ organizationUuid: z10.string().optional(),
4243
+ organizationName: z10.string().optional(),
4244
+ organizationType: z10.string().optional(),
4245
+ organizationRole: z10.string().optional(),
4246
+ workspaceRole: z10.string().optional(),
4247
+ billingType: z10.string().optional(),
4248
+ seatTier: z10.string().optional(),
4249
+ organizationRateLimitTier: z10.string().optional(),
4250
+ userRateLimitTier: z10.string().optional(),
4251
+ hasExtraUsageEnabled: z10.boolean().optional(),
4252
+ subscriptionCreatedAt: z10.string().optional(),
4253
+ accountCreatedAt: z10.string().optional()
4254
4254
  });
4255
- UsageSnapshotSchema = z8.strictObject({
4255
+ UsageSnapshotSchema = z10.strictObject({
4256
4256
  schemaVersion: VersionSchema,
4257
- identity: z8.string(),
4257
+ identity: z10.string(),
4258
4258
  updatedAt: InstantSchema,
4259
4259
  /** The identity's account metadata as of `updatedAt`. */
4260
4260
  account: AccountMetadataSchema.optional(),
4261
4261
  /** Latest state per provider, keyed by provider name (`anthropic` for OAuth sessions). */
4262
- providers: z8.record(z8.string(), ProviderUsageStateSchema)
4262
+ providers: z10.record(z10.string(), ProviderUsageStateSchema)
4263
4263
  });
4264
4264
  }
4265
4265
  });
@@ -4347,7 +4347,7 @@ var init_account = __esm({
4347
4347
  });
4348
4348
 
4349
4349
  // src/usage/plan.ts
4350
- import { z as z9 } from "zod";
4350
+ import { z as z11 } from "zod";
4351
4351
  function planOf(account) {
4352
4352
  const userTier = account?.userRateLimitTier;
4353
4353
  if (userTier !== void 0 && ZERO_TIER.test(userTier)) {
@@ -4371,19 +4371,19 @@ var PlanClassSchema, TIER_MULTIPLIER, ZERO_TIER, BASE_TIER;
4371
4371
  var init_plan2 = __esm({
4372
4372
  "src/usage/plan.ts"() {
4373
4373
  "use strict";
4374
- PlanClassSchema = z9.union([
4375
- z9.strictObject({
4376
- kind: z9.literal("subscription"),
4374
+ PlanClassSchema = z11.union([
4375
+ z11.strictObject({
4376
+ kind: z11.literal("subscription"),
4377
4377
  /** The plan's size as a multiple of the smallest subscription tier (Max 5x is 5, Max 20x is 20). */
4378
- capacity: z9.number().positive(),
4378
+ capacity: z11.number().positive(),
4379
4379
  /** False when the tier string named no multiplier and no tier this project knows, so `capacity` is the neutral 1 rather than a reading. */
4380
- recognised: z9.boolean(),
4380
+ recognised: z11.boolean(),
4381
4381
  /** The tier string the classification rests on, when the account had one. */
4382
- tier: z9.string().optional()
4382
+ tier: z11.string().optional()
4383
4383
  }),
4384
- z9.strictObject({
4385
- kind: z9.literal("pay-per-use"),
4386
- tier: z9.string().optional()
4384
+ z11.strictObject({
4385
+ kind: z11.literal("pay-per-use"),
4386
+ tier: z11.string().optional()
4387
4387
  })
4388
4388
  ]);
4389
4389
  TIER_MULTIPLIER = /(?:^|_)(\d+)x$/;
@@ -4484,21 +4484,21 @@ var init_rateLimit = __esm({
4484
4484
  });
4485
4485
 
4486
4486
  // src/usage/scan.ts
4487
- import { z as z10 } from "zod";
4487
+ import { z as z12 } from "zod";
4488
4488
  var AnthropicUsageSchema, ErrorObjectSchema;
4489
4489
  var init_scan = __esm({
4490
4490
  "src/usage/scan.ts"() {
4491
4491
  "use strict";
4492
- AnthropicUsageSchema = z10.looseObject({
4493
- input_tokens: z10.number().int().nonnegative().nullish(),
4494
- output_tokens: z10.number().int().nonnegative().nullish(),
4495
- cache_creation_input_tokens: z10.number().int().nonnegative().nullish(),
4496
- cache_read_input_tokens: z10.number().int().nonnegative().nullish()
4492
+ AnthropicUsageSchema = z12.looseObject({
4493
+ input_tokens: z12.number().int().nonnegative().nullish(),
4494
+ output_tokens: z12.number().int().nonnegative().nullish(),
4495
+ cache_creation_input_tokens: z12.number().int().nonnegative().nullish(),
4496
+ cache_read_input_tokens: z12.number().int().nonnegative().nullish()
4497
4497
  });
4498
- ErrorObjectSchema = z10.looseObject({
4499
- type: z10.string().optional(),
4500
- code: z10.union([z10.string(), z10.number()]).optional(),
4501
- message: z10.string().optional()
4498
+ ErrorObjectSchema = z12.looseObject({
4499
+ type: z12.string().optional(),
4500
+ code: z12.union([z12.string(), z12.number()]).optional(),
4501
+ message: z12.string().optional()
4502
4502
  });
4503
4503
  }
4504
4504
  });
@@ -5103,7 +5103,7 @@ var init_store2 = __esm({
5103
5103
 
5104
5104
  // src/usage/poolPick.ts
5105
5105
  import path20 from "node:path";
5106
- import { z as z11 } from "zod";
5106
+ import { z as z13 } from "zod";
5107
5107
  function errorMessage(error) {
5108
5108
  return error instanceof Error ? error.message : String(error);
5109
5109
  }
@@ -5253,10 +5253,10 @@ var init_poolPick = __esm({
5253
5253
  }
5254
5254
  };
5255
5255
  SCHEMA_VERSION = 1;
5256
- PickEntrySchema = z11.strictObject({ identity: z11.string().min(1), at: z11.iso.datetime() });
5257
- PicksFileSchema = z11.strictObject({
5258
- schemaVersion: z11.literal(SCHEMA_VERSION),
5259
- picks: z11.record(z11.string().min(1), PickEntrySchema)
5256
+ PickEntrySchema = z13.strictObject({ identity: z13.string().min(1), at: z13.iso.datetime() });
5257
+ PicksFileSchema = z13.strictObject({
5258
+ schemaVersion: z13.literal(SCHEMA_VERSION),
5259
+ picks: z13.record(z13.string().min(1), PickEntrySchema)
5260
5260
  });
5261
5261
  }
5262
5262
  });
@@ -5336,7 +5336,7 @@ var init_paths = __esm({
5336
5336
  });
5337
5337
 
5338
5338
  // src/credentialCache.ts
5339
- import { z as z12 } from "zod";
5339
+ import { z as z14 } from "zod";
5340
5340
  function effectiveStore(cache, platform) {
5341
5341
  return cache.store ?? (platform === "darwin" ? "keychain" : "file");
5342
5342
  }
@@ -5403,9 +5403,9 @@ var init_credentialCache = __esm({
5403
5403
  init_schema();
5404
5404
  init_preflight();
5405
5405
  MS_PER_UNIT = { s: 1e3, m: 6e4, h: 36e5, d: 864e5 };
5406
- CachedCredentialSchema = z12.strictObject({
5407
- token: z12.string().min(1),
5408
- fetchedAt: z12.number().int().nonnegative(),
5406
+ CachedCredentialSchema = z14.strictObject({
5407
+ token: z14.string().min(1),
5408
+ fetchedAt: z14.number().int().nonnegative(),
5409
5409
  source: CredentialSourceSchema
5410
5410
  });
5411
5411
  }
@@ -5678,14 +5678,14 @@ function providerJsonPath(paths, name) {
5678
5678
  function providerExists(paths, name) {
5679
5679
  return fs7.existsSync(providerJsonPath(paths, name));
5680
5680
  }
5681
- function isRecord4(value) {
5681
+ function isRecord5(value) {
5682
5682
  return typeof value === "object" && value !== null && !Array.isArray(value);
5683
5683
  }
5684
5684
  function legacyProviderConversion(raw) {
5685
- if (!isRecord4(raw) || "credential" in raw) {
5685
+ if (!isRecord5(raw) || "credential" in raw) {
5686
5686
  return void 0;
5687
5687
  }
5688
- const env = isRecord4(raw.env) ? raw.env : void 0;
5688
+ const env = isRecord5(raw.env) ? raw.env : void 0;
5689
5689
  const legacyEnvKeys = env === void 0 ? [] : Object.keys(env).filter((key) => LEGACY_ENV_CREDENTIAL_KEYS.includes(key));
5690
5690
  const fields = [...LEGACY_PROVIDER_FIELDS.filter((field) => field in raw), ...legacyEnvKeys.map((key) => `env.${key}`)];
5691
5691
  if (fields.length === 0) {
@@ -6107,7 +6107,7 @@ var init_commandDeps = __esm({
6107
6107
  // src/claudeShim.ts
6108
6108
  import fs8 from "node:fs";
6109
6109
  import path26 from "node:path";
6110
- import { z as z17 } from "zod";
6110
+ import { z as z19 } from "zod";
6111
6111
  function commandFilename(ownExecutablePath, commandName) {
6112
6112
  return ownExecutablePath.toLowerCase().endsWith(".exe") ? `${commandName}.exe` : commandName;
6113
6113
  }
@@ -6157,10 +6157,10 @@ var init_claudeShim = __esm({
6157
6157
  init_store();
6158
6158
  init_realPorts();
6159
6159
  init_cliError();
6160
- ClaudeShimStateSchema = z17.strictObject({
6161
- targetPath: z17.string().min(1),
6162
- method: z17.enum(["hardlink", "copy"]),
6163
- installedAtMs: z17.number()
6160
+ ClaudeShimStateSchema = z19.strictObject({
6161
+ targetPath: z19.string().min(1),
6162
+ method: z19.enum(["hardlink", "copy"]),
6163
+ installedAtMs: z19.number()
6164
6164
  });
6165
6165
  nodeLinkFs = { link: fs8.linkSync, copyFile: fs8.copyFileSync, chmod: fs8.chmodSync };
6166
6166
  }
@@ -7876,7 +7876,7 @@ var init_identityClaude = __esm({
7876
7876
  });
7877
7877
 
7878
7878
  // src/usage/providerQuota.ts
7879
- import { z as z28 } from "zod";
7879
+ import { z as z29 } from "zod";
7880
7880
  var 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;
7881
7881
  var init_providerQuota = __esm({
7882
7882
  "src/usage/providerQuota.ts"() {
@@ -7894,35 +7894,35 @@ var init_providerQuota = __esm({
7894
7894
  [ZAI_UNIT_HOURS, SECONDS_PER_HOUR * MS_PER_SECOND7],
7895
7895
  [ZAI_UNIT_MONTHS, DAYS_PER_MONTH * HOURS_PER_DAY4 * SECONDS_PER_HOUR * MS_PER_SECOND7]
7896
7896
  ]);
7897
- ZaiLimitSchema = z28.object({
7898
- type: z28.string(),
7899
- unit: z28.number().int(),
7900
- number: z28.number().int().positive(),
7901
- percentage: z28.number().nonnegative(),
7902
- nextResetTime: z28.number().positive().optional(),
7903
- usage: z28.number().nonnegative().optional(),
7904
- currentValue: z28.number().nonnegative().optional(),
7905
- remaining: z28.number().nonnegative().optional()
7897
+ ZaiLimitSchema = z29.object({
7898
+ type: z29.string(),
7899
+ unit: z29.number().int(),
7900
+ number: z29.number().int().positive(),
7901
+ percentage: z29.number().nonnegative(),
7902
+ nextResetTime: z29.number().positive().optional(),
7903
+ usage: z29.number().nonnegative().optional(),
7904
+ currentValue: z29.number().nonnegative().optional(),
7905
+ remaining: z29.number().nonnegative().optional()
7906
7906
  });
7907
- ZaiResponseSchema = z28.object({
7908
- success: z28.boolean(),
7909
- msg: z28.string().optional(),
7910
- data: z28.object({ level: z28.string().optional(), limits: z28.array(ZaiLimitSchema) })
7907
+ ZaiResponseSchema = z29.object({
7908
+ success: z29.boolean(),
7909
+ msg: z29.string().optional(),
7910
+ data: z29.object({ level: z29.string().optional(), limits: z29.array(ZaiLimitSchema) })
7911
7911
  });
7912
7912
  OPENROUTER_HOST = "openrouter.ai";
7913
7913
  OPENROUTER_KEY_URL = `https://${OPENROUTER_HOST}/api/v1/key`;
7914
7914
  OPENROUTER_CREDITS_URL = `https://${OPENROUTER_HOST}/api/v1/credits`;
7915
7915
  MS_PER_DAY3 = HOURS_PER_DAY4 * SECONDS_PER_HOUR * MS_PER_SECOND7;
7916
- OpenRouterKeySchema = z28.object({
7917
- data: z28.object({
7918
- limit: z28.number().nonnegative().nullable(),
7919
- limit_remaining: z28.number().nullable(),
7920
- limit_reset: z28.string().nullable(),
7921
- is_free_tier: z28.boolean().optional(),
7922
- free_model_daily_requests: z28.object({ used: z28.number().nonnegative(), limit: z28.number().nonnegative(), remaining: z28.number() }).optional()
7916
+ OpenRouterKeySchema = z29.object({
7917
+ data: z29.object({
7918
+ limit: z29.number().nonnegative().nullable(),
7919
+ limit_remaining: z29.number().nullable(),
7920
+ limit_reset: z29.string().nullable(),
7921
+ is_free_tier: z29.boolean().optional(),
7922
+ free_model_daily_requests: z29.object({ used: z29.number().nonnegative(), limit: z29.number().nonnegative(), remaining: z29.number() }).optional()
7923
7923
  })
7924
7924
  });
7925
- OpenRouterCreditsSchema = z28.object({ data: z28.object({ total_credits: z28.number().nonnegative(), total_usage: z28.number().nonnegative() }) });
7925
+ OpenRouterCreditsSchema = z29.object({ data: z29.object({ total_credits: z29.number().nonnegative(), total_usage: z29.number().nonnegative() }) });
7926
7926
  }
7927
7927
  });
7928
7928
 
@@ -8906,6 +8906,264 @@ var HTTP_STATUS = {
8906
8906
  badGateway: 502
8907
8907
  };
8908
8908
 
8909
+ // src/agents/liveTasks.ts
8910
+ import { z as z5 } from "zod";
8911
+
8912
+ // src/agents/schema.ts
8913
+ import { z as z4 } from "zod";
8914
+ var AgentMetaSchema = z4.looseObject({
8915
+ agentType: z4.string(),
8916
+ isFork: z4.boolean().optional(),
8917
+ description: z4.string().optional(),
8918
+ name: z4.string().optional(),
8919
+ toolUseId: z4.string().optional(),
8920
+ spawnDepth: z4.number().int().nonnegative().optional(),
8921
+ parentAgentId: z4.string().optional(),
8922
+ model: z4.string().optional(),
8923
+ requestShape: z4.string().optional(),
8924
+ requestNonInteractive: z4.boolean().optional(),
8925
+ workflowPhase: z4.string().optional(),
8926
+ taskKind: z4.string().optional(),
8927
+ teamName: z4.string().optional(),
8928
+ worktreePath: z4.string().optional(),
8929
+ worktreeBranch: z4.string().optional(),
8930
+ stoppedByUser: z4.boolean().optional()
8931
+ });
8932
+ var AgentKindSchema = z4.enum(["subagent", "fork", "workflow-agent", "teammate"]);
8933
+ var AgentNodeFields = {
8934
+ id: z4.string(),
8935
+ kind: AgentKindSchema,
8936
+ agentType: z4.string(),
8937
+ description: z4.string().optional(),
8938
+ name: z4.string().optional(),
8939
+ toolUseId: z4.string().optional(),
8940
+ spawnDepth: z4.number().int().nonnegative().optional(),
8941
+ model: z4.string().optional(),
8942
+ background: z4.boolean().optional(),
8943
+ workflowRunId: z4.string().optional(),
8944
+ workflowPhase: z4.string().optional(),
8945
+ teamName: z4.string().optional(),
8946
+ stoppedByUser: z4.boolean().optional(),
8947
+ transcript: z4.string()
8948
+ };
8949
+ var AgentNodeSchema = z4.lazy(() => z4.strictObject({ ...AgentNodeFields, children: z4.array(AgentNodeSchema) }));
8950
+ var TaskItemSchema = z4.strictObject({
8951
+ id: z4.string(),
8952
+ subject: z4.string(),
8953
+ description: z4.string().optional(),
8954
+ status: z4.string(),
8955
+ /** What a spinner shows while the task runs. */
8956
+ activeForm: z4.string().optional(),
8957
+ /** The teammate or agent name the task is assigned to, as Agent Teams writes it. */
8958
+ owner: z4.string().optional(),
8959
+ /** Free-form data the harness attaches to a task, kept as written. */
8960
+ metadata: z4.record(z4.string(), z4.unknown()).optional(),
8961
+ blocks: z4.array(z4.string()),
8962
+ blockedBy: z4.array(z4.string()),
8963
+ /** 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. */
8964
+ taskList: z4.string().optional()
8965
+ });
8966
+ var WorkflowRunSchema = z4.strictObject({
8967
+ runId: z4.string(),
8968
+ workflowName: z4.string().optional(),
8969
+ status: z4.string().optional(),
8970
+ startTime: z4.number().optional(),
8971
+ phases: z4.array(z4.string()),
8972
+ summary: z4.string().optional()
8973
+ });
8974
+ var AgentTreeProblemSchema = z4.strictObject({
8975
+ /** Relative to the identity's configuration directory. */
8976
+ path: z4.string(),
8977
+ reason: z4.string()
8978
+ });
8979
+ var SessionSummarySchema = z4.strictObject({
8980
+ project: z4.string(),
8981
+ sessionId: z4.string(),
8982
+ superseded: z4.boolean(),
8983
+ /** The directory and transcript stem exactly as on disk, which differs from `sessionId` for a superseded session. */
8984
+ entry: z4.string(),
8985
+ agentCount: z4.number().int().nonnegative(),
8986
+ workflowRunCount: z4.number().int().nonnegative(),
8987
+ /** When the transcript was last written, as an ISO instant; absent when there is no transcript file. */
8988
+ updatedAt: z4.iso.datetime().optional(),
8989
+ identities: z4.array(z4.string())
8990
+ });
8991
+ var SessionAgentTreeSchema = z4.strictObject({
8992
+ project: z4.string(),
8993
+ sessionId: z4.string(),
8994
+ /** True for a session directory a resume superseded (`<session-id>.superseded-<epoch-ms>`). */
8995
+ superseded: z4.boolean(),
8996
+ /** The agents the session itself spawned, each with its descendants. */
8997
+ agents: z4.array(AgentNodeSchema),
8998
+ tasks: z4.array(TaskItemSchema),
8999
+ workflowRuns: z4.array(WorkflowRunSchema),
9000
+ problems: z4.array(AgentTreeProblemSchema)
9001
+ });
9002
+
9003
+ // src/agents/liveTasks.ts
9004
+ var LIVE_TASK_CAP = 512;
9005
+ var RUNNING_STATUS = "running";
9006
+ var LiveTaskUsageSchema = z5.strictObject({
9007
+ totalTokens: z5.number().optional(),
9008
+ toolUses: z5.number().optional(),
9009
+ durationMs: z5.number().optional()
9010
+ });
9011
+ var LiveTaskSchema = z5.strictObject({
9012
+ /** The `task_id`: for an unnamed subagent the stem of its `agent-<id>` files on disk. */
9013
+ taskId: z5.string(),
9014
+ /** The `cse_` session whose stream carried the task. */
9015
+ sessionId: z5.string(),
9016
+ runId: z5.string().optional(),
9017
+ /** The `tool_use` block in the spawning transcript, which is the meta file's `toolUseId`. */
9018
+ toolUseId: z5.string().optional(),
9019
+ /** `local_agent` for a subagent, `local_bash` for a backgrounded command; open because other kinds may exist. */
9020
+ taskType: z5.string().optional(),
9021
+ description: z5.string().optional(),
9022
+ subagentType: z5.string().optional(),
9023
+ spawnDepth: z5.number().int().nonnegative().optional(),
9024
+ parentTaskId: z5.string().optional(),
9025
+ backgrounded: z5.boolean().optional(),
9026
+ status: z5.string(),
9027
+ /** `<tmpdir>/<project-slug>/<local session id>/tasks/<task_id>.output`, which embeds the local session id. */
9028
+ outputFile: z5.string().optional(),
9029
+ summary: z5.string().optional(),
9030
+ lastToolName: z5.string().optional(),
9031
+ usage: LiveTaskUsageSchema.optional(),
9032
+ /** When the door last observed an event for this task, in epoch milliseconds from its injected clock. */
9033
+ observedAt: z5.number()
9034
+ });
9035
+ var SYSTEM_SUBTYPES = ["task_started", "task_progress", "task_updated", "task_notification", "background_tasks_changed"];
9036
+ function isRecord2(value) {
9037
+ return typeof value === "object" && value !== null && !Array.isArray(value);
9038
+ }
9039
+ function stringField(record, field) {
9040
+ const value = record[field];
9041
+ return typeof value === "string" && value !== "" ? value : void 0;
9042
+ }
9043
+ function numberField(record, field) {
9044
+ const value = record[field];
9045
+ return typeof value === "number" && Number.isFinite(value) ? value : void 0;
9046
+ }
9047
+ function booleanField(record, field) {
9048
+ const value = record[field];
9049
+ return typeof value === "boolean" ? value : void 0;
9050
+ }
9051
+ function usageOf(record) {
9052
+ const raw = record.usage;
9053
+ if (!isRecord2(raw)) {
9054
+ return void 0;
9055
+ }
9056
+ const totalTokens = numberField(raw, "total_tokens");
9057
+ const toolUses = numberField(raw, "tool_uses");
9058
+ const durationMs = numberField(raw, "duration_ms");
9059
+ if (totalTokens === void 0 && toolUses === void 0 && durationMs === void 0) {
9060
+ return void 0;
9061
+ }
9062
+ return { ...totalTokens === void 0 ? {} : { totalTokens }, ...toolUses === void 0 ? {} : { toolUses }, ...durationMs === void 0 ? {} : { durationMs } };
9063
+ }
9064
+ function overlay(base, fields) {
9065
+ const defined = Object.fromEntries(Object.entries(fields).filter(([, value]) => value !== void 0));
9066
+ return LiveTaskSchema.parse({ ...base, ...defined });
9067
+ }
9068
+ function isFinished(task) {
9069
+ return task.status !== RUNNING_STATUS;
9070
+ }
9071
+ function bounded(book) {
9072
+ if (book.size <= LIVE_TASK_CAP) {
9073
+ return book;
9074
+ }
9075
+ const evictable = [...book.values()].filter(isFinished).sort((left, right) => left.observedAt - right.observedAt);
9076
+ for (const task of evictable) {
9077
+ if (book.size <= LIVE_TASK_CAP) {
9078
+ break;
9079
+ }
9080
+ book.delete(task.taskId);
9081
+ }
9082
+ return book;
9083
+ }
9084
+ function applyAgentTaskEvent(book, sessionId, payload, observedAt2) {
9085
+ if (!isRecord2(payload) || payload.type !== "system") {
9086
+ return book;
9087
+ }
9088
+ const subtype = payload.subtype;
9089
+ if (typeof subtype !== "string" || !SYSTEM_SUBTYPES.some((known) => known === subtype)) {
9090
+ return book;
9091
+ }
9092
+ const next = new Map(book);
9093
+ const upsert = (taskId2, fields) => {
9094
+ const existing = next.get(taskId2);
9095
+ const base = existing ?? { taskId: taskId2, sessionId, status: RUNNING_STATUS, observedAt: observedAt2 };
9096
+ next.set(taskId2, overlay(base, { ...fields, observedAt: observedAt2 }));
9097
+ };
9098
+ if (subtype === "background_tasks_changed") {
9099
+ const tasks = Array.isArray(payload.tasks) ? payload.tasks : [];
9100
+ for (const raw of tasks) {
9101
+ const taskId2 = isRecord2(raw) ? stringField(raw, "task_id") : void 0;
9102
+ if (isRecord2(raw) && taskId2 !== void 0) {
9103
+ upsert(taskId2, { runId: stringField(raw, "run_id"), taskType: stringField(raw, "task_type"), description: stringField(raw, "description") });
9104
+ }
9105
+ }
9106
+ return bounded(next);
9107
+ }
9108
+ const taskId = stringField(payload, "task_id");
9109
+ if (taskId === void 0) {
9110
+ return book;
9111
+ }
9112
+ const common = { runId: stringField(payload, "run_id"), toolUseId: stringField(payload, "tool_use_id"), description: stringField(payload, "description") };
9113
+ if (subtype === "task_started") {
9114
+ upsert(taskId, {
9115
+ ...common,
9116
+ taskType: stringField(payload, "task_type"),
9117
+ subagentType: stringField(payload, "subagent_type"),
9118
+ spawnDepth: numberField(payload, "spawn_depth"),
9119
+ parentTaskId: stringField(payload, "parent_task_id"),
9120
+ backgrounded: booleanField(payload, "is_backgrounded")
9121
+ });
9122
+ } else if (subtype === "task_progress") {
9123
+ upsert(taskId, { ...common, subagentType: stringField(payload, "subagent_type"), lastToolName: stringField(payload, "last_tool_name"), usage: usageOf(payload) });
9124
+ } else if (subtype === "task_updated") {
9125
+ const patch = isRecord2(payload.patch) ? payload.patch : {};
9126
+ upsert(taskId, { runId: stringField(payload, "run_id"), status: stringField(patch, "status") });
9127
+ } else {
9128
+ upsert(taskId, { ...common, status: stringField(payload, "status"), outputFile: stringField(payload, "output_file"), summary: stringField(payload, "summary"), usage: usageOf(payload) });
9129
+ }
9130
+ return bounded(next);
9131
+ }
9132
+ var MergedProvenanceSchema = z5.enum(["disk", "both"]);
9133
+ var MergedAgentNodeSchema = z5.lazy(
9134
+ () => z5.strictObject({
9135
+ ...AgentNodeFields,
9136
+ provenance: MergedProvenanceSchema,
9137
+ live: LiveTaskSchema.optional(),
9138
+ children: z5.array(MergedAgentNodeSchema)
9139
+ })
9140
+ );
9141
+ var MergedAgentTreeSchema = z5.strictObject({
9142
+ ...SessionAgentTreeSchema.shape,
9143
+ agents: z5.array(MergedAgentNodeSchema),
9144
+ /** The `cse_` sessions whose live tasks matched this session. Empty when the session is not live or the door has not observed it. */
9145
+ remoteSessions: z5.array(z5.string()),
9146
+ /** Live tasks of those sessions that match no disk agent (a backgrounded command, or an agent whose files have not appeared yet). */
9147
+ liveOnly: z5.array(LiveTaskSchema)
9148
+ });
9149
+ function mergeLiveTasks(tree, live) {
9150
+ const byTaskId = new Map(live.map((task) => [task.taskId, task]));
9151
+ const byToolUseId = new Map(live.flatMap((task) => task.toolUseId === void 0 ? [] : [[task.toolUseId, task]]));
9152
+ const claimed = /* @__PURE__ */ new Set();
9153
+ const merge = (node) => {
9154
+ const task = byTaskId.get(node.id) ?? (node.toolUseId === void 0 ? void 0 : byToolUseId.get(node.toolUseId));
9155
+ if (task !== void 0) {
9156
+ claimed.add(task.taskId);
9157
+ }
9158
+ return { ...node, provenance: task === void 0 ? "disk" : "both", ...task === void 0 ? {} : { live: task }, children: node.children.map(merge) };
9159
+ };
9160
+ const agents = tree.agents.map(merge);
9161
+ const sessionMarker = `/${tree.sessionId}/`;
9162
+ const liveOnly = live.filter((task) => !claimed.has(task.taskId) && task.outputFile?.includes(sessionMarker) === true);
9163
+ const remoteSessions = [...new Set([...claimed, ...liveOnly.map((task) => task.taskId)].flatMap((taskId) => byTaskId.get(taskId)?.sessionId ?? []))].sort();
9164
+ return { ...tree, agents, remoteSessions, liveOnly };
9165
+ }
9166
+
8909
9167
  // src/frontdoor/rcSessions.ts
8910
9168
  var RC_SESSIONS_PATH_PREFIX = "/v1/code/sessions";
8911
9169
  var RC_SESSION_ID_PREFIX = "cse_";
@@ -8946,7 +9204,7 @@ function sessionCreateId(body) {
8946
9204
  const id = session.id;
8947
9205
  return typeof id === "string" && id.startsWith(RC_SESSION_ID_PREFIX) ? id : void 0;
8948
9206
  }
8949
- function isRecord2(value) {
9207
+ function isRecord3(value) {
8950
9208
  return typeof value === "object" && value !== null && !Array.isArray(value);
8951
9209
  }
8952
9210
  function parseJsonObject(body) {
@@ -8956,7 +9214,7 @@ function parseJsonObject(body) {
8956
9214
  } catch {
8957
9215
  return void 0;
8958
9216
  }
8959
- return isRecord2(parsed) ? parsed : void 0;
9217
+ return isRecord3(parsed) ? parsed : void 0;
8960
9218
  }
8961
9219
  function nonEmptyString(record, field) {
8962
9220
  const value = record === void 0 ? void 0 : record[field];
@@ -8977,11 +9235,11 @@ function payloadEventsOf(body) {
8977
9235
  }
8978
9236
  const payloads = [];
8979
9237
  for (const event of events) {
8980
- if (!isRecord2(event)) {
9238
+ if (!isRecord3(event)) {
8981
9239
  continue;
8982
9240
  }
8983
9241
  const payload = event.payload;
8984
- if (!isRecord2(payload)) {
9242
+ if (!isRecord3(payload)) {
8985
9243
  continue;
8986
9244
  }
8987
9245
  payloads.push(payload);
@@ -8996,7 +9254,7 @@ function pendingOfControlRequestPayload(payload) {
8996
9254
  if (requestId === void 0) {
8997
9255
  return void 0;
8998
9256
  }
8999
- const request4 = isRecord2(payload.request) ? payload.request : void 0;
9257
+ const request4 = isRecord3(payload.request) ? payload.request : void 0;
9000
9258
  const subtype = nonEmptyString(request4, "subtype");
9001
9259
  const type = subtype ?? "control_request";
9002
9260
  let summary = "";
@@ -9013,20 +9271,21 @@ function answeredRequestIdsOfControlResponsePayload(payload) {
9013
9271
  if (payload.type !== "control_response") {
9014
9272
  return [];
9015
9273
  }
9016
- const response = isRecord2(payload.response) ? payload.response : void 0;
9274
+ const response = isRecord3(payload.response) ? payload.response : void 0;
9017
9275
  const id = nonEmptyString(response, "request_id") ?? nonEmptyString(payload, "request_id") ?? nonEmptyString(payload, "uuid");
9018
9276
  return id === void 0 ? [] : [id];
9019
9277
  }
9020
9278
  function parseRcRequestBody(kind, body) {
9021
9279
  if (kind === "heartbeat") {
9022
- return { controlRequests: [], answeredRequestIds: [], idleSeconds: finiteNumber(parseJsonObject(body), "idle_seconds"), workerStatus: void 0 };
9280
+ return { controlRequests: [], answeredRequestIds: [], idleSeconds: finiteNumber(parseJsonObject(body), "idle_seconds"), workerStatus: void 0, payloads: [] };
9023
9281
  }
9024
9282
  if (kind === "worker-registration") {
9025
- return { controlRequests: [], answeredRequestIds: [], idleSeconds: void 0, workerStatus: nonEmptyString(parseJsonObject(body), "worker_status") };
9283
+ return { controlRequests: [], answeredRequestIds: [], idleSeconds: void 0, workerStatus: nonEmptyString(parseJsonObject(body), "worker_status"), payloads: [] };
9026
9284
  }
9027
9285
  const controlRequests = [];
9028
9286
  const answeredRequestIds = [];
9029
- for (const payload of payloadEventsOf(body)) {
9287
+ const payloads = payloadEventsOf(body);
9288
+ for (const payload of payloads) {
9030
9289
  const pending = pendingOfControlRequestPayload(payload);
9031
9290
  if (pending !== void 0) {
9032
9291
  controlRequests.push({ requestId: pending.requestId, type: pending.type, summary: pending.summary });
@@ -9034,7 +9293,7 @@ function parseRcRequestBody(kind, body) {
9034
9293
  }
9035
9294
  answeredRequestIds.push(...answeredRequestIdsOfControlResponsePayload(payload));
9036
9295
  }
9037
- return { controlRequests, answeredRequestIds, idleSeconds: void 0, workerStatus: void 0 };
9296
+ return { controlRequests, answeredRequestIds, idleSeconds: void 0, workerStatus: void 0, payloads };
9038
9297
  }
9039
9298
  function createRcSessionTracker(deps) {
9040
9299
  const entries = /* @__PURE__ */ new Map();
@@ -9060,7 +9319,7 @@ function createRcSessionTracker(deps) {
9060
9319
  const timer = setInterval(sweep, deps.idleMs);
9061
9320
  timer.unref();
9062
9321
  const birth = (id, facts) => {
9063
- const record = { id, createdAt: deps.now(), lastSeenAt: deps.now(), ...facts, pending: /* @__PURE__ */ new Map(), workerState: void 0, workerIdleSeconds: void 0, sequenceNum: void 0 };
9322
+ 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() };
9064
9323
  entries.set(id, record);
9065
9324
  return record;
9066
9325
  };
@@ -9148,6 +9407,9 @@ function createRcSessionTracker(deps) {
9148
9407
  for (const requestId of factsOfBody.answeredRequestIds) {
9149
9408
  entryNow.pending.delete(requestId);
9150
9409
  }
9410
+ for (const payload of factsOfBody.payloads) {
9411
+ entryNow.liveTasks = applyAgentTaskEvent(entryNow.liveTasks, id, payload, now);
9412
+ }
9151
9413
  if (factsOfBody.idleSeconds !== void 0) {
9152
9414
  entryNow.workerIdleSeconds = { value: factsOfBody.idleSeconds, observedAt: now };
9153
9415
  }
@@ -9238,9 +9500,10 @@ function createRcSessionTracker(deps) {
9238
9500
  return;
9239
9501
  }
9240
9502
  entry.sequenceNum = entry.sequenceNum === void 0 || event.sequence_num > entry.sequenceNum ? event.sequence_num : entry.sequenceNum;
9241
- if (!isRecord2(event.payload)) {
9503
+ if (!isRecord3(event.payload)) {
9242
9504
  return;
9243
9505
  }
9506
+ entry.liveTasks = applyAgentTaskEvent(entry.liveTasks, sessionId, event.payload, deps.now());
9244
9507
  const pending = pendingOfControlRequestPayload(event.payload);
9245
9508
  if (pending !== void 0) {
9246
9509
  if (event.source === RC_STREAM_WORKER_SOURCE) {
@@ -9252,6 +9515,10 @@ function createRcSessionTracker(deps) {
9252
9515
  entry.pending.delete(requestId);
9253
9516
  }
9254
9517
  },
9518
+ liveTasksOf: (sessionId) => {
9519
+ sweep();
9520
+ 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)));
9521
+ },
9255
9522
  completePending: (sessionId, requestId) => {
9256
9523
  entries.get(sessionId)?.pending.delete(requestId);
9257
9524
  },
@@ -10656,11 +10923,11 @@ import path10 from "node:path";
10656
10923
  function isSafeSessionId(sessionId) {
10657
10924
  return /^[A-Za-z0-9_-]+$/.test(sessionId);
10658
10925
  }
10659
- function isRecord3(value) {
10926
+ function isRecord4(value) {
10660
10927
  return typeof value === "object" && value !== null && !Array.isArray(value);
10661
10928
  }
10662
10929
  function credentialOfJson(parsed) {
10663
- if (!isRecord3(parsed)) {
10930
+ if (!isRecord4(parsed)) {
10664
10931
  return void 0;
10665
10932
  }
10666
10933
  const { authorization, anthropicVersion, anthropicClientPlatform } = parsed;
@@ -10690,7 +10957,7 @@ function createRcCredentialStore(fs12, dir) {
10690
10957
  } catch {
10691
10958
  return void 0;
10692
10959
  }
10693
- return isRecord3(parsed) ? parsed : void 0;
10960
+ return isRecord4(parsed) ? parsed : void 0;
10694
10961
  };
10695
10962
  return {
10696
10963
  read: (sessionId) => {
@@ -10744,162 +11011,162 @@ import { Agent as Agent3, fetch as undiciFetch } from "undici";
10744
11011
  init_capability();
10745
11012
 
10746
11013
  // src/frontdoor/rcSchemas.ts
10747
- import { z as z4 } from "zod";
10748
- var RcPermissionModeSchema = z4.enum(RC_PERMISSION_MODES);
10749
- var RcSessionSummarySchema = z4.strictObject({
10750
- id: z4.string(),
10751
- createdAt: z4.number(),
10752
- lastSeenAt: z4.number()
11014
+ import { z as z6 } from "zod";
11015
+ var RcPermissionModeSchema = z6.enum(RC_PERMISSION_MODES);
11016
+ var RcSessionSummarySchema = z6.strictObject({
11017
+ id: z6.string(),
11018
+ createdAt: z6.number(),
11019
+ lastSeenAt: z6.number()
10753
11020
  });
10754
11021
  function workerFactSchema(value) {
10755
- return z4.strictObject({ value, observedAt: z4.number() });
10756
- }
10757
- var RcPendingRequestSummarySchema = z4.strictObject({
10758
- sessionId: z4.string(),
10759
- requestId: z4.string(),
10760
- type: z4.string(),
10761
- summary: z4.string(),
10762
- observedAt: z4.number()
11022
+ return z6.strictObject({ value, observedAt: z6.number() });
11023
+ }
11024
+ var RcPendingRequestSummarySchema = z6.strictObject({
11025
+ sessionId: z6.string(),
11026
+ requestId: z6.string(),
11027
+ type: z6.string(),
11028
+ summary: z6.string(),
11029
+ observedAt: z6.number()
10763
11030
  });
10764
- var RcSessionStatusSchema = z4.strictObject({
11031
+ var RcSessionStatusSchema = z6.strictObject({
10765
11032
  ...RcSessionSummarySchema.shape,
10766
- workerState: workerFactSchema(z4.string()).optional(),
10767
- workerIdleSeconds: workerFactSchema(z4.number()).optional(),
10768
- pending: z4.readonly(z4.array(RcPendingRequestSummarySchema))
11033
+ workerState: workerFactSchema(z6.string()).optional(),
11034
+ workerIdleSeconds: workerFactSchema(z6.number()).optional(),
11035
+ pending: z6.readonly(z6.array(RcPendingRequestSummarySchema))
10769
11036
  });
10770
- var RcStreamEnvelopeSchema = z4.looseObject({
11037
+ var RcStreamEnvelopeSchema = z6.looseObject({
10771
11038
  /** The envelope's own event id, when the host sent one. */
10772
- event_id: z4.string().optional(),
11039
+ event_id: z6.string().optional(),
10773
11040
  /** The envelope's event type, the discriminator a consumer switches on (`control_request`, `user`, and kin). */
10774
- event_type: z4.string(),
11041
+ event_type: z6.string(),
10775
11042
  /** The sequence number the host assigned, the value a resume continues after. */
10776
- sequence_num: z4.int(),
11043
+ sequence_num: z6.int(),
10777
11044
  /** Who emitted the event (`worker` for the CLI's half, a client id for a client's). */
10778
- source: z4.string(),
11045
+ source: z6.string(),
10779
11046
  /** 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. */
10780
- payload: z4.unknown().optional(),
11047
+ payload: z6.unknown().optional(),
10781
11048
  /** 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. */
10782
- created_at: z4.unknown().optional()
11049
+ created_at: z6.unknown().optional()
10783
11050
  });
10784
- var RcStreamEventSchema = z4.strictObject({
10785
- session: z4.string(),
11051
+ var RcStreamEventSchema = z6.strictObject({
11052
+ session: z6.string(),
10786
11053
  envelope: RcStreamEnvelopeSchema
10787
11054
  });
10788
- var RcRateLimitWindowSchema = z4.looseObject({
11055
+ var RcRateLimitWindowSchema = z6.looseObject({
10789
11056
  /** 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). */
10790
- utilization: z4.number().optional(),
11057
+ utilization: z6.number().optional(),
10791
11058
  /** 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. */
10792
- resetsAt: z4.number().optional()
11059
+ resetsAt: z6.number().optional()
10793
11060
  });
10794
- var RcRateLimitInfoSchema = z4.looseObject({
11061
+ var RcRateLimitInfoSchema = z6.looseObject({
10795
11062
  /** The limiting window's own status (`allowed`, `allowed_warning`, `rejected`), asserted only as a string because the vocabulary grows with the CLI. */
10796
- status: z4.string(),
11063
+ status: z6.string(),
10797
11064
  /** When the limiting window resets, in unix epoch seconds. */
10798
- resetsAt: z4.number().optional(),
11065
+ resetsAt: z6.number().optional(),
10799
11066
  /** Which window the top-level fields describe (`five_hour`, `seven_day`, and kin), the payload's own name for it. */
10800
- rateLimitType: z4.string().optional(),
11067
+ rateLimitType: z6.string().optional(),
10801
11068
  /** The fraction of the limiting window used, on the same scale the per-window utilizations carry. */
10802
- utilization: z4.number().optional(),
11069
+ utilization: z6.number().optional(),
10803
11070
  /** Whether usage beyond the plan (extra usage) is currently covering the overflow, the payload's own flag for it. */
10804
- isUsingOverage: z4.boolean().optional(),
11071
+ isUsingOverage: z6.boolean().optional(),
10805
11072
  /** The overage's own status, the same vocabulary the limiting window's `status` carries. */
10806
- overageStatus: z4.string().optional(),
11073
+ overageStatus: z6.string().optional(),
10807
11074
  /** When the overage window resets, in unix epoch seconds. */
10808
- overageResetsAt: z4.number().optional(),
11075
+ overageResetsAt: z6.number().optional(),
10809
11076
  /** 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. */
10810
- unifiedWindows: z4.looseObject({ five_hour: RcRateLimitWindowSchema.optional(), seven_day: RcRateLimitWindowSchema.optional(), seven_day_overage_included: RcRateLimitWindowSchema.optional() }).optional()
11077
+ unifiedWindows: z6.looseObject({ five_hour: RcRateLimitWindowSchema.optional(), seven_day: RcRateLimitWindowSchema.optional(), seven_day_overage_included: RcRateLimitWindowSchema.optional() }).optional()
10811
11078
  });
10812
- var RcLiveRateLimitSchema = z4.strictObject({
10813
- session: z4.string(),
10814
- observedAt: z4.number(),
11079
+ var RcLiveRateLimitSchema = z6.strictObject({
11080
+ session: z6.string(),
11081
+ observedAt: z6.number(),
10815
11082
  rateLimit: RcRateLimitInfoSchema
10816
11083
  });
10817
- var RcSessionQuerySchema = z4.strictObject({
10818
- session: z4.string().min(1).optional()
11084
+ var RcSessionQuerySchema = z6.strictObject({
11085
+ session: z6.string().min(1).optional()
10819
11086
  });
10820
- var RcSendInputSchema = z4.strictObject({
10821
- session: z4.string().min(1),
10822
- text: z4.string().min(1)
11087
+ var RcSendInputSchema = z6.strictObject({
11088
+ session: z6.string().min(1),
11089
+ text: z6.string().min(1)
10823
11090
  });
10824
- var RcAnswerInputSchema = z4.strictObject({
10825
- session: z4.string().min(1),
10826
- request: z4.string().min(1),
10827
- approve: z4.boolean(),
10828
- text: z4.string().optional()
11091
+ var RcAnswerInputSchema = z6.strictObject({
11092
+ session: z6.string().min(1),
11093
+ request: z6.string().min(1),
11094
+ approve: z6.boolean(),
11095
+ text: z6.string().optional()
10829
11096
  }).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" });
10830
- var RcInterruptInputSchema = z4.strictObject({
10831
- session: z4.string().min(1)
11097
+ var RcInterruptInputSchema = z6.strictObject({
11098
+ session: z6.string().min(1)
10832
11099
  });
10833
- var RcSetModelInputSchema = z4.strictObject({
10834
- session: z4.string().min(1),
10835
- model: z4.string().min(1)
11100
+ var RcSetModelInputSchema = z6.strictObject({
11101
+ session: z6.string().min(1),
11102
+ model: z6.string().min(1)
10836
11103
  });
10837
- var RcSetPermissionModeInputSchema = z4.strictObject({
10838
- session: z4.string().min(1),
11104
+ var RcSetPermissionModeInputSchema = z6.strictObject({
11105
+ session: z6.string().min(1),
10839
11106
  mode: RcPermissionModeSchema
10840
11107
  });
10841
- var RcEndSessionInputSchema = z4.strictObject({
10842
- session: z4.string().min(1),
10843
- reason: z4.string().min(1).optional()
11108
+ var RcEndSessionInputSchema = z6.strictObject({
11109
+ session: z6.string().min(1),
11110
+ reason: z6.string().min(1).optional()
10844
11111
  });
10845
- var RcGetUsageInputSchema = z4.strictObject({
10846
- session: z4.string().min(1),
10847
- skipBehaviors: z4.boolean().optional()
11112
+ var RcGetUsageInputSchema = z6.strictObject({
11113
+ session: z6.string().min(1),
11114
+ skipBehaviors: z6.boolean().optional()
10848
11115
  });
10849
- var RcGetContextUsageInputSchema = z4.strictObject({
10850
- session: z4.string().min(1),
10851
- detail: z4.enum(RC_CONTEXT_USAGE_DETAILS).optional()
11116
+ var RcGetContextUsageInputSchema = z6.strictObject({
11117
+ session: z6.string().min(1),
11118
+ detail: z6.enum(RC_CONTEXT_USAGE_DETAILS).optional()
10852
11119
  });
10853
- var RcReadFileInputSchema = z4.strictObject({
10854
- session: z4.string().min(1),
10855
- path: z4.string().min(1),
10856
- maxBytes: z4.number().int().positive().optional(),
10857
- encoding: z4.enum(RC_READ_FILE_ENCODINGS).optional()
11120
+ var RcReadFileInputSchema = z6.strictObject({
11121
+ session: z6.string().min(1),
11122
+ path: z6.string().min(1),
11123
+ maxBytes: z6.number().int().positive().optional(),
11124
+ encoding: z6.enum(RC_READ_FILE_ENCODINGS).optional()
10858
11125
  });
10859
- var RcFileSuggestionsInputSchema = z4.strictObject({
10860
- session: z4.string().min(1),
10861
- query: z4.string()
11126
+ var RcFileSuggestionsInputSchema = z6.strictObject({
11127
+ session: z6.string().min(1),
11128
+ query: z6.string()
10862
11129
  });
10863
- var RcKeepAliveInputSchema = z4.strictObject({
10864
- session: z4.string().min(1)
11130
+ var RcKeepAliveInputSchema = z6.strictObject({
11131
+ session: z6.string().min(1)
10865
11132
  });
10866
- var RcMcpStatusInputSchema = z4.strictObject({
10867
- session: z4.string().min(1)
11133
+ var RcMcpStatusInputSchema = z6.strictObject({
11134
+ session: z6.string().min(1)
10868
11135
  });
10869
- var RcMcpReconnectInputSchema = z4.strictObject({
10870
- session: z4.string().min(1),
10871
- serverName: z4.string().min(1)
11136
+ var RcMcpReconnectInputSchema = z6.strictObject({
11137
+ session: z6.string().min(1),
11138
+ serverName: z6.string().min(1)
10872
11139
  });
10873
- var RcMcpAuthenticateInputSchema = z4.strictObject({
10874
- session: z4.string().min(1),
10875
- serverName: z4.string().min(1),
10876
- redirectUri: z4.string().min(1)
11140
+ var RcMcpAuthenticateInputSchema = z6.strictObject({
11141
+ session: z6.string().min(1),
11142
+ serverName: z6.string().min(1),
11143
+ redirectUri: z6.string().min(1)
10877
11144
  });
10878
- var RcMcpOAuthCallbackUrlInputSchema = z4.strictObject({
10879
- session: z4.string().min(1),
10880
- serverName: z4.string().min(1),
10881
- callbackUrl: z4.string().min(1)
11145
+ var RcMcpOAuthCallbackUrlInputSchema = z6.strictObject({
11146
+ session: z6.string().min(1),
11147
+ serverName: z6.string().min(1),
11148
+ callbackUrl: z6.string().min(1)
10882
11149
  });
10883
- var RcTeleportInputSchema = z4.strictObject({
10884
- session: z4.string().min(1),
10885
- marker: z4.string().min(1)
11150
+ var RcTeleportInputSchema = z6.strictObject({
11151
+ session: z6.string().min(1),
11152
+ marker: z6.string().min(1)
10886
11153
  });
10887
- var RcListOutputSchema = z4.strictObject({ sessions: z4.readonly(z4.array(RcSessionSummarySchema)) });
10888
- var RcStatusOutputSchema = z4.strictObject({ statuses: z4.readonly(z4.array(RcSessionStatusSchema)) });
10889
- var RcPendingOutputSchema = z4.strictObject({ pending: z4.readonly(z4.array(RcPendingRequestSummarySchema)) });
10890
- var RcWriteOutputSchema = z4.strictObject({
10891
- session: z4.string(),
10892
- sequenceNums: z4.readonly(z4.array(z4.number()))
11154
+ var RcListOutputSchema = z6.strictObject({ sessions: z6.readonly(z6.array(RcSessionSummarySchema)) });
11155
+ var RcStatusOutputSchema = z6.strictObject({ statuses: z6.readonly(z6.array(RcSessionStatusSchema)) });
11156
+ var RcPendingOutputSchema = z6.strictObject({ pending: z6.readonly(z6.array(RcPendingRequestSummarySchema)) });
11157
+ var RcWriteOutputSchema = z6.strictObject({
11158
+ session: z6.string(),
11159
+ sequenceNums: z6.readonly(z6.array(z6.number()))
10893
11160
  });
10894
- var RcControlWriteOutputSchema = z4.strictObject({
10895
- session: z4.string(),
10896
- request: z4.string(),
10897
- sequenceNums: z4.readonly(z4.array(z4.number()))
11161
+ var RcControlWriteOutputSchema = z6.strictObject({
11162
+ session: z6.string(),
11163
+ request: z6.string(),
11164
+ sequenceNums: z6.readonly(z6.array(z6.number()))
10898
11165
  });
10899
- var RcAnswerOutputSchema = z4.strictObject({
10900
- session: z4.string(),
10901
- request: z4.string(),
10902
- sequenceNums: z4.readonly(z4.array(z4.number()))
11166
+ var RcAnswerOutputSchema = z6.strictObject({
11167
+ session: z6.string(),
11168
+ request: z6.string(),
11169
+ sequenceNums: z6.readonly(z6.array(z6.number()))
10903
11170
  });
10904
11171
 
10905
11172
  // src/frontdoor/rcApi.ts
@@ -11086,48 +11353,48 @@ init_cliError();
11086
11353
  init_package();
11087
11354
 
11088
11355
  // src/codex/appServerSchemas.ts
11089
- import { z as z5 } from "zod";
11356
+ import { z as z7 } from "zod";
11090
11357
  var CODEX_APP_SERVER_GENERATED_AGAINST = "0.160.0";
11091
- var RateLimitWindowSchema = z5.object({
11092
- usedPercent: z5.number(),
11093
- resetsAt: z5.number().nullish(),
11094
- windowDurationMins: z5.number().nullish()
11358
+ var RateLimitWindowSchema = z7.object({
11359
+ usedPercent: z7.number(),
11360
+ resetsAt: z7.number().nullish(),
11361
+ windowDurationMins: z7.number().nullish()
11095
11362
  });
11096
- var RateLimitSnapshotSchema = z5.object({
11097
- limitId: z5.string().nullish(),
11098
- limitName: z5.string().nullish(),
11099
- planType: z5.string().nullish(),
11363
+ var RateLimitSnapshotSchema = z7.object({
11364
+ limitId: z7.string().nullish(),
11365
+ limitName: z7.string().nullish(),
11366
+ planType: z7.string().nullish(),
11100
11367
  primary: RateLimitWindowSchema.nullish(),
11101
11368
  secondary: RateLimitWindowSchema.nullish(),
11102
- rateLimitReachedType: z5.string().nullish(),
11103
- spendControlReached: z5.boolean().nullish()
11369
+ rateLimitReachedType: z7.string().nullish(),
11370
+ spendControlReached: z7.boolean().nullish()
11104
11371
  });
11105
- var RateLimitResetCreditSchema = z5.object({
11106
- id: z5.string(),
11107
- grantedAt: z5.number(),
11108
- expiresAt: z5.number().nullish(),
11109
- resetType: z5.string(),
11110
- status: z5.string(),
11111
- title: z5.string().nullish(),
11112
- description: z5.string().nullish()
11372
+ var RateLimitResetCreditSchema = z7.object({
11373
+ id: z7.string(),
11374
+ grantedAt: z7.number(),
11375
+ expiresAt: z7.number().nullish(),
11376
+ resetType: z7.string(),
11377
+ status: z7.string(),
11378
+ title: z7.string().nullish(),
11379
+ description: z7.string().nullish()
11113
11380
  });
11114
- var CodexAccountSchema = z5.discriminatedUnion("type", [
11115
- z5.object({ type: z5.literal("apiKey") }),
11116
- z5.object({ type: z5.literal("chatgpt"), email: z5.string().nullable(), planType: z5.string() }),
11117
- z5.object({ type: z5.literal("amazonBedrock"), usesCodexManagedCredentials: z5.boolean().default(false) })
11381
+ var CodexAccountSchema = z7.discriminatedUnion("type", [
11382
+ z7.object({ type: z7.literal("apiKey") }),
11383
+ z7.object({ type: z7.literal("chatgpt"), email: z7.string().nullable(), planType: z7.string() }),
11384
+ z7.object({ type: z7.literal("amazonBedrock"), usesCodexManagedCredentials: z7.boolean().default(false) })
11118
11385
  ]);
11119
- var CodexAccountReadSchema = z5.object({
11386
+ var CodexAccountReadSchema = z7.object({
11120
11387
  account: CodexAccountSchema.nullable(),
11121
- requiresOpenaiAuth: z5.boolean()
11388
+ requiresOpenaiAuth: z7.boolean()
11122
11389
  });
11123
- var CodexRateLimitsReadSchema = z5.object({
11390
+ var CodexRateLimitsReadSchema = z7.object({
11124
11391
  rateLimits: RateLimitSnapshotSchema,
11125
- rateLimitsByLimitId: z5.record(z5.string(), RateLimitSnapshotSchema).nullish(),
11126
- rateLimitResetCredits: z5.object({ availableCount: z5.number(), credits: z5.array(RateLimitResetCreditSchema).nullish() }).nullish(),
11127
- accountId: z5.string().nullish(),
11128
- ordinaryUsageAllowed: z5.boolean().nullish()
11392
+ rateLimitsByLimitId: z7.record(z7.string(), RateLimitSnapshotSchema).nullish(),
11393
+ rateLimitResetCredits: z7.object({ availableCount: z7.number(), credits: z7.array(RateLimitResetCreditSchema).nullish() }).nullish(),
11394
+ accountId: z7.string().nullish(),
11395
+ ordinaryUsageAllowed: z7.boolean().nullish()
11129
11396
  });
11130
- var CodexInitializeResultSchema = z5.object({ userAgent: z5.string() });
11397
+ var CodexInitializeResultSchema = z7.object({ userAgent: z7.string() });
11131
11398
 
11132
11399
  // src/codex/appServer.ts
11133
11400
  var CodexAppServerUnavailableError = class extends CliError {
@@ -11715,7 +11982,7 @@ init_providersStore();
11715
11982
  init_projects();
11716
11983
  init_pipeline();
11717
11984
  import path25 from "node:path";
11718
- import { z as z13 } from "zod";
11985
+ import { z as z15 } from "zod";
11719
11986
  var HISTORY_PROJECTS_KEY_PREFIX = "history/projects/";
11720
11987
  function projectFragmentOf(rawKey) {
11721
11988
  return rawKey.startsWith(HISTORY_PROJECTS_KEY_PREFIX) ? rawKey.slice(HISTORY_PROJECTS_KEY_PREFIX.length) : void 0;
@@ -11792,9 +12059,9 @@ function lookupKeychainService(run, farmRoot) {
11792
12059
  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}".`
11793
12060
  };
11794
12061
  }
11795
- var SettingsSecretsShapeSchema = z13.looseObject({
11796
- env: z13.record(z13.string(), z13.unknown()).optional(),
11797
- hooks: z13.record(z13.string(), z13.array(z13.unknown())).optional()
12062
+ var SettingsSecretsShapeSchema = z15.looseObject({
12063
+ env: z15.record(z15.string(), z15.unknown()).optional(),
12064
+ hooks: z15.record(z15.string(), z15.array(z15.unknown())).optional()
11798
12065
  });
11799
12066
  function hookCommandCountOf(group) {
11800
12067
  if (typeof group !== "object" || group === null) {
@@ -12090,7 +12357,7 @@ init_schema();
12090
12357
  init_claudeVersion();
12091
12358
  init_identity();
12092
12359
  init_projects();
12093
- import { z as z15 } from "zod";
12360
+ import { z as z17 } from "zod";
12094
12361
 
12095
12362
  // src/resolve/types.ts
12096
12363
  var LAYER_KINDS = [
@@ -12151,123 +12418,123 @@ var DIAGNOSTIC_SEVERITIES = ["error", "warning", "info"];
12151
12418
 
12152
12419
  // src/usage/pickReportSchema.ts
12153
12420
  init_plan2();
12154
- import { z as z14 } from "zod";
12155
- var PoolPickCandidateViewSchema = z14.strictObject({
12156
- identity: z14.string(),
12421
+ import { z as z16 } from "zod";
12422
+ var PoolPickCandidateViewSchema = z16.strictObject({
12423
+ identity: z16.string(),
12157
12424
  /** In pick order: `scored` has usable quota data, `unknown` has none, `pay-per-use` bills by use, `ineligible` is refused right now. */
12158
- class: z14.enum(["scored", "unknown", "pay-per-use", "ineligible"]),
12425
+ class: z16.enum(["scored", "unknown", "pay-per-use", "ineligible"]),
12159
12426
  /** Plan-size-weighted remaining quota per hour until its reset; present for `scored` only. */
12160
- score: z14.number().optional(),
12427
+ score: z16.number().optional(),
12161
12428
  /** 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`. */
12162
- scoreWindow: z14.enum(["sevenDay", "fiveHour"]).optional(),
12429
+ scoreWindow: z16.enum(["sevenDay", "fiveHour"]).optional(),
12163
12430
  /** False when the five-hour window would run dry, at the observed pace, before it resets. */
12164
- feasible: z14.boolean(),
12431
+ feasible: z16.boolean(),
12165
12432
  /** When an `ineligible` member can be used again, as an ISO instant. */
12166
- blockedUntil: z14.iso.datetime().optional(),
12433
+ blockedUntil: z16.iso.datetime().optional(),
12167
12434
  plan: PlanClassSchema,
12168
12435
  /** The facts behind the class and score, in the order they matter. */
12169
- reasons: z14.array(z14.string())
12436
+ reasons: z16.array(z16.string())
12170
12437
  });
12171
- var PoolPickReportSchema = z14.strictObject({
12172
- pool: z14.string(),
12173
- directory: z14.string(),
12438
+ var PoolPickReportSchema = z16.strictObject({
12439
+ pool: z16.string(),
12440
+ directory: z16.string(),
12174
12441
  /** The member a launch would run as, absent when every member is refused. */
12175
- pick: z14.string().optional(),
12176
- candidates: z14.array(PoolPickCandidateViewSchema),
12442
+ pick: z16.string().optional(),
12443
+ candidates: z16.array(PoolPickCandidateViewSchema),
12177
12444
  /** Identity members anywhere in the pool's graph that do not exist; a launch skips them. */
12178
- missing: z14.array(z14.string()),
12445
+ missing: z16.array(z16.string()),
12179
12446
  /** When nothing can be picked, the soonest any member returns. */
12180
- earliestReturn: z14.strictObject({ identity: z14.string(), at: z14.iso.datetime() }).optional(),
12447
+ earliestReturn: z16.strictObject({ identity: z16.string(), at: z16.iso.datetime() }).optional(),
12181
12448
  /** The member a resumed conversation started on but moved off, and why, when the ranking could not keep it. */
12182
- movedOff: z14.strictObject({ identity: z14.string(), reason: z14.string() }).optional(),
12449
+ movedOff: z16.strictObject({ identity: z16.string(), reason: z16.string() }).optional(),
12183
12450
  /** Why the last-pick record could not be read, when that is the case. */
12184
- stickyProblem: z14.string().optional()
12451
+ stickyProblem: z16.string().optional()
12185
12452
  });
12186
12453
 
12187
12454
  // src/checkReportSchema.ts
12188
12455
  var CHECK_CREDENTIAL_APPLIES = ["provider", "identity", "stored-login"];
12189
- var CheckLayerViewSchema = z15.strictObject({
12190
- id: z15.int(),
12191
- kind: z15.enum(LAYER_KINDS),
12192
- source: z15.string()
12456
+ var CheckLayerViewSchema = z17.strictObject({
12457
+ id: z17.int(),
12458
+ kind: z17.enum(LAYER_KINDS),
12459
+ source: z17.string()
12193
12460
  });
12194
- var CheckEntryViewSchema = z15.strictObject({
12195
- path: z15.string(),
12196
- shared: z15.boolean(),
12197
- via: z15.enum(DECISION_VIAS),
12461
+ var CheckEntryViewSchema = z17.strictObject({
12462
+ path: z17.string(),
12463
+ shared: z17.boolean(),
12464
+ via: z17.enum(DECISION_VIAS),
12198
12465
  /** The entry's real category, or null when nothing classifies it. */
12199
- category: z15.enum(CATEGORY_NAMES).nullable(),
12200
- rule: z15.strictObject({ key: z15.string(), layer: z15.int() }).optional(),
12466
+ category: z17.enum(CATEGORY_NAMES).nullable(),
12467
+ rule: z17.strictObject({ key: z17.string(), layer: z17.int() }).optional(),
12201
12468
  /** Rules that matched but whose `when` condition failed, each with the conditions that failed. */
12202
- eliminated: z15.readonly(z15.array(z15.strictObject({ key: z15.string(), failed: z15.readonly(z15.array(z15.string())) }))).optional()
12469
+ eliminated: z17.readonly(z17.array(z17.strictObject({ key: z17.string(), failed: z17.readonly(z17.array(z17.string())) }))).optional()
12203
12470
  });
12204
- var CheckDiagnosticSchema = z15.strictObject({
12205
- code: z15.enum(DIAGNOSTIC_CODES),
12206
- severity: z15.enum(DIAGNOSTIC_SEVERITIES),
12207
- message: z15.string(),
12208
- subject: z15.string().optional(),
12209
- layer: z15.int().optional()
12471
+ var CheckDiagnosticSchema = z17.strictObject({
12472
+ code: z17.enum(DIAGNOSTIC_CODES),
12473
+ severity: z17.enum(DIAGNOSTIC_SEVERITIES),
12474
+ message: z17.string(),
12475
+ subject: z17.string().optional(),
12476
+ layer: z17.int().optional()
12210
12477
  });
12211
- var CheckAmbientCredentialSchema = z15.union([z15.strictObject({ ok: z15.literal(true) }), z15.strictObject({ ok: z15.literal(false), variable: z15.string(), message: z15.string() })]);
12212
- var CheckKeychainSchema = z15.strictObject({
12213
- checked: z15.literal(true),
12214
- found: z15.boolean(),
12215
- serviceName: z15.string().optional(),
12216
- note: z15.string()
12478
+ var CheckAmbientCredentialSchema = z17.union([z17.strictObject({ ok: z17.literal(true) }), z17.strictObject({ ok: z17.literal(false), variable: z17.string(), message: z17.string() })]);
12479
+ var CheckKeychainSchema = z17.strictObject({
12480
+ checked: z17.literal(true),
12481
+ found: z17.boolean(),
12482
+ serviceName: z17.string().optional(),
12483
+ note: z17.string()
12217
12484
  });
12218
- var CheckSettingsExposureSchema = z15.strictObject({
12219
- file: z15.string(),
12220
- envKeyNames: z15.readonly(z15.array(z15.string())),
12221
- hookEventNames: z15.readonly(z15.array(z15.string())),
12222
- hookCommandCount: z15.int().nonnegative()
12485
+ var CheckSettingsExposureSchema = z17.strictObject({
12486
+ file: z17.string(),
12487
+ envKeyNames: z17.readonly(z17.array(z17.string())),
12488
+ hookEventNames: z17.readonly(z17.array(z17.string())),
12489
+ hookCommandCount: z17.int().nonnegative()
12223
12490
  });
12224
- var CredentialSourceSummarySchema = z15.union([
12225
- z15.strictObject({ kind: z15.literal("env"), variable: z15.string() }),
12226
- z15.strictObject({ kind: z15.literal("file"), path: z15.string() }),
12227
- z15.strictObject({ kind: z15.literal("command"), program: z15.string() }),
12228
- z15.strictObject({ kind: z15.literal("op"), reference: z15.string() }),
12229
- z15.strictObject({ kind: z15.literal("keychain"), service: z15.string(), account: z15.string().optional() }),
12230
- z15.strictObject({ kind: z15.literal("literal") })
12491
+ var CredentialSourceSummarySchema = z17.union([
12492
+ z17.strictObject({ kind: z17.literal("env"), variable: z17.string() }),
12493
+ z17.strictObject({ kind: z17.literal("file"), path: z17.string() }),
12494
+ z17.strictObject({ kind: z17.literal("command"), program: z17.string() }),
12495
+ z17.strictObject({ kind: z17.literal("op"), reference: z17.string() }),
12496
+ z17.strictObject({ kind: z17.literal("keychain"), service: z17.string(), account: z17.string().optional() }),
12497
+ z17.strictObject({ kind: z17.literal("literal") })
12231
12498
  ]);
12232
- var CredentialSummarySchema = z15.strictObject({
12233
- target: z15.enum(CREDENTIAL_TARGETS),
12234
- sources: z15.readonly(z15.array(CredentialSourceSummarySchema)),
12499
+ var CredentialSummarySchema = z17.strictObject({
12500
+ target: z17.enum(CREDENTIAL_TARGETS),
12501
+ sources: z17.readonly(z17.array(CredentialSourceSummarySchema)),
12235
12502
  cache: CredentialCacheSchema.optional()
12236
12503
  });
12237
- var CachedCredentialStateSchema = z15.union([
12238
- z15.strictObject({ store: z15.enum(CREDENTIAL_CACHE_STORES), status: z15.literal("empty") }),
12239
- z15.strictObject({ store: z15.enum(CREDENTIAL_CACHE_STORES), status: z15.literal("unreadable"), reason: z15.string() }),
12240
- z15.strictObject({ store: z15.enum(CREDENTIAL_CACHE_STORES), status: z15.enum(["fresh", "expired"]), ageMs: z15.number(), expiresInMs: z15.number().optional() })
12504
+ var CachedCredentialStateSchema = z17.union([
12505
+ z17.strictObject({ store: z17.enum(CREDENTIAL_CACHE_STORES), status: z17.literal("empty") }),
12506
+ z17.strictObject({ store: z17.enum(CREDENTIAL_CACHE_STORES), status: z17.literal("unreadable"), reason: z17.string() }),
12507
+ z17.strictObject({ store: z17.enum(CREDENTIAL_CACHE_STORES), status: z17.enum(["fresh", "expired"]), ageMs: z17.number(), expiresInMs: z17.number().optional() })
12241
12508
  ]);
12242
- var CheckCredentialProviderSchema = z15.union([
12243
- z15.strictObject({ name: z15.string(), credential: CredentialSummarySchema, cached: CachedCredentialStateSchema.optional() }),
12244
- z15.strictObject({ name: z15.string(), problem: z15.string() })
12509
+ var CheckCredentialProviderSchema = z17.union([
12510
+ z17.strictObject({ name: z17.string(), credential: CredentialSummarySchema, cached: CachedCredentialStateSchema.optional() }),
12511
+ z17.strictObject({ name: z17.string(), problem: z17.string() })
12245
12512
  ]);
12246
- var CheckCredentialSchema = z15.strictObject({
12247
- applies: z15.enum(CHECK_CREDENTIAL_APPLIES),
12513
+ var CheckCredentialSchema = z17.strictObject({
12514
+ applies: z17.enum(CHECK_CREDENTIAL_APPLIES),
12248
12515
  provider: CheckCredentialProviderSchema.optional(),
12249
12516
  identity: CredentialSummarySchema.optional(),
12250
12517
  identityCached: CachedCredentialStateSchema.optional()
12251
12518
  });
12252
- var CheckClaudeVersionSchema = z15.strictObject({
12253
- pinned: z15.strictObject({ version: z15.string(), source: z15.enum(CLAUDE_VERSION_SOURCES), installed: z15.boolean() }).optional(),
12254
- highestInstalled: z15.string().optional(),
12255
- installed: z15.readonly(z15.array(z15.string()))
12519
+ var CheckClaudeVersionSchema = z17.strictObject({
12520
+ pinned: z17.strictObject({ version: z17.string(), source: z17.enum(CLAUDE_VERSION_SOURCES), installed: z17.boolean() }).optional(),
12521
+ highestInstalled: z17.string().optional(),
12522
+ installed: z17.readonly(z17.array(z17.string()))
12256
12523
  });
12257
- var CheckReportJsonSchema = z15.strictObject({
12258
- identity: z15.strictObject({ name: z15.string().nullable(), source: z15.enum(IDENTITY_DECISION_SOURCES) }),
12524
+ var CheckReportJsonSchema = z17.strictObject({
12525
+ identity: z17.strictObject({ name: z17.string().nullable(), source: z17.enum(IDENTITY_DECISION_SOURCES) }),
12259
12526
  /** The pool ranking, when the launch named a pool instead of an identity. */
12260
12527
  pool: PoolPickReportSchema.optional(),
12261
- configProfile: z15.strictObject({ name: z15.string().nullable(), source: z15.enum(CONFIG_PROFILE_DECISION_SOURCES) }),
12262
- layers: z15.readonly(z15.array(CheckLayerViewSchema)),
12263
- entries: z15.readonly(z15.array(CheckEntryViewSchema)),
12264
- projectEncodingAmbiguities: z15.readonly(
12265
- z15.array(z15.strictObject({ fragment: z15.string(), encoded: z15.string(), reason: z15.enum(ENCODING_AMBIGUITY_REASONS), detail: z15.string() }))
12528
+ configProfile: z17.strictObject({ name: z17.string().nullable(), source: z17.enum(CONFIG_PROFILE_DECISION_SOURCES) }),
12529
+ layers: z17.readonly(z17.array(CheckLayerViewSchema)),
12530
+ entries: z17.readonly(z17.array(CheckEntryViewSchema)),
12531
+ projectEncodingAmbiguities: z17.readonly(
12532
+ z17.array(z17.strictObject({ fragment: z17.string(), encoded: z17.string(), reason: z17.enum(ENCODING_AMBIGUITY_REASONS), detail: z17.string() }))
12266
12533
  ),
12267
- diagnostics: z15.readonly(z15.array(CheckDiagnosticSchema)),
12534
+ diagnostics: z17.readonly(z17.array(CheckDiagnosticSchema)),
12268
12535
  ambientCredential: CheckAmbientCredentialSchema,
12269
12536
  keychain: CheckKeychainSchema.optional(),
12270
- settingsExposure: z15.readonly(z15.array(CheckSettingsExposureSchema)),
12537
+ settingsExposure: z17.readonly(z17.array(CheckSettingsExposureSchema)),
12271
12538
  credential: CheckCredentialSchema,
12272
12539
  claudeVersion: CheckClaudeVersionSchema.optional()
12273
12540
  });
@@ -12327,28 +12594,28 @@ function collectResets(snapshots, nowMs) {
12327
12594
  }
12328
12595
 
12329
12596
  // src/usage/resetsSchema.ts
12330
- import { z as z16 } from "zod";
12331
- var ResetRowSchema = z16.strictObject({
12332
- identity: z16.string(),
12333
- provider: z16.string(),
12597
+ import { z as z18 } from "zod";
12598
+ var ResetRowSchema = z18.strictObject({
12599
+ identity: z18.string(),
12600
+ provider: z18.string(),
12334
12601
  /** What the window is: `5h`, `7d` or `extra usage` for an Anthropic account, or the provider's own measure and period (`tokens 5h`). */
12335
- window: z16.string(),
12602
+ window: z18.string(),
12336
12603
  /** When the state the window comes from was observed, as an ISO instant. */
12337
- observedAt: z16.iso.datetime(),
12604
+ observedAt: z18.iso.datetime(),
12338
12605
  /** When the window resets, as an ISO instant; absent when the upstream reported none. */
12339
- resetsAt: z16.iso.datetime().optional(),
12606
+ resetsAt: z18.iso.datetime().optional(),
12340
12607
  /** True when the reset time has passed, so the recorded observation describes a window that no longer exists and its utilisation reads as 0. */
12341
- reset: z16.boolean(),
12608
+ reset: z18.boolean(),
12342
12609
  /** The fraction used, as `effectiveWindow` reads it at the report's own clock. */
12343
- utilization: z16.number().optional(),
12610
+ utilization: z18.number().optional(),
12344
12611
  /** The window's own status, for a window that has not reset yet. */
12345
- status: z16.string().optional()
12612
+ status: z18.string().optional()
12346
12613
  });
12347
- var ResetScheduleSchema = z16.strictObject({ resets: z16.readonly(z16.array(ResetRowSchema)) });
12614
+ var ResetScheduleSchema = z18.strictObject({ resets: z18.readonly(z18.array(ResetRowSchema)) });
12348
12615
 
12349
12616
  // src/frontdoor/controlSchemas.ts
12350
12617
  import path30 from "node:path";
12351
- import { z as z21 } from "zod";
12618
+ import { z as z23 } from "zod";
12352
12619
 
12353
12620
  // src/doctorReport.ts
12354
12621
  init_claudeShim();
@@ -12549,24 +12816,24 @@ function credentialsFilePath(farmRoot) {
12549
12816
  }
12550
12817
 
12551
12818
  // src/codex/siwcStore.ts
12552
- import { z as z20 } from "zod";
12819
+ import { z as z22 } from "zod";
12553
12820
 
12554
12821
  // src/codex/auth.ts
12555
- import { z as z18 } from "zod";
12556
- var AuthFileSchema = z18.looseObject({
12557
- tokens: z18.looseObject({
12558
- access_token: z18.string().optional(),
12559
- refresh_token: z18.string().optional(),
12560
- id_token: z18.string().optional(),
12561
- account_id: z18.string().optional()
12822
+ import { z as z20 } from "zod";
12823
+ var AuthFileSchema = z20.looseObject({
12824
+ tokens: z20.looseObject({
12825
+ access_token: z20.string().optional(),
12826
+ refresh_token: z20.string().optional(),
12827
+ id_token: z20.string().optional(),
12828
+ account_id: z20.string().optional()
12562
12829
  }).nullish(),
12563
- last_refresh: z18.string().optional()
12830
+ last_refresh: z20.string().optional()
12564
12831
  });
12565
- var TokenGrantSchema = z18.looseObject({
12566
- access_token: z18.string().min(1).optional(),
12567
- refresh_token: z18.string().min(1).optional(),
12568
- id_token: z18.string().min(1).optional(),
12569
- account_id: z18.string().min(1).optional()
12832
+ var TokenGrantSchema = z20.looseObject({
12833
+ access_token: z20.string().min(1).optional(),
12834
+ refresh_token: z20.string().min(1).optional(),
12835
+ id_token: z20.string().min(1).optional(),
12836
+ account_id: z20.string().min(1).optional()
12570
12837
  });
12571
12838
  var CodexAuthError = class extends Error {
12572
12839
  constructor(message) {
@@ -12576,41 +12843,41 @@ var CodexAuthError = class extends Error {
12576
12843
  };
12577
12844
 
12578
12845
  // src/codex/siwc.ts
12579
- import { z as z19 } from "zod";
12846
+ import { z as z21 } from "zod";
12580
12847
  var SIWC_RESOURCE = "https://api.openai.com/v1";
12581
12848
  var SIWC_RESPONSES_URL = `${SIWC_RESOURCE}/responses`;
12582
12849
  var SIWC_PLAN_SCOPE = "chatgpt.tokens.use.direct";
12583
- var TokenResponseSchema = z19.looseObject({
12584
- access_token: z19.string().min(1),
12585
- refresh_token: z19.string().min(1).optional(),
12586
- id_token: z19.string().min(1).optional(),
12587
- expires_in: z19.number().positive(),
12588
- scope: z19.string().optional()
12850
+ var TokenResponseSchema = z21.looseObject({
12851
+ access_token: z21.string().min(1),
12852
+ refresh_token: z21.string().min(1).optional(),
12853
+ id_token: z21.string().min(1).optional(),
12854
+ expires_in: z21.number().positive(),
12855
+ scope: z21.string().optional()
12589
12856
  });
12590
- var JwtHeaderSchema = z19.looseObject({ alg: z19.string(), kid: z19.string().optional() });
12591
- var IdTokenClaimsSchema = z19.looseObject({
12592
- iss: z19.string(),
12593
- sub: z19.string().min(1),
12594
- aud: z19.union([z19.string(), z19.array(z19.string())]),
12595
- exp: z19.number(),
12596
- nonce: z19.string().optional(),
12597
- email: z19.string().optional()
12857
+ var JwtHeaderSchema = z21.looseObject({ alg: z21.string(), kid: z21.string().optional() });
12858
+ var IdTokenClaimsSchema = z21.looseObject({
12859
+ iss: z21.string(),
12860
+ sub: z21.string().min(1),
12861
+ aud: z21.union([z21.string(), z21.array(z21.string())]),
12862
+ exp: z21.number(),
12863
+ nonce: z21.string().optional(),
12864
+ email: z21.string().optional()
12598
12865
  });
12599
- var JwksSchema = z19.object({ keys: z19.array(z19.looseObject({ kid: z19.string().optional(), kty: z19.string() })) });
12866
+ var JwksSchema = z21.object({ keys: z21.array(z21.looseObject({ kid: z21.string().optional(), kty: z21.string() })) });
12600
12867
 
12601
12868
  // src/codex/siwcStore.ts
12602
- var SiwcGrantSchema = z20.strictObject({
12603
- clientId: z20.string().min(1),
12604
- sub: z20.string().min(1),
12605
- email: z20.string().optional(),
12606
- idToken: z20.string().min(1),
12607
- accessToken: z20.string().min(1),
12608
- refreshToken: z20.string().min(1),
12609
- scopes: z20.array(z20.string()).readonly(),
12869
+ var SiwcGrantSchema = z22.strictObject({
12870
+ clientId: z22.string().min(1),
12871
+ sub: z22.string().min(1),
12872
+ email: z22.string().optional(),
12873
+ idToken: z22.string().min(1),
12874
+ accessToken: z22.string().min(1),
12875
+ refreshToken: z22.string().min(1),
12876
+ scopes: z22.array(z22.string()).readonly(),
12610
12877
  /** When the access token stops working, in milliseconds since the epoch. */
12611
- expiresAt: z20.number()
12878
+ expiresAt: z22.number()
12612
12879
  });
12613
- var SiwcFileSchema = z20.strictObject({ registeredClientId: z20.string().min(1).optional(), grant: SiwcGrantSchema.optional() });
12880
+ var SiwcFileSchema = z22.strictObject({ registeredClientId: z22.string().min(1).optional(), grant: SiwcGrantSchema.optional() });
12614
12881
  function parseSiwcFile(raw, filePath) {
12615
12882
  let json;
12616
12883
  try {
@@ -13307,90 +13574,90 @@ function collectDoctorReport(params) {
13307
13574
  // src/frontdoor/controlSchemas.ts
13308
13575
  init_schema2();
13309
13576
  init_state();
13310
- var UsageListOutputSchema = z21.strictObject({ snapshots: z21.readonly(z21.array(UsageSnapshotSchema)) });
13311
- var UsageWindowsInputSchema = z21.strictObject({
13312
- identity: z21.string().min(1),
13313
- provider: z21.string().min(1).optional()
13577
+ var UsageListOutputSchema = z23.strictObject({ snapshots: z23.readonly(z23.array(UsageSnapshotSchema)) });
13578
+ var UsageWindowsInputSchema = z23.strictObject({
13579
+ identity: z23.string().min(1),
13580
+ provider: z23.string().min(1).optional()
13314
13581
  });
13315
- var EffectiveWindowSchema = z21.strictObject({
13582
+ var EffectiveWindowSchema = z23.strictObject({
13316
13583
  /** True when the window's reset time has passed, so the recorded observation describes a window that no longer exists. */
13317
- reset: z21.boolean(),
13584
+ reset: z23.boolean(),
13318
13585
  /** The fraction used: 0 for a reset window, otherwise what was last observed, absent when none was reported. */
13319
- utilization: z21.number().optional(),
13586
+ utilization: z23.number().optional(),
13320
13587
  /** The reset instant, for a window that has not reset yet and reported one. */
13321
- resetsAtMs: z21.number().optional(),
13588
+ resetsAtMs: z23.number().optional(),
13322
13589
  /** The window's own status, for a window that has not reset yet. */
13323
- status: z21.string().optional()
13590
+ status: z23.string().optional()
13324
13591
  });
13325
- var UsageWindowsOutputSchema = z21.strictObject({
13326
- identity: z21.string(),
13327
- provider: z21.string(),
13592
+ var UsageWindowsOutputSchema = z23.strictObject({
13593
+ identity: z23.string(),
13594
+ provider: z23.string(),
13328
13595
  /** When the rate-limit state the windows come from was observed. */
13329
- observedAt: z21.iso.datetime().optional(),
13596
+ observedAt: z23.iso.datetime().optional(),
13330
13597
  fiveHour: EffectiveWindowSchema.optional(),
13331
13598
  sevenDay: EffectiveWindowSchema.optional()
13332
13599
  });
13333
- var UsageLiveOutputSchema = z21.strictObject({
13600
+ var UsageLiveOutputSchema = z23.strictObject({
13334
13601
  /** 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. */
13335
13602
  latest: RcLiveRateLimitSchema.optional(),
13336
13603
  /** One observation per session whose stream has filed a rate_limit_event this door generation. */
13337
- sessions: z21.readonly(z21.array(RcLiveRateLimitSchema))
13604
+ sessions: z23.readonly(z23.array(RcLiveRateLimitSchema))
13338
13605
  });
13339
- var FrontDoorSessionStatusSchema = z21.strictObject({
13340
- pid: z21.int().positive(),
13341
- startedAt: z21.number(),
13342
- alive: z21.boolean()
13606
+ var FrontDoorSessionStatusSchema = z23.strictObject({
13607
+ pid: z23.int().positive(),
13608
+ startedAt: z23.number(),
13609
+ alive: z23.boolean()
13343
13610
  });
13344
- var HeadroomSocketTargetSchema = z21.union([z21.strictObject({ socketPath: z21.string() }), z21.strictObject({ refused: z21.string() })]);
13345
- var FrontDoorStatusOutputSchema = z21.strictObject({
13611
+ var HeadroomSocketTargetSchema = z23.union([z23.strictObject({ socketPath: z23.string() }), z23.strictObject({ refused: z23.string() })]);
13612
+ var FrontDoorStatusOutputSchema = z23.strictObject({
13346
13613
  state: FrontDoorStateSchema,
13347
- supervisorAlive: z21.boolean(),
13348
- sessions: z21.readonly(z21.array(FrontDoorSessionStatusSchema)),
13614
+ supervisorAlive: z23.boolean(),
13615
+ sessions: z23.readonly(z23.array(FrontDoorSessionStatusSchema)),
13349
13616
  headroomSocket: HeadroomSocketTargetSchema.optional(),
13350
- logPath: z21.string(),
13351
- logExists: z21.boolean()
13617
+ logPath: z23.string(),
13618
+ logExists: z23.boolean()
13352
13619
  });
13353
- var FrontDoorSessionsOutputSchema = z21.strictObject({ sessions: z21.readonly(z21.array(FrontDoorSessionStatusSchema)) });
13354
- var CheckRunInputSchema = z21.strictObject({
13355
- path: z21.string().min(1),
13356
- identity: z21.string().min(1).optional()
13620
+ var FrontDoorSessionsOutputSchema = z23.strictObject({ sessions: z23.readonly(z23.array(FrontDoorSessionStatusSchema)) });
13621
+ var CheckRunInputSchema = z23.strictObject({
13622
+ path: z23.string().min(1),
13623
+ identity: z23.string().min(1).optional()
13357
13624
  }).refine((input) => path30.isAbsolute(input.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
13358
- var PoolPickInputSchema = z21.strictObject({
13359
- pool: z21.string().min(1),
13360
- path: z21.string().min(1)
13625
+ var PoolPickInputSchema = z23.strictObject({
13626
+ pool: z23.string().min(1),
13627
+ path: z23.string().min(1)
13361
13628
  }).refine((input) => path30.isAbsolute(input.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
13362
- var DoctorFindingSchema = z21.strictObject({
13363
- section: z21.enum(DOCTOR_SECTIONS),
13364
- subject: z21.string().optional(),
13365
- severity: z21.enum(DOCTOR_SEVERITIES),
13366
- message: z21.string()
13629
+ var DoctorFindingSchema = z23.strictObject({
13630
+ section: z23.enum(DOCTOR_SECTIONS),
13631
+ subject: z23.string().optional(),
13632
+ severity: z23.enum(DOCTOR_SEVERITIES),
13633
+ message: z23.string()
13367
13634
  });
13368
- var DoctorRunOutputSchema = z21.strictObject({
13635
+ var DoctorRunOutputSchema = z23.strictObject({
13369
13636
  /** False exactly when any finding is a `fail`; a `warn` never fails the report on its own. */
13370
- ok: z21.boolean(),
13371
- findings: z21.readonly(z21.array(DoctorFindingSchema))
13637
+ ok: z23.boolean(),
13638
+ findings: z23.readonly(z23.array(DoctorFindingSchema))
13372
13639
  });
13373
- var FrontDoorRestartOutputSchema = z21.strictObject({
13374
- action: z21.literal("restarting"),
13375
- previousPid: z21.int().positive()
13640
+ var FrontDoorRestartOutputSchema = z23.strictObject({
13641
+ action: z23.literal("restarting"),
13642
+ previousPid: z23.int().positive()
13376
13643
  });
13377
- var UpdateCheckOutputSchema = z21.strictObject({
13378
- current: z21.string(),
13379
- latest: z21.string(),
13380
- action: z21.enum(["current", "available", "updated"])
13644
+ var UpdateCheckOutputSchema = z23.strictObject({
13645
+ current: z23.string(),
13646
+ latest: z23.string(),
13647
+ action: z23.enum(["current", "available", "updated"])
13381
13648
  });
13382
- var CodexSignInSchema = z21.discriminatedUnion("state", [
13383
- z21.strictObject({ state: z21.literal("none") }),
13384
- z21.strictObject({ state: z21.literal("signed-in"), email: z21.string().optional(), planScope: z21.boolean(), accessTokenExpiresAt: z21.number() }),
13385
- z21.strictObject({ state: z21.literal("unreadable"), message: z21.string() })
13649
+ var CodexSignInSchema = z23.discriminatedUnion("state", [
13650
+ z23.strictObject({ state: z23.literal("none") }),
13651
+ z23.strictObject({ state: z23.literal("signed-in"), email: z23.string().optional(), planScope: z23.boolean(), accessTokenExpiresAt: z23.number() }),
13652
+ z23.strictObject({ state: z23.literal("unreadable"), message: z23.string() })
13386
13653
  ]);
13387
- var CodexStatusOutputSchema = z21.strictObject({
13654
+ var CodexStatusOutputSchema = z23.strictObject({
13388
13655
  signIn: CodexSignInSchema,
13389
- codexProviders: z21.readonly(z21.array(z21.string()))
13656
+ codexProviders: z23.readonly(z23.array(z23.string()))
13390
13657
  });
13391
- var CodexLogoutOutputSchema = z21.strictObject({
13392
- hadGrant: z21.boolean(),
13393
- revoked: z21.boolean()
13658
+ var CodexLogoutOutputSchema = z23.strictObject({
13659
+ hadGrant: z23.boolean(),
13660
+ revoked: z23.boolean()
13394
13661
  });
13395
13662
 
13396
13663
  // src/frontdoor/codexApi.ts
@@ -13547,133 +13814,133 @@ init_providersStore();
13547
13814
 
13548
13815
  // src/frontdoor/configSchemas.ts
13549
13816
  init_schema();
13550
- import { z as z22 } from "zod";
13551
- var RemovalConfirmationSchema = z22.boolean();
13552
- var CredentialWriteSchema = (targets) => z22.strictObject({
13553
- sources: z22.array(RemoteCredentialSourceSchema).min(1).optional(),
13554
- target: z22.enum(targets).optional(),
13555
- cache: z22.union([z22.literal(false), CredentialCacheSchema]).optional()
13817
+ import { z as z24 } from "zod";
13818
+ var RemovalConfirmationSchema = z24.boolean();
13819
+ var CredentialWriteSchema = (targets) => z24.strictObject({
13820
+ sources: z24.array(RemoteCredentialSourceSchema).min(1).optional(),
13821
+ target: z24.enum(targets).optional(),
13822
+ cache: z24.union([z24.literal(false), CredentialCacheSchema]).optional()
13556
13823
  });
13557
- var CredentialSummarySchema2 = z22.strictObject({
13558
- target: z22.enum(CREDENTIAL_TARGETS),
13559
- sources: z22.readonly(z22.array(
13560
- z22.discriminatedUnion("kind", [
13561
- z22.strictObject({ kind: z22.literal("env"), variable: z22.string() }),
13562
- z22.strictObject({ kind: z22.literal("file"), path: z22.string() }),
13563
- z22.strictObject({ kind: z22.literal("command"), program: z22.string() }),
13564
- z22.strictObject({ kind: z22.literal("op"), reference: z22.string() }),
13565
- z22.strictObject({ kind: z22.literal("keychain"), service: z22.string(), account: z22.string().optional() }),
13566
- z22.strictObject({ kind: z22.literal("literal") })
13824
+ var CredentialSummarySchema2 = z24.strictObject({
13825
+ target: z24.enum(CREDENTIAL_TARGETS),
13826
+ sources: z24.readonly(z24.array(
13827
+ z24.discriminatedUnion("kind", [
13828
+ z24.strictObject({ kind: z24.literal("env"), variable: z24.string() }),
13829
+ z24.strictObject({ kind: z24.literal("file"), path: z24.string() }),
13830
+ z24.strictObject({ kind: z24.literal("command"), program: z24.string() }),
13831
+ z24.strictObject({ kind: z24.literal("op"), reference: z24.string() }),
13832
+ z24.strictObject({ kind: z24.literal("keychain"), service: z24.string(), account: z24.string().optional() }),
13833
+ z24.strictObject({ kind: z24.literal("literal") })
13567
13834
  ])
13568
13835
  )),
13569
13836
  cache: CredentialCacheSchema.optional()
13570
13837
  });
13571
- var mutationOutput = (kind, action) => z22.strictObject({ action: z22.literal(action), kind: z22.literal(kind), name: z22.string() });
13572
- var storedMutationOutput = (kind, action, value) => z22.strictObject({ action: z22.literal(action), kind: z22.literal(kind), name: z22.string(), value });
13573
- var IdentityValueSchema = z22.strictObject({
13574
- name: z22.string(),
13575
- defaultConfigProfile: z22.string().optional(),
13576
- allowAmbientCredential: z22.boolean(),
13838
+ var mutationOutput = (kind, action) => z24.strictObject({ action: z24.literal(action), kind: z24.literal(kind), name: z24.string() });
13839
+ var storedMutationOutput = (kind, action, value) => z24.strictObject({ action: z24.literal(action), kind: z24.literal(kind), name: z24.string(), value });
13840
+ var IdentityValueSchema = z24.strictObject({
13841
+ name: z24.string(),
13842
+ defaultConfigProfile: z24.string().optional(),
13843
+ allowAmbientCredential: z24.boolean(),
13577
13844
  credential: CredentialSummarySchema2.optional(),
13578
- anchors: z22.array(AnchorSchema).optional()
13845
+ anchors: z24.array(AnchorSchema).optional()
13579
13846
  });
13580
13847
  var ProfileValueSchema = ConfigProfileSchema.omit({ $schema: true });
13581
- var ProviderValueSchema = z22.strictObject({
13582
- name: z22.string(),
13583
- kind: z22.enum(PROVIDER_KINDS),
13584
- displayName: z22.string(),
13585
- baseUrl: z22.string().optional(),
13848
+ var ProviderValueSchema = z24.strictObject({
13849
+ name: z24.string(),
13850
+ kind: z24.enum(PROVIDER_KINDS),
13851
+ displayName: z24.string(),
13852
+ baseUrl: z24.string().optional(),
13586
13853
  codex: CodexProviderConfigSchema.optional(),
13587
13854
  credential: CredentialSummarySchema2,
13588
- env: z22.record(z22.string(), z22.string()).optional()
13855
+ env: z24.record(z24.string(), z24.string()).optional()
13589
13856
  });
13590
- var ConfigNameInputSchema = z22.strictObject({ name: z22.string().min(1) });
13857
+ var ConfigNameInputSchema = z24.strictObject({ name: z24.string().min(1) });
13591
13858
  var ConfigIdentityAddOutputSchema = storedMutationOutput("identity", "created", IdentityValueSchema);
13592
- var ConfigIdentitySetInputSchema = z22.strictObject({
13593
- name: z22.string().min(1),
13594
- defaultConfigProfile: z22.union([z22.string().min(1), z22.literal(false)]).optional(),
13595
- allowAmbientCredential: z22.boolean().optional(),
13596
- credential: z22.union([z22.literal(false), CredentialWriteSchema(CREDENTIAL_TARGETS)]).optional(),
13859
+ var ConfigIdentitySetInputSchema = z24.strictObject({
13860
+ name: z24.string().min(1),
13861
+ defaultConfigProfile: z24.union([z24.string().min(1), z24.literal(false)]).optional(),
13862
+ allowAmbientCredential: z24.boolean().optional(),
13863
+ credential: z24.union([z24.literal(false), CredentialWriteSchema(CREDENTIAL_TARGETS)]).optional(),
13597
13864
  /** `false` removes the anchors; a list replaces them. */
13598
- anchors: z22.union([z22.literal(false), z22.array(AnchorSchema).min(1)]).optional()
13865
+ anchors: z24.union([z24.literal(false), z24.array(AnchorSchema).min(1)]).optional()
13599
13866
  });
13600
13867
  var ConfigIdentitySetOutputSchema = storedMutationOutput("identity", "updated", IdentityValueSchema);
13601
- var ConfigIdentityRemoveInputSchema = z22.strictObject({ name: z22.string().min(1), confirm: RemovalConfirmationSchema });
13868
+ var ConfigIdentityRemoveInputSchema = z24.strictObject({ name: z24.string().min(1), confirm: RemovalConfirmationSchema });
13602
13869
  var ConfigIdentityRemoveOutputSchema = mutationOutput("identity", "removed");
13603
13870
  var ConfigIdentityUseOutputSchema = mutationOutput("identity", "selected");
13604
- var ConfigProfileAddInputSchema = z22.strictObject({
13605
- name: z22.string().min(1),
13606
- extends: z22.array(z22.string().min(1)).optional(),
13607
- description: z22.string().optional()
13871
+ var ConfigProfileAddInputSchema = z24.strictObject({
13872
+ name: z24.string().min(1),
13873
+ extends: z24.array(z24.string().min(1)).optional(),
13874
+ description: z24.string().optional()
13608
13875
  });
13609
13876
  var ConfigProfileAddOutputSchema = storedMutationOutput("profile", "created", ProfileValueSchema);
13610
- var ConfigProfileSetInputSchema = z22.strictObject({
13611
- name: z22.string().min(1),
13612
- category: z22.record(z22.string(), z22.boolean()).optional(),
13613
- entry: z22.record(z22.string(), z22.boolean()).optional(),
13614
- extends: z22.union([z22.array(z22.string().min(1)), z22.literal(false)]).optional(),
13615
- description: z22.union([z22.string(), z22.literal(false)]).optional(),
13616
- launch: z22.strictObject({
13617
- skipPermissions: z22.boolean().optional(),
13618
- remoteControl: z22.boolean().optional(),
13619
- headroom: z22.boolean().optional(),
13620
- trackUsage: z22.boolean().optional(),
13621
- provider: z22.union([z22.string().min(1), z22.literal(false)]).optional(),
13622
- claudeVersion: z22.union([z22.string().min(1), z22.literal(false)]).optional()
13877
+ var ConfigProfileSetInputSchema = z24.strictObject({
13878
+ name: z24.string().min(1),
13879
+ category: z24.record(z24.string(), z24.boolean()).optional(),
13880
+ entry: z24.record(z24.string(), z24.boolean()).optional(),
13881
+ extends: z24.union([z24.array(z24.string().min(1)), z24.literal(false)]).optional(),
13882
+ description: z24.union([z24.string(), z24.literal(false)]).optional(),
13883
+ launch: z24.strictObject({
13884
+ skipPermissions: z24.boolean().optional(),
13885
+ remoteControl: z24.boolean().optional(),
13886
+ headroom: z24.boolean().optional(),
13887
+ trackUsage: z24.boolean().optional(),
13888
+ provider: z24.union([z24.string().min(1), z24.literal(false)]).optional(),
13889
+ claudeVersion: z24.union([z24.string().min(1), z24.literal(false)]).optional()
13623
13890
  }).optional()
13624
13891
  });
13625
13892
  var ConfigProfileSetOutputSchema = storedMutationOutput("profile", "updated", ProfileValueSchema);
13626
- var ConfigProfileRemoveInputSchema = z22.strictObject({ name: z22.string().min(1), confirm: RemovalConfirmationSchema });
13893
+ var ConfigProfileRemoveInputSchema = z24.strictObject({ name: z24.string().min(1), confirm: RemovalConfirmationSchema });
13627
13894
  var ConfigProfileRemoveOutputSchema = mutationOutput("profile", "removed");
13628
13895
  var ConfigProfileUseOutputSchema = mutationOutput("profile", "selected");
13629
- var PoolMembersInputSchema = z22.array(z22.string().min(1)).min(1);
13630
- var ConfigPoolAddInputSchema = z22.strictObject({
13631
- name: z22.string().min(1),
13896
+ var PoolMembersInputSchema = z24.array(z24.string().min(1)).min(1);
13897
+ var ConfigPoolAddInputSchema = z24.strictObject({
13898
+ name: z24.string().min(1),
13632
13899
  identities: PoolMembersInputSchema,
13633
- preference: z22.enum(POOL_PREFERENCES).optional()
13900
+ preference: z24.enum(POOL_PREFERENCES).optional()
13634
13901
  });
13635
13902
  var ConfigPoolAddOutputSchema = storedMutationOutput("pool", "created", PoolSchema);
13636
- var ConfigPoolSetInputSchema = z22.strictObject({
13637
- name: z22.string().min(1),
13903
+ var ConfigPoolSetInputSchema = z24.strictObject({
13904
+ name: z24.string().min(1),
13638
13905
  identities: PoolMembersInputSchema.optional(),
13639
- preference: z22.union([z22.enum(POOL_PREFERENCES), z22.literal(false)]).optional()
13906
+ preference: z24.union([z24.enum(POOL_PREFERENCES), z24.literal(false)]).optional()
13640
13907
  });
13641
13908
  var ConfigPoolSetOutputSchema = storedMutationOutput("pool", "updated", PoolSchema);
13642
- var ConfigPoolRemoveInputSchema = z22.strictObject({ name: z22.string().min(1), confirm: RemovalConfirmationSchema });
13909
+ var ConfigPoolRemoveInputSchema = z24.strictObject({ name: z24.string().min(1), confirm: RemovalConfirmationSchema });
13643
13910
  var ConfigPoolRemoveOutputSchema = mutationOutput("pool", "removed");
13644
13911
  var ConfigPoolUseOutputSchema = mutationOutput("pool", "selected");
13645
- var ConfigProviderAddInputSchema = z22.strictObject({
13646
- name: z22.string().min(1),
13647
- kind: z22.enum(PROVIDER_KINDS).optional(),
13648
- displayName: z22.string().min(1),
13649
- baseUrl: z22.string().min(1).optional(),
13912
+ var ConfigProviderAddInputSchema = z24.strictObject({
13913
+ name: z24.string().min(1),
13914
+ kind: z24.enum(PROVIDER_KINDS).optional(),
13915
+ displayName: z24.string().min(1),
13916
+ baseUrl: z24.string().min(1).optional(),
13650
13917
  credential: CredentialWriteSchema(PROVIDER_CREDENTIAL_TARGETS).required({ sources: true }),
13651
13918
  codex: CodexProviderConfigSchema.optional()
13652
13919
  });
13653
13920
  var ConfigProviderAddOutputSchema = storedMutationOutput("provider", "created", ProviderValueSchema);
13654
- var ConfigProviderSetInputSchema = z22.strictObject({
13655
- name: z22.string().min(1),
13656
- displayName: z22.string().min(1).optional(),
13657
- baseUrl: z22.string().min(1).optional(),
13921
+ var ConfigProviderSetInputSchema = z24.strictObject({
13922
+ name: z24.string().min(1),
13923
+ displayName: z24.string().min(1).optional(),
13924
+ baseUrl: z24.string().min(1).optional(),
13658
13925
  credential: CredentialWriteSchema(PROVIDER_CREDENTIAL_TARGETS).optional(),
13659
13926
  codex: CodexProviderConfigSchema.optional()
13660
13927
  });
13661
13928
  var ConfigProviderSetOutputSchema = storedMutationOutput("provider", "updated", ProviderValueSchema);
13662
- var ConfigProviderRemoveInputSchema = z22.strictObject({ name: z22.string().min(1), confirm: RemovalConfirmationSchema });
13929
+ var ConfigProviderRemoveInputSchema = z24.strictObject({ name: z24.string().min(1), confirm: RemovalConfirmationSchema });
13663
13930
  var ConfigProviderRemoveOutputSchema = mutationOutput("provider", "removed");
13664
- var ConfigRuleAddInputSchema = z22.strictObject({
13665
- path: z22.string().min(1),
13666
- configProfile: z22.string().min(1).optional(),
13667
- identity: z22.string().min(1).optional()
13931
+ var ConfigRuleAddInputSchema = z24.strictObject({
13932
+ path: z24.string().min(1),
13933
+ configProfile: z24.string().min(1).optional(),
13934
+ identity: z24.string().min(1).optional()
13668
13935
  });
13669
13936
  var ConfigRuleAddOutputSchema = storedMutationOutput("rule", "created", DirectoryRuleSchema);
13670
- var ConfigRuleSetInputSchema = z22.strictObject({
13671
- path: z22.string().min(1),
13672
- configProfile: z22.union([z22.string().min(1), z22.literal(false)]).optional(),
13673
- identity: z22.union([z22.string().min(1), z22.literal(false)]).optional()
13937
+ var ConfigRuleSetInputSchema = z24.strictObject({
13938
+ path: z24.string().min(1),
13939
+ configProfile: z24.union([z24.string().min(1), z24.literal(false)]).optional(),
13940
+ identity: z24.union([z24.string().min(1), z24.literal(false)]).optional()
13674
13941
  });
13675
13942
  var ConfigRuleSetOutputSchema = storedMutationOutput("rule", "updated", DirectoryRuleSchema);
13676
- var ConfigRuleRemoveInputSchema = z22.strictObject({ path: z22.string().min(1), confirm: RemovalConfirmationSchema });
13943
+ var ConfigRuleRemoveInputSchema = z24.strictObject({ path: z24.string().min(1), confirm: RemovalConfirmationSchema });
13677
13944
  var ConfigRuleRemoveOutputSchema = mutationOutput("rule", "removed");
13678
13945
 
13679
13946
  // src/frontdoor/configApi.ts
@@ -13983,43 +14250,43 @@ import { openapi as openapi4 } from "@orpc/openapi";
13983
14250
  import { eventIterator as eventIterator2, withEventMeta as withEventMeta2 } from "@orpc/server";
13984
14251
 
13985
14252
  // src/frontdoor/eventSchemas.ts
13986
- import { z as z23 } from "zod";
14253
+ import { z as z25 } from "zod";
13987
14254
  var DOOR_EVENT_SOURCE_RC = "rc";
13988
14255
  var LAUNCH_EVENT_SOURCE = "launch";
13989
14256
  var USAGE_EVENT_SOURCE = "usage";
13990
14257
  var DOOR_HEALTH_EVENT_SOURCE = "door";
13991
14258
  var QUOTA_EXPIRING_EVENT_SOURCE = "quota-expiring";
13992
- var DoorEventSchema = z23.strictObject({
13993
- source: z23.string().min(1),
14259
+ var DoorEventSchema = z25.strictObject({
14260
+ source: z25.string().min(1),
13994
14261
  /** A positive integer because the backbone's counters start at one and only ever increase. */
13995
- sequence: z23.number().int().positive(),
13996
- payload: z23.unknown()
14262
+ sequence: z25.number().int().positive(),
14263
+ payload: z25.unknown()
13997
14264
  });
13998
- var DoorEventSourceQuerySchema = z23.strictObject({
13999
- sources: z23.array(z23.string().min(1)).min(1).optional()
14265
+ var DoorEventSourceQuerySchema = z25.strictObject({
14266
+ sources: z25.array(z25.string().min(1)).min(1).optional()
14000
14267
  });
14001
- var LaunchLifecycleEventSchema = z23.strictObject({
14002
- kind: z23.enum(["registered", "pruned", "ended"]),
14003
- pid: z23.number().int().positive(),
14004
- startedAt: z23.number(),
14005
- observedAt: z23.number()
14268
+ var LaunchLifecycleEventSchema = z25.strictObject({
14269
+ kind: z25.enum(["registered", "pruned", "ended"]),
14270
+ pid: z25.number().int().positive(),
14271
+ startedAt: z25.number(),
14272
+ observedAt: z25.number()
14006
14273
  });
14007
- var DoorHealthEventSchema = z23.discriminatedUnion("kind", [
14008
- z23.strictObject({ kind: z23.literal("generation"), pid: z23.number().int().positive(), providerPort: z23.number().int().positive(), connectPort: z23.number().int().positive(), directPort: z23.number().int().positive(), observedAt: z23.number() }),
14009
- z23.strictObject({ kind: z23.literal("listenerFailed"), pid: z23.number().int().positive(), listener: z23.enum(["provider", "connect", "direct"]), message: z23.string(), observedAt: z23.number() }),
14010
- z23.strictObject({ kind: z23.literal("binaryTurnover"), pid: z23.number().int().positive(), observedAt: z23.number() }),
14011
- z23.strictObject({ kind: z23.literal("idleShutdown"), pid: z23.number().int().positive(), observedAt: z23.number() }),
14012
- z23.strictObject({ kind: z23.literal("superseded"), pid: z23.number().int().positive(), ownerPid: z23.number().int().positive(), observedAt: z23.number() }),
14013
- z23.strictObject({ kind: z23.literal("drained"), pid: z23.number().int().positive(), observedAt: z23.number() })
14274
+ var DoorHealthEventSchema = z25.discriminatedUnion("kind", [
14275
+ z25.strictObject({ kind: z25.literal("generation"), pid: z25.number().int().positive(), providerPort: z25.number().int().positive(), connectPort: z25.number().int().positive(), directPort: z25.number().int().positive(), observedAt: z25.number() }),
14276
+ z25.strictObject({ kind: z25.literal("listenerFailed"), pid: z25.number().int().positive(), listener: z25.enum(["provider", "connect", "direct"]), message: z25.string(), observedAt: z25.number() }),
14277
+ z25.strictObject({ kind: z25.literal("binaryTurnover"), pid: z25.number().int().positive(), observedAt: z25.number() }),
14278
+ z25.strictObject({ kind: z25.literal("idleShutdown"), pid: z25.number().int().positive(), observedAt: z25.number() }),
14279
+ z25.strictObject({ kind: z25.literal("superseded"), pid: z25.number().int().positive(), ownerPid: z25.number().int().positive(), observedAt: z25.number() }),
14280
+ z25.strictObject({ kind: z25.literal("drained"), pid: z25.number().int().positive(), observedAt: z25.number() })
14014
14281
  ]);
14015
- var QuotaExpiringEventSchema = z23.strictObject({
14016
- identity: z23.string().min(1),
14017
- provider: z23.string().min(1),
14018
- window: z23.enum(["fiveHour", "sevenDay"]),
14282
+ var QuotaExpiringEventSchema = z25.strictObject({
14283
+ identity: z25.string().min(1),
14284
+ provider: z25.string().min(1),
14285
+ window: z25.enum(["fiveHour", "sevenDay"]),
14019
14286
  /** 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. */
14020
- utilization: z23.number().min(0).max(1),
14021
- resetsAt: z23.iso.datetime(),
14022
- observedAt: z23.number()
14287
+ utilization: z25.number().min(0).max(1),
14288
+ resetsAt: z25.iso.datetime(),
14289
+ observedAt: z25.number()
14023
14290
  });
14024
14291
 
14025
14292
  // src/frontdoor/eventsApi.ts
@@ -14103,51 +14370,51 @@ import { openapi as openapi6 } from "@orpc/openapi";
14103
14370
 
14104
14371
  // src/frontdoor/launchSchemas.ts
14105
14372
  import path31 from "node:path";
14106
- import { z as z24 } from "zod";
14373
+ import { z as z26 } from "zod";
14107
14374
  init_claudeVersion();
14108
14375
  init_identity();
14109
- var LaunchResolveInputSchema = z24.strictObject({
14110
- path: z24.string().min(1),
14376
+ var LaunchResolveInputSchema = z26.strictObject({
14377
+ path: z26.string().min(1),
14111
14378
  /** `@name`, launch flags, then the arguments for `claude`; empty for a bare launch. */
14112
- argv: z24.readonly(z24.array(z24.string())).optional(),
14379
+ argv: z26.readonly(z26.array(z26.string())).optional(),
14113
14380
  /** 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. */
14114
- env: z24.record(z24.string(), z24.string()).optional()
14381
+ env: z26.record(z26.string(), z26.string()).optional()
14115
14382
  }).refine((input) => path31.isAbsolute(input.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
14116
- var LaunchPoolDecisionSchema = z24.strictObject({
14117
- name: z24.string(),
14118
- reasons: z24.readonly(z24.array(z24.string())),
14119
- movedOff: z24.strictObject({ identity: z24.string(), reason: z24.string() }).optional()
14383
+ var LaunchPoolDecisionSchema = z26.strictObject({
14384
+ name: z26.string(),
14385
+ reasons: z26.readonly(z26.array(z26.string())),
14386
+ movedOff: z26.strictObject({ identity: z26.string(), reason: z26.string() }).optional()
14120
14387
  });
14121
- var LaunchDecisionSchema = z24.strictObject({
14122
- identity: z24.string().optional(),
14123
- identitySource: z24.enum(IDENTITY_DECISION_SOURCES),
14388
+ var LaunchDecisionSchema = z26.strictObject({
14389
+ identity: z26.string().optional(),
14390
+ identitySource: z26.enum(IDENTITY_DECISION_SOURCES),
14124
14391
  pool: LaunchPoolDecisionSchema.optional(),
14125
- configDirEscapeHatch: z24.boolean(),
14126
- configDir: z24.string().optional(),
14127
- configProfile: z24.string().optional(),
14128
- configProfileSource: z24.enum(CONFIG_PROFILE_DECISION_SOURCES),
14129
- provider: z24.string().optional()
14392
+ configDirEscapeHatch: z26.boolean(),
14393
+ configDir: z26.string().optional(),
14394
+ configProfile: z26.string().optional(),
14395
+ configProfileSource: z26.enum(CONFIG_PROFILE_DECISION_SOURCES),
14396
+ provider: z26.string().optional()
14130
14397
  });
14131
- var LaunchFlagsSchema = z24.strictObject({
14132
- skipPermissions: z24.boolean(),
14133
- remoteControl: z24.boolean(),
14134
- headroom: z24.boolean(),
14135
- trackUsage: z24.boolean()
14398
+ var LaunchFlagsSchema = z26.strictObject({
14399
+ skipPermissions: z26.boolean(),
14400
+ remoteControl: z26.boolean(),
14401
+ headroom: z26.boolean(),
14402
+ trackUsage: z26.boolean()
14136
14403
  });
14137
- var LaunchResolveOutputSchema = z24.strictObject({
14404
+ var LaunchResolveOutputSchema = z26.strictObject({
14138
14405
  decision: LaunchDecisionSchema,
14139
14406
  flags: LaunchFlagsSchema,
14140
- claudeVersion: z24.strictObject({ version: z24.string(), source: z24.enum(CLAUDE_VERSION_SOURCES) }).optional(),
14407
+ claudeVersion: z26.strictObject({ version: z26.string(), source: z26.enum(CLAUDE_VERSION_SOURCES) }).optional(),
14141
14408
  /** The real `claude` binary the launch would spawn, on the door's host. */
14142
- bin: z24.string(),
14409
+ bin: z26.string(),
14143
14410
  /** The arguments the launch would pass it: the tool's own flags, then `CLAUDE_EXTRA_FLAGS`, then the caller's own. */
14144
- args: z24.readonly(z24.array(z24.string())),
14411
+ args: z26.readonly(z26.array(z26.string())),
14145
14412
  /** The credential the launch would authenticate with, by target and source kinds. Absent when none applies. */
14146
- credential: z24.strictObject({ subject: z24.enum(["provider", "identity"]), name: z24.string(), summary: CredentialSummarySchema }).optional(),
14147
- routing: z24.strictObject({ frontDoor: z24.boolean(), headroom: z24.boolean() }),
14413
+ credential: z26.strictObject({ subject: z26.enum(["provider", "identity"]), name: z26.string(), summary: CredentialSummarySchema }).optional(),
14414
+ routing: z26.strictObject({ frontDoor: z26.boolean(), headroom: z26.boolean() }),
14148
14415
  /** The names of the environment variables the launch would set or unset, sorted. Values are not reported. */
14149
- environment: z24.readonly(z24.array(z24.string())),
14150
- warnings: z24.readonly(z24.array(z24.string()))
14416
+ environment: z26.readonly(z26.array(z26.string())),
14417
+ warnings: z26.readonly(z26.array(z26.string()))
14151
14418
  });
14152
14419
 
14153
14420
  // src/frontdoor/launchApi.ts
@@ -14183,117 +14450,22 @@ function createLaunchApiRouter(deps) {
14183
14450
  // src/frontdoor/agentTreesApi.ts
14184
14451
  import { ORPCError as ORPCError6 } from "@orpc/client";
14185
14452
  import { openapi as openapi7 } from "@orpc/openapi";
14186
- import { z as z26 } from "zod";
14187
-
14188
- // src/agents/schema.ts
14189
- import { z as z25 } from "zod";
14190
- var AgentMetaSchema = z25.looseObject({
14191
- agentType: z25.string(),
14192
- isFork: z25.boolean().optional(),
14193
- description: z25.string().optional(),
14194
- name: z25.string().optional(),
14195
- toolUseId: z25.string().optional(),
14196
- spawnDepth: z25.number().int().nonnegative().optional(),
14197
- parentAgentId: z25.string().optional(),
14198
- model: z25.string().optional(),
14199
- requestShape: z25.string().optional(),
14200
- requestNonInteractive: z25.boolean().optional(),
14201
- workflowPhase: z25.string().optional(),
14202
- taskKind: z25.string().optional(),
14203
- teamName: z25.string().optional(),
14204
- worktreePath: z25.string().optional(),
14205
- worktreeBranch: z25.string().optional(),
14206
- stoppedByUser: z25.boolean().optional()
14207
- });
14208
- var AgentKindSchema = z25.enum(["subagent", "fork", "workflow-agent", "teammate"]);
14209
- var AgentNodeSchema = z25.lazy(
14210
- () => z25.strictObject({
14211
- id: z25.string(),
14212
- kind: AgentKindSchema,
14213
- agentType: z25.string(),
14214
- description: z25.string().optional(),
14215
- name: z25.string().optional(),
14216
- toolUseId: z25.string().optional(),
14217
- spawnDepth: z25.number().int().nonnegative().optional(),
14218
- model: z25.string().optional(),
14219
- background: z25.boolean().optional(),
14220
- workflowRunId: z25.string().optional(),
14221
- workflowPhase: z25.string().optional(),
14222
- teamName: z25.string().optional(),
14223
- stoppedByUser: z25.boolean().optional(),
14224
- transcript: z25.string(),
14225
- children: z25.array(AgentNodeSchema)
14226
- })
14227
- );
14228
- var TaskItemSchema = z25.strictObject({
14229
- id: z25.string(),
14230
- subject: z25.string(),
14231
- description: z25.string().optional(),
14232
- status: z25.string(),
14233
- /** What a spinner shows while the task runs. */
14234
- activeForm: z25.string().optional(),
14235
- /** The teammate or agent name the task is assigned to, as Agent Teams writes it. */
14236
- owner: z25.string().optional(),
14237
- /** Free-form data the harness attaches to a task, kept as written. */
14238
- metadata: z25.record(z25.string(), z25.unknown()).optional(),
14239
- blocks: z25.array(z25.string()),
14240
- blockedBy: z25.array(z25.string()),
14241
- /** 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. */
14242
- taskList: z25.string().optional()
14243
- });
14244
- var WorkflowRunSchema = z25.strictObject({
14245
- runId: z25.string(),
14246
- workflowName: z25.string().optional(),
14247
- status: z25.string().optional(),
14248
- startTime: z25.number().optional(),
14249
- phases: z25.array(z25.string()),
14250
- summary: z25.string().optional()
14251
- });
14252
- var AgentTreeProblemSchema = z25.strictObject({
14253
- /** Relative to the identity's configuration directory. */
14254
- path: z25.string(),
14255
- reason: z25.string()
14256
- });
14257
- var SessionSummarySchema = z25.strictObject({
14258
- project: z25.string(),
14259
- sessionId: z25.string(),
14260
- superseded: z25.boolean(),
14261
- /** The directory and transcript stem exactly as on disk, which differs from `sessionId` for a superseded session. */
14262
- entry: z25.string(),
14263
- agentCount: z25.number().int().nonnegative(),
14264
- workflowRunCount: z25.number().int().nonnegative(),
14265
- /** When the transcript was last written, as an ISO instant; absent when there is no transcript file. */
14266
- updatedAt: z25.iso.datetime().optional(),
14267
- identities: z25.array(z25.string())
14268
- });
14269
- var SessionAgentTreeSchema = z25.strictObject({
14270
- project: z25.string(),
14271
- sessionId: z25.string(),
14272
- /** True for a session directory a resume superseded (`<session-id>.superseded-<epoch-ms>`). */
14273
- superseded: z25.boolean(),
14274
- /** The agents the session itself spawned, each with its descendants. */
14275
- agents: z25.array(AgentNodeSchema),
14276
- tasks: z25.array(TaskItemSchema),
14277
- workflowRuns: z25.array(WorkflowRunSchema),
14278
- problems: z25.array(AgentTreeProblemSchema)
14279
- });
14280
-
14281
- // src/frontdoor/agentTreesApi.ts
14453
+ import { z as z27 } from "zod";
14282
14454
  init_cliError();
14283
- var AgentTreesListInputSchema = z26.strictObject({
14455
+ var AgentTreesListInputSchema = z27.strictObject({
14284
14456
  /** Only this identity's sessions. */
14285
- identity: z26.string().optional(),
14457
+ identity: z27.string().optional(),
14286
14458
  /** Include sessions that spawned no agent and ran no workflow. */
14287
- all: z26.boolean().optional()
14459
+ all: z27.boolean().optional()
14288
14460
  });
14289
- var AgentTreesListOutputSchema = z26.array(SessionSummarySchema);
14290
- var AgentTreesShowInputSchema = z26.strictObject({
14461
+ var AgentTreesListOutputSchema = z27.array(SessionSummarySchema);
14462
+ var AgentTreesShowInputSchema = z27.strictObject({
14291
14463
  /** A session id, or an unambiguous prefix of one. */
14292
- session: z26.string().min(1),
14464
+ session: z27.string().min(1),
14293
14465
  /** Look only in this identity. */
14294
- identity: z26.string().optional()
14466
+ identity: z27.string().optional()
14295
14467
  });
14296
- var AgentTreesShowOutputSchema = z26.strictObject({ identities: z26.array(z26.string()), ...SessionAgentTreeSchema.shape });
14468
+ var AgentTreesShowOutputSchema = z27.strictObject({ identities: z27.array(z27.string()), ...MergedAgentTreeSchema.shape });
14297
14469
  function asBadRequest(error) {
14298
14470
  if (error instanceof CliError) {
14299
14471
  throw new ORPCError6("BAD_REQUEST", { message: error.message });
@@ -14324,14 +14496,14 @@ function createAgentTreesApiRouter(deps) {
14324
14496
  openapi7({
14325
14497
  method: "POST",
14326
14498
  path: "/rest/agent-trees/show",
14327
- summary: "Show one session's agent tree, task list and workflow runs",
14499
+ summary: "Show one session's agent tree, task list and workflow runs, with the live Remote Control tasks merged in",
14328
14500
  tags: [SESSION_HISTORY_TAG],
14329
14501
  spec: (current) => ({ ...current, [READ_ONLY_OPERATION_EXTENSION]: true })
14330
14502
  })
14331
14503
  ).input(AgentTreesShowInputSchema).output(AgentTreesShowOutputSchema).handler(({ input }) => {
14332
14504
  try {
14333
14505
  const view = deps.sessionShow(input.session, input.identity);
14334
- return { identities: [...view.identities], ...view.tree };
14506
+ return { identities: [...view.identities], ...mergeLiveTasks(view.tree, deps.liveTasks()) };
14335
14507
  } catch (error) {
14336
14508
  return asBadRequest(error);
14337
14509
  }
@@ -14739,15 +14911,15 @@ function createQuotaExpiringPublisher(hub, deps) {
14739
14911
 
14740
14912
  // src/frontdoor/rcLiveUsage.ts
14741
14913
  var RC_RATE_LIMIT_EVENT_TYPE = "rate_limit_event";
14742
- function isRecord5(value) {
14914
+ function isRecord6(value) {
14743
14915
  return typeof value === "object" && value !== null && !Array.isArray(value);
14744
14916
  }
14745
14917
  function rcRateLimitInfoOf(event) {
14746
14918
  const payload = event.envelope.payload;
14747
- if (!isRecord5(payload) || payload.type !== RC_RATE_LIMIT_EVENT_TYPE) {
14919
+ if (!isRecord6(payload) || payload.type !== RC_RATE_LIMIT_EVENT_TYPE) {
14748
14920
  return void 0;
14749
14921
  }
14750
- if (!isRecord5(payload.rate_limit_info)) {
14922
+ if (!isRecord6(payload.rate_limit_info)) {
14751
14923
  return void 0;
14752
14924
  }
14753
14925
  const parsed = RcRateLimitInfoSchema.safeParse(payload.rate_limit_info);
@@ -14835,7 +15007,7 @@ function createSseParser() {
14835
15007
  }
14836
15008
  };
14837
15009
  }
14838
- function isRecord6(value) {
15010
+ function isRecord7(value) {
14839
15011
  return typeof value === "object" && value !== null && !Array.isArray(value);
14840
15012
  }
14841
15013
  function sequenceNumOf(value) {
@@ -14857,7 +15029,7 @@ function parseRcStreamEnvelope(parsed) {
14857
15029
  } catch {
14858
15030
  return void 0;
14859
15031
  }
14860
- if (!isRecord6(data)) {
15032
+ if (!isRecord7(data)) {
14861
15033
  return void 0;
14862
15034
  }
14863
15035
  const eventType = data.event_type;
@@ -15098,7 +15270,7 @@ init_capability();
15098
15270
  // src/frontdoor/rcSelfHostEndpoints.ts
15099
15271
  var RC_SOURCE_WORKER = "worker";
15100
15272
  var RC_SOURCE_CLIENT = "client";
15101
- function isRecord7(value) {
15273
+ function isRecord8(value) {
15102
15274
  return typeof value === "object" && value !== null && !Array.isArray(value);
15103
15275
  }
15104
15276
  function parseJsonObject2(body) {
@@ -15108,7 +15280,7 @@ function parseJsonObject2(body) {
15108
15280
  } catch {
15109
15281
  return void 0;
15110
15282
  }
15111
- return isRecord7(parsed) ? parsed : void 0;
15283
+ return isRecord8(parsed) ? parsed : void 0;
15112
15284
  }
15113
15285
  function nonEmptyString2(record, field) {
15114
15286
  const value = record === void 0 ? void 0 : record[field];
@@ -15182,7 +15354,7 @@ async function serveRcClientChannels(ctx, tail, method, maxBatchEvents) {
15182
15354
  }
15183
15355
  const results = [];
15184
15356
  for (const event of events) {
15185
- if (!isRecord7(event) || !isRecord7(event.payload)) {
15357
+ if (!isRecord8(event) || !isRecord8(event.payload)) {
15186
15358
  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" } });
15187
15359
  return true;
15188
15360
  }
@@ -15282,7 +15454,7 @@ async function serveRcCompatSessions(ctx, pathname, compatPath) {
15282
15454
  // src/frontdoor/rcSelfHostConversations.ts
15283
15455
  var RC_CONVERSATIONS_PATH_PREFIX = "/v1/code/conversations";
15284
15456
  var RC_CONVERSATION_ID_PREFIX = "conv_";
15285
- function isRecord8(value) {
15457
+ function isRecord9(value) {
15286
15458
  return typeof value === "object" && value !== null && !Array.isArray(value);
15287
15459
  }
15288
15460
  function parseJsonObject3(body) {
@@ -15292,7 +15464,7 @@ function parseJsonObject3(body) {
15292
15464
  } catch {
15293
15465
  return void 0;
15294
15466
  }
15295
- return isRecord8(parsed) ? parsed : void 0;
15467
+ return isRecord9(parsed) ? parsed : void 0;
15296
15468
  }
15297
15469
  function nonEmptyString3(record, field) {
15298
15470
  const value = record === void 0 ? void 0 : record[field];
@@ -15346,7 +15518,7 @@ async function serveRcConversations(ctx, pathname, method) {
15346
15518
  }
15347
15519
  const results = [];
15348
15520
  for (const event of events) {
15349
- if (!isRecord8(event) || !isRecord8(event.payload)) {
15521
+ if (!isRecord9(event) || !isRecord9(event.payload)) {
15350
15522
  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" } });
15351
15523
  return;
15352
15524
  }
@@ -15378,7 +15550,7 @@ var RC_SELF_HOST_SCOPE_LIST = ["user:profile", "user:inference", "user:sessions:
15378
15550
  var RC_SELF_HOST_OAUTH_TOKEN_TTL_SECONDS = 3600;
15379
15551
  var MS_PER_SECOND5 = 1e3;
15380
15552
  var HTTP_SERVICE_UNAVAILABLE = 503;
15381
- function isRecord9(value) {
15553
+ function isRecord10(value) {
15382
15554
  return typeof value === "object" && value !== null && !Array.isArray(value);
15383
15555
  }
15384
15556
  function parseJsonObject4(body) {
@@ -15388,7 +15560,7 @@ function parseJsonObject4(body) {
15388
15560
  } catch {
15389
15561
  return void 0;
15390
15562
  }
15391
- return isRecord9(parsed) ? parsed : void 0;
15563
+ return isRecord10(parsed) ? parsed : void 0;
15392
15564
  }
15393
15565
  function growthBookFeatures() {
15394
15566
  return {
@@ -15742,7 +15914,7 @@ var RC_SELF_HOST_WORKER_EPOCH = 1;
15742
15914
  var RC_STREAM_EVENT_NAME2 = "client_event";
15743
15915
  var CONFLICT_REASON_HEADER2 = "x-ccr-conflict-reason";
15744
15916
  var CONFLICT_REASON_EPOCH_STALE = "epoch_stale";
15745
- function isRecord10(value) {
15917
+ function isRecord11(value) {
15746
15918
  return typeof value === "object" && value !== null && !Array.isArray(value);
15747
15919
  }
15748
15920
  function isWebSearchRefusal(value) {
@@ -15826,7 +15998,7 @@ function parseJsonObject5(body) {
15826
15998
  } catch {
15827
15999
  return void 0;
15828
16000
  }
15829
- return isRecord10(parsed) ? parsed : void 0;
16001
+ return isRecord11(parsed) ? parsed : void 0;
15830
16002
  }
15831
16003
  function mintWorkerJwt(randomToken, issuedAt) {
15832
16004
  const encode = (value) => Buffer.from(JSON.stringify(value), "utf8").toString("base64url");
@@ -16086,7 +16258,7 @@ data: ${JSON.stringify(envelope)}
16086
16258
  if (status !== void 0) {
16087
16259
  session.workerStatus = status;
16088
16260
  }
16089
- if (isRecord10(body?.external_metadata)) {
16261
+ if (isRecord11(body?.external_metadata)) {
16090
16262
  session.externalMetadata = body.external_metadata;
16091
16263
  }
16092
16264
  await answerJson2(response, HTTP_STATUS.ok, {});
@@ -16116,7 +16288,7 @@ data: ${JSON.stringify(envelope)}
16116
16288
  }
16117
16289
  const results = [];
16118
16290
  for (const event of events) {
16119
- if (!isRecord10(event) || !isRecord10(event.payload)) {
16291
+ if (!isRecord11(event) || !isRecord11(event.payload)) {
16120
16292
  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" } });
16121
16293
  return;
16122
16294
  }
@@ -16149,7 +16321,7 @@ data: ${JSON.stringify(envelope)}
16149
16321
  return;
16150
16322
  }
16151
16323
  for (const event of events) {
16152
- if (isRecord10(event)) {
16324
+ if (isRecord11(event)) {
16153
16325
  session.internalEvents.push({ eventId: deps.newUuid(), body: event });
16154
16326
  }
16155
16327
  }
@@ -16245,7 +16417,7 @@ data: ${JSON.stringify(envelope)}
16245
16417
  }
16246
16418
  const results = [];
16247
16419
  for (const event of events) {
16248
- if (!isRecord10(event) || !isRecord10(event.payload)) {
16420
+ if (!isRecord11(event) || !isRecord11(event.payload)) {
16249
16421
  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" } });
16250
16422
  return;
16251
16423
  }
@@ -16382,7 +16554,7 @@ var RC_SELF_HOST_RECORD_DIR = "rc-selfhost";
16382
16554
  var RC_SELF_HOST_RECORD_FILE = "credential.json";
16383
16555
  var SELF_HOST_EMAIL = "selfhost@agent-shim.invalid";
16384
16556
  var SELF_HOST_SUBSCRIPTION_TYPE = "max";
16385
- function isRecord11(value) {
16557
+ function isRecord12(value) {
16386
16558
  return typeof value === "object" && value !== null && !Array.isArray(value);
16387
16559
  }
16388
16560
  function readJsonObject(fs12, file) {
@@ -16396,7 +16568,7 @@ function readJsonObject(fs12, file) {
16396
16568
  } catch {
16397
16569
  return void 0;
16398
16570
  }
16399
- return isRecord11(parsed) ? parsed : void 0;
16571
+ return isRecord12(parsed) ? parsed : void 0;
16400
16572
  }
16401
16573
  function readRcSelfHostRecord(fs12, frontdoorDir) {
16402
16574
  const parsed = readJsonObject(fs12, path32.join(frontdoorDir, RC_SELF_HOST_RECORD_DIR, RC_SELF_HOST_RECORD_FILE));
@@ -16420,7 +16592,7 @@ function mintRcSelfHostCredential(deps) {
16420
16592
  const recordFile = path32.join(recordDir, RC_SELF_HOST_RECORD_FILE);
16421
16593
  const previousRecord = readRcSelfHostRecord(deps.fs, deps.frontdoorDir);
16422
16594
  const existingCredentials = readJsonObject(deps.fs, credentialsFile);
16423
- const existingOauth = isRecord11(existingCredentials?.claudeAiOauth) ? existingCredentials.claudeAiOauth : void 0;
16595
+ const existingOauth = isRecord12(existingCredentials?.claudeAiOauth) ? existingCredentials.claudeAiOauth : void 0;
16424
16596
  const existingToken = typeof existingOauth?.accessToken === "string" && existingOauth.accessToken !== "" ? existingOauth.accessToken : void 0;
16425
16597
  const existingIsOwn = existingToken !== void 0 && previousRecord?.accessToken === existingToken;
16426
16598
  if (existingToken !== void 0 && !existingIsOwn && !deps.force) {
@@ -16437,7 +16609,7 @@ function mintRcSelfHostCredential(deps) {
16437
16609
  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)}
16438
16610
  `);
16439
16611
  const claudeJson = readJsonObject(deps.fs, claudeJsonFile) ?? {};
16440
- const existingBlock = (value) => isRecord11(value) ? value : {};
16612
+ const existingBlock = (value) => isRecord12(value) ? value : {};
16441
16613
  deps.fs.writeFilePrivate(claudeJsonFile, `${JSON.stringify({
16442
16614
  ...claudeJson,
16443
16615
  oauthAccount: {
@@ -16476,7 +16648,7 @@ init_poolPick();
16476
16648
 
16477
16649
  // src/agents/read.ts
16478
16650
  import path33 from "node:path";
16479
- import { z as z27 } from "zod";
16651
+ import { z as z28 } from "zod";
16480
16652
  var PROJECTS_DIR = "projects";
16481
16653
  var TASKS_DIR = "tasks";
16482
16654
  var SUBAGENTS_DIR = "subagents";
@@ -16595,14 +16767,14 @@ function parseJson2(text) {
16595
16767
  return void 0;
16596
16768
  }
16597
16769
  }
16598
- var TaskFileSchema = z27.object({ ...TaskItemSchema.omit({ taskList: true }).shape, blocks: z27.array(z27.string()).default([]), blockedBy: z27.array(z27.string()).default([]) });
16599
- var WorkflowRunFileSchema = z27.object({
16600
- runId: z27.string(),
16601
- workflowName: z27.string().optional(),
16602
- status: z27.string().optional(),
16603
- startTime: z27.number().optional(),
16604
- phases: z27.array(z27.object({ title: z27.string() })).default([]),
16605
- summary: z27.string().optional()
16770
+ var TaskFileSchema = z28.object({ ...TaskItemSchema.omit({ taskList: true }).shape, blocks: z28.array(z28.string()).default([]), blockedBy: z28.array(z28.string()).default([]) });
16771
+ var WorkflowRunFileSchema = z28.object({
16772
+ runId: z28.string(),
16773
+ workflowName: z28.string().optional(),
16774
+ status: z28.string().optional(),
16775
+ startTime: z28.number().optional(),
16776
+ phases: z28.array(z28.object({ title: z28.string() })).default([]),
16777
+ summary: z28.string().optional()
16606
16778
  });
16607
16779
  function summariseSession(fs12, configDir, ref) {
16608
16780
  const sessionRelative = path33.join(PROJECTS_DIR, ref.project, ref.entry);
@@ -17072,11 +17244,15 @@ export {
17072
17244
  InvalidIdentityNameError,
17073
17245
  InvalidProviderNameError,
17074
17246
  LAUNCH_EVENT_SOURCE,
17247
+ LIVE_TASK_CAP,
17075
17248
  LaunchLifecycleEventSchema,
17076
17249
  LaunchRefusedError,
17077
17250
  LaunchResolveInputSchema,
17078
17251
  LaunchResolveOutputSchema,
17079
17252
  LegacyProviderFileError,
17253
+ LiveTaskSchema,
17254
+ MergedAgentNodeSchema,
17255
+ MergedAgentTreeSchema,
17080
17256
  OWN_CLI_FILE_NAME,
17081
17257
  PROMPT_CACHE_TTL_MS,
17082
17258
  PlanClassSchema,
@@ -17144,6 +17320,7 @@ export {
17144
17320
  addProvider,
17145
17321
  agentShimCliPath,
17146
17322
  answerRcControlRequest,
17323
+ applyAgentTaskEvent,
17147
17324
  authenticateRcSessionMcpServer,
17148
17325
  buildEntryFacts,
17149
17326
  buildLayoutPaths,
@@ -17245,6 +17422,7 @@ export {
17245
17422
  listUsageSnapshots,
17246
17423
  locateSession,
17247
17424
  matchBranch,
17425
+ mergeLiveTasks,
17248
17426
  mintLeaf,
17249
17427
  mintRcSelfHostCredential,
17250
17428
  observingRoutedRoute,