claude-use 11.33.0 → 11.35.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
@@ -212,6 +212,9 @@ function isHttpProvider(provider) {
212
212
  function isCodexProvider(provider) {
213
213
  return provider.kind === "codex";
214
214
  }
215
+ function isRouterProvider(provider) {
216
+ return provider.kind === "router";
217
+ }
215
218
  function isAntigravityProvider(provider) {
216
219
  return provider.kind === "antigravity";
217
220
  }
@@ -226,7 +229,7 @@ function isTimeZone(name) {
226
229
  return false;
227
230
  }
228
231
  }
229
- var 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, SELECTION_MODES, VirtualModelSchema, ModelPricesSchema, ModelsConfigSchema, ModelsLayerSchema, 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;
232
+ var 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, RouterProviderSchema, AntigravityProviderSchema, ProviderSchema, SELECTION_MODES, VirtualModelSchema, ModelPricesSchema, ModelsConfigSchema, ModelsLayerSchema, 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;
230
233
  var init_schema = __esm({
231
234
  "src/config/schema.ts"() {
232
235
  "use strict";
@@ -268,6 +271,8 @@ var init_schema = __esm({
268
271
  delay: z.string().regex(DURATION_RE, "must be a duration such as 5s or 500ms").optional(),
269
272
  /** Whether the launcher waits for a key press after its own output before it starts claude. Takes the place of `delay` when both are set. Applies only when a terminal is watching. */
270
273
  pause: z.boolean().optional(),
274
+ /** Whether a provider session routes provider-qualified model names (`z/glm-5.3`, `auto`) through the `models` block to the provider that serves them, instead of sending every request to the launch provider. */
275
+ routeByName: z.boolean().optional(),
271
276
  /** Whether the launcher's report, for a launch that picks from a pool, lists every member the pick ranked with why each stands where it does, and not only the member it picked. */
272
277
  explain: z.boolean().optional()
273
278
  });
@@ -328,7 +333,7 @@ var init_schema = __esm({
328
333
  ProviderEnvSchema = z.record(z.string().min(1), z.string()).refine((env) => !Object.keys(env).some((key) => RESERVED_PROVIDER_ENV_KEYS.includes(key)), {
329
334
  message: `env may not set ${RESERVED_PROVIDER_ENV_KEYS.join(", ")}: the credential block's target sets one and agent-shim removes the others`
330
335
  });
331
- PROVIDER_KINDS = ["http", "codex", "antigravity"];
336
+ PROVIDER_KINDS = ["http", "codex", "antigravity", "router"];
332
337
  ANTIGRAVITY_MODES = ["cloud", "local"];
333
338
  CLAUDE_TIERS = ["fable", "opus", "sonnet", "haiku"];
334
339
  ANTIGRAVITY_EFFORTS = ["none", "low", "medium", "high", "xhigh", "max"];
@@ -441,6 +446,11 @@ var init_schema = __esm({
441
446
  pickerModels: PickerModelsSchema.optional(),
442
447
  codex: CodexProviderConfigSchema.optional()
443
448
  });
449
+ RouterProviderSchema = z.strictObject({
450
+ $schema: z.string().optional(),
451
+ kind: z.literal("router"),
452
+ displayName: z.string().min(1)
453
+ });
444
454
  AntigravityProviderSchema = z.strictObject({
445
455
  $schema: z.string().optional(),
446
456
  kind: z.literal("antigravity"),
@@ -451,7 +461,7 @@ var init_schema = __esm({
451
461
  pickerModels: PickerModelsSchema.optional(),
452
462
  antigravity: AntigravityProviderConfigSchema.optional()
453
463
  });
454
- ProviderSchema = z.discriminatedUnion("kind", [HttpProviderSchema, CodexProviderSchema, AntigravityProviderSchema]);
464
+ ProviderSchema = z.discriminatedUnion("kind", [HttpProviderSchema, CodexProviderSchema, AntigravityProviderSchema, RouterProviderSchema]);
455
465
  SELECTION_MODES = ["ordered", "most-allowance", "soonest-reset", "spread", "adaptive", "lowest-latency", "highest-success", "cheapest"];
456
466
  VirtualModelSchema = z.strictObject({
457
467
  /** How the virtual model chooses its member for a request. */
@@ -1424,6 +1434,9 @@ function flattenLayers(layers, options) {
1424
1434
  if (layer.launch.explain !== void 0) {
1425
1435
  launch.explain = layer.launch.explain;
1426
1436
  }
1437
+ if (layer.launch.routeByName !== void 0) {
1438
+ launch.routeByName = layer.launch.routeByName;
1439
+ }
1427
1440
  }
1428
1441
  if (layer.models !== void 0) {
1429
1442
  models = mergeModels(models, layer.models);
@@ -2852,7 +2865,7 @@ var init_capability = __esm({
2852
2865
  });
2853
2866
 
2854
2867
  // src/frontdoor/route.ts
2855
- var IDENTITY_HEADER, SESSION_HEADER, PROVIDER_HEADER, HEADROOM_FLAG_HEADER, PROJECT_ID_HEADER, AUTH_HEADER;
2868
+ var IDENTITY_HEADER, SESSION_HEADER, PROVIDER_HEADER, HEADROOM_FLAG_HEADER, ROUTE_BY_NAME_HEADER, PROJECT_ID_HEADER, AUTH_HEADER;
2856
2869
  var init_route = __esm({
2857
2870
  "src/frontdoor/route.ts"() {
2858
2871
  "use strict";
@@ -2860,6 +2873,7 @@ var init_route = __esm({
2860
2873
  SESSION_HEADER = "x-agent-shim-session";
2861
2874
  PROVIDER_HEADER = "x-agent-shim-provider";
2862
2875
  HEADROOM_FLAG_HEADER = "x-agent-shim-headroom";
2876
+ ROUTE_BY_NAME_HEADER = "x-agent-shim-route-by-name";
2863
2877
  PROJECT_ID_HEADER = "x-headroom-project-id";
2864
2878
  AUTH_HEADER = "x-agent-shim-auth";
2865
2879
  }
@@ -3068,7 +3082,7 @@ var init_package = __esm({
3068
3082
  "package.json"() {
3069
3083
  package_default = {
3070
3084
  name: "claude-use",
3071
- version: "11.33.0",
3085
+ version: "11.35.0",
3072
3086
  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.",
3073
3087
  license: "MIT",
3074
3088
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -6768,7 +6782,7 @@ function describeProviderEndpoint(provider) {
6768
6782
  if (isAntigravityProvider(provider)) {
6769
6783
  return (provider.antigravity?.mode ?? ANTIGRAVITY_DEFAULT_MODE) === "local" ? "antigravity local (ACP daemon)" : "antigravity cloud (Gemini API)";
6770
6784
  }
6771
- return provider.baseUrl;
6785
+ return isRouterProvider(provider) ? "the models block" : provider.baseUrl;
6772
6786
  }
6773
6787
  function isEmptyCodexConfig(config) {
6774
6788
  return config === void 0 || config.defaultModel === void 0 && config.effort === void 0 && config.login === void 0 && (config.models === void 0 || Object.keys(config.models).length === 0);
@@ -6790,10 +6804,16 @@ function addProvider(paths, name, input) {
6790
6804
  if (kind === "antigravity" && input.baseUrl !== void 0) {
6791
6805
  throw new ProviderKindMismatchError("An antigravity provider has no base URL: the launcher points its sessions at the front-door daemon. Drop --base-url.");
6792
6806
  }
6807
+ if (kind === "router" && input.baseUrl !== void 0) {
6808
+ throw new ProviderKindMismatchError("A router provider has no base URL: it resolves each request's model name through the models block. Drop --base-url.");
6809
+ }
6793
6810
  if (kind === "http" && input.baseUrl === void 0) {
6794
6811
  throw new ProviderKindMismatchError("An http provider needs --base-url.");
6795
6812
  }
6796
- if (kind !== "http" && input.catalogue !== void 0) {
6813
+ if (kind === "router" && (input.sources.length > 0 || input.target !== void 0 || input.env !== void 0 || input.pickerModels !== void 0)) {
6814
+ throw new ProviderKindMismatchError("A router provider has no credential, env or picker models of its own: the models block's targets carry their own.");
6815
+ }
6816
+ if (kind !== "http" && kind !== "router" && input.catalogue !== void 0) {
6797
6817
  throw new ProviderKindMismatchError("A model catalogue applies only to an http provider.");
6798
6818
  }
6799
6819
  if (kind !== "codex" && !isEmptyCodexConfig(input.codex)) {
@@ -6809,7 +6829,7 @@ function addProvider(paths, name, input) {
6809
6829
  ...input.pickerModels === void 0 || input.pickerModels.length === 0 ? {} : { pickerModels: input.pickerModels }
6810
6830
  };
6811
6831
  const parsed = ProviderSchema.safeParse(
6812
- 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 } }
6832
+ kind === "router" ? { kind, displayName: input.displayName } : 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 } }
6813
6833
  );
6814
6834
  if (!parsed.success) {
6815
6835
  throw new ConfigValidationError(providerJsonPath(paths, name), parsed.error.issues);
@@ -6823,15 +6843,18 @@ function updateProvider(paths, name, input) {
6823
6843
  throw new ProviderNotFoundError(name);
6824
6844
  }
6825
6845
  const unset = new Set(input.unsetEnv);
6826
- const env = Object.fromEntries(Object.entries({ ...existing.env, ...input.env }).filter(([key]) => !unset.has(key)));
6846
+ const existingEnv = isRouterProvider(existing) ? {} : existing.env;
6847
+ const env = Object.fromEntries(Object.entries({ ...existingEnv, ...input.env }).filter(([key]) => !unset.has(key)));
6827
6848
  const unsetPicker = new Set(input.unsetPickerModels);
6828
6849
  const added = new Map((input.pickerModels ?? []).map((entry) => [entry.model, entry]));
6850
+ const existingPicker = isRouterProvider(existing) ? [] : existing.pickerModels;
6829
6851
  const pickerModels = [
6830
- ...(existing.pickerModels ?? []).filter((entry) => !unsetPicker.has(entry.model)).map((entry) => added.get(entry.model) ?? entry),
6831
- ...[...added.values()].filter((entry) => !(existing.pickerModels ?? []).some((kept) => kept.model === entry.model))
6852
+ ...(existingPicker ?? []).filter((entry) => !unsetPicker.has(entry.model)).map((entry) => added.get(entry.model) ?? entry),
6853
+ ...[...added.values()].filter((entry) => !(existingPicker ?? []).some((kept) => kept.model === entry.model))
6832
6854
  ];
6833
- const target = input.target ?? existing.credential.target;
6834
- const cache = input.cache === void 0 ? existing.credential.cache : input.cache === false ? void 0 : input.cache;
6855
+ const router = isRouterProvider(existing);
6856
+ const target = router ? void 0 : input.target ?? existing.credential.target;
6857
+ const cache = router ? void 0 : input.cache === void 0 ? existing.credential.cache : input.cache === false ? void 0 : input.cache;
6835
6858
  if (isCodexProvider(existing) && input.baseUrl !== void 0) {
6836
6859
  throw new ProviderKindMismatchError(`Provider "${name}" is a codex provider, which has no base URL.`);
6837
6860
  }
@@ -6849,10 +6872,12 @@ function updateProvider(paths, name, input) {
6849
6872
  }
6850
6873
  const shared = {
6851
6874
  ...input.displayName === void 0 ? {} : { displayName: input.displayName },
6852
- credential: {
6853
- sources: input.sources ?? existing.credential.sources,
6854
- ...target === void 0 ? {} : { target },
6855
- ...cache === void 0 ? {} : { cache }
6875
+ ...router ? {} : {
6876
+ credential: {
6877
+ sources: input.sources ?? existing.credential.sources,
6878
+ ...target === void 0 ? {} : { target },
6879
+ ...cache === void 0 ? {} : { cache }
6880
+ }
6856
6881
  },
6857
6882
  env: Object.keys(env).length === 0 ? void 0 : env,
6858
6883
  pickerModels: pickerModels.length === 0 ? void 0 : pickerModels
@@ -6872,6 +6897,8 @@ function updateProvider(paths, name, input) {
6872
6897
  ...existing.antigravity?.models === void 0 && input.antigravity?.models === void 0 ? {} : { models: { ...existing.antigravity?.models, ...input.antigravity?.models } }
6873
6898
  };
6874
6899
  candidate = { ...existing, ...shared, antigravity: isEmptyAntigravityConfig(antigravity) ? void 0 : antigravity };
6900
+ } else if (router) {
6901
+ candidate = { kind: "router", ...shared };
6875
6902
  } else {
6876
6903
  const catalogue = input.catalogue === void 0 ? existing.catalogue : input.catalogue === false ? void 0 : input.catalogue;
6877
6904
  candidate = { ...existing, ...shared, catalogue, ...input.baseUrl === void 0 ? {} : { baseUrl: input.baseUrl } };
@@ -6921,6 +6948,9 @@ function resolveProvider(params) {
6921
6948
  return selection;
6922
6949
  }
6923
6950
  const { name, definition } = selection.provider;
6951
+ if (isRouterProvider(definition)) {
6952
+ return { ok: true, provider: { name, definition, credential: { target: "bearer", token: "", source: { env: "AGENT_SHIM_ROUTER" }, warnings: [] } }, warnings: [] };
6953
+ }
6924
6954
  if (params.credentials === void 0) {
6925
6955
  return { ok: false, status: 1, message: `agent-shim: provider ${name} needs its credential resolved, but this launcher has no credential port wired` };
6926
6956
  }
@@ -7666,7 +7696,8 @@ var init_argv = __esm({
7666
7696
  { flag: "--remote-control", key: "remoteControl" },
7667
7697
  { flag: "--wait", key: "wait" },
7668
7698
  { flag: "--pause", key: "pause" },
7669
- { flag: "--explain", key: "explain" }
7699
+ { flag: "--explain", key: "explain" },
7700
+ { flag: "--route-by-name", key: "routeByName" }
7670
7701
  ];
7671
7702
  LAUNCHER_FLAG_NAMES = [
7672
7703
  ...VALUED_FLAGS,
@@ -7857,6 +7888,7 @@ function resolveLaunchFlags(params) {
7857
7888
  trackUsage: params.flags?.trackUsage ?? parseEnvBool("AGENT_SHIM_TRACK_USAGE", params.env.AGENT_SHIM_TRACK_USAGE) ?? params.cascade?.trackUsage ?? true,
7858
7889
  pause: params.flags?.pause ?? parseEnvBool("AGENT_SHIM_PAUSE", params.env.AGENT_SHIM_PAUSE) ?? params.cascade?.pause ?? false,
7859
7890
  explain: params.flags?.explain ?? parseEnvBool("AGENT_SHIM_EXPLAIN", params.env.AGENT_SHIM_EXPLAIN) ?? params.cascade?.explain ?? false,
7891
+ routeByName: params.flags?.routeByName ?? parseEnvBool("AGENT_SHIM_ROUTE_BY_NAME", params.env.AGENT_SHIM_ROUTE_BY_NAME) ?? params.cascade?.routeByName ?? false,
7860
7892
  delayMs: resolveDelayMs(params)
7861
7893
  };
7862
7894
  }
@@ -7897,7 +7929,7 @@ function buildEnv(params) {
7897
7929
  env.CLAUDE_CONFIG_DIR = path36.join(params.identitiesDir, params.resolvedIdentityName);
7898
7930
  }
7899
7931
  if (params.provider !== void 0) {
7900
- const providerEnv = params.provider.definition.env ?? {};
7932
+ const providerEnv = params.provider.definition.kind !== void 0 && params.provider.definition.kind !== "http" ? {} : params.provider.definition.env ?? {};
7901
7933
  providerCustomHeaders = providerEnv.ANTHROPIC_CUSTOM_HEADERS;
7902
7934
  env.ANTHROPIC_BASE_URL = void 0;
7903
7935
  env.AGENT_SHIM_PROVIDER = params.provider.definition.displayName;
@@ -7925,6 +7957,7 @@ function buildEnv(params) {
7925
7957
  { name: SESSION_HEADER, value: params.sessionId },
7926
7958
  { name: AUTH_HEADER, value: params.frontdoor.sessionToken },
7927
7959
  ...params.provider === void 0 ? [] : [{ name: PROVIDER_HEADER, value: params.provider.name }],
7960
+ ...params.routeByName ? [{ name: ROUTE_BY_NAME_HEADER, value: "1" }] : [],
7928
7961
  ...params.headroom === void 0 ? [] : [
7929
7962
  { name: HEADROOM_FLAG_HEADER, value: "1" },
7930
7963
  { name: PROJECT_ID_HEADER, value: params.headroom.projectId }
@@ -8558,8 +8591,8 @@ function catalogueRows(provider, models) {
8558
8591
  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));
8559
8592
  }
8560
8593
  function providerModelRows(provider, catalogue = []) {
8561
- const derived = provider.kind === "codex" ? codexRows(provider) : provider.kind === "antigravity" ? antigravityRows(provider) : httpRows(provider);
8562
- const declared = (provider.pickerModels ?? []).map(declaredRow);
8594
+ const derived = provider.kind === "codex" ? codexRows(provider) : provider.kind === "antigravity" ? antigravityRows(provider) : provider.kind === "router" ? [] : httpRows(provider);
8595
+ const declared = provider.kind === "router" ? [] : (provider.pickerModels ?? []).map(declaredRow);
8563
8596
  const declaredModels = new Set(declared.map((row) => row.model));
8564
8597
  const named = [...derived.filter((row) => !declaredModels.has(row.model)), ...declared];
8565
8598
  const taken = new Set(named.map((row) => labelOf(row.model)));
@@ -9005,6 +9038,7 @@ function decideLaunch(params, readOnly) {
9005
9038
  ...parsedArgv.trackUsage === void 0 ? {} : { trackUsage: parsedArgv.trackUsage },
9006
9039
  ...parsedArgv.pause === void 0 ? {} : { pause: parsedArgv.pause },
9007
9040
  ...parsedArgv.explain === void 0 ? {} : { explain: parsedArgv.explain },
9041
+ ...parsedArgv.routeByName === void 0 ? {} : { routeByName: parsedArgv.routeByName },
9008
9042
  ...parsedArgv.delay === void 0 ? {} : { delay: parsedArgv.delay }
9009
9043
  }
9010
9044
  });
@@ -9148,7 +9182,8 @@ function prepareLaunch(params) {
9148
9182
  ...frontDoor === void 0 ? {} : { frontdoor: frontDoor },
9149
9183
  ...headroom === void 0 ? {} : { headroom },
9150
9184
  sessionId,
9151
- remoteControl: resolvedFlags.remoteControl
9185
+ remoteControl: resolvedFlags.remoteControl,
9186
+ routeByName: resolvedFlags.routeByName || resolvedProvider !== void 0 && isRouterProvider(resolvedProvider.definition)
9152
9187
  });
9153
9188
  const releases = [...headroom === void 0 || headroomPort === void 0 ? [] : [headroomPort.release], ...frontDoorRelease === void 0 ? [] : [frontDoorRelease]];
9154
9189
  const release = () => {
@@ -9175,11 +9210,12 @@ function resolveLaunch(params) {
9175
9210
  ...frontDoor ? { frontdoor: { port: 0, connectPort: 0, trustBundlePath: "", sessionToken: "" } } : {},
9176
9211
  ...decided.flags.headroom ? { headroom: { socketPath: "", projectId: "" } } : {},
9177
9212
  sessionId: "",
9178
- remoteControl: decided.flags.remoteControl
9213
+ remoteControl: decided.flags.remoteControl,
9214
+ routeByName: decided.flags.routeByName
9179
9215
  });
9180
9216
  const credentialNames = decided.identityCredentialBlock === void 0 ? [] : Object.keys(credentialVariables(decided.identityCredentialBlock.target ?? "bearer", ""));
9181
9217
  const environment = [.../* @__PURE__ */ new Set([...Object.keys(built).filter((name) => built[name] !== env[name]), ...credentialNames])].sort();
9182
- const credential = decided.provider !== void 0 ? { subject: "provider", name: decided.provider.name, summary: summariseCredential(decided.provider.definition.credential) } : decided.identityCredentialBlock !== void 0 && decided.farmIdentity !== void 0 ? { subject: "identity", name: decided.farmIdentity, summary: summariseCredential(decided.identityCredentialBlock) } : void 0;
9218
+ const credential = decided.provider !== void 0 ? isRouterProvider(decided.provider.definition) ? void 0 : { subject: "provider", name: decided.provider.name, summary: summariseCredential(decided.provider.definition.credential) } : decided.identityCredentialBlock !== void 0 && decided.farmIdentity !== void 0 ? { subject: "identity", name: decided.farmIdentity, summary: summariseCredential(decided.identityCredentialBlock) } : void 0;
9183
9219
  return {
9184
9220
  decision: decided.decision,
9185
9221
  flags: decided.flags,
@@ -9187,7 +9223,7 @@ function resolveLaunch(params) {
9187
9223
  bin: decided.bin,
9188
9224
  args: decided.args,
9189
9225
  ...credential === void 0 ? {} : { credential },
9190
- routing: { frontDoor, headroom: decided.flags.headroom },
9226
+ routing: { frontDoor, headroom: decided.flags.headroom, routeByName: decided.flags.routeByName },
9191
9227
  environment
9192
9228
  };
9193
9229
  }
@@ -13694,6 +13730,9 @@ function applyProfileChange(paths, name, change) {
13694
13730
  if (change.launchExplain !== void 0) {
13695
13731
  launchPatch.explain = change.launchExplain;
13696
13732
  }
13733
+ if (change.launchRouteByName !== void 0) {
13734
+ launchPatch.routeByName = change.launchRouteByName;
13735
+ }
13697
13736
  if (Object.keys(launchPatch).length > 0) {
13698
13737
  setProfileLaunchFlags(paths, name, launchPatch);
13699
13738
  touched = true;
@@ -14023,11 +14062,12 @@ function cachedState(cacheEnv, owner, block) {
14023
14062
  function buildCredentialReport(provider, identity, identityName, cacheEnv) {
14024
14063
  const identityCredential = identity?.credential === void 0 ? void 0 : summariseCredential(identity.credential);
14025
14064
  const identityCached = identity?.credential === void 0 || identityName === void 0 ? void 0 : cachedState(cacheEnv, `identity ${identityName}`, identity.credential);
14026
- const providerCached = provider?.definition === void 0 ? void 0 : cachedState(cacheEnv, `provider ${provider.name}`, provider.definition.credential);
14065
+ const providerCredential = provider?.definition !== void 0 && !isRouterProvider(provider.definition) ? provider.definition.credential : void 0;
14066
+ const providerCached = providerCredential === void 0 || provider === void 0 ? void 0 : cachedState(cacheEnv, `provider ${provider.name}`, providerCredential);
14027
14067
  return {
14028
14068
  applies: provider !== void 0 ? "provider" : identityCredential !== void 0 ? "identity" : "stored-login",
14029
14069
  ...provider === void 0 ? {} : {
14030
- provider: provider.problem === void 0 ? { name: provider.name, credential: summariseCredential(provider.definition.credential), ...providerCached === void 0 ? {} : { cached: providerCached } } : { name: provider.name, problem: provider.problem }
14070
+ provider: provider.problem === void 0 ? { name: provider.name, ...providerCredential === void 0 ? {} : { credential: summariseCredential(providerCredential), ...providerCached === void 0 ? {} : { cached: providerCached } } } : { name: provider.name, problem: provider.problem }
14031
14071
  },
14032
14072
  ...identityCredential === void 0 ? {} : { identity: identityCredential },
14033
14073
  ...identityCached === void 0 ? {} : { identityCached }
@@ -14122,7 +14162,7 @@ function formatCheckReport(report) {
14122
14162
  const { credential } = report;
14123
14163
  if (credential.provider !== void 0) {
14124
14164
  lines.push(
14125
- ` Provider ${credential.provider.name}: ${credential.provider.credential === void 0 ? `unusable: ${credential.provider.problem}` : formatCredentialSummary(credential.provider.credential)}${credential.provider.cached === void 0 ? "" : `; ${formatCachedCredentialState(credential.provider.cached)}`}`
14165
+ ` Provider ${credential.provider.name}: ${credential.provider.credential === void 0 ? `unusable: ${credential.provider.problem ?? ""}` : formatCredentialSummary(credential.provider.credential)}${credential.provider.cached === void 0 ? "" : `; ${formatCachedCredentialState(credential.provider.cached)}`}`
14126
14166
  );
14127
14167
  }
14128
14168
  if (credential.identity !== void 0) {
@@ -14408,7 +14448,7 @@ var CachedCredentialStateSchema = z17.union([
14408
14448
  z17.strictObject({ store: z17.enum(CREDENTIAL_CACHE_STORES), status: z17.enum(["fresh", "expired"]), ageMs: z17.number(), expiresInMs: z17.number().optional() })
14409
14449
  ]);
14410
14450
  var CheckCredentialProviderSchema = z17.union([
14411
- z17.strictObject({ name: z17.string(), credential: CredentialSummarySchema, cached: CachedCredentialStateSchema.optional() }),
14451
+ z17.strictObject({ name: z17.string(), credential: CredentialSummarySchema.optional(), cached: CachedCredentialStateSchema.optional() }),
14412
14452
  z17.strictObject({ name: z17.string(), problem: z17.string() })
14413
14453
  ]);
14414
14454
  var CheckCredentialSchema = z17.strictObject({
@@ -15192,9 +15232,11 @@ function pushProvider(push, entry, cacheEnv, signIn) {
15192
15232
  if (validated3.ignored.length > 0) {
15193
15233
  push("provider", "warn", describeIgnoredKeys(entry.path, validated3.ignored), entry.name);
15194
15234
  }
15195
- const cache = cacheClause(cacheEnv, `provider ${entry.name}`, validated3.data.credential);
15196
- push("provider", cache.unreadable ? "fail" : "pass", `${entry.name} is valid (${describeProviderEndpoint(validated3.data)}, credential ${describeCredential(validated3.data.credential)})${cache.text}.`, entry.name);
15197
- if (validated3.data.env?.ENABLE_TOOL_SEARCH === void 0) {
15235
+ const router = isRouterProvider(validated3.data);
15236
+ const noCache = { unreadable: false, text: "" };
15237
+ const cache = router ? noCache : cacheClause(cacheEnv, `provider ${entry.name}`, validated3.data.credential);
15238
+ push("provider", cache.unreadable ? "fail" : "pass", router ? `${entry.name} is valid (${describeProviderEndpoint(validated3.data)})` : `${entry.name} is valid (${describeProviderEndpoint(validated3.data)}, credential ${describeCredential(validated3.data.credential)})${cache.text}.`, entry.name);
15239
+ if (!router && validated3.data.env?.ENABLE_TOOL_SEARCH === void 0) {
15198
15240
  push("provider", "warn", `${entry.name} does not set ENABLE_TOOL_SEARCH: a session on this provider keeps Claude Code's own API as its base URL, so it defers MCP tool loading and sends tool_reference payloads the upstream backend must understand. Set ENABLE_TOOL_SEARCH=false in the provider's env block to load tools upfront instead, when the backend does not support them.`, entry.name);
15199
15241
  }
15200
15242
  if (signIn !== void 0 && isCodexProvider(validated3.data) && validated3.data.codex?.login === "chatgpt-sign-in") {
@@ -15992,7 +16034,7 @@ var ProviderValueSchema = z24.strictObject({
15992
16034
  displayName: z24.string(),
15993
16035
  baseUrl: z24.string().optional(),
15994
16036
  codex: CodexProviderConfigSchema.optional(),
15995
- credential: CredentialSummarySchema2,
16037
+ credential: CredentialSummarySchema2.optional(),
15996
16038
  env: z24.record(z24.string(), z24.string()).optional()
15997
16039
  });
15998
16040
  var ConfigNameInputSchema = z24.strictObject({ name: z24.string().min(1) });
@@ -16030,7 +16072,8 @@ var ConfigProfileSetInputSchema = z24.strictObject({
16030
16072
  claudeVersion: z24.union([z24.string().min(1), z24.literal(false)]).optional(),
16031
16073
  delay: z24.union([z24.string().regex(DURATION_RE), z24.literal(false)]).optional(),
16032
16074
  pause: z24.boolean().optional(),
16033
- explain: z24.boolean().optional()
16075
+ explain: z24.boolean().optional(),
16076
+ routeByName: z24.boolean().optional()
16034
16077
  }).optional()
16035
16078
  });
16036
16079
  var ConfigProfileSetOutputSchema = storedMutationOutput("profile", "updated", ProfileValueSchema);
@@ -16142,9 +16185,8 @@ function providerValue(name, provider) {
16142
16185
  name,
16143
16186
  kind: provider.kind ?? "http",
16144
16187
  displayName: provider.displayName,
16145
- ...isCodexProvider(provider) ? provider.codex === void 0 ? {} : { codex: provider.codex } : isAntigravityProvider(provider) ? provider.antigravity === void 0 ? {} : { antigravity: provider.antigravity } : { baseUrl: provider.baseUrl },
16146
- credential: summariseCredential(provider.credential),
16147
- ...provider.env === void 0 ? {} : { env: provider.env }
16188
+ ...isCodexProvider(provider) ? provider.codex === void 0 ? {} : { codex: provider.codex } : isAntigravityProvider(provider) ? provider.antigravity === void 0 ? {} : { antigravity: provider.antigravity } : isRouterProvider(provider) ? {} : { baseUrl: provider.baseUrl },
16189
+ ...isRouterProvider(provider) ? {} : { credential: summariseCredential(provider.credential), ...provider.env === void 0 ? {} : { env: provider.env } }
16148
16190
  };
16149
16191
  }
16150
16192
  function profileValue(name, paths) {
@@ -16243,7 +16285,8 @@ function createConfigApiRouter(deps) {
16243
16285
  ...launch?.claudeVersion === void 0 ? {} : { launchClaudeVersion: launch.claudeVersion },
16244
16286
  ...launch?.delay === void 0 ? {} : { launchDelay: launch.delay },
16245
16287
  ...launch?.pause === void 0 ? {} : { launchPause: launch.pause },
16246
- ...launch?.explain === void 0 ? {} : { launchExplain: launch.explain }
16288
+ ...launch?.explain === void 0 ? {} : { launchExplain: launch.explain },
16289
+ ...launch?.routeByName === void 0 ? {} : { launchRouteByName: launch.routeByName }
16247
16290
  });
16248
16291
  return { action: "updated", kind: "profile", name: input.name, value: profileValue(input.name, paths) };
16249
16292
  })
@@ -16326,7 +16369,7 @@ function createConfigApiRouter(deps) {
16326
16369
  if (input.baseUrl !== void 0 && isHttpProvider(existing) && input.baseUrl !== existing.baseUrl && credential?.sources === void 0) {
16327
16370
  throw new ORPCError2("BAD_REQUEST", { message: `Changing the base URL of provider "${input.name}" requires a credential block in the same call: the stored credential is not sent to a different endpoint.` });
16328
16371
  }
16329
- const cache = credential?.cache === void 0 ? void 0 : mergeCredentialCache(credential.cache === false ? { enabled: false } : { ...credential.cache, enabled: true }, existing.credential.cache);
16372
+ const cache = credential?.cache === void 0 || isRouterProvider(existing) ? void 0 : mergeCredentialCache(credential.cache === false ? { enabled: false } : { ...credential.cache, enabled: true }, isRouterProvider(existing) ? void 0 : existing.credential.cache);
16330
16373
  const updated = updateProvider(paths, input.name, {
16331
16374
  ...input.displayName === void 0 ? {} : { displayName: input.displayName },
16332
16375
  ...input.baseUrl === void 0 ? {} : { baseUrl: input.baseUrl },
@@ -16554,6 +16597,7 @@ var LaunchFlagsSchema = z26.strictObject({
16554
16597
  trackUsage: z26.boolean(),
16555
16598
  pause: z26.boolean(),
16556
16599
  explain: z26.boolean(),
16600
+ routeByName: z26.boolean(),
16557
16601
  /** How long the launch waits after its own output before it starts claude, in milliseconds. */
16558
16602
  delayMs: z26.number()
16559
16603
  });
@@ -16567,7 +16611,7 @@ var LaunchResolveOutputSchema = z26.strictObject({
16567
16611
  args: z26.readonly(z26.array(z26.string())),
16568
16612
  /** The credential the launch would authenticate with, by target and source kinds. Absent when none applies. */
16569
16613
  credential: z26.strictObject({ subject: z26.enum(["provider", "identity"]), name: z26.string(), summary: CredentialSummarySchema }).optional(),
16570
- routing: z26.strictObject({ frontDoor: z26.boolean(), headroom: z26.boolean() }),
16614
+ routing: z26.strictObject({ frontDoor: z26.boolean(), headroom: z26.boolean(), routeByName: z26.boolean() }),
16571
16615
  /** The names of the environment variables the launch would set or unset, sorted. Values are not reported. */
16572
16616
  environment: z26.readonly(z26.array(z26.string())),
16573
16617
  warnings: z26.readonly(z26.array(z26.string()))