claude-use 11.23.0 → 11.24.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 +18267 -18107
- package/dist/index.cjs +343 -59
- package/dist/index.mjs +343 -59
- package/dist/types/index.d.ts +30 -30
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -242,7 +242,7 @@ function isTimeZone(name) {
|
|
|
242
242
|
return false;
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
|
-
var import_node_path2, import_zod, import_trilean, CATEGORY_NAMES, OVERRIDABLE_CATEGORIES, CategoryMapSchema, DURATION_RE, DurationSchema, WhenConditionObjectSchema, WhenSchema, EntryValueSchema, ENTRY_KEY_RE, EntriesSchema, LaunchSchema, CREDENTIAL_TARGETS, PROVIDER_CREDENTIAL_TARGETS, CREDENTIAL_TARGET_VARS, ArgvSchema, CommandSourceOptions, EnvCredentialSourceSchema, FileCredentialSourceSchema, CommandCredentialSourceSchema, OpCredentialSourceSchema, KeychainCredentialSourceSchema, LiteralCredentialSourceSchema, CredentialSourceSchema, RemoteCredentialSourceSchema, CREDENTIAL_CACHE_STORES, CredentialCacheSchema, CredentialSchema, ProviderCredentialSchema, RESERVED_PROVIDER_ENV_KEYS, ProviderEnvSchema, PROVIDER_KINDS, ANTIGRAVITY_MODES, 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;
|
|
245
|
+
var import_node_path2, import_zod, import_trilean, CATEGORY_NAMES, OVERRIDABLE_CATEGORIES, CategoryMapSchema, DURATION_RE, DurationSchema, WhenConditionObjectSchema, WhenSchema, EntryValueSchema, ENTRY_KEY_RE, EntriesSchema, LaunchSchema, CREDENTIAL_TARGETS, PROVIDER_CREDENTIAL_TARGETS, CREDENTIAL_TARGET_VARS, ArgvSchema, CommandSourceOptions, EnvCredentialSourceSchema, FileCredentialSourceSchema, CommandCredentialSourceSchema, OpCredentialSourceSchema, KeychainCredentialSourceSchema, LiteralCredentialSourceSchema, CredentialSourceSchema, RemoteCredentialSourceSchema, CREDENTIAL_CACHE_STORES, CredentialCacheSchema, CredentialSchema, ProviderCredentialSchema, RESERVED_PROVIDER_ENV_KEYS, ProviderEnvSchema, PROVIDER_KINDS, ANTIGRAVITY_MODES, ANTIGRAVITY_TIERS, ANTIGRAVITY_EFFORTS, ANTIGRAVITY_DEFAULT_MODE, ANTIGRAVITY_DEFAULT_MODEL, ANTIGRAVITY_DEFAULT_TIER_MODELS, ANTIGRAVITY_DEFAULT_EFFORT, AntigravityModelTargetSchema, AntigravityProviderConfigSchema, CODEX_TIERS, CODEX_EFFORTS, CODEX_LOGINS, CODEX_DEFAULT_LOGIN, CODEX_DEFAULT_MODEL, CODEX_DEFAULT_TIER_MODELS, CODEX_DEFAULT_EFFORT, 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;
|
|
246
246
|
var init_schema = __esm({
|
|
247
247
|
"src/config/schema.ts"() {
|
|
248
248
|
"use strict";
|
|
@@ -343,14 +343,17 @@ var init_schema = __esm({
|
|
|
343
343
|
});
|
|
344
344
|
PROVIDER_KINDS = ["http", "codex", "antigravity"];
|
|
345
345
|
ANTIGRAVITY_MODES = ["cloud", "local"];
|
|
346
|
+
ANTIGRAVITY_TIERS = ["fable", "opus", "sonnet", "haiku"];
|
|
346
347
|
ANTIGRAVITY_EFFORTS = ["none", "low", "medium", "high", "xhigh", "max"];
|
|
347
348
|
ANTIGRAVITY_DEFAULT_MODE = "cloud";
|
|
349
|
+
ANTIGRAVITY_DEFAULT_MODEL = "gemini-3.8-flash-high";
|
|
348
350
|
ANTIGRAVITY_DEFAULT_TIER_MODELS = Object.freeze({
|
|
349
351
|
fable: ["gemini-4-argon-high", "claude-opus-5-5-high", "gemini-3.8-flash-high"],
|
|
350
352
|
opus: ["claude-opus-5-5-high", "gemini-4-argon-high", "gemini-3.8-flash-high"],
|
|
351
353
|
sonnet: ["claude-sonnet-5-5-medium", "gemini-4-argon-medium", "gemini-3.8-flash-medium"],
|
|
352
354
|
haiku: ["gemini-3.8-flash-low", "gemini-4-argon-low", "claude-sonnet-5-5-low"]
|
|
353
355
|
});
|
|
356
|
+
ANTIGRAVITY_DEFAULT_EFFORT = "low";
|
|
354
357
|
AntigravityModelTargetSchema = import_zod.z.union([import_zod.z.string().min(1), import_zod.z.array(import_zod.z.string().min(1)).min(1)]);
|
|
355
358
|
AntigravityProviderConfigSchema = import_zod.z.strictObject({
|
|
356
359
|
/** Operational mode: direct cloud endpoint or local ACP daemon. Defaults to `cloud`. */
|
|
@@ -380,14 +383,18 @@ var init_schema = __esm({
|
|
|
380
383
|
socketPath: import_zod.z.string().min(1).optional()
|
|
381
384
|
}).optional()
|
|
382
385
|
});
|
|
386
|
+
CODEX_TIERS = ["fable", "opus", "sonnet", "haiku"];
|
|
383
387
|
CODEX_EFFORTS = ["none", "low", "medium", "high"];
|
|
384
388
|
CODEX_LOGINS = ["codex-cli", "chatgpt-sign-in"];
|
|
389
|
+
CODEX_DEFAULT_LOGIN = "codex-cli";
|
|
390
|
+
CODEX_DEFAULT_MODEL = "gpt-5.6-sol";
|
|
385
391
|
CODEX_DEFAULT_TIER_MODELS = Object.freeze({
|
|
386
392
|
fable: "gpt-5.6-sol",
|
|
387
393
|
opus: "gpt-5.6-sol",
|
|
388
394
|
sonnet: "gpt-5.6-terra",
|
|
389
395
|
haiku: "gpt-5.6-luna"
|
|
390
396
|
});
|
|
397
|
+
CODEX_DEFAULT_EFFORT = "low";
|
|
391
398
|
CodexProviderConfigSchema = import_zod.z.strictObject({
|
|
392
399
|
/** The codex model a request maps to when no tier matches its model name. */
|
|
393
400
|
defaultModel: import_zod.z.string().min(1).optional(),
|
|
@@ -2928,7 +2935,7 @@ var init_package = __esm({
|
|
|
2928
2935
|
"package.json"() {
|
|
2929
2936
|
package_default = {
|
|
2930
2937
|
name: "claude-use",
|
|
2931
|
-
version: "11.
|
|
2938
|
+
version: "11.24.0",
|
|
2932
2939
|
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.",
|
|
2933
2940
|
license: "MIT",
|
|
2934
2941
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -7796,13 +7803,43 @@ function withConversation(passthrough, conversation, id) {
|
|
|
7796
7803
|
}
|
|
7797
7804
|
return [...kept, conversation === "start" ? "--session-id" : "--resume", id, ...tail];
|
|
7798
7805
|
}
|
|
7806
|
+
function hasSettingsArgument(passthrough) {
|
|
7807
|
+
const end = passthrough.indexOf(TERMINATOR2);
|
|
7808
|
+
return (end === -1 ? passthrough : passthrough.slice(0, end)).some((token) => token === "--settings" || token.startsWith("--settings="));
|
|
7809
|
+
}
|
|
7799
7810
|
function withSupervision(passthrough, supervised) {
|
|
7800
|
-
|
|
7801
|
-
|
|
7802
|
-
|
|
7811
|
+
return supervised.conversation === "as-given" ? passthrough : withConversation(passthrough, supervised.conversation, supervised.sessionId);
|
|
7812
|
+
}
|
|
7813
|
+
function withLauncherSettings(passthrough, settings) {
|
|
7814
|
+
if (settings === void 0) {
|
|
7815
|
+
return passthrough;
|
|
7816
|
+
}
|
|
7817
|
+
const end = passthrough.indexOf(TERMINATOR2);
|
|
7818
|
+
return end === -1 ? [...passthrough, "--settings", settings] : [...passthrough.slice(0, end), "--settings", settings, ...passthrough.slice(end)];
|
|
7819
|
+
}
|
|
7820
|
+
function isRecord15(value) {
|
|
7821
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7822
|
+
}
|
|
7823
|
+
function mergeSettings(parts) {
|
|
7824
|
+
const merged = {};
|
|
7825
|
+
let any = false;
|
|
7826
|
+
for (const part of parts) {
|
|
7827
|
+
if (part === void 0) {
|
|
7828
|
+
continue;
|
|
7829
|
+
}
|
|
7830
|
+
const parsed = JSON.parse(part);
|
|
7831
|
+
if (!isRecord15(parsed)) {
|
|
7832
|
+
throw new Error("a launch's settings part is not a JSON object");
|
|
7833
|
+
}
|
|
7834
|
+
for (const [key, value] of Object.entries(parsed)) {
|
|
7835
|
+
if (key in merged) {
|
|
7836
|
+
throw new Error(`two launch settings parts both set "${key}"`);
|
|
7837
|
+
}
|
|
7838
|
+
merged[key] = value;
|
|
7839
|
+
}
|
|
7840
|
+
any = true;
|
|
7803
7841
|
}
|
|
7804
|
-
|
|
7805
|
-
return end === -1 ? [...conversation, "--settings", supervised.settings] : [...conversation.slice(0, end), "--settings", supervised.settings, ...conversation.slice(end)];
|
|
7842
|
+
return any ? JSON.stringify(merged) : void 0;
|
|
7806
7843
|
}
|
|
7807
7844
|
var TERMINATOR2, VALUED_CONVERSATION_FLAGS, CONTINUE_FLAGS;
|
|
7808
7845
|
var init_claudeSession = __esm({
|
|
@@ -7815,6 +7852,253 @@ var init_claudeSession = __esm({
|
|
|
7815
7852
|
}
|
|
7816
7853
|
});
|
|
7817
7854
|
|
|
7855
|
+
// src/antigravity/cloudUpstream.ts
|
|
7856
|
+
var init_cloudUpstream = __esm({
|
|
7857
|
+
"src/antigravity/cloudUpstream.ts"() {
|
|
7858
|
+
"use strict";
|
|
7859
|
+
}
|
|
7860
|
+
});
|
|
7861
|
+
|
|
7862
|
+
// src/antigravity/quota.ts
|
|
7863
|
+
var SECONDS_PER_HOUR, HOURS_PER_FIVE_HOUR_WINDOW, DAYS_PER_WEEK, HOURS_PER_DAY4, FIVE_HOUR_PERIOD_SECONDS, WEEK_PERIOD_SECONDS;
|
|
7864
|
+
var init_quota = __esm({
|
|
7865
|
+
"src/antigravity/quota.ts"() {
|
|
7866
|
+
"use strict";
|
|
7867
|
+
init_cloudUpstream();
|
|
7868
|
+
SECONDS_PER_HOUR = 3600;
|
|
7869
|
+
HOURS_PER_FIVE_HOUR_WINDOW = 5;
|
|
7870
|
+
DAYS_PER_WEEK = 7;
|
|
7871
|
+
HOURS_PER_DAY4 = 24;
|
|
7872
|
+
FIVE_HOUR_PERIOD_SECONDS = HOURS_PER_FIVE_HOUR_WINDOW * SECONDS_PER_HOUR;
|
|
7873
|
+
WEEK_PERIOD_SECONDS = DAYS_PER_WEEK * HOURS_PER_DAY4 * SECONDS_PER_HOUR;
|
|
7874
|
+
}
|
|
7875
|
+
});
|
|
7876
|
+
|
|
7877
|
+
// src/antigravity/signatures.ts
|
|
7878
|
+
var init_signatures = __esm({
|
|
7879
|
+
"src/antigravity/signatures.ts"() {
|
|
7880
|
+
"use strict";
|
|
7881
|
+
}
|
|
7882
|
+
});
|
|
7883
|
+
|
|
7884
|
+
// src/codex/anthropic.ts
|
|
7885
|
+
var import_zod29, TextBlockSchema, Base64ImageSourceSchema, UrlImageSourceSchema, ImageBlockSchema, ToolUseBlockSchema, ToolResultContentBlockSchema, ToolResultBlockSchema, OtherBlockSchema, ContentBlockSchema, MessageSchema, ToolSchema, ToolChoiceSchema, SystemSchema, MessagesRequestSchema, CountTokensRequestSchema;
|
|
7886
|
+
var init_anthropic = __esm({
|
|
7887
|
+
"src/codex/anthropic.ts"() {
|
|
7888
|
+
"use strict";
|
|
7889
|
+
import_zod29 = require("zod");
|
|
7890
|
+
TextBlockSchema = import_zod29.z.looseObject({ type: import_zod29.z.literal("text"), text: import_zod29.z.string() });
|
|
7891
|
+
Base64ImageSourceSchema = import_zod29.z.looseObject({ type: import_zod29.z.literal("base64"), media_type: import_zod29.z.string().min(1), data: import_zod29.z.string() });
|
|
7892
|
+
UrlImageSourceSchema = import_zod29.z.looseObject({ type: import_zod29.z.literal("url"), url: import_zod29.z.string().min(1) });
|
|
7893
|
+
ImageBlockSchema = import_zod29.z.looseObject({
|
|
7894
|
+
type: import_zod29.z.literal("image"),
|
|
7895
|
+
source: import_zod29.z.union([Base64ImageSourceSchema, UrlImageSourceSchema])
|
|
7896
|
+
});
|
|
7897
|
+
ToolUseBlockSchema = import_zod29.z.looseObject({
|
|
7898
|
+
type: import_zod29.z.literal("tool_use"),
|
|
7899
|
+
id: import_zod29.z.string().min(1),
|
|
7900
|
+
name: import_zod29.z.string().min(1),
|
|
7901
|
+
input: import_zod29.z.unknown()
|
|
7902
|
+
});
|
|
7903
|
+
ToolResultContentBlockSchema = import_zod29.z.union([TextBlockSchema, import_zod29.z.looseObject({ type: import_zod29.z.string() })]);
|
|
7904
|
+
ToolResultBlockSchema = import_zod29.z.looseObject({
|
|
7905
|
+
type: import_zod29.z.literal("tool_result"),
|
|
7906
|
+
tool_use_id: import_zod29.z.string().min(1),
|
|
7907
|
+
content: import_zod29.z.union([import_zod29.z.string(), import_zod29.z.array(ToolResultContentBlockSchema)]).optional()
|
|
7908
|
+
});
|
|
7909
|
+
OtherBlockSchema = import_zod29.z.looseObject({ type: import_zod29.z.string() });
|
|
7910
|
+
ContentBlockSchema = import_zod29.z.union([TextBlockSchema, ImageBlockSchema, ToolUseBlockSchema, ToolResultBlockSchema, OtherBlockSchema]);
|
|
7911
|
+
MessageSchema = import_zod29.z.looseObject({
|
|
7912
|
+
role: import_zod29.z.enum(["user", "assistant", "system"]),
|
|
7913
|
+
content: import_zod29.z.union([import_zod29.z.string(), import_zod29.z.array(ContentBlockSchema)])
|
|
7914
|
+
});
|
|
7915
|
+
ToolSchema = import_zod29.z.looseObject({
|
|
7916
|
+
name: import_zod29.z.string().min(1),
|
|
7917
|
+
description: import_zod29.z.string().optional(),
|
|
7918
|
+
input_schema: import_zod29.z.record(import_zod29.z.string(), import_zod29.z.unknown()).optional()
|
|
7919
|
+
});
|
|
7920
|
+
ToolChoiceSchema = import_zod29.z.union([
|
|
7921
|
+
import_zod29.z.looseObject({ type: import_zod29.z.enum(["auto", "none", "any"]) }),
|
|
7922
|
+
import_zod29.z.looseObject({ type: import_zod29.z.literal("tool"), name: import_zod29.z.string().min(1) })
|
|
7923
|
+
]);
|
|
7924
|
+
SystemSchema = import_zod29.z.union([import_zod29.z.string(), import_zod29.z.array(import_zod29.z.union([TextBlockSchema, OtherBlockSchema]))]);
|
|
7925
|
+
MessagesRequestSchema = import_zod29.z.looseObject({
|
|
7926
|
+
model: import_zod29.z.string().optional(),
|
|
7927
|
+
system: SystemSchema.optional(),
|
|
7928
|
+
messages: import_zod29.z.array(MessageSchema),
|
|
7929
|
+
tools: import_zod29.z.array(ToolSchema).optional(),
|
|
7930
|
+
tool_choice: ToolChoiceSchema.optional(),
|
|
7931
|
+
stream: import_zod29.z.boolean().optional(),
|
|
7932
|
+
/** `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. */
|
|
7933
|
+
metadata: import_zod29.z.looseObject({ user_id: import_zod29.z.string().optional() }).optional(),
|
|
7934
|
+
/** Claude Code's effort setting. Any string is accepted; the translator honours only the levels the backend understands. */
|
|
7935
|
+
output_config: import_zod29.z.looseObject({ effort: import_zod29.z.string().optional() }).optional()
|
|
7936
|
+
});
|
|
7937
|
+
CountTokensRequestSchema = import_zod29.z.looseObject({
|
|
7938
|
+
system: import_zod29.z.unknown().optional(),
|
|
7939
|
+
messages: import_zod29.z.unknown().optional(),
|
|
7940
|
+
tools: import_zod29.z.unknown().optional()
|
|
7941
|
+
});
|
|
7942
|
+
}
|
|
7943
|
+
});
|
|
7944
|
+
|
|
7945
|
+
// src/antigravity/translate.ts
|
|
7946
|
+
function candidatesOf(target) {
|
|
7947
|
+
return typeof target === "string" ? [target] : target;
|
|
7948
|
+
}
|
|
7949
|
+
function isAntigravityTier(key) {
|
|
7950
|
+
return ANTIGRAVITY_TIERS.some((tier) => tier === key);
|
|
7951
|
+
}
|
|
7952
|
+
function resolveAntigravityConfig(config) {
|
|
7953
|
+
const overrides = config?.models ?? {};
|
|
7954
|
+
const aliases = /* @__PURE__ */ new Map();
|
|
7955
|
+
for (const [key, target] of Object.entries(overrides)) {
|
|
7956
|
+
if (!isAntigravityTier(key)) {
|
|
7957
|
+
aliases.set(key.toLowerCase(), candidatesOf(target));
|
|
7958
|
+
}
|
|
7959
|
+
}
|
|
7960
|
+
const tierModel = (tier) => {
|
|
7961
|
+
const target = overrides[tier];
|
|
7962
|
+
return target === void 0 ? ANTIGRAVITY_DEFAULT_TIER_MODELS[tier] : candidatesOf(target);
|
|
7963
|
+
};
|
|
7964
|
+
return {
|
|
7965
|
+
mode: config?.mode ?? ANTIGRAVITY_DEFAULT_MODE,
|
|
7966
|
+
defaultModel: config?.defaultModel ?? ANTIGRAVITY_DEFAULT_MODEL,
|
|
7967
|
+
models: { fable: tierModel("fable"), opus: tierModel("opus"), sonnet: tierModel("sonnet"), haiku: tierModel("haiku") },
|
|
7968
|
+
aliases,
|
|
7969
|
+
degradeDownTiers: config?.degradeDownTiers ?? false,
|
|
7970
|
+
effort: config?.effort ?? ANTIGRAVITY_DEFAULT_EFFORT,
|
|
7971
|
+
cloud: {
|
|
7972
|
+
endpoint: config?.cloud?.endpoint,
|
|
7973
|
+
projectId: config?.cloud?.projectId,
|
|
7974
|
+
location: config?.cloud?.location
|
|
7975
|
+
},
|
|
7976
|
+
local: {
|
|
7977
|
+
command: config?.local?.command,
|
|
7978
|
+
socketPath: config?.local?.socketPath
|
|
7979
|
+
}
|
|
7980
|
+
};
|
|
7981
|
+
}
|
|
7982
|
+
var init_translate = __esm({
|
|
7983
|
+
"src/antigravity/translate.ts"() {
|
|
7984
|
+
"use strict";
|
|
7985
|
+
init_quota();
|
|
7986
|
+
init_signatures();
|
|
7987
|
+
init_schema();
|
|
7988
|
+
init_anthropic();
|
|
7989
|
+
}
|
|
7990
|
+
});
|
|
7991
|
+
|
|
7992
|
+
// src/codex/translate.ts
|
|
7993
|
+
function resolveCodexConfig(config) {
|
|
7994
|
+
const overrides = config?.models;
|
|
7995
|
+
return {
|
|
7996
|
+
defaultModel: config?.defaultModel ?? CODEX_DEFAULT_MODEL,
|
|
7997
|
+
models: {
|
|
7998
|
+
fable: overrides?.fable ?? CODEX_DEFAULT_TIER_MODELS.fable,
|
|
7999
|
+
opus: overrides?.opus ?? CODEX_DEFAULT_TIER_MODELS.opus,
|
|
8000
|
+
sonnet: overrides?.sonnet ?? CODEX_DEFAULT_TIER_MODELS.sonnet,
|
|
8001
|
+
haiku: overrides?.haiku ?? CODEX_DEFAULT_TIER_MODELS.haiku
|
|
8002
|
+
},
|
|
8003
|
+
effort: config?.effort ?? CODEX_DEFAULT_EFFORT,
|
|
8004
|
+
login: config?.login ?? CODEX_DEFAULT_LOGIN
|
|
8005
|
+
};
|
|
8006
|
+
}
|
|
8007
|
+
var init_translate2 = __esm({
|
|
8008
|
+
"src/codex/translate.ts"() {
|
|
8009
|
+
"use strict";
|
|
8010
|
+
init_schema();
|
|
8011
|
+
init_anthropic();
|
|
8012
|
+
}
|
|
8013
|
+
});
|
|
8014
|
+
|
|
8015
|
+
// src/launcher/modelPicker.ts
|
|
8016
|
+
function joined(parts) {
|
|
8017
|
+
const last = parts[parts.length - 1];
|
|
8018
|
+
return last === void 0 || parts.length === 1 ? last ?? "" : `${parts.slice(0, -1).join(", ")} and ${last}`;
|
|
8019
|
+
}
|
|
8020
|
+
function rowOf2(model, reaches) {
|
|
8021
|
+
const lead = reaches.find((reach) => reach.standing === "first") ?? reaches[0];
|
|
8022
|
+
if (lead === void 0) {
|
|
8023
|
+
throw new Error(`model ${model} is reached by no tier`);
|
|
8024
|
+
}
|
|
8025
|
+
const firsts = reaches.filter((reach) => reach.standing === "first").map((reach) => reach.tier);
|
|
8026
|
+
const fallbacks = reaches.filter((reach) => reach.standing === "fallback").map((reach) => reach.tier);
|
|
8027
|
+
const serves = firsts.length === 0 ? [] : [`Serves the ${joined(firsts)} tier${firsts.length === 1 ? "" : "s"}`];
|
|
8028
|
+
const falls = fallbacks.length === 0 ? [] : [`${serves.length === 0 ? "Fallback" : "fallback"} for ${joined(fallbacks)}`];
|
|
8029
|
+
return { model, label: model, description: [...serves, ...falls].join("; "), behavesAs: TIER_BEHAVES_AS[lead.tier] };
|
|
8030
|
+
}
|
|
8031
|
+
function rowsOfTable(table) {
|
|
8032
|
+
const reachesByModel = /* @__PURE__ */ new Map();
|
|
8033
|
+
for (const [tier, candidates] of table) {
|
|
8034
|
+
candidates.forEach((model, index) => {
|
|
8035
|
+
const reaches = reachesByModel.get(model) ?? [];
|
|
8036
|
+
if (!reaches.some((reach) => reach.tier === tier)) {
|
|
8037
|
+
reaches.push({ tier, standing: index === 0 ? "first" : "fallback" });
|
|
8038
|
+
}
|
|
8039
|
+
reachesByModel.set(model, reaches);
|
|
8040
|
+
});
|
|
8041
|
+
}
|
|
8042
|
+
return [...reachesByModel].map(([model, reaches]) => rowOf2(model, reaches));
|
|
8043
|
+
}
|
|
8044
|
+
function antigravityRows(provider) {
|
|
8045
|
+
const config = resolveAntigravityConfig(provider.antigravity);
|
|
8046
|
+
const tiers = rowsOfTable(ANTIGRAVITY_TIERS.map((tier) => [tier, config.models[tier]]));
|
|
8047
|
+
const behavesAsOf = new Map(tiers.map((row) => [row.model, row.behavesAs]));
|
|
8048
|
+
const aliases = [...config.aliases].flatMap(([alias, candidates]) => {
|
|
8049
|
+
const [first] = candidates;
|
|
8050
|
+
const behavesAs = first === void 0 ? void 0 : behavesAsOf.get(first);
|
|
8051
|
+
return behavesAs === void 0 ? [] : [{ model: alias, label: alias, description: `Alias for ${candidates.join(", then ")}`, behavesAs }];
|
|
8052
|
+
});
|
|
8053
|
+
return [...tiers, ...aliases];
|
|
8054
|
+
}
|
|
8055
|
+
function codexRows(provider) {
|
|
8056
|
+
const config = resolveCodexConfig(provider.codex);
|
|
8057
|
+
return rowsOfTable(CODEX_TIERS.map((tier) => [tier, [config.models[tier]]]));
|
|
8058
|
+
}
|
|
8059
|
+
function httpRows(provider) {
|
|
8060
|
+
const env = provider.env ?? {};
|
|
8061
|
+
const table = CODEX_TIERS.flatMap((tier) => {
|
|
8062
|
+
const model = env[TIER_ENV_VARIABLES[tier]];
|
|
8063
|
+
return model === void 0 || model === "" ? [] : [[tier, [model]]];
|
|
8064
|
+
});
|
|
8065
|
+
return rowsOfTable(table);
|
|
8066
|
+
}
|
|
8067
|
+
function providerModelRows(provider) {
|
|
8068
|
+
if (provider.kind === "codex") {
|
|
8069
|
+
return codexRows(provider);
|
|
8070
|
+
}
|
|
8071
|
+
if (provider.kind === "antigravity") {
|
|
8072
|
+
return antigravityRows(provider);
|
|
8073
|
+
}
|
|
8074
|
+
return httpRows(provider);
|
|
8075
|
+
}
|
|
8076
|
+
function modelPickerSettings(provider) {
|
|
8077
|
+
const options = providerModelRows(provider);
|
|
8078
|
+
return options.length === 0 ? void 0 : JSON.stringify({ modelPicker: { options, replaceBuiltInOptions: true } });
|
|
8079
|
+
}
|
|
8080
|
+
var TIER_BEHAVES_AS, TIER_ENV_VARIABLES;
|
|
8081
|
+
var init_modelPicker = __esm({
|
|
8082
|
+
"src/launcher/modelPicker.ts"() {
|
|
8083
|
+
"use strict";
|
|
8084
|
+
init_translate();
|
|
8085
|
+
init_translate2();
|
|
8086
|
+
init_schema();
|
|
8087
|
+
TIER_BEHAVES_AS = Object.freeze({
|
|
8088
|
+
fable: "claude-fable-5-1",
|
|
8089
|
+
opus: "claude-opus-5-5",
|
|
8090
|
+
sonnet: "claude-sonnet-5-5",
|
|
8091
|
+
haiku: "claude-haiku-5-5"
|
|
8092
|
+
});
|
|
8093
|
+
TIER_ENV_VARIABLES = Object.freeze({
|
|
8094
|
+
fable: "ANTHROPIC_DEFAULT_FABLE_MODEL",
|
|
8095
|
+
opus: "ANTHROPIC_DEFAULT_OPUS_MODEL",
|
|
8096
|
+
sonnet: "ANTHROPIC_DEFAULT_SONNET_MODEL",
|
|
8097
|
+
haiku: "ANTHROPIC_DEFAULT_HAIKU_MODEL"
|
|
8098
|
+
});
|
|
8099
|
+
}
|
|
8100
|
+
});
|
|
8101
|
+
|
|
7818
8102
|
// src/launcher/pool.ts
|
|
7819
8103
|
function isResuming(passthrough) {
|
|
7820
8104
|
const end = passthrough.indexOf(TERMINATOR3);
|
|
@@ -8239,10 +8523,16 @@ function decideLaunch(params, readOnly) {
|
|
|
8239
8523
|
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`);
|
|
8240
8524
|
}
|
|
8241
8525
|
const flags = loginlessProvider === void 0 ? requestedFlags : { ...requestedFlags, remoteControl: false };
|
|
8526
|
+
const pickerSettings = selectedProvider === void 0 ? void 0 : modelPickerSettings(selectedProvider.definition);
|
|
8527
|
+
const callerSettings = hasSettingsArgument(parsedArgv.rest);
|
|
8528
|
+
if (pickerSettings !== void 0 && callerSettings && !readOnly) {
|
|
8529
|
+
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");
|
|
8530
|
+
}
|
|
8531
|
+
const launcherSettings = mergeSettings([params.supervised?.settings, callerSettings ? void 0 : pickerSettings]);
|
|
8242
8532
|
const args = buildArgv({
|
|
8243
8533
|
toolFlags: buildFlagArgs(flags),
|
|
8244
8534
|
extraFlags: splitExtraFlags(env.CLAUDE_EXTRA_FLAGS),
|
|
8245
|
-
passthrough: params.supervised === void 0 ? parsedArgv.rest : withSupervision(parsedArgv.rest, params.supervised)
|
|
8535
|
+
passthrough: withLauncherSettings(params.supervised === void 0 ? parsedArgv.rest : withSupervision(parsedArgv.rest, params.supervised), launcherSettings)
|
|
8246
8536
|
});
|
|
8247
8537
|
const configDir = configDirEscapeHatchApplies || identityDecision.name === void 0 ? env.CLAUDE_CONFIG_DIR : import_node_path38.default.join(paths.identitiesDir, identityDecision.name);
|
|
8248
8538
|
const decision = {
|
|
@@ -8435,6 +8725,7 @@ var init_launcher = __esm({
|
|
|
8435
8725
|
init_flags();
|
|
8436
8726
|
init_extraFlags();
|
|
8437
8727
|
init_claudeSession();
|
|
8728
|
+
init_modelPicker();
|
|
8438
8729
|
init_pool();
|
|
8439
8730
|
init_resumeContext();
|
|
8440
8731
|
init_lock();
|
|
@@ -8915,84 +9206,77 @@ var init_identityClaude = __esm({
|
|
|
8915
9206
|
}
|
|
8916
9207
|
});
|
|
8917
9208
|
|
|
8918
|
-
// src/antigravity/cloudUpstream.ts
|
|
8919
|
-
var init_cloudUpstream = __esm({
|
|
8920
|
-
"src/antigravity/cloudUpstream.ts"() {
|
|
8921
|
-
"use strict";
|
|
8922
|
-
}
|
|
8923
|
-
});
|
|
8924
|
-
|
|
8925
9209
|
// src/usage/providerQuota.ts
|
|
8926
|
-
var
|
|
9210
|
+
var import_zod30, MS_PER_SECOND7, SECONDS_PER_HOUR2, HOURS_PER_DAY5, DAYS_PER_MONTH, ZAI_HOST, ZAI_QUOTA_URL, ZAI_UNIT_HOURS, ZAI_UNIT_MONTHS, ZAI_UNIT_MS, ZaiLimitSchema, ZaiResponseSchema, OPENROUTER_HOST, OPENROUTER_KEY_URL, OPENROUTER_CREDITS_URL, MS_PER_DAY3, OpenRouterKeySchema, OpenRouterCreditsSchema, ANTIGRAVITY_HOST, ANTIGRAVITY_QUOTA_URL, ANTIGRAVITY_USER_URL, FIVE_HOURS2, DAYS_PER_WEEK2, FIVE_HOURS_MS, WEEK_MS, AntigravityBucketSchema, AntigravitySummarySchema, GoogleTokenInfoSchema, AntigravityUserSchema;
|
|
8927
9211
|
var init_providerQuota = __esm({
|
|
8928
9212
|
"src/usage/providerQuota.ts"() {
|
|
8929
9213
|
"use strict";
|
|
8930
|
-
|
|
9214
|
+
import_zod30 = require("zod");
|
|
8931
9215
|
init_cloudUpstream();
|
|
8932
9216
|
init_schema2();
|
|
8933
9217
|
MS_PER_SECOND7 = 1e3;
|
|
8934
|
-
|
|
8935
|
-
|
|
9218
|
+
SECONDS_PER_HOUR2 = 3600;
|
|
9219
|
+
HOURS_PER_DAY5 = 24;
|
|
8936
9220
|
DAYS_PER_MONTH = 30;
|
|
8937
9221
|
ZAI_HOST = "api.z.ai";
|
|
8938
9222
|
ZAI_QUOTA_URL = `https://${ZAI_HOST}/api/monitor/usage/quota/limit`;
|
|
8939
9223
|
ZAI_UNIT_HOURS = 3;
|
|
8940
9224
|
ZAI_UNIT_MONTHS = 5;
|
|
8941
9225
|
ZAI_UNIT_MS = /* @__PURE__ */ new Map([
|
|
8942
|
-
[ZAI_UNIT_HOURS,
|
|
8943
|
-
[ZAI_UNIT_MONTHS, DAYS_PER_MONTH *
|
|
9226
|
+
[ZAI_UNIT_HOURS, SECONDS_PER_HOUR2 * MS_PER_SECOND7],
|
|
9227
|
+
[ZAI_UNIT_MONTHS, DAYS_PER_MONTH * HOURS_PER_DAY5 * SECONDS_PER_HOUR2 * MS_PER_SECOND7]
|
|
8944
9228
|
]);
|
|
8945
|
-
ZaiLimitSchema =
|
|
8946
|
-
type:
|
|
8947
|
-
unit:
|
|
8948
|
-
number:
|
|
8949
|
-
percentage:
|
|
8950
|
-
nextResetTime:
|
|
8951
|
-
usage:
|
|
8952
|
-
currentValue:
|
|
8953
|
-
remaining:
|
|
9229
|
+
ZaiLimitSchema = import_zod30.z.object({
|
|
9230
|
+
type: import_zod30.z.string(),
|
|
9231
|
+
unit: import_zod30.z.number().int(),
|
|
9232
|
+
number: import_zod30.z.number().int().positive(),
|
|
9233
|
+
percentage: import_zod30.z.number().nonnegative(),
|
|
9234
|
+
nextResetTime: import_zod30.z.number().positive().optional(),
|
|
9235
|
+
usage: import_zod30.z.number().nonnegative().optional(),
|
|
9236
|
+
currentValue: import_zod30.z.number().nonnegative().optional(),
|
|
9237
|
+
remaining: import_zod30.z.number().nonnegative().optional()
|
|
8954
9238
|
});
|
|
8955
|
-
ZaiResponseSchema =
|
|
8956
|
-
success:
|
|
8957
|
-
msg:
|
|
8958
|
-
data:
|
|
9239
|
+
ZaiResponseSchema = import_zod30.z.object({
|
|
9240
|
+
success: import_zod30.z.boolean(),
|
|
9241
|
+
msg: import_zod30.z.string().optional(),
|
|
9242
|
+
data: import_zod30.z.object({ level: import_zod30.z.string().optional(), limits: import_zod30.z.array(ZaiLimitSchema) })
|
|
8959
9243
|
});
|
|
8960
9244
|
OPENROUTER_HOST = "openrouter.ai";
|
|
8961
9245
|
OPENROUTER_KEY_URL = `https://${OPENROUTER_HOST}/api/v1/key`;
|
|
8962
9246
|
OPENROUTER_CREDITS_URL = `https://${OPENROUTER_HOST}/api/v1/credits`;
|
|
8963
|
-
MS_PER_DAY3 =
|
|
8964
|
-
OpenRouterKeySchema =
|
|
8965
|
-
data:
|
|
8966
|
-
limit:
|
|
8967
|
-
limit_remaining:
|
|
8968
|
-
limit_reset:
|
|
8969
|
-
is_free_tier:
|
|
8970
|
-
free_model_daily_requests:
|
|
9247
|
+
MS_PER_DAY3 = HOURS_PER_DAY5 * SECONDS_PER_HOUR2 * MS_PER_SECOND7;
|
|
9248
|
+
OpenRouterKeySchema = import_zod30.z.object({
|
|
9249
|
+
data: import_zod30.z.object({
|
|
9250
|
+
limit: import_zod30.z.number().nonnegative().nullable(),
|
|
9251
|
+
limit_remaining: import_zod30.z.number().nullable(),
|
|
9252
|
+
limit_reset: import_zod30.z.string().nullable(),
|
|
9253
|
+
is_free_tier: import_zod30.z.boolean().optional(),
|
|
9254
|
+
free_model_daily_requests: import_zod30.z.object({ used: import_zod30.z.number().nonnegative(), limit: import_zod30.z.number().nonnegative(), remaining: import_zod30.z.number() }).optional()
|
|
8971
9255
|
})
|
|
8972
9256
|
});
|
|
8973
|
-
OpenRouterCreditsSchema =
|
|
9257
|
+
OpenRouterCreditsSchema = import_zod30.z.object({ data: import_zod30.z.object({ total_credits: import_zod30.z.number().nonnegative(), total_usage: import_zod30.z.number().nonnegative() }) });
|
|
8974
9258
|
ANTIGRAVITY_HOST = "daily-cloudcode-pa.googleapis.com";
|
|
8975
9259
|
ANTIGRAVITY_QUOTA_URL = `https://${ANTIGRAVITY_HOST}/v1internal:retrieveUserQuotaSummary`;
|
|
8976
9260
|
ANTIGRAVITY_USER_URL = `https://${ANTIGRAVITY_HOST}/v1internal:loadCodeAssist`;
|
|
8977
9261
|
FIVE_HOURS2 = 5;
|
|
8978
|
-
|
|
8979
|
-
FIVE_HOURS_MS = FIVE_HOURS2 *
|
|
8980
|
-
WEEK_MS =
|
|
8981
|
-
AntigravityBucketSchema =
|
|
8982
|
-
bucketId:
|
|
8983
|
-
remainingFraction:
|
|
8984
|
-
resetTime:
|
|
9262
|
+
DAYS_PER_WEEK2 = 7;
|
|
9263
|
+
FIVE_HOURS_MS = FIVE_HOURS2 * SECONDS_PER_HOUR2 * MS_PER_SECOND7;
|
|
9264
|
+
WEEK_MS = DAYS_PER_WEEK2 * HOURS_PER_DAY5 * SECONDS_PER_HOUR2 * MS_PER_SECOND7;
|
|
9265
|
+
AntigravityBucketSchema = import_zod30.z.object({
|
|
9266
|
+
bucketId: import_zod30.z.string(),
|
|
9267
|
+
remainingFraction: import_zod30.z.number().optional(),
|
|
9268
|
+
resetTime: import_zod30.z.string().optional()
|
|
8985
9269
|
});
|
|
8986
|
-
AntigravitySummarySchema =
|
|
8987
|
-
GoogleTokenInfoSchema =
|
|
8988
|
-
email:
|
|
8989
|
-
sub:
|
|
9270
|
+
AntigravitySummarySchema = import_zod30.z.object({ groups: import_zod30.z.array(import_zod30.z.object({ buckets: import_zod30.z.array(AntigravityBucketSchema) })) });
|
|
9271
|
+
GoogleTokenInfoSchema = import_zod30.z.object({
|
|
9272
|
+
email: import_zod30.z.string().optional(),
|
|
9273
|
+
sub: import_zod30.z.string().optional()
|
|
8990
9274
|
});
|
|
8991
|
-
AntigravityUserSchema =
|
|
9275
|
+
AntigravityUserSchema = import_zod30.z.object({
|
|
8992
9276
|
/** The code-assist tier context, which defaults to the free tier for every account. */
|
|
8993
|
-
currentTier:
|
|
9277
|
+
currentTier: import_zod30.z.object({ name: import_zod30.z.string().optional(), id: import_zod30.z.string().optional() }).optional(),
|
|
8994
9278
|
/** The account's paid subscription; absent when the account has none. */
|
|
8995
|
-
paidTier:
|
|
9279
|
+
paidTier: import_zod30.z.object({ name: import_zod30.z.string().optional(), id: import_zod30.z.string().optional() }).optional()
|
|
8996
9280
|
});
|
|
8997
9281
|
}
|
|
8998
9282
|
});
|
|
@@ -16910,7 +17194,7 @@ function numberOf(record, field) {
|
|
|
16910
17194
|
}
|
|
16911
17195
|
return void 0;
|
|
16912
17196
|
}
|
|
16913
|
-
function pageOfRcChannel(url, rows, idOf,
|
|
17197
|
+
function pageOfRcChannel(url, rows, idOf, rowOf3) {
|
|
16914
17198
|
const query = new URL(url, "http://127.0.0.1").searchParams;
|
|
16915
17199
|
const anchor = query.get("after_event_id") ?? query.get("cursor");
|
|
16916
17200
|
const rawLimit = query.get("limit");
|
|
@@ -16924,7 +17208,7 @@ function pageOfRcChannel(url, rows, idOf, rowOf2) {
|
|
|
16924
17208
|
}
|
|
16925
17209
|
const page = limit === void 0 ? rows.slice(from) : rows.slice(from, from + limit);
|
|
16926
17210
|
const last = page[page.length - 1];
|
|
16927
|
-
return { data: page.map(
|
|
17211
|
+
return { data: page.map(rowOf3), ...last === void 0 ? {} : { next_cursor: idOf(last) } };
|
|
16928
17212
|
}
|
|
16929
17213
|
async function serveRcClientChannels(ctx, tail, method, maxBatchEvents) {
|
|
16930
17214
|
const { request: request4, response, host } = ctx;
|