claude-use 11.35.0 → 11.36.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 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.35.0",
34638
+ version: "11.36.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>",
@@ -65216,8 +65406,40 @@ function providerModelRows(provider, catalogue = []) {
65216
65406
  const taken = new Set(named.map((row) => labelOf(row.model)));
65217
65407
  return [...named, ...catalogueRows(provider, catalogue).filter((row) => !taken.has(labelOf(row.model)))];
65218
65408
  }
65409
+ function routedModelRows(models, providers) {
65410
+ const hidden = new Set(models.hide ?? []);
65411
+ const shown = models.show === void 0 ? void 0 : new Set(models.show);
65412
+ const visible = (model) => shown === void 0 ? !hidden.has(model) : shown.has(model);
65413
+ const tierOf = (model) => {
65414
+ for (const [, provider] of providers) {
65415
+ if (provider.kind !== void 0 && provider.kind !== "http") {
65416
+ continue;
65417
+ }
65418
+ const env = provider.env ?? {};
65419
+ const match = Object.entries(env).find(([, value2]) => value2 === model);
65420
+ if (match?.[0].endsWith("_MODEL") === true) {
65421
+ const tier = match[0].replace("ANTHROPIC_DEFAULT_", "").replace("_MODEL", "").toLowerCase();
65422
+ return tier === "fable" || tier === "opus" || tier === "sonnet" || tier === "haiku" ? tier : void 0;
65423
+ }
65424
+ }
65425
+ return void 0;
65426
+ };
65427
+ const virtual = Object.entries(models.virtual ?? {}).flatMap(([name, definition]) => {
65428
+ if (!visible(name)) {
65429
+ return [];
65430
+ }
65431
+ const first = definition.members.find((member) => member.includes("/"));
65432
+ const tier = first === void 0 ? void 0 : tierOf(first.split("/").slice(1).join("/"));
65433
+ const behavesAs = tier === void 0 ? void 0 : TIER_BEHAVES_AS[tier];
65434
+ return behavesAs === void 0 ? [] : [{ model: name, label: name, description: `Virtual (${definition.mode})`, behavesAs }];
65435
+ });
65436
+ const concrete = providers.flatMap(([name, provider]) => providerModelRows(provider).map((row) => ({ ...row, model: `${name}/${row.model}`, label: `${name} / ${row.label}`, description: `${name}: ${row.description}` })));
65437
+ return [...virtual, ...concrete.filter((row) => visible(row.model))];
65438
+ }
65219
65439
  function modelPickerSettings(provider, catalogue = []) {
65220
- const options = providerModelRows(provider, catalogue);
65440
+ return modelPickerSettingsFromRows(providerModelRows(provider, catalogue));
65441
+ }
65442
+ function modelPickerSettingsFromRows(options) {
65221
65443
  return options.length === 0 ? void 0 : JSON.stringify({ modelPicker: { options, replaceBuiltInOptions: true } });
65222
65444
  }
65223
65445
  var CONTEXT_MARKER_1M2, TIER_BEHAVES_AS, TIER_ENV_VARIABLES;
@@ -65244,6 +65466,114 @@ var init_modelPicker = __esm({
65244
65466
  }
65245
65467
  });
65246
65468
 
65469
+ // src/modelsStore.ts
65470
+ function readModels(paths) {
65471
+ return readGlobalConfig(paths)?.models;
65472
+ }
65473
+ function writeModels(paths, models) {
65474
+ const emptied = models !== void 0 && Object.keys(models).length === 0 ? void 0 : models;
65475
+ applyPatch(paths.globalConfigFile, GlobalConfigSchema, { models: emptied }, { defaults: {} });
65476
+ }
65477
+ function stripEmpty(models) {
65478
+ const kept = {};
65479
+ if (models.virtual !== void 0 && Object.keys(models.virtual).length > 0) {
65480
+ kept.virtual = models.virtual;
65481
+ }
65482
+ if (models.tiers !== void 0 && Object.keys(models.tiers).length > 0) {
65483
+ kept.tiers = models.tiers;
65484
+ }
65485
+ if (models.prices !== void 0 && Object.keys(models.prices).length > 0) {
65486
+ kept.prices = models.prices;
65487
+ }
65488
+ if (models.hide !== void 0 && models.hide.length > 0) {
65489
+ kept.hide = models.hide;
65490
+ }
65491
+ if (models.show !== void 0 && models.show.length > 0) {
65492
+ kept.show = models.show;
65493
+ }
65494
+ return kept;
65495
+ }
65496
+ function memberKindOf(ref, models) {
65497
+ if (ref.startsWith("acct:")) {
65498
+ return "account";
65499
+ }
65500
+ if (ref.startsWith("family:")) {
65501
+ return "family";
65502
+ }
65503
+ return models?.virtual !== void 0 && ref in models.virtual ? "virtual" : "provider";
65504
+ }
65505
+ function expandMembers(name, models) {
65506
+ const virtual = models?.virtual ?? {};
65507
+ const expanded = [];
65508
+ const walk2 = (current, chain) => {
65509
+ const nested = virtual[current];
65510
+ if (nested !== void 0) {
65511
+ if (chain.includes(current)) {
65512
+ throw new Error(`virtual model cycle: ${[...chain, current].join(" -> ")}`);
65513
+ }
65514
+ for (const member of nested.members) {
65515
+ walk2(member, [...chain, current]);
65516
+ }
65517
+ return;
65518
+ }
65519
+ if (!expanded.includes(current)) {
65520
+ expanded.push(current);
65521
+ }
65522
+ };
65523
+ const top = virtual[name];
65524
+ if (top === void 0) {
65525
+ throw new VirtualModelNotFoundError(name);
65526
+ }
65527
+ for (const member of top.members) {
65528
+ walk2(member, [name]);
65529
+ }
65530
+ return expanded;
65531
+ }
65532
+ function setVirtualModel(paths, name, model) {
65533
+ const current = readModels(paths) ?? {};
65534
+ writeModels(paths, { ...current, virtual: { ...current.virtual ?? {}, [name]: model } });
65535
+ }
65536
+ function removeVirtualModel(paths, name) {
65537
+ const current = readModels(paths);
65538
+ if (current?.virtual?.[name] === void 0) {
65539
+ throw new VirtualModelNotFoundError(name);
65540
+ }
65541
+ const virtual = Object.fromEntries(Object.entries(current.virtual ?? {}).filter(([existing]) => existing !== name));
65542
+ writeModels(paths, stripEmpty({ ...current, virtual: Object.keys(virtual).length === 0 ? void 0 : virtual }));
65543
+ }
65544
+ function setPrice(paths, ref, prices) {
65545
+ const current = readModels(paths) ?? {};
65546
+ const priced = Object.fromEntries(Object.entries(current.prices ?? {}).filter(([existing]) => existing !== ref));
65547
+ const next = prices === void 0 ? priced : { ...priced, [ref]: prices };
65548
+ writeModels(paths, stripEmpty({ ...current, prices: Object.keys(next).length === 0 ? void 0 : next }));
65549
+ }
65550
+ function setTier(paths, tier, ref) {
65551
+ const current = readModels(paths) ?? {};
65552
+ const tiers = {};
65553
+ const merged = { ...current.tiers ?? {}, [tier]: ref };
65554
+ for (const [key, value2] of Object.entries(merged)) {
65555
+ if (value2 !== void 0) {
65556
+ tiers[key] = value2;
65557
+ }
65558
+ }
65559
+ writeModels(paths, stripEmpty({ ...current, tiers: Object.keys(tiers).length === 0 ? void 0 : tiers }));
65560
+ }
65561
+ var VirtualModelNotFoundError;
65562
+ var init_modelsStore = __esm({
65563
+ "src/modelsStore.ts"() {
65564
+ "use strict";
65565
+ init_store();
65566
+ init_schema();
65567
+ init_configProfilesStore();
65568
+ VirtualModelNotFoundError = class extends Error {
65569
+ constructor(name) {
65570
+ super(`No virtual model named "${name}".`);
65571
+ this.name = "VirtualModelNotFoundError";
65572
+ }
65573
+ };
65574
+ }
65575
+ });
65576
+
65247
65577
  // src/launcher/pool.ts
65248
65578
  function isResuming(passthrough) {
65249
65579
  const end = passthrough.indexOf(TERMINATOR3);
@@ -65665,7 +65995,8 @@ function decideLaunch(params, readOnly) {
65665
65995
  }
65666
65996
  const flags = loginlessProvider === void 0 ? requestedFlags : { ...requestedFlags, remoteControl: false };
65667
65997
  const catalogue = selectedProvider === void 0 ? void 0 : parseCatalogueCache(params.fs.readFileUtf8(catalogueCachePath(paths, selectedProvider.name)));
65668
- const pickerSettings = selectedProvider === void 0 ? void 0 : modelPickerSettings(selectedProvider.definition, catalogue?.models);
65998
+ const routesByName = flags.routeByName || selectedProvider !== void 0 && isRouterProvider(selectedProvider.definition);
65999
+ 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
66000
  const callerSettings = hasSettingsArgument(parsedArgv.rest);
65670
66001
  if (pickerSettings !== void 0 && callerSettings) {
65671
66002
  notes.push("--settings was passed, so /model keeps Claude Code's own model names");
@@ -65882,6 +66213,8 @@ var init_launcher = __esm({
65882
66213
  init_launchReport();
65883
66214
  init_modelPicker();
65884
66215
  init_providerCatalogue();
66216
+ init_modelsStore();
66217
+ init_providersStore();
65885
66218
  init_pool();
65886
66219
  init_resumeContext();
65887
66220
  init_lock();
@@ -111679,192 +112012,7 @@ init_identity();
111679
112012
 
111680
112013
  // src/poolStore.ts
111681
112014
  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
112015
+ init_configProfilesStore();
111868
112016
  init_store();
111869
112017
  init_schema();
111870
112018
  init_identity();
@@ -112156,6 +112304,9 @@ function removeIdentity(paths, name) {
112156
112304
  }
112157
112305
  }
112158
112306
 
112307
+ // src/configure.ts
112308
+ init_configProfilesStore();
112309
+
112159
112310
  // src/directoryRulesStore.ts
112160
112311
  init_store();
112161
112312
  init_load();
@@ -113084,6 +113235,7 @@ async function resolveFarmConflicts(params) {
113084
113235
  // src/configProfiles.ts
113085
113236
  init_commandDeps();
113086
113237
  init_cliError();
113238
+ init_configProfilesStore();
113087
113239
  async function ensureProfileExists(deps, name) {
113088
113240
  if (profileExists(deps.paths, name)) {
113089
113241
  return;
@@ -114895,6 +115047,7 @@ var import_node_crypto25 = require("node:crypto");
114895
115047
  var import_node_path53 = __toESM(require("node:path"), 1);
114896
115048
  var import_node_fs19 = __toESM(require("node:fs"), 1);
114897
115049
  init_commandDeps();
115050
+ init_configProfilesStore();
114898
115051
  init_schema();
114899
115052
  init_conditions();
114900
115053
 
@@ -115390,6 +115543,7 @@ var import_node_os7 = __toESM(require("node:os"), 1);
115390
115543
  var import_node_path38 = __toESM(require("node:path"), 1);
115391
115544
  init_package();
115392
115545
  init_commandDeps();
115546
+ init_configProfilesStore();
115393
115547
  init_store();
115394
115548
  init_schema();
115395
115549
  init_realFrontDoorPort();
@@ -115581,6 +115735,7 @@ function registerUpdateCommand(program2, deps, ports = realUpdatePorts) {
115581
115735
 
115582
115736
  // src/jobStore.ts
115583
115737
  init_cliError();
115738
+ init_configProfilesStore();
115584
115739
  init_store();
115585
115740
  init_schema();
115586
115741
  var JobNotFoundError = class extends CliError {
@@ -119162,108 +119317,8 @@ init_credentialCache();
119162
119317
  init_realCredentialCache();
119163
119318
  init_source();
119164
119319
 
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
119320
  // src/models/doctor.ts
119321
+ init_modelsStore();
119267
119322
  function modelsFindings(input2) {
119268
119323
  const findings = [];
119269
119324
  const { models } = input2;
@@ -119318,6 +119373,9 @@ function modelsFindings(input2) {
119318
119373
  return findings;
119319
119374
  }
119320
119375
 
119376
+ // src/doctorReport.ts
119377
+ init_configProfilesStore();
119378
+
119321
119379
  // src/headroom/allowlistDrift.ts
119322
119380
  init_earlierRelease();
119323
119381
  init_state2();
@@ -128141,6 +128199,7 @@ function createCodexApiRouter(deps) {
128141
128199
  // src/frontdoor/configApi.ts
128142
128200
  init_cliError();
128143
128201
  init_schema();
128202
+ init_configProfilesStore();
128144
128203
  init_credential();
128145
128204
  init_identity();
128146
128205
  init_providersStore();
@@ -131398,6 +131457,7 @@ function attachingProviderCredential(route, deps) {
131398
131457
  }
131399
131458
 
131400
131459
  // src/frontdoor/commands.ts
131460
+ init_modelsStore();
131401
131461
  init_realFrontDoorPort();
131402
131462
 
131403
131463
  // src/frontdoor/rcCommands.ts
@@ -146005,6 +146065,7 @@ var import_node_http5 = __toESM(require("node:http"), 1);
146005
146065
  var import_node_path58 = __toESM(require("node:path"), 1);
146006
146066
  var import_node_child_process9 = require("node:child_process");
146007
146067
  init_commandDeps();
146068
+ init_configProfilesStore();
146008
146069
  init_realFrontDoorPort();
146009
146070
  init_trust();
146010
146071
 
@@ -147326,6 +147387,7 @@ function sameFamilyOtherVersion(a10, b) {
147326
147387
  }
147327
147388
 
147328
147389
  // src/models.ts
147390
+ init_modelsStore();
147329
147391
  function providerModels(paths) {
147330
147392
  return listProviders(paths).flatMap((entry) => {
147331
147393
  const catalogue = parseCatalogueCache(realFsPort.readFileUtf8(catalogueCachePath(paths, entry.name)));
@@ -148011,6 +148073,7 @@ function buildProgram(deps) {
148011
148073
 
148012
148074
  // src/runClaude.ts
148013
148075
  init_cliError();
148076
+ init_configProfilesStore();
148014
148077
  init_launchWiring();
148015
148078
  init_paths();
148016
148079