claude-use 11.41.0 → 11.43.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 +518 -378
- package/dist/index.cjs +296 -227
- package/dist/index.mjs +295 -226
- package/dist/types/index.d.ts +549 -495
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2076,7 +2076,8 @@ function assembleCascade(input) {
|
|
|
2076
2076
|
...config.categories === void 0 ? {} : { categories: config.categories },
|
|
2077
2077
|
...config.entries === void 0 ? {} : { entries: config.entries },
|
|
2078
2078
|
...entryOrder === void 0 ? {} : { entryOrder },
|
|
2079
|
-
...config.launch === void 0 ? {} : { launch: config.launch }
|
|
2079
|
+
...config.launch === void 0 ? {} : { launch: config.launch },
|
|
2080
|
+
...config.models === void 0 ? {} : { models: config.models }
|
|
2080
2081
|
});
|
|
2081
2082
|
nextId += 1;
|
|
2082
2083
|
}
|
|
@@ -3032,6 +3033,9 @@ function pruneDeadFrontDoorDirectRecords(fs13, recordsDir, records, liveness) {
|
|
|
3032
3033
|
}
|
|
3033
3034
|
}
|
|
3034
3035
|
}
|
|
3036
|
+
function recordOf(details) {
|
|
3037
|
+
return details === void 0 ? {} : { sessionId: details.sessionId, ...details.models === void 0 ? {} : { models: details.models } };
|
|
3038
|
+
}
|
|
3035
3039
|
function writeFrontDoorSession(fs13, sessionsDir, session) {
|
|
3036
3040
|
fs13.mkdirPrivate(sessionsDir);
|
|
3037
3041
|
fs13.writeFilePrivate(import_node_path8.default.join(sessionsDir, `${String(session.pid)}.json`), `${JSON.stringify(session, null, 2)}
|
|
@@ -3073,8 +3077,9 @@ var init_state = __esm({
|
|
|
3073
3077
|
"use strict";
|
|
3074
3078
|
import_node_path8 = __toESM(require("node:path"), 1);
|
|
3075
3079
|
import_zod3 = require("zod");
|
|
3080
|
+
init_schema();
|
|
3076
3081
|
FRONT_DOOR_PROTOCOL = 4;
|
|
3077
|
-
FrontDoorSessionSchema = import_zod3.z.strictObject({ pid: import_zod3.z.number().int().positive(), startedAt: import_zod3.z.number(), token: import_zod3.z.string().min(1), supervisorPid: import_zod3.z.number().int().positive().optional() });
|
|
3082
|
+
FrontDoorSessionSchema = import_zod3.z.strictObject({ pid: import_zod3.z.number().int().positive(), startedAt: import_zod3.z.number(), token: import_zod3.z.string().min(1), supervisorPid: import_zod3.z.number().int().positive().optional(), sessionId: import_zod3.z.string().min(1).optional(), models: ModelsConfigSchema.optional() });
|
|
3078
3083
|
FrontDoorStateSchema = import_zod3.z.strictObject({
|
|
3079
3084
|
/**
|
|
3080
3085
|
* The launcher-to-door wire protocol this supervisor speaks, written once it is serving; absent in state written by a release that predates the field, which `ensureFrontDoor` reads as protocol 0. A launcher replaces a door whose protocol is lower than its own (see `FRONT_DOOR_PROTOCOL`).
|
|
@@ -3146,7 +3151,7 @@ var init_package = __esm({
|
|
|
3146
3151
|
"package.json"() {
|
|
3147
3152
|
package_default = {
|
|
3148
3153
|
name: "claude-use",
|
|
3149
|
-
version: "11.
|
|
3154
|
+
version: "11.43.0",
|
|
3150
3155
|
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.",
|
|
3151
3156
|
license: "MIT",
|
|
3152
3157
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -6930,6 +6935,213 @@ var init_credential = __esm({
|
|
|
6930
6935
|
}
|
|
6931
6936
|
});
|
|
6932
6937
|
|
|
6938
|
+
// src/models/identity.ts
|
|
6939
|
+
function withoutContextMarker(model) {
|
|
6940
|
+
return model.toLowerCase().endsWith(CONTEXT_MARKER_1M) ? model.slice(0, -CONTEXT_MARKER_1M.length) : model;
|
|
6941
|
+
}
|
|
6942
|
+
function canonicalText(name) {
|
|
6943
|
+
return name.trim().toLowerCase().replace(NON_IDENTITY_BRACKET_RE, "").replace(/[\s_]+/g, "-").replace(/([a-z])(\d+(?:\.\d+)+)/g, "$1-$2").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
6944
|
+
}
|
|
6945
|
+
function splitVariants(tokens) {
|
|
6946
|
+
const variants = [];
|
|
6947
|
+
let end = tokens.length;
|
|
6948
|
+
for (; ; ) {
|
|
6949
|
+
const token = tokens[end - 1];
|
|
6950
|
+
if (token === void 0 || !KNOWN_VARIANTS.has(token)) {
|
|
6951
|
+
return { familyTokens: tokens.slice(0, end), variants };
|
|
6952
|
+
}
|
|
6953
|
+
variants.unshift(token);
|
|
6954
|
+
end -= 1;
|
|
6955
|
+
}
|
|
6956
|
+
}
|
|
6957
|
+
function versionOf(tokens) {
|
|
6958
|
+
for (let index = 0; index < tokens.length; index += 1) {
|
|
6959
|
+
const token = tokens[index];
|
|
6960
|
+
const next = tokens[index + 1];
|
|
6961
|
+
if (token === void 0) {
|
|
6962
|
+
return "";
|
|
6963
|
+
}
|
|
6964
|
+
if (/^\d+$/.test(token) && next !== void 0 && /^\d+$/.test(next)) {
|
|
6965
|
+
return `${token}.${next}`;
|
|
6966
|
+
}
|
|
6967
|
+
const dotted = /^\d+(?:\.\d+)+$/.exec(token);
|
|
6968
|
+
if (dotted !== null) {
|
|
6969
|
+
return dotted[0];
|
|
6970
|
+
}
|
|
6971
|
+
}
|
|
6972
|
+
return "";
|
|
6973
|
+
}
|
|
6974
|
+
function modelIdentity(rawName) {
|
|
6975
|
+
const segments = rawName.trim().toLowerCase().split("/");
|
|
6976
|
+
const stripped = canonicalText(segments[segments.length - 1] ?? "").split(":")[0] ?? "";
|
|
6977
|
+
const withoutDate = stripped.replace(DATE_STAMP_RE, "");
|
|
6978
|
+
const tokens = withoutDate.split("-").filter((token) => token !== "");
|
|
6979
|
+
const { familyTokens, variants } = splitVariants(tokens);
|
|
6980
|
+
const version = versionOf(familyTokens);
|
|
6981
|
+
const versionless = familyTokens.filter((token, index) => {
|
|
6982
|
+
if (version === "") {
|
|
6983
|
+
return true;
|
|
6984
|
+
}
|
|
6985
|
+
const dotted = /^\d+(?:\.\d+)+$/.test(token);
|
|
6986
|
+
const previous = familyTokens[index - 1];
|
|
6987
|
+
const next = familyTokens[index + 1];
|
|
6988
|
+
const insideVersionRun = dotted || /^\d+$/.test(token) && (previous !== void 0 && /^\d+$/.test(previous) || next !== void 0 && /^\d+$/.test(next));
|
|
6989
|
+
return !insideVersionRun;
|
|
6990
|
+
});
|
|
6991
|
+
const family = versionless.join("-");
|
|
6992
|
+
const tokenVendor = familyTokens.find((token) => Object.keys(VENDOR_BY_TOKEN).some((key) => token === key || token.startsWith(key)));
|
|
6993
|
+
const namespace = segments.length >= 2 ? (segments[0] ?? "").split(":").pop() ?? "" : "";
|
|
6994
|
+
const namespaceVendor = VENDOR_BY_NAMESPACE[namespace] ?? "";
|
|
6995
|
+
const tokenVendorName = tokenVendor === void 0 ? "" : VENDOR_BY_TOKEN[Object.keys(VENDOR_BY_TOKEN).find((key) => tokenVendor === key || tokenVendor.startsWith(key)) ?? ""] ?? "";
|
|
6996
|
+
return {
|
|
6997
|
+
vendor: tokenVendorName === "" ? namespaceVendor : tokenVendorName,
|
|
6998
|
+
vendorConflict: tokenVendorName !== "" && namespaceVendor !== "" && tokenVendorName !== namespaceVendor,
|
|
6999
|
+
family,
|
|
7000
|
+
version,
|
|
7001
|
+
variant: variants.join("-"),
|
|
7002
|
+
familyAndVersion: version === "" ? family : `${family}-${version.replace(/\./g, "-")}`
|
|
7003
|
+
};
|
|
7004
|
+
}
|
|
7005
|
+
function relateModels(left, right) {
|
|
7006
|
+
const a = modelIdentity(left);
|
|
7007
|
+
const b = modelIdentity(right);
|
|
7008
|
+
if (a.familyAndVersion !== b.familyAndVersion) {
|
|
7009
|
+
return sameFamilyOtherVersion(a, b) ? "similar" : "distinct";
|
|
7010
|
+
}
|
|
7011
|
+
if (a.variant !== b.variant || a.vendorConflict || b.vendorConflict || a.vendor !== "" && b.vendor !== "" && a.vendor !== b.vendor) {
|
|
7012
|
+
return "similar";
|
|
7013
|
+
}
|
|
7014
|
+
return "same";
|
|
7015
|
+
}
|
|
7016
|
+
function sameFamilyOtherVersion(a, b) {
|
|
7017
|
+
if (a.family !== b.family) {
|
|
7018
|
+
return false;
|
|
7019
|
+
}
|
|
7020
|
+
if (a.vendor !== "" && b.vendor !== "" && a.vendor !== b.vendor) {
|
|
7021
|
+
return false;
|
|
7022
|
+
}
|
|
7023
|
+
return true;
|
|
7024
|
+
}
|
|
7025
|
+
var NON_IDENTITY_BRACKET_RE, CONTEXT_MARKER_1M, DATE_STAMP_RE, KNOWN_VARIANTS, VENDOR_BY_NAMESPACE, VENDOR_BY_TOKEN;
|
|
7026
|
+
var init_identity2 = __esm({
|
|
7027
|
+
"src/models/identity.ts"() {
|
|
7028
|
+
"use strict";
|
|
7029
|
+
NON_IDENTITY_BRACKET_RE = /\[[^\]]*\]/g;
|
|
7030
|
+
CONTEXT_MARKER_1M = "[1m]";
|
|
7031
|
+
DATE_STAMP_RE = /-(?:19|20)\d{2}(?:0[1-9]|1[0-2])(?:0[1-9]|[12]\d|3[01])$/;
|
|
7032
|
+
KNOWN_VARIANTS = /* @__PURE__ */ new Set(["high", "medium", "low", "thinking", "xhigh", "max", "highspeed", "sol", "terra", "luna", "mini", "flash-lite", "turbo"]);
|
|
7033
|
+
VENDOR_BY_NAMESPACE = Object.freeze({
|
|
7034
|
+
anthropic: "anthropic",
|
|
7035
|
+
google: "google",
|
|
7036
|
+
openai: "openai",
|
|
7037
|
+
zai: "zai",
|
|
7038
|
+
"z-ai": "zai",
|
|
7039
|
+
minimax: "minimax",
|
|
7040
|
+
qwen: "qwen",
|
|
7041
|
+
deepseek: "deepseek",
|
|
7042
|
+
moonshot: "moonshot",
|
|
7043
|
+
meta: "meta",
|
|
7044
|
+
mistral: "mistral"
|
|
7045
|
+
});
|
|
7046
|
+
VENDOR_BY_TOKEN = Object.freeze({
|
|
7047
|
+
claude: "anthropic",
|
|
7048
|
+
gemini: "google",
|
|
7049
|
+
antigravity: "google",
|
|
7050
|
+
gpt: "openai",
|
|
7051
|
+
glm: "zai",
|
|
7052
|
+
minimax: "minimax",
|
|
7053
|
+
qwen: "qwen",
|
|
7054
|
+
deepseek: "deepseek",
|
|
7055
|
+
kimi: "moonshot",
|
|
7056
|
+
llama: "meta",
|
|
7057
|
+
mistral: "mistral",
|
|
7058
|
+
mixtral: "mistral"
|
|
7059
|
+
});
|
|
7060
|
+
}
|
|
7061
|
+
});
|
|
7062
|
+
|
|
7063
|
+
// src/models/families.ts
|
|
7064
|
+
function modelOf(ref) {
|
|
7065
|
+
const slash = ref.indexOf("/");
|
|
7066
|
+
return slash === -1 ? ref : ref.slice(slash + 1);
|
|
7067
|
+
}
|
|
7068
|
+
function familyKeyOf(rawModel) {
|
|
7069
|
+
const identity = modelIdentity(rawModel);
|
|
7070
|
+
return identity.variant === "" ? identity.familyAndVersion : `${identity.familyAndVersion}${VARIANT_SEPARATOR}${identity.variant}`;
|
|
7071
|
+
}
|
|
7072
|
+
function assertionsOf(models) {
|
|
7073
|
+
return { same: models?.same ?? [], distinct: models?.distinct ?? [] };
|
|
7074
|
+
}
|
|
7075
|
+
function sameModel(left, right, assertions) {
|
|
7076
|
+
if (assertions.distinct.some(([a, b]) => a === left && b === right || a === right && b === left)) {
|
|
7077
|
+
return false;
|
|
7078
|
+
}
|
|
7079
|
+
const leftGroup = assertions.same.find((group) => group.includes(left));
|
|
7080
|
+
const rightGroup = assertions.same.find((group) => group.includes(right));
|
|
7081
|
+
if (leftGroup !== void 0 && leftGroup === rightGroup) {
|
|
7082
|
+
return true;
|
|
7083
|
+
}
|
|
7084
|
+
if (leftGroup !== void 0 && !leftGroup.includes(right) || rightGroup !== void 0 && !rightGroup.includes(left)) {
|
|
7085
|
+
return false;
|
|
7086
|
+
}
|
|
7087
|
+
return relateModels(modelOf(left), modelOf(right)) === "same";
|
|
7088
|
+
}
|
|
7089
|
+
function pinnedTo(settings, ref) {
|
|
7090
|
+
return settings?.names?.some((name) => name === ref || name === modelOf(ref)) === true;
|
|
7091
|
+
}
|
|
7092
|
+
function buildFamilies(refs, models) {
|
|
7093
|
+
const assertions = assertionsOf(models);
|
|
7094
|
+
const settingsByKey = models?.families ?? {};
|
|
7095
|
+
const groups = [];
|
|
7096
|
+
for (const ref of refs) {
|
|
7097
|
+
const pinnedKey = Object.entries(settingsByKey).find(([, settings]) => pinnedTo(settings, ref))?.[0];
|
|
7098
|
+
const joined2 = groups.find((group) => pinnedKey === void 0 ? group.refs.some((first) => sameModel(first, ref, assertions)) : group.key === pinnedKey);
|
|
7099
|
+
if (joined2 !== void 0) {
|
|
7100
|
+
joined2.refs.push(ref);
|
|
7101
|
+
} else {
|
|
7102
|
+
groups.push({ key: pinnedKey ?? familyKeyOf(modelOf(ref)), refs: [ref] });
|
|
7103
|
+
}
|
|
7104
|
+
}
|
|
7105
|
+
return groups.map((group) => ({ key: group.key, refs: group.refs, settings: settingsByKey[group.key] ?? {} }));
|
|
7106
|
+
}
|
|
7107
|
+
function familyNamed(families, member) {
|
|
7108
|
+
if (!member.startsWith(FAMILY_PREFIX)) {
|
|
7109
|
+
return void 0;
|
|
7110
|
+
}
|
|
7111
|
+
const key = member.slice(FAMILY_PREFIX.length);
|
|
7112
|
+
return families.find((family) => family.key === key);
|
|
7113
|
+
}
|
|
7114
|
+
function familyMode(settings) {
|
|
7115
|
+
return settings.mode ?? "ordered";
|
|
7116
|
+
}
|
|
7117
|
+
function sharedFamilies(families) {
|
|
7118
|
+
return families.filter((family) => family.refs.length > 1);
|
|
7119
|
+
}
|
|
7120
|
+
function expandFamilyMembers(members, families) {
|
|
7121
|
+
const expanded = [];
|
|
7122
|
+
for (const member of members) {
|
|
7123
|
+
for (const ref of member.startsWith(FAMILY_PREFIX) ? familyNamed(families, member)?.refs ?? [] : [member]) {
|
|
7124
|
+
if (!expanded.includes(ref)) {
|
|
7125
|
+
expanded.push(ref);
|
|
7126
|
+
}
|
|
7127
|
+
}
|
|
7128
|
+
}
|
|
7129
|
+
return expanded;
|
|
7130
|
+
}
|
|
7131
|
+
function accountRefsOf(models) {
|
|
7132
|
+
const named = [...(models?.same ?? []).flat(), ...Object.values(models?.families ?? {}).flatMap((settings) => settings.names ?? [])];
|
|
7133
|
+
return [...new Set(named.filter((ref) => ref.startsWith("acct:")))];
|
|
7134
|
+
}
|
|
7135
|
+
var FAMILY_PREFIX, VARIANT_SEPARATOR;
|
|
7136
|
+
var init_families = __esm({
|
|
7137
|
+
"src/models/families.ts"() {
|
|
7138
|
+
"use strict";
|
|
7139
|
+
init_identity2();
|
|
7140
|
+
FAMILY_PREFIX = "family:";
|
|
7141
|
+
VARIANT_SEPARATOR = "+";
|
|
7142
|
+
}
|
|
7143
|
+
});
|
|
7144
|
+
|
|
6933
7145
|
// src/providersStore.ts
|
|
6934
7146
|
function providerJsonPath(paths, name) {
|
|
6935
7147
|
return import_node_path25.default.join(paths.providersDir, `${name}.json`);
|
|
@@ -7224,8 +7436,15 @@ function resolveRoutedProviderCredentials(params) {
|
|
|
7224
7436
|
}
|
|
7225
7437
|
const virtualNames = new Set(Object.keys(models.virtual ?? {}));
|
|
7226
7438
|
const providerNames = /* @__PURE__ */ new Set();
|
|
7439
|
+
const families = () => buildFamilies(params.targets?.() ?? [], models);
|
|
7227
7440
|
const collect = (ref) => {
|
|
7228
|
-
if (ref.startsWith(
|
|
7441
|
+
if (ref.startsWith(FAMILY_PREFIX)) {
|
|
7442
|
+
for (const target of expandFamilyMembers([ref], families())) {
|
|
7443
|
+
collect(target);
|
|
7444
|
+
}
|
|
7445
|
+
return;
|
|
7446
|
+
}
|
|
7447
|
+
if (ref.startsWith("acct:") || virtualNames.has(ref)) {
|
|
7229
7448
|
return;
|
|
7230
7449
|
}
|
|
7231
7450
|
const [provider] = ref.split("/", 1);
|
|
@@ -7282,6 +7501,7 @@ var init_providersStore = __esm({
|
|
|
7282
7501
|
init_cliError();
|
|
7283
7502
|
init_credential();
|
|
7284
7503
|
init_walk();
|
|
7504
|
+
init_families();
|
|
7285
7505
|
ProviderNotFoundError = class extends CliError {
|
|
7286
7506
|
constructor(name) {
|
|
7287
7507
|
super(`No provider named "${name}". Run \`agent-shim provider add ${name}\` first.`);
|
|
@@ -7587,9 +7807,6 @@ var init_claudeShim = __esm({
|
|
|
7587
7807
|
});
|
|
7588
7808
|
|
|
7589
7809
|
// src/modelsStore.ts
|
|
7590
|
-
function readModels(paths) {
|
|
7591
|
-
return readGlobalConfig(paths)?.models;
|
|
7592
|
-
}
|
|
7593
7810
|
function memberKindOf(ref, models) {
|
|
7594
7811
|
if (ref.startsWith("acct:")) {
|
|
7595
7812
|
return "account";
|
|
@@ -7642,131 +7859,6 @@ var init_modelsStore = __esm({
|
|
|
7642
7859
|
}
|
|
7643
7860
|
});
|
|
7644
7861
|
|
|
7645
|
-
// src/models/identity.ts
|
|
7646
|
-
function withoutContextMarker(model) {
|
|
7647
|
-
return model.toLowerCase().endsWith(CONTEXT_MARKER_1M) ? model.slice(0, -CONTEXT_MARKER_1M.length) : model;
|
|
7648
|
-
}
|
|
7649
|
-
function canonicalText(name) {
|
|
7650
|
-
return name.trim().toLowerCase().replace(NON_IDENTITY_BRACKET_RE, "").replace(/[\s_]+/g, "-").replace(/([a-z])(\d+(?:\.\d+)+)/g, "$1-$2").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
7651
|
-
}
|
|
7652
|
-
function splitVariants(tokens) {
|
|
7653
|
-
const variants = [];
|
|
7654
|
-
let end = tokens.length;
|
|
7655
|
-
for (; ; ) {
|
|
7656
|
-
const token = tokens[end - 1];
|
|
7657
|
-
if (token === void 0 || !KNOWN_VARIANTS.has(token)) {
|
|
7658
|
-
return { familyTokens: tokens.slice(0, end), variants };
|
|
7659
|
-
}
|
|
7660
|
-
variants.unshift(token);
|
|
7661
|
-
end -= 1;
|
|
7662
|
-
}
|
|
7663
|
-
}
|
|
7664
|
-
function versionOf(tokens) {
|
|
7665
|
-
for (let index = 0; index < tokens.length; index += 1) {
|
|
7666
|
-
const token = tokens[index];
|
|
7667
|
-
const next = tokens[index + 1];
|
|
7668
|
-
if (token === void 0) {
|
|
7669
|
-
return "";
|
|
7670
|
-
}
|
|
7671
|
-
if (/^\d+$/.test(token) && next !== void 0 && /^\d+$/.test(next)) {
|
|
7672
|
-
return `${token}.${next}`;
|
|
7673
|
-
}
|
|
7674
|
-
const dotted = /^\d+(?:\.\d+)+$/.exec(token);
|
|
7675
|
-
if (dotted !== null) {
|
|
7676
|
-
return dotted[0];
|
|
7677
|
-
}
|
|
7678
|
-
}
|
|
7679
|
-
return "";
|
|
7680
|
-
}
|
|
7681
|
-
function modelIdentity(rawName) {
|
|
7682
|
-
const segments = rawName.trim().toLowerCase().split("/");
|
|
7683
|
-
const stripped = canonicalText(segments[segments.length - 1] ?? "").split(":")[0] ?? "";
|
|
7684
|
-
const withoutDate = stripped.replace(DATE_STAMP_RE, "");
|
|
7685
|
-
const tokens = withoutDate.split("-").filter((token) => token !== "");
|
|
7686
|
-
const { familyTokens, variants } = splitVariants(tokens);
|
|
7687
|
-
const version = versionOf(familyTokens);
|
|
7688
|
-
const versionless = familyTokens.filter((token, index) => {
|
|
7689
|
-
if (version === "") {
|
|
7690
|
-
return true;
|
|
7691
|
-
}
|
|
7692
|
-
const dotted = /^\d+(?:\.\d+)+$/.test(token);
|
|
7693
|
-
const previous = familyTokens[index - 1];
|
|
7694
|
-
const next = familyTokens[index + 1];
|
|
7695
|
-
const insideVersionRun = dotted || /^\d+$/.test(token) && (previous !== void 0 && /^\d+$/.test(previous) || next !== void 0 && /^\d+$/.test(next));
|
|
7696
|
-
return !insideVersionRun;
|
|
7697
|
-
});
|
|
7698
|
-
const family = versionless.join("-");
|
|
7699
|
-
const tokenVendor = familyTokens.find((token) => Object.keys(VENDOR_BY_TOKEN).some((key) => token === key || token.startsWith(key)));
|
|
7700
|
-
const namespace = segments.length >= 2 ? (segments[0] ?? "").split(":").pop() ?? "" : "";
|
|
7701
|
-
const namespaceVendor = VENDOR_BY_NAMESPACE[namespace] ?? "";
|
|
7702
|
-
const tokenVendorName = tokenVendor === void 0 ? "" : VENDOR_BY_TOKEN[Object.keys(VENDOR_BY_TOKEN).find((key) => tokenVendor === key || tokenVendor.startsWith(key)) ?? ""] ?? "";
|
|
7703
|
-
return {
|
|
7704
|
-
vendor: tokenVendorName === "" ? namespaceVendor : tokenVendorName,
|
|
7705
|
-
vendorConflict: tokenVendorName !== "" && namespaceVendor !== "" && tokenVendorName !== namespaceVendor,
|
|
7706
|
-
family,
|
|
7707
|
-
version,
|
|
7708
|
-
variant: variants.join("-"),
|
|
7709
|
-
familyAndVersion: version === "" ? family : `${family}-${version.replace(/\./g, "-")}`
|
|
7710
|
-
};
|
|
7711
|
-
}
|
|
7712
|
-
function relateModels(left, right) {
|
|
7713
|
-
const a = modelIdentity(left);
|
|
7714
|
-
const b = modelIdentity(right);
|
|
7715
|
-
if (a.familyAndVersion !== b.familyAndVersion) {
|
|
7716
|
-
return sameFamilyOtherVersion(a, b) ? "similar" : "distinct";
|
|
7717
|
-
}
|
|
7718
|
-
if (a.variant !== b.variant || a.vendorConflict || b.vendorConflict || a.vendor !== "" && b.vendor !== "" && a.vendor !== b.vendor) {
|
|
7719
|
-
return "similar";
|
|
7720
|
-
}
|
|
7721
|
-
return "same";
|
|
7722
|
-
}
|
|
7723
|
-
function sameFamilyOtherVersion(a, b) {
|
|
7724
|
-
if (a.family !== b.family) {
|
|
7725
|
-
return false;
|
|
7726
|
-
}
|
|
7727
|
-
if (a.vendor !== "" && b.vendor !== "" && a.vendor !== b.vendor) {
|
|
7728
|
-
return false;
|
|
7729
|
-
}
|
|
7730
|
-
return true;
|
|
7731
|
-
}
|
|
7732
|
-
var NON_IDENTITY_BRACKET_RE, CONTEXT_MARKER_1M, DATE_STAMP_RE, KNOWN_VARIANTS, VENDOR_BY_NAMESPACE, VENDOR_BY_TOKEN;
|
|
7733
|
-
var init_identity2 = __esm({
|
|
7734
|
-
"src/models/identity.ts"() {
|
|
7735
|
-
"use strict";
|
|
7736
|
-
NON_IDENTITY_BRACKET_RE = /\[[^\]]*\]/g;
|
|
7737
|
-
CONTEXT_MARKER_1M = "[1m]";
|
|
7738
|
-
DATE_STAMP_RE = /-(?:19|20)\d{2}(?:0[1-9]|1[0-2])(?:0[1-9]|[12]\d|3[01])$/;
|
|
7739
|
-
KNOWN_VARIANTS = /* @__PURE__ */ new Set(["high", "medium", "low", "thinking", "xhigh", "max", "highspeed", "sol", "terra", "luna", "mini", "flash-lite", "turbo"]);
|
|
7740
|
-
VENDOR_BY_NAMESPACE = Object.freeze({
|
|
7741
|
-
anthropic: "anthropic",
|
|
7742
|
-
google: "google",
|
|
7743
|
-
openai: "openai",
|
|
7744
|
-
zai: "zai",
|
|
7745
|
-
"z-ai": "zai",
|
|
7746
|
-
minimax: "minimax",
|
|
7747
|
-
qwen: "qwen",
|
|
7748
|
-
deepseek: "deepseek",
|
|
7749
|
-
moonshot: "moonshot",
|
|
7750
|
-
meta: "meta",
|
|
7751
|
-
mistral: "mistral"
|
|
7752
|
-
});
|
|
7753
|
-
VENDOR_BY_TOKEN = Object.freeze({
|
|
7754
|
-
claude: "anthropic",
|
|
7755
|
-
gemini: "google",
|
|
7756
|
-
antigravity: "google",
|
|
7757
|
-
gpt: "openai",
|
|
7758
|
-
glm: "zai",
|
|
7759
|
-
minimax: "minimax",
|
|
7760
|
-
qwen: "qwen",
|
|
7761
|
-
deepseek: "deepseek",
|
|
7762
|
-
kimi: "moonshot",
|
|
7763
|
-
llama: "meta",
|
|
7764
|
-
mistral: "mistral",
|
|
7765
|
-
mixtral: "mistral"
|
|
7766
|
-
});
|
|
7767
|
-
}
|
|
7768
|
-
});
|
|
7769
|
-
|
|
7770
7862
|
// src/selection/engine.ts
|
|
7771
7863
|
var init_engine = __esm({
|
|
7772
7864
|
"src/selection/engine.ts"() {
|
|
@@ -8070,30 +8162,29 @@ function routedModelRows(models, providers) {
|
|
|
8070
8162
|
const hidden = new Set(models.hide ?? []);
|
|
8071
8163
|
const shown = models.show === void 0 ? void 0 : new Set(models.show);
|
|
8072
8164
|
const visible = (model) => shown === void 0 ? !hidden.has(model) : shown.has(model);
|
|
8073
|
-
const
|
|
8074
|
-
|
|
8075
|
-
|
|
8076
|
-
|
|
8077
|
-
}
|
|
8078
|
-
const match = Object.entries(provider.env ?? {}).find(([key, value]) => value === model && key.startsWith("ANTHROPIC_DEFAULT_") && key.endsWith("_MODEL"));
|
|
8079
|
-
if (match !== void 0) {
|
|
8080
|
-
const tier = match[0].replace("ANTHROPIC_DEFAULT_", "").replace("_MODEL", "").toLowerCase();
|
|
8081
|
-
return tier === "fable" || tier === "opus" || tier === "sonnet" || tier === "haiku" ? tier : void 0;
|
|
8082
|
-
}
|
|
8083
|
-
}
|
|
8084
|
-
return void 0;
|
|
8085
|
-
};
|
|
8165
|
+
const concrete = providers.flatMap(([name, provider]) => providerModelRows(provider).map((row) => ({ ...row, model: `${name}/${row.model}`, label: `${name} / ${row.label}`, description: `${name}: ${row.description}` })));
|
|
8166
|
+
const concreteByRef = new Map(concrete.map((row) => [row.model, row]));
|
|
8167
|
+
const families = buildFamilies([...concrete.map((row) => row.model), ...accountRefsOf(models)], models);
|
|
8168
|
+
const handlingOf = (refs) => refs.map((ref) => concreteByRef.get(ref)?.behavesAs).find((behavesAs) => behavesAs !== void 0) ?? TIER_BEHAVES_AS.sonnet;
|
|
8086
8169
|
const virtual = Object.entries(models.virtual ?? {}).flatMap(([name, definition]) => {
|
|
8087
8170
|
if (!visible(name)) {
|
|
8088
8171
|
return [];
|
|
8089
8172
|
}
|
|
8090
|
-
const
|
|
8091
|
-
|
|
8092
|
-
const behavesAs = tier === void 0 ? void 0 : TIER_BEHAVES_AS[tier];
|
|
8093
|
-
return behavesAs === void 0 ? [] : [{ model: name, label: name, description: `Virtual (${definition.mode})`, behavesAs }];
|
|
8173
|
+
const targets = expandFamilyMembers(safeExpand(name, models), families);
|
|
8174
|
+
return [{ model: name, label: name, description: `Virtual (${definition.mode})`, behavesAs: handlingOf(targets) }];
|
|
8094
8175
|
});
|
|
8095
|
-
const
|
|
8096
|
-
|
|
8176
|
+
const familyRows = sharedFamilies(families).flatMap((family) => {
|
|
8177
|
+
const member = `${FAMILY_PREFIX}${family.key}`;
|
|
8178
|
+
return visible(member) ? [{ model: member, label: family.key, description: `Family (${familyMode(family.settings)}): ${family.refs.join(", ")}`, behavesAs: handlingOf(family.refs) }] : [];
|
|
8179
|
+
});
|
|
8180
|
+
return [...virtual, ...familyRows, ...concrete.filter((row) => visible(row.model))];
|
|
8181
|
+
}
|
|
8182
|
+
function safeExpand(name, models) {
|
|
8183
|
+
try {
|
|
8184
|
+
return expandMembers(name, models);
|
|
8185
|
+
} catch {
|
|
8186
|
+
return models.virtual?.[name]?.members ?? [];
|
|
8187
|
+
}
|
|
8097
8188
|
}
|
|
8098
8189
|
function modelPickerSettings(provider, catalogue = []) {
|
|
8099
8190
|
return modelPickerSettingsFromRows(providerModelRows(provider, catalogue), true);
|
|
@@ -8110,6 +8201,8 @@ var init_modelPicker = __esm({
|
|
|
8110
8201
|
init_providerCatalogue();
|
|
8111
8202
|
init_schema();
|
|
8112
8203
|
init_identity2();
|
|
8204
|
+
init_families();
|
|
8205
|
+
init_modelsStore();
|
|
8113
8206
|
TIER_BEHAVES_AS = Object.freeze({
|
|
8114
8207
|
fable: "claude-fable-5-1",
|
|
8115
8208
|
opus: "claude-opus-5-5",
|
|
@@ -8125,6 +8218,26 @@ var init_modelPicker = __esm({
|
|
|
8125
8218
|
}
|
|
8126
8219
|
});
|
|
8127
8220
|
|
|
8221
|
+
// src/models/targets.ts
|
|
8222
|
+
function providerModels(paths) {
|
|
8223
|
+
return listProviders(paths).flatMap((entry) => {
|
|
8224
|
+
const catalogue = parseCatalogueCache(realFsPort.readFileUtf8(catalogueCachePath(paths, entry.name)));
|
|
8225
|
+
return providerModelRows(entry.provider, catalogue?.models).map((row) => ({ provider: entry.name, model: row.model }));
|
|
8226
|
+
});
|
|
8227
|
+
}
|
|
8228
|
+
function targetRefs(paths) {
|
|
8229
|
+
return providerModels(paths).map((entry) => `${entry.provider}/${entry.model}`);
|
|
8230
|
+
}
|
|
8231
|
+
var init_targets = __esm({
|
|
8232
|
+
"src/models/targets.ts"() {
|
|
8233
|
+
"use strict";
|
|
8234
|
+
init_modelPicker();
|
|
8235
|
+
init_providerCatalogue();
|
|
8236
|
+
init_providersStore();
|
|
8237
|
+
init_realPorts();
|
|
8238
|
+
}
|
|
8239
|
+
});
|
|
8240
|
+
|
|
8128
8241
|
// src/frontdoor/probe.ts
|
|
8129
8242
|
function probeFrontDoorSync(port, caPem) {
|
|
8130
8243
|
refuseToBlockInRole("a synchronous probe of the front door");
|
|
@@ -8312,7 +8425,7 @@ function ensureFrontDoor(params) {
|
|
|
8312
8425
|
if (state?.port !== void 0 && state.connectPort !== void 0) {
|
|
8313
8426
|
if (supervisorPid === params.launcherPid && params.replace !== true && ports.isFrontDoorSupervisor(supervisorPid)) {
|
|
8314
8427
|
const token = (0, import_node_crypto10.randomUUID)();
|
|
8315
|
-
writeFrontDoorSession(ports.fs, paths.frontdoorSessionsDir, { pid: params.launcherPid, startedAt: ports.now(), token, supervisorPid });
|
|
8428
|
+
writeFrontDoorSession(ports.fs, paths.frontdoorSessionsDir, { pid: params.launcherPid, startedAt: ports.now(), token, supervisorPid, ...recordOf(params.session) });
|
|
8316
8429
|
return { port: state.port, connectPort: state.connectPort, token };
|
|
8317
8430
|
}
|
|
8318
8431
|
const verdict = verifyWithRetry(state.port);
|
|
@@ -8326,7 +8439,7 @@ function ensureFrontDoor(params) {
|
|
|
8326
8439
|
}
|
|
8327
8440
|
if (verdict.ok) {
|
|
8328
8441
|
const token = (0, import_node_crypto10.randomUUID)();
|
|
8329
|
-
writeFrontDoorSession(ports.fs, paths.frontdoorSessionsDir, { pid: params.launcherPid, startedAt: ports.now(), token, supervisorPid });
|
|
8442
|
+
writeFrontDoorSession(ports.fs, paths.frontdoorSessionsDir, { pid: params.launcherPid, startedAt: ports.now(), token, supervisorPid, ...recordOf(params.session) });
|
|
8330
8443
|
return { port: state.port, connectPort: state.connectPort, token };
|
|
8331
8444
|
}
|
|
8332
8445
|
lastRejection = `the listener on 127.0.0.1:${String(state.port)} (recorded for pid ${String(supervisorPid)}) failed authentication: ${verdict.reason}`;
|
|
@@ -8786,6 +8899,14 @@ function buildEnv(params) {
|
|
|
8786
8899
|
env[key] = value;
|
|
8787
8900
|
}
|
|
8788
8901
|
}
|
|
8902
|
+
if (params.routeByName) {
|
|
8903
|
+
for (const tier of CLAUDE_TIERS) {
|
|
8904
|
+
const ref = params.tierModels?.[tier];
|
|
8905
|
+
if (ref !== void 0) {
|
|
8906
|
+
env[`ANTHROPIC_DEFAULT_${tier.toUpperCase()}_MODEL`] = ref;
|
|
8907
|
+
}
|
|
8908
|
+
}
|
|
8909
|
+
}
|
|
8789
8910
|
if (params.provider !== void 0) {
|
|
8790
8911
|
env.ANTHROPIC_AUTH_TOKEN = params.remoteControl ? void 0 : PROVIDER_SESSION_PLACEHOLDER;
|
|
8791
8912
|
env.ANTHROPIC_API_KEY = void 0;
|
|
@@ -8828,6 +8949,7 @@ var init_flags = __esm({
|
|
|
8828
8949
|
init_envBool();
|
|
8829
8950
|
init_cliError();
|
|
8830
8951
|
init_conditions();
|
|
8952
|
+
init_schema();
|
|
8831
8953
|
init_credential();
|
|
8832
8954
|
init_headers();
|
|
8833
8955
|
init_capability();
|
|
@@ -9562,10 +9684,12 @@ function decideLaunch(params, readOnly) {
|
|
|
9562
9684
|
}
|
|
9563
9685
|
const launchCascade = farmContext?.cascade ?? (params.farm === void 0 ? void 0 : params.farm.loadCascade(configProfileDecision.name, cliOverride));
|
|
9564
9686
|
let cascadeLaunch;
|
|
9687
|
+
let cascadeModels;
|
|
9565
9688
|
if (launchCascade !== void 0 && params.farm !== void 0) {
|
|
9566
9689
|
const assembled = assembleCascade(launchCascade);
|
|
9567
9690
|
const flattened = flattenLayers(assembled.layers, { home: params.farm.home });
|
|
9568
9691
|
cascadeLaunch = flattened.launch;
|
|
9692
|
+
cascadeModels = flattened.models;
|
|
9569
9693
|
if (readOnly || farmContext === void 0) {
|
|
9570
9694
|
reportDiagnostics(log, [...assembled.diagnostics, ...flattened.diagnostics], { errorsAsWarnings: readOnly });
|
|
9571
9695
|
}
|
|
@@ -9594,7 +9718,9 @@ function decideLaunch(params, readOnly) {
|
|
|
9594
9718
|
const flags = loginlessProvider === void 0 ? requestedFlags : { ...requestedFlags, remoteControl: false };
|
|
9595
9719
|
const catalogue = selectedProvider === void 0 ? void 0 : parseCatalogueCache(params.fs.readFileUtf8(catalogueCachePath(paths, selectedProvider.name)));
|
|
9596
9720
|
const routesByName = flags.routeByName || selectedProvider !== void 0 && isRouterProvider(selectedProvider.definition);
|
|
9597
|
-
const
|
|
9721
|
+
const globalModels = loadConfigFile(paths.globalConfigFile, GlobalConfigSchema, params.fs.readConfigFile)?.config.models;
|
|
9722
|
+
const models = launchCascade !== void 0 && params.farm !== void 0 ? cascadeModels : globalModels;
|
|
9723
|
+
const pickerSettings = routesByName ? modelPickerSettingsFromRows(routedModelRows(models ?? {}, listProviders(paths).map((entry) => [entry.name, entry.provider])), selectedProvider !== void 0) : selectedProvider === void 0 ? void 0 : modelPickerSettings(selectedProvider.definition, catalogue?.models);
|
|
9598
9724
|
const callerSettings = hasSettingsArgument(parsedArgv.rest);
|
|
9599
9725
|
if (pickerSettings !== void 0 && callerSettings) {
|
|
9600
9726
|
notes.push("--settings was passed, so /model keeps Claude Code's own model names");
|
|
@@ -9632,6 +9758,8 @@ function decideLaunch(params, readOnly) {
|
|
|
9632
9758
|
identityCredential,
|
|
9633
9759
|
pinnedVersion,
|
|
9634
9760
|
flags,
|
|
9761
|
+
models,
|
|
9762
|
+
globalModels,
|
|
9635
9763
|
bin: discovered.path,
|
|
9636
9764
|
args,
|
|
9637
9765
|
decision
|
|
@@ -9698,7 +9826,7 @@ function prepareLaunch(params) {
|
|
|
9698
9826
|
}
|
|
9699
9827
|
const routesByName = resolvedFlags.routeByName || resolvedProvider !== void 0 && isRouterProvider(resolvedProvider.definition);
|
|
9700
9828
|
if (routesByName) {
|
|
9701
|
-
const check = resolveRoutedProviderCredentials({ paths, port: params.fs, env, ...params.credentials === void 0 ? {} : { credentials: params.credentials }, models:
|
|
9829
|
+
const check = resolveRoutedProviderCredentials({ paths, port: params.fs, env, ...params.credentials === void 0 ? {} : { credentials: params.credentials }, models: decided.models, targets: () => targetRefs(paths) });
|
|
9702
9830
|
if (!check.ok) {
|
|
9703
9831
|
log.error(check.message);
|
|
9704
9832
|
proc.exit(check.status);
|
|
@@ -9710,7 +9838,10 @@ function prepareLaunch(params) {
|
|
|
9710
9838
|
log.error("agent-shim: this launch routes through the front-door daemon, but this launcher has no front-door port wired; refusing to launch without it.");
|
|
9711
9839
|
proc.exit(1);
|
|
9712
9840
|
}
|
|
9713
|
-
const
|
|
9841
|
+
const sessionId = params.supervised?.sessionId ?? (0, import_node_crypto11.randomUUID)();
|
|
9842
|
+
const resolvedModels = decided.models ?? (decided.globalModels === void 0 ? void 0 : {});
|
|
9843
|
+
const sessionModels = (0, import_node_util2.isDeepStrictEqual)(resolvedModels, decided.globalModels) ? void 0 : resolvedModels;
|
|
9844
|
+
const frontDoor = frontDoorEngaged && frontDoorPort !== void 0 ? frontDoorPort.ensure(env.NODE_EXTRA_CA_CERTS, { sessionId, ...sessionModels === void 0 ? {} : { models: sessionModels } }) : void 0;
|
|
9714
9845
|
if (frontDoor?.trustWarning !== void 0) {
|
|
9715
9846
|
log.warn(frontDoor.trustWarning);
|
|
9716
9847
|
}
|
|
@@ -9724,7 +9855,6 @@ function prepareLaunch(params) {
|
|
|
9724
9855
|
}
|
|
9725
9856
|
rows.push(...routingRows({ frontDoor, headroom, provider: resolvedProvider !== void 0 }));
|
|
9726
9857
|
const frontDoorRelease = frontDoor === void 0 ? void 0 : frontDoorPort?.release;
|
|
9727
|
-
const sessionId = params.supervised?.sessionId ?? (0, import_node_crypto11.randomUUID)();
|
|
9728
9858
|
const finalEnv = buildEnv({
|
|
9729
9859
|
baseEnv: env,
|
|
9730
9860
|
configDirEscapeHatch: configDirEscapeHatchApplies,
|
|
@@ -9736,7 +9866,8 @@ function prepareLaunch(params) {
|
|
|
9736
9866
|
...headroom === void 0 ? {} : { headroom },
|
|
9737
9867
|
sessionId,
|
|
9738
9868
|
remoteControl: resolvedFlags.remoteControl,
|
|
9739
|
-
routeByName: routesByName
|
|
9869
|
+
routeByName: routesByName,
|
|
9870
|
+
...decided.models?.tiers === void 0 ? {} : { tierModels: decided.models.tiers }
|
|
9740
9871
|
});
|
|
9741
9872
|
const releases = [...headroom === void 0 || headroomPort === void 0 ? [] : [headroomPort.release], ...frontDoorRelease === void 0 ? [] : [frontDoorRelease]];
|
|
9742
9873
|
const release = () => {
|
|
@@ -9798,11 +9929,12 @@ function runLaunchPlan(plan, spawn3) {
|
|
|
9798
9929
|
function runLauncher(params) {
|
|
9799
9930
|
params.proc.exit(runLaunchPlan(prepareLaunch(params), params.spawn));
|
|
9800
9931
|
}
|
|
9801
|
-
var import_node_crypto11, import_node_path39;
|
|
9932
|
+
var import_node_crypto11, import_node_util2, import_node_path39;
|
|
9802
9933
|
var init_launcher = __esm({
|
|
9803
9934
|
"src/launcher.ts"() {
|
|
9804
9935
|
"use strict";
|
|
9805
9936
|
import_node_crypto11 = require("node:crypto");
|
|
9937
|
+
import_node_util2 = require("node:util");
|
|
9806
9938
|
import_node_path39 = __toESM(require("node:path"), 1);
|
|
9807
9939
|
init_package();
|
|
9808
9940
|
init_envBool();
|
|
@@ -9819,7 +9951,6 @@ var init_launcher = __esm({
|
|
|
9819
9951
|
init_launchReport();
|
|
9820
9952
|
init_modelPicker();
|
|
9821
9953
|
init_providerCatalogue();
|
|
9822
|
-
init_modelsStore();
|
|
9823
9954
|
init_providersStore();
|
|
9824
9955
|
init_pool();
|
|
9825
9956
|
init_resumeContext();
|
|
@@ -9837,6 +9968,7 @@ var init_launcher = __esm({
|
|
|
9837
9968
|
init_read();
|
|
9838
9969
|
init_claudeVersion();
|
|
9839
9970
|
init_launchHook();
|
|
9971
|
+
init_targets();
|
|
9840
9972
|
}
|
|
9841
9973
|
});
|
|
9842
9974
|
|
|
@@ -9933,8 +10065,8 @@ function realEnsurePorts(paths, spawnDaemon) {
|
|
|
9933
10065
|
}
|
|
9934
10066
|
function realFrontDoorPort(paths, spawnDaemon) {
|
|
9935
10067
|
return {
|
|
9936
|
-
ensure: (inheritedExtraCaCerts) => {
|
|
9937
|
-
const up = ensureFrontDoor({ paths, launcherPid: process.pid, ports: realEnsurePorts(paths, spawnDaemon) });
|
|
10068
|
+
ensure: (inheritedExtraCaCerts, session) => {
|
|
10069
|
+
const up = ensureFrontDoor({ paths, launcherPid: process.pid, ports: realEnsurePorts(paths, spawnDaemon), ...session === void 0 ? {} : { session } });
|
|
9938
10070
|
const trust = resolveTrustBundle({ caCertFile: paths.frontdoorCaCertFile, bundlesDir: paths.frontdoorCaBundlesDir, variable: "NODE_EXTRA_CA_CERTS", inherited: inheritedExtraCaCerts, fs: realTrustBundleFs });
|
|
9939
10071
|
return {
|
|
9940
10072
|
port: up.port,
|
|
@@ -15582,56 +15714,7 @@ init_source();
|
|
|
15582
15714
|
|
|
15583
15715
|
// src/models/doctor.ts
|
|
15584
15716
|
init_modelsStore();
|
|
15585
|
-
|
|
15586
|
-
// src/models/families.ts
|
|
15587
|
-
init_identity2();
|
|
15588
|
-
var FAMILY_PREFIX = "family:";
|
|
15589
|
-
var VARIANT_SEPARATOR = "+";
|
|
15590
|
-
function modelOf(ref) {
|
|
15591
|
-
const slash = ref.indexOf("/");
|
|
15592
|
-
return slash === -1 ? ref : ref.slice(slash + 1);
|
|
15593
|
-
}
|
|
15594
|
-
function familyKeyOf(rawModel) {
|
|
15595
|
-
const identity = modelIdentity(rawModel);
|
|
15596
|
-
return identity.variant === "" ? identity.familyAndVersion : `${identity.familyAndVersion}${VARIANT_SEPARATOR}${identity.variant}`;
|
|
15597
|
-
}
|
|
15598
|
-
function assertionsOf(models) {
|
|
15599
|
-
return { same: models?.same ?? [], distinct: models?.distinct ?? [] };
|
|
15600
|
-
}
|
|
15601
|
-
function sameModel(left, right, assertions) {
|
|
15602
|
-
if (assertions.distinct.some(([a, b]) => a === left && b === right || a === right && b === left)) {
|
|
15603
|
-
return false;
|
|
15604
|
-
}
|
|
15605
|
-
const leftGroup = assertions.same.find((group) => group.includes(left));
|
|
15606
|
-
const rightGroup = assertions.same.find((group) => group.includes(right));
|
|
15607
|
-
if (leftGroup !== void 0 && leftGroup === rightGroup) {
|
|
15608
|
-
return true;
|
|
15609
|
-
}
|
|
15610
|
-
if (leftGroup !== void 0 && !leftGroup.includes(right) || rightGroup !== void 0 && !rightGroup.includes(left)) {
|
|
15611
|
-
return false;
|
|
15612
|
-
}
|
|
15613
|
-
return relateModels(modelOf(left), modelOf(right)) === "same";
|
|
15614
|
-
}
|
|
15615
|
-
function pinnedTo(settings, ref) {
|
|
15616
|
-
return settings?.names?.some((name) => name === ref || name === modelOf(ref)) === true;
|
|
15617
|
-
}
|
|
15618
|
-
function buildFamilies(refs, models) {
|
|
15619
|
-
const assertions = assertionsOf(models);
|
|
15620
|
-
const settingsByKey = models?.families ?? {};
|
|
15621
|
-
const groups = [];
|
|
15622
|
-
for (const ref of refs) {
|
|
15623
|
-
const pinnedKey = Object.entries(settingsByKey).find(([, settings]) => pinnedTo(settings, ref))?.[0];
|
|
15624
|
-
const joined2 = groups.find((group) => pinnedKey === void 0 ? group.refs.some((first) => sameModel(first, ref, assertions)) : group.key === pinnedKey);
|
|
15625
|
-
if (joined2 !== void 0) {
|
|
15626
|
-
joined2.refs.push(ref);
|
|
15627
|
-
} else {
|
|
15628
|
-
groups.push({ key: pinnedKey ?? familyKeyOf(modelOf(ref)), refs: [ref] });
|
|
15629
|
-
}
|
|
15630
|
-
}
|
|
15631
|
-
return groups.map((group) => ({ key: group.key, refs: group.refs, settings: settingsByKey[group.key] ?? {} }));
|
|
15632
|
-
}
|
|
15633
|
-
|
|
15634
|
-
// src/models/doctor.ts
|
|
15717
|
+
init_families();
|
|
15635
15718
|
init_identity2();
|
|
15636
15719
|
function modelsFindings(input) {
|
|
15637
15720
|
const findings = [];
|
|
@@ -15719,22 +15802,8 @@ function modelsFindings(input) {
|
|
|
15719
15802
|
return findings;
|
|
15720
15803
|
}
|
|
15721
15804
|
|
|
15722
|
-
// src/models/targets.ts
|
|
15723
|
-
init_modelPicker();
|
|
15724
|
-
init_providerCatalogue();
|
|
15725
|
-
init_providersStore();
|
|
15726
|
-
init_realPorts();
|
|
15727
|
-
function providerModels(paths) {
|
|
15728
|
-
return listProviders(paths).flatMap((entry) => {
|
|
15729
|
-
const catalogue = parseCatalogueCache(realFsPort.readFileUtf8(catalogueCachePath(paths, entry.name)));
|
|
15730
|
-
return providerModelRows(entry.provider, catalogue?.models).map((row) => ({ provider: entry.name, model: row.model }));
|
|
15731
|
-
});
|
|
15732
|
-
}
|
|
15733
|
-
function targetRefs(paths) {
|
|
15734
|
-
return providerModels(paths).map((entry) => `${entry.provider}/${entry.model}`);
|
|
15735
|
-
}
|
|
15736
|
-
|
|
15737
15805
|
// src/doctorReport.ts
|
|
15806
|
+
init_targets();
|
|
15738
15807
|
init_configProfilesStore();
|
|
15739
15808
|
|
|
15740
15809
|
// src/headroom/allowlistDrift.ts
|