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/cli.cjs
CHANGED
|
@@ -31706,6 +31706,196 @@ var init_identity = __esm({
|
|
|
31706
31706
|
}
|
|
31707
31707
|
});
|
|
31708
31708
|
|
|
31709
|
+
// src/configProfilesStore.ts
|
|
31710
|
+
function profileJsonPath(paths, name) {
|
|
31711
|
+
return import_node_path12.default.join(paths.configProfilesDir, `${name}.json`);
|
|
31712
|
+
}
|
|
31713
|
+
function profileExists(paths, name) {
|
|
31714
|
+
return import_node_fs5.default.existsSync(profileJsonPath(paths, name));
|
|
31715
|
+
}
|
|
31716
|
+
function requireProfileExists(paths, name) {
|
|
31717
|
+
if (!profileExists(paths, name)) {
|
|
31718
|
+
throw new ProfileNotFoundError(name);
|
|
31719
|
+
}
|
|
31720
|
+
}
|
|
31721
|
+
function readProfile(paths, name) {
|
|
31722
|
+
return readJson(profileJsonPath(paths, name), ConfigProfileSchema);
|
|
31723
|
+
}
|
|
31724
|
+
function createProfile(paths, name, extendsList, description) {
|
|
31725
|
+
if (profileExists(paths, name)) {
|
|
31726
|
+
throw new ProfileAlreadyExistsError(name);
|
|
31727
|
+
}
|
|
31728
|
+
const filePath = profileJsonPath(paths, name);
|
|
31729
|
+
const parsed = ConfigProfileSchema.safeParse({
|
|
31730
|
+
...description === void 0 ? {} : { description },
|
|
31731
|
+
...extendsList !== void 0 && extendsList.length > 0 ? { extends: [...extendsList] } : {}
|
|
31732
|
+
});
|
|
31733
|
+
if (!parsed.success) {
|
|
31734
|
+
throw new ConfigValidationError(filePath, parsed.error.issues);
|
|
31735
|
+
}
|
|
31736
|
+
writeJsonAtomic(filePath, parsed.data);
|
|
31737
|
+
return parsed.data;
|
|
31738
|
+
}
|
|
31739
|
+
function listProfiles(paths) {
|
|
31740
|
+
if (!import_node_fs5.default.existsSync(paths.configProfilesDir)) {
|
|
31741
|
+
return [];
|
|
31742
|
+
}
|
|
31743
|
+
const names = import_node_fs5.default.readdirSync(paths.configProfilesDir, { withFileTypes: true }).filter((entry) => entry.isFile() && entry.name.endsWith(".json")).map((entry) => entry.name.slice(0, -".json".length)).sort();
|
|
31744
|
+
const result = [];
|
|
31745
|
+
for (const name of names) {
|
|
31746
|
+
const profile = readProfile(paths, name);
|
|
31747
|
+
if (profile !== void 0) {
|
|
31748
|
+
result.push({ name, profile });
|
|
31749
|
+
}
|
|
31750
|
+
}
|
|
31751
|
+
return result;
|
|
31752
|
+
}
|
|
31753
|
+
function globalConfigPath(paths) {
|
|
31754
|
+
return paths.globalConfigFile;
|
|
31755
|
+
}
|
|
31756
|
+
function readGlobalConfig(paths) {
|
|
31757
|
+
return readJson(globalConfigPath(paths), GlobalConfigSchema);
|
|
31758
|
+
}
|
|
31759
|
+
function setGlobalDefaultProfile(paths, name) {
|
|
31760
|
+
return applyPatch(
|
|
31761
|
+
globalConfigPath(paths),
|
|
31762
|
+
GlobalConfigSchema,
|
|
31763
|
+
{ defaultConfigProfile: name },
|
|
31764
|
+
{ defaults: {} }
|
|
31765
|
+
);
|
|
31766
|
+
}
|
|
31767
|
+
function validateCategoryNames(patch) {
|
|
31768
|
+
for (const key of Object.keys(patch)) {
|
|
31769
|
+
if (!isOverridableCategory(key)) {
|
|
31770
|
+
throw new InvalidCategoryNameError(key);
|
|
31771
|
+
}
|
|
31772
|
+
}
|
|
31773
|
+
}
|
|
31774
|
+
function setProfileCategories(paths, name, patch) {
|
|
31775
|
+
requireProfileExists(paths, name);
|
|
31776
|
+
const expandedPatch = expandAllCategoryKey(patch);
|
|
31777
|
+
validateCategoryNames(expandedPatch);
|
|
31778
|
+
const existing = readProfile(paths, name) ?? {};
|
|
31779
|
+
const mergedCategories = { ...existing.categories, ...expandedPatch };
|
|
31780
|
+
return applyPatch(profileJsonPath(paths, name), ConfigProfileSchema, { categories: mergedCategories });
|
|
31781
|
+
}
|
|
31782
|
+
function setProfileEntries(paths, name, patch) {
|
|
31783
|
+
requireProfileExists(paths, name);
|
|
31784
|
+
const existing = readProfile(paths, name) ?? {};
|
|
31785
|
+
const mergedEntries = { ...existing.entries, ...patch };
|
|
31786
|
+
return applyPatch(profileJsonPath(paths, name), ConfigProfileSchema, { entries: mergedEntries });
|
|
31787
|
+
}
|
|
31788
|
+
function setProfileLaunchFlags(paths, name, patch) {
|
|
31789
|
+
requireProfileExists(paths, name);
|
|
31790
|
+
const existing = readProfile(paths, name) ?? {};
|
|
31791
|
+
const mergedLaunch = { ...existing.launch, ...patch };
|
|
31792
|
+
return applyPatch(profileJsonPath(paths, name), ConfigProfileSchema, {
|
|
31793
|
+
// Read as `unknown` so the check sees the `undefined` a cleared key holds, which LaunchFlags' optional properties hide from the value type.
|
|
31794
|
+
launch: Object.values(mergedLaunch).every((value2) => value2 === void 0) ? void 0 : mergedLaunch
|
|
31795
|
+
});
|
|
31796
|
+
}
|
|
31797
|
+
function setProfileMetadata(paths, name, patch) {
|
|
31798
|
+
requireProfileExists(paths, name);
|
|
31799
|
+
return applyPatch(profileJsonPath(paths, name), ConfigProfileSchema, {
|
|
31800
|
+
...patch.extends === void 0 ? {} : { extends: patch.extends.length === 0 ? void 0 : [...patch.extends] },
|
|
31801
|
+
...patch.description === void 0 ? {} : { description: patch.description === false ? void 0 : patch.description }
|
|
31802
|
+
});
|
|
31803
|
+
}
|
|
31804
|
+
function removeProfile(paths, name) {
|
|
31805
|
+
requireProfileExists(paths, name);
|
|
31806
|
+
import_node_fs5.default.rmSync(profileJsonPath(paths, name));
|
|
31807
|
+
}
|
|
31808
|
+
function applyProfileChange(paths, name, change) {
|
|
31809
|
+
let touched = false;
|
|
31810
|
+
if (change.category !== void 0) {
|
|
31811
|
+
setProfileCategories(paths, name, change.category);
|
|
31812
|
+
touched = true;
|
|
31813
|
+
}
|
|
31814
|
+
if (change.entry !== void 0) {
|
|
31815
|
+
setProfileEntries(paths, name, change.entry);
|
|
31816
|
+
touched = true;
|
|
31817
|
+
}
|
|
31818
|
+
if (change.extends !== void 0 || change.description !== void 0) {
|
|
31819
|
+
setProfileMetadata(paths, name, {
|
|
31820
|
+
...change.extends === void 0 ? {} : { extends: change.extends === false ? [] : change.extends },
|
|
31821
|
+
...change.description === void 0 ? {} : { description: change.description }
|
|
31822
|
+
});
|
|
31823
|
+
touched = true;
|
|
31824
|
+
}
|
|
31825
|
+
const launchPatch = {};
|
|
31826
|
+
if (change.launchSkipPermissions !== void 0) {
|
|
31827
|
+
launchPatch.skipPermissions = change.launchSkipPermissions;
|
|
31828
|
+
}
|
|
31829
|
+
if (change.launchRemoteControl !== void 0) {
|
|
31830
|
+
launchPatch.remoteControl = change.launchRemoteControl;
|
|
31831
|
+
}
|
|
31832
|
+
if (change.launchHeadroom !== void 0) {
|
|
31833
|
+
launchPatch.headroom = change.launchHeadroom;
|
|
31834
|
+
}
|
|
31835
|
+
if (change.launchTrackUsage !== void 0) {
|
|
31836
|
+
launchPatch.trackUsage = change.launchTrackUsage;
|
|
31837
|
+
}
|
|
31838
|
+
if (change.launchProvider !== void 0) {
|
|
31839
|
+
launchPatch.provider = change.launchProvider === false ? void 0 : change.launchProvider;
|
|
31840
|
+
}
|
|
31841
|
+
if (change.launchClaudeVersion !== void 0) {
|
|
31842
|
+
launchPatch.claudeVersion = change.launchClaudeVersion === false ? void 0 : change.launchClaudeVersion;
|
|
31843
|
+
}
|
|
31844
|
+
if (change.launchDelay !== void 0) {
|
|
31845
|
+
launchPatch.delay = change.launchDelay === false ? void 0 : change.launchDelay;
|
|
31846
|
+
}
|
|
31847
|
+
if (change.launchPause !== void 0) {
|
|
31848
|
+
launchPatch.pause = change.launchPause;
|
|
31849
|
+
}
|
|
31850
|
+
if (change.launchExplain !== void 0) {
|
|
31851
|
+
launchPatch.explain = change.launchExplain;
|
|
31852
|
+
}
|
|
31853
|
+
if (change.launchRouteByName !== void 0) {
|
|
31854
|
+
launchPatch.routeByName = change.launchRouteByName;
|
|
31855
|
+
}
|
|
31856
|
+
if (Object.keys(launchPatch).length > 0) {
|
|
31857
|
+
setProfileLaunchFlags(paths, name, launchPatch);
|
|
31858
|
+
touched = true;
|
|
31859
|
+
}
|
|
31860
|
+
return touched;
|
|
31861
|
+
}
|
|
31862
|
+
var import_node_fs5, import_node_path12, ProfileNotFoundError, ProfileAlreadyExistsError, InvalidCategoryNameError;
|
|
31863
|
+
var init_configProfilesStore = __esm({
|
|
31864
|
+
"src/configProfilesStore.ts"() {
|
|
31865
|
+
"use strict";
|
|
31866
|
+
import_node_fs5 = __toESM(require("node:fs"), 1);
|
|
31867
|
+
import_node_path12 = __toESM(require("node:path"), 1);
|
|
31868
|
+
init_store();
|
|
31869
|
+
init_schema();
|
|
31870
|
+
init_cliError();
|
|
31871
|
+
init_load();
|
|
31872
|
+
ProfileNotFoundError = class extends CliError {
|
|
31873
|
+
constructor(profileName) {
|
|
31874
|
+
super(`No configuration profile named "${profileName}". Run \`agent-shim profile add ${profileName}\` first.`);
|
|
31875
|
+
this.profileName = profileName;
|
|
31876
|
+
this.name = "ProfileNotFoundError";
|
|
31877
|
+
}
|
|
31878
|
+
profileName;
|
|
31879
|
+
};
|
|
31880
|
+
ProfileAlreadyExistsError = class extends CliError {
|
|
31881
|
+
constructor(profileName) {
|
|
31882
|
+
super(`A configuration profile named "${profileName}" already exists.`);
|
|
31883
|
+
this.profileName = profileName;
|
|
31884
|
+
this.name = "ProfileAlreadyExistsError";
|
|
31885
|
+
}
|
|
31886
|
+
profileName;
|
|
31887
|
+
};
|
|
31888
|
+
InvalidCategoryNameError = class extends CliError {
|
|
31889
|
+
constructor(categoryName) {
|
|
31890
|
+
super(`"${categoryName}" is not a category a configuration profile may toggle (runtime, history, knowledge, settings).`);
|
|
31891
|
+
this.categoryName = categoryName;
|
|
31892
|
+
this.name = "InvalidCategoryNameError";
|
|
31893
|
+
}
|
|
31894
|
+
categoryName;
|
|
31895
|
+
};
|
|
31896
|
+
}
|
|
31897
|
+
});
|
|
31898
|
+
|
|
31709
31899
|
// src/launcher/lock.ts
|
|
31710
31900
|
function identityLockPath(dir, identity) {
|
|
31711
31901
|
return import_node_path13.default.join(dir, `.${identity}.lock`);
|
|
@@ -34445,7 +34635,7 @@ var init_package = __esm({
|
|
|
34445
34635
|
"package.json"() {
|
|
34446
34636
|
package_default = {
|
|
34447
34637
|
name: "claude-use",
|
|
34448
|
-
version: "11.
|
|
34638
|
+
version: "11.37.0",
|
|
34449
34639
|
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.",
|
|
34450
34640
|
license: "MIT",
|
|
34451
34641
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -36306,6 +36496,58 @@ function resolveProvider(params) {
|
|
|
36306
36496
|
}
|
|
36307
36497
|
return { ok: true, provider: { name, definition, credential: resolution.credential }, warnings: resolution.credential.warnings };
|
|
36308
36498
|
}
|
|
36499
|
+
function resolveRoutedProviderCredentials(params) {
|
|
36500
|
+
const { models } = params;
|
|
36501
|
+
if (models === void 0) {
|
|
36502
|
+
return { ok: true, checked: [] };
|
|
36503
|
+
}
|
|
36504
|
+
const virtualNames = new Set(Object.keys(models.virtual ?? {}));
|
|
36505
|
+
const providerNames = /* @__PURE__ */ new Set();
|
|
36506
|
+
const collect = (ref) => {
|
|
36507
|
+
if (ref.startsWith("acct:") || ref.startsWith("family:") || virtualNames.has(ref)) {
|
|
36508
|
+
return;
|
|
36509
|
+
}
|
|
36510
|
+
const [provider] = ref.split("/", 1);
|
|
36511
|
+
if (provider !== void 0 && provider !== "") {
|
|
36512
|
+
providerNames.add(provider);
|
|
36513
|
+
}
|
|
36514
|
+
};
|
|
36515
|
+
for (const model of Object.values(models.virtual ?? {})) {
|
|
36516
|
+
for (const member of model.members) {
|
|
36517
|
+
collect(member);
|
|
36518
|
+
}
|
|
36519
|
+
}
|
|
36520
|
+
for (const ref of Object.values(models.tiers ?? {})) {
|
|
36521
|
+
collect(ref);
|
|
36522
|
+
}
|
|
36523
|
+
if (providerNames.size === 0) {
|
|
36524
|
+
return { ok: true, checked: [] };
|
|
36525
|
+
}
|
|
36526
|
+
if (params.credentials === void 0) {
|
|
36527
|
+
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` };
|
|
36528
|
+
}
|
|
36529
|
+
const failures = [];
|
|
36530
|
+
let credentialFailure = false;
|
|
36531
|
+
for (const name of [...providerNames].sort()) {
|
|
36532
|
+
const definition = loadProvider(params.paths.providersDir, name, params.port);
|
|
36533
|
+
if (definition === void 0) {
|
|
36534
|
+
failures.push(`no provider named "${name}"`);
|
|
36535
|
+
continue;
|
|
36536
|
+
}
|
|
36537
|
+
if (isRouterProvider(definition)) {
|
|
36538
|
+
continue;
|
|
36539
|
+
}
|
|
36540
|
+
const resolution = resolveCredential({ credential: definition.credential, env: params.env, port: params.credentials, subject: `provider ${name}` });
|
|
36541
|
+
if (!resolution.ok) {
|
|
36542
|
+
failures.push(resolution.message.replace(/^agent-shim: /, ""));
|
|
36543
|
+
credentialFailure = true;
|
|
36544
|
+
}
|
|
36545
|
+
}
|
|
36546
|
+
if (failures.length > 0) {
|
|
36547
|
+
return { ok: false, status: credentialFailure ? CREDENTIAL_UNAVAILABLE_EXIT : 1, message: `agent-shim: this launch routes model names through the models block, but: ${failures.join("; ")}` };
|
|
36548
|
+
}
|
|
36549
|
+
return { ok: true, checked: [...providerNames].sort() };
|
|
36550
|
+
}
|
|
36309
36551
|
var import_node_fs10, import_node_path29, ProviderNotFoundError, ProviderAlreadyExistsError, InvalidProviderNameError, PROVIDER_NAME_RE, LEGACY_PROVIDER_FIELDS, LEGACY_ENV_CREDENTIAL_KEYS, LEGACY_LITERAL_PLACEHOLDER, LegacyProviderFileError, ProviderKindMismatchError;
|
|
36310
36552
|
var init_providersStore = __esm({
|
|
36311
36553
|
"src/providersStore.ts"() {
|
|
@@ -65216,8 +65458,40 @@ function providerModelRows(provider, catalogue = []) {
|
|
|
65216
65458
|
const taken = new Set(named.map((row) => labelOf(row.model)));
|
|
65217
65459
|
return [...named, ...catalogueRows(provider, catalogue).filter((row) => !taken.has(labelOf(row.model)))];
|
|
65218
65460
|
}
|
|
65461
|
+
function routedModelRows(models, providers) {
|
|
65462
|
+
const hidden = new Set(models.hide ?? []);
|
|
65463
|
+
const shown = models.show === void 0 ? void 0 : new Set(models.show);
|
|
65464
|
+
const visible = (model) => shown === void 0 ? !hidden.has(model) : shown.has(model);
|
|
65465
|
+
const tierOf = (model) => {
|
|
65466
|
+
for (const [, provider] of providers) {
|
|
65467
|
+
if (provider.kind !== void 0 && provider.kind !== "http") {
|
|
65468
|
+
continue;
|
|
65469
|
+
}
|
|
65470
|
+
const env = provider.env ?? {};
|
|
65471
|
+
const match = Object.entries(env).find(([, value2]) => value2 === model);
|
|
65472
|
+
if (match?.[0].endsWith("_MODEL") === true) {
|
|
65473
|
+
const tier = match[0].replace("ANTHROPIC_DEFAULT_", "").replace("_MODEL", "").toLowerCase();
|
|
65474
|
+
return tier === "fable" || tier === "opus" || tier === "sonnet" || tier === "haiku" ? tier : void 0;
|
|
65475
|
+
}
|
|
65476
|
+
}
|
|
65477
|
+
return void 0;
|
|
65478
|
+
};
|
|
65479
|
+
const virtual = Object.entries(models.virtual ?? {}).flatMap(([name, definition]) => {
|
|
65480
|
+
if (!visible(name)) {
|
|
65481
|
+
return [];
|
|
65482
|
+
}
|
|
65483
|
+
const first = definition.members.find((member) => member.includes("/"));
|
|
65484
|
+
const tier = first === void 0 ? void 0 : tierOf(first.split("/").slice(1).join("/"));
|
|
65485
|
+
const behavesAs = tier === void 0 ? void 0 : TIER_BEHAVES_AS[tier];
|
|
65486
|
+
return behavesAs === void 0 ? [] : [{ model: name, label: name, description: `Virtual (${definition.mode})`, behavesAs }];
|
|
65487
|
+
});
|
|
65488
|
+
const concrete = providers.flatMap(([name, provider]) => providerModelRows(provider).map((row) => ({ ...row, model: `${name}/${row.model}`, label: `${name} / ${row.label}`, description: `${name}: ${row.description}` })));
|
|
65489
|
+
return [...virtual, ...concrete.filter((row) => visible(row.model))];
|
|
65490
|
+
}
|
|
65219
65491
|
function modelPickerSettings(provider, catalogue = []) {
|
|
65220
|
-
|
|
65492
|
+
return modelPickerSettingsFromRows(providerModelRows(provider, catalogue));
|
|
65493
|
+
}
|
|
65494
|
+
function modelPickerSettingsFromRows(options) {
|
|
65221
65495
|
return options.length === 0 ? void 0 : JSON.stringify({ modelPicker: { options, replaceBuiltInOptions: true } });
|
|
65222
65496
|
}
|
|
65223
65497
|
var CONTEXT_MARKER_1M2, TIER_BEHAVES_AS, TIER_ENV_VARIABLES;
|
|
@@ -65244,6 +65518,114 @@ var init_modelPicker = __esm({
|
|
|
65244
65518
|
}
|
|
65245
65519
|
});
|
|
65246
65520
|
|
|
65521
|
+
// src/modelsStore.ts
|
|
65522
|
+
function readModels(paths) {
|
|
65523
|
+
return readGlobalConfig(paths)?.models;
|
|
65524
|
+
}
|
|
65525
|
+
function writeModels(paths, models) {
|
|
65526
|
+
const emptied = models !== void 0 && Object.keys(models).length === 0 ? void 0 : models;
|
|
65527
|
+
applyPatch(paths.globalConfigFile, GlobalConfigSchema, { models: emptied }, { defaults: {} });
|
|
65528
|
+
}
|
|
65529
|
+
function stripEmpty(models) {
|
|
65530
|
+
const kept = {};
|
|
65531
|
+
if (models.virtual !== void 0 && Object.keys(models.virtual).length > 0) {
|
|
65532
|
+
kept.virtual = models.virtual;
|
|
65533
|
+
}
|
|
65534
|
+
if (models.tiers !== void 0 && Object.keys(models.tiers).length > 0) {
|
|
65535
|
+
kept.tiers = models.tiers;
|
|
65536
|
+
}
|
|
65537
|
+
if (models.prices !== void 0 && Object.keys(models.prices).length > 0) {
|
|
65538
|
+
kept.prices = models.prices;
|
|
65539
|
+
}
|
|
65540
|
+
if (models.hide !== void 0 && models.hide.length > 0) {
|
|
65541
|
+
kept.hide = models.hide;
|
|
65542
|
+
}
|
|
65543
|
+
if (models.show !== void 0 && models.show.length > 0) {
|
|
65544
|
+
kept.show = models.show;
|
|
65545
|
+
}
|
|
65546
|
+
return kept;
|
|
65547
|
+
}
|
|
65548
|
+
function memberKindOf(ref, models) {
|
|
65549
|
+
if (ref.startsWith("acct:")) {
|
|
65550
|
+
return "account";
|
|
65551
|
+
}
|
|
65552
|
+
if (ref.startsWith("family:")) {
|
|
65553
|
+
return "family";
|
|
65554
|
+
}
|
|
65555
|
+
return models?.virtual !== void 0 && ref in models.virtual ? "virtual" : "provider";
|
|
65556
|
+
}
|
|
65557
|
+
function expandMembers(name, models) {
|
|
65558
|
+
const virtual = models?.virtual ?? {};
|
|
65559
|
+
const expanded = [];
|
|
65560
|
+
const walk2 = (current, chain) => {
|
|
65561
|
+
const nested = virtual[current];
|
|
65562
|
+
if (nested !== void 0) {
|
|
65563
|
+
if (chain.includes(current)) {
|
|
65564
|
+
throw new Error(`virtual model cycle: ${[...chain, current].join(" -> ")}`);
|
|
65565
|
+
}
|
|
65566
|
+
for (const member of nested.members) {
|
|
65567
|
+
walk2(member, [...chain, current]);
|
|
65568
|
+
}
|
|
65569
|
+
return;
|
|
65570
|
+
}
|
|
65571
|
+
if (!expanded.includes(current)) {
|
|
65572
|
+
expanded.push(current);
|
|
65573
|
+
}
|
|
65574
|
+
};
|
|
65575
|
+
const top = virtual[name];
|
|
65576
|
+
if (top === void 0) {
|
|
65577
|
+
throw new VirtualModelNotFoundError(name);
|
|
65578
|
+
}
|
|
65579
|
+
for (const member of top.members) {
|
|
65580
|
+
walk2(member, [name]);
|
|
65581
|
+
}
|
|
65582
|
+
return expanded;
|
|
65583
|
+
}
|
|
65584
|
+
function setVirtualModel(paths, name, model) {
|
|
65585
|
+
const current = readModels(paths) ?? {};
|
|
65586
|
+
writeModels(paths, { ...current, virtual: { ...current.virtual ?? {}, [name]: model } });
|
|
65587
|
+
}
|
|
65588
|
+
function removeVirtualModel(paths, name) {
|
|
65589
|
+
const current = readModels(paths);
|
|
65590
|
+
if (current?.virtual?.[name] === void 0) {
|
|
65591
|
+
throw new VirtualModelNotFoundError(name);
|
|
65592
|
+
}
|
|
65593
|
+
const virtual = Object.fromEntries(Object.entries(current.virtual ?? {}).filter(([existing]) => existing !== name));
|
|
65594
|
+
writeModels(paths, stripEmpty({ ...current, virtual: Object.keys(virtual).length === 0 ? void 0 : virtual }));
|
|
65595
|
+
}
|
|
65596
|
+
function setPrice(paths, ref, prices) {
|
|
65597
|
+
const current = readModels(paths) ?? {};
|
|
65598
|
+
const priced = Object.fromEntries(Object.entries(current.prices ?? {}).filter(([existing]) => existing !== ref));
|
|
65599
|
+
const next = prices === void 0 ? priced : { ...priced, [ref]: prices };
|
|
65600
|
+
writeModels(paths, stripEmpty({ ...current, prices: Object.keys(next).length === 0 ? void 0 : next }));
|
|
65601
|
+
}
|
|
65602
|
+
function setTier(paths, tier, ref) {
|
|
65603
|
+
const current = readModels(paths) ?? {};
|
|
65604
|
+
const tiers = {};
|
|
65605
|
+
const merged = { ...current.tiers ?? {}, [tier]: ref };
|
|
65606
|
+
for (const [key, value2] of Object.entries(merged)) {
|
|
65607
|
+
if (value2 !== void 0) {
|
|
65608
|
+
tiers[key] = value2;
|
|
65609
|
+
}
|
|
65610
|
+
}
|
|
65611
|
+
writeModels(paths, stripEmpty({ ...current, tiers: Object.keys(tiers).length === 0 ? void 0 : tiers }));
|
|
65612
|
+
}
|
|
65613
|
+
var VirtualModelNotFoundError;
|
|
65614
|
+
var init_modelsStore = __esm({
|
|
65615
|
+
"src/modelsStore.ts"() {
|
|
65616
|
+
"use strict";
|
|
65617
|
+
init_store();
|
|
65618
|
+
init_schema();
|
|
65619
|
+
init_configProfilesStore();
|
|
65620
|
+
VirtualModelNotFoundError = class extends Error {
|
|
65621
|
+
constructor(name) {
|
|
65622
|
+
super(`No virtual model named "${name}".`);
|
|
65623
|
+
this.name = "VirtualModelNotFoundError";
|
|
65624
|
+
}
|
|
65625
|
+
};
|
|
65626
|
+
}
|
|
65627
|
+
});
|
|
65628
|
+
|
|
65247
65629
|
// src/launcher/pool.ts
|
|
65248
65630
|
function isResuming(passthrough) {
|
|
65249
65631
|
const end = passthrough.indexOf(TERMINATOR3);
|
|
@@ -65665,7 +66047,8 @@ function decideLaunch(params, readOnly) {
|
|
|
65665
66047
|
}
|
|
65666
66048
|
const flags = loginlessProvider === void 0 ? requestedFlags : { ...requestedFlags, remoteControl: false };
|
|
65667
66049
|
const catalogue = selectedProvider === void 0 ? void 0 : parseCatalogueCache(params.fs.readFileUtf8(catalogueCachePath(paths, selectedProvider.name)));
|
|
65668
|
-
const
|
|
66050
|
+
const routesByName = flags.routeByName || selectedProvider !== void 0 && isRouterProvider(selectedProvider.definition);
|
|
66051
|
+
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);
|
|
65669
66052
|
const callerSettings = hasSettingsArgument(parsedArgv.rest);
|
|
65670
66053
|
if (pickerSettings !== void 0 && callerSettings) {
|
|
65671
66054
|
notes.push("--settings was passed, so /model keeps Claude Code's own model names");
|
|
@@ -65767,6 +66150,14 @@ function prepareLaunch(params) {
|
|
|
65767
66150
|
if (decided.pinnedVersion !== void 0) {
|
|
65768
66151
|
rows.push(pinnedVersionRow(decided.pinnedVersion.version, decided.pinnedVersion.source));
|
|
65769
66152
|
}
|
|
66153
|
+
const routesByName = resolvedFlags.routeByName || resolvedProvider !== void 0 && isRouterProvider(resolvedProvider.definition);
|
|
66154
|
+
if (routesByName) {
|
|
66155
|
+
const check2 = resolveRoutedProviderCredentials({ paths, port: params.fs, env, ...params.credentials === void 0 ? {} : { credentials: params.credentials }, models: loadConfigFile(paths.globalConfigFile, GlobalConfigSchema, params.fs.readConfigFile)?.config.models });
|
|
66156
|
+
if (!check2.ok) {
|
|
66157
|
+
log.error(check2.message);
|
|
66158
|
+
proc.exit(check2.status);
|
|
66159
|
+
}
|
|
66160
|
+
}
|
|
65770
66161
|
const frontDoorPort = params.frontdoor;
|
|
65771
66162
|
const frontDoorEngaged = resolvedProvider !== void 0 || resolvedFlags.headroom || resolvedFlags.trackUsage;
|
|
65772
66163
|
if (frontDoorEngaged && frontDoorPort === void 0) {
|
|
@@ -65799,7 +66190,7 @@ function prepareLaunch(params) {
|
|
|
65799
66190
|
...headroom === void 0 ? {} : { headroom },
|
|
65800
66191
|
sessionId,
|
|
65801
66192
|
remoteControl: resolvedFlags.remoteControl,
|
|
65802
|
-
routeByName:
|
|
66193
|
+
routeByName: routesByName
|
|
65803
66194
|
});
|
|
65804
66195
|
const releases = [...headroom === void 0 || headroomPort === void 0 ? [] : [headroomPort.release], ...frontDoorRelease === void 0 ? [] : [frontDoorRelease]];
|
|
65805
66196
|
const release = () => {
|
|
@@ -65882,14 +66273,18 @@ var init_launcher = __esm({
|
|
|
65882
66273
|
init_launchReport();
|
|
65883
66274
|
init_modelPicker();
|
|
65884
66275
|
init_providerCatalogue();
|
|
66276
|
+
init_modelsStore();
|
|
66277
|
+
init_providersStore();
|
|
65885
66278
|
init_pool();
|
|
65886
66279
|
init_resumeContext();
|
|
65887
66280
|
init_lock();
|
|
65888
66281
|
init_spawn();
|
|
65889
66282
|
init_providersStore();
|
|
66283
|
+
init_load();
|
|
65890
66284
|
init_flatten();
|
|
65891
66285
|
init_walk();
|
|
65892
66286
|
init_schema();
|
|
66287
|
+
init_schema();
|
|
65893
66288
|
init_credential();
|
|
65894
66289
|
init_middleware();
|
|
65895
66290
|
init_preflight();
|
|
@@ -111679,192 +112074,7 @@ init_identity();
|
|
|
111679
112074
|
|
|
111680
112075
|
// src/poolStore.ts
|
|
111681
112076
|
init_cliError();
|
|
111682
|
-
|
|
111683
|
-
// src/configProfilesStore.ts
|
|
111684
|
-
var import_node_fs5 = __toESM(require("node:fs"), 1);
|
|
111685
|
-
var import_node_path12 = __toESM(require("node:path"), 1);
|
|
111686
|
-
init_store();
|
|
111687
|
-
init_schema();
|
|
111688
|
-
init_cliError();
|
|
111689
|
-
init_load();
|
|
111690
|
-
var ProfileNotFoundError = class extends CliError {
|
|
111691
|
-
constructor(profileName) {
|
|
111692
|
-
super(`No configuration profile named "${profileName}". Run \`agent-shim profile add ${profileName}\` first.`);
|
|
111693
|
-
this.profileName = profileName;
|
|
111694
|
-
this.name = "ProfileNotFoundError";
|
|
111695
|
-
}
|
|
111696
|
-
profileName;
|
|
111697
|
-
};
|
|
111698
|
-
var ProfileAlreadyExistsError = class extends CliError {
|
|
111699
|
-
constructor(profileName) {
|
|
111700
|
-
super(`A configuration profile named "${profileName}" already exists.`);
|
|
111701
|
-
this.profileName = profileName;
|
|
111702
|
-
this.name = "ProfileAlreadyExistsError";
|
|
111703
|
-
}
|
|
111704
|
-
profileName;
|
|
111705
|
-
};
|
|
111706
|
-
var InvalidCategoryNameError = class extends CliError {
|
|
111707
|
-
constructor(categoryName) {
|
|
111708
|
-
super(`"${categoryName}" is not a category a configuration profile may toggle (runtime, history, knowledge, settings).`);
|
|
111709
|
-
this.categoryName = categoryName;
|
|
111710
|
-
this.name = "InvalidCategoryNameError";
|
|
111711
|
-
}
|
|
111712
|
-
categoryName;
|
|
111713
|
-
};
|
|
111714
|
-
function profileJsonPath(paths, name) {
|
|
111715
|
-
return import_node_path12.default.join(paths.configProfilesDir, `${name}.json`);
|
|
111716
|
-
}
|
|
111717
|
-
function profileExists(paths, name) {
|
|
111718
|
-
return import_node_fs5.default.existsSync(profileJsonPath(paths, name));
|
|
111719
|
-
}
|
|
111720
|
-
function requireProfileExists(paths, name) {
|
|
111721
|
-
if (!profileExists(paths, name)) {
|
|
111722
|
-
throw new ProfileNotFoundError(name);
|
|
111723
|
-
}
|
|
111724
|
-
}
|
|
111725
|
-
function readProfile(paths, name) {
|
|
111726
|
-
return readJson(profileJsonPath(paths, name), ConfigProfileSchema);
|
|
111727
|
-
}
|
|
111728
|
-
function createProfile(paths, name, extendsList, description) {
|
|
111729
|
-
if (profileExists(paths, name)) {
|
|
111730
|
-
throw new ProfileAlreadyExistsError(name);
|
|
111731
|
-
}
|
|
111732
|
-
const filePath = profileJsonPath(paths, name);
|
|
111733
|
-
const parsed = ConfigProfileSchema.safeParse({
|
|
111734
|
-
...description === void 0 ? {} : { description },
|
|
111735
|
-
...extendsList !== void 0 && extendsList.length > 0 ? { extends: [...extendsList] } : {}
|
|
111736
|
-
});
|
|
111737
|
-
if (!parsed.success) {
|
|
111738
|
-
throw new ConfigValidationError(filePath, parsed.error.issues);
|
|
111739
|
-
}
|
|
111740
|
-
writeJsonAtomic(filePath, parsed.data);
|
|
111741
|
-
return parsed.data;
|
|
111742
|
-
}
|
|
111743
|
-
function listProfiles(paths) {
|
|
111744
|
-
if (!import_node_fs5.default.existsSync(paths.configProfilesDir)) {
|
|
111745
|
-
return [];
|
|
111746
|
-
}
|
|
111747
|
-
const names = import_node_fs5.default.readdirSync(paths.configProfilesDir, { withFileTypes: true }).filter((entry) => entry.isFile() && entry.name.endsWith(".json")).map((entry) => entry.name.slice(0, -".json".length)).sort();
|
|
111748
|
-
const result = [];
|
|
111749
|
-
for (const name of names) {
|
|
111750
|
-
const profile = readProfile(paths, name);
|
|
111751
|
-
if (profile !== void 0) {
|
|
111752
|
-
result.push({ name, profile });
|
|
111753
|
-
}
|
|
111754
|
-
}
|
|
111755
|
-
return result;
|
|
111756
|
-
}
|
|
111757
|
-
function globalConfigPath(paths) {
|
|
111758
|
-
return paths.globalConfigFile;
|
|
111759
|
-
}
|
|
111760
|
-
function readGlobalConfig(paths) {
|
|
111761
|
-
return readJson(globalConfigPath(paths), GlobalConfigSchema);
|
|
111762
|
-
}
|
|
111763
|
-
function setGlobalDefaultProfile(paths, name) {
|
|
111764
|
-
return applyPatch(
|
|
111765
|
-
globalConfigPath(paths),
|
|
111766
|
-
GlobalConfigSchema,
|
|
111767
|
-
{ defaultConfigProfile: name },
|
|
111768
|
-
{ defaults: {} }
|
|
111769
|
-
);
|
|
111770
|
-
}
|
|
111771
|
-
function validateCategoryNames(patch) {
|
|
111772
|
-
for (const key of Object.keys(patch)) {
|
|
111773
|
-
if (!isOverridableCategory(key)) {
|
|
111774
|
-
throw new InvalidCategoryNameError(key);
|
|
111775
|
-
}
|
|
111776
|
-
}
|
|
111777
|
-
}
|
|
111778
|
-
function setProfileCategories(paths, name, patch) {
|
|
111779
|
-
requireProfileExists(paths, name);
|
|
111780
|
-
const expandedPatch = expandAllCategoryKey(patch);
|
|
111781
|
-
validateCategoryNames(expandedPatch);
|
|
111782
|
-
const existing = readProfile(paths, name) ?? {};
|
|
111783
|
-
const mergedCategories = { ...existing.categories, ...expandedPatch };
|
|
111784
|
-
return applyPatch(profileJsonPath(paths, name), ConfigProfileSchema, { categories: mergedCategories });
|
|
111785
|
-
}
|
|
111786
|
-
function setProfileEntries(paths, name, patch) {
|
|
111787
|
-
requireProfileExists(paths, name);
|
|
111788
|
-
const existing = readProfile(paths, name) ?? {};
|
|
111789
|
-
const mergedEntries = { ...existing.entries, ...patch };
|
|
111790
|
-
return applyPatch(profileJsonPath(paths, name), ConfigProfileSchema, { entries: mergedEntries });
|
|
111791
|
-
}
|
|
111792
|
-
function setProfileLaunchFlags(paths, name, patch) {
|
|
111793
|
-
requireProfileExists(paths, name);
|
|
111794
|
-
const existing = readProfile(paths, name) ?? {};
|
|
111795
|
-
const mergedLaunch = { ...existing.launch, ...patch };
|
|
111796
|
-
return applyPatch(profileJsonPath(paths, name), ConfigProfileSchema, {
|
|
111797
|
-
// Read as `unknown` so the check sees the `undefined` a cleared key holds, which LaunchFlags' optional properties hide from the value type.
|
|
111798
|
-
launch: Object.values(mergedLaunch).every((value2) => value2 === void 0) ? void 0 : mergedLaunch
|
|
111799
|
-
});
|
|
111800
|
-
}
|
|
111801
|
-
function setProfileMetadata(paths, name, patch) {
|
|
111802
|
-
requireProfileExists(paths, name);
|
|
111803
|
-
return applyPatch(profileJsonPath(paths, name), ConfigProfileSchema, {
|
|
111804
|
-
...patch.extends === void 0 ? {} : { extends: patch.extends.length === 0 ? void 0 : [...patch.extends] },
|
|
111805
|
-
...patch.description === void 0 ? {} : { description: patch.description === false ? void 0 : patch.description }
|
|
111806
|
-
});
|
|
111807
|
-
}
|
|
111808
|
-
function removeProfile(paths, name) {
|
|
111809
|
-
requireProfileExists(paths, name);
|
|
111810
|
-
import_node_fs5.default.rmSync(profileJsonPath(paths, name));
|
|
111811
|
-
}
|
|
111812
|
-
function applyProfileChange(paths, name, change) {
|
|
111813
|
-
let touched = false;
|
|
111814
|
-
if (change.category !== void 0) {
|
|
111815
|
-
setProfileCategories(paths, name, change.category);
|
|
111816
|
-
touched = true;
|
|
111817
|
-
}
|
|
111818
|
-
if (change.entry !== void 0) {
|
|
111819
|
-
setProfileEntries(paths, name, change.entry);
|
|
111820
|
-
touched = true;
|
|
111821
|
-
}
|
|
111822
|
-
if (change.extends !== void 0 || change.description !== void 0) {
|
|
111823
|
-
setProfileMetadata(paths, name, {
|
|
111824
|
-
...change.extends === void 0 ? {} : { extends: change.extends === false ? [] : change.extends },
|
|
111825
|
-
...change.description === void 0 ? {} : { description: change.description }
|
|
111826
|
-
});
|
|
111827
|
-
touched = true;
|
|
111828
|
-
}
|
|
111829
|
-
const launchPatch = {};
|
|
111830
|
-
if (change.launchSkipPermissions !== void 0) {
|
|
111831
|
-
launchPatch.skipPermissions = change.launchSkipPermissions;
|
|
111832
|
-
}
|
|
111833
|
-
if (change.launchRemoteControl !== void 0) {
|
|
111834
|
-
launchPatch.remoteControl = change.launchRemoteControl;
|
|
111835
|
-
}
|
|
111836
|
-
if (change.launchHeadroom !== void 0) {
|
|
111837
|
-
launchPatch.headroom = change.launchHeadroom;
|
|
111838
|
-
}
|
|
111839
|
-
if (change.launchTrackUsage !== void 0) {
|
|
111840
|
-
launchPatch.trackUsage = change.launchTrackUsage;
|
|
111841
|
-
}
|
|
111842
|
-
if (change.launchProvider !== void 0) {
|
|
111843
|
-
launchPatch.provider = change.launchProvider === false ? void 0 : change.launchProvider;
|
|
111844
|
-
}
|
|
111845
|
-
if (change.launchClaudeVersion !== void 0) {
|
|
111846
|
-
launchPatch.claudeVersion = change.launchClaudeVersion === false ? void 0 : change.launchClaudeVersion;
|
|
111847
|
-
}
|
|
111848
|
-
if (change.launchDelay !== void 0) {
|
|
111849
|
-
launchPatch.delay = change.launchDelay === false ? void 0 : change.launchDelay;
|
|
111850
|
-
}
|
|
111851
|
-
if (change.launchPause !== void 0) {
|
|
111852
|
-
launchPatch.pause = change.launchPause;
|
|
111853
|
-
}
|
|
111854
|
-
if (change.launchExplain !== void 0) {
|
|
111855
|
-
launchPatch.explain = change.launchExplain;
|
|
111856
|
-
}
|
|
111857
|
-
if (change.launchRouteByName !== void 0) {
|
|
111858
|
-
launchPatch.routeByName = change.launchRouteByName;
|
|
111859
|
-
}
|
|
111860
|
-
if (Object.keys(launchPatch).length > 0) {
|
|
111861
|
-
setProfileLaunchFlags(paths, name, launchPatch);
|
|
111862
|
-
touched = true;
|
|
111863
|
-
}
|
|
111864
|
-
return touched;
|
|
111865
|
-
}
|
|
111866
|
-
|
|
111867
|
-
// src/poolStore.ts
|
|
112077
|
+
init_configProfilesStore();
|
|
111868
112078
|
init_store();
|
|
111869
112079
|
init_schema();
|
|
111870
112080
|
init_identity();
|
|
@@ -112156,6 +112366,9 @@ function removeIdentity(paths, name) {
|
|
|
112156
112366
|
}
|
|
112157
112367
|
}
|
|
112158
112368
|
|
|
112369
|
+
// src/configure.ts
|
|
112370
|
+
init_configProfilesStore();
|
|
112371
|
+
|
|
112159
112372
|
// src/directoryRulesStore.ts
|
|
112160
112373
|
init_store();
|
|
112161
112374
|
init_load();
|
|
@@ -113084,6 +113297,7 @@ async function resolveFarmConflicts(params) {
|
|
|
113084
113297
|
// src/configProfiles.ts
|
|
113085
113298
|
init_commandDeps();
|
|
113086
113299
|
init_cliError();
|
|
113300
|
+
init_configProfilesStore();
|
|
113087
113301
|
async function ensureProfileExists(deps, name) {
|
|
113088
113302
|
if (profileExists(deps.paths, name)) {
|
|
113089
113303
|
return;
|
|
@@ -114895,6 +115109,7 @@ var import_node_crypto25 = require("node:crypto");
|
|
|
114895
115109
|
var import_node_path53 = __toESM(require("node:path"), 1);
|
|
114896
115110
|
var import_node_fs19 = __toESM(require("node:fs"), 1);
|
|
114897
115111
|
init_commandDeps();
|
|
115112
|
+
init_configProfilesStore();
|
|
114898
115113
|
init_schema();
|
|
114899
115114
|
init_conditions();
|
|
114900
115115
|
|
|
@@ -115390,6 +115605,7 @@ var import_node_os7 = __toESM(require("node:os"), 1);
|
|
|
115390
115605
|
var import_node_path38 = __toESM(require("node:path"), 1);
|
|
115391
115606
|
init_package();
|
|
115392
115607
|
init_commandDeps();
|
|
115608
|
+
init_configProfilesStore();
|
|
115393
115609
|
init_store();
|
|
115394
115610
|
init_schema();
|
|
115395
115611
|
init_realFrontDoorPort();
|
|
@@ -115581,6 +115797,7 @@ function registerUpdateCommand(program2, deps, ports = realUpdatePorts) {
|
|
|
115581
115797
|
|
|
115582
115798
|
// src/jobStore.ts
|
|
115583
115799
|
init_cliError();
|
|
115800
|
+
init_configProfilesStore();
|
|
115584
115801
|
init_store();
|
|
115585
115802
|
init_schema();
|
|
115586
115803
|
var JobNotFoundError = class extends CliError {
|
|
@@ -119162,108 +119379,8 @@ init_credentialCache();
|
|
|
119162
119379
|
init_realCredentialCache();
|
|
119163
119380
|
init_source();
|
|
119164
119381
|
|
|
119165
|
-
// src/modelsStore.ts
|
|
119166
|
-
init_store();
|
|
119167
|
-
init_schema();
|
|
119168
|
-
function readModels(paths) {
|
|
119169
|
-
return readGlobalConfig(paths)?.models;
|
|
119170
|
-
}
|
|
119171
|
-
function writeModels(paths, models) {
|
|
119172
|
-
const emptied = models !== void 0 && Object.keys(models).length === 0 ? void 0 : models;
|
|
119173
|
-
applyPatch(paths.globalConfigFile, GlobalConfigSchema, { models: emptied }, { defaults: {} });
|
|
119174
|
-
}
|
|
119175
|
-
function stripEmpty(models) {
|
|
119176
|
-
const kept = {};
|
|
119177
|
-
if (models.virtual !== void 0 && Object.keys(models.virtual).length > 0) {
|
|
119178
|
-
kept.virtual = models.virtual;
|
|
119179
|
-
}
|
|
119180
|
-
if (models.tiers !== void 0 && Object.keys(models.tiers).length > 0) {
|
|
119181
|
-
kept.tiers = models.tiers;
|
|
119182
|
-
}
|
|
119183
|
-
if (models.prices !== void 0 && Object.keys(models.prices).length > 0) {
|
|
119184
|
-
kept.prices = models.prices;
|
|
119185
|
-
}
|
|
119186
|
-
if (models.hide !== void 0 && models.hide.length > 0) {
|
|
119187
|
-
kept.hide = models.hide;
|
|
119188
|
-
}
|
|
119189
|
-
if (models.show !== void 0 && models.show.length > 0) {
|
|
119190
|
-
kept.show = models.show;
|
|
119191
|
-
}
|
|
119192
|
-
return kept;
|
|
119193
|
-
}
|
|
119194
|
-
var VirtualModelNotFoundError = class extends Error {
|
|
119195
|
-
constructor(name) {
|
|
119196
|
-
super(`No virtual model named "${name}".`);
|
|
119197
|
-
this.name = "VirtualModelNotFoundError";
|
|
119198
|
-
}
|
|
119199
|
-
};
|
|
119200
|
-
function memberKindOf(ref, models) {
|
|
119201
|
-
if (ref.startsWith("acct:")) {
|
|
119202
|
-
return "account";
|
|
119203
|
-
}
|
|
119204
|
-
if (ref.startsWith("family:")) {
|
|
119205
|
-
return "family";
|
|
119206
|
-
}
|
|
119207
|
-
return models?.virtual !== void 0 && ref in models.virtual ? "virtual" : "provider";
|
|
119208
|
-
}
|
|
119209
|
-
function expandMembers(name, models) {
|
|
119210
|
-
const virtual = models?.virtual ?? {};
|
|
119211
|
-
const expanded = [];
|
|
119212
|
-
const walk2 = (current, chain) => {
|
|
119213
|
-
const nested = virtual[current];
|
|
119214
|
-
if (nested !== void 0) {
|
|
119215
|
-
if (chain.includes(current)) {
|
|
119216
|
-
throw new Error(`virtual model cycle: ${[...chain, current].join(" -> ")}`);
|
|
119217
|
-
}
|
|
119218
|
-
for (const member of nested.members) {
|
|
119219
|
-
walk2(member, [...chain, current]);
|
|
119220
|
-
}
|
|
119221
|
-
return;
|
|
119222
|
-
}
|
|
119223
|
-
if (!expanded.includes(current)) {
|
|
119224
|
-
expanded.push(current);
|
|
119225
|
-
}
|
|
119226
|
-
};
|
|
119227
|
-
const top = virtual[name];
|
|
119228
|
-
if (top === void 0) {
|
|
119229
|
-
throw new VirtualModelNotFoundError(name);
|
|
119230
|
-
}
|
|
119231
|
-
for (const member of top.members) {
|
|
119232
|
-
walk2(member, [name]);
|
|
119233
|
-
}
|
|
119234
|
-
return expanded;
|
|
119235
|
-
}
|
|
119236
|
-
function setVirtualModel(paths, name, model) {
|
|
119237
|
-
const current = readModels(paths) ?? {};
|
|
119238
|
-
writeModels(paths, { ...current, virtual: { ...current.virtual ?? {}, [name]: model } });
|
|
119239
|
-
}
|
|
119240
|
-
function removeVirtualModel(paths, name) {
|
|
119241
|
-
const current = readModels(paths);
|
|
119242
|
-
if (current?.virtual?.[name] === void 0) {
|
|
119243
|
-
throw new VirtualModelNotFoundError(name);
|
|
119244
|
-
}
|
|
119245
|
-
const virtual = Object.fromEntries(Object.entries(current.virtual ?? {}).filter(([existing]) => existing !== name));
|
|
119246
|
-
writeModels(paths, stripEmpty({ ...current, virtual: Object.keys(virtual).length === 0 ? void 0 : virtual }));
|
|
119247
|
-
}
|
|
119248
|
-
function setPrice(paths, ref, prices) {
|
|
119249
|
-
const current = readModels(paths) ?? {};
|
|
119250
|
-
const priced = Object.fromEntries(Object.entries(current.prices ?? {}).filter(([existing]) => existing !== ref));
|
|
119251
|
-
const next = prices === void 0 ? priced : { ...priced, [ref]: prices };
|
|
119252
|
-
writeModels(paths, stripEmpty({ ...current, prices: Object.keys(next).length === 0 ? void 0 : next }));
|
|
119253
|
-
}
|
|
119254
|
-
function setTier(paths, tier, ref) {
|
|
119255
|
-
const current = readModels(paths) ?? {};
|
|
119256
|
-
const tiers = {};
|
|
119257
|
-
const merged = { ...current.tiers ?? {}, [tier]: ref };
|
|
119258
|
-
for (const [key, value2] of Object.entries(merged)) {
|
|
119259
|
-
if (value2 !== void 0) {
|
|
119260
|
-
tiers[key] = value2;
|
|
119261
|
-
}
|
|
119262
|
-
}
|
|
119263
|
-
writeModels(paths, stripEmpty({ ...current, tiers: Object.keys(tiers).length === 0 ? void 0 : tiers }));
|
|
119264
|
-
}
|
|
119265
|
-
|
|
119266
119382
|
// src/models/doctor.ts
|
|
119383
|
+
init_modelsStore();
|
|
119267
119384
|
function modelsFindings(input2) {
|
|
119268
119385
|
const findings = [];
|
|
119269
119386
|
const { models } = input2;
|
|
@@ -119318,6 +119435,9 @@ function modelsFindings(input2) {
|
|
|
119318
119435
|
return findings;
|
|
119319
119436
|
}
|
|
119320
119437
|
|
|
119438
|
+
// src/doctorReport.ts
|
|
119439
|
+
init_configProfilesStore();
|
|
119440
|
+
|
|
119321
119441
|
// src/headroom/allowlistDrift.ts
|
|
119322
119442
|
init_earlierRelease();
|
|
119323
119443
|
init_state2();
|
|
@@ -128141,6 +128261,7 @@ function createCodexApiRouter(deps) {
|
|
|
128141
128261
|
// src/frontdoor/configApi.ts
|
|
128142
128262
|
init_cliError();
|
|
128143
128263
|
init_schema();
|
|
128264
|
+
init_configProfilesStore();
|
|
128144
128265
|
init_credential();
|
|
128145
128266
|
init_identity();
|
|
128146
128267
|
init_providersStore();
|
|
@@ -131398,6 +131519,7 @@ function attachingProviderCredential(route, deps) {
|
|
|
131398
131519
|
}
|
|
131399
131520
|
|
|
131400
131521
|
// src/frontdoor/commands.ts
|
|
131522
|
+
init_modelsStore();
|
|
131401
131523
|
init_realFrontDoorPort();
|
|
131402
131524
|
|
|
131403
131525
|
// src/frontdoor/rcCommands.ts
|
|
@@ -146005,6 +146127,7 @@ var import_node_http5 = __toESM(require("node:http"), 1);
|
|
|
146005
146127
|
var import_node_path58 = __toESM(require("node:path"), 1);
|
|
146006
146128
|
var import_node_child_process9 = require("node:child_process");
|
|
146007
146129
|
init_commandDeps();
|
|
146130
|
+
init_configProfilesStore();
|
|
146008
146131
|
init_realFrontDoorPort();
|
|
146009
146132
|
init_trust();
|
|
146010
146133
|
|
|
@@ -147326,6 +147449,7 @@ function sameFamilyOtherVersion(a10, b) {
|
|
|
147326
147449
|
}
|
|
147327
147450
|
|
|
147328
147451
|
// src/models.ts
|
|
147452
|
+
init_modelsStore();
|
|
147329
147453
|
function providerModels(paths) {
|
|
147330
147454
|
return listProviders(paths).flatMap((entry) => {
|
|
147331
147455
|
const catalogue = parseCatalogueCache(realFsPort.readFileUtf8(catalogueCachePath(paths, entry.name)));
|
|
@@ -148011,6 +148135,7 @@ function buildProgram(deps) {
|
|
|
148011
148135
|
|
|
148012
148136
|
// src/runClaude.ts
|
|
148013
148137
|
init_cliError();
|
|
148138
|
+
init_configProfilesStore();
|
|
148014
148139
|
init_launchWiring();
|
|
148015
148140
|
init_paths();
|
|
148016
148141
|
|