claude-use 11.33.0 → 11.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +119 -48
- package/dist/index.cjs +60 -32
- package/dist/index.mjs +60 -32
- package/dist/types/index.d.ts +51 -20
- 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. */
|
|
@@ -3092,7 +3102,7 @@ var init_package = __esm({
|
|
|
3092
3102
|
"package.json"() {
|
|
3093
3103
|
package_default = {
|
|
3094
3104
|
name: "claude-use",
|
|
3095
|
-
version: "11.
|
|
3105
|
+
version: "11.34.0",
|
|
3096
3106
|
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
3107
|
license: "MIT",
|
|
3098
3108
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -6793,7 +6803,7 @@ function describeProviderEndpoint(provider) {
|
|
|
6793
6803
|
if (isAntigravityProvider(provider)) {
|
|
6794
6804
|
return (provider.antigravity?.mode ?? ANTIGRAVITY_DEFAULT_MODE) === "local" ? "antigravity local (ACP daemon)" : "antigravity cloud (Gemini API)";
|
|
6795
6805
|
}
|
|
6796
|
-
return provider.baseUrl;
|
|
6806
|
+
return isRouterProvider(provider) ? "the models block" : provider.baseUrl;
|
|
6797
6807
|
}
|
|
6798
6808
|
function isEmptyCodexConfig(config) {
|
|
6799
6809
|
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 +6825,16 @@ function addProvider(paths, name, input) {
|
|
|
6815
6825
|
if (kind === "antigravity" && input.baseUrl !== void 0) {
|
|
6816
6826
|
throw new ProviderKindMismatchError("An antigravity provider has no base URL: the launcher points its sessions at the front-door daemon. Drop --base-url.");
|
|
6817
6827
|
}
|
|
6828
|
+
if (kind === "router" && input.baseUrl !== void 0) {
|
|
6829
|
+
throw new ProviderKindMismatchError("A router provider has no base URL: it resolves each request's model name through the models block. Drop --base-url.");
|
|
6830
|
+
}
|
|
6818
6831
|
if (kind === "http" && input.baseUrl === void 0) {
|
|
6819
6832
|
throw new ProviderKindMismatchError("An http provider needs --base-url.");
|
|
6820
6833
|
}
|
|
6821
|
-
if (kind
|
|
6834
|
+
if (kind === "router" && (input.sources.length > 0 || input.target !== void 0 || input.env !== void 0 || input.pickerModels !== void 0)) {
|
|
6835
|
+
throw new ProviderKindMismatchError("A router provider has no credential, env or picker models of its own: the models block's targets carry their own.");
|
|
6836
|
+
}
|
|
6837
|
+
if (kind !== "http" && kind !== "router" && input.catalogue !== void 0) {
|
|
6822
6838
|
throw new ProviderKindMismatchError("A model catalogue applies only to an http provider.");
|
|
6823
6839
|
}
|
|
6824
6840
|
if (kind !== "codex" && !isEmptyCodexConfig(input.codex)) {
|
|
@@ -6834,7 +6850,7 @@ function addProvider(paths, name, input) {
|
|
|
6834
6850
|
...input.pickerModels === void 0 || input.pickerModels.length === 0 ? {} : { pickerModels: input.pickerModels }
|
|
6835
6851
|
};
|
|
6836
6852
|
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 } }
|
|
6853
|
+
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
6854
|
);
|
|
6839
6855
|
if (!parsed.success) {
|
|
6840
6856
|
throw new ConfigValidationError(providerJsonPath(paths, name), parsed.error.issues);
|
|
@@ -6848,15 +6864,18 @@ function updateProvider(paths, name, input) {
|
|
|
6848
6864
|
throw new ProviderNotFoundError(name);
|
|
6849
6865
|
}
|
|
6850
6866
|
const unset = new Set(input.unsetEnv);
|
|
6851
|
-
const
|
|
6867
|
+
const existingEnv = isRouterProvider(existing) ? {} : existing.env;
|
|
6868
|
+
const env = Object.fromEntries(Object.entries({ ...existingEnv, ...input.env }).filter(([key]) => !unset.has(key)));
|
|
6852
6869
|
const unsetPicker = new Set(input.unsetPickerModels);
|
|
6853
6870
|
const added = new Map((input.pickerModels ?? []).map((entry) => [entry.model, entry]));
|
|
6871
|
+
const existingPicker = isRouterProvider(existing) ? [] : existing.pickerModels;
|
|
6854
6872
|
const pickerModels = [
|
|
6855
|
-
...(
|
|
6856
|
-
...[...added.values()].filter((entry) => !(
|
|
6873
|
+
...(existingPicker ?? []).filter((entry) => !unsetPicker.has(entry.model)).map((entry) => added.get(entry.model) ?? entry),
|
|
6874
|
+
...[...added.values()].filter((entry) => !(existingPicker ?? []).some((kept) => kept.model === entry.model))
|
|
6857
6875
|
];
|
|
6858
|
-
const
|
|
6859
|
-
const
|
|
6876
|
+
const router = isRouterProvider(existing);
|
|
6877
|
+
const target = router ? void 0 : input.target ?? existing.credential.target;
|
|
6878
|
+
const cache = router ? void 0 : input.cache === void 0 ? existing.credential.cache : input.cache === false ? void 0 : input.cache;
|
|
6860
6879
|
if (isCodexProvider(existing) && input.baseUrl !== void 0) {
|
|
6861
6880
|
throw new ProviderKindMismatchError(`Provider "${name}" is a codex provider, which has no base URL.`);
|
|
6862
6881
|
}
|
|
@@ -6874,10 +6893,12 @@ function updateProvider(paths, name, input) {
|
|
|
6874
6893
|
}
|
|
6875
6894
|
const shared = {
|
|
6876
6895
|
...input.displayName === void 0 ? {} : { displayName: input.displayName },
|
|
6877
|
-
|
|
6878
|
-
|
|
6879
|
-
|
|
6880
|
-
|
|
6896
|
+
...router ? {} : {
|
|
6897
|
+
credential: {
|
|
6898
|
+
sources: input.sources ?? existing.credential.sources,
|
|
6899
|
+
...target === void 0 ? {} : { target },
|
|
6900
|
+
...cache === void 0 ? {} : { cache }
|
|
6901
|
+
}
|
|
6881
6902
|
},
|
|
6882
6903
|
env: Object.keys(env).length === 0 ? void 0 : env,
|
|
6883
6904
|
pickerModels: pickerModels.length === 0 ? void 0 : pickerModels
|
|
@@ -6897,6 +6918,8 @@ function updateProvider(paths, name, input) {
|
|
|
6897
6918
|
...existing.antigravity?.models === void 0 && input.antigravity?.models === void 0 ? {} : { models: { ...existing.antigravity?.models, ...input.antigravity?.models } }
|
|
6898
6919
|
};
|
|
6899
6920
|
candidate = { ...existing, ...shared, antigravity: isEmptyAntigravityConfig(antigravity) ? void 0 : antigravity };
|
|
6921
|
+
} else if (router) {
|
|
6922
|
+
candidate = { kind: "router", ...shared };
|
|
6900
6923
|
} else {
|
|
6901
6924
|
const catalogue = input.catalogue === void 0 ? existing.catalogue : input.catalogue === false ? void 0 : input.catalogue;
|
|
6902
6925
|
candidate = { ...existing, ...shared, catalogue, ...input.baseUrl === void 0 ? {} : { baseUrl: input.baseUrl } };
|
|
@@ -6946,6 +6969,9 @@ function resolveProvider(params) {
|
|
|
6946
6969
|
return selection;
|
|
6947
6970
|
}
|
|
6948
6971
|
const { name, definition } = selection.provider;
|
|
6972
|
+
if (isRouterProvider(definition)) {
|
|
6973
|
+
return { ok: true, provider: { name, definition, credential: { target: "bearer", token: "", source: { env: "AGENT_SHIM_ROUTER" }, warnings: [] } }, warnings: [] };
|
|
6974
|
+
}
|
|
6949
6975
|
if (params.credentials === void 0) {
|
|
6950
6976
|
return { ok: false, status: 1, message: `agent-shim: provider ${name} needs its credential resolved, but this launcher has no credential port wired` };
|
|
6951
6977
|
}
|
|
@@ -7923,7 +7949,7 @@ function buildEnv(params) {
|
|
|
7923
7949
|
env.CLAUDE_CONFIG_DIR = import_node_path36.default.join(params.identitiesDir, params.resolvedIdentityName);
|
|
7924
7950
|
}
|
|
7925
7951
|
if (params.provider !== void 0) {
|
|
7926
|
-
const providerEnv = params.provider.definition.env ?? {};
|
|
7952
|
+
const providerEnv = params.provider.definition.kind !== void 0 && params.provider.definition.kind !== "http" ? {} : params.provider.definition.env ?? {};
|
|
7927
7953
|
providerCustomHeaders = providerEnv.ANTHROPIC_CUSTOM_HEADERS;
|
|
7928
7954
|
env.ANTHROPIC_BASE_URL = void 0;
|
|
7929
7955
|
env.AGENT_SHIM_PROVIDER = params.provider.definition.displayName;
|
|
@@ -8586,8 +8612,8 @@ function catalogueRows(provider, models) {
|
|
|
8586
8612
|
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
8613
|
}
|
|
8588
8614
|
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);
|
|
8615
|
+
const derived = provider.kind === "codex" ? codexRows(provider) : provider.kind === "antigravity" ? antigravityRows(provider) : provider.kind === "router" ? [] : httpRows(provider);
|
|
8616
|
+
const declared = provider.kind === "router" ? [] : (provider.pickerModels ?? []).map(declaredRow);
|
|
8591
8617
|
const declaredModels = new Set(declared.map((row) => row.model));
|
|
8592
8618
|
const named = [...derived.filter((row) => !declaredModels.has(row.model)), ...declared];
|
|
8593
8619
|
const taken = new Set(named.map((row) => labelOf(row.model)));
|
|
@@ -9205,7 +9231,7 @@ function resolveLaunch(params) {
|
|
|
9205
9231
|
});
|
|
9206
9232
|
const credentialNames = decided.identityCredentialBlock === void 0 ? [] : Object.keys(credentialVariables(decided.identityCredentialBlock.target ?? "bearer", ""));
|
|
9207
9233
|
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;
|
|
9234
|
+
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
9235
|
return {
|
|
9210
9236
|
decision: decided.decision,
|
|
9211
9237
|
flags: decided.flags,
|
|
@@ -14436,11 +14462,12 @@ function cachedState(cacheEnv, owner, block) {
|
|
|
14436
14462
|
function buildCredentialReport(provider, identity, identityName, cacheEnv) {
|
|
14437
14463
|
const identityCredential = identity?.credential === void 0 ? void 0 : summariseCredential(identity.credential);
|
|
14438
14464
|
const identityCached = identity?.credential === void 0 || identityName === void 0 ? void 0 : cachedState(cacheEnv, `identity ${identityName}`, identity.credential);
|
|
14439
|
-
const
|
|
14465
|
+
const providerCredential = provider?.definition !== void 0 && !isRouterProvider(provider.definition) ? provider.definition.credential : void 0;
|
|
14466
|
+
const providerCached = providerCredential === void 0 || provider === void 0 ? void 0 : cachedState(cacheEnv, `provider ${provider.name}`, providerCredential);
|
|
14440
14467
|
return {
|
|
14441
14468
|
applies: provider !== void 0 ? "provider" : identityCredential !== void 0 ? "identity" : "stored-login",
|
|
14442
14469
|
...provider === void 0 ? {} : {
|
|
14443
|
-
provider: provider.problem === void 0 ? { name: provider.name, credential: summariseCredential(
|
|
14470
|
+
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
14471
|
},
|
|
14445
14472
|
...identityCredential === void 0 ? {} : { identity: identityCredential },
|
|
14446
14473
|
...identityCached === void 0 ? {} : { identityCached }
|
|
@@ -14535,7 +14562,7 @@ function formatCheckReport(report) {
|
|
|
14535
14562
|
const { credential } = report;
|
|
14536
14563
|
if (credential.provider !== void 0) {
|
|
14537
14564
|
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)}`}`
|
|
14565
|
+
` 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
14566
|
);
|
|
14540
14567
|
}
|
|
14541
14568
|
if (credential.identity !== void 0) {
|
|
@@ -14821,7 +14848,7 @@ var CachedCredentialStateSchema = import_zod17.z.union([
|
|
|
14821
14848
|
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
14849
|
]);
|
|
14823
14850
|
var CheckCredentialProviderSchema = import_zod17.z.union([
|
|
14824
|
-
import_zod17.z.strictObject({ name: import_zod17.z.string(), credential: CredentialSummarySchema, cached: CachedCredentialStateSchema.optional() }),
|
|
14851
|
+
import_zod17.z.strictObject({ name: import_zod17.z.string(), credential: CredentialSummarySchema.optional(), cached: CachedCredentialStateSchema.optional() }),
|
|
14825
14852
|
import_zod17.z.strictObject({ name: import_zod17.z.string(), problem: import_zod17.z.string() })
|
|
14826
14853
|
]);
|
|
14827
14854
|
var CheckCredentialSchema = import_zod17.z.strictObject({
|
|
@@ -15605,9 +15632,11 @@ function pushProvider(push, entry, cacheEnv, signIn) {
|
|
|
15605
15632
|
if (validated3.ignored.length > 0) {
|
|
15606
15633
|
push("provider", "warn", describeIgnoredKeys(entry.path, validated3.ignored), entry.name);
|
|
15607
15634
|
}
|
|
15608
|
-
const
|
|
15609
|
-
|
|
15610
|
-
|
|
15635
|
+
const router = isRouterProvider(validated3.data);
|
|
15636
|
+
const noCache = { unreadable: false, text: "" };
|
|
15637
|
+
const cache = router ? noCache : cacheClause(cacheEnv, `provider ${entry.name}`, validated3.data.credential);
|
|
15638
|
+
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);
|
|
15639
|
+
if (!router && validated3.data.env?.ENABLE_TOOL_SEARCH === void 0) {
|
|
15611
15640
|
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
15641
|
}
|
|
15613
15642
|
if (signIn !== void 0 && isCodexProvider(validated3.data) && validated3.data.codex?.login === "chatgpt-sign-in") {
|
|
@@ -16405,7 +16434,7 @@ var ProviderValueSchema = import_zod24.z.strictObject({
|
|
|
16405
16434
|
displayName: import_zod24.z.string(),
|
|
16406
16435
|
baseUrl: import_zod24.z.string().optional(),
|
|
16407
16436
|
codex: CodexProviderConfigSchema.optional(),
|
|
16408
|
-
credential: CredentialSummarySchema2,
|
|
16437
|
+
credential: CredentialSummarySchema2.optional(),
|
|
16409
16438
|
env: import_zod24.z.record(import_zod24.z.string(), import_zod24.z.string()).optional()
|
|
16410
16439
|
});
|
|
16411
16440
|
var ConfigNameInputSchema = import_zod24.z.strictObject({ name: import_zod24.z.string().min(1) });
|
|
@@ -16555,9 +16584,8 @@ function providerValue(name, provider) {
|
|
|
16555
16584
|
name,
|
|
16556
16585
|
kind: provider.kind ?? "http",
|
|
16557
16586
|
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 }
|
|
16587
|
+
...isCodexProvider(provider) ? provider.codex === void 0 ? {} : { codex: provider.codex } : isAntigravityProvider(provider) ? provider.antigravity === void 0 ? {} : { antigravity: provider.antigravity } : isRouterProvider(provider) ? {} : { baseUrl: provider.baseUrl },
|
|
16588
|
+
...isRouterProvider(provider) ? {} : { credential: summariseCredential(provider.credential), ...provider.env === void 0 ? {} : { env: provider.env } }
|
|
16561
16589
|
};
|
|
16562
16590
|
}
|
|
16563
16591
|
function profileValue(name, paths) {
|
|
@@ -16739,7 +16767,7 @@ function createConfigApiRouter(deps) {
|
|
|
16739
16767
|
if (input.baseUrl !== void 0 && isHttpProvider(existing) && input.baseUrl !== existing.baseUrl && credential?.sources === void 0) {
|
|
16740
16768
|
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
16769
|
}
|
|
16742
|
-
const cache = credential?.cache === void 0 ? void 0 : mergeCredentialCache(credential.cache === false ? { enabled: false } : { ...credential.cache, enabled: true }, existing.credential.cache);
|
|
16770
|
+
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
16771
|
const updated = updateProvider(paths, input.name, {
|
|
16744
16772
|
...input.displayName === void 0 ? {} : { displayName: input.displayName },
|
|
16745
16773
|
...input.baseUrl === void 0 ? {} : { baseUrl: input.baseUrl },
|
package/dist/index.mjs
CHANGED
|
@@ -212,6 +212,9 @@ function isHttpProvider(provider) {
|
|
|
212
212
|
function isCodexProvider(provider) {
|
|
213
213
|
return provider.kind === "codex";
|
|
214
214
|
}
|
|
215
|
+
function isRouterProvider(provider) {
|
|
216
|
+
return provider.kind === "router";
|
|
217
|
+
}
|
|
215
218
|
function isAntigravityProvider(provider) {
|
|
216
219
|
return provider.kind === "antigravity";
|
|
217
220
|
}
|
|
@@ -226,7 +229,7 @@ function isTimeZone(name) {
|
|
|
226
229
|
return false;
|
|
227
230
|
}
|
|
228
231
|
}
|
|
229
|
-
var CATEGORY_NAMES, OVERRIDABLE_CATEGORIES, CategoryMapSchema, DURATION_RE, DurationSchema, WhenConditionObjectSchema, WhenSchema, EntryValueSchema, ENTRY_KEY_RE, EntriesSchema, LaunchSchema, CREDENTIAL_TARGETS, PROVIDER_CREDENTIAL_TARGETS, CREDENTIAL_TARGET_VARS, ArgvSchema, CommandSourceOptions, EnvCredentialSourceSchema, FileCredentialSourceSchema, CommandCredentialSourceSchema, OpCredentialSourceSchema, KeychainCredentialSourceSchema, LiteralCredentialSourceSchema, CredentialSourceSchema, RemoteCredentialSourceSchema, CREDENTIAL_CACHE_STORES, CredentialCacheSchema, CredentialSchema, ProviderCredentialSchema, RESERVED_PROVIDER_ENV_KEYS, ProviderEnvSchema, PROVIDER_KINDS, ANTIGRAVITY_MODES, CLAUDE_TIERS, ANTIGRAVITY_EFFORTS, ANTIGRAVITY_DEFAULT_MODE, ANTIGRAVITY_DEFAULT_MODEL, ANTIGRAVITY_DEFAULT_TIER_MODELS, ANTIGRAVITY_DEFAULT_EFFORT, AntigravityModelTargetSchema, AntigravityProviderConfigSchema, CODEX_EFFORTS, CODEX_LOGINS, CODEX_DEFAULT_LOGIN, CODEX_DEFAULT_MODEL, CODEX_DEFAULT_TIER_MODELS, CODEX_DEFAULT_EFFORT, CodexProviderConfigSchema, ProviderRouteSchema, PickerModelSchema, PickerModelsSchema, ProviderCatalogueSchema, HttpProviderSchema, CodexProviderSchema, AntigravityProviderSchema, ProviderSchema, SELECTION_MODES, VirtualModelSchema, ModelPricesSchema, ModelsConfigSchema, ModelsLayerSchema, ConfigProfileSchema, POOL_SELECTOR_PREFIX, POOL_NAME_PATTERN, IDENTITY_NAME_PATTERN, PoolNameSchema, SELECTOR_RE, IdentitySelectorSchema, PoolMemberSchema, POOL_PREFERENCES, PoolPreferenceSchema, WHOLE_PERCENT_MAX, CompactAtUtilisationSchema, PoolSchema, WEEKDAYS, AnchorSchema, JOB_WINDOWS, JobTriggerSchema, JobTargetSchema, JobSchema, DirectoryRuleSchema, DirectoryRulesSchema, PortableConfigSchema, HEADROOM_MODES, HEADROOM_CCR_MODES, HEADROOM_ROLLOUT_CHANNELS, INTERCEPT_CHANNELS, READ_MATURATION_CHANNELS, HeadroomGlobalConfigObjectSchema, HeadroomGlobalConfigSchema, HEADROOM_DEFAULT_SOURCE, HEADROOM_DEFAULT_IDLE_SHUTDOWN_MINUTES, FrontDoorGlobalConfigSchema, UPDATE_MODES, UpdateGlobalConfigSchema, GlobalConfigSchema, IdentitySchema, CategoryClassificationSchema, CategoryClassificationOverlaySchema, SHIPPED_CATEGORY_DEFAULTS;
|
|
232
|
+
var CATEGORY_NAMES, OVERRIDABLE_CATEGORIES, CategoryMapSchema, DURATION_RE, DurationSchema, WhenConditionObjectSchema, WhenSchema, EntryValueSchema, ENTRY_KEY_RE, EntriesSchema, LaunchSchema, CREDENTIAL_TARGETS, PROVIDER_CREDENTIAL_TARGETS, CREDENTIAL_TARGET_VARS, ArgvSchema, CommandSourceOptions, EnvCredentialSourceSchema, FileCredentialSourceSchema, CommandCredentialSourceSchema, OpCredentialSourceSchema, KeychainCredentialSourceSchema, LiteralCredentialSourceSchema, CredentialSourceSchema, RemoteCredentialSourceSchema, CREDENTIAL_CACHE_STORES, CredentialCacheSchema, CredentialSchema, ProviderCredentialSchema, RESERVED_PROVIDER_ENV_KEYS, ProviderEnvSchema, PROVIDER_KINDS, ANTIGRAVITY_MODES, CLAUDE_TIERS, ANTIGRAVITY_EFFORTS, ANTIGRAVITY_DEFAULT_MODE, ANTIGRAVITY_DEFAULT_MODEL, ANTIGRAVITY_DEFAULT_TIER_MODELS, ANTIGRAVITY_DEFAULT_EFFORT, AntigravityModelTargetSchema, AntigravityProviderConfigSchema, CODEX_EFFORTS, CODEX_LOGINS, CODEX_DEFAULT_LOGIN, CODEX_DEFAULT_MODEL, CODEX_DEFAULT_TIER_MODELS, CODEX_DEFAULT_EFFORT, CodexProviderConfigSchema, ProviderRouteSchema, PickerModelSchema, PickerModelsSchema, ProviderCatalogueSchema, HttpProviderSchema, CodexProviderSchema, RouterProviderSchema, AntigravityProviderSchema, ProviderSchema, SELECTION_MODES, VirtualModelSchema, ModelPricesSchema, ModelsConfigSchema, ModelsLayerSchema, ConfigProfileSchema, POOL_SELECTOR_PREFIX, POOL_NAME_PATTERN, IDENTITY_NAME_PATTERN, PoolNameSchema, SELECTOR_RE, IdentitySelectorSchema, PoolMemberSchema, POOL_PREFERENCES, PoolPreferenceSchema, WHOLE_PERCENT_MAX, CompactAtUtilisationSchema, PoolSchema, WEEKDAYS, AnchorSchema, JOB_WINDOWS, JobTriggerSchema, JobTargetSchema, JobSchema, DirectoryRuleSchema, DirectoryRulesSchema, PortableConfigSchema, HEADROOM_MODES, HEADROOM_CCR_MODES, HEADROOM_ROLLOUT_CHANNELS, INTERCEPT_CHANNELS, READ_MATURATION_CHANNELS, HeadroomGlobalConfigObjectSchema, HeadroomGlobalConfigSchema, HEADROOM_DEFAULT_SOURCE, HEADROOM_DEFAULT_IDLE_SHUTDOWN_MINUTES, FrontDoorGlobalConfigSchema, UPDATE_MODES, UpdateGlobalConfigSchema, GlobalConfigSchema, IdentitySchema, CategoryClassificationSchema, CategoryClassificationOverlaySchema, SHIPPED_CATEGORY_DEFAULTS;
|
|
230
233
|
var init_schema = __esm({
|
|
231
234
|
"src/config/schema.ts"() {
|
|
232
235
|
"use strict";
|
|
@@ -268,6 +271,8 @@ var init_schema = __esm({
|
|
|
268
271
|
delay: z.string().regex(DURATION_RE, "must be a duration such as 5s or 500ms").optional(),
|
|
269
272
|
/** Whether the launcher waits for a key press after its own output before it starts claude. Takes the place of `delay` when both are set. Applies only when a terminal is watching. */
|
|
270
273
|
pause: z.boolean().optional(),
|
|
274
|
+
/** Whether a provider session routes provider-qualified model names (`z/glm-5.3`, `auto`) through the `models` block to the provider that serves them, instead of sending every request to the launch provider. */
|
|
275
|
+
routeByName: z.boolean().optional(),
|
|
271
276
|
/** Whether the launcher's report, for a launch that picks from a pool, lists every member the pick ranked with why each stands where it does, and not only the member it picked. */
|
|
272
277
|
explain: z.boolean().optional()
|
|
273
278
|
});
|
|
@@ -328,7 +333,7 @@ var init_schema = __esm({
|
|
|
328
333
|
ProviderEnvSchema = z.record(z.string().min(1), z.string()).refine((env) => !Object.keys(env).some((key) => RESERVED_PROVIDER_ENV_KEYS.includes(key)), {
|
|
329
334
|
message: `env may not set ${RESERVED_PROVIDER_ENV_KEYS.join(", ")}: the credential block's target sets one and agent-shim removes the others`
|
|
330
335
|
});
|
|
331
|
-
PROVIDER_KINDS = ["http", "codex", "antigravity"];
|
|
336
|
+
PROVIDER_KINDS = ["http", "codex", "antigravity", "router"];
|
|
332
337
|
ANTIGRAVITY_MODES = ["cloud", "local"];
|
|
333
338
|
CLAUDE_TIERS = ["fable", "opus", "sonnet", "haiku"];
|
|
334
339
|
ANTIGRAVITY_EFFORTS = ["none", "low", "medium", "high", "xhigh", "max"];
|
|
@@ -441,6 +446,11 @@ var init_schema = __esm({
|
|
|
441
446
|
pickerModels: PickerModelsSchema.optional(),
|
|
442
447
|
codex: CodexProviderConfigSchema.optional()
|
|
443
448
|
});
|
|
449
|
+
RouterProviderSchema = z.strictObject({
|
|
450
|
+
$schema: z.string().optional(),
|
|
451
|
+
kind: z.literal("router"),
|
|
452
|
+
displayName: z.string().min(1)
|
|
453
|
+
});
|
|
444
454
|
AntigravityProviderSchema = z.strictObject({
|
|
445
455
|
$schema: z.string().optional(),
|
|
446
456
|
kind: z.literal("antigravity"),
|
|
@@ -451,7 +461,7 @@ var init_schema = __esm({
|
|
|
451
461
|
pickerModels: PickerModelsSchema.optional(),
|
|
452
462
|
antigravity: AntigravityProviderConfigSchema.optional()
|
|
453
463
|
});
|
|
454
|
-
ProviderSchema = z.discriminatedUnion("kind", [HttpProviderSchema, CodexProviderSchema, AntigravityProviderSchema]);
|
|
464
|
+
ProviderSchema = z.discriminatedUnion("kind", [HttpProviderSchema, CodexProviderSchema, AntigravityProviderSchema, RouterProviderSchema]);
|
|
455
465
|
SELECTION_MODES = ["ordered", "most-allowance", "soonest-reset", "spread", "adaptive", "lowest-latency", "highest-success", "cheapest"];
|
|
456
466
|
VirtualModelSchema = z.strictObject({
|
|
457
467
|
/** How the virtual model chooses its member for a request. */
|
|
@@ -3068,7 +3078,7 @@ var init_package = __esm({
|
|
|
3068
3078
|
"package.json"() {
|
|
3069
3079
|
package_default = {
|
|
3070
3080
|
name: "claude-use",
|
|
3071
|
-
version: "11.
|
|
3081
|
+
version: "11.34.0",
|
|
3072
3082
|
description: "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
|
|
3073
3083
|
license: "MIT",
|
|
3074
3084
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -6768,7 +6778,7 @@ function describeProviderEndpoint(provider) {
|
|
|
6768
6778
|
if (isAntigravityProvider(provider)) {
|
|
6769
6779
|
return (provider.antigravity?.mode ?? ANTIGRAVITY_DEFAULT_MODE) === "local" ? "antigravity local (ACP daemon)" : "antigravity cloud (Gemini API)";
|
|
6770
6780
|
}
|
|
6771
|
-
return provider.baseUrl;
|
|
6781
|
+
return isRouterProvider(provider) ? "the models block" : provider.baseUrl;
|
|
6772
6782
|
}
|
|
6773
6783
|
function isEmptyCodexConfig(config) {
|
|
6774
6784
|
return config === void 0 || config.defaultModel === void 0 && config.effort === void 0 && config.login === void 0 && (config.models === void 0 || Object.keys(config.models).length === 0);
|
|
@@ -6790,10 +6800,16 @@ function addProvider(paths, name, input) {
|
|
|
6790
6800
|
if (kind === "antigravity" && input.baseUrl !== void 0) {
|
|
6791
6801
|
throw new ProviderKindMismatchError("An antigravity provider has no base URL: the launcher points its sessions at the front-door daemon. Drop --base-url.");
|
|
6792
6802
|
}
|
|
6803
|
+
if (kind === "router" && input.baseUrl !== void 0) {
|
|
6804
|
+
throw new ProviderKindMismatchError("A router provider has no base URL: it resolves each request's model name through the models block. Drop --base-url.");
|
|
6805
|
+
}
|
|
6793
6806
|
if (kind === "http" && input.baseUrl === void 0) {
|
|
6794
6807
|
throw new ProviderKindMismatchError("An http provider needs --base-url.");
|
|
6795
6808
|
}
|
|
6796
|
-
if (kind
|
|
6809
|
+
if (kind === "router" && (input.sources.length > 0 || input.target !== void 0 || input.env !== void 0 || input.pickerModels !== void 0)) {
|
|
6810
|
+
throw new ProviderKindMismatchError("A router provider has no credential, env or picker models of its own: the models block's targets carry their own.");
|
|
6811
|
+
}
|
|
6812
|
+
if (kind !== "http" && kind !== "router" && input.catalogue !== void 0) {
|
|
6797
6813
|
throw new ProviderKindMismatchError("A model catalogue applies only to an http provider.");
|
|
6798
6814
|
}
|
|
6799
6815
|
if (kind !== "codex" && !isEmptyCodexConfig(input.codex)) {
|
|
@@ -6809,7 +6825,7 @@ function addProvider(paths, name, input) {
|
|
|
6809
6825
|
...input.pickerModels === void 0 || input.pickerModels.length === 0 ? {} : { pickerModels: input.pickerModels }
|
|
6810
6826
|
};
|
|
6811
6827
|
const parsed = ProviderSchema.safeParse(
|
|
6812
|
-
kind === "codex" ? { kind, ...shared, ...isEmptyCodexConfig(input.codex) ? {} : { codex: input.codex } } : kind === "antigravity" ? { kind, ...shared, ...isEmptyAntigravityConfig(input.antigravity) ? {} : { antigravity: input.antigravity } } : { ...shared, baseUrl: input.baseUrl, ...input.catalogue === void 0 ? {} : { catalogue: input.catalogue } }
|
|
6828
|
+
kind === "router" ? { kind, displayName: input.displayName } : kind === "codex" ? { kind, ...shared, ...isEmptyCodexConfig(input.codex) ? {} : { codex: input.codex } } : kind === "antigravity" ? { kind, ...shared, ...isEmptyAntigravityConfig(input.antigravity) ? {} : { antigravity: input.antigravity } } : { ...shared, baseUrl: input.baseUrl, ...input.catalogue === void 0 ? {} : { catalogue: input.catalogue } }
|
|
6813
6829
|
);
|
|
6814
6830
|
if (!parsed.success) {
|
|
6815
6831
|
throw new ConfigValidationError(providerJsonPath(paths, name), parsed.error.issues);
|
|
@@ -6823,15 +6839,18 @@ function updateProvider(paths, name, input) {
|
|
|
6823
6839
|
throw new ProviderNotFoundError(name);
|
|
6824
6840
|
}
|
|
6825
6841
|
const unset = new Set(input.unsetEnv);
|
|
6826
|
-
const
|
|
6842
|
+
const existingEnv = isRouterProvider(existing) ? {} : existing.env;
|
|
6843
|
+
const env = Object.fromEntries(Object.entries({ ...existingEnv, ...input.env }).filter(([key]) => !unset.has(key)));
|
|
6827
6844
|
const unsetPicker = new Set(input.unsetPickerModels);
|
|
6828
6845
|
const added = new Map((input.pickerModels ?? []).map((entry) => [entry.model, entry]));
|
|
6846
|
+
const existingPicker = isRouterProvider(existing) ? [] : existing.pickerModels;
|
|
6829
6847
|
const pickerModels = [
|
|
6830
|
-
...(
|
|
6831
|
-
...[...added.values()].filter((entry) => !(
|
|
6848
|
+
...(existingPicker ?? []).filter((entry) => !unsetPicker.has(entry.model)).map((entry) => added.get(entry.model) ?? entry),
|
|
6849
|
+
...[...added.values()].filter((entry) => !(existingPicker ?? []).some((kept) => kept.model === entry.model))
|
|
6832
6850
|
];
|
|
6833
|
-
const
|
|
6834
|
-
const
|
|
6851
|
+
const router = isRouterProvider(existing);
|
|
6852
|
+
const target = router ? void 0 : input.target ?? existing.credential.target;
|
|
6853
|
+
const cache = router ? void 0 : input.cache === void 0 ? existing.credential.cache : input.cache === false ? void 0 : input.cache;
|
|
6835
6854
|
if (isCodexProvider(existing) && input.baseUrl !== void 0) {
|
|
6836
6855
|
throw new ProviderKindMismatchError(`Provider "${name}" is a codex provider, which has no base URL.`);
|
|
6837
6856
|
}
|
|
@@ -6849,10 +6868,12 @@ function updateProvider(paths, name, input) {
|
|
|
6849
6868
|
}
|
|
6850
6869
|
const shared = {
|
|
6851
6870
|
...input.displayName === void 0 ? {} : { displayName: input.displayName },
|
|
6852
|
-
|
|
6853
|
-
|
|
6854
|
-
|
|
6855
|
-
|
|
6871
|
+
...router ? {} : {
|
|
6872
|
+
credential: {
|
|
6873
|
+
sources: input.sources ?? existing.credential.sources,
|
|
6874
|
+
...target === void 0 ? {} : { target },
|
|
6875
|
+
...cache === void 0 ? {} : { cache }
|
|
6876
|
+
}
|
|
6856
6877
|
},
|
|
6857
6878
|
env: Object.keys(env).length === 0 ? void 0 : env,
|
|
6858
6879
|
pickerModels: pickerModels.length === 0 ? void 0 : pickerModels
|
|
@@ -6872,6 +6893,8 @@ function updateProvider(paths, name, input) {
|
|
|
6872
6893
|
...existing.antigravity?.models === void 0 && input.antigravity?.models === void 0 ? {} : { models: { ...existing.antigravity?.models, ...input.antigravity?.models } }
|
|
6873
6894
|
};
|
|
6874
6895
|
candidate = { ...existing, ...shared, antigravity: isEmptyAntigravityConfig(antigravity) ? void 0 : antigravity };
|
|
6896
|
+
} else if (router) {
|
|
6897
|
+
candidate = { kind: "router", ...shared };
|
|
6875
6898
|
} else {
|
|
6876
6899
|
const catalogue = input.catalogue === void 0 ? existing.catalogue : input.catalogue === false ? void 0 : input.catalogue;
|
|
6877
6900
|
candidate = { ...existing, ...shared, catalogue, ...input.baseUrl === void 0 ? {} : { baseUrl: input.baseUrl } };
|
|
@@ -6921,6 +6944,9 @@ function resolveProvider(params) {
|
|
|
6921
6944
|
return selection;
|
|
6922
6945
|
}
|
|
6923
6946
|
const { name, definition } = selection.provider;
|
|
6947
|
+
if (isRouterProvider(definition)) {
|
|
6948
|
+
return { ok: true, provider: { name, definition, credential: { target: "bearer", token: "", source: { env: "AGENT_SHIM_ROUTER" }, warnings: [] } }, warnings: [] };
|
|
6949
|
+
}
|
|
6924
6950
|
if (params.credentials === void 0) {
|
|
6925
6951
|
return { ok: false, status: 1, message: `agent-shim: provider ${name} needs its credential resolved, but this launcher has no credential port wired` };
|
|
6926
6952
|
}
|
|
@@ -7897,7 +7923,7 @@ function buildEnv(params) {
|
|
|
7897
7923
|
env.CLAUDE_CONFIG_DIR = path36.join(params.identitiesDir, params.resolvedIdentityName);
|
|
7898
7924
|
}
|
|
7899
7925
|
if (params.provider !== void 0) {
|
|
7900
|
-
const providerEnv = params.provider.definition.env ?? {};
|
|
7926
|
+
const providerEnv = params.provider.definition.kind !== void 0 && params.provider.definition.kind !== "http" ? {} : params.provider.definition.env ?? {};
|
|
7901
7927
|
providerCustomHeaders = providerEnv.ANTHROPIC_CUSTOM_HEADERS;
|
|
7902
7928
|
env.ANTHROPIC_BASE_URL = void 0;
|
|
7903
7929
|
env.AGENT_SHIM_PROVIDER = params.provider.definition.displayName;
|
|
@@ -8558,8 +8584,8 @@ function catalogueRows(provider, models) {
|
|
|
8558
8584
|
return filterCatalogue(models, provider.catalogue).map((model) => ({ model: model.id, label: labelOf(model.id), description: describedAs(model.id, model.name === void 0 ? "Listed by the provider" : `Listed by the provider as ${model.name}`), behavesAs: TIER_BEHAVES_AS[tier] })).sort((left, right) => left.model.localeCompare(right.model));
|
|
8559
8585
|
}
|
|
8560
8586
|
function providerModelRows(provider, catalogue = []) {
|
|
8561
|
-
const derived = provider.kind === "codex" ? codexRows(provider) : provider.kind === "antigravity" ? antigravityRows(provider) : httpRows(provider);
|
|
8562
|
-
const declared = (provider.pickerModels ?? []).map(declaredRow);
|
|
8587
|
+
const derived = provider.kind === "codex" ? codexRows(provider) : provider.kind === "antigravity" ? antigravityRows(provider) : provider.kind === "router" ? [] : httpRows(provider);
|
|
8588
|
+
const declared = provider.kind === "router" ? [] : (provider.pickerModels ?? []).map(declaredRow);
|
|
8563
8589
|
const declaredModels = new Set(declared.map((row) => row.model));
|
|
8564
8590
|
const named = [...derived.filter((row) => !declaredModels.has(row.model)), ...declared];
|
|
8565
8591
|
const taken = new Set(named.map((row) => labelOf(row.model)));
|
|
@@ -9179,7 +9205,7 @@ function resolveLaunch(params) {
|
|
|
9179
9205
|
});
|
|
9180
9206
|
const credentialNames = decided.identityCredentialBlock === void 0 ? [] : Object.keys(credentialVariables(decided.identityCredentialBlock.target ?? "bearer", ""));
|
|
9181
9207
|
const environment = [.../* @__PURE__ */ new Set([...Object.keys(built).filter((name) => built[name] !== env[name]), ...credentialNames])].sort();
|
|
9182
|
-
const credential = decided.provider !== void 0 ? { subject: "provider", name: decided.provider.name, summary: summariseCredential(decided.provider.definition.credential) } : decided.identityCredentialBlock !== void 0 && decided.farmIdentity !== void 0 ? { subject: "identity", name: decided.farmIdentity, summary: summariseCredential(decided.identityCredentialBlock) } : void 0;
|
|
9208
|
+
const credential = decided.provider !== void 0 ? isRouterProvider(decided.provider.definition) ? void 0 : { subject: "provider", name: decided.provider.name, summary: summariseCredential(decided.provider.definition.credential) } : decided.identityCredentialBlock !== void 0 && decided.farmIdentity !== void 0 ? { subject: "identity", name: decided.farmIdentity, summary: summariseCredential(decided.identityCredentialBlock) } : void 0;
|
|
9183
9209
|
return {
|
|
9184
9210
|
decision: decided.decision,
|
|
9185
9211
|
flags: decided.flags,
|
|
@@ -14023,11 +14049,12 @@ function cachedState(cacheEnv, owner, block) {
|
|
|
14023
14049
|
function buildCredentialReport(provider, identity, identityName, cacheEnv) {
|
|
14024
14050
|
const identityCredential = identity?.credential === void 0 ? void 0 : summariseCredential(identity.credential);
|
|
14025
14051
|
const identityCached = identity?.credential === void 0 || identityName === void 0 ? void 0 : cachedState(cacheEnv, `identity ${identityName}`, identity.credential);
|
|
14026
|
-
const
|
|
14052
|
+
const providerCredential = provider?.definition !== void 0 && !isRouterProvider(provider.definition) ? provider.definition.credential : void 0;
|
|
14053
|
+
const providerCached = providerCredential === void 0 || provider === void 0 ? void 0 : cachedState(cacheEnv, `provider ${provider.name}`, providerCredential);
|
|
14027
14054
|
return {
|
|
14028
14055
|
applies: provider !== void 0 ? "provider" : identityCredential !== void 0 ? "identity" : "stored-login",
|
|
14029
14056
|
...provider === void 0 ? {} : {
|
|
14030
|
-
provider: provider.problem === void 0 ? { name: provider.name, credential: summariseCredential(
|
|
14057
|
+
provider: provider.problem === void 0 ? { name: provider.name, ...providerCredential === void 0 ? {} : { credential: summariseCredential(providerCredential), ...providerCached === void 0 ? {} : { cached: providerCached } } } : { name: provider.name, problem: provider.problem }
|
|
14031
14058
|
},
|
|
14032
14059
|
...identityCredential === void 0 ? {} : { identity: identityCredential },
|
|
14033
14060
|
...identityCached === void 0 ? {} : { identityCached }
|
|
@@ -14122,7 +14149,7 @@ function formatCheckReport(report) {
|
|
|
14122
14149
|
const { credential } = report;
|
|
14123
14150
|
if (credential.provider !== void 0) {
|
|
14124
14151
|
lines.push(
|
|
14125
|
-
` Provider ${credential.provider.name}: ${credential.provider.credential === void 0 ? `unusable: ${credential.provider.problem}` : formatCredentialSummary(credential.provider.credential)}${credential.provider.cached === void 0 ? "" : `; ${formatCachedCredentialState(credential.provider.cached)}`}`
|
|
14152
|
+
` Provider ${credential.provider.name}: ${credential.provider.credential === void 0 ? `unusable: ${credential.provider.problem ?? ""}` : formatCredentialSummary(credential.provider.credential)}${credential.provider.cached === void 0 ? "" : `; ${formatCachedCredentialState(credential.provider.cached)}`}`
|
|
14126
14153
|
);
|
|
14127
14154
|
}
|
|
14128
14155
|
if (credential.identity !== void 0) {
|
|
@@ -14408,7 +14435,7 @@ var CachedCredentialStateSchema = z17.union([
|
|
|
14408
14435
|
z17.strictObject({ store: z17.enum(CREDENTIAL_CACHE_STORES), status: z17.enum(["fresh", "expired"]), ageMs: z17.number(), expiresInMs: z17.number().optional() })
|
|
14409
14436
|
]);
|
|
14410
14437
|
var CheckCredentialProviderSchema = z17.union([
|
|
14411
|
-
z17.strictObject({ name: z17.string(), credential: CredentialSummarySchema, cached: CachedCredentialStateSchema.optional() }),
|
|
14438
|
+
z17.strictObject({ name: z17.string(), credential: CredentialSummarySchema.optional(), cached: CachedCredentialStateSchema.optional() }),
|
|
14412
14439
|
z17.strictObject({ name: z17.string(), problem: z17.string() })
|
|
14413
14440
|
]);
|
|
14414
14441
|
var CheckCredentialSchema = z17.strictObject({
|
|
@@ -15192,9 +15219,11 @@ function pushProvider(push, entry, cacheEnv, signIn) {
|
|
|
15192
15219
|
if (validated3.ignored.length > 0) {
|
|
15193
15220
|
push("provider", "warn", describeIgnoredKeys(entry.path, validated3.ignored), entry.name);
|
|
15194
15221
|
}
|
|
15195
|
-
const
|
|
15196
|
-
|
|
15197
|
-
|
|
15222
|
+
const router = isRouterProvider(validated3.data);
|
|
15223
|
+
const noCache = { unreadable: false, text: "" };
|
|
15224
|
+
const cache = router ? noCache : cacheClause(cacheEnv, `provider ${entry.name}`, validated3.data.credential);
|
|
15225
|
+
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);
|
|
15226
|
+
if (!router && validated3.data.env?.ENABLE_TOOL_SEARCH === void 0) {
|
|
15198
15227
|
push("provider", "warn", `${entry.name} does not set ENABLE_TOOL_SEARCH: a session on this provider keeps Claude Code's own API as its base URL, so it defers MCP tool loading and sends tool_reference payloads the upstream backend must understand. Set ENABLE_TOOL_SEARCH=false in the provider's env block to load tools upfront instead, when the backend does not support them.`, entry.name);
|
|
15199
15228
|
}
|
|
15200
15229
|
if (signIn !== void 0 && isCodexProvider(validated3.data) && validated3.data.codex?.login === "chatgpt-sign-in") {
|
|
@@ -15992,7 +16021,7 @@ var ProviderValueSchema = z24.strictObject({
|
|
|
15992
16021
|
displayName: z24.string(),
|
|
15993
16022
|
baseUrl: z24.string().optional(),
|
|
15994
16023
|
codex: CodexProviderConfigSchema.optional(),
|
|
15995
|
-
credential: CredentialSummarySchema2,
|
|
16024
|
+
credential: CredentialSummarySchema2.optional(),
|
|
15996
16025
|
env: z24.record(z24.string(), z24.string()).optional()
|
|
15997
16026
|
});
|
|
15998
16027
|
var ConfigNameInputSchema = z24.strictObject({ name: z24.string().min(1) });
|
|
@@ -16142,9 +16171,8 @@ function providerValue(name, provider) {
|
|
|
16142
16171
|
name,
|
|
16143
16172
|
kind: provider.kind ?? "http",
|
|
16144
16173
|
displayName: provider.displayName,
|
|
16145
|
-
...isCodexProvider(provider) ? provider.codex === void 0 ? {} : { codex: provider.codex } : isAntigravityProvider(provider) ? provider.antigravity === void 0 ? {} : { antigravity: provider.antigravity } : { baseUrl: provider.baseUrl },
|
|
16146
|
-
credential: summariseCredential(provider.credential),
|
|
16147
|
-
...provider.env === void 0 ? {} : { env: provider.env }
|
|
16174
|
+
...isCodexProvider(provider) ? provider.codex === void 0 ? {} : { codex: provider.codex } : isAntigravityProvider(provider) ? provider.antigravity === void 0 ? {} : { antigravity: provider.antigravity } : isRouterProvider(provider) ? {} : { baseUrl: provider.baseUrl },
|
|
16175
|
+
...isRouterProvider(provider) ? {} : { credential: summariseCredential(provider.credential), ...provider.env === void 0 ? {} : { env: provider.env } }
|
|
16148
16176
|
};
|
|
16149
16177
|
}
|
|
16150
16178
|
function profileValue(name, paths) {
|
|
@@ -16326,7 +16354,7 @@ function createConfigApiRouter(deps) {
|
|
|
16326
16354
|
if (input.baseUrl !== void 0 && isHttpProvider(existing) && input.baseUrl !== existing.baseUrl && credential?.sources === void 0) {
|
|
16327
16355
|
throw new ORPCError2("BAD_REQUEST", { message: `Changing the base URL of provider "${input.name}" requires a credential block in the same call: the stored credential is not sent to a different endpoint.` });
|
|
16328
16356
|
}
|
|
16329
|
-
const cache = credential?.cache === void 0 ? void 0 : mergeCredentialCache(credential.cache === false ? { enabled: false } : { ...credential.cache, enabled: true }, existing.credential.cache);
|
|
16357
|
+
const cache = credential?.cache === void 0 || isRouterProvider(existing) ? void 0 : mergeCredentialCache(credential.cache === false ? { enabled: false } : { ...credential.cache, enabled: true }, isRouterProvider(existing) ? void 0 : existing.credential.cache);
|
|
16330
16358
|
const updated = updateProvider(paths, input.name, {
|
|
16331
16359
|
...input.displayName === void 0 ? {} : { displayName: input.displayName },
|
|
16332
16360
|
...input.baseUrl === void 0 ? {} : { baseUrl: input.baseUrl },
|