claude-use 11.25.0 → 11.26.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.cjs CHANGED
@@ -242,7 +242,7 @@ function isTimeZone(name) {
242
242
  return false;
243
243
  }
244
244
  }
245
- var import_node_path2, import_zod, import_trilean, CATEGORY_NAMES, OVERRIDABLE_CATEGORIES, CategoryMapSchema, DURATION_RE, DurationSchema, WhenConditionObjectSchema, WhenSchema, EntryValueSchema, ENTRY_KEY_RE, EntriesSchema, LaunchSchema, CREDENTIAL_TARGETS, PROVIDER_CREDENTIAL_TARGETS, CREDENTIAL_TARGET_VARS, ArgvSchema, CommandSourceOptions, EnvCredentialSourceSchema, FileCredentialSourceSchema, CommandCredentialSourceSchema, OpCredentialSourceSchema, KeychainCredentialSourceSchema, LiteralCredentialSourceSchema, CredentialSourceSchema, RemoteCredentialSourceSchema, CREDENTIAL_CACHE_STORES, CredentialCacheSchema, CredentialSchema, ProviderCredentialSchema, RESERVED_PROVIDER_ENV_KEYS, ProviderEnvSchema, PROVIDER_KINDS, ANTIGRAVITY_MODES, CLAUDE_TIERS, ANTIGRAVITY_EFFORTS, ANTIGRAVITY_DEFAULT_MODE, ANTIGRAVITY_DEFAULT_MODEL, ANTIGRAVITY_DEFAULT_TIER_MODELS, ANTIGRAVITY_DEFAULT_EFFORT, AntigravityModelTargetSchema, AntigravityProviderConfigSchema, CODEX_EFFORTS, CODEX_LOGINS, CODEX_DEFAULT_LOGIN, CODEX_DEFAULT_MODEL, CODEX_DEFAULT_TIER_MODELS, CODEX_DEFAULT_EFFORT, CodexProviderConfigSchema, ProviderRouteSchema, PickerModelSchema, PickerModelsSchema, HttpProviderSchema, CodexProviderSchema, AntigravityProviderSchema, ProviderSchema, ConfigProfileSchema, POOL_SELECTOR_PREFIX, POOL_NAME_PATTERN, IDENTITY_NAME_PATTERN, PoolNameSchema, SELECTOR_RE, IdentitySelectorSchema, PoolMemberSchema, POOL_PREFERENCES, PoolPreferenceSchema, WHOLE_PERCENT_MAX, CompactAtUtilisationSchema, PoolSchema, WEEKDAYS, AnchorSchema, JOB_WINDOWS, JobTriggerSchema, JobTargetSchema, JobSchema, DirectoryRuleSchema, DirectoryRulesSchema, PortableConfigSchema, HEADROOM_MODES, HEADROOM_CCR_MODES, HEADROOM_ROLLOUT_CHANNELS, INTERCEPT_CHANNELS, READ_MATURATION_CHANNELS, HeadroomGlobalConfigObjectSchema, HeadroomGlobalConfigSchema, HEADROOM_DEFAULT_SOURCE, HEADROOM_DEFAULT_IDLE_SHUTDOWN_MINUTES, FrontDoorGlobalConfigSchema, UPDATE_MODES, UpdateGlobalConfigSchema, GlobalConfigSchema, IdentitySchema, CategoryClassificationSchema, CategoryClassificationOverlaySchema, SHIPPED_CATEGORY_DEFAULTS;
245
+ var import_node_path2, import_zod, import_trilean, CATEGORY_NAMES, OVERRIDABLE_CATEGORIES, CategoryMapSchema, DURATION_RE, DurationSchema, WhenConditionObjectSchema, WhenSchema, EntryValueSchema, ENTRY_KEY_RE, EntriesSchema, LaunchSchema, CREDENTIAL_TARGETS, PROVIDER_CREDENTIAL_TARGETS, CREDENTIAL_TARGET_VARS, ArgvSchema, CommandSourceOptions, EnvCredentialSourceSchema, FileCredentialSourceSchema, CommandCredentialSourceSchema, OpCredentialSourceSchema, KeychainCredentialSourceSchema, LiteralCredentialSourceSchema, CredentialSourceSchema, RemoteCredentialSourceSchema, CREDENTIAL_CACHE_STORES, CredentialCacheSchema, CredentialSchema, ProviderCredentialSchema, RESERVED_PROVIDER_ENV_KEYS, ProviderEnvSchema, PROVIDER_KINDS, ANTIGRAVITY_MODES, CLAUDE_TIERS, ANTIGRAVITY_EFFORTS, ANTIGRAVITY_DEFAULT_MODE, ANTIGRAVITY_DEFAULT_MODEL, ANTIGRAVITY_DEFAULT_TIER_MODELS, ANTIGRAVITY_DEFAULT_EFFORT, AntigravityModelTargetSchema, AntigravityProviderConfigSchema, CODEX_EFFORTS, CODEX_LOGINS, CODEX_DEFAULT_LOGIN, CODEX_DEFAULT_MODEL, CODEX_DEFAULT_TIER_MODELS, CODEX_DEFAULT_EFFORT, CodexProviderConfigSchema, ProviderRouteSchema, PickerModelSchema, PickerModelsSchema, ProviderCatalogueSchema, HttpProviderSchema, CodexProviderSchema, AntigravityProviderSchema, ProviderSchema, ConfigProfileSchema, POOL_SELECTOR_PREFIX, POOL_NAME_PATTERN, IDENTITY_NAME_PATTERN, PoolNameSchema, SELECTOR_RE, IdentitySelectorSchema, PoolMemberSchema, POOL_PREFERENCES, PoolPreferenceSchema, WHOLE_PERCENT_MAX, CompactAtUtilisationSchema, PoolSchema, WEEKDAYS, AnchorSchema, JOB_WINDOWS, JobTriggerSchema, JobTargetSchema, JobSchema, DirectoryRuleSchema, DirectoryRulesSchema, PortableConfigSchema, HEADROOM_MODES, HEADROOM_CCR_MODES, HEADROOM_ROLLOUT_CHANNELS, INTERCEPT_CHANNELS, READ_MATURATION_CHANNELS, HeadroomGlobalConfigObjectSchema, HeadroomGlobalConfigSchema, HEADROOM_DEFAULT_SOURCE, HEADROOM_DEFAULT_IDLE_SHUTDOWN_MINUTES, FrontDoorGlobalConfigSchema, UPDATE_MODES, UpdateGlobalConfigSchema, GlobalConfigSchema, IdentitySchema, CategoryClassificationSchema, CategoryClassificationOverlaySchema, SHIPPED_CATEGORY_DEFAULTS;
246
246
  var init_schema = __esm({
247
247
  "src/config/schema.ts"() {
248
248
  "use strict";
@@ -424,6 +424,12 @@ var init_schema = __esm({
424
424
  description: import_zod.z.string().min(1).optional()
425
425
  });
426
426
  PickerModelsSchema = import_zod.z.array(PickerModelSchema).refine((models) => new Set(models.map((entry) => entry.model)).size === models.length, { message: "pickerModels names a model more than once" });
427
+ ProviderCatalogueSchema = import_zod.z.strictObject({
428
+ tier: import_zod.z.enum(CLAUDE_TIERS),
429
+ include: import_zod.z.array(import_zod.z.string().min(1)).min(1).optional(),
430
+ exclude: import_zod.z.array(import_zod.z.string().min(1)).min(1).optional(),
431
+ url: import_zod.z.url().optional()
432
+ });
427
433
  HttpProviderSchema = import_zod.z.strictObject({
428
434
  $schema: import_zod.z.string().optional(),
429
435
  kind: import_zod.z.literal("http").optional(),
@@ -433,6 +439,8 @@ var init_schema = __esm({
433
439
  env: ProviderEnvSchema.optional(),
434
440
  /** Extra models `/model` lists beside the ones the tier settings name. */
435
441
  pickerModels: PickerModelsSchema.optional(),
442
+ /** The provider's own model catalogue, listed in `/model` when set. */
443
+ catalogue: ProviderCatalogueSchema.optional(),
436
444
  /** Per-request routing: when present, each request this provider would serve is matched against the list in order, and the first definite match is sent to that entry's provider instead (itself resolved exactly as a directly dialled request would be). Unmatched requests stay on this provider. */
437
445
  routes: import_zod.z.array(ProviderRouteSchema).optional()
438
446
  });
@@ -643,7 +651,7 @@ function parseIgnoringUnrecognisedKeys(schema, raw) {
643
651
  return second.success ? { success: true, data: second.data, ignored } : { success: false, issues: second.error.issues };
644
652
  }
645
653
  function describeIgnoredKeys(filePath, ignored) {
646
- const places = ignored.map(({ path: path42, keys }) => `${path42.length === 0 ? "" : `${path42.map(String).join(".")}.`}${keys.join(", ")}`);
654
+ const places = ignored.map(({ path: path43, keys }) => `${path43.length === 0 ? "" : `${path43.map(String).join(".")}.`}${keys.join(", ")}`);
647
655
  return `${filePath} has settings this version of agent-shim does not know and ignores: ${places.join("; ")}. A newer release may read them.`;
648
656
  }
649
657
  function noteIgnoredKeys(filePath, ignored) {
@@ -665,9 +673,9 @@ function restoreIgnoredKeys(filePath, value) {
665
673
  return value;
666
674
  }
667
675
  const restored = structuredClone(value);
668
- for (const { path: path42, values } of ignored) {
676
+ for (const { path: path43, values } of ignored) {
669
677
  let holder = restored;
670
- for (const step of path42) {
678
+ for (const step of path43) {
671
679
  holder = isRecord(holder) ? holder[step] : void 0;
672
680
  }
673
681
  if (isRecord(holder)) {
@@ -2947,7 +2955,7 @@ var init_package = __esm({
2947
2955
  "package.json"() {
2948
2956
  package_default = {
2949
2957
  name: "claude-use",
2950
- version: "11.25.0",
2958
+ version: "11.26.0",
2951
2959
  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.",
2952
2960
  license: "MIT",
2953
2961
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -6055,6 +6063,7 @@ function buildLayoutPaths(root) {
6055
6063
  usageDir: import_node_path23.default.join(root, "usage"),
6056
6064
  usageLogDir: import_node_path23.default.join(root, "usage", "log"),
6057
6065
  usageSnapshotsDir: import_node_path23.default.join(root, "usage", "snapshots"),
6066
+ catalogueDir: import_node_path23.default.join(root, "catalogues"),
6058
6067
  usagePicksFile: import_node_path23.default.join(root, "usage", "picks.json"),
6059
6068
  usageAnchorsFile: import_node_path23.default.join(root, "usage", "anchors.json"),
6060
6069
  usageJobsFile: import_node_path23.default.join(root, "usage", "jobs.json"),
@@ -6501,7 +6510,10 @@ function loadProvider(providersDir, name, port) {
6501
6510
  const raw = port.readConfigFile(filePath);
6502
6511
  return raw === void 0 ? void 0 : parseProviderFile(filePath, raw);
6503
6512
  }
6504
- function listProviders(paths) {
6513
+ function reportInvalidProvider(name, message) {
6514
+ console.error(`agent-shim: providers/${name}.json is invalid and was skipped: ${message}`);
6515
+ }
6516
+ function listProviders(paths, onInvalid = reportInvalidProvider) {
6505
6517
  const names = listProviderNames(
6506
6518
  (dir) => import_node_fs6.default.readdirSync(dir),
6507
6519
  paths.providersDir
@@ -6515,7 +6527,7 @@ function listProviders(paths) {
6515
6527
  if (!(error instanceof ConfigValidationError || error instanceof LegacyProviderFileError)) {
6516
6528
  throw error;
6517
6529
  }
6518
- console.error(`agent-shim: providers/${name}.json is invalid and was skipped: ${error.message}`);
6530
+ onInvalid(name, error.message);
6519
6531
  continue;
6520
6532
  }
6521
6533
  if (provider !== void 0) {
@@ -6565,6 +6577,9 @@ function addProvider(paths, name, input) {
6565
6577
  if (kind === "http" && input.baseUrl === void 0) {
6566
6578
  throw new ProviderKindMismatchError("An http provider needs --base-url.");
6567
6579
  }
6580
+ if (kind !== "http" && input.catalogue !== void 0) {
6581
+ throw new ProviderKindMismatchError("A model catalogue applies only to an http provider.");
6582
+ }
6568
6583
  if (kind !== "codex" && !isEmptyCodexConfig(input.codex)) {
6569
6584
  throw new ProviderKindMismatchError("Codex settings apply only to a codex provider (--kind codex).");
6570
6585
  }
@@ -6578,7 +6593,7 @@ function addProvider(paths, name, input) {
6578
6593
  ...input.pickerModels === void 0 || input.pickerModels.length === 0 ? {} : { pickerModels: input.pickerModels }
6579
6594
  };
6580
6595
  const parsed = ProviderSchema.safeParse(
6581
- kind === "codex" ? { kind, ...shared, ...isEmptyCodexConfig(input.codex) ? {} : { codex: input.codex } } : kind === "antigravity" ? { kind, ...shared, ...isEmptyAntigravityConfig(input.antigravity) ? {} : { antigravity: input.antigravity } } : { ...shared, baseUrl: input.baseUrl }
6596
+ kind === "codex" ? { kind, ...shared, ...isEmptyCodexConfig(input.codex) ? {} : { codex: input.codex } } : kind === "antigravity" ? { kind, ...shared, ...isEmptyAntigravityConfig(input.antigravity) ? {} : { antigravity: input.antigravity } } : { ...shared, baseUrl: input.baseUrl, ...input.catalogue === void 0 ? {} : { catalogue: input.catalogue } }
6582
6597
  );
6583
6598
  if (!parsed.success) {
6584
6599
  throw new ConfigValidationError(providerJsonPath(paths, name), parsed.error.issues);
@@ -6607,6 +6622,9 @@ function updateProvider(paths, name, input) {
6607
6622
  if (isAntigravityProvider(existing) && input.baseUrl !== void 0) {
6608
6623
  throw new ProviderKindMismatchError(`Provider "${name}" is an antigravity provider, which has no base URL.`);
6609
6624
  }
6625
+ if ((isCodexProvider(existing) || isAntigravityProvider(existing)) && input.catalogue !== void 0 && input.catalogue !== false) {
6626
+ throw new ProviderKindMismatchError(`Provider "${name}" is not an http provider; a model catalogue applies only to an http provider.`);
6627
+ }
6610
6628
  if (!isCodexProvider(existing) && !isEmptyCodexConfig(input.codex)) {
6611
6629
  throw new ProviderKindMismatchError(`Provider "${name}" is not a codex provider; codex settings apply only to a codex provider.`);
6612
6630
  }
@@ -6639,7 +6657,8 @@ function updateProvider(paths, name, input) {
6639
6657
  };
6640
6658
  candidate = { ...existing, ...shared, antigravity: isEmptyAntigravityConfig(antigravity) ? void 0 : antigravity };
6641
6659
  } else {
6642
- candidate = { ...existing, ...shared, ...input.baseUrl === void 0 ? {} : { baseUrl: input.baseUrl } };
6660
+ const catalogue = input.catalogue === void 0 ? existing.catalogue : input.catalogue === false ? void 0 : input.catalogue;
6661
+ candidate = { ...existing, ...shared, catalogue, ...input.baseUrl === void 0 ? {} : { baseUrl: input.baseUrl } };
6643
6662
  }
6644
6663
  const parsed = ProviderSchema.safeParse(candidate);
6645
6664
  if (!parsed.success) {
@@ -8032,6 +8051,49 @@ var init_translate2 = __esm({
8032
8051
  }
8033
8052
  });
8034
8053
 
8054
+ // src/providerCatalogue.ts
8055
+ function catalogueCachePath(paths, name) {
8056
+ return import_node_path38.default.join(paths.catalogueDir, `${name}.json`);
8057
+ }
8058
+ function parseCatalogueCache(text) {
8059
+ if (text === void 0) {
8060
+ return void 0;
8061
+ }
8062
+ try {
8063
+ const parsed = CatalogueCacheSchema.safeParse(JSON.parse(text));
8064
+ return parsed.success ? parsed.data : void 0;
8065
+ } catch {
8066
+ return void 0;
8067
+ }
8068
+ }
8069
+ function filterCatalogue(models, catalogue) {
8070
+ const included = catalogue.include === void 0 ? void 0 : (0, import_picomatch4.default)(catalogue.include, { dot: true });
8071
+ const excluded = catalogue.exclude === void 0 ? void 0 : (0, import_picomatch4.default)(catalogue.exclude, { dot: true });
8072
+ return models.filter((model) => included?.(model.id) !== false && excluded?.(model.id) !== true);
8073
+ }
8074
+ var import_node_path38, import_picomatch4, import_zod30, DEFAULT_CANDIDATE_URLS, MS_PER_SECOND7, SECONDS_PER_HOUR2, HOURS_PER_DAY5, MS_PER_HOUR5, HOURS_BETWEEN_RETRIES, CATALOGUE_MAX_AGE_MS, CATALOGUE_RETRY_MS, CATALOGUE_REQUEST_SECONDS, CATALOGUE_REQUEST_TIMEOUT_MS, CATALOGUE_REFRESH_TIMEOUT_MS, CatalogueModelSchema, CatalogueCacheSchema;
8075
+ var init_providerCatalogue = __esm({
8076
+ "src/providerCatalogue.ts"() {
8077
+ "use strict";
8078
+ import_node_path38 = __toESM(require("node:path"), 1);
8079
+ import_picomatch4 = __toESM(require("picomatch"), 1);
8080
+ import_zod30 = require("zod");
8081
+ DEFAULT_CANDIDATE_URLS = 2;
8082
+ MS_PER_SECOND7 = 1e3;
8083
+ SECONDS_PER_HOUR2 = 3600;
8084
+ HOURS_PER_DAY5 = 24;
8085
+ MS_PER_HOUR5 = SECONDS_PER_HOUR2 * MS_PER_SECOND7;
8086
+ HOURS_BETWEEN_RETRIES = 1;
8087
+ CATALOGUE_MAX_AGE_MS = HOURS_PER_DAY5 * MS_PER_HOUR5;
8088
+ CATALOGUE_RETRY_MS = HOURS_BETWEEN_RETRIES * MS_PER_HOUR5;
8089
+ CATALOGUE_REQUEST_SECONDS = 10;
8090
+ CATALOGUE_REQUEST_TIMEOUT_MS = CATALOGUE_REQUEST_SECONDS * MS_PER_SECOND7;
8091
+ CATALOGUE_REFRESH_TIMEOUT_MS = DEFAULT_CANDIDATE_URLS * CATALOGUE_REQUEST_TIMEOUT_MS;
8092
+ CatalogueModelSchema = import_zod30.z.strictObject({ id: import_zod30.z.string().min(1), name: import_zod30.z.string().min(1).optional() });
8093
+ CatalogueCacheSchema = import_zod30.z.strictObject({ fetchedAt: import_zod30.z.number(), url: import_zod30.z.string().min(1), models: import_zod30.z.array(CatalogueModelSchema) });
8094
+ }
8095
+ });
8096
+
8035
8097
  // src/launcher/modelPicker.ts
8036
8098
  function labelOf(model) {
8037
8099
  return model.toLowerCase().endsWith(CONTEXT_MARKER_1M) ? model.slice(0, -CONTEXT_MARKER_1M.length) : model;
@@ -8098,14 +8160,23 @@ function declaredRow(entry) {
8098
8160
  behavesAs: TIER_BEHAVES_AS[entry.tier]
8099
8161
  };
8100
8162
  }
8101
- function providerModelRows(provider) {
8163
+ function catalogueRows(provider, models) {
8164
+ if (provider.kind !== void 0 && provider.kind !== "http" || provider.catalogue === void 0) {
8165
+ return [];
8166
+ }
8167
+ const { tier } = provider.catalogue;
8168
+ return filterCatalogue(models, provider.catalogue).map((model) => ({ model: model.id, label: labelOf(model.id), description: describedAs(model.id, model.name === void 0 ? "Listed by the provider" : `Listed by the provider as ${model.name}`), behavesAs: TIER_BEHAVES_AS[tier] })).sort((left, right) => left.model.localeCompare(right.model));
8169
+ }
8170
+ function providerModelRows(provider, catalogue = []) {
8102
8171
  const derived = provider.kind === "codex" ? codexRows(provider) : provider.kind === "antigravity" ? antigravityRows(provider) : httpRows(provider);
8103
8172
  const declared = (provider.pickerModels ?? []).map(declaredRow);
8104
8173
  const declaredModels = new Set(declared.map((row) => row.model));
8105
- return [...derived.filter((row) => !declaredModels.has(row.model)), ...declared];
8174
+ const named = [...derived.filter((row) => !declaredModels.has(row.model)), ...declared];
8175
+ const taken = new Set(named.map((row) => labelOf(row.model)));
8176
+ return [...named, ...catalogueRows(provider, catalogue).filter((row) => !taken.has(labelOf(row.model)))];
8106
8177
  }
8107
- function modelPickerSettings(provider) {
8108
- const options = providerModelRows(provider);
8178
+ function modelPickerSettings(provider, catalogue = []) {
8179
+ const options = providerModelRows(provider, catalogue);
8109
8180
  return options.length === 0 ? void 0 : JSON.stringify({ modelPicker: { options, replaceBuiltInOptions: true } });
8110
8181
  }
8111
8182
  var CONTEXT_MARKER_1M, TIER_BEHAVES_AS, TIER_ENV_VARIABLES;
@@ -8114,6 +8185,7 @@ var init_modelPicker = __esm({
8114
8185
  "use strict";
8115
8186
  init_translate();
8116
8187
  init_translate2();
8188
+ init_providerCatalogue();
8117
8189
  init_schema();
8118
8190
  CONTEXT_MARKER_1M = "[1m]";
8119
8191
  TIER_BEHAVES_AS = Object.freeze({
@@ -8445,7 +8517,7 @@ function decideLaunch(params, readOnly) {
8445
8517
  identityDefaultConfigProfile: loadedIdentity?.config.defaultConfigProfile,
8446
8518
  globalDefaultConfigProfile: params.globalDefaultConfigProfile
8447
8519
  });
8448
- if (configProfileDecision.name !== void 0 && params.allowMissingConfigProfile !== true && fs13.readConfigFile(import_node_path38.default.join(paths.configProfilesDir, `${configProfileDecision.name}.json`)) === void 0) {
8520
+ if (configProfileDecision.name !== void 0 && params.allowMissingConfigProfile !== true && fs13.readConfigFile(import_node_path39.default.join(paths.configProfilesDir, `${configProfileDecision.name}.json`)) === void 0) {
8449
8521
  log.error(
8450
8522
  `agent-shim: no configuration profile named "${configProfileDecision.name}" (selected via ${configProfileDecision.source}). Run \`agent-shim profile add ${configProfileDecision.name}\` first.`
8451
8523
  );
@@ -8555,7 +8627,8 @@ function decideLaunch(params, readOnly) {
8555
8627
  log.info(`agent-shim: identity ${loginlessProvider.identity} has no stored login, so Remote Control, which needs one, is off for this launch; provider ${loginlessProvider.provider} runs without it`);
8556
8628
  }
8557
8629
  const flags = loginlessProvider === void 0 ? requestedFlags : { ...requestedFlags, remoteControl: false };
8558
- const pickerSettings = selectedProvider === void 0 ? void 0 : modelPickerSettings(selectedProvider.definition);
8630
+ const catalogue = selectedProvider === void 0 ? void 0 : parseCatalogueCache(params.fs.readFileUtf8(catalogueCachePath(paths, selectedProvider.name)));
8631
+ const pickerSettings = selectedProvider === void 0 ? void 0 : modelPickerSettings(selectedProvider.definition, catalogue?.models);
8559
8632
  const callerSettings = hasSettingsArgument(parsedArgv.rest);
8560
8633
  if (pickerSettings !== void 0 && callerSettings && !readOnly) {
8561
8634
  log.info("agent-shim: this launch passes its own --settings, so /model keeps Claude Code's own model names instead of listing the provider's models");
@@ -8566,7 +8639,7 @@ function decideLaunch(params, readOnly) {
8566
8639
  extraFlags: splitExtraFlags(env.CLAUDE_EXTRA_FLAGS),
8567
8640
  passthrough: withLauncherSettings(params.supervised === void 0 ? parsedArgv.rest : withSupervision(parsedArgv.rest, params.supervised), launcherSettings)
8568
8641
  });
8569
- const configDir = configDirEscapeHatchApplies || identityDecision.name === void 0 ? env.CLAUDE_CONFIG_DIR : import_node_path38.default.join(paths.identitiesDir, identityDecision.name);
8642
+ const configDir = configDirEscapeHatchApplies || identityDecision.name === void 0 ? env.CLAUDE_CONFIG_DIR : import_node_path39.default.join(paths.identitiesDir, identityDecision.name);
8570
8643
  const decision = {
8571
8644
  identitySource: identityDecision.source,
8572
8645
  configDirEscapeHatch: identityDecision.configDirEscapeHatch,
@@ -8607,7 +8680,7 @@ function prepareLaunch(params) {
8607
8680
  );
8608
8681
  const updateCheck = runLaunchUpdateCheck({
8609
8682
  mode: params.updateMode ?? "off",
8610
- checkPath: import_node_path38.default.join(paths.root, "update.check"),
8683
+ checkPath: import_node_path39.default.join(paths.root, "update.check"),
8611
8684
  currentVersion: package_default.version,
8612
8685
  port: params.update
8613
8686
  });
@@ -8741,12 +8814,12 @@ function runLaunchPlan(plan, spawn3) {
8741
8814
  function runLauncher(params) {
8742
8815
  params.proc.exit(runLaunchPlan(prepareLaunch(params), params.spawn));
8743
8816
  }
8744
- var import_node_crypto11, import_node_path38;
8817
+ var import_node_crypto11, import_node_path39;
8745
8818
  var init_launcher = __esm({
8746
8819
  "src/launcher.ts"() {
8747
8820
  "use strict";
8748
8821
  import_node_crypto11 = require("node:crypto");
8749
- import_node_path38 = __toESM(require("node:path"), 1);
8822
+ import_node_path39 = __toESM(require("node:path"), 1);
8750
8823
  init_package();
8751
8824
  init_envBool();
8752
8825
  init_argv();
@@ -8758,6 +8831,7 @@ var init_launcher = __esm({
8758
8831
  init_extraFlags();
8759
8832
  init_claudeSession();
8760
8833
  init_modelPicker();
8834
+ init_providerCatalogue();
8761
8835
  init_pool();
8762
8836
  init_resumeContext();
8763
8837
  init_lock();
@@ -8780,13 +8854,13 @@ function agentShimCliPath(distDir = typeof __AGENT_SHIM_DIST_DIR__ === "string"
8780
8854
  if (distDir === void 0) {
8781
8855
  throw new OwnCliPathUnknownError();
8782
8856
  }
8783
- return import_node_path39.default.join(distDir, OWN_CLI_FILE_NAME);
8857
+ return import_node_path40.default.join(distDir, OWN_CLI_FILE_NAME);
8784
8858
  }
8785
- var import_node_path39, OWN_CLI_FILE_NAME, OwnCliPathUnknownError;
8859
+ var import_node_path40, OWN_CLI_FILE_NAME, OwnCliPathUnknownError;
8786
8860
  var init_ownCli = __esm({
8787
8861
  "src/ownCli.ts"() {
8788
8862
  "use strict";
8789
- import_node_path39 = __toESM(require("node:path"), 1);
8863
+ import_node_path40 = __toESM(require("node:path"), 1);
8790
8864
  init_cliError();
8791
8865
  OWN_CLI_FILE_NAME = "cli.cjs";
8792
8866
  OwnCliPathUnknownError = class extends CliError {
@@ -8812,7 +8886,7 @@ var init_selfIdentity = __esm({
8812
8886
  // src/frontdoor/trust.ts
8813
8887
  function resolveTrustBundle(params) {
8814
8888
  const { caCertFile, bundlesDir, variable, inherited, fs: fs13 } = params;
8815
- if (inherited === void 0 || inherited === "" || import_node_path40.default.resolve(inherited) === import_node_path40.default.resolve(caCertFile)) {
8889
+ if (inherited === void 0 || inherited === "" || import_node_path41.default.resolve(inherited) === import_node_path41.default.resolve(caCertFile)) {
8816
8890
  return { path: caCertFile };
8817
8891
  }
8818
8892
  const caPem = fs13.readFileUtf8(caCertFile);
@@ -8830,19 +8904,19 @@ function resolveTrustBundle(params) {
8830
8904
  }
8831
8905
  const combined = `${inheritedPem.trimEnd()}
8832
8906
  ${caPem}`;
8833
- const bundle = import_node_path40.default.join(bundlesDir, `${(0, import_node_crypto12.createHash)("sha256").update(combined).digest("hex").slice(0, BUNDLE_NAME_HEX_DIGITS)}.pem`);
8907
+ const bundle = import_node_path41.default.join(bundlesDir, `${(0, import_node_crypto12.createHash)("sha256").update(combined).digest("hex").slice(0, BUNDLE_NAME_HEX_DIGITS)}.pem`);
8834
8908
  if (!fs13.exists(bundle)) {
8835
8909
  fs13.mkdirp(bundlesDir);
8836
8910
  fs13.writeFileAtomic(bundle, combined);
8837
8911
  }
8838
8912
  return { path: bundle };
8839
8913
  }
8840
- var import_node_crypto12, import_node_path40, BUNDLE_NAME_HEX_DIGITS;
8914
+ var import_node_crypto12, import_node_path41, BUNDLE_NAME_HEX_DIGITS;
8841
8915
  var init_trust = __esm({
8842
8916
  "src/frontdoor/trust.ts"() {
8843
8917
  "use strict";
8844
8918
  import_node_crypto12 = require("node:crypto");
8845
- import_node_path40 = __toESM(require("node:path"), 1);
8919
+ import_node_path41 = __toESM(require("node:path"), 1);
8846
8920
  BUNDLE_NAME_HEX_DIGITS = 16;
8847
8921
  }
8848
8922
  });
@@ -8961,7 +9035,7 @@ function realPrepareLaunchParams(paths, options) {
8961
9035
  headroom: realHeadroomPort(paths, { spawnDaemon: options.spawnDaemon, cwd: farm.runtime.cwd }),
8962
9036
  frontdoor: realFrontDoorPort(paths, options.spawnDaemon),
8963
9037
  credentials: { ...realCredentialPort, cache: realCredentialCacheEnv(paths) },
8964
- hasStoredLogin: (identity) => identitySignIn(realFarmFs, { platform: process.platform, run: realRunPort }, { farmRoot: import_node_path41.default.join(paths.identitiesDir, identity), hasCredentialBlock: false }).state !== "signed-out",
9038
+ hasStoredLogin: (identity) => identitySignIn(realFarmFs, { platform: process.platform, run: realRunPort }, { farmRoot: import_node_path42.default.join(paths.identitiesDir, identity), hasCredentialBlock: false }).state !== "signed-out",
8965
9039
  ...farm.directoryIdentity === void 0 ? {} : { directoryPinnedIdentity: farm.directoryIdentity },
8966
9040
  ...farm.directoryConfigProfile === void 0 ? {} : { directoryRuleConfigProfile: farm.directoryConfigProfile },
8967
9041
  ...farm.globalDefaultConfigProfile === void 0 ? {} : { globalDefaultConfigProfile: farm.globalDefaultConfigProfile },
@@ -9018,12 +9092,12 @@ function resolveClaudeLaunch(options) {
9018
9092
  };
9019
9093
  return { resolution: resolveLaunch(realPrepareLaunchParams(paths, { proc, log, spawnDaemon, farm: buildFarmRuntime(paths, options.cwd) })), warnings };
9020
9094
  }
9021
- var import_node_os7, import_node_path41, import_node_crypto13, LaunchRefusedError;
9095
+ var import_node_os7, import_node_path42, import_node_crypto13, LaunchRefusedError;
9022
9096
  var init_launchWiring = __esm({
9023
9097
  "src/launchWiring.ts"() {
9024
9098
  "use strict";
9025
9099
  import_node_os7 = __toESM(require("node:os"), 1);
9026
- import_node_path41 = __toESM(require("node:path"), 1);
9100
+ import_node_path42 = __toESM(require("node:path"), 1);
9027
9101
  import_node_crypto13 = require("node:crypto");
9028
9102
  init_cliError();
9029
9103
  init_claudeShim();
@@ -9239,76 +9313,76 @@ var init_identityClaude = __esm({
9239
9313
  });
9240
9314
 
9241
9315
  // src/usage/providerQuota.ts
9242
- var import_zod30, MS_PER_SECOND7, SECONDS_PER_HOUR2, HOURS_PER_DAY5, DAYS_PER_MONTH, ZAI_HOST, ZAI_QUOTA_URL, ZAI_UNIT_HOURS, ZAI_UNIT_MONTHS, ZAI_UNIT_MS, ZaiLimitSchema, ZaiResponseSchema, OPENROUTER_HOST, OPENROUTER_KEY_URL, OPENROUTER_CREDITS_URL, MS_PER_DAY3, OpenRouterKeySchema, OpenRouterCreditsSchema, ANTIGRAVITY_HOST, ANTIGRAVITY_QUOTA_URL, ANTIGRAVITY_USER_URL, FIVE_HOURS2, DAYS_PER_WEEK2, FIVE_HOURS_MS, WEEK_MS, AntigravityBucketSchema, AntigravitySummarySchema, GoogleTokenInfoSchema, AntigravityUserSchema;
9316
+ var import_zod31, MS_PER_SECOND8, SECONDS_PER_HOUR3, HOURS_PER_DAY6, DAYS_PER_MONTH, ZAI_HOST, ZAI_QUOTA_URL, ZAI_UNIT_HOURS, ZAI_UNIT_MONTHS, ZAI_UNIT_MS, ZaiLimitSchema, ZaiResponseSchema, OPENROUTER_HOST, OPENROUTER_KEY_URL, OPENROUTER_CREDITS_URL, MS_PER_DAY3, OpenRouterKeySchema, OpenRouterCreditsSchema, ANTIGRAVITY_HOST, ANTIGRAVITY_QUOTA_URL, ANTIGRAVITY_USER_URL, FIVE_HOURS2, DAYS_PER_WEEK2, FIVE_HOURS_MS, WEEK_MS, AntigravityBucketSchema, AntigravitySummarySchema, GoogleTokenInfoSchema, AntigravityUserSchema;
9243
9317
  var init_providerQuota = __esm({
9244
9318
  "src/usage/providerQuota.ts"() {
9245
9319
  "use strict";
9246
- import_zod30 = require("zod");
9320
+ import_zod31 = require("zod");
9247
9321
  init_cloudUpstream();
9248
9322
  init_schema2();
9249
- MS_PER_SECOND7 = 1e3;
9250
- SECONDS_PER_HOUR2 = 3600;
9251
- HOURS_PER_DAY5 = 24;
9323
+ MS_PER_SECOND8 = 1e3;
9324
+ SECONDS_PER_HOUR3 = 3600;
9325
+ HOURS_PER_DAY6 = 24;
9252
9326
  DAYS_PER_MONTH = 30;
9253
9327
  ZAI_HOST = "api.z.ai";
9254
9328
  ZAI_QUOTA_URL = `https://${ZAI_HOST}/api/monitor/usage/quota/limit`;
9255
9329
  ZAI_UNIT_HOURS = 3;
9256
9330
  ZAI_UNIT_MONTHS = 5;
9257
9331
  ZAI_UNIT_MS = /* @__PURE__ */ new Map([
9258
- [ZAI_UNIT_HOURS, SECONDS_PER_HOUR2 * MS_PER_SECOND7],
9259
- [ZAI_UNIT_MONTHS, DAYS_PER_MONTH * HOURS_PER_DAY5 * SECONDS_PER_HOUR2 * MS_PER_SECOND7]
9332
+ [ZAI_UNIT_HOURS, SECONDS_PER_HOUR3 * MS_PER_SECOND8],
9333
+ [ZAI_UNIT_MONTHS, DAYS_PER_MONTH * HOURS_PER_DAY6 * SECONDS_PER_HOUR3 * MS_PER_SECOND8]
9260
9334
  ]);
9261
- ZaiLimitSchema = import_zod30.z.object({
9262
- type: import_zod30.z.string(),
9263
- unit: import_zod30.z.number().int(),
9264
- number: import_zod30.z.number().int().positive(),
9265
- percentage: import_zod30.z.number().nonnegative(),
9266
- nextResetTime: import_zod30.z.number().positive().optional(),
9267
- usage: import_zod30.z.number().nonnegative().optional(),
9268
- currentValue: import_zod30.z.number().nonnegative().optional(),
9269
- remaining: import_zod30.z.number().nonnegative().optional()
9335
+ ZaiLimitSchema = import_zod31.z.object({
9336
+ type: import_zod31.z.string(),
9337
+ unit: import_zod31.z.number().int(),
9338
+ number: import_zod31.z.number().int().positive(),
9339
+ percentage: import_zod31.z.number().nonnegative(),
9340
+ nextResetTime: import_zod31.z.number().positive().optional(),
9341
+ usage: import_zod31.z.number().nonnegative().optional(),
9342
+ currentValue: import_zod31.z.number().nonnegative().optional(),
9343
+ remaining: import_zod31.z.number().nonnegative().optional()
9270
9344
  });
9271
- ZaiResponseSchema = import_zod30.z.object({
9272
- success: import_zod30.z.boolean(),
9273
- msg: import_zod30.z.string().optional(),
9274
- data: import_zod30.z.object({ level: import_zod30.z.string().optional(), limits: import_zod30.z.array(ZaiLimitSchema) })
9345
+ ZaiResponseSchema = import_zod31.z.object({
9346
+ success: import_zod31.z.boolean(),
9347
+ msg: import_zod31.z.string().optional(),
9348
+ data: import_zod31.z.object({ level: import_zod31.z.string().optional(), limits: import_zod31.z.array(ZaiLimitSchema) })
9275
9349
  });
9276
9350
  OPENROUTER_HOST = "openrouter.ai";
9277
9351
  OPENROUTER_KEY_URL = `https://${OPENROUTER_HOST}/api/v1/key`;
9278
9352
  OPENROUTER_CREDITS_URL = `https://${OPENROUTER_HOST}/api/v1/credits`;
9279
- MS_PER_DAY3 = HOURS_PER_DAY5 * SECONDS_PER_HOUR2 * MS_PER_SECOND7;
9280
- OpenRouterKeySchema = import_zod30.z.object({
9281
- data: import_zod30.z.object({
9282
- limit: import_zod30.z.number().nonnegative().nullable(),
9283
- limit_remaining: import_zod30.z.number().nullable(),
9284
- limit_reset: import_zod30.z.string().nullable(),
9285
- is_free_tier: import_zod30.z.boolean().optional(),
9286
- free_model_daily_requests: import_zod30.z.object({ used: import_zod30.z.number().nonnegative(), limit: import_zod30.z.number().nonnegative(), remaining: import_zod30.z.number() }).optional()
9353
+ MS_PER_DAY3 = HOURS_PER_DAY6 * SECONDS_PER_HOUR3 * MS_PER_SECOND8;
9354
+ OpenRouterKeySchema = import_zod31.z.object({
9355
+ data: import_zod31.z.object({
9356
+ limit: import_zod31.z.number().nonnegative().nullable(),
9357
+ limit_remaining: import_zod31.z.number().nullable(),
9358
+ limit_reset: import_zod31.z.string().nullable(),
9359
+ is_free_tier: import_zod31.z.boolean().optional(),
9360
+ free_model_daily_requests: import_zod31.z.object({ used: import_zod31.z.number().nonnegative(), limit: import_zod31.z.number().nonnegative(), remaining: import_zod31.z.number() }).optional()
9287
9361
  })
9288
9362
  });
9289
- OpenRouterCreditsSchema = import_zod30.z.object({ data: import_zod30.z.object({ total_credits: import_zod30.z.number().nonnegative(), total_usage: import_zod30.z.number().nonnegative() }) });
9363
+ OpenRouterCreditsSchema = import_zod31.z.object({ data: import_zod31.z.object({ total_credits: import_zod31.z.number().nonnegative(), total_usage: import_zod31.z.number().nonnegative() }) });
9290
9364
  ANTIGRAVITY_HOST = "daily-cloudcode-pa.googleapis.com";
9291
9365
  ANTIGRAVITY_QUOTA_URL = `https://${ANTIGRAVITY_HOST}/v1internal:retrieveUserQuotaSummary`;
9292
9366
  ANTIGRAVITY_USER_URL = `https://${ANTIGRAVITY_HOST}/v1internal:loadCodeAssist`;
9293
9367
  FIVE_HOURS2 = 5;
9294
9368
  DAYS_PER_WEEK2 = 7;
9295
- FIVE_HOURS_MS = FIVE_HOURS2 * SECONDS_PER_HOUR2 * MS_PER_SECOND7;
9296
- WEEK_MS = DAYS_PER_WEEK2 * HOURS_PER_DAY5 * SECONDS_PER_HOUR2 * MS_PER_SECOND7;
9297
- AntigravityBucketSchema = import_zod30.z.object({
9298
- bucketId: import_zod30.z.string(),
9299
- remainingFraction: import_zod30.z.number().optional(),
9300
- resetTime: import_zod30.z.string().optional()
9369
+ FIVE_HOURS_MS = FIVE_HOURS2 * SECONDS_PER_HOUR3 * MS_PER_SECOND8;
9370
+ WEEK_MS = DAYS_PER_WEEK2 * HOURS_PER_DAY6 * SECONDS_PER_HOUR3 * MS_PER_SECOND8;
9371
+ AntigravityBucketSchema = import_zod31.z.object({
9372
+ bucketId: import_zod31.z.string(),
9373
+ remainingFraction: import_zod31.z.number().optional(),
9374
+ resetTime: import_zod31.z.string().optional()
9301
9375
  });
9302
- AntigravitySummarySchema = import_zod30.z.object({ groups: import_zod30.z.array(import_zod30.z.object({ buckets: import_zod30.z.array(AntigravityBucketSchema) })) });
9303
- GoogleTokenInfoSchema = import_zod30.z.object({
9304
- email: import_zod30.z.string().optional(),
9305
- sub: import_zod30.z.string().optional()
9376
+ AntigravitySummarySchema = import_zod31.z.object({ groups: import_zod31.z.array(import_zod31.z.object({ buckets: import_zod31.z.array(AntigravityBucketSchema) })) });
9377
+ GoogleTokenInfoSchema = import_zod31.z.object({
9378
+ email: import_zod31.z.string().optional(),
9379
+ sub: import_zod31.z.string().optional()
9306
9380
  });
9307
- AntigravityUserSchema = import_zod30.z.object({
9381
+ AntigravityUserSchema = import_zod31.z.object({
9308
9382
  /** The code-assist tier context, which defaults to the free tier for every account. */
9309
- currentTier: import_zod30.z.object({ name: import_zod30.z.string().optional(), id: import_zod30.z.string().optional() }).optional(),
9383
+ currentTier: import_zod31.z.object({ name: import_zod31.z.string().optional(), id: import_zod31.z.string().optional() }).optional(),
9310
9384
  /** The account's paid subscription; absent when the account has none. */
9311
- paidTier: import_zod30.z.object({ name: import_zod30.z.string().optional(), id: import_zod30.z.string().optional() }).optional()
9385
+ paidTier: import_zod31.z.object({ name: import_zod31.z.string().optional(), id: import_zod31.z.string().optional() }).optional()
9312
9386
  });
9313
9387
  }
9314
9388
  });
@@ -10321,8 +10395,8 @@ function parseConnectTarget(authority) {
10321
10395
  function isInterceptedHost(host, interceptHosts) {
10322
10396
  return interceptHosts.includes(host);
10323
10397
  }
10324
- function servedByPipeline(path42) {
10325
- return path42?.startsWith(ROUTED_PATH_PREFIX) === true;
10398
+ function servedByPipeline(path43) {
10399
+ return path43?.startsWith(ROUTED_PATH_PREFIX) === true;
10326
10400
  }
10327
10401
  var HOP_BY_HOP_HEADERS = /* @__PURE__ */ new Set([
10328
10402
  "connection",
@@ -11116,11 +11190,11 @@ function createRcSessionTracker(deps) {
11116
11190
  };
11117
11191
  const observeExchange = (request4) => {
11118
11192
  const method = (request4.method ?? "").toUpperCase();
11119
- const path42 = new URL(request4.url ?? "/", "http://127.0.0.1").pathname;
11120
- if (!path42.startsWith(RC_SESSIONS_PATH_PREFIX)) {
11193
+ const path43 = new URL(request4.url ?? "/", "http://127.0.0.1").pathname;
11194
+ if (!path43.startsWith(RC_SESSIONS_PATH_PREFIX)) {
11121
11195
  return void 0;
11122
11196
  }
11123
- const tail = path42.slice(RC_SESSIONS_PATH_PREFIX.length);
11197
+ const tail = path43.slice(RC_SESSIONS_PATH_PREFIX.length);
11124
11198
  const facts = {
11125
11199
  oauthAuthorization: oauthAuthorizationOf(request4.headers),
11126
11200
  anthropicVersion: singleHeader(request4.headers, "anthropic-version"),
@@ -11510,8 +11584,8 @@ var RC_READ_FILE_ENCODINGS = ["utf-8", "base64"];
11510
11584
  function isRcReadFileEncoding(value) {
11511
11585
  return RC_READ_FILE_ENCODINGS.some((encoding) => encoding === value);
11512
11586
  }
11513
- function buildRcReadFilePayload(requestId, path42, options) {
11514
- return buildRcControlRequestPayload(requestId, { subtype: "read_file", path: path42, ...options?.maxBytes === void 0 ? {} : { max_bytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } });
11587
+ function buildRcReadFilePayload(requestId, path43, options) {
11588
+ return buildRcControlRequestPayload(requestId, { subtype: "read_file", path: path43, ...options?.maxBytes === void 0 ? {} : { max_bytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } });
11515
11589
  }
11516
11590
  function buildRcFileSuggestionsPayload(requestId, query) {
11517
11591
  return buildRcControlRequestPayload(requestId, { subtype: "file_suggestions", query });
@@ -11613,15 +11687,15 @@ async function getRcSessionContextUsage(deps, sessionId, detail) {
11613
11687
  const result = await deliverRcClientPayload(deps, sessionId, buildRcGetContextUsagePayload(requestId, detail), `request the context usage of session ${sessionId}`);
11614
11688
  return result.ok ? { ...result, requestId } : result;
11615
11689
  }
11616
- async function readRcSessionFile(deps, sessionId, path42, options) {
11617
- if (path42 === "") {
11690
+ async function readRcSessionFile(deps, sessionId, path43, options) {
11691
+ if (path43 === "") {
11618
11692
  return { ok: false, message: "a read-file write needs a non-empty path: the SDK's own field names the file the worker resolves against the session's cwd, and an empty string names none" };
11619
11693
  }
11620
11694
  if (options?.maxBytes !== void 0 && (!Number.isInteger(options.maxBytes) || options.maxBytes <= 0)) {
11621
11695
  return { ok: false, message: "a read-file write's max-bytes is a positive whole number of bytes: the SDK's own field caps the read, and a zero or negative cap reads nothing" };
11622
11696
  }
11623
11697
  const requestId = deps.newUuid();
11624
- const result = await deliverRcClientPayload(deps, sessionId, buildRcReadFilePayload(requestId, path42, options), `read ${path42} from session ${sessionId}`);
11698
+ const result = await deliverRcClientPayload(deps, sessionId, buildRcReadFilePayload(requestId, path43, options), `read ${path43} from session ${sessionId}`);
11625
11699
  return result.ok ? { ...result, requestId } : result;
11626
11700
  }
11627
11701
  async function suggestRcSessionFiles(deps, sessionId, query) {
@@ -11790,11 +11864,11 @@ function createRcControlHandler(deps) {
11790
11864
  path: "read-file",
11791
11865
  read: (body) => {
11792
11866
  const session = bodyString(body, "session");
11793
- const path42 = bodyString(body, "path");
11867
+ const path43 = bodyString(body, "path");
11794
11868
  const maxBytes = "maxBytes" in body ? bodyPositiveInteger(body, "maxBytes") : void 0;
11795
11869
  const encoding = "encoding" in body && isRcReadFileEncoding(body.encoding) ? body.encoding : void 0;
11796
- const refused2 = session === void 0 || path42 === void 0 || "maxBytes" in body && maxBytes === void 0 || "encoding" in body && encoding === void 0;
11797
- return refused2 ? { error: `the read-file body must be JSON naming a non-empty session id and path, maxBytes only as a positive whole number or absent, and an encoding the SDK's own type permits (${RC_READ_FILE_ENCODINGS.join(", ")}) or none` } : { session, run: async () => await deps.readFile(session, path42, { ...maxBytes === void 0 ? {} : { maxBytes }, ...encoding === void 0 ? {} : { encoding } }) };
11870
+ const refused2 = session === void 0 || path43 === void 0 || "maxBytes" in body && maxBytes === void 0 || "encoding" in body && encoding === void 0;
11871
+ return refused2 ? { error: `the read-file body must be JSON naming a non-empty session id and path, maxBytes only as a positive whole number or absent, and an encoding the SDK's own type permits (${RC_READ_FILE_ENCODINGS.join(", ")}) or none` } : { session, run: async () => await deps.readFile(session, path43, { ...maxBytes === void 0 ? {} : { maxBytes }, ...encoding === void 0 ? {} : { encoding } }) };
11798
11872
  }
11799
11873
  },
11800
11874
  {
@@ -12104,9 +12178,9 @@ function requestIdOfBody(body) {
12104
12178
  }
12105
12179
  function frontDoorRcControl(transport, token) {
12106
12180
  const headers = { authorization: `Bearer ${token}` };
12107
- const listAnswerOf = async (path42, what) => {
12181
+ const listAnswerOf = async (path43, what) => {
12108
12182
  try {
12109
- return await transport.request({ method: "GET", path: path42, headers });
12183
+ return await transport.request({ method: "GET", path: path43, headers });
12110
12184
  } catch (error) {
12111
12185
  throw new Error(`${what}: could not reach the front door's control listener: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
12112
12186
  }
@@ -12178,10 +12252,10 @@ function frontDoorRcControl(transport, token) {
12178
12252
  }
12179
12253
  return pending;
12180
12254
  };
12181
- const writeOf = async (path42, body, describeFailure2) => {
12255
+ const writeOf = async (path43, body, describeFailure2) => {
12182
12256
  let answer;
12183
12257
  try {
12184
- answer = await transport.request({ method: "POST", path: path42, headers: { ...headers, "content-type": "application/json" }, body });
12258
+ answer = await transport.request({ method: "POST", path: path43, headers: { ...headers, "content-type": "application/json" }, body });
12185
12259
  } catch (error) {
12186
12260
  return { ok: false, message: `could not reach the front door's control listener: ${error instanceof Error ? error.message : String(error)}` };
12187
12261
  }
@@ -12212,10 +12286,10 @@ function frontDoorRcControl(transport, token) {
12212
12286
  endSession: async (sessionId, reason) => await writeOf(`${CONTROL_PATH_PREFIX}/end-session`, JSON.stringify({ session: sessionId, ...reason === void 0 ? {} : { reason } }), (status, message) => `ending ${sessionId} failed (HTTP ${String(status)}): ${message}`),
12213
12287
  getUsage: async (sessionId, skipBehaviors) => await writeOf(`${CONTROL_PATH_PREFIX}/get-usage`, JSON.stringify({ session: sessionId, ...skipBehaviors === void 0 ? {} : { skipBehaviors } }), (status, message) => `requesting the usage of ${sessionId} failed (HTTP ${String(status)}): ${message}`),
12214
12288
  getContextUsage: async (sessionId, detail) => await writeOf(`${CONTROL_PATH_PREFIX}/get-context-usage`, JSON.stringify({ session: sessionId, ...detail === void 0 ? {} : { detail } }), (status, message) => `requesting the context usage of ${sessionId} failed (HTTP ${String(status)}): ${message}`),
12215
- readFile: async (sessionId, path42, options) => await writeOf(
12289
+ readFile: async (sessionId, path43, options) => await writeOf(
12216
12290
  `${CONTROL_PATH_PREFIX}/read-file`,
12217
- JSON.stringify({ session: sessionId, path: path42, ...options?.maxBytes === void 0 ? {} : { maxBytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } }),
12218
- (status, message) => `reading ${path42} from ${sessionId} failed (HTTP ${String(status)}): ${message}`
12291
+ JSON.stringify({ session: sessionId, path: path43, ...options?.maxBytes === void 0 ? {} : { maxBytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } }),
12292
+ (status, message) => `reading ${path43} from ${sessionId} failed (HTTP ${String(status)}): ${message}`
12219
12293
  ),
12220
12294
  fileSuggestions: async (sessionId, query) => await writeOf(`${CONTROL_PATH_PREFIX}/file-suggestions`, JSON.stringify({ session: sessionId, query }), (status, message) => `requesting file suggestions from ${sessionId} failed (HTTP ${String(status)}): ${message}`),
12221
12295
  keepAlive: async (sessionId) => await writeOf(`${CONTROL_PATH_PREFIX}/keep-alive`, JSON.stringify({ session: sessionId }), (status, message) => `keeping ${sessionId} alive failed (HTTP ${String(status)}): ${message}`),
@@ -12374,12 +12448,12 @@ function tlsFacts(options) {
12374
12448
  }
12375
12449
  function realRcEventDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
12376
12450
  const agent = new ExemptTlsAgent();
12377
- const post = async (path42, headers, body) => await new Promise((resolve, reject) => {
12451
+ const post = async (path43, headers, body) => await new Promise((resolve, reject) => {
12378
12452
  const options = {
12379
12453
  host: target.host,
12380
12454
  port: target.port,
12381
12455
  method: "POST",
12382
- path: path42,
12456
+ path: path43,
12383
12457
  // The Host header names the host whose API this is, not the address dialled: a redirected test dials a loopback stand-in while still speaking to the API host by name, exactly as the forwarded paths present their SNI.
12384
12458
  headers: { ...headers, host: target.servername ?? target.host, "content-length": String(Buffer.byteLength(body, "utf8")) },
12385
12459
  agent
@@ -12444,12 +12518,12 @@ function lateRcStreamDial(resolve) {
12444
12518
  }
12445
12519
  function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
12446
12520
  const agent = new ExemptTlsAgent();
12447
- const request4 = async (method, path42, headers, body, signal) => await new Promise((resolve, reject) => {
12521
+ const request4 = async (method, path43, headers, body, signal) => await new Promise((resolve, reject) => {
12448
12522
  const options = {
12449
12523
  host: target.host,
12450
12524
  port: target.port,
12451
12525
  method,
12452
- path: path42,
12526
+ path: path43,
12453
12527
  // The Host header names the host whose API this is, not the address dialled: a redirected test dials a loopback stand-in while still speaking to the API host by name, exactly as the forwarded paths present their SNI.
12454
12528
  headers: { ...headers, host: target.servername ?? target.host, ...body === void 0 ? {} : { "content-length": String(Buffer.byteLength(body, "utf8")) } },
12455
12529
  agent,
@@ -12491,9 +12565,9 @@ function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_P
12491
12565
  return { status, body: await readAll(response) };
12492
12566
  },
12493
12567
  openStream: async (sessionId, headers, resume, signal) => {
12494
- const path42 = resume === void 0 ? `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream` : `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream?from_sequence_num=${String(resume.fromSequenceNum)}`;
12568
+ const path43 = resume === void 0 ? `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream` : `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream?from_sequence_num=${String(resume.fromSequenceNum)}`;
12495
12569
  const streamHeaders = resume === void 0 ? headers : { ...headers, "last-event-id": String(resume.fromSequenceNum) };
12496
- const { status, response } = await request4("GET", path42, streamHeaders, void 0, signal);
12570
+ const { status, response } = await request4("GET", path43, streamHeaders, void 0, signal);
12497
12571
  if (!isSuccessful2(status)) {
12498
12572
  await readAll(response);
12499
12573
  return { status, chunks: NO_CHUNKS };
@@ -13645,19 +13719,19 @@ function writePools(paths, pools) {
13645
13719
  applyPatch(paths.globalConfigFile, GlobalConfigSchema, { pools }, { defaults: {} });
13646
13720
  }
13647
13721
  function poolCycleOf(pools, name) {
13648
- const walk = (current, path42) => {
13722
+ const walk = (current, path43) => {
13649
13723
  for (const entry of pools[current]?.identities ?? []) {
13650
13724
  const nested = poolNameOf(poolMemberIdentity(entry));
13651
13725
  if (nested === void 0) {
13652
13726
  continue;
13653
13727
  }
13654
13728
  if (nested === name) {
13655
- return [...path42, nested];
13729
+ return [...path43, nested];
13656
13730
  }
13657
- if (path42.includes(nested)) {
13731
+ if (path43.includes(nested)) {
13658
13732
  continue;
13659
13733
  }
13660
- const found = walk(nested, [...path42, nested]);
13734
+ const found = walk(nested, [...path43, nested]);
13661
13735
  if (found !== void 0) {
13662
13736
  return found;
13663
13737
  }
@@ -15936,7 +16010,7 @@ function profileValue(name, paths) {
15936
16010
  function createConfigApiRouter(deps) {
15937
16011
  const authed = doorApiAuth(deps.expectedToken);
15938
16012
  const { paths } = deps;
15939
- const route = (path42, summary) => authed.meta((0, import_openapi3.openapi)({ method: "POST", path: path42, summary, tags: [CONFIG_API_TAG] }));
16013
+ const route = (path43, summary) => authed.meta((0, import_openapi3.openapi)({ method: "POST", path: path43, summary, tags: [CONFIG_API_TAG] }));
15940
16014
  return {
15941
16015
  config: {
15942
16016
  identity: {