claude-use 11.23.0 → 11.25.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
@@ -223,7 +223,7 @@ function isTimeZone(name) {
223
223
  return false;
224
224
  }
225
225
  }
226
- 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, ANTIGRAVITY_EFFORTS, ANTIGRAVITY_DEFAULT_MODE, ANTIGRAVITY_DEFAULT_TIER_MODELS, AntigravityModelTargetSchema, AntigravityProviderConfigSchema, CODEX_EFFORTS, CODEX_LOGINS, CODEX_DEFAULT_TIER_MODELS, CodexProviderConfigSchema, ProviderRouteSchema, 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;
226
+ 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, 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;
227
227
  var init_schema = __esm({
228
228
  "src/config/schema.ts"() {
229
229
  "use strict";
@@ -321,21 +321,24 @@ var init_schema = __esm({
321
321
  });
322
322
  PROVIDER_KINDS = ["http", "codex", "antigravity"];
323
323
  ANTIGRAVITY_MODES = ["cloud", "local"];
324
+ CLAUDE_TIERS = ["fable", "opus", "sonnet", "haiku"];
324
325
  ANTIGRAVITY_EFFORTS = ["none", "low", "medium", "high", "xhigh", "max"];
325
326
  ANTIGRAVITY_DEFAULT_MODE = "cloud";
327
+ ANTIGRAVITY_DEFAULT_MODEL = "gemini-3.8-flash-high";
326
328
  ANTIGRAVITY_DEFAULT_TIER_MODELS = Object.freeze({
327
329
  fable: ["gemini-4-argon-high", "claude-opus-5-5-high", "gemini-3.8-flash-high"],
328
330
  opus: ["claude-opus-5-5-high", "gemini-4-argon-high", "gemini-3.8-flash-high"],
329
331
  sonnet: ["claude-sonnet-5-5-medium", "gemini-4-argon-medium", "gemini-3.8-flash-medium"],
330
332
  haiku: ["gemini-3.8-flash-low", "gemini-4-argon-low", "claude-sonnet-5-5-low"]
331
333
  });
334
+ ANTIGRAVITY_DEFAULT_EFFORT = "low";
332
335
  AntigravityModelTargetSchema = z.union([z.string().min(1), z.array(z.string().min(1)).min(1)]);
333
336
  AntigravityProviderConfigSchema = z.strictObject({
334
337
  /** Operational mode: direct cloud endpoint or local ACP daemon. Defaults to `cloud`. */
335
338
  mode: z.enum(ANTIGRAVITY_MODES).optional(),
336
339
  /** The model a request maps to when no tier matches its model name. */
337
340
  defaultModel: z.string().min(1).optional(),
338
- /** Model name mapping. A key naming a tier (`fable`, `opus`, `sonnet`, `haiku`) overrides that tier's shipped model and is matched by substring of the requested name in `ANTIGRAVITY_TIERS` order; any other key is an alias, matched against the whole requested name case-insensitively, so `/model <alias>` selects its backend model. An alias outranks every other rule, including the pass-through of backend names. A value is one model or an ordered list of candidates: the request goes to the first whose quota windows are not spent, and when every candidate is spent, to the one whose binding window lifts soonest. */
341
+ /** Model name mapping. A key naming a tier (`fable`, `opus`, `sonnet`, `haiku`) overrides that tier's shipped model and is matched by substring of the requested name in `CLAUDE_TIERS` order; any other key is an alias, matched against the whole requested name case-insensitively, so `/model <alias>` selects its backend model. An alias outranks every other rule, including the pass-through of backend names. A value is one model or an ordered list of candidates: the request goes to the first whose quota windows are not spent, and when every candidate is spent, to the one whose binding window lifts soonest. */
339
342
  models: z.record(z.string().min(1), AntigravityModelTargetSchema).optional(),
340
343
  /** When every candidate of the tier a request names has no quota left, serve it from the next tier down, and onward through the lower tiers, instead of failing with the quota limit. Applies to a name that selects a tier (`/model fable`), not to an alias or a backend model name. Defaults to false. */
341
344
  degradeDownTiers: z.boolean().optional(),
@@ -360,16 +363,19 @@ var init_schema = __esm({
360
363
  });
361
364
  CODEX_EFFORTS = ["none", "low", "medium", "high"];
362
365
  CODEX_LOGINS = ["codex-cli", "chatgpt-sign-in"];
366
+ CODEX_DEFAULT_LOGIN = "codex-cli";
367
+ CODEX_DEFAULT_MODEL = "gpt-5.6-sol";
363
368
  CODEX_DEFAULT_TIER_MODELS = Object.freeze({
364
369
  fable: "gpt-5.6-sol",
365
370
  opus: "gpt-5.6-sol",
366
371
  sonnet: "gpt-5.6-terra",
367
372
  haiku: "gpt-5.6-luna"
368
373
  });
374
+ CODEX_DEFAULT_EFFORT = "low";
369
375
  CodexProviderConfigSchema = z.strictObject({
370
376
  /** The codex model a request maps to when no tier matches its model name. */
371
377
  defaultModel: z.string().min(1).optional(),
372
- /** Per-tier overrides of the shipped mapping, matched by substring of the requested model name in `CODEX_TIERS` order. */
378
+ /** Per-tier overrides of the shipped mapping, matched by substring of the requested model name in `CLAUDE_TIERS` order. */
373
379
  models: z.strictObject({
374
380
  fable: z.string().min(1).optional(),
375
381
  opus: z.string().min(1).optional(),
@@ -389,6 +395,13 @@ var init_schema = __esm({
389
395
  /** The model name to rewrite the request to before it reaches the target, for a provider that expects another form (OpenRouter's `anthropic/claude-...` for instance). A route that rewrites reads the whole body, the one copy the rewrite needs. */
390
396
  model: z.string().min(1).optional()
391
397
  });
398
+ PickerModelSchema = z.strictObject({
399
+ model: z.string().min(1),
400
+ tier: z.enum(CLAUDE_TIERS),
401
+ label: z.string().min(1).optional(),
402
+ description: z.string().min(1).optional()
403
+ });
404
+ PickerModelsSchema = z.array(PickerModelSchema).refine((models) => new Set(models.map((entry) => entry.model)).size === models.length, { message: "pickerModels names a model more than once" });
392
405
  HttpProviderSchema = z.strictObject({
393
406
  $schema: z.string().optional(),
394
407
  kind: z.literal("http").optional(),
@@ -396,6 +409,8 @@ var init_schema = __esm({
396
409
  baseUrl: z.url(),
397
410
  credential: ProviderCredentialSchema,
398
411
  env: ProviderEnvSchema.optional(),
412
+ /** Extra models `/model` lists beside the ones the tier settings name. */
413
+ pickerModels: PickerModelsSchema.optional(),
399
414
  /** 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. */
400
415
  routes: z.array(ProviderRouteSchema).optional()
401
416
  });
@@ -405,6 +420,8 @@ var init_schema = __esm({
405
420
  displayName: z.string().min(1),
406
421
  credential: ProviderCredentialSchema,
407
422
  env: ProviderEnvSchema.optional(),
423
+ /** Extra models `/model` lists beside the ones the tier settings name. */
424
+ pickerModels: PickerModelsSchema.optional(),
408
425
  codex: CodexProviderConfigSchema.optional()
409
426
  });
410
427
  AntigravityProviderSchema = z.strictObject({
@@ -413,6 +430,8 @@ var init_schema = __esm({
413
430
  displayName: z.string().min(1),
414
431
  credential: ProviderCredentialSchema,
415
432
  env: ProviderEnvSchema.optional(),
433
+ /** Extra models `/model` lists beside the ones the tier settings name. */
434
+ pickerModels: PickerModelsSchema.optional(),
416
435
  antigravity: AntigravityProviderConfigSchema.optional()
417
436
  });
418
437
  ProviderSchema = z.discriminatedUnion("kind", [HttpProviderSchema, CodexProviderSchema, AntigravityProviderSchema]);
@@ -2904,7 +2923,7 @@ var init_package = __esm({
2904
2923
  "package.json"() {
2905
2924
  package_default = {
2906
2925
  name: "claude-use",
2907
- version: "11.23.0",
2926
+ version: "11.25.0",
2908
2927
  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.",
2909
2928
  license: "MIT",
2910
2929
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -6530,7 +6549,8 @@ function addProvider(paths, name, input) {
6530
6549
  const shared = {
6531
6550
  displayName: input.displayName,
6532
6551
  credential: { sources: input.sources, ...input.target === void 0 ? {} : { target: input.target } },
6533
- ...input.env === void 0 || Object.keys(input.env).length === 0 ? {} : { env: input.env }
6552
+ ...input.env === void 0 || Object.keys(input.env).length === 0 ? {} : { env: input.env },
6553
+ ...input.pickerModels === void 0 || input.pickerModels.length === 0 ? {} : { pickerModels: input.pickerModels }
6534
6554
  };
6535
6555
  const parsed = ProviderSchema.safeParse(
6536
6556
  kind === "codex" ? { kind, ...shared, ...isEmptyCodexConfig(input.codex) ? {} : { codex: input.codex } } : kind === "antigravity" ? { kind, ...shared, ...isEmptyAntigravityConfig(input.antigravity) ? {} : { antigravity: input.antigravity } } : { ...shared, baseUrl: input.baseUrl }
@@ -6548,6 +6568,12 @@ function updateProvider(paths, name, input) {
6548
6568
  }
6549
6569
  const unset = new Set(input.unsetEnv);
6550
6570
  const env = Object.fromEntries(Object.entries({ ...existing.env, ...input.env }).filter(([key]) => !unset.has(key)));
6571
+ const unsetPicker = new Set(input.unsetPickerModels);
6572
+ const added = new Map((input.pickerModels ?? []).map((entry) => [entry.model, entry]));
6573
+ const pickerModels = [
6574
+ ...(existing.pickerModels ?? []).filter((entry) => !unsetPicker.has(entry.model)).map((entry) => added.get(entry.model) ?? entry),
6575
+ ...[...added.values()].filter((entry) => !(existing.pickerModels ?? []).some((kept) => kept.model === entry.model))
6576
+ ];
6551
6577
  const target = input.target ?? existing.credential.target;
6552
6578
  const cache = input.cache === void 0 ? existing.credential.cache : input.cache === false ? void 0 : input.cache;
6553
6579
  if (isCodexProvider(existing) && input.baseUrl !== void 0) {
@@ -6569,7 +6595,8 @@ function updateProvider(paths, name, input) {
6569
6595
  ...target === void 0 ? {} : { target },
6570
6596
  ...cache === void 0 ? {} : { cache }
6571
6597
  },
6572
- env: Object.keys(env).length === 0 ? void 0 : env
6598
+ env: Object.keys(env).length === 0 ? void 0 : env,
6599
+ pickerModels: pickerModels.length === 0 ? void 0 : pickerModels
6573
6600
  };
6574
6601
  let candidate;
6575
6602
  if (isCodexProvider(existing)) {
@@ -7768,13 +7795,43 @@ function withConversation(passthrough, conversation, id) {
7768
7795
  }
7769
7796
  return [...kept, conversation === "start" ? "--session-id" : "--resume", id, ...tail];
7770
7797
  }
7798
+ function hasSettingsArgument(passthrough) {
7799
+ const end = passthrough.indexOf(TERMINATOR2);
7800
+ return (end === -1 ? passthrough : passthrough.slice(0, end)).some((token) => token === "--settings" || token.startsWith("--settings="));
7801
+ }
7771
7802
  function withSupervision(passthrough, supervised) {
7772
- const conversation = supervised.conversation === "as-given" ? passthrough : withConversation(passthrough, supervised.conversation, supervised.sessionId);
7773
- if (supervised.settings === void 0) {
7774
- return conversation;
7803
+ return supervised.conversation === "as-given" ? passthrough : withConversation(passthrough, supervised.conversation, supervised.sessionId);
7804
+ }
7805
+ function withLauncherSettings(passthrough, settings) {
7806
+ if (settings === void 0) {
7807
+ return passthrough;
7808
+ }
7809
+ const end = passthrough.indexOf(TERMINATOR2);
7810
+ return end === -1 ? [...passthrough, "--settings", settings] : [...passthrough.slice(0, end), "--settings", settings, ...passthrough.slice(end)];
7811
+ }
7812
+ function isRecord15(value) {
7813
+ return typeof value === "object" && value !== null && !Array.isArray(value);
7814
+ }
7815
+ function mergeSettings(parts) {
7816
+ const merged = {};
7817
+ let any = false;
7818
+ for (const part of parts) {
7819
+ if (part === void 0) {
7820
+ continue;
7821
+ }
7822
+ const parsed = JSON.parse(part);
7823
+ if (!isRecord15(parsed)) {
7824
+ throw new Error("a launch's settings part is not a JSON object");
7825
+ }
7826
+ for (const [key, value] of Object.entries(parsed)) {
7827
+ if (key in merged) {
7828
+ throw new Error(`two launch settings parts both set "${key}"`);
7829
+ }
7830
+ merged[key] = value;
7831
+ }
7832
+ any = true;
7775
7833
  }
7776
- const end = conversation.indexOf(TERMINATOR2);
7777
- return end === -1 ? [...conversation, "--settings", supervised.settings] : [...conversation.slice(0, end), "--settings", supervised.settings, ...conversation.slice(end)];
7834
+ return any ? JSON.stringify(merged) : void 0;
7778
7835
  }
7779
7836
  var TERMINATOR2, VALUED_CONVERSATION_FLAGS, CONTINUE_FLAGS;
7780
7837
  var init_claudeSession = __esm({
@@ -7787,6 +7844,265 @@ var init_claudeSession = __esm({
7787
7844
  }
7788
7845
  });
7789
7846
 
7847
+ // src/antigravity/cloudUpstream.ts
7848
+ var init_cloudUpstream = __esm({
7849
+ "src/antigravity/cloudUpstream.ts"() {
7850
+ "use strict";
7851
+ }
7852
+ });
7853
+
7854
+ // src/antigravity/quota.ts
7855
+ var SECONDS_PER_HOUR, HOURS_PER_FIVE_HOUR_WINDOW, DAYS_PER_WEEK, HOURS_PER_DAY4, FIVE_HOUR_PERIOD_SECONDS, WEEK_PERIOD_SECONDS;
7856
+ var init_quota = __esm({
7857
+ "src/antigravity/quota.ts"() {
7858
+ "use strict";
7859
+ init_cloudUpstream();
7860
+ SECONDS_PER_HOUR = 3600;
7861
+ HOURS_PER_FIVE_HOUR_WINDOW = 5;
7862
+ DAYS_PER_WEEK = 7;
7863
+ HOURS_PER_DAY4 = 24;
7864
+ FIVE_HOUR_PERIOD_SECONDS = HOURS_PER_FIVE_HOUR_WINDOW * SECONDS_PER_HOUR;
7865
+ WEEK_PERIOD_SECONDS = DAYS_PER_WEEK * HOURS_PER_DAY4 * SECONDS_PER_HOUR;
7866
+ }
7867
+ });
7868
+
7869
+ // src/antigravity/signatures.ts
7870
+ var init_signatures = __esm({
7871
+ "src/antigravity/signatures.ts"() {
7872
+ "use strict";
7873
+ }
7874
+ });
7875
+
7876
+ // src/codex/anthropic.ts
7877
+ import { z as z29 } from "zod";
7878
+ var TextBlockSchema, Base64ImageSourceSchema, UrlImageSourceSchema, ImageBlockSchema, ToolUseBlockSchema, ToolResultContentBlockSchema, ToolResultBlockSchema, OtherBlockSchema, ContentBlockSchema, MessageSchema, ToolSchema, ToolChoiceSchema, SystemSchema, MessagesRequestSchema, CountTokensRequestSchema;
7879
+ var init_anthropic = __esm({
7880
+ "src/codex/anthropic.ts"() {
7881
+ "use strict";
7882
+ TextBlockSchema = z29.looseObject({ type: z29.literal("text"), text: z29.string() });
7883
+ Base64ImageSourceSchema = z29.looseObject({ type: z29.literal("base64"), media_type: z29.string().min(1), data: z29.string() });
7884
+ UrlImageSourceSchema = z29.looseObject({ type: z29.literal("url"), url: z29.string().min(1) });
7885
+ ImageBlockSchema = z29.looseObject({
7886
+ type: z29.literal("image"),
7887
+ source: z29.union([Base64ImageSourceSchema, UrlImageSourceSchema])
7888
+ });
7889
+ ToolUseBlockSchema = z29.looseObject({
7890
+ type: z29.literal("tool_use"),
7891
+ id: z29.string().min(1),
7892
+ name: z29.string().min(1),
7893
+ input: z29.unknown()
7894
+ });
7895
+ ToolResultContentBlockSchema = z29.union([TextBlockSchema, z29.looseObject({ type: z29.string() })]);
7896
+ ToolResultBlockSchema = z29.looseObject({
7897
+ type: z29.literal("tool_result"),
7898
+ tool_use_id: z29.string().min(1),
7899
+ content: z29.union([z29.string(), z29.array(ToolResultContentBlockSchema)]).optional()
7900
+ });
7901
+ OtherBlockSchema = z29.looseObject({ type: z29.string() });
7902
+ ContentBlockSchema = z29.union([TextBlockSchema, ImageBlockSchema, ToolUseBlockSchema, ToolResultBlockSchema, OtherBlockSchema]);
7903
+ MessageSchema = z29.looseObject({
7904
+ role: z29.enum(["user", "assistant", "system"]),
7905
+ content: z29.union([z29.string(), z29.array(ContentBlockSchema)])
7906
+ });
7907
+ ToolSchema = z29.looseObject({
7908
+ name: z29.string().min(1),
7909
+ description: z29.string().optional(),
7910
+ input_schema: z29.record(z29.string(), z29.unknown()).optional()
7911
+ });
7912
+ ToolChoiceSchema = z29.union([
7913
+ z29.looseObject({ type: z29.enum(["auto", "none", "any"]) }),
7914
+ z29.looseObject({ type: z29.literal("tool"), name: z29.string().min(1) })
7915
+ ]);
7916
+ SystemSchema = z29.union([z29.string(), z29.array(z29.union([TextBlockSchema, OtherBlockSchema]))]);
7917
+ MessagesRequestSchema = z29.looseObject({
7918
+ model: z29.string().optional(),
7919
+ system: SystemSchema.optional(),
7920
+ messages: z29.array(MessageSchema),
7921
+ tools: z29.array(ToolSchema).optional(),
7922
+ tool_choice: ToolChoiceSchema.optional(),
7923
+ stream: z29.boolean().optional(),
7924
+ /** `user_id` is stable for one Claude Code session and differs between sessions, which is what makes it the right key for both the backend's prompt cache and its session header. */
7925
+ metadata: z29.looseObject({ user_id: z29.string().optional() }).optional(),
7926
+ /** Claude Code's effort setting. Any string is accepted; the translator honours only the levels the backend understands. */
7927
+ output_config: z29.looseObject({ effort: z29.string().optional() }).optional()
7928
+ });
7929
+ CountTokensRequestSchema = z29.looseObject({
7930
+ system: z29.unknown().optional(),
7931
+ messages: z29.unknown().optional(),
7932
+ tools: z29.unknown().optional()
7933
+ });
7934
+ }
7935
+ });
7936
+
7937
+ // src/antigravity/translate.ts
7938
+ function candidatesOf(target) {
7939
+ return typeof target === "string" ? [target] : target;
7940
+ }
7941
+ function isAntigravityTier(key) {
7942
+ return CLAUDE_TIERS.some((tier) => tier === key);
7943
+ }
7944
+ function resolveAntigravityConfig(config) {
7945
+ const overrides = config?.models ?? {};
7946
+ const aliases = /* @__PURE__ */ new Map();
7947
+ for (const [key, target] of Object.entries(overrides)) {
7948
+ if (!isAntigravityTier(key)) {
7949
+ aliases.set(key.toLowerCase(), candidatesOf(target));
7950
+ }
7951
+ }
7952
+ const tierModel = (tier) => {
7953
+ const target = overrides[tier];
7954
+ return target === void 0 ? ANTIGRAVITY_DEFAULT_TIER_MODELS[tier] : candidatesOf(target);
7955
+ };
7956
+ return {
7957
+ mode: config?.mode ?? ANTIGRAVITY_DEFAULT_MODE,
7958
+ defaultModel: config?.defaultModel ?? ANTIGRAVITY_DEFAULT_MODEL,
7959
+ models: { fable: tierModel("fable"), opus: tierModel("opus"), sonnet: tierModel("sonnet"), haiku: tierModel("haiku") },
7960
+ aliases,
7961
+ degradeDownTiers: config?.degradeDownTiers ?? false,
7962
+ effort: config?.effort ?? ANTIGRAVITY_DEFAULT_EFFORT,
7963
+ cloud: {
7964
+ endpoint: config?.cloud?.endpoint,
7965
+ projectId: config?.cloud?.projectId,
7966
+ location: config?.cloud?.location
7967
+ },
7968
+ local: {
7969
+ command: config?.local?.command,
7970
+ socketPath: config?.local?.socketPath
7971
+ }
7972
+ };
7973
+ }
7974
+ var init_translate = __esm({
7975
+ "src/antigravity/translate.ts"() {
7976
+ "use strict";
7977
+ init_quota();
7978
+ init_signatures();
7979
+ init_schema();
7980
+ init_anthropic();
7981
+ }
7982
+ });
7983
+
7984
+ // src/codex/translate.ts
7985
+ function resolveCodexConfig(config) {
7986
+ const overrides = config?.models;
7987
+ return {
7988
+ defaultModel: config?.defaultModel ?? CODEX_DEFAULT_MODEL,
7989
+ models: {
7990
+ fable: overrides?.fable ?? CODEX_DEFAULT_TIER_MODELS.fable,
7991
+ opus: overrides?.opus ?? CODEX_DEFAULT_TIER_MODELS.opus,
7992
+ sonnet: overrides?.sonnet ?? CODEX_DEFAULT_TIER_MODELS.sonnet,
7993
+ haiku: overrides?.haiku ?? CODEX_DEFAULT_TIER_MODELS.haiku
7994
+ },
7995
+ effort: config?.effort ?? CODEX_DEFAULT_EFFORT,
7996
+ login: config?.login ?? CODEX_DEFAULT_LOGIN
7997
+ };
7998
+ }
7999
+ var init_translate2 = __esm({
8000
+ "src/codex/translate.ts"() {
8001
+ "use strict";
8002
+ init_schema();
8003
+ init_anthropic();
8004
+ }
8005
+ });
8006
+
8007
+ // src/launcher/modelPicker.ts
8008
+ function labelOf(model) {
8009
+ return model.toLowerCase().endsWith(CONTEXT_MARKER_1M) ? model.slice(0, -CONTEXT_MARKER_1M.length) : model;
8010
+ }
8011
+ function describedAs(model, description) {
8012
+ return model.toLowerCase().endsWith(CONTEXT_MARKER_1M) ? `${description}; 1M context` : description;
8013
+ }
8014
+ function joined(parts) {
8015
+ const last = parts[parts.length - 1];
8016
+ return last === void 0 || parts.length === 1 ? last ?? "" : `${parts.slice(0, -1).join(", ")} and ${last}`;
8017
+ }
8018
+ function rowOf2(model, reaches) {
8019
+ const lead = reaches.find((reach) => reach.standing === "first") ?? reaches[0];
8020
+ if (lead === void 0) {
8021
+ throw new Error(`model ${model} is reached by no tier`);
8022
+ }
8023
+ const firsts = reaches.filter((reach) => reach.standing === "first").map((reach) => reach.tier);
8024
+ const fallbacks = reaches.filter((reach) => reach.standing === "fallback").map((reach) => reach.tier);
8025
+ const serves = firsts.length === 0 ? [] : [`Serves the ${joined(firsts)} tier${firsts.length === 1 ? "" : "s"}`];
8026
+ const falls = fallbacks.length === 0 ? [] : [`${serves.length === 0 ? "Fallback" : "fallback"} for ${joined(fallbacks)}`];
8027
+ return { model, label: labelOf(model), description: describedAs(model, [...serves, ...falls].join("; ")), behavesAs: TIER_BEHAVES_AS[lead.tier] };
8028
+ }
8029
+ function rowsOfTable(table) {
8030
+ const reachesByModel = /* @__PURE__ */ new Map();
8031
+ for (const [tier, candidates] of table) {
8032
+ candidates.forEach((model, index) => {
8033
+ const reaches = reachesByModel.get(model) ?? [];
8034
+ if (!reaches.some((reach) => reach.tier === tier)) {
8035
+ reaches.push({ tier, standing: index === 0 ? "first" : "fallback" });
8036
+ }
8037
+ reachesByModel.set(model, reaches);
8038
+ });
8039
+ }
8040
+ return [...reachesByModel].map(([model, reaches]) => rowOf2(model, reaches));
8041
+ }
8042
+ function antigravityRows(provider) {
8043
+ const config = resolveAntigravityConfig(provider.antigravity);
8044
+ const tiers = rowsOfTable(CLAUDE_TIERS.map((tier) => [tier, config.models[tier]]));
8045
+ const behavesAsOf = new Map(tiers.map((row) => [row.model, row.behavesAs]));
8046
+ const aliases = [...config.aliases].flatMap(([alias, candidates]) => {
8047
+ const [first] = candidates;
8048
+ const behavesAs = first === void 0 ? void 0 : behavesAsOf.get(first);
8049
+ return behavesAs === void 0 ? [] : [{ model: alias, label: labelOf(alias), description: `Alias for ${candidates.join(", then ")}`, behavesAs }];
8050
+ });
8051
+ return [...tiers, ...aliases];
8052
+ }
8053
+ function codexRows(provider) {
8054
+ const config = resolveCodexConfig(provider.codex);
8055
+ return rowsOfTable(CLAUDE_TIERS.map((tier) => [tier, [config.models[tier]]]));
8056
+ }
8057
+ function httpRows(provider) {
8058
+ const env = provider.env ?? {};
8059
+ const table = CLAUDE_TIERS.flatMap((tier) => {
8060
+ const model = env[TIER_ENV_VARIABLES[tier]];
8061
+ return model === void 0 || model === "" ? [] : [[tier, [model]]];
8062
+ });
8063
+ return rowsOfTable(table);
8064
+ }
8065
+ function declaredRow(entry) {
8066
+ return {
8067
+ model: entry.model,
8068
+ label: entry.label ?? labelOf(entry.model),
8069
+ description: entry.description ?? describedAs(entry.model, `Declared by the provider for the ${entry.tier} tier`),
8070
+ behavesAs: TIER_BEHAVES_AS[entry.tier]
8071
+ };
8072
+ }
8073
+ function providerModelRows(provider) {
8074
+ const derived = provider.kind === "codex" ? codexRows(provider) : provider.kind === "antigravity" ? antigravityRows(provider) : httpRows(provider);
8075
+ const declared = (provider.pickerModels ?? []).map(declaredRow);
8076
+ const declaredModels = new Set(declared.map((row) => row.model));
8077
+ return [...derived.filter((row) => !declaredModels.has(row.model)), ...declared];
8078
+ }
8079
+ function modelPickerSettings(provider) {
8080
+ const options = providerModelRows(provider);
8081
+ return options.length === 0 ? void 0 : JSON.stringify({ modelPicker: { options, replaceBuiltInOptions: true } });
8082
+ }
8083
+ var CONTEXT_MARKER_1M, TIER_BEHAVES_AS, TIER_ENV_VARIABLES;
8084
+ var init_modelPicker = __esm({
8085
+ "src/launcher/modelPicker.ts"() {
8086
+ "use strict";
8087
+ init_translate();
8088
+ init_translate2();
8089
+ init_schema();
8090
+ CONTEXT_MARKER_1M = "[1m]";
8091
+ TIER_BEHAVES_AS = Object.freeze({
8092
+ fable: "claude-fable-5-1",
8093
+ opus: "claude-opus-5-5",
8094
+ sonnet: "claude-sonnet-5-5",
8095
+ haiku: "claude-haiku-5-5"
8096
+ });
8097
+ TIER_ENV_VARIABLES = Object.freeze({
8098
+ fable: "ANTHROPIC_DEFAULT_FABLE_MODEL",
8099
+ opus: "ANTHROPIC_DEFAULT_OPUS_MODEL",
8100
+ sonnet: "ANTHROPIC_DEFAULT_SONNET_MODEL",
8101
+ haiku: "ANTHROPIC_DEFAULT_HAIKU_MODEL"
8102
+ });
8103
+ }
8104
+ });
8105
+
7790
8106
  // src/launcher/pool.ts
7791
8107
  function isResuming(passthrough) {
7792
8108
  const end = passthrough.indexOf(TERMINATOR3);
@@ -8213,10 +8529,16 @@ function decideLaunch(params, readOnly) {
8213
8529
  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`);
8214
8530
  }
8215
8531
  const flags = loginlessProvider === void 0 ? requestedFlags : { ...requestedFlags, remoteControl: false };
8532
+ const pickerSettings = selectedProvider === void 0 ? void 0 : modelPickerSettings(selectedProvider.definition);
8533
+ const callerSettings = hasSettingsArgument(parsedArgv.rest);
8534
+ if (pickerSettings !== void 0 && callerSettings && !readOnly) {
8535
+ 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");
8536
+ }
8537
+ const launcherSettings = mergeSettings([params.supervised?.settings, callerSettings ? void 0 : pickerSettings]);
8216
8538
  const args = buildArgv({
8217
8539
  toolFlags: buildFlagArgs(flags),
8218
8540
  extraFlags: splitExtraFlags(env.CLAUDE_EXTRA_FLAGS),
8219
- passthrough: params.supervised === void 0 ? parsedArgv.rest : withSupervision(parsedArgv.rest, params.supervised)
8541
+ passthrough: withLauncherSettings(params.supervised === void 0 ? parsedArgv.rest : withSupervision(parsedArgv.rest, params.supervised), launcherSettings)
8220
8542
  });
8221
8543
  const configDir = configDirEscapeHatchApplies || identityDecision.name === void 0 ? env.CLAUDE_CONFIG_DIR : path38.join(paths.identitiesDir, identityDecision.name);
8222
8544
  const decision = {
@@ -8406,6 +8728,7 @@ var init_launcher = __esm({
8406
8728
  init_flags();
8407
8729
  init_extraFlags();
8408
8730
  init_claudeSession();
8731
+ init_modelPicker();
8409
8732
  init_pool();
8410
8733
  init_resumeContext();
8411
8734
  init_lock();
@@ -8886,84 +9209,77 @@ var init_identityClaude = __esm({
8886
9209
  }
8887
9210
  });
8888
9211
 
8889
- // src/antigravity/cloudUpstream.ts
8890
- var init_cloudUpstream = __esm({
8891
- "src/antigravity/cloudUpstream.ts"() {
8892
- "use strict";
8893
- }
8894
- });
8895
-
8896
9212
  // src/usage/providerQuota.ts
8897
- import { z as z29 } from "zod";
8898
- var MS_PER_SECOND7, SECONDS_PER_HOUR, HOURS_PER_DAY4, DAYS_PER_MONTH, ZAI_HOST, ZAI_QUOTA_URL, ZAI_UNIT_HOURS, ZAI_UNIT_MONTHS, ZAI_UNIT_MS, ZaiLimitSchema, ZaiResponseSchema, OPENROUTER_HOST, OPENROUTER_KEY_URL, OPENROUTER_CREDITS_URL, MS_PER_DAY3, OpenRouterKeySchema, OpenRouterCreditsSchema, ANTIGRAVITY_HOST, ANTIGRAVITY_QUOTA_URL, ANTIGRAVITY_USER_URL, FIVE_HOURS2, DAYS_PER_WEEK, FIVE_HOURS_MS, WEEK_MS, AntigravityBucketSchema, AntigravitySummarySchema, GoogleTokenInfoSchema, AntigravityUserSchema;
9213
+ import { z as z30 } from "zod";
9214
+ var 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;
8899
9215
  var init_providerQuota = __esm({
8900
9216
  "src/usage/providerQuota.ts"() {
8901
9217
  "use strict";
8902
9218
  init_cloudUpstream();
8903
9219
  init_schema2();
8904
9220
  MS_PER_SECOND7 = 1e3;
8905
- SECONDS_PER_HOUR = 3600;
8906
- HOURS_PER_DAY4 = 24;
9221
+ SECONDS_PER_HOUR2 = 3600;
9222
+ HOURS_PER_DAY5 = 24;
8907
9223
  DAYS_PER_MONTH = 30;
8908
9224
  ZAI_HOST = "api.z.ai";
8909
9225
  ZAI_QUOTA_URL = `https://${ZAI_HOST}/api/monitor/usage/quota/limit`;
8910
9226
  ZAI_UNIT_HOURS = 3;
8911
9227
  ZAI_UNIT_MONTHS = 5;
8912
9228
  ZAI_UNIT_MS = /* @__PURE__ */ new Map([
8913
- [ZAI_UNIT_HOURS, SECONDS_PER_HOUR * MS_PER_SECOND7],
8914
- [ZAI_UNIT_MONTHS, DAYS_PER_MONTH * HOURS_PER_DAY4 * SECONDS_PER_HOUR * MS_PER_SECOND7]
9229
+ [ZAI_UNIT_HOURS, SECONDS_PER_HOUR2 * MS_PER_SECOND7],
9230
+ [ZAI_UNIT_MONTHS, DAYS_PER_MONTH * HOURS_PER_DAY5 * SECONDS_PER_HOUR2 * MS_PER_SECOND7]
8915
9231
  ]);
8916
- ZaiLimitSchema = z29.object({
8917
- type: z29.string(),
8918
- unit: z29.number().int(),
8919
- number: z29.number().int().positive(),
8920
- percentage: z29.number().nonnegative(),
8921
- nextResetTime: z29.number().positive().optional(),
8922
- usage: z29.number().nonnegative().optional(),
8923
- currentValue: z29.number().nonnegative().optional(),
8924
- remaining: z29.number().nonnegative().optional()
9232
+ ZaiLimitSchema = z30.object({
9233
+ type: z30.string(),
9234
+ unit: z30.number().int(),
9235
+ number: z30.number().int().positive(),
9236
+ percentage: z30.number().nonnegative(),
9237
+ nextResetTime: z30.number().positive().optional(),
9238
+ usage: z30.number().nonnegative().optional(),
9239
+ currentValue: z30.number().nonnegative().optional(),
9240
+ remaining: z30.number().nonnegative().optional()
8925
9241
  });
8926
- ZaiResponseSchema = z29.object({
8927
- success: z29.boolean(),
8928
- msg: z29.string().optional(),
8929
- data: z29.object({ level: z29.string().optional(), limits: z29.array(ZaiLimitSchema) })
9242
+ ZaiResponseSchema = z30.object({
9243
+ success: z30.boolean(),
9244
+ msg: z30.string().optional(),
9245
+ data: z30.object({ level: z30.string().optional(), limits: z30.array(ZaiLimitSchema) })
8930
9246
  });
8931
9247
  OPENROUTER_HOST = "openrouter.ai";
8932
9248
  OPENROUTER_KEY_URL = `https://${OPENROUTER_HOST}/api/v1/key`;
8933
9249
  OPENROUTER_CREDITS_URL = `https://${OPENROUTER_HOST}/api/v1/credits`;
8934
- MS_PER_DAY3 = HOURS_PER_DAY4 * SECONDS_PER_HOUR * MS_PER_SECOND7;
8935
- OpenRouterKeySchema = z29.object({
8936
- data: z29.object({
8937
- limit: z29.number().nonnegative().nullable(),
8938
- limit_remaining: z29.number().nullable(),
8939
- limit_reset: z29.string().nullable(),
8940
- is_free_tier: z29.boolean().optional(),
8941
- free_model_daily_requests: z29.object({ used: z29.number().nonnegative(), limit: z29.number().nonnegative(), remaining: z29.number() }).optional()
9250
+ MS_PER_DAY3 = HOURS_PER_DAY5 * SECONDS_PER_HOUR2 * MS_PER_SECOND7;
9251
+ OpenRouterKeySchema = z30.object({
9252
+ data: z30.object({
9253
+ limit: z30.number().nonnegative().nullable(),
9254
+ limit_remaining: z30.number().nullable(),
9255
+ limit_reset: z30.string().nullable(),
9256
+ is_free_tier: z30.boolean().optional(),
9257
+ free_model_daily_requests: z30.object({ used: z30.number().nonnegative(), limit: z30.number().nonnegative(), remaining: z30.number() }).optional()
8942
9258
  })
8943
9259
  });
8944
- OpenRouterCreditsSchema = z29.object({ data: z29.object({ total_credits: z29.number().nonnegative(), total_usage: z29.number().nonnegative() }) });
9260
+ OpenRouterCreditsSchema = z30.object({ data: z30.object({ total_credits: z30.number().nonnegative(), total_usage: z30.number().nonnegative() }) });
8945
9261
  ANTIGRAVITY_HOST = "daily-cloudcode-pa.googleapis.com";
8946
9262
  ANTIGRAVITY_QUOTA_URL = `https://${ANTIGRAVITY_HOST}/v1internal:retrieveUserQuotaSummary`;
8947
9263
  ANTIGRAVITY_USER_URL = `https://${ANTIGRAVITY_HOST}/v1internal:loadCodeAssist`;
8948
9264
  FIVE_HOURS2 = 5;
8949
- DAYS_PER_WEEK = 7;
8950
- FIVE_HOURS_MS = FIVE_HOURS2 * SECONDS_PER_HOUR * MS_PER_SECOND7;
8951
- WEEK_MS = DAYS_PER_WEEK * HOURS_PER_DAY4 * SECONDS_PER_HOUR * MS_PER_SECOND7;
8952
- AntigravityBucketSchema = z29.object({
8953
- bucketId: z29.string(),
8954
- remainingFraction: z29.number().optional(),
8955
- resetTime: z29.string().optional()
9265
+ DAYS_PER_WEEK2 = 7;
9266
+ FIVE_HOURS_MS = FIVE_HOURS2 * SECONDS_PER_HOUR2 * MS_PER_SECOND7;
9267
+ WEEK_MS = DAYS_PER_WEEK2 * HOURS_PER_DAY5 * SECONDS_PER_HOUR2 * MS_PER_SECOND7;
9268
+ AntigravityBucketSchema = z30.object({
9269
+ bucketId: z30.string(),
9270
+ remainingFraction: z30.number().optional(),
9271
+ resetTime: z30.string().optional()
8956
9272
  });
8957
- AntigravitySummarySchema = z29.object({ groups: z29.array(z29.object({ buckets: z29.array(AntigravityBucketSchema) })) });
8958
- GoogleTokenInfoSchema = z29.object({
8959
- email: z29.string().optional(),
8960
- sub: z29.string().optional()
9273
+ AntigravitySummarySchema = z30.object({ groups: z30.array(z30.object({ buckets: z30.array(AntigravityBucketSchema) })) });
9274
+ GoogleTokenInfoSchema = z30.object({
9275
+ email: z30.string().optional(),
9276
+ sub: z30.string().optional()
8961
9277
  });
8962
- AntigravityUserSchema = z29.object({
9278
+ AntigravityUserSchema = z30.object({
8963
9279
  /** The code-assist tier context, which defaults to the free tier for every account. */
8964
- currentTier: z29.object({ name: z29.string().optional(), id: z29.string().optional() }).optional(),
9280
+ currentTier: z30.object({ name: z30.string().optional(), id: z30.string().optional() }).optional(),
8965
9281
  /** The account's paid subscription; absent when the account has none. */
8966
- paidTier: z29.object({ name: z29.string().optional(), id: z29.string().optional() }).optional()
9282
+ paidTier: z30.object({ name: z30.string().optional(), id: z30.string().optional() }).optional()
8967
9283
  });
8968
9284
  }
8969
9285
  });
@@ -16497,7 +16813,7 @@ function numberOf(record, field) {
16497
16813
  }
16498
16814
  return void 0;
16499
16815
  }
16500
- function pageOfRcChannel(url, rows, idOf, rowOf2) {
16816
+ function pageOfRcChannel(url, rows, idOf, rowOf3) {
16501
16817
  const query = new URL(url, "http://127.0.0.1").searchParams;
16502
16818
  const anchor = query.get("after_event_id") ?? query.get("cursor");
16503
16819
  const rawLimit = query.get("limit");
@@ -16511,7 +16827,7 @@ function pageOfRcChannel(url, rows, idOf, rowOf2) {
16511
16827
  }
16512
16828
  const page = limit === void 0 ? rows.slice(from) : rows.slice(from, from + limit);
16513
16829
  const last = page[page.length - 1];
16514
- return { data: page.map(rowOf2), ...last === void 0 ? {} : { next_cursor: idOf(last) } };
16830
+ return { data: page.map(rowOf3), ...last === void 0 ? {} : { next_cursor: idOf(last) } };
16515
16831
  }
16516
16832
  async function serveRcClientChannels(ctx, tail, method, maxBatchEvents) {
16517
16833
  const { request: request4, response, host } = ctx;