claude-use 11.33.0 → 11.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/cli.cjs +157 -58
- package/dist/index.cjs +84 -40
- package/dist/index.mjs +84 -40
- package/dist/types/index.d.ts +72 -27
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -231,6 +231,9 @@ function isHttpProvider(provider) {
|
|
|
231
231
|
function isCodexProvider(provider) {
|
|
232
232
|
return provider.kind === "codex";
|
|
233
233
|
}
|
|
234
|
+
function isRouterProvider(provider) {
|
|
235
|
+
return provider.kind === "router";
|
|
236
|
+
}
|
|
234
237
|
function isAntigravityProvider(provider) {
|
|
235
238
|
return provider.kind === "antigravity";
|
|
236
239
|
}
|
|
@@ -245,7 +248,7 @@ function isTimeZone(name) {
|
|
|
245
248
|
return false;
|
|
246
249
|
}
|
|
247
250
|
}
|
|
248
|
-
var import_node_path2, import_zod, import_trilean, CATEGORY_NAMES, OVERRIDABLE_CATEGORIES, CategoryMapSchema, DURATION_RE, DurationSchema, WhenConditionObjectSchema, WhenSchema, EntryValueSchema, ENTRY_KEY_RE, EntriesSchema, LaunchSchema, CREDENTIAL_TARGETS, PROVIDER_CREDENTIAL_TARGETS, CREDENTIAL_TARGET_VARS, ArgvSchema, CommandSourceOptions, EnvCredentialSourceSchema, FileCredentialSourceSchema, CommandCredentialSourceSchema, OpCredentialSourceSchema, KeychainCredentialSourceSchema, LiteralCredentialSourceSchema, CredentialSourceSchema, RemoteCredentialSourceSchema, CREDENTIAL_CACHE_STORES, CredentialCacheSchema, CredentialSchema, ProviderCredentialSchema, RESERVED_PROVIDER_ENV_KEYS, ProviderEnvSchema, PROVIDER_KINDS, ANTIGRAVITY_MODES, CLAUDE_TIERS, ANTIGRAVITY_EFFORTS, ANTIGRAVITY_DEFAULT_MODE, ANTIGRAVITY_DEFAULT_MODEL, ANTIGRAVITY_DEFAULT_TIER_MODELS, ANTIGRAVITY_DEFAULT_EFFORT, AntigravityModelTargetSchema, AntigravityProviderConfigSchema, CODEX_EFFORTS, CODEX_LOGINS, CODEX_DEFAULT_LOGIN, CODEX_DEFAULT_MODEL, CODEX_DEFAULT_TIER_MODELS, CODEX_DEFAULT_EFFORT, CodexProviderConfigSchema, ProviderRouteSchema, PickerModelSchema, PickerModelsSchema, ProviderCatalogueSchema, HttpProviderSchema, CodexProviderSchema, AntigravityProviderSchema, ProviderSchema, SELECTION_MODES, VirtualModelSchema, ModelPricesSchema, ModelsConfigSchema, ModelsLayerSchema, ConfigProfileSchema, POOL_SELECTOR_PREFIX, POOL_NAME_PATTERN, IDENTITY_NAME_PATTERN, PoolNameSchema, SELECTOR_RE, IdentitySelectorSchema, PoolMemberSchema, POOL_PREFERENCES, PoolPreferenceSchema, WHOLE_PERCENT_MAX, CompactAtUtilisationSchema, PoolSchema, WEEKDAYS, AnchorSchema, JOB_WINDOWS, JobTriggerSchema, JobTargetSchema, JobSchema, DirectoryRuleSchema, DirectoryRulesSchema, PortableConfigSchema, HEADROOM_MODES, HEADROOM_CCR_MODES, HEADROOM_ROLLOUT_CHANNELS, INTERCEPT_CHANNELS, READ_MATURATION_CHANNELS, HeadroomGlobalConfigObjectSchema, HeadroomGlobalConfigSchema, HEADROOM_DEFAULT_SOURCE, HEADROOM_DEFAULT_IDLE_SHUTDOWN_MINUTES, FrontDoorGlobalConfigSchema, UPDATE_MODES, UpdateGlobalConfigSchema, GlobalConfigSchema, IdentitySchema, CategoryClassificationSchema, CategoryClassificationOverlaySchema, SHIPPED_CATEGORY_DEFAULTS;
|
|
251
|
+
var import_node_path2, import_zod, import_trilean, CATEGORY_NAMES, OVERRIDABLE_CATEGORIES, CategoryMapSchema, DURATION_RE, DurationSchema, WhenConditionObjectSchema, WhenSchema, EntryValueSchema, ENTRY_KEY_RE, EntriesSchema, LaunchSchema, CREDENTIAL_TARGETS, PROVIDER_CREDENTIAL_TARGETS, CREDENTIAL_TARGET_VARS, ArgvSchema, CommandSourceOptions, EnvCredentialSourceSchema, FileCredentialSourceSchema, CommandCredentialSourceSchema, OpCredentialSourceSchema, KeychainCredentialSourceSchema, LiteralCredentialSourceSchema, CredentialSourceSchema, RemoteCredentialSourceSchema, CREDENTIAL_CACHE_STORES, CredentialCacheSchema, CredentialSchema, ProviderCredentialSchema, RESERVED_PROVIDER_ENV_KEYS, ProviderEnvSchema, PROVIDER_KINDS, ANTIGRAVITY_MODES, CLAUDE_TIERS, ANTIGRAVITY_EFFORTS, ANTIGRAVITY_DEFAULT_MODE, ANTIGRAVITY_DEFAULT_MODEL, ANTIGRAVITY_DEFAULT_TIER_MODELS, ANTIGRAVITY_DEFAULT_EFFORT, AntigravityModelTargetSchema, AntigravityProviderConfigSchema, CODEX_EFFORTS, CODEX_LOGINS, CODEX_DEFAULT_LOGIN, CODEX_DEFAULT_MODEL, CODEX_DEFAULT_TIER_MODELS, CODEX_DEFAULT_EFFORT, CodexProviderConfigSchema, ProviderRouteSchema, PickerModelSchema, PickerModelsSchema, ProviderCatalogueSchema, HttpProviderSchema, CodexProviderSchema, RouterProviderSchema, AntigravityProviderSchema, ProviderSchema, SELECTION_MODES, VirtualModelSchema, ModelPricesSchema, ModelsConfigSchema, ModelsLayerSchema, ConfigProfileSchema, POOL_SELECTOR_PREFIX, POOL_NAME_PATTERN, IDENTITY_NAME_PATTERN, PoolNameSchema, SELECTOR_RE, IdentitySelectorSchema, PoolMemberSchema, POOL_PREFERENCES, PoolPreferenceSchema, WHOLE_PERCENT_MAX, CompactAtUtilisationSchema, PoolSchema, WEEKDAYS, AnchorSchema, JOB_WINDOWS, JobTriggerSchema, JobTargetSchema, JobSchema, DirectoryRuleSchema, DirectoryRulesSchema, PortableConfigSchema, HEADROOM_MODES, HEADROOM_CCR_MODES, HEADROOM_ROLLOUT_CHANNELS, INTERCEPT_CHANNELS, READ_MATURATION_CHANNELS, HeadroomGlobalConfigObjectSchema, HeadroomGlobalConfigSchema, HEADROOM_DEFAULT_SOURCE, HEADROOM_DEFAULT_IDLE_SHUTDOWN_MINUTES, FrontDoorGlobalConfigSchema, UPDATE_MODES, UpdateGlobalConfigSchema, GlobalConfigSchema, IdentitySchema, CategoryClassificationSchema, CategoryClassificationOverlaySchema, SHIPPED_CATEGORY_DEFAULTS;
|
|
249
252
|
var init_schema = __esm({
|
|
250
253
|
"src/config/schema.ts"() {
|
|
251
254
|
"use strict";
|
|
@@ -290,6 +293,8 @@ var init_schema = __esm({
|
|
|
290
293
|
delay: import_zod.z.string().regex(DURATION_RE, "must be a duration such as 5s or 500ms").optional(),
|
|
291
294
|
/** 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. */
|
|
292
295
|
pause: import_zod.z.boolean().optional(),
|
|
296
|
+
/** 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. */
|
|
297
|
+
routeByName: import_zod.z.boolean().optional(),
|
|
293
298
|
/** 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. */
|
|
294
299
|
explain: import_zod.z.boolean().optional()
|
|
295
300
|
});
|
|
@@ -350,7 +355,7 @@ var init_schema = __esm({
|
|
|
350
355
|
ProviderEnvSchema = import_zod.z.record(import_zod.z.string().min(1), import_zod.z.string()).refine((env) => !Object.keys(env).some((key) => RESERVED_PROVIDER_ENV_KEYS.includes(key)), {
|
|
351
356
|
message: `env may not set ${RESERVED_PROVIDER_ENV_KEYS.join(", ")}: the credential block's target sets one and agent-shim removes the others`
|
|
352
357
|
});
|
|
353
|
-
PROVIDER_KINDS = ["http", "codex", "antigravity"];
|
|
358
|
+
PROVIDER_KINDS = ["http", "codex", "antigravity", "router"];
|
|
354
359
|
ANTIGRAVITY_MODES = ["cloud", "local"];
|
|
355
360
|
CLAUDE_TIERS = ["fable", "opus", "sonnet", "haiku"];
|
|
356
361
|
ANTIGRAVITY_EFFORTS = ["none", "low", "medium", "high", "xhigh", "max"];
|
|
@@ -463,6 +468,11 @@ var init_schema = __esm({
|
|
|
463
468
|
pickerModels: PickerModelsSchema.optional(),
|
|
464
469
|
codex: CodexProviderConfigSchema.optional()
|
|
465
470
|
});
|
|
471
|
+
RouterProviderSchema = import_zod.z.strictObject({
|
|
472
|
+
$schema: import_zod.z.string().optional(),
|
|
473
|
+
kind: import_zod.z.literal("router"),
|
|
474
|
+
displayName: import_zod.z.string().min(1)
|
|
475
|
+
});
|
|
466
476
|
AntigravityProviderSchema = import_zod.z.strictObject({
|
|
467
477
|
$schema: import_zod.z.string().optional(),
|
|
468
478
|
kind: import_zod.z.literal("antigravity"),
|
|
@@ -473,7 +483,7 @@ var init_schema = __esm({
|
|
|
473
483
|
pickerModels: PickerModelsSchema.optional(),
|
|
474
484
|
antigravity: AntigravityProviderConfigSchema.optional()
|
|
475
485
|
});
|
|
476
|
-
ProviderSchema = import_zod.z.discriminatedUnion("kind", [HttpProviderSchema, CodexProviderSchema, AntigravityProviderSchema]);
|
|
486
|
+
ProviderSchema = import_zod.z.discriminatedUnion("kind", [HttpProviderSchema, CodexProviderSchema, AntigravityProviderSchema, RouterProviderSchema]);
|
|
477
487
|
SELECTION_MODES = ["ordered", "most-allowance", "soonest-reset", "spread", "adaptive", "lowest-latency", "highest-success", "cheapest"];
|
|
478
488
|
VirtualModelSchema = import_zod.z.strictObject({
|
|
479
489
|
/** How the virtual model chooses its member for a request. */
|
|
@@ -1446,6 +1456,9 @@ function flattenLayers(layers, options) {
|
|
|
1446
1456
|
if (layer.launch.explain !== void 0) {
|
|
1447
1457
|
launch.explain = layer.launch.explain;
|
|
1448
1458
|
}
|
|
1459
|
+
if (layer.launch.routeByName !== void 0) {
|
|
1460
|
+
launch.routeByName = layer.launch.routeByName;
|
|
1461
|
+
}
|
|
1449
1462
|
}
|
|
1450
1463
|
if (layer.models !== void 0) {
|
|
1451
1464
|
models = mergeModels(models, layer.models);
|
|
@@ -2876,7 +2889,7 @@ var init_capability = __esm({
|
|
|
2876
2889
|
});
|
|
2877
2890
|
|
|
2878
2891
|
// src/frontdoor/route.ts
|
|
2879
|
-
var IDENTITY_HEADER, SESSION_HEADER, PROVIDER_HEADER, HEADROOM_FLAG_HEADER, PROJECT_ID_HEADER, AUTH_HEADER;
|
|
2892
|
+
var IDENTITY_HEADER, SESSION_HEADER, PROVIDER_HEADER, HEADROOM_FLAG_HEADER, ROUTE_BY_NAME_HEADER, PROJECT_ID_HEADER, AUTH_HEADER;
|
|
2880
2893
|
var init_route = __esm({
|
|
2881
2894
|
"src/frontdoor/route.ts"() {
|
|
2882
2895
|
"use strict";
|
|
@@ -2884,6 +2897,7 @@ var init_route = __esm({
|
|
|
2884
2897
|
SESSION_HEADER = "x-agent-shim-session";
|
|
2885
2898
|
PROVIDER_HEADER = "x-agent-shim-provider";
|
|
2886
2899
|
HEADROOM_FLAG_HEADER = "x-agent-shim-headroom";
|
|
2900
|
+
ROUTE_BY_NAME_HEADER = "x-agent-shim-route-by-name";
|
|
2887
2901
|
PROJECT_ID_HEADER = "x-headroom-project-id";
|
|
2888
2902
|
AUTH_HEADER = "x-agent-shim-auth";
|
|
2889
2903
|
}
|
|
@@ -3092,7 +3106,7 @@ var init_package = __esm({
|
|
|
3092
3106
|
"package.json"() {
|
|
3093
3107
|
package_default = {
|
|
3094
3108
|
name: "claude-use",
|
|
3095
|
-
version: "11.
|
|
3109
|
+
version: "11.35.0",
|
|
3096
3110
|
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.",
|
|
3097
3111
|
license: "MIT",
|
|
3098
3112
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -6793,7 +6807,7 @@ function describeProviderEndpoint(provider) {
|
|
|
6793
6807
|
if (isAntigravityProvider(provider)) {
|
|
6794
6808
|
return (provider.antigravity?.mode ?? ANTIGRAVITY_DEFAULT_MODE) === "local" ? "antigravity local (ACP daemon)" : "antigravity cloud (Gemini API)";
|
|
6795
6809
|
}
|
|
6796
|
-
return provider.baseUrl;
|
|
6810
|
+
return isRouterProvider(provider) ? "the models block" : provider.baseUrl;
|
|
6797
6811
|
}
|
|
6798
6812
|
function isEmptyCodexConfig(config) {
|
|
6799
6813
|
return config === void 0 || config.defaultModel === void 0 && config.effort === void 0 && config.login === void 0 && (config.models === void 0 || Object.keys(config.models).length === 0);
|
|
@@ -6815,10 +6829,16 @@ function addProvider(paths, name, input) {
|
|
|
6815
6829
|
if (kind === "antigravity" && input.baseUrl !== void 0) {
|
|
6816
6830
|
throw new ProviderKindMismatchError("An antigravity provider has no base URL: the launcher points its sessions at the front-door daemon. Drop --base-url.");
|
|
6817
6831
|
}
|
|
6832
|
+
if (kind === "router" && input.baseUrl !== void 0) {
|
|
6833
|
+
throw new ProviderKindMismatchError("A router provider has no base URL: it resolves each request's model name through the models block. Drop --base-url.");
|
|
6834
|
+
}
|
|
6818
6835
|
if (kind === "http" && input.baseUrl === void 0) {
|
|
6819
6836
|
throw new ProviderKindMismatchError("An http provider needs --base-url.");
|
|
6820
6837
|
}
|
|
6821
|
-
if (kind
|
|
6838
|
+
if (kind === "router" && (input.sources.length > 0 || input.target !== void 0 || input.env !== void 0 || input.pickerModels !== void 0)) {
|
|
6839
|
+
throw new ProviderKindMismatchError("A router provider has no credential, env or picker models of its own: the models block's targets carry their own.");
|
|
6840
|
+
}
|
|
6841
|
+
if (kind !== "http" && kind !== "router" && input.catalogue !== void 0) {
|
|
6822
6842
|
throw new ProviderKindMismatchError("A model catalogue applies only to an http provider.");
|
|
6823
6843
|
}
|
|
6824
6844
|
if (kind !== "codex" && !isEmptyCodexConfig(input.codex)) {
|
|
@@ -6834,7 +6854,7 @@ function addProvider(paths, name, input) {
|
|
|
6834
6854
|
...input.pickerModels === void 0 || input.pickerModels.length === 0 ? {} : { pickerModels: input.pickerModels }
|
|
6835
6855
|
};
|
|
6836
6856
|
const parsed = ProviderSchema.safeParse(
|
|
6837
|
-
kind === "codex" ? { kind, ...shared, ...isEmptyCodexConfig(input.codex) ? {} : { codex: input.codex } } : kind === "antigravity" ? { kind, ...shared, ...isEmptyAntigravityConfig(input.antigravity) ? {} : { antigravity: input.antigravity } } : { ...shared, baseUrl: input.baseUrl, ...input.catalogue === void 0 ? {} : { catalogue: input.catalogue } }
|
|
6857
|
+
kind === "router" ? { kind, displayName: input.displayName } : kind === "codex" ? { kind, ...shared, ...isEmptyCodexConfig(input.codex) ? {} : { codex: input.codex } } : kind === "antigravity" ? { kind, ...shared, ...isEmptyAntigravityConfig(input.antigravity) ? {} : { antigravity: input.antigravity } } : { ...shared, baseUrl: input.baseUrl, ...input.catalogue === void 0 ? {} : { catalogue: input.catalogue } }
|
|
6838
6858
|
);
|
|
6839
6859
|
if (!parsed.success) {
|
|
6840
6860
|
throw new ConfigValidationError(providerJsonPath(paths, name), parsed.error.issues);
|
|
@@ -6848,15 +6868,18 @@ function updateProvider(paths, name, input) {
|
|
|
6848
6868
|
throw new ProviderNotFoundError(name);
|
|
6849
6869
|
}
|
|
6850
6870
|
const unset = new Set(input.unsetEnv);
|
|
6851
|
-
const
|
|
6871
|
+
const existingEnv = isRouterProvider(existing) ? {} : existing.env;
|
|
6872
|
+
const env = Object.fromEntries(Object.entries({ ...existingEnv, ...input.env }).filter(([key]) => !unset.has(key)));
|
|
6852
6873
|
const unsetPicker = new Set(input.unsetPickerModels);
|
|
6853
6874
|
const added = new Map((input.pickerModels ?? []).map((entry) => [entry.model, entry]));
|
|
6875
|
+
const existingPicker = isRouterProvider(existing) ? [] : existing.pickerModels;
|
|
6854
6876
|
const pickerModels = [
|
|
6855
|
-
...(
|
|
6856
|
-
...[...added.values()].filter((entry) => !(
|
|
6877
|
+
...(existingPicker ?? []).filter((entry) => !unsetPicker.has(entry.model)).map((entry) => added.get(entry.model) ?? entry),
|
|
6878
|
+
...[...added.values()].filter((entry) => !(existingPicker ?? []).some((kept) => kept.model === entry.model))
|
|
6857
6879
|
];
|
|
6858
|
-
const
|
|
6859
|
-
const
|
|
6880
|
+
const router = isRouterProvider(existing);
|
|
6881
|
+
const target = router ? void 0 : input.target ?? existing.credential.target;
|
|
6882
|
+
const cache = router ? void 0 : input.cache === void 0 ? existing.credential.cache : input.cache === false ? void 0 : input.cache;
|
|
6860
6883
|
if (isCodexProvider(existing) && input.baseUrl !== void 0) {
|
|
6861
6884
|
throw new ProviderKindMismatchError(`Provider "${name}" is a codex provider, which has no base URL.`);
|
|
6862
6885
|
}
|
|
@@ -6874,10 +6897,12 @@ function updateProvider(paths, name, input) {
|
|
|
6874
6897
|
}
|
|
6875
6898
|
const shared = {
|
|
6876
6899
|
...input.displayName === void 0 ? {} : { displayName: input.displayName },
|
|
6877
|
-
|
|
6878
|
-
|
|
6879
|
-
|
|
6880
|
-
|
|
6900
|
+
...router ? {} : {
|
|
6901
|
+
credential: {
|
|
6902
|
+
sources: input.sources ?? existing.credential.sources,
|
|
6903
|
+
...target === void 0 ? {} : { target },
|
|
6904
|
+
...cache === void 0 ? {} : { cache }
|
|
6905
|
+
}
|
|
6881
6906
|
},
|
|
6882
6907
|
env: Object.keys(env).length === 0 ? void 0 : env,
|
|
6883
6908
|
pickerModels: pickerModels.length === 0 ? void 0 : pickerModels
|
|
@@ -6897,6 +6922,8 @@ function updateProvider(paths, name, input) {
|
|
|
6897
6922
|
...existing.antigravity?.models === void 0 && input.antigravity?.models === void 0 ? {} : { models: { ...existing.antigravity?.models, ...input.antigravity?.models } }
|
|
6898
6923
|
};
|
|
6899
6924
|
candidate = { ...existing, ...shared, antigravity: isEmptyAntigravityConfig(antigravity) ? void 0 : antigravity };
|
|
6925
|
+
} else if (router) {
|
|
6926
|
+
candidate = { kind: "router", ...shared };
|
|
6900
6927
|
} else {
|
|
6901
6928
|
const catalogue = input.catalogue === void 0 ? existing.catalogue : input.catalogue === false ? void 0 : input.catalogue;
|
|
6902
6929
|
candidate = { ...existing, ...shared, catalogue, ...input.baseUrl === void 0 ? {} : { baseUrl: input.baseUrl } };
|
|
@@ -6946,6 +6973,9 @@ function resolveProvider(params) {
|
|
|
6946
6973
|
return selection;
|
|
6947
6974
|
}
|
|
6948
6975
|
const { name, definition } = selection.provider;
|
|
6976
|
+
if (isRouterProvider(definition)) {
|
|
6977
|
+
return { ok: true, provider: { name, definition, credential: { target: "bearer", token: "", source: { env: "AGENT_SHIM_ROUTER" }, warnings: [] } }, warnings: [] };
|
|
6978
|
+
}
|
|
6949
6979
|
if (params.credentials === void 0) {
|
|
6950
6980
|
return { ok: false, status: 1, message: `agent-shim: provider ${name} needs its credential resolved, but this launcher has no credential port wired` };
|
|
6951
6981
|
}
|
|
@@ -7693,7 +7723,8 @@ var init_argv = __esm({
|
|
|
7693
7723
|
{ flag: "--remote-control", key: "remoteControl" },
|
|
7694
7724
|
{ flag: "--wait", key: "wait" },
|
|
7695
7725
|
{ flag: "--pause", key: "pause" },
|
|
7696
|
-
{ flag: "--explain", key: "explain" }
|
|
7726
|
+
{ flag: "--explain", key: "explain" },
|
|
7727
|
+
{ flag: "--route-by-name", key: "routeByName" }
|
|
7697
7728
|
];
|
|
7698
7729
|
LAUNCHER_FLAG_NAMES = [
|
|
7699
7730
|
...VALUED_FLAGS,
|
|
@@ -7883,6 +7914,7 @@ function resolveLaunchFlags(params) {
|
|
|
7883
7914
|
trackUsage: params.flags?.trackUsage ?? parseEnvBool("AGENT_SHIM_TRACK_USAGE", params.env.AGENT_SHIM_TRACK_USAGE) ?? params.cascade?.trackUsage ?? true,
|
|
7884
7915
|
pause: params.flags?.pause ?? parseEnvBool("AGENT_SHIM_PAUSE", params.env.AGENT_SHIM_PAUSE) ?? params.cascade?.pause ?? false,
|
|
7885
7916
|
explain: params.flags?.explain ?? parseEnvBool("AGENT_SHIM_EXPLAIN", params.env.AGENT_SHIM_EXPLAIN) ?? params.cascade?.explain ?? false,
|
|
7917
|
+
routeByName: params.flags?.routeByName ?? parseEnvBool("AGENT_SHIM_ROUTE_BY_NAME", params.env.AGENT_SHIM_ROUTE_BY_NAME) ?? params.cascade?.routeByName ?? false,
|
|
7886
7918
|
delayMs: resolveDelayMs(params)
|
|
7887
7919
|
};
|
|
7888
7920
|
}
|
|
@@ -7923,7 +7955,7 @@ function buildEnv(params) {
|
|
|
7923
7955
|
env.CLAUDE_CONFIG_DIR = import_node_path36.default.join(params.identitiesDir, params.resolvedIdentityName);
|
|
7924
7956
|
}
|
|
7925
7957
|
if (params.provider !== void 0) {
|
|
7926
|
-
const providerEnv = params.provider.definition.env ?? {};
|
|
7958
|
+
const providerEnv = params.provider.definition.kind !== void 0 && params.provider.definition.kind !== "http" ? {} : params.provider.definition.env ?? {};
|
|
7927
7959
|
providerCustomHeaders = providerEnv.ANTHROPIC_CUSTOM_HEADERS;
|
|
7928
7960
|
env.ANTHROPIC_BASE_URL = void 0;
|
|
7929
7961
|
env.AGENT_SHIM_PROVIDER = params.provider.definition.displayName;
|
|
@@ -7951,6 +7983,7 @@ function buildEnv(params) {
|
|
|
7951
7983
|
{ name: SESSION_HEADER, value: params.sessionId },
|
|
7952
7984
|
{ name: AUTH_HEADER, value: params.frontdoor.sessionToken },
|
|
7953
7985
|
...params.provider === void 0 ? [] : [{ name: PROVIDER_HEADER, value: params.provider.name }],
|
|
7986
|
+
...params.routeByName ? [{ name: ROUTE_BY_NAME_HEADER, value: "1" }] : [],
|
|
7954
7987
|
...params.headroom === void 0 ? [] : [
|
|
7955
7988
|
{ name: HEADROOM_FLAG_HEADER, value: "1" },
|
|
7956
7989
|
{ name: PROJECT_ID_HEADER, value: params.headroom.projectId }
|
|
@@ -8586,8 +8619,8 @@ function catalogueRows(provider, models) {
|
|
|
8586
8619
|
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));
|
|
8587
8620
|
}
|
|
8588
8621
|
function providerModelRows(provider, catalogue = []) {
|
|
8589
|
-
const derived = provider.kind === "codex" ? codexRows(provider) : provider.kind === "antigravity" ? antigravityRows(provider) : httpRows(provider);
|
|
8590
|
-
const declared = (provider.pickerModels ?? []).map(declaredRow);
|
|
8622
|
+
const derived = provider.kind === "codex" ? codexRows(provider) : provider.kind === "antigravity" ? antigravityRows(provider) : provider.kind === "router" ? [] : httpRows(provider);
|
|
8623
|
+
const declared = provider.kind === "router" ? [] : (provider.pickerModels ?? []).map(declaredRow);
|
|
8591
8624
|
const declaredModels = new Set(declared.map((row) => row.model));
|
|
8592
8625
|
const named = [...derived.filter((row) => !declaredModels.has(row.model)), ...declared];
|
|
8593
8626
|
const taken = new Set(named.map((row) => labelOf(row.model)));
|
|
@@ -9031,6 +9064,7 @@ function decideLaunch(params, readOnly) {
|
|
|
9031
9064
|
...parsedArgv.trackUsage === void 0 ? {} : { trackUsage: parsedArgv.trackUsage },
|
|
9032
9065
|
...parsedArgv.pause === void 0 ? {} : { pause: parsedArgv.pause },
|
|
9033
9066
|
...parsedArgv.explain === void 0 ? {} : { explain: parsedArgv.explain },
|
|
9067
|
+
...parsedArgv.routeByName === void 0 ? {} : { routeByName: parsedArgv.routeByName },
|
|
9034
9068
|
...parsedArgv.delay === void 0 ? {} : { delay: parsedArgv.delay }
|
|
9035
9069
|
}
|
|
9036
9070
|
});
|
|
@@ -9174,7 +9208,8 @@ function prepareLaunch(params) {
|
|
|
9174
9208
|
...frontDoor === void 0 ? {} : { frontdoor: frontDoor },
|
|
9175
9209
|
...headroom === void 0 ? {} : { headroom },
|
|
9176
9210
|
sessionId,
|
|
9177
|
-
remoteControl: resolvedFlags.remoteControl
|
|
9211
|
+
remoteControl: resolvedFlags.remoteControl,
|
|
9212
|
+
routeByName: resolvedFlags.routeByName || resolvedProvider !== void 0 && isRouterProvider(resolvedProvider.definition)
|
|
9178
9213
|
});
|
|
9179
9214
|
const releases = [...headroom === void 0 || headroomPort === void 0 ? [] : [headroomPort.release], ...frontDoorRelease === void 0 ? [] : [frontDoorRelease]];
|
|
9180
9215
|
const release = () => {
|
|
@@ -9201,11 +9236,12 @@ function resolveLaunch(params) {
|
|
|
9201
9236
|
...frontDoor ? { frontdoor: { port: 0, connectPort: 0, trustBundlePath: "", sessionToken: "" } } : {},
|
|
9202
9237
|
...decided.flags.headroom ? { headroom: { socketPath: "", projectId: "" } } : {},
|
|
9203
9238
|
sessionId: "",
|
|
9204
|
-
remoteControl: decided.flags.remoteControl
|
|
9239
|
+
remoteControl: decided.flags.remoteControl,
|
|
9240
|
+
routeByName: decided.flags.routeByName
|
|
9205
9241
|
});
|
|
9206
9242
|
const credentialNames = decided.identityCredentialBlock === void 0 ? [] : Object.keys(credentialVariables(decided.identityCredentialBlock.target ?? "bearer", ""));
|
|
9207
9243
|
const environment = [.../* @__PURE__ */ new Set([...Object.keys(built).filter((name) => built[name] !== env[name]), ...credentialNames])].sort();
|
|
9208
|
-
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;
|
|
9244
|
+
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;
|
|
9209
9245
|
return {
|
|
9210
9246
|
decision: decided.decision,
|
|
9211
9247
|
flags: decided.flags,
|
|
@@ -9213,7 +9249,7 @@ function resolveLaunch(params) {
|
|
|
9213
9249
|
bin: decided.bin,
|
|
9214
9250
|
args: decided.args,
|
|
9215
9251
|
...credential === void 0 ? {} : { credential },
|
|
9216
|
-
routing: { frontDoor, headroom: decided.flags.headroom },
|
|
9252
|
+
routing: { frontDoor, headroom: decided.flags.headroom, routeByName: decided.flags.routeByName },
|
|
9217
9253
|
environment
|
|
9218
9254
|
};
|
|
9219
9255
|
}
|
|
@@ -14107,6 +14143,9 @@ function applyProfileChange(paths, name, change) {
|
|
|
14107
14143
|
if (change.launchExplain !== void 0) {
|
|
14108
14144
|
launchPatch.explain = change.launchExplain;
|
|
14109
14145
|
}
|
|
14146
|
+
if (change.launchRouteByName !== void 0) {
|
|
14147
|
+
launchPatch.routeByName = change.launchRouteByName;
|
|
14148
|
+
}
|
|
14110
14149
|
if (Object.keys(launchPatch).length > 0) {
|
|
14111
14150
|
setProfileLaunchFlags(paths, name, launchPatch);
|
|
14112
14151
|
touched = true;
|
|
@@ -14436,11 +14475,12 @@ function cachedState(cacheEnv, owner, block) {
|
|
|
14436
14475
|
function buildCredentialReport(provider, identity, identityName, cacheEnv) {
|
|
14437
14476
|
const identityCredential = identity?.credential === void 0 ? void 0 : summariseCredential(identity.credential);
|
|
14438
14477
|
const identityCached = identity?.credential === void 0 || identityName === void 0 ? void 0 : cachedState(cacheEnv, `identity ${identityName}`, identity.credential);
|
|
14439
|
-
const
|
|
14478
|
+
const providerCredential = provider?.definition !== void 0 && !isRouterProvider(provider.definition) ? provider.definition.credential : void 0;
|
|
14479
|
+
const providerCached = providerCredential === void 0 || provider === void 0 ? void 0 : cachedState(cacheEnv, `provider ${provider.name}`, providerCredential);
|
|
14440
14480
|
return {
|
|
14441
14481
|
applies: provider !== void 0 ? "provider" : identityCredential !== void 0 ? "identity" : "stored-login",
|
|
14442
14482
|
...provider === void 0 ? {} : {
|
|
14443
|
-
provider: provider.problem === void 0 ? { name: provider.name, credential: summariseCredential(
|
|
14483
|
+
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 }
|
|
14444
14484
|
},
|
|
14445
14485
|
...identityCredential === void 0 ? {} : { identity: identityCredential },
|
|
14446
14486
|
...identityCached === void 0 ? {} : { identityCached }
|
|
@@ -14535,7 +14575,7 @@ function formatCheckReport(report) {
|
|
|
14535
14575
|
const { credential } = report;
|
|
14536
14576
|
if (credential.provider !== void 0) {
|
|
14537
14577
|
lines.push(
|
|
14538
|
-
` 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)}`}`
|
|
14578
|
+
` 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)}`}`
|
|
14539
14579
|
);
|
|
14540
14580
|
}
|
|
14541
14581
|
if (credential.identity !== void 0) {
|
|
@@ -14821,7 +14861,7 @@ var CachedCredentialStateSchema = import_zod17.z.union([
|
|
|
14821
14861
|
import_zod17.z.strictObject({ store: import_zod17.z.enum(CREDENTIAL_CACHE_STORES), status: import_zod17.z.enum(["fresh", "expired"]), ageMs: import_zod17.z.number(), expiresInMs: import_zod17.z.number().optional() })
|
|
14822
14862
|
]);
|
|
14823
14863
|
var CheckCredentialProviderSchema = import_zod17.z.union([
|
|
14824
|
-
import_zod17.z.strictObject({ name: import_zod17.z.string(), credential: CredentialSummarySchema, cached: CachedCredentialStateSchema.optional() }),
|
|
14864
|
+
import_zod17.z.strictObject({ name: import_zod17.z.string(), credential: CredentialSummarySchema.optional(), cached: CachedCredentialStateSchema.optional() }),
|
|
14825
14865
|
import_zod17.z.strictObject({ name: import_zod17.z.string(), problem: import_zod17.z.string() })
|
|
14826
14866
|
]);
|
|
14827
14867
|
var CheckCredentialSchema = import_zod17.z.strictObject({
|
|
@@ -15605,9 +15645,11 @@ function pushProvider(push, entry, cacheEnv, signIn) {
|
|
|
15605
15645
|
if (validated3.ignored.length > 0) {
|
|
15606
15646
|
push("provider", "warn", describeIgnoredKeys(entry.path, validated3.ignored), entry.name);
|
|
15607
15647
|
}
|
|
15608
|
-
const
|
|
15609
|
-
|
|
15610
|
-
|
|
15648
|
+
const router = isRouterProvider(validated3.data);
|
|
15649
|
+
const noCache = { unreadable: false, text: "" };
|
|
15650
|
+
const cache = router ? noCache : cacheClause(cacheEnv, `provider ${entry.name}`, validated3.data.credential);
|
|
15651
|
+
push("provider", cache.unreadable ? "fail" : "pass", router ? `${entry.name} is valid (${describeProviderEndpoint(validated3.data)})` : `${entry.name} is valid (${describeProviderEndpoint(validated3.data)}, credential ${describeCredential(validated3.data.credential)})${cache.text}.`, entry.name);
|
|
15652
|
+
if (!router && validated3.data.env?.ENABLE_TOOL_SEARCH === void 0) {
|
|
15611
15653
|
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);
|
|
15612
15654
|
}
|
|
15613
15655
|
if (signIn !== void 0 && isCodexProvider(validated3.data) && validated3.data.codex?.login === "chatgpt-sign-in") {
|
|
@@ -16405,7 +16447,7 @@ var ProviderValueSchema = import_zod24.z.strictObject({
|
|
|
16405
16447
|
displayName: import_zod24.z.string(),
|
|
16406
16448
|
baseUrl: import_zod24.z.string().optional(),
|
|
16407
16449
|
codex: CodexProviderConfigSchema.optional(),
|
|
16408
|
-
credential: CredentialSummarySchema2,
|
|
16450
|
+
credential: CredentialSummarySchema2.optional(),
|
|
16409
16451
|
env: import_zod24.z.record(import_zod24.z.string(), import_zod24.z.string()).optional()
|
|
16410
16452
|
});
|
|
16411
16453
|
var ConfigNameInputSchema = import_zod24.z.strictObject({ name: import_zod24.z.string().min(1) });
|
|
@@ -16443,7 +16485,8 @@ var ConfigProfileSetInputSchema = import_zod24.z.strictObject({
|
|
|
16443
16485
|
claudeVersion: import_zod24.z.union([import_zod24.z.string().min(1), import_zod24.z.literal(false)]).optional(),
|
|
16444
16486
|
delay: import_zod24.z.union([import_zod24.z.string().regex(DURATION_RE), import_zod24.z.literal(false)]).optional(),
|
|
16445
16487
|
pause: import_zod24.z.boolean().optional(),
|
|
16446
|
-
explain: import_zod24.z.boolean().optional()
|
|
16488
|
+
explain: import_zod24.z.boolean().optional(),
|
|
16489
|
+
routeByName: import_zod24.z.boolean().optional()
|
|
16447
16490
|
}).optional()
|
|
16448
16491
|
});
|
|
16449
16492
|
var ConfigProfileSetOutputSchema = storedMutationOutput("profile", "updated", ProfileValueSchema);
|
|
@@ -16555,9 +16598,8 @@ function providerValue(name, provider) {
|
|
|
16555
16598
|
name,
|
|
16556
16599
|
kind: provider.kind ?? "http",
|
|
16557
16600
|
displayName: provider.displayName,
|
|
16558
|
-
...isCodexProvider(provider) ? provider.codex === void 0 ? {} : { codex: provider.codex } : isAntigravityProvider(provider) ? provider.antigravity === void 0 ? {} : { antigravity: provider.antigravity } : { baseUrl: provider.baseUrl },
|
|
16559
|
-
credential: summariseCredential(provider.credential),
|
|
16560
|
-
...provider.env === void 0 ? {} : { env: provider.env }
|
|
16601
|
+
...isCodexProvider(provider) ? provider.codex === void 0 ? {} : { codex: provider.codex } : isAntigravityProvider(provider) ? provider.antigravity === void 0 ? {} : { antigravity: provider.antigravity } : isRouterProvider(provider) ? {} : { baseUrl: provider.baseUrl },
|
|
16602
|
+
...isRouterProvider(provider) ? {} : { credential: summariseCredential(provider.credential), ...provider.env === void 0 ? {} : { env: provider.env } }
|
|
16561
16603
|
};
|
|
16562
16604
|
}
|
|
16563
16605
|
function profileValue(name, paths) {
|
|
@@ -16656,7 +16698,8 @@ function createConfigApiRouter(deps) {
|
|
|
16656
16698
|
...launch?.claudeVersion === void 0 ? {} : { launchClaudeVersion: launch.claudeVersion },
|
|
16657
16699
|
...launch?.delay === void 0 ? {} : { launchDelay: launch.delay },
|
|
16658
16700
|
...launch?.pause === void 0 ? {} : { launchPause: launch.pause },
|
|
16659
|
-
...launch?.explain === void 0 ? {} : { launchExplain: launch.explain }
|
|
16701
|
+
...launch?.explain === void 0 ? {} : { launchExplain: launch.explain },
|
|
16702
|
+
...launch?.routeByName === void 0 ? {} : { launchRouteByName: launch.routeByName }
|
|
16660
16703
|
});
|
|
16661
16704
|
return { action: "updated", kind: "profile", name: input.name, value: profileValue(input.name, paths) };
|
|
16662
16705
|
})
|
|
@@ -16739,7 +16782,7 @@ function createConfigApiRouter(deps) {
|
|
|
16739
16782
|
if (input.baseUrl !== void 0 && isHttpProvider(existing) && input.baseUrl !== existing.baseUrl && credential?.sources === void 0) {
|
|
16740
16783
|
throw new import_client2.ORPCError("BAD_REQUEST", { message: `Changing the base URL of provider "${input.name}" requires a credential block in the same call: the stored credential is not sent to a different endpoint.` });
|
|
16741
16784
|
}
|
|
16742
|
-
const cache = credential?.cache === void 0 ? void 0 : mergeCredentialCache(credential.cache === false ? { enabled: false } : { ...credential.cache, enabled: true }, existing.credential.cache);
|
|
16785
|
+
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);
|
|
16743
16786
|
const updated = updateProvider(paths, input.name, {
|
|
16744
16787
|
...input.displayName === void 0 ? {} : { displayName: input.displayName },
|
|
16745
16788
|
...input.baseUrl === void 0 ? {} : { baseUrl: input.baseUrl },
|
|
@@ -16967,6 +17010,7 @@ var LaunchFlagsSchema = import_zod26.z.strictObject({
|
|
|
16967
17010
|
trackUsage: import_zod26.z.boolean(),
|
|
16968
17011
|
pause: import_zod26.z.boolean(),
|
|
16969
17012
|
explain: import_zod26.z.boolean(),
|
|
17013
|
+
routeByName: import_zod26.z.boolean(),
|
|
16970
17014
|
/** How long the launch waits after its own output before it starts claude, in milliseconds. */
|
|
16971
17015
|
delayMs: import_zod26.z.number()
|
|
16972
17016
|
});
|
|
@@ -16980,7 +17024,7 @@ var LaunchResolveOutputSchema = import_zod26.z.strictObject({
|
|
|
16980
17024
|
args: import_zod26.z.readonly(import_zod26.z.array(import_zod26.z.string())),
|
|
16981
17025
|
/** The credential the launch would authenticate with, by target and source kinds. Absent when none applies. */
|
|
16982
17026
|
credential: import_zod26.z.strictObject({ subject: import_zod26.z.enum(["provider", "identity"]), name: import_zod26.z.string(), summary: CredentialSummarySchema }).optional(),
|
|
16983
|
-
routing: import_zod26.z.strictObject({ frontDoor: import_zod26.z.boolean(), headroom: import_zod26.z.boolean() }),
|
|
17027
|
+
routing: import_zod26.z.strictObject({ frontDoor: import_zod26.z.boolean(), headroom: import_zod26.z.boolean(), routeByName: import_zod26.z.boolean() }),
|
|
16984
17028
|
/** The names of the environment variables the launch would set or unset, sorted. Values are not reported. */
|
|
16985
17029
|
environment: import_zod26.z.readonly(import_zod26.z.array(import_zod26.z.string())),
|
|
16986
17030
|
warnings: import_zod26.z.readonly(import_zod26.z.array(import_zod26.z.string()))
|