claude-use 11.33.0 → 11.34.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/cli.cjs CHANGED
@@ -26973,6 +26973,9 @@ function isHttpProvider(provider) {
26973
26973
  function isCodexProvider(provider) {
26974
26974
  return provider.kind === "codex";
26975
26975
  }
26976
+ function isRouterProvider(provider) {
26977
+ return provider.kind === "router";
26978
+ }
26976
26979
  function isAntigravityProvider(provider) {
26977
26980
  return provider.kind === "antigravity";
26978
26981
  }
@@ -26987,7 +26990,7 @@ function isTimeZone(name) {
26987
26990
  return false;
26988
26991
  }
26989
26992
  }
26990
- var import_node_path4, 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, FRONTDOOR_DEFAULT_IDLE_SHUTDOWN_MINUTES, FrontDoorGlobalConfigSchema, UPDATE_MODES, UpdateGlobalConfigSchema, GlobalConfigSchema, IdentitySchema, CategoryClassificationSchema, CategoryClassificationOverlaySchema, SHIPPED_CATEGORY_DEFAULTS;
26993
+ var import_node_path4, 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, FRONTDOOR_DEFAULT_IDLE_SHUTDOWN_MINUTES, FrontDoorGlobalConfigSchema, UPDATE_MODES, UpdateGlobalConfigSchema, GlobalConfigSchema, IdentitySchema, CategoryClassificationSchema, CategoryClassificationOverlaySchema, SHIPPED_CATEGORY_DEFAULTS;
26991
26994
  var init_schema = __esm({
26992
26995
  "src/config/schema.ts"() {
26993
26996
  "use strict";
@@ -27032,6 +27035,8 @@ var init_schema = __esm({
27032
27035
  delay: external_exports.string().regex(DURATION_RE, "must be a duration such as 5s or 500ms").optional(),
27033
27036
  /** 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. */
27034
27037
  pause: external_exports.boolean().optional(),
27038
+ /** 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. */
27039
+ routeByName: external_exports.boolean().optional(),
27035
27040
  /** 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. */
27036
27041
  explain: external_exports.boolean().optional()
27037
27042
  });
@@ -27092,7 +27097,7 @@ var init_schema = __esm({
27092
27097
  ProviderEnvSchema = external_exports.record(external_exports.string().min(1), external_exports.string()).refine((env) => !Object.keys(env).some((key) => RESERVED_PROVIDER_ENV_KEYS.includes(key)), {
27093
27098
  message: `env may not set ${RESERVED_PROVIDER_ENV_KEYS.join(", ")}: the credential block's target sets one and agent-shim removes the others`
27094
27099
  });
27095
- PROVIDER_KINDS = ["http", "codex", "antigravity"];
27100
+ PROVIDER_KINDS = ["http", "codex", "antigravity", "router"];
27096
27101
  ANTIGRAVITY_MODES = ["cloud", "local"];
27097
27102
  CLAUDE_TIERS = ["fable", "opus", "sonnet", "haiku"];
27098
27103
  ANTIGRAVITY_EFFORTS = ["none", "low", "medium", "high", "xhigh", "max"];
@@ -27205,6 +27210,11 @@ var init_schema = __esm({
27205
27210
  pickerModels: PickerModelsSchema.optional(),
27206
27211
  codex: CodexProviderConfigSchema.optional()
27207
27212
  });
27213
+ RouterProviderSchema = external_exports.strictObject({
27214
+ $schema: external_exports.string().optional(),
27215
+ kind: external_exports.literal("router"),
27216
+ displayName: external_exports.string().min(1)
27217
+ });
27208
27218
  AntigravityProviderSchema = external_exports.strictObject({
27209
27219
  $schema: external_exports.string().optional(),
27210
27220
  kind: external_exports.literal("antigravity"),
@@ -27215,7 +27225,7 @@ var init_schema = __esm({
27215
27225
  pickerModels: PickerModelsSchema.optional(),
27216
27226
  antigravity: AntigravityProviderConfigSchema.optional()
27217
27227
  });
27218
- ProviderSchema = external_exports.discriminatedUnion("kind", [HttpProviderSchema, CodexProviderSchema, AntigravityProviderSchema]);
27228
+ ProviderSchema = external_exports.discriminatedUnion("kind", [HttpProviderSchema, CodexProviderSchema, AntigravityProviderSchema, RouterProviderSchema]);
27219
27229
  SELECTION_MODES = ["ordered", "most-allowance", "soonest-reset", "spread", "adaptive", "lowest-latency", "highest-success", "cheapest"];
27220
27230
  VirtualModelSchema = external_exports.strictObject({
27221
27231
  /** How the virtual model chooses its member for a request. */
@@ -34432,7 +34442,7 @@ var init_package = __esm({
34432
34442
  "package.json"() {
34433
34443
  package_default = {
34434
34444
  name: "claude-use",
34435
- version: "11.33.0",
34445
+ version: "11.34.0",
34436
34446
  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.",
34437
34447
  license: "MIT",
34438
34448
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -36112,7 +36122,7 @@ function describeProviderEndpoint(provider) {
36112
36122
  if (isAntigravityProvider(provider)) {
36113
36123
  return (provider.antigravity?.mode ?? ANTIGRAVITY_DEFAULT_MODE) === "local" ? "antigravity local (ACP daemon)" : "antigravity cloud (Gemini API)";
36114
36124
  }
36115
- return provider.baseUrl;
36125
+ return isRouterProvider(provider) ? "the models block" : provider.baseUrl;
36116
36126
  }
36117
36127
  function isEmptyCodexConfig(config2) {
36118
36128
  return config2 === void 0 || config2.defaultModel === void 0 && config2.effort === void 0 && config2.login === void 0 && (config2.models === void 0 || Object.keys(config2.models).length === 0);
@@ -36134,10 +36144,16 @@ function addProvider(paths, name, input2) {
36134
36144
  if (kind === "antigravity" && input2.baseUrl !== void 0) {
36135
36145
  throw new ProviderKindMismatchError("An antigravity provider has no base URL: the launcher points its sessions at the front-door daemon. Drop --base-url.");
36136
36146
  }
36147
+ if (kind === "router" && input2.baseUrl !== void 0) {
36148
+ throw new ProviderKindMismatchError("A router provider has no base URL: it resolves each request's model name through the models block. Drop --base-url.");
36149
+ }
36137
36150
  if (kind === "http" && input2.baseUrl === void 0) {
36138
36151
  throw new ProviderKindMismatchError("An http provider needs --base-url.");
36139
36152
  }
36140
- if (kind !== "http" && input2.catalogue !== void 0) {
36153
+ if (kind === "router" && (input2.sources.length > 0 || input2.target !== void 0 || input2.env !== void 0 || input2.pickerModels !== void 0)) {
36154
+ throw new ProviderKindMismatchError("A router provider has no credential, env or picker models of its own: the models block's targets carry their own.");
36155
+ }
36156
+ if (kind !== "http" && kind !== "router" && input2.catalogue !== void 0) {
36141
36157
  throw new ProviderKindMismatchError("A model catalogue applies only to an http provider.");
36142
36158
  }
36143
36159
  if (kind !== "codex" && !isEmptyCodexConfig(input2.codex)) {
@@ -36153,7 +36169,7 @@ function addProvider(paths, name, input2) {
36153
36169
  ...input2.pickerModels === void 0 || input2.pickerModels.length === 0 ? {} : { pickerModels: input2.pickerModels }
36154
36170
  };
36155
36171
  const parsed = ProviderSchema.safeParse(
36156
- kind === "codex" ? { kind, ...shared, ...isEmptyCodexConfig(input2.codex) ? {} : { codex: input2.codex } } : kind === "antigravity" ? { kind, ...shared, ...isEmptyAntigravityConfig(input2.antigravity) ? {} : { antigravity: input2.antigravity } } : { ...shared, baseUrl: input2.baseUrl, ...input2.catalogue === void 0 ? {} : { catalogue: input2.catalogue } }
36172
+ kind === "router" ? { kind, displayName: input2.displayName } : kind === "codex" ? { kind, ...shared, ...isEmptyCodexConfig(input2.codex) ? {} : { codex: input2.codex } } : kind === "antigravity" ? { kind, ...shared, ...isEmptyAntigravityConfig(input2.antigravity) ? {} : { antigravity: input2.antigravity } } : { ...shared, baseUrl: input2.baseUrl, ...input2.catalogue === void 0 ? {} : { catalogue: input2.catalogue } }
36157
36173
  );
36158
36174
  if (!parsed.success) {
36159
36175
  throw new ConfigValidationError(providerJsonPath(paths, name), parsed.error.issues);
@@ -36167,15 +36183,18 @@ function updateProvider(paths, name, input2) {
36167
36183
  throw new ProviderNotFoundError(name);
36168
36184
  }
36169
36185
  const unset = new Set(input2.unsetEnv);
36170
- const env = Object.fromEntries(Object.entries({ ...existing.env, ...input2.env }).filter(([key]) => !unset.has(key)));
36186
+ const existingEnv = isRouterProvider(existing) ? {} : existing.env;
36187
+ const env = Object.fromEntries(Object.entries({ ...existingEnv, ...input2.env }).filter(([key]) => !unset.has(key)));
36171
36188
  const unsetPicker = new Set(input2.unsetPickerModels);
36172
36189
  const added = new Map((input2.pickerModels ?? []).map((entry) => [entry.model, entry]));
36190
+ const existingPicker = isRouterProvider(existing) ? [] : existing.pickerModels;
36173
36191
  const pickerModels = [
36174
- ...(existing.pickerModels ?? []).filter((entry) => !unsetPicker.has(entry.model)).map((entry) => added.get(entry.model) ?? entry),
36175
- ...[...added.values()].filter((entry) => !(existing.pickerModels ?? []).some((kept) => kept.model === entry.model))
36192
+ ...(existingPicker ?? []).filter((entry) => !unsetPicker.has(entry.model)).map((entry) => added.get(entry.model) ?? entry),
36193
+ ...[...added.values()].filter((entry) => !(existingPicker ?? []).some((kept) => kept.model === entry.model))
36176
36194
  ];
36177
- const target = input2.target ?? existing.credential.target;
36178
- const cache = input2.cache === void 0 ? existing.credential.cache : input2.cache === false ? void 0 : input2.cache;
36195
+ const router = isRouterProvider(existing);
36196
+ const target = router ? void 0 : input2.target ?? existing.credential.target;
36197
+ const cache = router ? void 0 : input2.cache === void 0 ? existing.credential.cache : input2.cache === false ? void 0 : input2.cache;
36179
36198
  if (isCodexProvider(existing) && input2.baseUrl !== void 0) {
36180
36199
  throw new ProviderKindMismatchError(`Provider "${name}" is a codex provider, which has no base URL.`);
36181
36200
  }
@@ -36193,10 +36212,12 @@ function updateProvider(paths, name, input2) {
36193
36212
  }
36194
36213
  const shared = {
36195
36214
  ...input2.displayName === void 0 ? {} : { displayName: input2.displayName },
36196
- credential: {
36197
- sources: input2.sources ?? existing.credential.sources,
36198
- ...target === void 0 ? {} : { target },
36199
- ...cache === void 0 ? {} : { cache }
36215
+ ...router ? {} : {
36216
+ credential: {
36217
+ sources: input2.sources ?? existing.credential.sources,
36218
+ ...target === void 0 ? {} : { target },
36219
+ ...cache === void 0 ? {} : { cache }
36220
+ }
36200
36221
  },
36201
36222
  env: Object.keys(env).length === 0 ? void 0 : env,
36202
36223
  pickerModels: pickerModels.length === 0 ? void 0 : pickerModels
@@ -36216,6 +36237,8 @@ function updateProvider(paths, name, input2) {
36216
36237
  ...existing.antigravity?.models === void 0 && input2.antigravity?.models === void 0 ? {} : { models: { ...existing.antigravity?.models, ...input2.antigravity?.models } }
36217
36238
  };
36218
36239
  candidate = { ...existing, ...shared, antigravity: isEmptyAntigravityConfig(antigravity) ? void 0 : antigravity };
36240
+ } else if (router) {
36241
+ candidate = { kind: "router", ...shared };
36219
36242
  } else {
36220
36243
  const catalogue = input2.catalogue === void 0 ? existing.catalogue : input2.catalogue === false ? void 0 : input2.catalogue;
36221
36244
  candidate = { ...existing, ...shared, catalogue, ...input2.baseUrl === void 0 ? {} : { baseUrl: input2.baseUrl } };
@@ -36265,6 +36288,9 @@ function resolveProvider(params) {
36265
36288
  return selection;
36266
36289
  }
36267
36290
  const { name, definition } = selection.provider;
36291
+ if (isRouterProvider(definition)) {
36292
+ return { ok: true, provider: { name, definition, credential: { target: "bearer", token: "", source: { env: "AGENT_SHIM_ROUTER" }, warnings: [] } }, warnings: [] };
36293
+ }
36268
36294
  if (params.credentials === void 0) {
36269
36295
  return { ok: false, status: 1, message: `agent-shim: provider ${name} needs its credential resolved, but this launcher has no credential port wired` };
36270
36296
  }
@@ -63470,7 +63496,7 @@ function buildEnv(params) {
63470
63496
  env.CLAUDE_CONFIG_DIR = import_node_path40.default.join(params.identitiesDir, params.resolvedIdentityName);
63471
63497
  }
63472
63498
  if (params.provider !== void 0) {
63473
- const providerEnv = params.provider.definition.env ?? {};
63499
+ const providerEnv = params.provider.definition.kind !== void 0 && params.provider.definition.kind !== "http" ? {} : params.provider.definition.env ?? {};
63474
63500
  providerCustomHeaders = providerEnv.ANTHROPIC_CUSTOM_HEADERS;
63475
63501
  env.ANTHROPIC_BASE_URL = void 0;
63476
63502
  env.AGENT_SHIM_PROVIDER = params.provider.definition.displayName;
@@ -65174,8 +65200,8 @@ function catalogueRows(provider, models) {
65174
65200
  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));
65175
65201
  }
65176
65202
  function providerModelRows(provider, catalogue = []) {
65177
- const derived2 = provider.kind === "codex" ? codexRows(provider) : provider.kind === "antigravity" ? antigravityRows(provider) : httpRows(provider);
65178
- const declared = (provider.pickerModels ?? []).map(declaredRow);
65203
+ const derived2 = provider.kind === "codex" ? codexRows(provider) : provider.kind === "antigravity" ? antigravityRows(provider) : provider.kind === "router" ? [] : httpRows(provider);
65204
+ const declared = provider.kind === "router" ? [] : (provider.pickerModels ?? []).map(declaredRow);
65179
65205
  const declaredModels = new Set(declared.map((row) => row.model));
65180
65206
  const named = [...derived2.filter((row) => !declaredModels.has(row.model)), ...declared];
65181
65207
  const taken = new Set(named.map((row) => labelOf(row.model)));
@@ -65793,7 +65819,7 @@ function resolveLaunch(params) {
65793
65819
  });
65794
65820
  const credentialNames = decided.identityCredentialBlock === void 0 ? [] : Object.keys(credentialVariables(decided.identityCredentialBlock.target ?? "bearer", ""));
65795
65821
  const environment = [.../* @__PURE__ */ new Set([...Object.keys(built).filter((name) => built[name] !== env[name]), ...credentialNames])].sort();
65796
- 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;
65822
+ 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;
65797
65823
  return {
65798
65824
  decision: decided.decision,
65799
65825
  flags: decided.flags,
@@ -66365,7 +66391,7 @@ function createProviderLookup(ports) {
66365
66391
  return {
66366
66392
  baseUrl,
66367
66393
  apiKey: () => {
66368
- const resolution = resolveCredential({ credential: definition.credential, env: ports.env, port: ports.credentials, subject: `provider ${name}` });
66394
+ const resolution = resolveCredential({ credential: isRouterProvider(definition) ? { sources: [] } : definition.credential, env: ports.env, port: ports.credentials, subject: `provider ${name}` });
66369
66395
  if (!resolution.ok) {
66370
66396
  throw new Error(resolution.message);
66371
66397
  }
@@ -113732,11 +113758,12 @@ function cachedState(cacheEnv, owner, block2) {
113732
113758
  function buildCredentialReport(provider, identity, identityName, cacheEnv) {
113733
113759
  const identityCredential = identity?.credential === void 0 ? void 0 : summariseCredential(identity.credential);
113734
113760
  const identityCached = identity?.credential === void 0 || identityName === void 0 ? void 0 : cachedState(cacheEnv, `identity ${identityName}`, identity.credential);
113735
- const providerCached = provider?.definition === void 0 ? void 0 : cachedState(cacheEnv, `provider ${provider.name}`, provider.definition.credential);
113761
+ const providerCredential = provider?.definition !== void 0 && !isRouterProvider(provider.definition) ? provider.definition.credential : void 0;
113762
+ const providerCached = providerCredential === void 0 || provider === void 0 ? void 0 : cachedState(cacheEnv, `provider ${provider.name}`, providerCredential);
113736
113763
  return {
113737
113764
  applies: provider !== void 0 ? "provider" : identityCredential !== void 0 ? "identity" : "stored-login",
113738
113765
  ...provider === void 0 ? {} : {
113739
- provider: provider.problem === void 0 ? { name: provider.name, credential: summariseCredential(provider.definition.credential), ...providerCached === void 0 ? {} : { cached: providerCached } } : { name: provider.name, problem: provider.problem }
113766
+ 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 }
113740
113767
  },
113741
113768
  ...identityCredential === void 0 ? {} : { identity: identityCredential },
113742
113769
  ...identityCached === void 0 ? {} : { identityCached }
@@ -113831,7 +113858,7 @@ function formatCheckReport(report) {
113831
113858
  const { credential } = report;
113832
113859
  if (credential.provider !== void 0) {
113833
113860
  lines.push(
113834
- ` 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)}`}`
113861
+ ` 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)}`}`
113835
113862
  );
113836
113863
  }
113837
113864
  if (credential.identity !== void 0) {
@@ -119586,9 +119613,11 @@ function pushProvider(push, entry, cacheEnv, signIn) {
119586
119613
  if (validated2.ignored.length > 0) {
119587
119614
  push("provider", "warn", describeIgnoredKeys(entry.path, validated2.ignored), entry.name);
119588
119615
  }
119589
- const cache = cacheClause(cacheEnv, `provider ${entry.name}`, validated2.data.credential);
119590
- push("provider", cache.unreadable ? "fail" : "pass", `${entry.name} is valid (${describeProviderEndpoint(validated2.data)}, credential ${describeCredential(validated2.data.credential)})${cache.text}.`, entry.name);
119591
- if (validated2.data.env?.ENABLE_TOOL_SEARCH === void 0) {
119616
+ const router = isRouterProvider(validated2.data);
119617
+ const noCache = { unreadable: false, text: "" };
119618
+ const cache = router ? noCache : cacheClause(cacheEnv, `provider ${entry.name}`, validated2.data.credential);
119619
+ push("provider", cache.unreadable ? "fail" : "pass", router ? `${entry.name} is valid (${describeProviderEndpoint(validated2.data)})` : `${entry.name} is valid (${describeProviderEndpoint(validated2.data)}, credential ${describeCredential(validated2.data.credential)})${cache.text}.`, entry.name);
119620
+ if (!router && validated2.data.env?.ENABLE_TOOL_SEARCH === void 0) {
119592
119621
  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);
119593
119622
  }
119594
119623
  if (signIn !== void 0 && isCodexProvider(validated2.data) && validated2.data.codex?.login === "chatgpt-sign-in") {
@@ -125491,7 +125520,7 @@ var CachedCredentialStateSchema = external_exports.union([
125491
125520
  external_exports.strictObject({ store: external_exports.enum(CREDENTIAL_CACHE_STORES), status: external_exports.enum(["fresh", "expired"]), ageMs: external_exports.number(), expiresInMs: external_exports.number().optional() })
125492
125521
  ]);
125493
125522
  var CheckCredentialProviderSchema = external_exports.union([
125494
- external_exports.strictObject({ name: external_exports.string(), credential: CredentialSummarySchema, cached: CachedCredentialStateSchema.optional() }),
125523
+ external_exports.strictObject({ name: external_exports.string(), credential: CredentialSummarySchema.optional(), cached: CachedCredentialStateSchema.optional() }),
125495
125524
  external_exports.strictObject({ name: external_exports.string(), problem: external_exports.string() })
125496
125525
  ]);
125497
125526
  var CheckCredentialSchema = external_exports.strictObject({
@@ -128140,7 +128169,7 @@ var ProviderValueSchema = external_exports.strictObject({
128140
128169
  displayName: external_exports.string(),
128141
128170
  baseUrl: external_exports.string().optional(),
128142
128171
  codex: CodexProviderConfigSchema.optional(),
128143
- credential: CredentialSummarySchema2,
128172
+ credential: CredentialSummarySchema2.optional(),
128144
128173
  env: external_exports.record(external_exports.string(), external_exports.string()).optional()
128145
128174
  });
128146
128175
  var ConfigNameInputSchema = external_exports.strictObject({ name: external_exports.string().min(1) });
@@ -128290,9 +128319,8 @@ function providerValue(name, provider) {
128290
128319
  name,
128291
128320
  kind: provider.kind ?? "http",
128292
128321
  displayName: provider.displayName,
128293
- ...isCodexProvider(provider) ? provider.codex === void 0 ? {} : { codex: provider.codex } : isAntigravityProvider(provider) ? provider.antigravity === void 0 ? {} : { antigravity: provider.antigravity } : { baseUrl: provider.baseUrl },
128294
- credential: summariseCredential(provider.credential),
128295
- ...provider.env === void 0 ? {} : { env: provider.env }
128322
+ ...isCodexProvider(provider) ? provider.codex === void 0 ? {} : { codex: provider.codex } : isAntigravityProvider(provider) ? provider.antigravity === void 0 ? {} : { antigravity: provider.antigravity } : isRouterProvider(provider) ? {} : { baseUrl: provider.baseUrl },
128323
+ ...isRouterProvider(provider) ? {} : { credential: summariseCredential(provider.credential), ...provider.env === void 0 ? {} : { env: provider.env } }
128296
128324
  };
128297
128325
  }
128298
128326
  function profileValue(name, paths) {
@@ -128474,7 +128502,7 @@ function createConfigApiRouter(deps) {
128474
128502
  if (input2.baseUrl !== void 0 && isHttpProvider(existing) && input2.baseUrl !== existing.baseUrl && credential?.sources === void 0) {
128475
128503
  throw new ORPCError("BAD_REQUEST", { message: `Changing the base URL of provider "${input2.name}" requires a credential block in the same call: the stored credential is not sent to a different endpoint.` });
128476
128504
  }
128477
- const cache = credential?.cache === void 0 ? void 0 : mergeCredentialCache(credential.cache === false ? { enabled: false } : { ...credential.cache, enabled: true }, existing.credential.cache);
128505
+ 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);
128478
128506
  const updated = updateProvider(paths, input2.name, {
128479
128507
  ...input2.displayName === void 0 ? {} : { displayName: input2.displayName },
128480
128508
  ...input2.baseUrl === void 0 ? {} : { baseUrl: input2.baseUrl },
@@ -131080,6 +131108,20 @@ function scopeSessionProviderPath(request7) {
131080
131108
  }
131081
131109
  return { ...request7, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(request7.session.provider)}${request7.url}` };
131082
131110
  }
131111
+ function resolveModelTarget(model, models) {
131112
+ if (models === void 0) {
131113
+ return model.includes("/") && !model.startsWith("acct:") ? model.split("/")[0] : void 0;
131114
+ }
131115
+ if (model.includes("/") && !model.startsWith("acct:")) {
131116
+ return model.split("/")[0];
131117
+ }
131118
+ const virtual = models.virtual?.[model];
131119
+ const first = virtual?.members.find((member) => !member.startsWith("acct:") && !member.startsWith("family:"));
131120
+ if (first === void 0) {
131121
+ return void 0;
131122
+ }
131123
+ return first.includes("/") ? first.split("/")[0] : resolveModelTarget(first, models);
131124
+ }
131083
131125
  function createProviderRouteResolver(deps) {
131084
131126
  const oauthRoute = createPassthroughRoute("anthropic", { baseUrl: `https://${CONNECT_INTERCEPT_HOST}:${String(HTTPS_PORT)}`, stripPrefix: void 0, headroomUpstream: void 0 });
131085
131127
  const antigravityQuotaSources = /* @__PURE__ */ new Map();
@@ -131192,6 +131234,9 @@ function createProviderRouteResolver(deps) {
131192
131234
  )
131193
131235
  };
131194
131236
  }
131237
+ if (isRouterProvider(definition)) {
131238
+ return { ok: true, route: passthroughFor(`router:${provider}`, { baseUrl: `http://127.0.0.1:${String(deps.directPort())}`, stripPrefix: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(provider)}`, headroomUpstream: directOrigin2(deps.directPort()) }) };
131239
+ }
131195
131240
  const httpProvider = definition;
131196
131241
  return {
131197
131242
  ok: true,
@@ -131231,11 +131276,28 @@ function createProviderRouteResolver(deps) {
131231
131276
  visited.add(providerName);
131232
131277
  }
131233
131278
  let routes;
131279
+ let isRouter;
131234
131280
  try {
131235
131281
  const definition = providerName === void 0 ? void 0 : loadProvider(deps.providersDir, providerName, deps.fs);
131236
131282
  routes = definition === void 0 || !isHttpProvider(definition) ? void 0 : definition.routes;
131283
+ isRouter = definition !== void 0 && isRouterProvider(definition);
131237
131284
  } catch {
131238
131285
  routes = void 0;
131286
+ isRouter = false;
131287
+ }
131288
+ if (isRouter) {
131289
+ const scan2 = await scanRequestHead(current, false);
131290
+ if (scan2.replayed !== void 0) {
131291
+ replay = scan2.replayed;
131292
+ }
131293
+ const target = scan2.model === void 0 ? void 0 : resolveModelTarget(scan2.model, deps.models?.());
131294
+ if (target !== void 0) {
131295
+ const rest2 = path65.slice(`${PROVIDER_PATH_PREFIX}${encodeURIComponent(providerName ?? "")}`.length);
131296
+ const query2 = current.url.includes("?") ? current.url.slice(current.url.indexOf("?")) : "";
131297
+ const carried = scan2.replayed ?? current;
131298
+ current = { ...current, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(target)}${rest2}${query2}`, body: carried.body, headers: carried.headers };
131299
+ continue;
131300
+ }
131239
131301
  }
131240
131302
  if (routes === void 0 || routes.length === 0) {
131241
131303
  const resolution = resolve2(current);
@@ -134453,6 +134515,8 @@ function realFrontDoorSupervisorPorts(paths) {
134453
134515
  const rcControlToken = (0, import_node_crypto25.randomUUID)();
134454
134516
  const resolveRoute = rcObservingResolver(
134455
134517
  createProviderRouteResolver({
134518
+ // Read live so a models-block edit reaches the next request without a door restart.
134519
+ models: () => readModels(paths),
134456
134520
  fs: realFsPort,
134457
134521
  providersDir: paths.providersDir,
134458
134522
  codexPorts,
@@ -145715,6 +145779,7 @@ function registerCompletionCommand(program2) {
145715
145779
  var import_node_child_process8 = require("node:child_process");
145716
145780
  init_commandDeps();
145717
145781
  init_cliError();
145782
+ init_schema();
145718
145783
  init_credential();
145719
145784
  init_credentialCache();
145720
145785
 
@@ -145783,6 +145848,9 @@ function credentialSubject(deps, name, asProvider) {
145783
145848
  if (provider === void 0) {
145784
145849
  throw new ProviderNotFoundError(name);
145785
145850
  }
145851
+ if (isRouterProvider(provider)) {
145852
+ throw new UsageError(`Provider "${name}" is a router: it has no credential of its own.`);
145853
+ }
145786
145854
  return { name, subject: `provider ${name}`, credential: provider.credential };
145787
145855
  }
145788
145856
  const identity = readIdentity(deps.paths, name);
@@ -146821,11 +146889,11 @@ function toProviderView(name, provider) {
146821
146889
  name,
146822
146890
  kind: provider.kind ?? "http",
146823
146891
  displayName: provider.displayName,
146824
- ...isCodexProvider(provider) ? provider.codex === void 0 ? {} : { codex: provider.codex } : isAntigravityProvider(provider) ? provider.antigravity === void 0 ? {} : { antigravity: provider.antigravity } : { baseUrl: provider.baseUrl },
146825
- credential: summariseCredential(provider.credential),
146826
- ...provider.env === void 0 ? {} : { env: provider.env },
146827
- ...provider.pickerModels === void 0 ? {} : { pickerModels: provider.pickerModels },
146828
- ...isCodexProvider(provider) || isAntigravityProvider(provider) || provider.catalogue === void 0 ? {} : { catalogue: provider.catalogue }
146892
+ ...isCodexProvider(provider) ? provider.codex === void 0 ? {} : { codex: provider.codex } : isAntigravityProvider(provider) ? provider.antigravity === void 0 ? {} : { antigravity: provider.antigravity } : isRouterProvider(provider) ? {} : { baseUrl: provider.baseUrl },
146893
+ ...isRouterProvider(provider) ? {} : { credential: summariseCredential(provider.credential) },
146894
+ ...!isRouterProvider(provider) && provider.env !== void 0 ? { env: provider.env } : {},
146895
+ ...!isRouterProvider(provider) && provider.pickerModels !== void 0 ? { pickerModels: provider.pickerModels } : {},
146896
+ ...isCodexProvider(provider) || isAntigravityProvider(provider) || isRouterProvider(provider) || provider.catalogue === void 0 ? {} : { catalogue: provider.catalogue }
146829
146897
  };
146830
146898
  }
146831
146899
  function antigravityConfigFromOptions(options) {
@@ -146933,7 +147001,7 @@ function registerProviderCommand(program2, deps) {
146933
147001
  ...antigravity === void 0 ? {} : { antigravity }
146934
147002
  });
146935
147003
  reportMutation(options.json, { action: "created", kind: "provider", name, value: created }, () => {
146936
- console.log(`Created provider "${name}" (${describeProviderEndpoint(created)}, credential ${describeCredential(created.credential)}).`);
147004
+ console.log(`Created provider "${name}" (${describeProviderEndpoint(created)}${isRouterProvider(created) ? "" : `, credential ${describeCredential(created.credential)}`}).`);
146937
147005
  });
146938
147006
  }),
146939
147007
  [
@@ -146967,12 +147035,13 @@ function registerProviderCommand(program2, deps) {
146967
147035
  }
146968
147036
  const codex = codexConfigFromOptions(options);
146969
147037
  const antigravity = antigravityConfigFromOptions(options);
146970
- const cache = cacheChange(options, readProvider(paths, name)?.credential.cache);
147038
+ const existingForCache = readProvider(paths, name);
147039
+ const cache = cacheChange(options, existingForCache !== void 0 && !isRouterProvider(existingForCache) ? existingForCache.credential.cache : void 0);
146971
147040
  if (options.unsetCatalogue === true && hasCatalogueOptions(options)) {
146972
147041
  throw new UsageError("--unset-catalogue cannot be combined with another --catalogue option.");
146973
147042
  }
146974
147043
  const existingProvider = readProvider(paths, name);
146975
- const catalogue = options.unsetCatalogue === true ? false : catalogueFromOptions(options, existingProvider !== void 0 && !isCodexProvider(existingProvider) && !isAntigravityProvider(existingProvider) ? existingProvider.catalogue : void 0);
147044
+ const catalogue = options.unsetCatalogue === true ? false : catalogueFromOptions(options, existingProvider !== void 0 && !isCodexProvider(existingProvider) && !isAntigravityProvider(existingProvider) && !isRouterProvider(existingProvider) ? existingProvider.catalogue : void 0);
146976
147045
  const updated = updateProvider(paths, name, {
146977
147046
  ...codex === void 0 ? {} : { codex },
146978
147047
  ...antigravity === void 0 ? {} : { antigravity },
@@ -146988,7 +147057,7 @@ function registerProviderCommand(program2, deps) {
146988
147057
  ...catalogue === void 0 ? {} : { catalogue }
146989
147058
  });
146990
147059
  reportMutation(json2, { action: "updated", kind: "provider", name, value: updated }, () => {
146991
- console.log(`Updated provider "${name}" (${describeProviderEndpoint(updated)}, credential ${describeCredential(updated.credential)}).`);
147060
+ console.log(`Updated provider "${name}" (${describeProviderEndpoint(updated)}${isRouterProvider(updated) ? "" : `, credential ${describeCredential(updated.credential)}`}).`);
146992
147061
  });
146993
147062
  }),
146994
147063
  [
@@ -147046,16 +147115,18 @@ function registerProviderCommand(program2, deps) {
147046
147115
  console.log(`Antigravity effort: ${config2.effort}`);
147047
147116
  console.log(`Antigravity degrade down tiers: ${config2.degradeDownTiers ? "on" : "off"}`);
147048
147117
  console.log(`Endpoint: ${describeProviderEndpoint(found)}`);
147049
- } else {
147118
+ } else if (!isRouterProvider(found)) {
147050
147119
  console.log(`Base URL: ${found.baseUrl}`);
147051
147120
  }
147052
- console.log(`Credential: ${describeCredential(found.credential)}`);
147053
- const env = Object.entries(found.env ?? {});
147121
+ if (!isRouterProvider(found)) {
147122
+ console.log(`Credential: ${describeCredential(found.credential)}`);
147123
+ }
147124
+ const env = Object.entries(isRouterProvider(found) ? {} : found.env ?? {});
147054
147125
  console.log(`Environment: ${env.length === 0 ? "(none)" : env.map(([key, value2]) => `${key}=${value2}`).join(", ")}`);
147055
- if (found.pickerModels !== void 0) {
147126
+ if (!isRouterProvider(found) && found.pickerModels !== void 0) {
147056
147127
  console.log(`Picker models: ${found.pickerModels.map((entry) => `${entry.model} (${entry.tier})`).join(", ")}`);
147057
147128
  }
147058
- if (!isCodexProvider(found) && !isAntigravityProvider(found) && found.catalogue !== void 0) {
147129
+ if (!isCodexProvider(found) && !isAntigravityProvider(found) && !isRouterProvider(found) && found.catalogue !== void 0) {
147059
147130
  const { tier, include, exclude, url: url2 } = found.catalogue;
147060
147131
  console.log(`Catalogue: tier ${tier}${include === void 0 ? "" : `, include ${include.join(" ")}`}${exclude === void 0 ? "" : `, exclude ${exclude.join(" ")}`}${url2 === void 0 ? "" : `, url ${url2}`} (see \`provider models ${name}\`)`);
147061
147132
  }
@@ -147068,7 +147139,7 @@ function registerProviderCommand(program2, deps) {
147068
147139
  if (found === void 0) {
147069
147140
  throw new ProviderNotFoundError(name);
147070
147141
  }
147071
- if (isCodexProvider(found) || isAntigravityProvider(found) || found.catalogue === void 0) {
147142
+ if (isCodexProvider(found) || isAntigravityProvider(found) || isRouterProvider(found) || found.catalogue === void 0) {
147072
147143
  throw new UsageError(`Provider "${name}" has no catalogue setting. Set one with \`agent-shim provider set ${name} --catalogue-tier <tier>\`.`);
147073
147144
  }
147074
147145
  const catalogueSetting = found.catalogue;