claude-use 11.41.0 → 11.42.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 +487 -372
- package/dist/index.cjs +296 -227
- package/dist/index.mjs +295 -226
- package/dist/types/index.d.ts +130 -76
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2054,7 +2054,8 @@ function assembleCascade(input) {
|
|
|
2054
2054
|
...config.categories === void 0 ? {} : { categories: config.categories },
|
|
2055
2055
|
...config.entries === void 0 ? {} : { entries: config.entries },
|
|
2056
2056
|
...entryOrder === void 0 ? {} : { entryOrder },
|
|
2057
|
-
...config.launch === void 0 ? {} : { launch: config.launch }
|
|
2057
|
+
...config.launch === void 0 ? {} : { launch: config.launch },
|
|
2058
|
+
...config.models === void 0 ? {} : { models: config.models }
|
|
2058
2059
|
});
|
|
2059
2060
|
nextId += 1;
|
|
2060
2061
|
}
|
|
@@ -3010,6 +3011,9 @@ function pruneDeadFrontDoorDirectRecords(fs13, recordsDir, records, liveness) {
|
|
|
3010
3011
|
}
|
|
3011
3012
|
}
|
|
3012
3013
|
}
|
|
3014
|
+
function recordOf(details) {
|
|
3015
|
+
return details === void 0 ? {} : { sessionId: details.sessionId, ...details.models === void 0 ? {} : { models: details.models } };
|
|
3016
|
+
}
|
|
3013
3017
|
function writeFrontDoorSession(fs13, sessionsDir, session) {
|
|
3014
3018
|
fs13.mkdirPrivate(sessionsDir);
|
|
3015
3019
|
fs13.writeFilePrivate(path8.join(sessionsDir, `${String(session.pid)}.json`), `${JSON.stringify(session, null, 2)}
|
|
@@ -3049,8 +3053,9 @@ var FRONT_DOOR_PROTOCOL, FrontDoorSessionSchema, FrontDoorStateSchema, MAX_TCP_P
|
|
|
3049
3053
|
var init_state = __esm({
|
|
3050
3054
|
"src/frontdoor/state.ts"() {
|
|
3051
3055
|
"use strict";
|
|
3056
|
+
init_schema();
|
|
3052
3057
|
FRONT_DOOR_PROTOCOL = 4;
|
|
3053
|
-
FrontDoorSessionSchema = z3.strictObject({ pid: z3.number().int().positive(), startedAt: z3.number(), token: z3.string().min(1), supervisorPid: z3.number().int().positive().optional() });
|
|
3058
|
+
FrontDoorSessionSchema = z3.strictObject({ pid: z3.number().int().positive(), startedAt: z3.number(), token: z3.string().min(1), supervisorPid: z3.number().int().positive().optional(), sessionId: z3.string().min(1).optional(), models: ModelsConfigSchema.optional() });
|
|
3054
3059
|
FrontDoorStateSchema = z3.strictObject({
|
|
3055
3060
|
/**
|
|
3056
3061
|
* 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`).
|
|
@@ -3122,7 +3127,7 @@ var init_package = __esm({
|
|
|
3122
3127
|
"package.json"() {
|
|
3123
3128
|
package_default = {
|
|
3124
3129
|
name: "claude-use",
|
|
3125
|
-
version: "11.
|
|
3130
|
+
version: "11.42.0",
|
|
3126
3131
|
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.",
|
|
3127
3132
|
license: "MIT",
|
|
3128
3133
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -6903,6 +6908,213 @@ var init_credential = __esm({
|
|
|
6903
6908
|
}
|
|
6904
6909
|
});
|
|
6905
6910
|
|
|
6911
|
+
// src/models/identity.ts
|
|
6912
|
+
function withoutContextMarker(model) {
|
|
6913
|
+
return model.toLowerCase().endsWith(CONTEXT_MARKER_1M) ? model.slice(0, -CONTEXT_MARKER_1M.length) : model;
|
|
6914
|
+
}
|
|
6915
|
+
function canonicalText(name) {
|
|
6916
|
+
return name.trim().toLowerCase().replace(NON_IDENTITY_BRACKET_RE, "").replace(/[\s_]+/g, "-").replace(/([a-z])(\d+(?:\.\d+)+)/g, "$1-$2").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
6917
|
+
}
|
|
6918
|
+
function splitVariants(tokens) {
|
|
6919
|
+
const variants = [];
|
|
6920
|
+
let end = tokens.length;
|
|
6921
|
+
for (; ; ) {
|
|
6922
|
+
const token = tokens[end - 1];
|
|
6923
|
+
if (token === void 0 || !KNOWN_VARIANTS.has(token)) {
|
|
6924
|
+
return { familyTokens: tokens.slice(0, end), variants };
|
|
6925
|
+
}
|
|
6926
|
+
variants.unshift(token);
|
|
6927
|
+
end -= 1;
|
|
6928
|
+
}
|
|
6929
|
+
}
|
|
6930
|
+
function versionOf(tokens) {
|
|
6931
|
+
for (let index = 0; index < tokens.length; index += 1) {
|
|
6932
|
+
const token = tokens[index];
|
|
6933
|
+
const next = tokens[index + 1];
|
|
6934
|
+
if (token === void 0) {
|
|
6935
|
+
return "";
|
|
6936
|
+
}
|
|
6937
|
+
if (/^\d+$/.test(token) && next !== void 0 && /^\d+$/.test(next)) {
|
|
6938
|
+
return `${token}.${next}`;
|
|
6939
|
+
}
|
|
6940
|
+
const dotted = /^\d+(?:\.\d+)+$/.exec(token);
|
|
6941
|
+
if (dotted !== null) {
|
|
6942
|
+
return dotted[0];
|
|
6943
|
+
}
|
|
6944
|
+
}
|
|
6945
|
+
return "";
|
|
6946
|
+
}
|
|
6947
|
+
function modelIdentity(rawName) {
|
|
6948
|
+
const segments = rawName.trim().toLowerCase().split("/");
|
|
6949
|
+
const stripped = canonicalText(segments[segments.length - 1] ?? "").split(":")[0] ?? "";
|
|
6950
|
+
const withoutDate = stripped.replace(DATE_STAMP_RE, "");
|
|
6951
|
+
const tokens = withoutDate.split("-").filter((token) => token !== "");
|
|
6952
|
+
const { familyTokens, variants } = splitVariants(tokens);
|
|
6953
|
+
const version = versionOf(familyTokens);
|
|
6954
|
+
const versionless = familyTokens.filter((token, index) => {
|
|
6955
|
+
if (version === "") {
|
|
6956
|
+
return true;
|
|
6957
|
+
}
|
|
6958
|
+
const dotted = /^\d+(?:\.\d+)+$/.test(token);
|
|
6959
|
+
const previous = familyTokens[index - 1];
|
|
6960
|
+
const next = familyTokens[index + 1];
|
|
6961
|
+
const insideVersionRun = dotted || /^\d+$/.test(token) && (previous !== void 0 && /^\d+$/.test(previous) || next !== void 0 && /^\d+$/.test(next));
|
|
6962
|
+
return !insideVersionRun;
|
|
6963
|
+
});
|
|
6964
|
+
const family = versionless.join("-");
|
|
6965
|
+
const tokenVendor = familyTokens.find((token) => Object.keys(VENDOR_BY_TOKEN).some((key) => token === key || token.startsWith(key)));
|
|
6966
|
+
const namespace = segments.length >= 2 ? (segments[0] ?? "").split(":").pop() ?? "" : "";
|
|
6967
|
+
const namespaceVendor = VENDOR_BY_NAMESPACE[namespace] ?? "";
|
|
6968
|
+
const tokenVendorName = tokenVendor === void 0 ? "" : VENDOR_BY_TOKEN[Object.keys(VENDOR_BY_TOKEN).find((key) => tokenVendor === key || tokenVendor.startsWith(key)) ?? ""] ?? "";
|
|
6969
|
+
return {
|
|
6970
|
+
vendor: tokenVendorName === "" ? namespaceVendor : tokenVendorName,
|
|
6971
|
+
vendorConflict: tokenVendorName !== "" && namespaceVendor !== "" && tokenVendorName !== namespaceVendor,
|
|
6972
|
+
family,
|
|
6973
|
+
version,
|
|
6974
|
+
variant: variants.join("-"),
|
|
6975
|
+
familyAndVersion: version === "" ? family : `${family}-${version.replace(/\./g, "-")}`
|
|
6976
|
+
};
|
|
6977
|
+
}
|
|
6978
|
+
function relateModels(left, right) {
|
|
6979
|
+
const a = modelIdentity(left);
|
|
6980
|
+
const b = modelIdentity(right);
|
|
6981
|
+
if (a.familyAndVersion !== b.familyAndVersion) {
|
|
6982
|
+
return sameFamilyOtherVersion(a, b) ? "similar" : "distinct";
|
|
6983
|
+
}
|
|
6984
|
+
if (a.variant !== b.variant || a.vendorConflict || b.vendorConflict || a.vendor !== "" && b.vendor !== "" && a.vendor !== b.vendor) {
|
|
6985
|
+
return "similar";
|
|
6986
|
+
}
|
|
6987
|
+
return "same";
|
|
6988
|
+
}
|
|
6989
|
+
function sameFamilyOtherVersion(a, b) {
|
|
6990
|
+
if (a.family !== b.family) {
|
|
6991
|
+
return false;
|
|
6992
|
+
}
|
|
6993
|
+
if (a.vendor !== "" && b.vendor !== "" && a.vendor !== b.vendor) {
|
|
6994
|
+
return false;
|
|
6995
|
+
}
|
|
6996
|
+
return true;
|
|
6997
|
+
}
|
|
6998
|
+
var NON_IDENTITY_BRACKET_RE, CONTEXT_MARKER_1M, DATE_STAMP_RE, KNOWN_VARIANTS, VENDOR_BY_NAMESPACE, VENDOR_BY_TOKEN;
|
|
6999
|
+
var init_identity2 = __esm({
|
|
7000
|
+
"src/models/identity.ts"() {
|
|
7001
|
+
"use strict";
|
|
7002
|
+
NON_IDENTITY_BRACKET_RE = /\[[^\]]*\]/g;
|
|
7003
|
+
CONTEXT_MARKER_1M = "[1m]";
|
|
7004
|
+
DATE_STAMP_RE = /-(?:19|20)\d{2}(?:0[1-9]|1[0-2])(?:0[1-9]|[12]\d|3[01])$/;
|
|
7005
|
+
KNOWN_VARIANTS = /* @__PURE__ */ new Set(["high", "medium", "low", "thinking", "xhigh", "max", "highspeed", "sol", "terra", "luna", "mini", "flash-lite", "turbo"]);
|
|
7006
|
+
VENDOR_BY_NAMESPACE = Object.freeze({
|
|
7007
|
+
anthropic: "anthropic",
|
|
7008
|
+
google: "google",
|
|
7009
|
+
openai: "openai",
|
|
7010
|
+
zai: "zai",
|
|
7011
|
+
"z-ai": "zai",
|
|
7012
|
+
minimax: "minimax",
|
|
7013
|
+
qwen: "qwen",
|
|
7014
|
+
deepseek: "deepseek",
|
|
7015
|
+
moonshot: "moonshot",
|
|
7016
|
+
meta: "meta",
|
|
7017
|
+
mistral: "mistral"
|
|
7018
|
+
});
|
|
7019
|
+
VENDOR_BY_TOKEN = Object.freeze({
|
|
7020
|
+
claude: "anthropic",
|
|
7021
|
+
gemini: "google",
|
|
7022
|
+
antigravity: "google",
|
|
7023
|
+
gpt: "openai",
|
|
7024
|
+
glm: "zai",
|
|
7025
|
+
minimax: "minimax",
|
|
7026
|
+
qwen: "qwen",
|
|
7027
|
+
deepseek: "deepseek",
|
|
7028
|
+
kimi: "moonshot",
|
|
7029
|
+
llama: "meta",
|
|
7030
|
+
mistral: "mistral",
|
|
7031
|
+
mixtral: "mistral"
|
|
7032
|
+
});
|
|
7033
|
+
}
|
|
7034
|
+
});
|
|
7035
|
+
|
|
7036
|
+
// src/models/families.ts
|
|
7037
|
+
function modelOf(ref) {
|
|
7038
|
+
const slash = ref.indexOf("/");
|
|
7039
|
+
return slash === -1 ? ref : ref.slice(slash + 1);
|
|
7040
|
+
}
|
|
7041
|
+
function familyKeyOf(rawModel) {
|
|
7042
|
+
const identity = modelIdentity(rawModel);
|
|
7043
|
+
return identity.variant === "" ? identity.familyAndVersion : `${identity.familyAndVersion}${VARIANT_SEPARATOR}${identity.variant}`;
|
|
7044
|
+
}
|
|
7045
|
+
function assertionsOf(models) {
|
|
7046
|
+
return { same: models?.same ?? [], distinct: models?.distinct ?? [] };
|
|
7047
|
+
}
|
|
7048
|
+
function sameModel(left, right, assertions) {
|
|
7049
|
+
if (assertions.distinct.some(([a, b]) => a === left && b === right || a === right && b === left)) {
|
|
7050
|
+
return false;
|
|
7051
|
+
}
|
|
7052
|
+
const leftGroup = assertions.same.find((group) => group.includes(left));
|
|
7053
|
+
const rightGroup = assertions.same.find((group) => group.includes(right));
|
|
7054
|
+
if (leftGroup !== void 0 && leftGroup === rightGroup) {
|
|
7055
|
+
return true;
|
|
7056
|
+
}
|
|
7057
|
+
if (leftGroup !== void 0 && !leftGroup.includes(right) || rightGroup !== void 0 && !rightGroup.includes(left)) {
|
|
7058
|
+
return false;
|
|
7059
|
+
}
|
|
7060
|
+
return relateModels(modelOf(left), modelOf(right)) === "same";
|
|
7061
|
+
}
|
|
7062
|
+
function pinnedTo(settings, ref) {
|
|
7063
|
+
return settings?.names?.some((name) => name === ref || name === modelOf(ref)) === true;
|
|
7064
|
+
}
|
|
7065
|
+
function buildFamilies(refs, models) {
|
|
7066
|
+
const assertions = assertionsOf(models);
|
|
7067
|
+
const settingsByKey = models?.families ?? {};
|
|
7068
|
+
const groups = [];
|
|
7069
|
+
for (const ref of refs) {
|
|
7070
|
+
const pinnedKey = Object.entries(settingsByKey).find(([, settings]) => pinnedTo(settings, ref))?.[0];
|
|
7071
|
+
const joined2 = groups.find((group) => pinnedKey === void 0 ? group.refs.some((first) => sameModel(first, ref, assertions)) : group.key === pinnedKey);
|
|
7072
|
+
if (joined2 !== void 0) {
|
|
7073
|
+
joined2.refs.push(ref);
|
|
7074
|
+
} else {
|
|
7075
|
+
groups.push({ key: pinnedKey ?? familyKeyOf(modelOf(ref)), refs: [ref] });
|
|
7076
|
+
}
|
|
7077
|
+
}
|
|
7078
|
+
return groups.map((group) => ({ key: group.key, refs: group.refs, settings: settingsByKey[group.key] ?? {} }));
|
|
7079
|
+
}
|
|
7080
|
+
function familyNamed(families, member) {
|
|
7081
|
+
if (!member.startsWith(FAMILY_PREFIX)) {
|
|
7082
|
+
return void 0;
|
|
7083
|
+
}
|
|
7084
|
+
const key = member.slice(FAMILY_PREFIX.length);
|
|
7085
|
+
return families.find((family) => family.key === key);
|
|
7086
|
+
}
|
|
7087
|
+
function familyMode(settings) {
|
|
7088
|
+
return settings.mode ?? "ordered";
|
|
7089
|
+
}
|
|
7090
|
+
function sharedFamilies(families) {
|
|
7091
|
+
return families.filter((family) => family.refs.length > 1);
|
|
7092
|
+
}
|
|
7093
|
+
function expandFamilyMembers(members, families) {
|
|
7094
|
+
const expanded = [];
|
|
7095
|
+
for (const member of members) {
|
|
7096
|
+
for (const ref of member.startsWith(FAMILY_PREFIX) ? familyNamed(families, member)?.refs ?? [] : [member]) {
|
|
7097
|
+
if (!expanded.includes(ref)) {
|
|
7098
|
+
expanded.push(ref);
|
|
7099
|
+
}
|
|
7100
|
+
}
|
|
7101
|
+
}
|
|
7102
|
+
return expanded;
|
|
7103
|
+
}
|
|
7104
|
+
function accountRefsOf(models) {
|
|
7105
|
+
const named = [...(models?.same ?? []).flat(), ...Object.values(models?.families ?? {}).flatMap((settings) => settings.names ?? [])];
|
|
7106
|
+
return [...new Set(named.filter((ref) => ref.startsWith("acct:")))];
|
|
7107
|
+
}
|
|
7108
|
+
var FAMILY_PREFIX, VARIANT_SEPARATOR;
|
|
7109
|
+
var init_families = __esm({
|
|
7110
|
+
"src/models/families.ts"() {
|
|
7111
|
+
"use strict";
|
|
7112
|
+
init_identity2();
|
|
7113
|
+
FAMILY_PREFIX = "family:";
|
|
7114
|
+
VARIANT_SEPARATOR = "+";
|
|
7115
|
+
}
|
|
7116
|
+
});
|
|
7117
|
+
|
|
6906
7118
|
// src/providersStore.ts
|
|
6907
7119
|
import fs7 from "node:fs";
|
|
6908
7120
|
import path25 from "node:path";
|
|
@@ -7199,8 +7411,15 @@ function resolveRoutedProviderCredentials(params) {
|
|
|
7199
7411
|
}
|
|
7200
7412
|
const virtualNames = new Set(Object.keys(models.virtual ?? {}));
|
|
7201
7413
|
const providerNames = /* @__PURE__ */ new Set();
|
|
7414
|
+
const families = () => buildFamilies(params.targets?.() ?? [], models);
|
|
7202
7415
|
const collect = (ref) => {
|
|
7203
|
-
if (ref.startsWith(
|
|
7416
|
+
if (ref.startsWith(FAMILY_PREFIX)) {
|
|
7417
|
+
for (const target of expandFamilyMembers([ref], families())) {
|
|
7418
|
+
collect(target);
|
|
7419
|
+
}
|
|
7420
|
+
return;
|
|
7421
|
+
}
|
|
7422
|
+
if (ref.startsWith("acct:") || virtualNames.has(ref)) {
|
|
7204
7423
|
return;
|
|
7205
7424
|
}
|
|
7206
7425
|
const [provider] = ref.split("/", 1);
|
|
@@ -7255,6 +7474,7 @@ var init_providersStore = __esm({
|
|
|
7255
7474
|
init_cliError();
|
|
7256
7475
|
init_credential();
|
|
7257
7476
|
init_walk();
|
|
7477
|
+
init_families();
|
|
7258
7478
|
ProviderNotFoundError = class extends CliError {
|
|
7259
7479
|
constructor(name) {
|
|
7260
7480
|
super(`No provider named "${name}". Run \`agent-shim provider add ${name}\` first.`);
|
|
@@ -7560,9 +7780,6 @@ var init_claudeShim = __esm({
|
|
|
7560
7780
|
});
|
|
7561
7781
|
|
|
7562
7782
|
// src/modelsStore.ts
|
|
7563
|
-
function readModels(paths) {
|
|
7564
|
-
return readGlobalConfig(paths)?.models;
|
|
7565
|
-
}
|
|
7566
7783
|
function memberKindOf(ref, models) {
|
|
7567
7784
|
if (ref.startsWith("acct:")) {
|
|
7568
7785
|
return "account";
|
|
@@ -7615,131 +7832,6 @@ var init_modelsStore = __esm({
|
|
|
7615
7832
|
}
|
|
7616
7833
|
});
|
|
7617
7834
|
|
|
7618
|
-
// src/models/identity.ts
|
|
7619
|
-
function withoutContextMarker(model) {
|
|
7620
|
-
return model.toLowerCase().endsWith(CONTEXT_MARKER_1M) ? model.slice(0, -CONTEXT_MARKER_1M.length) : model;
|
|
7621
|
-
}
|
|
7622
|
-
function canonicalText(name) {
|
|
7623
|
-
return name.trim().toLowerCase().replace(NON_IDENTITY_BRACKET_RE, "").replace(/[\s_]+/g, "-").replace(/([a-z])(\d+(?:\.\d+)+)/g, "$1-$2").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
7624
|
-
}
|
|
7625
|
-
function splitVariants(tokens) {
|
|
7626
|
-
const variants = [];
|
|
7627
|
-
let end = tokens.length;
|
|
7628
|
-
for (; ; ) {
|
|
7629
|
-
const token = tokens[end - 1];
|
|
7630
|
-
if (token === void 0 || !KNOWN_VARIANTS.has(token)) {
|
|
7631
|
-
return { familyTokens: tokens.slice(0, end), variants };
|
|
7632
|
-
}
|
|
7633
|
-
variants.unshift(token);
|
|
7634
|
-
end -= 1;
|
|
7635
|
-
}
|
|
7636
|
-
}
|
|
7637
|
-
function versionOf(tokens) {
|
|
7638
|
-
for (let index = 0; index < tokens.length; index += 1) {
|
|
7639
|
-
const token = tokens[index];
|
|
7640
|
-
const next = tokens[index + 1];
|
|
7641
|
-
if (token === void 0) {
|
|
7642
|
-
return "";
|
|
7643
|
-
}
|
|
7644
|
-
if (/^\d+$/.test(token) && next !== void 0 && /^\d+$/.test(next)) {
|
|
7645
|
-
return `${token}.${next}`;
|
|
7646
|
-
}
|
|
7647
|
-
const dotted = /^\d+(?:\.\d+)+$/.exec(token);
|
|
7648
|
-
if (dotted !== null) {
|
|
7649
|
-
return dotted[0];
|
|
7650
|
-
}
|
|
7651
|
-
}
|
|
7652
|
-
return "";
|
|
7653
|
-
}
|
|
7654
|
-
function modelIdentity(rawName) {
|
|
7655
|
-
const segments = rawName.trim().toLowerCase().split("/");
|
|
7656
|
-
const stripped = canonicalText(segments[segments.length - 1] ?? "").split(":")[0] ?? "";
|
|
7657
|
-
const withoutDate = stripped.replace(DATE_STAMP_RE, "");
|
|
7658
|
-
const tokens = withoutDate.split("-").filter((token) => token !== "");
|
|
7659
|
-
const { familyTokens, variants } = splitVariants(tokens);
|
|
7660
|
-
const version = versionOf(familyTokens);
|
|
7661
|
-
const versionless = familyTokens.filter((token, index) => {
|
|
7662
|
-
if (version === "") {
|
|
7663
|
-
return true;
|
|
7664
|
-
}
|
|
7665
|
-
const dotted = /^\d+(?:\.\d+)+$/.test(token);
|
|
7666
|
-
const previous = familyTokens[index - 1];
|
|
7667
|
-
const next = familyTokens[index + 1];
|
|
7668
|
-
const insideVersionRun = dotted || /^\d+$/.test(token) && (previous !== void 0 && /^\d+$/.test(previous) || next !== void 0 && /^\d+$/.test(next));
|
|
7669
|
-
return !insideVersionRun;
|
|
7670
|
-
});
|
|
7671
|
-
const family = versionless.join("-");
|
|
7672
|
-
const tokenVendor = familyTokens.find((token) => Object.keys(VENDOR_BY_TOKEN).some((key) => token === key || token.startsWith(key)));
|
|
7673
|
-
const namespace = segments.length >= 2 ? (segments[0] ?? "").split(":").pop() ?? "" : "";
|
|
7674
|
-
const namespaceVendor = VENDOR_BY_NAMESPACE[namespace] ?? "";
|
|
7675
|
-
const tokenVendorName = tokenVendor === void 0 ? "" : VENDOR_BY_TOKEN[Object.keys(VENDOR_BY_TOKEN).find((key) => tokenVendor === key || tokenVendor.startsWith(key)) ?? ""] ?? "";
|
|
7676
|
-
return {
|
|
7677
|
-
vendor: tokenVendorName === "" ? namespaceVendor : tokenVendorName,
|
|
7678
|
-
vendorConflict: tokenVendorName !== "" && namespaceVendor !== "" && tokenVendorName !== namespaceVendor,
|
|
7679
|
-
family,
|
|
7680
|
-
version,
|
|
7681
|
-
variant: variants.join("-"),
|
|
7682
|
-
familyAndVersion: version === "" ? family : `${family}-${version.replace(/\./g, "-")}`
|
|
7683
|
-
};
|
|
7684
|
-
}
|
|
7685
|
-
function relateModels(left, right) {
|
|
7686
|
-
const a = modelIdentity(left);
|
|
7687
|
-
const b = modelIdentity(right);
|
|
7688
|
-
if (a.familyAndVersion !== b.familyAndVersion) {
|
|
7689
|
-
return sameFamilyOtherVersion(a, b) ? "similar" : "distinct";
|
|
7690
|
-
}
|
|
7691
|
-
if (a.variant !== b.variant || a.vendorConflict || b.vendorConflict || a.vendor !== "" && b.vendor !== "" && a.vendor !== b.vendor) {
|
|
7692
|
-
return "similar";
|
|
7693
|
-
}
|
|
7694
|
-
return "same";
|
|
7695
|
-
}
|
|
7696
|
-
function sameFamilyOtherVersion(a, b) {
|
|
7697
|
-
if (a.family !== b.family) {
|
|
7698
|
-
return false;
|
|
7699
|
-
}
|
|
7700
|
-
if (a.vendor !== "" && b.vendor !== "" && a.vendor !== b.vendor) {
|
|
7701
|
-
return false;
|
|
7702
|
-
}
|
|
7703
|
-
return true;
|
|
7704
|
-
}
|
|
7705
|
-
var NON_IDENTITY_BRACKET_RE, CONTEXT_MARKER_1M, DATE_STAMP_RE, KNOWN_VARIANTS, VENDOR_BY_NAMESPACE, VENDOR_BY_TOKEN;
|
|
7706
|
-
var init_identity2 = __esm({
|
|
7707
|
-
"src/models/identity.ts"() {
|
|
7708
|
-
"use strict";
|
|
7709
|
-
NON_IDENTITY_BRACKET_RE = /\[[^\]]*\]/g;
|
|
7710
|
-
CONTEXT_MARKER_1M = "[1m]";
|
|
7711
|
-
DATE_STAMP_RE = /-(?:19|20)\d{2}(?:0[1-9]|1[0-2])(?:0[1-9]|[12]\d|3[01])$/;
|
|
7712
|
-
KNOWN_VARIANTS = /* @__PURE__ */ new Set(["high", "medium", "low", "thinking", "xhigh", "max", "highspeed", "sol", "terra", "luna", "mini", "flash-lite", "turbo"]);
|
|
7713
|
-
VENDOR_BY_NAMESPACE = Object.freeze({
|
|
7714
|
-
anthropic: "anthropic",
|
|
7715
|
-
google: "google",
|
|
7716
|
-
openai: "openai",
|
|
7717
|
-
zai: "zai",
|
|
7718
|
-
"z-ai": "zai",
|
|
7719
|
-
minimax: "minimax",
|
|
7720
|
-
qwen: "qwen",
|
|
7721
|
-
deepseek: "deepseek",
|
|
7722
|
-
moonshot: "moonshot",
|
|
7723
|
-
meta: "meta",
|
|
7724
|
-
mistral: "mistral"
|
|
7725
|
-
});
|
|
7726
|
-
VENDOR_BY_TOKEN = Object.freeze({
|
|
7727
|
-
claude: "anthropic",
|
|
7728
|
-
gemini: "google",
|
|
7729
|
-
antigravity: "google",
|
|
7730
|
-
gpt: "openai",
|
|
7731
|
-
glm: "zai",
|
|
7732
|
-
minimax: "minimax",
|
|
7733
|
-
qwen: "qwen",
|
|
7734
|
-
deepseek: "deepseek",
|
|
7735
|
-
kimi: "moonshot",
|
|
7736
|
-
llama: "meta",
|
|
7737
|
-
mistral: "mistral",
|
|
7738
|
-
mixtral: "mistral"
|
|
7739
|
-
});
|
|
7740
|
-
}
|
|
7741
|
-
});
|
|
7742
|
-
|
|
7743
7835
|
// src/selection/engine.ts
|
|
7744
7836
|
var init_engine = __esm({
|
|
7745
7837
|
"src/selection/engine.ts"() {
|
|
@@ -8043,30 +8135,29 @@ function routedModelRows(models, providers) {
|
|
|
8043
8135
|
const hidden = new Set(models.hide ?? []);
|
|
8044
8136
|
const shown = models.show === void 0 ? void 0 : new Set(models.show);
|
|
8045
8137
|
const visible = (model) => shown === void 0 ? !hidden.has(model) : shown.has(model);
|
|
8046
|
-
const
|
|
8047
|
-
|
|
8048
|
-
|
|
8049
|
-
|
|
8050
|
-
}
|
|
8051
|
-
const match = Object.entries(provider.env ?? {}).find(([key, value]) => value === model && key.startsWith("ANTHROPIC_DEFAULT_") && key.endsWith("_MODEL"));
|
|
8052
|
-
if (match !== void 0) {
|
|
8053
|
-
const tier = match[0].replace("ANTHROPIC_DEFAULT_", "").replace("_MODEL", "").toLowerCase();
|
|
8054
|
-
return tier === "fable" || tier === "opus" || tier === "sonnet" || tier === "haiku" ? tier : void 0;
|
|
8055
|
-
}
|
|
8056
|
-
}
|
|
8057
|
-
return void 0;
|
|
8058
|
-
};
|
|
8138
|
+
const concrete = providers.flatMap(([name, provider]) => providerModelRows(provider).map((row) => ({ ...row, model: `${name}/${row.model}`, label: `${name} / ${row.label}`, description: `${name}: ${row.description}` })));
|
|
8139
|
+
const concreteByRef = new Map(concrete.map((row) => [row.model, row]));
|
|
8140
|
+
const families = buildFamilies([...concrete.map((row) => row.model), ...accountRefsOf(models)], models);
|
|
8141
|
+
const handlingOf = (refs) => refs.map((ref) => concreteByRef.get(ref)?.behavesAs).find((behavesAs) => behavesAs !== void 0) ?? TIER_BEHAVES_AS.sonnet;
|
|
8059
8142
|
const virtual = Object.entries(models.virtual ?? {}).flatMap(([name, definition]) => {
|
|
8060
8143
|
if (!visible(name)) {
|
|
8061
8144
|
return [];
|
|
8062
8145
|
}
|
|
8063
|
-
const
|
|
8064
|
-
|
|
8065
|
-
const behavesAs = tier === void 0 ? void 0 : TIER_BEHAVES_AS[tier];
|
|
8066
|
-
return behavesAs === void 0 ? [] : [{ model: name, label: name, description: `Virtual (${definition.mode})`, behavesAs }];
|
|
8146
|
+
const targets = expandFamilyMembers(safeExpand(name, models), families);
|
|
8147
|
+
return [{ model: name, label: name, description: `Virtual (${definition.mode})`, behavesAs: handlingOf(targets) }];
|
|
8067
8148
|
});
|
|
8068
|
-
const
|
|
8069
|
-
|
|
8149
|
+
const familyRows = sharedFamilies(families).flatMap((family) => {
|
|
8150
|
+
const member = `${FAMILY_PREFIX}${family.key}`;
|
|
8151
|
+
return visible(member) ? [{ model: member, label: family.key, description: `Family (${familyMode(family.settings)}): ${family.refs.join(", ")}`, behavesAs: handlingOf(family.refs) }] : [];
|
|
8152
|
+
});
|
|
8153
|
+
return [...virtual, ...familyRows, ...concrete.filter((row) => visible(row.model))];
|
|
8154
|
+
}
|
|
8155
|
+
function safeExpand(name, models) {
|
|
8156
|
+
try {
|
|
8157
|
+
return expandMembers(name, models);
|
|
8158
|
+
} catch {
|
|
8159
|
+
return models.virtual?.[name]?.members ?? [];
|
|
8160
|
+
}
|
|
8070
8161
|
}
|
|
8071
8162
|
function modelPickerSettings(provider, catalogue = []) {
|
|
8072
8163
|
return modelPickerSettingsFromRows(providerModelRows(provider, catalogue), true);
|
|
@@ -8083,6 +8174,8 @@ var init_modelPicker = __esm({
|
|
|
8083
8174
|
init_providerCatalogue();
|
|
8084
8175
|
init_schema();
|
|
8085
8176
|
init_identity2();
|
|
8177
|
+
init_families();
|
|
8178
|
+
init_modelsStore();
|
|
8086
8179
|
TIER_BEHAVES_AS = Object.freeze({
|
|
8087
8180
|
fable: "claude-fable-5-1",
|
|
8088
8181
|
opus: "claude-opus-5-5",
|
|
@@ -8098,6 +8191,26 @@ var init_modelPicker = __esm({
|
|
|
8098
8191
|
}
|
|
8099
8192
|
});
|
|
8100
8193
|
|
|
8194
|
+
// src/models/targets.ts
|
|
8195
|
+
function providerModels(paths) {
|
|
8196
|
+
return listProviders(paths).flatMap((entry) => {
|
|
8197
|
+
const catalogue = parseCatalogueCache(realFsPort.readFileUtf8(catalogueCachePath(paths, entry.name)));
|
|
8198
|
+
return providerModelRows(entry.provider, catalogue?.models).map((row) => ({ provider: entry.name, model: row.model }));
|
|
8199
|
+
});
|
|
8200
|
+
}
|
|
8201
|
+
function targetRefs(paths) {
|
|
8202
|
+
return providerModels(paths).map((entry) => `${entry.provider}/${entry.model}`);
|
|
8203
|
+
}
|
|
8204
|
+
var init_targets = __esm({
|
|
8205
|
+
"src/models/targets.ts"() {
|
|
8206
|
+
"use strict";
|
|
8207
|
+
init_modelPicker();
|
|
8208
|
+
init_providerCatalogue();
|
|
8209
|
+
init_providersStore();
|
|
8210
|
+
init_realPorts();
|
|
8211
|
+
}
|
|
8212
|
+
});
|
|
8213
|
+
|
|
8101
8214
|
// src/frontdoor/probe.ts
|
|
8102
8215
|
import { Worker } from "node:worker_threads";
|
|
8103
8216
|
function probeFrontDoorSync(port, caPem) {
|
|
@@ -8286,7 +8399,7 @@ function ensureFrontDoor(params) {
|
|
|
8286
8399
|
if (state?.port !== void 0 && state.connectPort !== void 0) {
|
|
8287
8400
|
if (supervisorPid === params.launcherPid && params.replace !== true && ports.isFrontDoorSupervisor(supervisorPid)) {
|
|
8288
8401
|
const token = randomUUID3();
|
|
8289
|
-
writeFrontDoorSession(ports.fs, paths.frontdoorSessionsDir, { pid: params.launcherPid, startedAt: ports.now(), token, supervisorPid });
|
|
8402
|
+
writeFrontDoorSession(ports.fs, paths.frontdoorSessionsDir, { pid: params.launcherPid, startedAt: ports.now(), token, supervisorPid, ...recordOf(params.session) });
|
|
8290
8403
|
return { port: state.port, connectPort: state.connectPort, token };
|
|
8291
8404
|
}
|
|
8292
8405
|
const verdict = verifyWithRetry(state.port);
|
|
@@ -8300,7 +8413,7 @@ function ensureFrontDoor(params) {
|
|
|
8300
8413
|
}
|
|
8301
8414
|
if (verdict.ok) {
|
|
8302
8415
|
const token = randomUUID3();
|
|
8303
|
-
writeFrontDoorSession(ports.fs, paths.frontdoorSessionsDir, { pid: params.launcherPid, startedAt: ports.now(), token, supervisorPid });
|
|
8416
|
+
writeFrontDoorSession(ports.fs, paths.frontdoorSessionsDir, { pid: params.launcherPid, startedAt: ports.now(), token, supervisorPid, ...recordOf(params.session) });
|
|
8304
8417
|
return { port: state.port, connectPort: state.connectPort, token };
|
|
8305
8418
|
}
|
|
8306
8419
|
lastRejection = `the listener on 127.0.0.1:${String(state.port)} (recorded for pid ${String(supervisorPid)}) failed authentication: ${verdict.reason}`;
|
|
@@ -8760,6 +8873,14 @@ function buildEnv(params) {
|
|
|
8760
8873
|
env[key] = value;
|
|
8761
8874
|
}
|
|
8762
8875
|
}
|
|
8876
|
+
if (params.routeByName) {
|
|
8877
|
+
for (const tier of CLAUDE_TIERS) {
|
|
8878
|
+
const ref = params.tierModels?.[tier];
|
|
8879
|
+
if (ref !== void 0) {
|
|
8880
|
+
env[`ANTHROPIC_DEFAULT_${tier.toUpperCase()}_MODEL`] = ref;
|
|
8881
|
+
}
|
|
8882
|
+
}
|
|
8883
|
+
}
|
|
8763
8884
|
if (params.provider !== void 0) {
|
|
8764
8885
|
env.ANTHROPIC_AUTH_TOKEN = params.remoteControl ? void 0 : PROVIDER_SESSION_PLACEHOLDER;
|
|
8765
8886
|
env.ANTHROPIC_API_KEY = void 0;
|
|
@@ -8801,6 +8922,7 @@ var init_flags = __esm({
|
|
|
8801
8922
|
init_envBool();
|
|
8802
8923
|
init_cliError();
|
|
8803
8924
|
init_conditions();
|
|
8925
|
+
init_schema();
|
|
8804
8926
|
init_credential();
|
|
8805
8927
|
init_headers();
|
|
8806
8928
|
init_capability();
|
|
@@ -9345,6 +9467,7 @@ var init_launchHook = __esm({
|
|
|
9345
9467
|
|
|
9346
9468
|
// src/launcher.ts
|
|
9347
9469
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
9470
|
+
import { isDeepStrictEqual } from "node:util";
|
|
9348
9471
|
import path39 from "node:path";
|
|
9349
9472
|
function resolveIdentityCredential(identity, credential, env, port) {
|
|
9350
9473
|
if (port === void 0) {
|
|
@@ -9536,10 +9659,12 @@ function decideLaunch(params, readOnly) {
|
|
|
9536
9659
|
}
|
|
9537
9660
|
const launchCascade = farmContext?.cascade ?? (params.farm === void 0 ? void 0 : params.farm.loadCascade(configProfileDecision.name, cliOverride));
|
|
9538
9661
|
let cascadeLaunch;
|
|
9662
|
+
let cascadeModels;
|
|
9539
9663
|
if (launchCascade !== void 0 && params.farm !== void 0) {
|
|
9540
9664
|
const assembled = assembleCascade(launchCascade);
|
|
9541
9665
|
const flattened = flattenLayers(assembled.layers, { home: params.farm.home });
|
|
9542
9666
|
cascadeLaunch = flattened.launch;
|
|
9667
|
+
cascadeModels = flattened.models;
|
|
9543
9668
|
if (readOnly || farmContext === void 0) {
|
|
9544
9669
|
reportDiagnostics(log, [...assembled.diagnostics, ...flattened.diagnostics], { errorsAsWarnings: readOnly });
|
|
9545
9670
|
}
|
|
@@ -9568,7 +9693,9 @@ function decideLaunch(params, readOnly) {
|
|
|
9568
9693
|
const flags = loginlessProvider === void 0 ? requestedFlags : { ...requestedFlags, remoteControl: false };
|
|
9569
9694
|
const catalogue = selectedProvider === void 0 ? void 0 : parseCatalogueCache(params.fs.readFileUtf8(catalogueCachePath(paths, selectedProvider.name)));
|
|
9570
9695
|
const routesByName = flags.routeByName || selectedProvider !== void 0 && isRouterProvider(selectedProvider.definition);
|
|
9571
|
-
const
|
|
9696
|
+
const globalModels = loadConfigFile(paths.globalConfigFile, GlobalConfigSchema, params.fs.readConfigFile)?.config.models;
|
|
9697
|
+
const models = launchCascade !== void 0 && params.farm !== void 0 ? cascadeModels : globalModels;
|
|
9698
|
+
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);
|
|
9572
9699
|
const callerSettings = hasSettingsArgument(parsedArgv.rest);
|
|
9573
9700
|
if (pickerSettings !== void 0 && callerSettings) {
|
|
9574
9701
|
notes.push("--settings was passed, so /model keeps Claude Code's own model names");
|
|
@@ -9606,6 +9733,8 @@ function decideLaunch(params, readOnly) {
|
|
|
9606
9733
|
identityCredential,
|
|
9607
9734
|
pinnedVersion,
|
|
9608
9735
|
flags,
|
|
9736
|
+
models,
|
|
9737
|
+
globalModels,
|
|
9609
9738
|
bin: discovered.path,
|
|
9610
9739
|
args,
|
|
9611
9740
|
decision
|
|
@@ -9672,7 +9801,7 @@ function prepareLaunch(params) {
|
|
|
9672
9801
|
}
|
|
9673
9802
|
const routesByName = resolvedFlags.routeByName || resolvedProvider !== void 0 && isRouterProvider(resolvedProvider.definition);
|
|
9674
9803
|
if (routesByName) {
|
|
9675
|
-
const check = resolveRoutedProviderCredentials({ paths, port: params.fs, env, ...params.credentials === void 0 ? {} : { credentials: params.credentials }, models:
|
|
9804
|
+
const check = resolveRoutedProviderCredentials({ paths, port: params.fs, env, ...params.credentials === void 0 ? {} : { credentials: params.credentials }, models: decided.models, targets: () => targetRefs(paths) });
|
|
9676
9805
|
if (!check.ok) {
|
|
9677
9806
|
log.error(check.message);
|
|
9678
9807
|
proc.exit(check.status);
|
|
@@ -9684,7 +9813,10 @@ function prepareLaunch(params) {
|
|
|
9684
9813
|
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.");
|
|
9685
9814
|
proc.exit(1);
|
|
9686
9815
|
}
|
|
9687
|
-
const
|
|
9816
|
+
const sessionId = params.supervised?.sessionId ?? randomUUID4();
|
|
9817
|
+
const resolvedModels = decided.models ?? (decided.globalModels === void 0 ? void 0 : {});
|
|
9818
|
+
const sessionModels = isDeepStrictEqual(resolvedModels, decided.globalModels) ? void 0 : resolvedModels;
|
|
9819
|
+
const frontDoor = frontDoorEngaged && frontDoorPort !== void 0 ? frontDoorPort.ensure(env.NODE_EXTRA_CA_CERTS, { sessionId, ...sessionModels === void 0 ? {} : { models: sessionModels } }) : void 0;
|
|
9688
9820
|
if (frontDoor?.trustWarning !== void 0) {
|
|
9689
9821
|
log.warn(frontDoor.trustWarning);
|
|
9690
9822
|
}
|
|
@@ -9698,7 +9830,6 @@ function prepareLaunch(params) {
|
|
|
9698
9830
|
}
|
|
9699
9831
|
rows.push(...routingRows({ frontDoor, headroom, provider: resolvedProvider !== void 0 }));
|
|
9700
9832
|
const frontDoorRelease = frontDoor === void 0 ? void 0 : frontDoorPort?.release;
|
|
9701
|
-
const sessionId = params.supervised?.sessionId ?? randomUUID4();
|
|
9702
9833
|
const finalEnv = buildEnv({
|
|
9703
9834
|
baseEnv: env,
|
|
9704
9835
|
configDirEscapeHatch: configDirEscapeHatchApplies,
|
|
@@ -9710,7 +9841,8 @@ function prepareLaunch(params) {
|
|
|
9710
9841
|
...headroom === void 0 ? {} : { headroom },
|
|
9711
9842
|
sessionId,
|
|
9712
9843
|
remoteControl: resolvedFlags.remoteControl,
|
|
9713
|
-
routeByName: routesByName
|
|
9844
|
+
routeByName: routesByName,
|
|
9845
|
+
...decided.models?.tiers === void 0 ? {} : { tierModels: decided.models.tiers }
|
|
9714
9846
|
});
|
|
9715
9847
|
const releases = [...headroom === void 0 || headroomPort === void 0 ? [] : [headroomPort.release], ...frontDoorRelease === void 0 ? [] : [frontDoorRelease]];
|
|
9716
9848
|
const release = () => {
|
|
@@ -9790,7 +9922,6 @@ var init_launcher = __esm({
|
|
|
9790
9922
|
init_launchReport();
|
|
9791
9923
|
init_modelPicker();
|
|
9792
9924
|
init_providerCatalogue();
|
|
9793
|
-
init_modelsStore();
|
|
9794
9925
|
init_providersStore();
|
|
9795
9926
|
init_pool();
|
|
9796
9927
|
init_resumeContext();
|
|
@@ -9808,6 +9939,7 @@ var init_launcher = __esm({
|
|
|
9808
9939
|
init_read();
|
|
9809
9940
|
init_claudeVersion();
|
|
9810
9941
|
init_launchHook();
|
|
9942
|
+
init_targets();
|
|
9811
9943
|
}
|
|
9812
9944
|
});
|
|
9813
9945
|
|
|
@@ -9905,8 +10037,8 @@ function realEnsurePorts(paths, spawnDaemon) {
|
|
|
9905
10037
|
}
|
|
9906
10038
|
function realFrontDoorPort(paths, spawnDaemon) {
|
|
9907
10039
|
return {
|
|
9908
|
-
ensure: (inheritedExtraCaCerts) => {
|
|
9909
|
-
const up = ensureFrontDoor({ paths, launcherPid: process.pid, ports: realEnsurePorts(paths, spawnDaemon) });
|
|
10040
|
+
ensure: (inheritedExtraCaCerts, session) => {
|
|
10041
|
+
const up = ensureFrontDoor({ paths, launcherPid: process.pid, ports: realEnsurePorts(paths, spawnDaemon), ...session === void 0 ? {} : { session } });
|
|
9910
10042
|
const trust = resolveTrustBundle({ caCertFile: paths.frontdoorCaCertFile, bundlesDir: paths.frontdoorCaBundlesDir, variable: "NODE_EXTRA_CA_CERTS", inherited: inheritedExtraCaCerts, fs: realTrustBundleFs });
|
|
9911
10043
|
return {
|
|
9912
10044
|
port: up.port,
|
|
@@ -15169,56 +15301,7 @@ init_source();
|
|
|
15169
15301
|
|
|
15170
15302
|
// src/models/doctor.ts
|
|
15171
15303
|
init_modelsStore();
|
|
15172
|
-
|
|
15173
|
-
// src/models/families.ts
|
|
15174
|
-
init_identity2();
|
|
15175
|
-
var FAMILY_PREFIX = "family:";
|
|
15176
|
-
var VARIANT_SEPARATOR = "+";
|
|
15177
|
-
function modelOf(ref) {
|
|
15178
|
-
const slash = ref.indexOf("/");
|
|
15179
|
-
return slash === -1 ? ref : ref.slice(slash + 1);
|
|
15180
|
-
}
|
|
15181
|
-
function familyKeyOf(rawModel) {
|
|
15182
|
-
const identity = modelIdentity(rawModel);
|
|
15183
|
-
return identity.variant === "" ? identity.familyAndVersion : `${identity.familyAndVersion}${VARIANT_SEPARATOR}${identity.variant}`;
|
|
15184
|
-
}
|
|
15185
|
-
function assertionsOf(models) {
|
|
15186
|
-
return { same: models?.same ?? [], distinct: models?.distinct ?? [] };
|
|
15187
|
-
}
|
|
15188
|
-
function sameModel(left, right, assertions) {
|
|
15189
|
-
if (assertions.distinct.some(([a, b]) => a === left && b === right || a === right && b === left)) {
|
|
15190
|
-
return false;
|
|
15191
|
-
}
|
|
15192
|
-
const leftGroup = assertions.same.find((group) => group.includes(left));
|
|
15193
|
-
const rightGroup = assertions.same.find((group) => group.includes(right));
|
|
15194
|
-
if (leftGroup !== void 0 && leftGroup === rightGroup) {
|
|
15195
|
-
return true;
|
|
15196
|
-
}
|
|
15197
|
-
if (leftGroup !== void 0 && !leftGroup.includes(right) || rightGroup !== void 0 && !rightGroup.includes(left)) {
|
|
15198
|
-
return false;
|
|
15199
|
-
}
|
|
15200
|
-
return relateModels(modelOf(left), modelOf(right)) === "same";
|
|
15201
|
-
}
|
|
15202
|
-
function pinnedTo(settings, ref) {
|
|
15203
|
-
return settings?.names?.some((name) => name === ref || name === modelOf(ref)) === true;
|
|
15204
|
-
}
|
|
15205
|
-
function buildFamilies(refs, models) {
|
|
15206
|
-
const assertions = assertionsOf(models);
|
|
15207
|
-
const settingsByKey = models?.families ?? {};
|
|
15208
|
-
const groups = [];
|
|
15209
|
-
for (const ref of refs) {
|
|
15210
|
-
const pinnedKey = Object.entries(settingsByKey).find(([, settings]) => pinnedTo(settings, ref))?.[0];
|
|
15211
|
-
const joined2 = groups.find((group) => pinnedKey === void 0 ? group.refs.some((first) => sameModel(first, ref, assertions)) : group.key === pinnedKey);
|
|
15212
|
-
if (joined2 !== void 0) {
|
|
15213
|
-
joined2.refs.push(ref);
|
|
15214
|
-
} else {
|
|
15215
|
-
groups.push({ key: pinnedKey ?? familyKeyOf(modelOf(ref)), refs: [ref] });
|
|
15216
|
-
}
|
|
15217
|
-
}
|
|
15218
|
-
return groups.map((group) => ({ key: group.key, refs: group.refs, settings: settingsByKey[group.key] ?? {} }));
|
|
15219
|
-
}
|
|
15220
|
-
|
|
15221
|
-
// src/models/doctor.ts
|
|
15304
|
+
init_families();
|
|
15222
15305
|
init_identity2();
|
|
15223
15306
|
function modelsFindings(input) {
|
|
15224
15307
|
const findings = [];
|
|
@@ -15306,22 +15389,8 @@ function modelsFindings(input) {
|
|
|
15306
15389
|
return findings;
|
|
15307
15390
|
}
|
|
15308
15391
|
|
|
15309
|
-
// src/models/targets.ts
|
|
15310
|
-
init_modelPicker();
|
|
15311
|
-
init_providerCatalogue();
|
|
15312
|
-
init_providersStore();
|
|
15313
|
-
init_realPorts();
|
|
15314
|
-
function providerModels(paths) {
|
|
15315
|
-
return listProviders(paths).flatMap((entry) => {
|
|
15316
|
-
const catalogue = parseCatalogueCache(realFsPort.readFileUtf8(catalogueCachePath(paths, entry.name)));
|
|
15317
|
-
return providerModelRows(entry.provider, catalogue?.models).map((row) => ({ provider: entry.name, model: row.model }));
|
|
15318
|
-
});
|
|
15319
|
-
}
|
|
15320
|
-
function targetRefs(paths) {
|
|
15321
|
-
return providerModels(paths).map((entry) => `${entry.provider}/${entry.model}`);
|
|
15322
|
-
}
|
|
15323
|
-
|
|
15324
15392
|
// src/doctorReport.ts
|
|
15393
|
+
init_targets();
|
|
15325
15394
|
init_configProfilesStore();
|
|
15326
15395
|
|
|
15327
15396
|
// src/headroom/allowlistDrift.ts
|