claude-use 11.35.0 → 11.37.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 +416 -291
- package/dist/index.cjs +354 -236
- package/dist/index.mjs +355 -237
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3082,7 +3082,7 @@ var init_package = __esm({
|
|
|
3082
3082
|
"package.json"() {
|
|
3083
3083
|
package_default = {
|
|
3084
3084
|
name: "claude-use",
|
|
3085
|
-
version: "11.
|
|
3085
|
+
version: "11.37.0",
|
|
3086
3086
|
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.",
|
|
3087
3087
|
license: "MIT",
|
|
3088
3088
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -6235,6 +6235,196 @@ var init_poolPick = __esm({
|
|
|
6235
6235
|
}
|
|
6236
6236
|
});
|
|
6237
6237
|
|
|
6238
|
+
// src/configProfilesStore.ts
|
|
6239
|
+
import fs4 from "node:fs";
|
|
6240
|
+
import path22 from "node:path";
|
|
6241
|
+
function profileJsonPath(paths, name) {
|
|
6242
|
+
return path22.join(paths.configProfilesDir, `${name}.json`);
|
|
6243
|
+
}
|
|
6244
|
+
function profileExists(paths, name) {
|
|
6245
|
+
return fs4.existsSync(profileJsonPath(paths, name));
|
|
6246
|
+
}
|
|
6247
|
+
function requireProfileExists(paths, name) {
|
|
6248
|
+
if (!profileExists(paths, name)) {
|
|
6249
|
+
throw new ProfileNotFoundError(name);
|
|
6250
|
+
}
|
|
6251
|
+
}
|
|
6252
|
+
function readProfile(paths, name) {
|
|
6253
|
+
return readJson(profileJsonPath(paths, name), ConfigProfileSchema);
|
|
6254
|
+
}
|
|
6255
|
+
function createProfile(paths, name, extendsList, description) {
|
|
6256
|
+
if (profileExists(paths, name)) {
|
|
6257
|
+
throw new ProfileAlreadyExistsError(name);
|
|
6258
|
+
}
|
|
6259
|
+
const filePath = profileJsonPath(paths, name);
|
|
6260
|
+
const parsed = ConfigProfileSchema.safeParse({
|
|
6261
|
+
...description === void 0 ? {} : { description },
|
|
6262
|
+
...extendsList !== void 0 && extendsList.length > 0 ? { extends: [...extendsList] } : {}
|
|
6263
|
+
});
|
|
6264
|
+
if (!parsed.success) {
|
|
6265
|
+
throw new ConfigValidationError(filePath, parsed.error.issues);
|
|
6266
|
+
}
|
|
6267
|
+
writeJsonAtomic(filePath, parsed.data);
|
|
6268
|
+
return parsed.data;
|
|
6269
|
+
}
|
|
6270
|
+
function listProfiles(paths) {
|
|
6271
|
+
if (!fs4.existsSync(paths.configProfilesDir)) {
|
|
6272
|
+
return [];
|
|
6273
|
+
}
|
|
6274
|
+
const names = fs4.readdirSync(paths.configProfilesDir, { withFileTypes: true }).filter((entry) => entry.isFile() && entry.name.endsWith(".json")).map((entry) => entry.name.slice(0, -".json".length)).sort();
|
|
6275
|
+
const result = [];
|
|
6276
|
+
for (const name of names) {
|
|
6277
|
+
const profile = readProfile(paths, name);
|
|
6278
|
+
if (profile !== void 0) {
|
|
6279
|
+
result.push({ name, profile });
|
|
6280
|
+
}
|
|
6281
|
+
}
|
|
6282
|
+
return result;
|
|
6283
|
+
}
|
|
6284
|
+
function globalConfigPath(paths) {
|
|
6285
|
+
return paths.globalConfigFile;
|
|
6286
|
+
}
|
|
6287
|
+
function readGlobalConfig(paths) {
|
|
6288
|
+
return readJson(globalConfigPath(paths), GlobalConfigSchema);
|
|
6289
|
+
}
|
|
6290
|
+
function setGlobalDefaultProfile(paths, name) {
|
|
6291
|
+
return applyPatch(
|
|
6292
|
+
globalConfigPath(paths),
|
|
6293
|
+
GlobalConfigSchema,
|
|
6294
|
+
{ defaultConfigProfile: name },
|
|
6295
|
+
{ defaults: {} }
|
|
6296
|
+
);
|
|
6297
|
+
}
|
|
6298
|
+
function validateCategoryNames(patch) {
|
|
6299
|
+
for (const key of Object.keys(patch)) {
|
|
6300
|
+
if (!isOverridableCategory(key)) {
|
|
6301
|
+
throw new InvalidCategoryNameError(key);
|
|
6302
|
+
}
|
|
6303
|
+
}
|
|
6304
|
+
}
|
|
6305
|
+
function setProfileCategories(paths, name, patch) {
|
|
6306
|
+
requireProfileExists(paths, name);
|
|
6307
|
+
const expandedPatch = expandAllCategoryKey(patch);
|
|
6308
|
+
validateCategoryNames(expandedPatch);
|
|
6309
|
+
const existing = readProfile(paths, name) ?? {};
|
|
6310
|
+
const mergedCategories = { ...existing.categories, ...expandedPatch };
|
|
6311
|
+
return applyPatch(profileJsonPath(paths, name), ConfigProfileSchema, { categories: mergedCategories });
|
|
6312
|
+
}
|
|
6313
|
+
function setProfileEntries(paths, name, patch) {
|
|
6314
|
+
requireProfileExists(paths, name);
|
|
6315
|
+
const existing = readProfile(paths, name) ?? {};
|
|
6316
|
+
const mergedEntries = { ...existing.entries, ...patch };
|
|
6317
|
+
return applyPatch(profileJsonPath(paths, name), ConfigProfileSchema, { entries: mergedEntries });
|
|
6318
|
+
}
|
|
6319
|
+
function setProfileLaunchFlags(paths, name, patch) {
|
|
6320
|
+
requireProfileExists(paths, name);
|
|
6321
|
+
const existing = readProfile(paths, name) ?? {};
|
|
6322
|
+
const mergedLaunch = { ...existing.launch, ...patch };
|
|
6323
|
+
return applyPatch(profileJsonPath(paths, name), ConfigProfileSchema, {
|
|
6324
|
+
// Read as `unknown` so the check sees the `undefined` a cleared key holds, which LaunchFlags' optional properties hide from the value type.
|
|
6325
|
+
launch: Object.values(mergedLaunch).every((value) => value === void 0) ? void 0 : mergedLaunch
|
|
6326
|
+
});
|
|
6327
|
+
}
|
|
6328
|
+
function setProfileMetadata(paths, name, patch) {
|
|
6329
|
+
requireProfileExists(paths, name);
|
|
6330
|
+
return applyPatch(profileJsonPath(paths, name), ConfigProfileSchema, {
|
|
6331
|
+
...patch.extends === void 0 ? {} : { extends: patch.extends.length === 0 ? void 0 : [...patch.extends] },
|
|
6332
|
+
...patch.description === void 0 ? {} : { description: patch.description === false ? void 0 : patch.description }
|
|
6333
|
+
});
|
|
6334
|
+
}
|
|
6335
|
+
function removeProfile(paths, name) {
|
|
6336
|
+
requireProfileExists(paths, name);
|
|
6337
|
+
fs4.rmSync(profileJsonPath(paths, name));
|
|
6338
|
+
}
|
|
6339
|
+
function applyProfileChange(paths, name, change) {
|
|
6340
|
+
let touched = false;
|
|
6341
|
+
if (change.category !== void 0) {
|
|
6342
|
+
setProfileCategories(paths, name, change.category);
|
|
6343
|
+
touched = true;
|
|
6344
|
+
}
|
|
6345
|
+
if (change.entry !== void 0) {
|
|
6346
|
+
setProfileEntries(paths, name, change.entry);
|
|
6347
|
+
touched = true;
|
|
6348
|
+
}
|
|
6349
|
+
if (change.extends !== void 0 || change.description !== void 0) {
|
|
6350
|
+
setProfileMetadata(paths, name, {
|
|
6351
|
+
...change.extends === void 0 ? {} : { extends: change.extends === false ? [] : change.extends },
|
|
6352
|
+
...change.description === void 0 ? {} : { description: change.description }
|
|
6353
|
+
});
|
|
6354
|
+
touched = true;
|
|
6355
|
+
}
|
|
6356
|
+
const launchPatch = {};
|
|
6357
|
+
if (change.launchSkipPermissions !== void 0) {
|
|
6358
|
+
launchPatch.skipPermissions = change.launchSkipPermissions;
|
|
6359
|
+
}
|
|
6360
|
+
if (change.launchRemoteControl !== void 0) {
|
|
6361
|
+
launchPatch.remoteControl = change.launchRemoteControl;
|
|
6362
|
+
}
|
|
6363
|
+
if (change.launchHeadroom !== void 0) {
|
|
6364
|
+
launchPatch.headroom = change.launchHeadroom;
|
|
6365
|
+
}
|
|
6366
|
+
if (change.launchTrackUsage !== void 0) {
|
|
6367
|
+
launchPatch.trackUsage = change.launchTrackUsage;
|
|
6368
|
+
}
|
|
6369
|
+
if (change.launchProvider !== void 0) {
|
|
6370
|
+
launchPatch.provider = change.launchProvider === false ? void 0 : change.launchProvider;
|
|
6371
|
+
}
|
|
6372
|
+
if (change.launchClaudeVersion !== void 0) {
|
|
6373
|
+
launchPatch.claudeVersion = change.launchClaudeVersion === false ? void 0 : change.launchClaudeVersion;
|
|
6374
|
+
}
|
|
6375
|
+
if (change.launchDelay !== void 0) {
|
|
6376
|
+
launchPatch.delay = change.launchDelay === false ? void 0 : change.launchDelay;
|
|
6377
|
+
}
|
|
6378
|
+
if (change.launchPause !== void 0) {
|
|
6379
|
+
launchPatch.pause = change.launchPause;
|
|
6380
|
+
}
|
|
6381
|
+
if (change.launchExplain !== void 0) {
|
|
6382
|
+
launchPatch.explain = change.launchExplain;
|
|
6383
|
+
}
|
|
6384
|
+
if (change.launchRouteByName !== void 0) {
|
|
6385
|
+
launchPatch.routeByName = change.launchRouteByName;
|
|
6386
|
+
}
|
|
6387
|
+
if (Object.keys(launchPatch).length > 0) {
|
|
6388
|
+
setProfileLaunchFlags(paths, name, launchPatch);
|
|
6389
|
+
touched = true;
|
|
6390
|
+
}
|
|
6391
|
+
return touched;
|
|
6392
|
+
}
|
|
6393
|
+
var ProfileNotFoundError, ProfileAlreadyExistsError, InvalidCategoryNameError;
|
|
6394
|
+
var init_configProfilesStore = __esm({
|
|
6395
|
+
"src/configProfilesStore.ts"() {
|
|
6396
|
+
"use strict";
|
|
6397
|
+
init_store();
|
|
6398
|
+
init_schema();
|
|
6399
|
+
init_cliError();
|
|
6400
|
+
init_load();
|
|
6401
|
+
ProfileNotFoundError = class extends CliError {
|
|
6402
|
+
constructor(profileName) {
|
|
6403
|
+
super(`No configuration profile named "${profileName}". Run \`agent-shim profile add ${profileName}\` first.`);
|
|
6404
|
+
this.profileName = profileName;
|
|
6405
|
+
this.name = "ProfileNotFoundError";
|
|
6406
|
+
}
|
|
6407
|
+
profileName;
|
|
6408
|
+
};
|
|
6409
|
+
ProfileAlreadyExistsError = class extends CliError {
|
|
6410
|
+
constructor(profileName) {
|
|
6411
|
+
super(`A configuration profile named "${profileName}" already exists.`);
|
|
6412
|
+
this.profileName = profileName;
|
|
6413
|
+
this.name = "ProfileAlreadyExistsError";
|
|
6414
|
+
}
|
|
6415
|
+
profileName;
|
|
6416
|
+
};
|
|
6417
|
+
InvalidCategoryNameError = class extends CliError {
|
|
6418
|
+
constructor(categoryName) {
|
|
6419
|
+
super(`"${categoryName}" is not a category a configuration profile may toggle (runtime, history, knowledge, settings).`);
|
|
6420
|
+
this.categoryName = categoryName;
|
|
6421
|
+
this.name = "InvalidCategoryNameError";
|
|
6422
|
+
}
|
|
6423
|
+
categoryName;
|
|
6424
|
+
};
|
|
6425
|
+
}
|
|
6426
|
+
});
|
|
6427
|
+
|
|
6238
6428
|
// src/paths.ts
|
|
6239
6429
|
import fs5 from "node:fs";
|
|
6240
6430
|
import os5 from "node:os";
|
|
@@ -6960,6 +7150,58 @@ function resolveProvider(params) {
|
|
|
6960
7150
|
}
|
|
6961
7151
|
return { ok: true, provider: { name, definition, credential: resolution.credential }, warnings: resolution.credential.warnings };
|
|
6962
7152
|
}
|
|
7153
|
+
function resolveRoutedProviderCredentials(params) {
|
|
7154
|
+
const { models } = params;
|
|
7155
|
+
if (models === void 0) {
|
|
7156
|
+
return { ok: true, checked: [] };
|
|
7157
|
+
}
|
|
7158
|
+
const virtualNames = new Set(Object.keys(models.virtual ?? {}));
|
|
7159
|
+
const providerNames = /* @__PURE__ */ new Set();
|
|
7160
|
+
const collect = (ref) => {
|
|
7161
|
+
if (ref.startsWith("acct:") || ref.startsWith("family:") || virtualNames.has(ref)) {
|
|
7162
|
+
return;
|
|
7163
|
+
}
|
|
7164
|
+
const [provider] = ref.split("/", 1);
|
|
7165
|
+
if (provider !== void 0 && provider !== "") {
|
|
7166
|
+
providerNames.add(provider);
|
|
7167
|
+
}
|
|
7168
|
+
};
|
|
7169
|
+
for (const model of Object.values(models.virtual ?? {})) {
|
|
7170
|
+
for (const member of model.members) {
|
|
7171
|
+
collect(member);
|
|
7172
|
+
}
|
|
7173
|
+
}
|
|
7174
|
+
for (const ref of Object.values(models.tiers ?? {})) {
|
|
7175
|
+
collect(ref);
|
|
7176
|
+
}
|
|
7177
|
+
if (providerNames.size === 0) {
|
|
7178
|
+
return { ok: true, checked: [] };
|
|
7179
|
+
}
|
|
7180
|
+
if (params.credentials === void 0) {
|
|
7181
|
+
return { ok: false, status: 1, message: `agent-shim: the models block routes to providers ${[...providerNames].sort().join(", ")}, which need their credentials resolved, but this launcher has no credential port wired` };
|
|
7182
|
+
}
|
|
7183
|
+
const failures = [];
|
|
7184
|
+
let credentialFailure = false;
|
|
7185
|
+
for (const name of [...providerNames].sort()) {
|
|
7186
|
+
const definition = loadProvider(params.paths.providersDir, name, params.port);
|
|
7187
|
+
if (definition === void 0) {
|
|
7188
|
+
failures.push(`no provider named "${name}"`);
|
|
7189
|
+
continue;
|
|
7190
|
+
}
|
|
7191
|
+
if (isRouterProvider(definition)) {
|
|
7192
|
+
continue;
|
|
7193
|
+
}
|
|
7194
|
+
const resolution = resolveCredential({ credential: definition.credential, env: params.env, port: params.credentials, subject: `provider ${name}` });
|
|
7195
|
+
if (!resolution.ok) {
|
|
7196
|
+
failures.push(resolution.message.replace(/^agent-shim: /, ""));
|
|
7197
|
+
credentialFailure = true;
|
|
7198
|
+
}
|
|
7199
|
+
}
|
|
7200
|
+
if (failures.length > 0) {
|
|
7201
|
+
return { ok: false, status: credentialFailure ? CREDENTIAL_UNAVAILABLE_EXIT : 1, message: `agent-shim: this launch routes model names through the models block, but: ${failures.join("; ")}` };
|
|
7202
|
+
}
|
|
7203
|
+
return { ok: true, checked: [...providerNames].sort() };
|
|
7204
|
+
}
|
|
6963
7205
|
var ProviderNotFoundError, ProviderAlreadyExistsError, InvalidProviderNameError, PROVIDER_NAME_RE, LEGACY_PROVIDER_FIELDS, LEGACY_ENV_CREDENTIAL_KEYS, LEGACY_LITERAL_PLACEHOLDER, LegacyProviderFileError, ProviderKindMismatchError;
|
|
6964
7206
|
var init_providersStore = __esm({
|
|
6965
7207
|
"src/providersStore.ts"() {
|
|
@@ -7275,6 +7517,62 @@ var init_claudeShim = __esm({
|
|
|
7275
7517
|
}
|
|
7276
7518
|
});
|
|
7277
7519
|
|
|
7520
|
+
// src/modelsStore.ts
|
|
7521
|
+
function readModels(paths) {
|
|
7522
|
+
return readGlobalConfig(paths)?.models;
|
|
7523
|
+
}
|
|
7524
|
+
function memberKindOf(ref, models) {
|
|
7525
|
+
if (ref.startsWith("acct:")) {
|
|
7526
|
+
return "account";
|
|
7527
|
+
}
|
|
7528
|
+
if (ref.startsWith("family:")) {
|
|
7529
|
+
return "family";
|
|
7530
|
+
}
|
|
7531
|
+
return models?.virtual !== void 0 && ref in models.virtual ? "virtual" : "provider";
|
|
7532
|
+
}
|
|
7533
|
+
function expandMembers(name, models) {
|
|
7534
|
+
const virtual = models?.virtual ?? {};
|
|
7535
|
+
const expanded = [];
|
|
7536
|
+
const walk = (current, chain) => {
|
|
7537
|
+
const nested = virtual[current];
|
|
7538
|
+
if (nested !== void 0) {
|
|
7539
|
+
if (chain.includes(current)) {
|
|
7540
|
+
throw new Error(`virtual model cycle: ${[...chain, current].join(" -> ")}`);
|
|
7541
|
+
}
|
|
7542
|
+
for (const member of nested.members) {
|
|
7543
|
+
walk(member, [...chain, current]);
|
|
7544
|
+
}
|
|
7545
|
+
return;
|
|
7546
|
+
}
|
|
7547
|
+
if (!expanded.includes(current)) {
|
|
7548
|
+
expanded.push(current);
|
|
7549
|
+
}
|
|
7550
|
+
};
|
|
7551
|
+
const top = virtual[name];
|
|
7552
|
+
if (top === void 0) {
|
|
7553
|
+
throw new VirtualModelNotFoundError(name);
|
|
7554
|
+
}
|
|
7555
|
+
for (const member of top.members) {
|
|
7556
|
+
walk(member, [name]);
|
|
7557
|
+
}
|
|
7558
|
+
return expanded;
|
|
7559
|
+
}
|
|
7560
|
+
var VirtualModelNotFoundError;
|
|
7561
|
+
var init_modelsStore = __esm({
|
|
7562
|
+
"src/modelsStore.ts"() {
|
|
7563
|
+
"use strict";
|
|
7564
|
+
init_store();
|
|
7565
|
+
init_schema();
|
|
7566
|
+
init_configProfilesStore();
|
|
7567
|
+
VirtualModelNotFoundError = class extends Error {
|
|
7568
|
+
constructor(name) {
|
|
7569
|
+
super(`No virtual model named "${name}".`);
|
|
7570
|
+
this.name = "VirtualModelNotFoundError";
|
|
7571
|
+
}
|
|
7572
|
+
};
|
|
7573
|
+
}
|
|
7574
|
+
});
|
|
7575
|
+
|
|
7278
7576
|
// src/frontdoor/probe.ts
|
|
7279
7577
|
import { Worker } from "node:worker_threads";
|
|
7280
7578
|
function probeFrontDoorSync(port, caPem) {
|
|
@@ -8598,8 +8896,40 @@ function providerModelRows(provider, catalogue = []) {
|
|
|
8598
8896
|
const taken = new Set(named.map((row) => labelOf(row.model)));
|
|
8599
8897
|
return [...named, ...catalogueRows(provider, catalogue).filter((row) => !taken.has(labelOf(row.model)))];
|
|
8600
8898
|
}
|
|
8899
|
+
function routedModelRows(models, providers) {
|
|
8900
|
+
const hidden = new Set(models.hide ?? []);
|
|
8901
|
+
const shown = models.show === void 0 ? void 0 : new Set(models.show);
|
|
8902
|
+
const visible = (model) => shown === void 0 ? !hidden.has(model) : shown.has(model);
|
|
8903
|
+
const tierOf = (model) => {
|
|
8904
|
+
for (const [, provider] of providers) {
|
|
8905
|
+
if (provider.kind !== void 0 && provider.kind !== "http") {
|
|
8906
|
+
continue;
|
|
8907
|
+
}
|
|
8908
|
+
const env = provider.env ?? {};
|
|
8909
|
+
const match = Object.entries(env).find(([, value]) => value === model);
|
|
8910
|
+
if (match?.[0].endsWith("_MODEL") === true) {
|
|
8911
|
+
const tier = match[0].replace("ANTHROPIC_DEFAULT_", "").replace("_MODEL", "").toLowerCase();
|
|
8912
|
+
return tier === "fable" || tier === "opus" || tier === "sonnet" || tier === "haiku" ? tier : void 0;
|
|
8913
|
+
}
|
|
8914
|
+
}
|
|
8915
|
+
return void 0;
|
|
8916
|
+
};
|
|
8917
|
+
const virtual = Object.entries(models.virtual ?? {}).flatMap(([name, definition]) => {
|
|
8918
|
+
if (!visible(name)) {
|
|
8919
|
+
return [];
|
|
8920
|
+
}
|
|
8921
|
+
const first = definition.members.find((member) => member.includes("/"));
|
|
8922
|
+
const tier = first === void 0 ? void 0 : tierOf(first.split("/").slice(1).join("/"));
|
|
8923
|
+
const behavesAs = tier === void 0 ? void 0 : TIER_BEHAVES_AS[tier];
|
|
8924
|
+
return behavesAs === void 0 ? [] : [{ model: name, label: name, description: `Virtual (${definition.mode})`, behavesAs }];
|
|
8925
|
+
});
|
|
8926
|
+
const concrete = providers.flatMap(([name, provider]) => providerModelRows(provider).map((row) => ({ ...row, model: `${name}/${row.model}`, label: `${name} / ${row.label}`, description: `${name}: ${row.description}` })));
|
|
8927
|
+
return [...virtual, ...concrete.filter((row) => visible(row.model))];
|
|
8928
|
+
}
|
|
8601
8929
|
function modelPickerSettings(provider, catalogue = []) {
|
|
8602
|
-
|
|
8930
|
+
return modelPickerSettingsFromRows(providerModelRows(provider, catalogue));
|
|
8931
|
+
}
|
|
8932
|
+
function modelPickerSettingsFromRows(options) {
|
|
8603
8933
|
return options.length === 0 ? void 0 : JSON.stringify({ modelPicker: { options, replaceBuiltInOptions: true } });
|
|
8604
8934
|
}
|
|
8605
8935
|
var CONTEXT_MARKER_1M, TIER_BEHAVES_AS, TIER_ENV_VARIABLES;
|
|
@@ -9049,7 +9379,8 @@ function decideLaunch(params, readOnly) {
|
|
|
9049
9379
|
}
|
|
9050
9380
|
const flags = loginlessProvider === void 0 ? requestedFlags : { ...requestedFlags, remoteControl: false };
|
|
9051
9381
|
const catalogue = selectedProvider === void 0 ? void 0 : parseCatalogueCache(params.fs.readFileUtf8(catalogueCachePath(paths, selectedProvider.name)));
|
|
9052
|
-
const
|
|
9382
|
+
const routesByName = flags.routeByName || selectedProvider !== void 0 && isRouterProvider(selectedProvider.definition);
|
|
9383
|
+
const pickerSettings = routesByName ? modelPickerSettingsFromRows(routedModelRows(readModels(paths) ?? {}, listProviders(paths).map((entry) => [entry.name, entry.provider]))) : selectedProvider === void 0 ? void 0 : modelPickerSettings(selectedProvider.definition, catalogue?.models);
|
|
9053
9384
|
const callerSettings = hasSettingsArgument(parsedArgv.rest);
|
|
9054
9385
|
if (pickerSettings !== void 0 && callerSettings) {
|
|
9055
9386
|
notes.push("--settings was passed, so /model keeps Claude Code's own model names");
|
|
@@ -9151,6 +9482,14 @@ function prepareLaunch(params) {
|
|
|
9151
9482
|
if (decided.pinnedVersion !== void 0) {
|
|
9152
9483
|
rows.push(pinnedVersionRow(decided.pinnedVersion.version, decided.pinnedVersion.source));
|
|
9153
9484
|
}
|
|
9485
|
+
const routesByName = resolvedFlags.routeByName || resolvedProvider !== void 0 && isRouterProvider(resolvedProvider.definition);
|
|
9486
|
+
if (routesByName) {
|
|
9487
|
+
const check = resolveRoutedProviderCredentials({ paths, port: params.fs, env, ...params.credentials === void 0 ? {} : { credentials: params.credentials }, models: loadConfigFile(paths.globalConfigFile, GlobalConfigSchema, params.fs.readConfigFile)?.config.models });
|
|
9488
|
+
if (!check.ok) {
|
|
9489
|
+
log.error(check.message);
|
|
9490
|
+
proc.exit(check.status);
|
|
9491
|
+
}
|
|
9492
|
+
}
|
|
9154
9493
|
const frontDoorPort = params.frontdoor;
|
|
9155
9494
|
const frontDoorEngaged = resolvedProvider !== void 0 || resolvedFlags.headroom || resolvedFlags.trackUsage;
|
|
9156
9495
|
if (frontDoorEngaged && frontDoorPort === void 0) {
|
|
@@ -9183,7 +9522,7 @@ function prepareLaunch(params) {
|
|
|
9183
9522
|
...headroom === void 0 ? {} : { headroom },
|
|
9184
9523
|
sessionId,
|
|
9185
9524
|
remoteControl: resolvedFlags.remoteControl,
|
|
9186
|
-
routeByName:
|
|
9525
|
+
routeByName: routesByName
|
|
9187
9526
|
});
|
|
9188
9527
|
const releases = [...headroom === void 0 || headroomPort === void 0 ? [] : [headroomPort.release], ...frontDoorRelease === void 0 ? [] : [frontDoorRelease]];
|
|
9189
9528
|
const release = () => {
|
|
@@ -9263,14 +9602,18 @@ var init_launcher = __esm({
|
|
|
9263
9602
|
init_launchReport();
|
|
9264
9603
|
init_modelPicker();
|
|
9265
9604
|
init_providerCatalogue();
|
|
9605
|
+
init_modelsStore();
|
|
9606
|
+
init_providersStore();
|
|
9266
9607
|
init_pool();
|
|
9267
9608
|
init_resumeContext();
|
|
9268
9609
|
init_lock();
|
|
9269
9610
|
init_spawn();
|
|
9270
9611
|
init_providersStore();
|
|
9612
|
+
init_load();
|
|
9271
9613
|
init_flatten();
|
|
9272
9614
|
init_walk();
|
|
9273
9615
|
init_schema();
|
|
9616
|
+
init_schema();
|
|
9274
9617
|
init_credential();
|
|
9275
9618
|
init_middleware();
|
|
9276
9619
|
init_preflight();
|
|
@@ -13555,192 +13898,7 @@ function collectPoolPick(params) {
|
|
|
13555
13898
|
|
|
13556
13899
|
// src/poolStore.ts
|
|
13557
13900
|
init_cliError();
|
|
13558
|
-
|
|
13559
|
-
// src/configProfilesStore.ts
|
|
13560
|
-
init_store();
|
|
13561
|
-
init_schema();
|
|
13562
|
-
init_cliError();
|
|
13563
|
-
init_load();
|
|
13564
|
-
import fs4 from "node:fs";
|
|
13565
|
-
import path22 from "node:path";
|
|
13566
|
-
var ProfileNotFoundError = class extends CliError {
|
|
13567
|
-
constructor(profileName) {
|
|
13568
|
-
super(`No configuration profile named "${profileName}". Run \`agent-shim profile add ${profileName}\` first.`);
|
|
13569
|
-
this.profileName = profileName;
|
|
13570
|
-
this.name = "ProfileNotFoundError";
|
|
13571
|
-
}
|
|
13572
|
-
profileName;
|
|
13573
|
-
};
|
|
13574
|
-
var ProfileAlreadyExistsError = class extends CliError {
|
|
13575
|
-
constructor(profileName) {
|
|
13576
|
-
super(`A configuration profile named "${profileName}" already exists.`);
|
|
13577
|
-
this.profileName = profileName;
|
|
13578
|
-
this.name = "ProfileAlreadyExistsError";
|
|
13579
|
-
}
|
|
13580
|
-
profileName;
|
|
13581
|
-
};
|
|
13582
|
-
var InvalidCategoryNameError = class extends CliError {
|
|
13583
|
-
constructor(categoryName) {
|
|
13584
|
-
super(`"${categoryName}" is not a category a configuration profile may toggle (runtime, history, knowledge, settings).`);
|
|
13585
|
-
this.categoryName = categoryName;
|
|
13586
|
-
this.name = "InvalidCategoryNameError";
|
|
13587
|
-
}
|
|
13588
|
-
categoryName;
|
|
13589
|
-
};
|
|
13590
|
-
function profileJsonPath(paths, name) {
|
|
13591
|
-
return path22.join(paths.configProfilesDir, `${name}.json`);
|
|
13592
|
-
}
|
|
13593
|
-
function profileExists(paths, name) {
|
|
13594
|
-
return fs4.existsSync(profileJsonPath(paths, name));
|
|
13595
|
-
}
|
|
13596
|
-
function requireProfileExists(paths, name) {
|
|
13597
|
-
if (!profileExists(paths, name)) {
|
|
13598
|
-
throw new ProfileNotFoundError(name);
|
|
13599
|
-
}
|
|
13600
|
-
}
|
|
13601
|
-
function readProfile(paths, name) {
|
|
13602
|
-
return readJson(profileJsonPath(paths, name), ConfigProfileSchema);
|
|
13603
|
-
}
|
|
13604
|
-
function createProfile(paths, name, extendsList, description) {
|
|
13605
|
-
if (profileExists(paths, name)) {
|
|
13606
|
-
throw new ProfileAlreadyExistsError(name);
|
|
13607
|
-
}
|
|
13608
|
-
const filePath = profileJsonPath(paths, name);
|
|
13609
|
-
const parsed = ConfigProfileSchema.safeParse({
|
|
13610
|
-
...description === void 0 ? {} : { description },
|
|
13611
|
-
...extendsList !== void 0 && extendsList.length > 0 ? { extends: [...extendsList] } : {}
|
|
13612
|
-
});
|
|
13613
|
-
if (!parsed.success) {
|
|
13614
|
-
throw new ConfigValidationError(filePath, parsed.error.issues);
|
|
13615
|
-
}
|
|
13616
|
-
writeJsonAtomic(filePath, parsed.data);
|
|
13617
|
-
return parsed.data;
|
|
13618
|
-
}
|
|
13619
|
-
function listProfiles(paths) {
|
|
13620
|
-
if (!fs4.existsSync(paths.configProfilesDir)) {
|
|
13621
|
-
return [];
|
|
13622
|
-
}
|
|
13623
|
-
const names = fs4.readdirSync(paths.configProfilesDir, { withFileTypes: true }).filter((entry) => entry.isFile() && entry.name.endsWith(".json")).map((entry) => entry.name.slice(0, -".json".length)).sort();
|
|
13624
|
-
const result = [];
|
|
13625
|
-
for (const name of names) {
|
|
13626
|
-
const profile = readProfile(paths, name);
|
|
13627
|
-
if (profile !== void 0) {
|
|
13628
|
-
result.push({ name, profile });
|
|
13629
|
-
}
|
|
13630
|
-
}
|
|
13631
|
-
return result;
|
|
13632
|
-
}
|
|
13633
|
-
function globalConfigPath(paths) {
|
|
13634
|
-
return paths.globalConfigFile;
|
|
13635
|
-
}
|
|
13636
|
-
function readGlobalConfig(paths) {
|
|
13637
|
-
return readJson(globalConfigPath(paths), GlobalConfigSchema);
|
|
13638
|
-
}
|
|
13639
|
-
function setGlobalDefaultProfile(paths, name) {
|
|
13640
|
-
return applyPatch(
|
|
13641
|
-
globalConfigPath(paths),
|
|
13642
|
-
GlobalConfigSchema,
|
|
13643
|
-
{ defaultConfigProfile: name },
|
|
13644
|
-
{ defaults: {} }
|
|
13645
|
-
);
|
|
13646
|
-
}
|
|
13647
|
-
function validateCategoryNames(patch) {
|
|
13648
|
-
for (const key of Object.keys(patch)) {
|
|
13649
|
-
if (!isOverridableCategory(key)) {
|
|
13650
|
-
throw new InvalidCategoryNameError(key);
|
|
13651
|
-
}
|
|
13652
|
-
}
|
|
13653
|
-
}
|
|
13654
|
-
function setProfileCategories(paths, name, patch) {
|
|
13655
|
-
requireProfileExists(paths, name);
|
|
13656
|
-
const expandedPatch = expandAllCategoryKey(patch);
|
|
13657
|
-
validateCategoryNames(expandedPatch);
|
|
13658
|
-
const existing = readProfile(paths, name) ?? {};
|
|
13659
|
-
const mergedCategories = { ...existing.categories, ...expandedPatch };
|
|
13660
|
-
return applyPatch(profileJsonPath(paths, name), ConfigProfileSchema, { categories: mergedCategories });
|
|
13661
|
-
}
|
|
13662
|
-
function setProfileEntries(paths, name, patch) {
|
|
13663
|
-
requireProfileExists(paths, name);
|
|
13664
|
-
const existing = readProfile(paths, name) ?? {};
|
|
13665
|
-
const mergedEntries = { ...existing.entries, ...patch };
|
|
13666
|
-
return applyPatch(profileJsonPath(paths, name), ConfigProfileSchema, { entries: mergedEntries });
|
|
13667
|
-
}
|
|
13668
|
-
function setProfileLaunchFlags(paths, name, patch) {
|
|
13669
|
-
requireProfileExists(paths, name);
|
|
13670
|
-
const existing = readProfile(paths, name) ?? {};
|
|
13671
|
-
const mergedLaunch = { ...existing.launch, ...patch };
|
|
13672
|
-
return applyPatch(profileJsonPath(paths, name), ConfigProfileSchema, {
|
|
13673
|
-
// Read as `unknown` so the check sees the `undefined` a cleared key holds, which LaunchFlags' optional properties hide from the value type.
|
|
13674
|
-
launch: Object.values(mergedLaunch).every((value) => value === void 0) ? void 0 : mergedLaunch
|
|
13675
|
-
});
|
|
13676
|
-
}
|
|
13677
|
-
function setProfileMetadata(paths, name, patch) {
|
|
13678
|
-
requireProfileExists(paths, name);
|
|
13679
|
-
return applyPatch(profileJsonPath(paths, name), ConfigProfileSchema, {
|
|
13680
|
-
...patch.extends === void 0 ? {} : { extends: patch.extends.length === 0 ? void 0 : [...patch.extends] },
|
|
13681
|
-
...patch.description === void 0 ? {} : { description: patch.description === false ? void 0 : patch.description }
|
|
13682
|
-
});
|
|
13683
|
-
}
|
|
13684
|
-
function removeProfile(paths, name) {
|
|
13685
|
-
requireProfileExists(paths, name);
|
|
13686
|
-
fs4.rmSync(profileJsonPath(paths, name));
|
|
13687
|
-
}
|
|
13688
|
-
function applyProfileChange(paths, name, change) {
|
|
13689
|
-
let touched = false;
|
|
13690
|
-
if (change.category !== void 0) {
|
|
13691
|
-
setProfileCategories(paths, name, change.category);
|
|
13692
|
-
touched = true;
|
|
13693
|
-
}
|
|
13694
|
-
if (change.entry !== void 0) {
|
|
13695
|
-
setProfileEntries(paths, name, change.entry);
|
|
13696
|
-
touched = true;
|
|
13697
|
-
}
|
|
13698
|
-
if (change.extends !== void 0 || change.description !== void 0) {
|
|
13699
|
-
setProfileMetadata(paths, name, {
|
|
13700
|
-
...change.extends === void 0 ? {} : { extends: change.extends === false ? [] : change.extends },
|
|
13701
|
-
...change.description === void 0 ? {} : { description: change.description }
|
|
13702
|
-
});
|
|
13703
|
-
touched = true;
|
|
13704
|
-
}
|
|
13705
|
-
const launchPatch = {};
|
|
13706
|
-
if (change.launchSkipPermissions !== void 0) {
|
|
13707
|
-
launchPatch.skipPermissions = change.launchSkipPermissions;
|
|
13708
|
-
}
|
|
13709
|
-
if (change.launchRemoteControl !== void 0) {
|
|
13710
|
-
launchPatch.remoteControl = change.launchRemoteControl;
|
|
13711
|
-
}
|
|
13712
|
-
if (change.launchHeadroom !== void 0) {
|
|
13713
|
-
launchPatch.headroom = change.launchHeadroom;
|
|
13714
|
-
}
|
|
13715
|
-
if (change.launchTrackUsage !== void 0) {
|
|
13716
|
-
launchPatch.trackUsage = change.launchTrackUsage;
|
|
13717
|
-
}
|
|
13718
|
-
if (change.launchProvider !== void 0) {
|
|
13719
|
-
launchPatch.provider = change.launchProvider === false ? void 0 : change.launchProvider;
|
|
13720
|
-
}
|
|
13721
|
-
if (change.launchClaudeVersion !== void 0) {
|
|
13722
|
-
launchPatch.claudeVersion = change.launchClaudeVersion === false ? void 0 : change.launchClaudeVersion;
|
|
13723
|
-
}
|
|
13724
|
-
if (change.launchDelay !== void 0) {
|
|
13725
|
-
launchPatch.delay = change.launchDelay === false ? void 0 : change.launchDelay;
|
|
13726
|
-
}
|
|
13727
|
-
if (change.launchPause !== void 0) {
|
|
13728
|
-
launchPatch.pause = change.launchPause;
|
|
13729
|
-
}
|
|
13730
|
-
if (change.launchExplain !== void 0) {
|
|
13731
|
-
launchPatch.explain = change.launchExplain;
|
|
13732
|
-
}
|
|
13733
|
-
if (change.launchRouteByName !== void 0) {
|
|
13734
|
-
launchPatch.routeByName = change.launchRouteByName;
|
|
13735
|
-
}
|
|
13736
|
-
if (Object.keys(launchPatch).length > 0) {
|
|
13737
|
-
setProfileLaunchFlags(paths, name, launchPatch);
|
|
13738
|
-
touched = true;
|
|
13739
|
-
}
|
|
13740
|
-
return touched;
|
|
13741
|
-
}
|
|
13742
|
-
|
|
13743
|
-
// src/poolStore.ts
|
|
13901
|
+
init_configProfilesStore();
|
|
13744
13902
|
init_store();
|
|
13745
13903
|
init_schema();
|
|
13746
13904
|
init_identity();
|
|
@@ -14821,53 +14979,8 @@ init_credentialCache();
|
|
|
14821
14979
|
init_realCredentialCache();
|
|
14822
14980
|
init_source();
|
|
14823
14981
|
|
|
14824
|
-
// src/modelsStore.ts
|
|
14825
|
-
init_store();
|
|
14826
|
-
init_schema();
|
|
14827
|
-
var VirtualModelNotFoundError = class extends Error {
|
|
14828
|
-
constructor(name) {
|
|
14829
|
-
super(`No virtual model named "${name}".`);
|
|
14830
|
-
this.name = "VirtualModelNotFoundError";
|
|
14831
|
-
}
|
|
14832
|
-
};
|
|
14833
|
-
function memberKindOf(ref, models) {
|
|
14834
|
-
if (ref.startsWith("acct:")) {
|
|
14835
|
-
return "account";
|
|
14836
|
-
}
|
|
14837
|
-
if (ref.startsWith("family:")) {
|
|
14838
|
-
return "family";
|
|
14839
|
-
}
|
|
14840
|
-
return models?.virtual !== void 0 && ref in models.virtual ? "virtual" : "provider";
|
|
14841
|
-
}
|
|
14842
|
-
function expandMembers(name, models) {
|
|
14843
|
-
const virtual = models?.virtual ?? {};
|
|
14844
|
-
const expanded = [];
|
|
14845
|
-
const walk = (current, chain) => {
|
|
14846
|
-
const nested = virtual[current];
|
|
14847
|
-
if (nested !== void 0) {
|
|
14848
|
-
if (chain.includes(current)) {
|
|
14849
|
-
throw new Error(`virtual model cycle: ${[...chain, current].join(" -> ")}`);
|
|
14850
|
-
}
|
|
14851
|
-
for (const member of nested.members) {
|
|
14852
|
-
walk(member, [...chain, current]);
|
|
14853
|
-
}
|
|
14854
|
-
return;
|
|
14855
|
-
}
|
|
14856
|
-
if (!expanded.includes(current)) {
|
|
14857
|
-
expanded.push(current);
|
|
14858
|
-
}
|
|
14859
|
-
};
|
|
14860
|
-
const top = virtual[name];
|
|
14861
|
-
if (top === void 0) {
|
|
14862
|
-
throw new VirtualModelNotFoundError(name);
|
|
14863
|
-
}
|
|
14864
|
-
for (const member of top.members) {
|
|
14865
|
-
walk(member, [name]);
|
|
14866
|
-
}
|
|
14867
|
-
return expanded;
|
|
14868
|
-
}
|
|
14869
|
-
|
|
14870
14982
|
// src/models/doctor.ts
|
|
14983
|
+
init_modelsStore();
|
|
14871
14984
|
function modelsFindings(input) {
|
|
14872
14985
|
const findings = [];
|
|
14873
14986
|
const { models } = input;
|
|
@@ -14922,6 +15035,9 @@ function modelsFindings(input) {
|
|
|
14922
15035
|
return findings;
|
|
14923
15036
|
}
|
|
14924
15037
|
|
|
15038
|
+
// src/doctorReport.ts
|
|
15039
|
+
init_configProfilesStore();
|
|
15040
|
+
|
|
14925
15041
|
// src/headroom/allowlistDrift.ts
|
|
14926
15042
|
init_earlierRelease();
|
|
14927
15043
|
init_state2();
|
|
@@ -15862,9 +15978,10 @@ function createCodexApiRouter(deps) {
|
|
|
15862
15978
|
// src/frontdoor/configApi.ts
|
|
15863
15979
|
init_cliError();
|
|
15864
15980
|
init_schema();
|
|
15981
|
+
init_configProfilesStore();
|
|
15982
|
+
init_credential();
|
|
15865
15983
|
import { ORPCError as ORPCError2 } from "@orpc/client";
|
|
15866
15984
|
import { openapi as openapi3 } from "@orpc/openapi";
|
|
15867
|
-
init_credential();
|
|
15868
15985
|
|
|
15869
15986
|
// src/credentialCacheChange.ts
|
|
15870
15987
|
init_cliError();
|
|
@@ -19242,6 +19359,7 @@ init_guard();
|
|
|
19242
19359
|
init_paths();
|
|
19243
19360
|
init_cliError();
|
|
19244
19361
|
init_schema();
|
|
19362
|
+
init_configProfilesStore();
|
|
19245
19363
|
init_providersStore();
|
|
19246
19364
|
init_launcher();
|
|
19247
19365
|
init_spawn();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-use",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.37.0",
|
|
4
4
|
"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.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Joseph Mearman <joseph@mearman.co.uk>",
|