claude-use 11.31.1 → 11.32.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 +437 -42
- package/dist/index.cjs +9 -1
- package/dist/index.mjs +9 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -34323,7 +34323,7 @@ var init_package = __esm({
|
|
|
34323
34323
|
"package.json"() {
|
|
34324
34324
|
package_default = {
|
|
34325
34325
|
name: "claude-use",
|
|
34326
|
-
version: "11.
|
|
34326
|
+
version: "11.32.0",
|
|
34327
34327
|
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.",
|
|
34328
34328
|
license: "MIT",
|
|
34329
34329
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -63767,6 +63767,158 @@ var init_launchReport = __esm({
|
|
|
63767
63767
|
}
|
|
63768
63768
|
});
|
|
63769
63769
|
|
|
63770
|
+
// src/selection/engine.ts
|
|
63771
|
+
function compareMaybe(left, right, preferHigh) {
|
|
63772
|
+
if (left === void 0 && right === void 0) {
|
|
63773
|
+
return 0;
|
|
63774
|
+
}
|
|
63775
|
+
if (left === void 0) {
|
|
63776
|
+
return 1;
|
|
63777
|
+
}
|
|
63778
|
+
if (right === void 0) {
|
|
63779
|
+
return -1;
|
|
63780
|
+
}
|
|
63781
|
+
return preferHigh ? right - left : left - right;
|
|
63782
|
+
}
|
|
63783
|
+
function by(comparator, candidates) {
|
|
63784
|
+
return [...candidates].sort((left, right) => comparator(left, right) || left.order - right.order || (left.ref < right.ref ? -1 : left.ref > right.ref ? 1 : 0));
|
|
63785
|
+
}
|
|
63786
|
+
function selectOrdered(candidates) {
|
|
63787
|
+
const reasons = candidates.map((candidate) => `${candidate.ref}${availability(candidate)}`);
|
|
63788
|
+
const unspent = candidates.filter((candidate) => candidate.available);
|
|
63789
|
+
const current = unspent.find((candidate) => candidate.isCurrent);
|
|
63790
|
+
if (current !== void 0) {
|
|
63791
|
+
return { ref: current.ref, reasons: [...reasons, `${current.ref} is the model this session is already on and still has quota`] };
|
|
63792
|
+
}
|
|
63793
|
+
const first = by((left, right) => left.order - right.order, candidates)[0];
|
|
63794
|
+
if (first?.available === true) {
|
|
63795
|
+
return { ref: first.ref, reasons: [...reasons, `${first.ref} is the first member with quota`] };
|
|
63796
|
+
}
|
|
63797
|
+
const byPressure = by((left, right) => compareMaybe(left.pressure, right.pressure, true), unspent);
|
|
63798
|
+
const top = byPressure[0];
|
|
63799
|
+
if (top !== void 0) {
|
|
63800
|
+
return { ref: top.ref, reasons: [...reasons, `${top.ref} carries the most allowance its reset would waste`] };
|
|
63801
|
+
}
|
|
63802
|
+
const byReset = by((left, right) => compareMaybe(left.hoursToReset, right.hoursToReset, false), candidates);
|
|
63803
|
+
return { ref: byReset[0]?.ref, reasons: [...reasons, "every member is spent; serving from the one whose window lifts soonest"] };
|
|
63804
|
+
}
|
|
63805
|
+
function selectRanked(candidates, comparator, what, why) {
|
|
63806
|
+
const ordered = selectOrdered(candidates);
|
|
63807
|
+
const available = candidates.filter((candidate) => candidate.available);
|
|
63808
|
+
if (available.length === 0) {
|
|
63809
|
+
return ordered;
|
|
63810
|
+
}
|
|
63811
|
+
const ranked = by(comparator, available);
|
|
63812
|
+
const best = ranked[0];
|
|
63813
|
+
if (best === void 0) {
|
|
63814
|
+
return ordered;
|
|
63815
|
+
}
|
|
63816
|
+
const current = available.find((candidate) => candidate.isCurrent);
|
|
63817
|
+
const chosen = current !== void 0 && (comparator(current, best) === 0 || best.isCurrent) ? current : best;
|
|
63818
|
+
if (chosen.isCurrent || current === void 0) {
|
|
63819
|
+
return { ref: chosen.ref, reasons: [...ordered.reasons, `${chosen.ref} ${what}`] };
|
|
63820
|
+
}
|
|
63821
|
+
return { ref: best.ref, reasons: [...ordered.reasons, `${best.ref} ${what}; the switch from the current member is worth re-sending the conversation because ${why}`] };
|
|
63822
|
+
}
|
|
63823
|
+
function selectMember(mode, candidates, options = {}) {
|
|
63824
|
+
const plain = candidates.map((entry) => entry.candidate);
|
|
63825
|
+
switch (mode) {
|
|
63826
|
+
case "ordered":
|
|
63827
|
+
return selectOrdered(plain);
|
|
63828
|
+
case "most-allowance":
|
|
63829
|
+
return selectRanked(plain, (left, right) => compareMaybe(left.remainingAllowance, right.remainingAllowance, true), "holds the most remaining allowance", "its allowance is the largest");
|
|
63830
|
+
case "soonest-reset":
|
|
63831
|
+
return selectRanked(plain, (left, right) => compareMaybe(left.hoursToReset, right.hoursToReset, false), "resets soonest, so its allowance is the most use-it-or-lose-it", "its reset is the soonest");
|
|
63832
|
+
case "lowest-latency":
|
|
63833
|
+
return selectRanked(plain, (left, right) => compareMaybe(left.latencyMs, right.latencyMs, false), "has answered fastest of late", "its latency is the lowest observed");
|
|
63834
|
+
case "highest-success":
|
|
63835
|
+
return selectRanked(plain, (left, right) => compareMaybe(left.successRate, right.successRate, true), "has succeeded most reliably of late", "its success rate is the highest observed");
|
|
63836
|
+
case "cheapest":
|
|
63837
|
+
return selectRanked(plain, (left, right) => compareMaybe(left.pricePerMTok, right.pricePerMTok, false), "is the cheapest for the tokens this session sends", "its blended price is the lowest");
|
|
63838
|
+
case "spread": {
|
|
63839
|
+
const ordered = selectOrdered(plain);
|
|
63840
|
+
const available = plain.filter((candidate) => candidate.available);
|
|
63841
|
+
if (available.length === 0) {
|
|
63842
|
+
return ordered;
|
|
63843
|
+
}
|
|
63844
|
+
const rotation = options.rotation ?? 0;
|
|
63845
|
+
const orderedByList = by((left, right) => left.order - right.order, available);
|
|
63846
|
+
const chosen = orderedByList[rotation % orderedByList.length];
|
|
63847
|
+
return chosen === void 0 ? ordered : { ref: chosen.ref, reasons: [...ordered.reasons, `${chosen.ref} is turn ${String(rotation % orderedByList.length + 1)} of the spread across the members with quota`] };
|
|
63848
|
+
}
|
|
63849
|
+
case "adaptive":
|
|
63850
|
+
return selectAdaptive(candidates, options.needs);
|
|
63851
|
+
}
|
|
63852
|
+
return selectOrdered(plain);
|
|
63853
|
+
}
|
|
63854
|
+
function selectAdaptive(candidates, needs) {
|
|
63855
|
+
const plain = candidates.map((entry) => entry.candidate);
|
|
63856
|
+
const ruledOut = candidates.map((entry) => {
|
|
63857
|
+
const { candidate, capabilities } = entry;
|
|
63858
|
+
if (needs?.hasImage === true && !capabilities.vision) {
|
|
63859
|
+
return `${candidate.ref} does not accept images`;
|
|
63860
|
+
}
|
|
63861
|
+
if (needs?.hasTools === true && !capabilities.tools) {
|
|
63862
|
+
return `${candidate.ref} does not accept tools`;
|
|
63863
|
+
}
|
|
63864
|
+
if (needs?.thinking === true && !capabilities.thinking) {
|
|
63865
|
+
return `${candidate.ref} does not think`;
|
|
63866
|
+
}
|
|
63867
|
+
if (candidate.available && !candidate.feasible) {
|
|
63868
|
+
return `${candidate.ref} would run dry before its window resets`;
|
|
63869
|
+
}
|
|
63870
|
+
if (candidate.successRate !== void 0 && candidate.successRate < ADAPTIVE_HEALTH_FLOOR) {
|
|
63871
|
+
return `${candidate.ref} has been failing`;
|
|
63872
|
+
}
|
|
63873
|
+
return void 0;
|
|
63874
|
+
}).filter((line) => line !== void 0);
|
|
63875
|
+
const standing = candidates.filter((entry) => {
|
|
63876
|
+
const { candidate, capabilities } = entry;
|
|
63877
|
+
if (!candidate.available) {
|
|
63878
|
+
return false;
|
|
63879
|
+
}
|
|
63880
|
+
if (needs?.hasImage === true && !capabilities.vision) {
|
|
63881
|
+
return false;
|
|
63882
|
+
}
|
|
63883
|
+
if (needs?.hasTools === true && !capabilities.tools) {
|
|
63884
|
+
return false;
|
|
63885
|
+
}
|
|
63886
|
+
if (needs?.thinking === true && !capabilities.thinking) {
|
|
63887
|
+
return false;
|
|
63888
|
+
}
|
|
63889
|
+
if (!candidate.feasible) {
|
|
63890
|
+
return false;
|
|
63891
|
+
}
|
|
63892
|
+
return !(candidate.successRate !== void 0 && candidate.successRate < ADAPTIVE_HEALTH_FLOOR);
|
|
63893
|
+
});
|
|
63894
|
+
const reasons = [...ruledOut];
|
|
63895
|
+
if (standing.length === 0) {
|
|
63896
|
+
const fallback = selectOrdered(plain);
|
|
63897
|
+
return { ref: fallback.ref, reasons: [...reasons, "nothing stands: serving by order"] };
|
|
63898
|
+
}
|
|
63899
|
+
const current = standing.find((entry) => entry.candidate.isCurrent);
|
|
63900
|
+
if (current !== void 0) {
|
|
63901
|
+
return { ref: current.candidate.ref, reasons: [...reasons, `${current.candidate.ref} stands and is the model this session is already on, so the conversation is not re-sent`] };
|
|
63902
|
+
}
|
|
63903
|
+
const ranked = by(
|
|
63904
|
+
(left, right) => compareMaybe(left.pressure, right.pressure, true) || compareMaybe(left.hoursToReset, right.hoursToReset, false) || compareMaybe(left.successRate, right.successRate, true),
|
|
63905
|
+
standing.map((entry) => entry.candidate)
|
|
63906
|
+
);
|
|
63907
|
+
const best = ranked[0];
|
|
63908
|
+
if (best === void 0) {
|
|
63909
|
+
return { ref: void 0, reasons };
|
|
63910
|
+
}
|
|
63911
|
+
return { ref: best.ref, reasons: [...reasons, `${best.ref} stands and carries the most allowance its reset would waste`] };
|
|
63912
|
+
}
|
|
63913
|
+
var ADAPTIVE_HEALTH_FLOOR, availability;
|
|
63914
|
+
var init_engine = __esm({
|
|
63915
|
+
"src/selection/engine.ts"() {
|
|
63916
|
+
"use strict";
|
|
63917
|
+
ADAPTIVE_HEALTH_FLOOR = 0.5;
|
|
63918
|
+
availability = (candidate) => candidate.available ? "" : "quota spent";
|
|
63919
|
+
}
|
|
63920
|
+
});
|
|
63921
|
+
|
|
63770
63922
|
// src/antigravity/cloudUpstream.ts
|
|
63771
63923
|
function isCcpaEndpoint(endpoint) {
|
|
63772
63924
|
return endpoint.includes("cloudcode-pa.googleapis.com");
|
|
@@ -64309,32 +64461,24 @@ function chooseCandidate(candidates, routing) {
|
|
|
64309
64461
|
if (routing === void 0 || candidates.length === 1) {
|
|
64310
64462
|
return first;
|
|
64311
64463
|
}
|
|
64312
|
-
|
|
64313
|
-
|
|
64314
|
-
|
|
64315
|
-
|
|
64316
|
-
|
|
64317
|
-
|
|
64318
|
-
|
|
64319
|
-
|
|
64320
|
-
|
|
64321
|
-
|
|
64322
|
-
|
|
64323
|
-
|
|
64324
|
-
|
|
64325
|
-
|
|
64326
|
-
|
|
64327
|
-
|
|
64328
|
-
|
|
64329
|
-
|
|
64330
|
-
let soonest;
|
|
64331
|
-
for (const model of candidates) {
|
|
64332
|
-
const exhaustion = antigravityQuotaExhaustion(routing.quota, model, routing.nowMs);
|
|
64333
|
-
if (exhaustion !== void 0 && (soonest === void 0 || exhaustion.resetSec < soonest.resetSec)) {
|
|
64334
|
-
soonest = { model, resetSec: exhaustion.resetSec };
|
|
64335
|
-
}
|
|
64336
|
-
}
|
|
64337
|
-
return soonest?.model ?? first;
|
|
64464
|
+
const exhaustionOf = (model) => antigravityQuotaExhaustion(routing.quota, model, routing.nowMs);
|
|
64465
|
+
const evaluated = candidates.map((model, index) => {
|
|
64466
|
+
const exhaustion = exhaustionOf(model);
|
|
64467
|
+
return {
|
|
64468
|
+
candidate: {
|
|
64469
|
+
ref: model,
|
|
64470
|
+
order: index,
|
|
64471
|
+
available: exhaustion === void 0,
|
|
64472
|
+
// A quota the map does not measure competes at the neutral pressure the old in-place ranking gave it, not as an unknown that always loses.
|
|
64473
|
+
pressure: antigravityQuotaPressure(routing.quota, model) ?? NEUTRAL_PRESSURE,
|
|
64474
|
+
hoursToReset: exhaustion === void 0 ? void 0 : exhaustion.resetSec / SECONDS_PER_HOUR2,
|
|
64475
|
+
feasible: true,
|
|
64476
|
+
isCurrent: routing.previous === model
|
|
64477
|
+
},
|
|
64478
|
+
capabilities: { vision: true, tools: true, thinking: true }
|
|
64479
|
+
};
|
|
64480
|
+
});
|
|
64481
|
+
return selectMember("ordered", evaluated).ref ?? first;
|
|
64338
64482
|
}
|
|
64339
64483
|
function mapEffort(request7, config2) {
|
|
64340
64484
|
const requested = request7.output_config?.effort;
|
|
@@ -64526,15 +64670,18 @@ function translateRequest(request7, config2, routing) {
|
|
|
64526
64670
|
toolNames
|
|
64527
64671
|
};
|
|
64528
64672
|
}
|
|
64529
|
-
var import_node_crypto16, AUTO_ALIAS, CONTEXT_MARKER_1M, BACKEND_FAMILY_PREFIXES, BACKEND_CLAUDE_NAME, EFFORT_TO_BUDGET, BILLING_HEADER_LINE, ANTIGRAVITY_TOOL_NAME_LIMIT, TOOL_NAME_HASH_CHARS, NON_TEXT_TOOL_RESULT, EMPTY_SCHEMA, EFFORT_SUFFIXES;
|
|
64673
|
+
var import_node_crypto16, SECONDS_PER_HOUR2, NEUTRAL_PRESSURE, AUTO_ALIAS, CONTEXT_MARKER_1M, BACKEND_FAMILY_PREFIXES, BACKEND_CLAUDE_NAME, EFFORT_TO_BUDGET, BILLING_HEADER_LINE, ANTIGRAVITY_TOOL_NAME_LIMIT, TOOL_NAME_HASH_CHARS, NON_TEXT_TOOL_RESULT, EMPTY_SCHEMA, EFFORT_SUFFIXES;
|
|
64530
64674
|
var init_translate = __esm({
|
|
64531
64675
|
"src/antigravity/translate.ts"() {
|
|
64532
64676
|
"use strict";
|
|
64533
64677
|
import_node_crypto16 = require("node:crypto");
|
|
64678
|
+
init_engine();
|
|
64534
64679
|
init_quota();
|
|
64535
64680
|
init_signatures();
|
|
64536
64681
|
init_schema();
|
|
64537
64682
|
init_anthropic();
|
|
64683
|
+
SECONDS_PER_HOUR2 = 3600;
|
|
64684
|
+
NEUTRAL_PRESSURE = 1;
|
|
64538
64685
|
AUTO_ALIAS = "auto";
|
|
64539
64686
|
CONTEXT_MARKER_1M = "[1m]";
|
|
64540
64687
|
BACKEND_FAMILY_PREFIXES = ["gemini-", "antigravity-", "gpt-oss-"];
|
|
@@ -64812,7 +64959,7 @@ async function fetchCatalogue(params) {
|
|
|
64812
64959
|
}
|
|
64813
64960
|
throw new CatalogueFetchError(`no catalogue from ${outcomes.join("; ")}`);
|
|
64814
64961
|
}
|
|
64815
|
-
var import_node_path42, import_picomatch3, DEFAULT_CANDIDATE_URLS, MS_PER_SECOND8,
|
|
64962
|
+
var import_node_path42, import_picomatch3, DEFAULT_CANDIDATE_URLS, MS_PER_SECOND8, SECONDS_PER_HOUR3, HOURS_PER_DAY4, MS_PER_HOUR3, HOURS_BETWEEN_RETRIES, HTTP_OK, HTTP_MULTIPLE_CHOICES, CATALOGUE_MAX_AGE_MS, CATALOGUE_RETRY_MS, CATALOGUE_REQUEST_SECONDS, CATALOGUE_REQUEST_TIMEOUT_MS, CATALOGUE_REFRESH_TIMEOUT_MS, CatalogueModelSchema, CatalogueCacheSchema, CatalogueFetchError;
|
|
64816
64963
|
var init_providerCatalogue = __esm({
|
|
64817
64964
|
"src/providerCatalogue.ts"() {
|
|
64818
64965
|
"use strict";
|
|
@@ -64821,9 +64968,9 @@ var init_providerCatalogue = __esm({
|
|
|
64821
64968
|
init_zod();
|
|
64822
64969
|
DEFAULT_CANDIDATE_URLS = 2;
|
|
64823
64970
|
MS_PER_SECOND8 = 1e3;
|
|
64824
|
-
|
|
64971
|
+
SECONDS_PER_HOUR3 = 3600;
|
|
64825
64972
|
HOURS_PER_DAY4 = 24;
|
|
64826
|
-
MS_PER_HOUR3 =
|
|
64973
|
+
MS_PER_HOUR3 = SECONDS_PER_HOUR3 * MS_PER_SECOND8;
|
|
64827
64974
|
HOURS_BETWEEN_RETRIES = 1;
|
|
64828
64975
|
HTTP_OK = 200;
|
|
64829
64976
|
HTTP_MULTIPLE_CHOICES = 300;
|
|
@@ -65823,7 +65970,7 @@ function quotaFreshnessMs(quota) {
|
|
|
65823
65970
|
const lengths = quota.windows.flatMap((window) => window.periodMs === void 0 ? [] : [window.periodMs]);
|
|
65824
65971
|
return lengths.length === 0 ? Number.POSITIVE_INFINITY : Math.min(...lengths) / PERCENT3;
|
|
65825
65972
|
}
|
|
65826
|
-
var ProviderQuotaError, MS_PER_SECOND9,
|
|
65973
|
+
var ProviderQuotaError, MS_PER_SECOND9, SECONDS_PER_HOUR4, HOURS_PER_DAY5, DAYS_PER_MONTH, PERCENT3, HTTP_OK2, ZAI_SOURCE, ZAI_HOST, ZAI_QUOTA_URL, ZAI_UNIT_HOURS, ZAI_UNIT_MONTHS, ZAI_UNIT_MS, ZAI_MEASURES, ZaiLimitSchema, ZaiResponseSchema, zaiQuotaAdapter, OPENROUTER_SOURCE, OPENROUTER_HOST, OPENROUTER_KEY_URL, OPENROUTER_CREDITS_URL, HTTP_FORBIDDEN, MS_PER_DAY2, OpenRouterKeySchema, OpenRouterCreditsSchema, openRouterQuotaAdapter, ANTIGRAVITY_SOURCE, ANTIGRAVITY_HOST, ANTIGRAVITY_QUOTA_URL, ANTIGRAVITY_USER_URL, GOOGLE_TOKENINFO_URL, FIVE_HOURS2, DAYS_PER_WEEK2, FIVE_HOURS_MS, WEEK_MS, AntigravityBucketSchema, AntigravitySummarySchema, GoogleTokenInfoSchema, AntigravityUserSchema, ANTIGRAVITY_WINDOW_MS, antigravityQuotaAdapter, PROVIDER_QUOTA_ADAPTERS;
|
|
65827
65974
|
var init_providerQuota = __esm({
|
|
65828
65975
|
"src/usage/providerQuota.ts"() {
|
|
65829
65976
|
"use strict";
|
|
@@ -65837,7 +65984,7 @@ var init_providerQuota = __esm({
|
|
|
65837
65984
|
}
|
|
65838
65985
|
};
|
|
65839
65986
|
MS_PER_SECOND9 = 1e3;
|
|
65840
|
-
|
|
65987
|
+
SECONDS_PER_HOUR4 = 3600;
|
|
65841
65988
|
HOURS_PER_DAY5 = 24;
|
|
65842
65989
|
DAYS_PER_MONTH = 30;
|
|
65843
65990
|
PERCENT3 = 100;
|
|
@@ -65848,8 +65995,8 @@ var init_providerQuota = __esm({
|
|
|
65848
65995
|
ZAI_UNIT_HOURS = 3;
|
|
65849
65996
|
ZAI_UNIT_MONTHS = 5;
|
|
65850
65997
|
ZAI_UNIT_MS = /* @__PURE__ */ new Map([
|
|
65851
|
-
[ZAI_UNIT_HOURS,
|
|
65852
|
-
[ZAI_UNIT_MONTHS, DAYS_PER_MONTH * HOURS_PER_DAY5 *
|
|
65998
|
+
[ZAI_UNIT_HOURS, SECONDS_PER_HOUR4 * MS_PER_SECOND9],
|
|
65999
|
+
[ZAI_UNIT_MONTHS, DAYS_PER_MONTH * HOURS_PER_DAY5 * SECONDS_PER_HOUR4 * MS_PER_SECOND9]
|
|
65853
66000
|
]);
|
|
65854
66001
|
ZAI_MEASURES = { TOKENS_LIMIT: "tokens", TIME_LIMIT: "tool-calls" };
|
|
65855
66002
|
ZaiLimitSchema = external_exports.object({
|
|
@@ -65901,7 +66048,7 @@ var init_providerQuota = __esm({
|
|
|
65901
66048
|
OPENROUTER_KEY_URL = `https://${OPENROUTER_HOST}/api/v1/key`;
|
|
65902
66049
|
OPENROUTER_CREDITS_URL = `https://${OPENROUTER_HOST}/api/v1/credits`;
|
|
65903
66050
|
HTTP_FORBIDDEN = 403;
|
|
65904
|
-
MS_PER_DAY2 = HOURS_PER_DAY5 *
|
|
66051
|
+
MS_PER_DAY2 = HOURS_PER_DAY5 * SECONDS_PER_HOUR4 * MS_PER_SECOND9;
|
|
65905
66052
|
OpenRouterKeySchema = external_exports.object({
|
|
65906
66053
|
data: external_exports.object({
|
|
65907
66054
|
limit: external_exports.number().nonnegative().nullable(),
|
|
@@ -65949,8 +66096,8 @@ var init_providerQuota = __esm({
|
|
|
65949
66096
|
GOOGLE_TOKENINFO_URL = "https://oauth2.googleapis.com/tokeninfo";
|
|
65950
66097
|
FIVE_HOURS2 = 5;
|
|
65951
66098
|
DAYS_PER_WEEK2 = 7;
|
|
65952
|
-
FIVE_HOURS_MS = FIVE_HOURS2 *
|
|
65953
|
-
WEEK_MS = DAYS_PER_WEEK2 * HOURS_PER_DAY5 *
|
|
66099
|
+
FIVE_HOURS_MS = FIVE_HOURS2 * SECONDS_PER_HOUR4 * MS_PER_SECOND9;
|
|
66100
|
+
WEEK_MS = DAYS_PER_WEEK2 * HOURS_PER_DAY5 * SECONDS_PER_HOUR4 * MS_PER_SECOND9;
|
|
65954
66101
|
AntigravityBucketSchema = external_exports.object({
|
|
65955
66102
|
bucketId: external_exports.string(),
|
|
65956
66103
|
remainingFraction: external_exports.number().optional(),
|
|
@@ -67064,7 +67211,7 @@ function Lp(e14) {
|
|
|
67064
67211
|
function my(e14) {
|
|
67065
67212
|
return e14.replace(/[\u200c-\u200f\u202a-\u202e\u206a-\u206f\ufeff]/g, "").toUpperCase().toLowerCase();
|
|
67066
67213
|
}
|
|
67067
|
-
function
|
|
67214
|
+
function by2(e14, t10) {
|
|
67068
67215
|
if (Qo(e14)) return true;
|
|
67069
67216
|
if (Yn(e14)) {
|
|
67070
67217
|
let n10 = hc(e14);
|
|
@@ -67672,7 +67819,7 @@ function ri(e14) {
|
|
|
67672
67819
|
return po(e14);
|
|
67673
67820
|
}
|
|
67674
67821
|
function Vp(e14, t10) {
|
|
67675
|
-
return t10 !== void 0 && t10.some((n10) => po(n10) && !
|
|
67822
|
+
return t10 !== void 0 && t10.some((n10) => po(n10) && !by2(e14, n10) && (Xy(e14, n10) || Yn(e14)));
|
|
67676
67823
|
}
|
|
67677
67824
|
function Ck(e14, t10) {
|
|
67678
67825
|
return t10 !== void 0 && t10.some((n10) => po(n10) && Xy(n10, e14));
|
|
@@ -67682,7 +67829,7 @@ function Xy(e14, t10) {
|
|
|
67682
67829
|
return r10 === o || r10.startsWith(o === "/" ? o : o + "/");
|
|
67683
67830
|
}
|
|
67684
67831
|
function Zp(e14, t10) {
|
|
67685
|
-
return t10 === void 0 || t10.every((n10) =>
|
|
67832
|
+
return t10 === void 0 || t10.every((n10) => by2(e14, n10));
|
|
67686
67833
|
}
|
|
67687
67834
|
function vk(e14, t10) {
|
|
67688
67835
|
return t10 === void 0 || t10.every((n10) => zO(e14, n10));
|
|
@@ -133875,6 +134022,67 @@ function createRealQuotaRefresher(params) {
|
|
|
133875
134022
|
|
|
133876
134023
|
// src/frontdoor/commands.ts
|
|
133877
134024
|
init_store2();
|
|
134025
|
+
|
|
134026
|
+
// src/selection/targetStore.ts
|
|
134027
|
+
init_read();
|
|
134028
|
+
|
|
134029
|
+
// src/selection/signals.ts
|
|
134030
|
+
function targetOf(record2) {
|
|
134031
|
+
return record2.model === void 0 ? void 0 : `${record2.provider}/${record2.model}`;
|
|
134032
|
+
}
|
|
134033
|
+
function median(values) {
|
|
134034
|
+
if (values.length === 0) {
|
|
134035
|
+
return void 0;
|
|
134036
|
+
}
|
|
134037
|
+
const sorted = [...values].sort((left, right) => left - right);
|
|
134038
|
+
const middle = Math.floor(sorted.length / 2);
|
|
134039
|
+
const above = sorted[middle];
|
|
134040
|
+
const below = sorted[middle - 1];
|
|
134041
|
+
return sorted.length % 2 === 0 && above !== void 0 && below !== void 0 ? (above + below) / 2 : sorted[middle];
|
|
134042
|
+
}
|
|
134043
|
+
var OBSERVATION_WINDOW = 20;
|
|
134044
|
+
function observeRecord(observations, record2) {
|
|
134045
|
+
const target = targetOf(record2);
|
|
134046
|
+
if (target === void 0) {
|
|
134047
|
+
return new Map(observations);
|
|
134048
|
+
}
|
|
134049
|
+
const kept = [...observations.get(target) ?? [], record2].slice(-OBSERVATION_WINDOW);
|
|
134050
|
+
return new Map(observations).set(target, kept);
|
|
134051
|
+
}
|
|
134052
|
+
function observationOf(records) {
|
|
134053
|
+
const completed = records.filter((record2) => record2.outcome === "completed");
|
|
134054
|
+
const latencies = completed.map((record2) => record2.latencyMs);
|
|
134055
|
+
const usage = records.flatMap((record2) => record2.usage === void 0 ? [] : [record2.usage]);
|
|
134056
|
+
const input2 = usage.reduce((sum, entry) => sum + (entry.inputTokens ?? 0), 0);
|
|
134057
|
+
const output2 = usage.reduce((sum, entry) => sum + (entry.outputTokens ?? 0), 0);
|
|
134058
|
+
const cacheRead = usage.reduce((sum, entry) => sum + (entry.cacheReadInputTokens ?? 0), 0);
|
|
134059
|
+
return {
|
|
134060
|
+
latencyMs: median(latencies),
|
|
134061
|
+
successRate: records.length === 0 ? void 0 : completed.length / records.length,
|
|
134062
|
+
tokenMix: input2 + output2 + cacheRead === 0 ? void 0 : { input: input2, output: output2, cacheRead }
|
|
134063
|
+
};
|
|
134064
|
+
}
|
|
134065
|
+
|
|
134066
|
+
// src/selection/targetStore.ts
|
|
134067
|
+
var SEED_LOOKBACK_RECORDS = 500;
|
|
134068
|
+
function createTargetObservationStore(fs26, paths) {
|
|
134069
|
+
let observations = /* @__PURE__ */ new Map();
|
|
134070
|
+
const seeded = readUsageLog(fs26, paths.usageLogDir, {}).records.slice(-SEED_LOOKBACK_RECORDS);
|
|
134071
|
+
for (const record2 of seeded) {
|
|
134072
|
+
observations = observeRecord(observations, record2);
|
|
134073
|
+
}
|
|
134074
|
+
return {
|
|
134075
|
+
observe: (record2) => {
|
|
134076
|
+
observations = observeRecord(observations, record2);
|
|
134077
|
+
},
|
|
134078
|
+
observation: (target) => {
|
|
134079
|
+
const records = observations.get(target);
|
|
134080
|
+
return records === void 0 ? void 0 : observationOf(records);
|
|
134081
|
+
}
|
|
134082
|
+
};
|
|
134083
|
+
}
|
|
134084
|
+
|
|
134085
|
+
// src/frontdoor/commands.ts
|
|
133878
134086
|
function respawnInvocation(paths) {
|
|
133879
134087
|
const env = {};
|
|
133880
134088
|
for (const [name, value2] of Object.entries({ ...process.env, AGENT_SHIM_HOME: paths.root })) {
|
|
@@ -134061,7 +134269,11 @@ function realFrontDoorSupervisorPorts(paths) {
|
|
|
134061
134269
|
catalogueKeeper.tick();
|
|
134062
134270
|
setInterval(catalogueKeeper.tick, ANTHROPIC_USAGE_FRESHNESS_MS).unref();
|
|
134063
134271
|
const headroomDecision = createHeadroomDecision(createRoutingSettingReader(paths));
|
|
134064
|
-
const
|
|
134272
|
+
const targetObservations = createTargetObservationStore(realFarmFs, paths);
|
|
134273
|
+
const recordUsage = (record2) => {
|
|
134274
|
+
withQuotaRefresh(usageStore.record, quotaRefresher)(record2);
|
|
134275
|
+
targetObservations.observe(record2);
|
|
134276
|
+
};
|
|
134065
134277
|
const usageMiddleware = createUsageMiddleware({
|
|
134066
134278
|
// Each finished response also tells the per-session headroom decision when the session's cache was last touched and whether it read from it.
|
|
134067
134279
|
record: (record2, event) => {
|
|
@@ -146610,6 +146822,188 @@ function registerProviderCommand(program2, deps) {
|
|
|
146610
146822
|
);
|
|
146611
146823
|
}
|
|
146612
146824
|
|
|
146825
|
+
// src/models.ts
|
|
146826
|
+
init_commandDeps();
|
|
146827
|
+
init_providersStore();
|
|
146828
|
+
init_modelPicker();
|
|
146829
|
+
init_providerCatalogue();
|
|
146830
|
+
init_realPorts();
|
|
146831
|
+
|
|
146832
|
+
// src/models/identity.ts
|
|
146833
|
+
var NON_IDENTITY_BRACKET_RE = /\[[^\]]*\]/g;
|
|
146834
|
+
var DATE_STAMP_RE = /-(?:19|20)\d{2}(?:0[1-9]|1[0-2])(?:0[1-9]|[12]\d|3[01])$/;
|
|
146835
|
+
var KNOWN_VARIANTS = /* @__PURE__ */ new Set(["high", "medium", "low", "thinking", "xhigh", "max", "highspeed", "sol", "terra", "luna", "mini", "flash-lite", "turbo"]);
|
|
146836
|
+
var VENDOR_BY_NAMESPACE = Object.freeze({
|
|
146837
|
+
anthropic: "anthropic",
|
|
146838
|
+
google: "google",
|
|
146839
|
+
openai: "openai",
|
|
146840
|
+
zai: "zai",
|
|
146841
|
+
"z-ai": "zai",
|
|
146842
|
+
minimax: "minimax",
|
|
146843
|
+
qwen: "qwen",
|
|
146844
|
+
deepseek: "deepseek",
|
|
146845
|
+
moonshot: "moonshot",
|
|
146846
|
+
meta: "meta",
|
|
146847
|
+
mistral: "mistral"
|
|
146848
|
+
});
|
|
146849
|
+
var VENDOR_BY_TOKEN = Object.freeze({
|
|
146850
|
+
claude: "anthropic",
|
|
146851
|
+
gemini: "google",
|
|
146852
|
+
antigravity: "google",
|
|
146853
|
+
gpt: "openai",
|
|
146854
|
+
glm: "zai",
|
|
146855
|
+
minimax: "minimax",
|
|
146856
|
+
qwen: "qwen",
|
|
146857
|
+
deepseek: "deepseek",
|
|
146858
|
+
kimi: "moonshot",
|
|
146859
|
+
llama: "meta",
|
|
146860
|
+
mistral: "mistral",
|
|
146861
|
+
mixtral: "mistral"
|
|
146862
|
+
});
|
|
146863
|
+
function canonicalText(name) {
|
|
146864
|
+
return name.trim().toLowerCase().replace(NON_IDENTITY_BRACKET_RE, "").replace(/[\s_]+/g, "-").replace(/([a-z])(\d+(?:\.\d+)+)/g, "$1-$2").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
146865
|
+
}
|
|
146866
|
+
function splitVariants(tokens) {
|
|
146867
|
+
const variants = [];
|
|
146868
|
+
let end = tokens.length;
|
|
146869
|
+
for (; ; ) {
|
|
146870
|
+
const token = tokens[end - 1];
|
|
146871
|
+
if (token === void 0 || !KNOWN_VARIANTS.has(token)) {
|
|
146872
|
+
return { familyTokens: tokens.slice(0, end), variants };
|
|
146873
|
+
}
|
|
146874
|
+
variants.unshift(token);
|
|
146875
|
+
end -= 1;
|
|
146876
|
+
}
|
|
146877
|
+
}
|
|
146878
|
+
function versionOf(tokens) {
|
|
146879
|
+
for (let index = 0; index < tokens.length; index += 1) {
|
|
146880
|
+
const token = tokens[index];
|
|
146881
|
+
const next = tokens[index + 1];
|
|
146882
|
+
if (token === void 0) {
|
|
146883
|
+
return "";
|
|
146884
|
+
}
|
|
146885
|
+
if (/^\d+$/.test(token) && next !== void 0 && /^\d+$/.test(next)) {
|
|
146886
|
+
return `${token}.${next}`;
|
|
146887
|
+
}
|
|
146888
|
+
const dotted = /^\d+(?:\.\d+)+$/.exec(token);
|
|
146889
|
+
if (dotted !== null) {
|
|
146890
|
+
return dotted[0];
|
|
146891
|
+
}
|
|
146892
|
+
}
|
|
146893
|
+
return "";
|
|
146894
|
+
}
|
|
146895
|
+
function modelIdentity(rawName) {
|
|
146896
|
+
const segments = rawName.trim().toLowerCase().split("/");
|
|
146897
|
+
const stripped = canonicalText(segments[segments.length - 1] ?? "").split(":")[0] ?? "";
|
|
146898
|
+
const withoutDate = stripped.replace(DATE_STAMP_RE, "");
|
|
146899
|
+
const tokens = withoutDate.split("-").filter((token) => token !== "");
|
|
146900
|
+
const { familyTokens, variants } = splitVariants(tokens);
|
|
146901
|
+
const version2 = versionOf(familyTokens);
|
|
146902
|
+
const versionless = familyTokens.filter((token, index) => {
|
|
146903
|
+
if (version2 === "") {
|
|
146904
|
+
return true;
|
|
146905
|
+
}
|
|
146906
|
+
const dotted = /^\d+(?:\.\d+)+$/.test(token);
|
|
146907
|
+
const previous = familyTokens[index - 1];
|
|
146908
|
+
const next = familyTokens[index + 1];
|
|
146909
|
+
const insideVersionRun = dotted || /^\d+$/.test(token) && (previous !== void 0 && /^\d+$/.test(previous) || next !== void 0 && /^\d+$/.test(next));
|
|
146910
|
+
return !insideVersionRun;
|
|
146911
|
+
});
|
|
146912
|
+
const family = versionless.join("-");
|
|
146913
|
+
const tokenVendor = familyTokens.find((token) => Object.keys(VENDOR_BY_TOKEN).some((key) => token === key || token.startsWith(key)));
|
|
146914
|
+
const namespace = segments.length >= 2 ? (segments[0] ?? "").split(":").pop() ?? "" : "";
|
|
146915
|
+
const namespaceVendor = VENDOR_BY_NAMESPACE[namespace] ?? "";
|
|
146916
|
+
const tokenVendorName = tokenVendor === void 0 ? "" : VENDOR_BY_TOKEN[Object.keys(VENDOR_BY_TOKEN).find((key) => tokenVendor === key || tokenVendor.startsWith(key)) ?? ""] ?? "";
|
|
146917
|
+
return {
|
|
146918
|
+
vendor: tokenVendorName === "" ? namespaceVendor : tokenVendorName,
|
|
146919
|
+
vendorConflict: tokenVendorName !== "" && namespaceVendor !== "" && tokenVendorName !== namespaceVendor,
|
|
146920
|
+
family,
|
|
146921
|
+
version: version2,
|
|
146922
|
+
variant: variants.join("-"),
|
|
146923
|
+
familyAndVersion: version2 === "" ? family : `${family}-${version2.replace(/\./g, "-")}`
|
|
146924
|
+
};
|
|
146925
|
+
}
|
|
146926
|
+
function relateModels(left, right) {
|
|
146927
|
+
const a10 = modelIdentity(left);
|
|
146928
|
+
const b = modelIdentity(right);
|
|
146929
|
+
if (a10.familyAndVersion !== b.familyAndVersion) {
|
|
146930
|
+
return sameFamilyOtherVersion(a10, b) ? "similar" : "distinct";
|
|
146931
|
+
}
|
|
146932
|
+
if (a10.variant !== b.variant || a10.vendorConflict || b.vendorConflict || a10.vendor !== "" && b.vendor !== "" && a10.vendor !== b.vendor) {
|
|
146933
|
+
return "similar";
|
|
146934
|
+
}
|
|
146935
|
+
return "same";
|
|
146936
|
+
}
|
|
146937
|
+
function sameFamilyOtherVersion(a10, b) {
|
|
146938
|
+
if (a10.family !== b.family) {
|
|
146939
|
+
return false;
|
|
146940
|
+
}
|
|
146941
|
+
if (a10.vendor !== "" && b.vendor !== "" && a10.vendor !== b.vendor) {
|
|
146942
|
+
return false;
|
|
146943
|
+
}
|
|
146944
|
+
return true;
|
|
146945
|
+
}
|
|
146946
|
+
|
|
146947
|
+
// src/models.ts
|
|
146948
|
+
function providerModels(paths) {
|
|
146949
|
+
return listProviders(paths).flatMap((entry) => {
|
|
146950
|
+
const catalogue = parseCatalogueCache(realFsPort.readFileUtf8(catalogueCachePath(paths, entry.name)));
|
|
146951
|
+
return providerModelRows(entry.provider, catalogue?.models).map((row) => ({ provider: entry.name, model: row.model }));
|
|
146952
|
+
});
|
|
146953
|
+
}
|
|
146954
|
+
function matchModels(models) {
|
|
146955
|
+
const same = [];
|
|
146956
|
+
for (const model of models) {
|
|
146957
|
+
const group = same.find((candidates) => candidates.some((other) => relateModels(other.model, model.model) === "same" && other.provider !== model.provider));
|
|
146958
|
+
if (group === void 0) {
|
|
146959
|
+
same.push([model]);
|
|
146960
|
+
} else {
|
|
146961
|
+
group.push(model);
|
|
146962
|
+
}
|
|
146963
|
+
}
|
|
146964
|
+
const similar = [];
|
|
146965
|
+
for (let outer = 0; outer < models.length; outer += 1) {
|
|
146966
|
+
for (let inner = outer + 1; inner < models.length; inner += 1) {
|
|
146967
|
+
const left = models[outer];
|
|
146968
|
+
const right = models[inner];
|
|
146969
|
+
if (left === void 0 || right === void 0 || left.provider === right.provider) {
|
|
146970
|
+
continue;
|
|
146971
|
+
}
|
|
146972
|
+
if (relateModels(left.model, right.model) === "similar" && !same.some((group) => group.includes(left) && group.includes(right))) {
|
|
146973
|
+
similar.push([left, right]);
|
|
146974
|
+
}
|
|
146975
|
+
}
|
|
146976
|
+
}
|
|
146977
|
+
return { same: same.filter((group) => group.length > 1), similar };
|
|
146978
|
+
}
|
|
146979
|
+
function registerModelsCommand(program2, deps) {
|
|
146980
|
+
const { paths } = deps;
|
|
146981
|
+
const modelsCommand = program2.command("model").description("Inspect the models the defined providers offer: which names are the same model across providers, and which only look alike.");
|
|
146982
|
+
withExamples(modelsCommand, ["agent-shim model match"]);
|
|
146983
|
+
withExamples(
|
|
146984
|
+
modelsCommand.command("match").description("List every model every provider offers, grouped into the ones that are the same model across providers, with the pairs that are merely similar named beside them.").option("--json", "Print the match as JSON."),
|
|
146985
|
+
["agent-shim model match"]
|
|
146986
|
+
).action((options) => {
|
|
146987
|
+
const models = providerModels(paths);
|
|
146988
|
+
const { same, similar } = matchModels(models);
|
|
146989
|
+
if (options.json === true) {
|
|
146990
|
+
printJson({ models, same, similar });
|
|
146991
|
+
return;
|
|
146992
|
+
}
|
|
146993
|
+
console.log(`Models of ${String(models.length)} across the defined providers:`);
|
|
146994
|
+
if (same.length === 0 && similar.length === 0) {
|
|
146995
|
+
console.log(" no two names are the same model, and none look alike");
|
|
146996
|
+
return;
|
|
146997
|
+
}
|
|
146998
|
+
for (const group of same) {
|
|
146999
|
+
console.log(` same: ${group.map((entry) => `${entry.provider}/${entry.model}`).join(" = ")}`);
|
|
147000
|
+
}
|
|
147001
|
+
for (const [left, right] of similar) {
|
|
147002
|
+
console.log(` similar: ${left.provider}/${left.model} ~ ${right.provider}/${right.model}`);
|
|
147003
|
+
}
|
|
147004
|
+
});
|
|
147005
|
+
}
|
|
147006
|
+
|
|
146613
147007
|
// src/directoryRules.ts
|
|
146614
147008
|
init_commandDeps();
|
|
146615
147009
|
init_cliError();
|
|
@@ -147104,6 +147498,7 @@ function buildProgram(deps) {
|
|
|
147104
147498
|
registerJobCommand(program2, deps);
|
|
147105
147499
|
registerHeadlessCommands(program2, deps);
|
|
147106
147500
|
registerProviderCommand(program2, deps);
|
|
147501
|
+
registerModelsCommand(program2, deps);
|
|
147107
147502
|
registerRuleCommand(program2, deps);
|
|
147108
147503
|
registerCredentialCommand(program2, deps, deps.credentialPorts);
|
|
147109
147504
|
registerCheckCommand(program2, deps);
|
package/dist/index.cjs
CHANGED
|
@@ -2983,7 +2983,7 @@ var init_package = __esm({
|
|
|
2983
2983
|
"package.json"() {
|
|
2984
2984
|
package_default = {
|
|
2985
2985
|
name: "claude-use",
|
|
2986
|
-
version: "11.
|
|
2986
|
+
version: "11.32.0",
|
|
2987
2987
|
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.",
|
|
2988
2988
|
license: "MIT",
|
|
2989
2989
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -8186,6 +8186,13 @@ var init_launchReport = __esm({
|
|
|
8186
8186
|
}
|
|
8187
8187
|
});
|
|
8188
8188
|
|
|
8189
|
+
// src/selection/engine.ts
|
|
8190
|
+
var init_engine = __esm({
|
|
8191
|
+
"src/selection/engine.ts"() {
|
|
8192
|
+
"use strict";
|
|
8193
|
+
}
|
|
8194
|
+
});
|
|
8195
|
+
|
|
8189
8196
|
// src/antigravity/cloudUpstream.ts
|
|
8190
8197
|
var init_cloudUpstream = __esm({
|
|
8191
8198
|
"src/antigravity/cloudUpstream.ts"() {
|
|
@@ -8320,6 +8327,7 @@ var AUTO_ALIAS;
|
|
|
8320
8327
|
var init_translate = __esm({
|
|
8321
8328
|
"src/antigravity/translate.ts"() {
|
|
8322
8329
|
"use strict";
|
|
8330
|
+
init_engine();
|
|
8323
8331
|
init_quota();
|
|
8324
8332
|
init_signatures();
|
|
8325
8333
|
init_schema();
|
package/dist/index.mjs
CHANGED
|
@@ -2959,7 +2959,7 @@ var init_package = __esm({
|
|
|
2959
2959
|
"package.json"() {
|
|
2960
2960
|
package_default = {
|
|
2961
2961
|
name: "claude-use",
|
|
2962
|
-
version: "11.
|
|
2962
|
+
version: "11.32.0",
|
|
2963
2963
|
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.",
|
|
2964
2964
|
license: "MIT",
|
|
2965
2965
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -8158,6 +8158,13 @@ var init_launchReport = __esm({
|
|
|
8158
8158
|
}
|
|
8159
8159
|
});
|
|
8160
8160
|
|
|
8161
|
+
// src/selection/engine.ts
|
|
8162
|
+
var init_engine = __esm({
|
|
8163
|
+
"src/selection/engine.ts"() {
|
|
8164
|
+
"use strict";
|
|
8165
|
+
}
|
|
8166
|
+
});
|
|
8167
|
+
|
|
8161
8168
|
// src/antigravity/cloudUpstream.ts
|
|
8162
8169
|
var init_cloudUpstream = __esm({
|
|
8163
8170
|
"src/antigravity/cloudUpstream.ts"() {
|
|
@@ -8292,6 +8299,7 @@ var AUTO_ALIAS;
|
|
|
8292
8299
|
var init_translate = __esm({
|
|
8293
8300
|
"src/antigravity/translate.ts"() {
|
|
8294
8301
|
"use strict";
|
|
8302
|
+
init_engine();
|
|
8295
8303
|
init_quota();
|
|
8296
8304
|
init_signatures();
|
|
8297
8305
|
init_schema();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-use",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.32.0",
|
|
4
4
|
"description": "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Joseph Mearman <joseph@mearman.co.uk>",
|