agent-shim 11.83.5 → 11.83.6
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 +199 -69
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -39986,7 +39986,7 @@ var init_package = __esm({
|
|
|
39986
39986
|
"package.json"() {
|
|
39987
39987
|
package_default = {
|
|
39988
39988
|
name: "agent-shim",
|
|
39989
|
-
version: "11.83.
|
|
39989
|
+
version: "11.83.6",
|
|
39990
39990
|
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.",
|
|
39991
39991
|
license: "MIT",
|
|
39992
39992
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -68743,9 +68743,12 @@ var init_cloudUpstream = __esm({
|
|
|
68743
68743
|
AntigravityUpstreamError = class extends Error {
|
|
68744
68744
|
status;
|
|
68745
68745
|
retryAfter;
|
|
68746
|
+
/** The backend's own answer, as it sent it, which carries more than the message says (the model a 429 names and when its allowance lifts). */
|
|
68747
|
+
body;
|
|
68746
68748
|
constructor(status, message, retryAfter) {
|
|
68747
68749
|
super(`Google Antigravity API error (${String(status)}): ${message}`);
|
|
68748
68750
|
this.name = "AntigravityUpstreamError";
|
|
68751
|
+
this.body = message;
|
|
68749
68752
|
this.status = status;
|
|
68750
68753
|
this.retryAfter = retryAfter;
|
|
68751
68754
|
}
|
|
@@ -68794,6 +68797,60 @@ function antigravityQuotaPressure(quota, model) {
|
|
|
68794
68797
|
const pressures = [windowPressure(fiveHour, FIVE_HOUR_PERIOD_SECONDS), windowPressure(weekly, WEEK_PERIOD_SECONDS)].filter((pressure) => pressure !== void 0);
|
|
68795
68798
|
return pressures.length === 0 ? void 0 : Math.min(...pressures);
|
|
68796
68799
|
}
|
|
68800
|
+
function parseQuotaExhaustion(body, nowMs) {
|
|
68801
|
+
let parsed;
|
|
68802
|
+
try {
|
|
68803
|
+
parsed = JSON.parse(body);
|
|
68804
|
+
} catch {
|
|
68805
|
+
return void 0;
|
|
68806
|
+
}
|
|
68807
|
+
const details = isRecord7(parsed) && isRecord7(parsed.error) && Array.isArray(parsed.error.details) ? parsed.error.details : [];
|
|
68808
|
+
let model;
|
|
68809
|
+
let resetAtMs;
|
|
68810
|
+
for (const detail of details) {
|
|
68811
|
+
if (!isRecord7(detail)) {
|
|
68812
|
+
continue;
|
|
68813
|
+
}
|
|
68814
|
+
if (detail.reason === "QUOTA_EXHAUSTED" && isRecord7(detail.metadata)) {
|
|
68815
|
+
const named = detail.metadata.model;
|
|
68816
|
+
const stamp = typeof detail.metadata.quotaResetTimeStamp === "string" ? Date.parse(detail.metadata.quotaResetTimeStamp) : Number.NaN;
|
|
68817
|
+
model = typeof named === "string" && named !== "" ? named : void 0;
|
|
68818
|
+
resetAtMs = Number.isNaN(stamp) ? void 0 : stamp;
|
|
68819
|
+
} else if (typeof detail.retryDelay === "string" && resetAtMs === void 0) {
|
|
68820
|
+
const seconds = RETRY_DELAY.exec(detail.retryDelay)?.groups?.seconds;
|
|
68821
|
+
resetAtMs = seconds === void 0 ? void 0 : nowMs + Math.ceil(Number(seconds) * MS_PER_SECOND9);
|
|
68822
|
+
}
|
|
68823
|
+
}
|
|
68824
|
+
return model === void 0 || resetAtMs === void 0 ? void 0 : { model, resetAtMs };
|
|
68825
|
+
}
|
|
68826
|
+
function bucketKeyOf(model, resetInSeconds) {
|
|
68827
|
+
const lower = model.toLowerCase();
|
|
68828
|
+
if (lower.includes("argon")) {
|
|
68829
|
+
return "gemini-argon-wtu-weekly";
|
|
68830
|
+
}
|
|
68831
|
+
const withinFiveHours = resetInSeconds <= FIVE_HOUR_PERIOD_SECONDS;
|
|
68832
|
+
if (lower.includes("gemini")) {
|
|
68833
|
+
return withinFiveHours ? "gemini-5h" : "gemini-weekly";
|
|
68834
|
+
}
|
|
68835
|
+
return withinFiveHours ? "3p-5h" : "3p-weekly";
|
|
68836
|
+
}
|
|
68837
|
+
function quotaWithExhaustions(quota, exhaustions, nowMs) {
|
|
68838
|
+
const spent = [...exhaustions].filter(([, resetAtMs]) => resetAtMs > nowMs);
|
|
68839
|
+
if (spent.length === 0) {
|
|
68840
|
+
return quota;
|
|
68841
|
+
}
|
|
68842
|
+
const merged = { ...quota };
|
|
68843
|
+
for (const [model, resetAtMs] of spent) {
|
|
68844
|
+
const resetIn = Math.ceil((resetAtMs - nowMs) / MS_PER_SECOND9);
|
|
68845
|
+
const key = bucketKeyOf(model, resetIn);
|
|
68846
|
+
const known = merged[key];
|
|
68847
|
+
if (known?.remaining_fraction === 0 && (known.reset_in_seconds ?? 0) >= resetIn) {
|
|
68848
|
+
continue;
|
|
68849
|
+
}
|
|
68850
|
+
merged[key] = { remaining_fraction: 0, reset_in_seconds: resetIn };
|
|
68851
|
+
}
|
|
68852
|
+
return merged;
|
|
68853
|
+
}
|
|
68797
68854
|
function calculateUtilization(remainingFraction) {
|
|
68798
68855
|
if (remainingFraction === void 0 || !Number.isFinite(remainingFraction)) {
|
|
68799
68856
|
return void 0;
|
|
@@ -68975,7 +69032,7 @@ function ageQuotaMap(quota, elapsedMs) {
|
|
|
68975
69032
|
Object.entries(quota).map(([key, bucket]) => [key, bucket?.reset_in_seconds === void 0 ? bucket : { ...bucket, reset_in_seconds: Math.max(0, bucket.reset_in_seconds - elapsedSec) }])
|
|
68976
69033
|
);
|
|
68977
69034
|
}
|
|
68978
|
-
var MS_PER_SECOND9, DEFAULT_RETRY_AFTER_SECONDS, FRACTION_DIGITS, GEMINI_5H_KEYS, GEMINI_WEEKLY_KEYS, ARGON_WEEKLY_KEYS, THIRD_PARTY_5H_KEYS, THIRD_PARTY_WEEKLY_KEYS, QUOTA_FAMILY_WINDOWS, SECONDS_PER_HOUR, HOURS_PER_FIVE_HOUR_WINDOW, DAYS_PER_WEEK, HOURS_PER_DAY4, FIVE_HOUR_PERIOD_SECONDS, WEEK_PERIOD_SECONDS, ANTIGRAVITY_QUOTA_REFRESH_MS;
|
|
69035
|
+
var MS_PER_SECOND9, DEFAULT_RETRY_AFTER_SECONDS, FRACTION_DIGITS, GEMINI_5H_KEYS, GEMINI_WEEKLY_KEYS, ARGON_WEEKLY_KEYS, THIRD_PARTY_5H_KEYS, THIRD_PARTY_WEEKLY_KEYS, QUOTA_FAMILY_WINDOWS, SECONDS_PER_HOUR, HOURS_PER_FIVE_HOUR_WINDOW, DAYS_PER_WEEK, HOURS_PER_DAY4, FIVE_HOUR_PERIOD_SECONDS, WEEK_PERIOD_SECONDS, RETRY_DELAY, ANTIGRAVITY_QUOTA_REFRESH_MS;
|
|
68979
69036
|
var init_quota = __esm({
|
|
68980
69037
|
"src/antigravity/quota.ts"() {
|
|
68981
69038
|
"use strict";
|
|
@@ -69002,6 +69059,7 @@ var init_quota = __esm({
|
|
|
69002
69059
|
HOURS_PER_DAY4 = 24;
|
|
69003
69060
|
FIVE_HOUR_PERIOD_SECONDS = HOURS_PER_FIVE_HOUR_WINDOW * SECONDS_PER_HOUR;
|
|
69004
69061
|
WEEK_PERIOD_SECONDS = DAYS_PER_WEEK * HOURS_PER_DAY4 * SECONDS_PER_HOUR;
|
|
69062
|
+
RETRY_DELAY = /^(?<seconds>\d+(?:\.\d+)?)s$/u;
|
|
69005
69063
|
ANTIGRAVITY_QUOTA_REFRESH_MS = 6e4;
|
|
69006
69064
|
}
|
|
69007
69065
|
});
|
|
@@ -71168,7 +71226,13 @@ var init_providerQuota = __esm({
|
|
|
71168
71226
|
/** The account's paid subscription; absent when the account has none. */
|
|
71169
71227
|
paidTier: external_exports.object({ name: external_exports.string().optional(), id: external_exports.string().optional() }).optional()
|
|
71170
71228
|
});
|
|
71171
|
-
ANTIGRAVITY_WINDOW_MS = {
|
|
71229
|
+
ANTIGRAVITY_WINDOW_MS = {
|
|
71230
|
+
"gemini-5h": FIVE_HOURS_MS,
|
|
71231
|
+
"3p-5h": FIVE_HOURS_MS,
|
|
71232
|
+
"gemini-weekly": WEEK_MS,
|
|
71233
|
+
"3p-weekly": WEEK_MS,
|
|
71234
|
+
"gemini-argon-wtu-weekly": WEEK_MS
|
|
71235
|
+
};
|
|
71172
71236
|
antigravityQuotaAdapter = {
|
|
71173
71237
|
source: ANTIGRAVITY_SOURCE,
|
|
71174
71238
|
matches: (baseUrl) => URL.canParse(baseUrl) && new URL(baseUrl).hostname === ANTIGRAVITY_HOST,
|
|
@@ -141846,6 +141910,15 @@ function exhaustedMessage(exhaustion) {
|
|
|
141846
141910
|
function createAntigravityRoute(ports) {
|
|
141847
141911
|
const fallbackId = ports.fallbackId ?? (() => (0, import_node_crypto24.randomUUID)());
|
|
141848
141912
|
const lastRouted = ports.lastRouted ?? /* @__PURE__ */ new Map();
|
|
141913
|
+
const exhaustedModels = ports.exhaustedModels ?? /* @__PURE__ */ new Map();
|
|
141914
|
+
const liveQuota = (nowMs) => {
|
|
141915
|
+
for (const [model, resetAtMs] of exhaustedModels) {
|
|
141916
|
+
if (resetAtMs <= nowMs) {
|
|
141917
|
+
exhaustedModels.delete(model);
|
|
141918
|
+
}
|
|
141919
|
+
}
|
|
141920
|
+
return quotaWithExhaustions(ports.quotaSource?.(), exhaustedModels, nowMs);
|
|
141921
|
+
};
|
|
141849
141922
|
return async (request7) => {
|
|
141850
141923
|
await Promise.resolve();
|
|
141851
141924
|
if (request7.method !== "POST") {
|
|
@@ -141899,71 +141972,90 @@ function createAntigravityRoute(ports) {
|
|
|
141899
141972
|
const requestedModel = parsed.data.model ?? config2.defaultModel;
|
|
141900
141973
|
const nowMs = ports.now?.() ?? Date.now();
|
|
141901
141974
|
const sessionKey = parsed.data.metadata?.user_id === void 0 ? void 0 : `${parsed.data.metadata.user_id}\0${parsed.data.model ?? ""}`;
|
|
141902
|
-
const
|
|
141903
|
-
|
|
141904
|
-
|
|
141905
|
-
|
|
141906
|
-
|
|
141907
|
-
|
|
141908
|
-
|
|
141909
|
-
|
|
141975
|
+
const routeRequest = () => {
|
|
141976
|
+
const routed = translateRequest(parsed.data, config2, { quota: liveQuota(nowMs), nowMs, previous: sessionKey === void 0 ? void 0 : lastRouted.get(sessionKey) });
|
|
141977
|
+
if (sessionKey !== void 0) {
|
|
141978
|
+
lastRouted.delete(sessionKey);
|
|
141979
|
+
lastRouted.set(sessionKey, routed.model);
|
|
141980
|
+
if (lastRouted.size > ROUTING_MEMORY_SESSIONS) {
|
|
141981
|
+
const oldest = lastRouted.keys().next();
|
|
141982
|
+
if (oldest.done !== true) {
|
|
141983
|
+
lastRouted.delete(oldest.value);
|
|
141984
|
+
}
|
|
141910
141985
|
}
|
|
141911
141986
|
}
|
|
141912
|
-
|
|
141913
|
-
|
|
141914
|
-
|
|
141915
|
-
|
|
141916
|
-
|
|
141917
|
-
|
|
141918
|
-
|
|
141919
|
-
|
|
141920
|
-
|
|
141921
|
-
model: translated.model,
|
|
141922
|
-
request: translated.request,
|
|
141923
|
-
signal: request7.signal,
|
|
141924
|
-
connector: ports.localConnector
|
|
141925
|
-
}) : callCloudAntigravity(
|
|
141926
|
-
{
|
|
141987
|
+
return routed;
|
|
141988
|
+
};
|
|
141989
|
+
let translated = routeRequest();
|
|
141990
|
+
const tried = /* @__PURE__ */ new Set();
|
|
141991
|
+
let iterator;
|
|
141992
|
+
let firstResult;
|
|
141993
|
+
for (; ; ) {
|
|
141994
|
+
tried.add(translated.model);
|
|
141995
|
+
const upstreamChunks2 = config2.mode === "local" ? callLocalAntigravity({
|
|
141927
141996
|
config: config2,
|
|
141928
141997
|
model: translated.model,
|
|
141929
141998
|
request: translated.request,
|
|
141930
|
-
|
|
141931
|
-
|
|
141932
|
-
|
|
141933
|
-
|
|
141934
|
-
|
|
141935
|
-
|
|
141936
|
-
|
|
141937
|
-
|
|
141938
|
-
|
|
141939
|
-
|
|
141940
|
-
|
|
141941
|
-
|
|
141942
|
-
|
|
141943
|
-
|
|
141944
|
-
|
|
141945
|
-
|
|
141946
|
-
|
|
141947
|
-
|
|
141999
|
+
signal: request7.signal,
|
|
142000
|
+
connector: ports.localConnector
|
|
142001
|
+
}) : callCloudAntigravity(
|
|
142002
|
+
{
|
|
142003
|
+
config: config2,
|
|
142004
|
+
model: translated.model,
|
|
142005
|
+
request: translated.request,
|
|
142006
|
+
token,
|
|
142007
|
+
credentialTarget,
|
|
142008
|
+
signal: request7.signal
|
|
142009
|
+
},
|
|
142010
|
+
ports.fetchFn
|
|
142011
|
+
);
|
|
142012
|
+
iterator = upstreamChunks2[Symbol.asyncIterator]();
|
|
142013
|
+
try {
|
|
142014
|
+
firstResult = await iterator.next();
|
|
142015
|
+
break;
|
|
142016
|
+
} catch (error63) {
|
|
142017
|
+
if (error63 instanceof AntigravityUpstreamError) {
|
|
142018
|
+
const is429 = error63.status === HTTP_STATUS.tooManyRequests;
|
|
142019
|
+
const learned = is429 ? parseQuotaExhaustion(error63.body, nowMs) : void 0;
|
|
142020
|
+
if (learned !== void 0) {
|
|
142021
|
+
exhaustedModels.set(learned.model, learned.resetAtMs);
|
|
142022
|
+
const next = routeRequest();
|
|
142023
|
+
if (!tried.has(next.model)) {
|
|
142024
|
+
translated = next;
|
|
142025
|
+
continue;
|
|
142026
|
+
}
|
|
142027
|
+
}
|
|
142028
|
+
const quota = liveQuota(nowMs);
|
|
142029
|
+
const quotaHeaders3 = unifiedAntigravityQuotaHeaders({ quota, rejected: is429, nowMs, model: translated.model });
|
|
142030
|
+
const retryAfter = is429 && quotaHeaders3["retry-after"] === void 0 ? parseRetryAfterSeconds(error63.retryAfter) : void 0;
|
|
142031
|
+
const exhaustion = is429 ? antigravityQuotaExhaustion(quota, translated.model, nowMs) : void 0;
|
|
142032
|
+
const errorType = is429 ? "rate_limit_error" : "api_error";
|
|
142033
|
+
return {
|
|
142034
|
+
status: error63.status,
|
|
142035
|
+
headers: {
|
|
142036
|
+
"Content-Type": "application/json",
|
|
142037
|
+
...quotaHeaders3,
|
|
142038
|
+
...retryAfter !== void 0 ? { "retry-after": String(retryAfter) } : {}
|
|
142039
|
+
},
|
|
142040
|
+
body: JSON.stringify({ type: "error", error: { type: errorType, message: exhaustion === void 0 ? error63.message : exhaustedMessage(exhaustion) } })
|
|
142041
|
+
};
|
|
142042
|
+
}
|
|
142043
|
+
const errMsg = error63 instanceof Error ? error63.message : String(error63);
|
|
141948
142044
|
return {
|
|
141949
|
-
status:
|
|
141950
|
-
headers: {
|
|
141951
|
-
|
|
141952
|
-
...quotaHeaders3,
|
|
141953
|
-
...retryAfter !== void 0 ? { "retry-after": String(retryAfter) } : {}
|
|
141954
|
-
},
|
|
141955
|
-
body: JSON.stringify({ type: "error", error: { type: errorType, message: exhaustion === void 0 ? error63.message : exhaustedMessage(exhaustion) } })
|
|
142045
|
+
status: HTTP_STATUS.badGateway,
|
|
142046
|
+
headers: { "Content-Type": "application/json" },
|
|
142047
|
+
body: JSON.stringify({ type: "error", error: { type: "api_error", message: errMsg } })
|
|
141956
142048
|
};
|
|
141957
142049
|
}
|
|
141958
|
-
const errMsg = error63 instanceof Error ? error63.message : String(error63);
|
|
141959
|
-
return {
|
|
141960
|
-
status: HTTP_STATUS.badGateway,
|
|
141961
|
-
headers: { "Content-Type": "application/json" },
|
|
141962
|
-
body: JSON.stringify({ type: "error", error: { type: "api_error", message: errMsg } })
|
|
141963
|
-
};
|
|
141964
142050
|
}
|
|
142051
|
+
const relay = createAntigravityRelay({
|
|
142052
|
+
// The frame carries the model that actually served the request, as the real API echoes the concrete model behind an alias: a usage record read from the response then attributes quota to the backend model, not the tier alias the session typed.
|
|
142053
|
+
servedModel: translated.model,
|
|
142054
|
+
toolNames: translated.toolNames,
|
|
142055
|
+
fallbackId
|
|
142056
|
+
});
|
|
141965
142057
|
const quotaHeaders2 = unifiedAntigravityQuotaHeaders({
|
|
141966
|
-
quota:
|
|
142058
|
+
quota: liveQuota(nowMs),
|
|
141967
142059
|
rejected: false,
|
|
141968
142060
|
nowMs,
|
|
141969
142061
|
model: translated.model
|
|
@@ -142427,6 +142519,7 @@ function createProviderRouteResolver(deps) {
|
|
|
142427
142519
|
const resolveCredential2 = shareInFlightResolutions(resolveCredentialAsync);
|
|
142428
142520
|
const antigravityQuotaSources = /* @__PURE__ */ new Map();
|
|
142429
142521
|
const antigravityRoutingMemory = /* @__PURE__ */ new Map();
|
|
142522
|
+
const antigravityExhaustedModels = /* @__PURE__ */ new Map();
|
|
142430
142523
|
const definesProvider = (name) => {
|
|
142431
142524
|
try {
|
|
142432
142525
|
return loadProvider(deps.providersDir, name, deps.fs) !== void 0;
|
|
@@ -142445,6 +142538,15 @@ function createProviderRouteResolver(deps) {
|
|
|
142445
142538
|
antigravityRoutingMemory.set(provider, created);
|
|
142446
142539
|
return created;
|
|
142447
142540
|
};
|
|
142541
|
+
const exhaustedModelsFor = (provider) => {
|
|
142542
|
+
const existing = antigravityExhaustedModels.get(provider);
|
|
142543
|
+
if (existing !== void 0) {
|
|
142544
|
+
return existing;
|
|
142545
|
+
}
|
|
142546
|
+
const created = /* @__PURE__ */ new Map();
|
|
142547
|
+
antigravityExhaustedModels.set(provider, created);
|
|
142548
|
+
return created;
|
|
142549
|
+
};
|
|
142448
142550
|
const antigravityQuotaOf = (provider, definition, config2) => {
|
|
142449
142551
|
const existing = antigravityQuotaSources.get(provider);
|
|
142450
142552
|
if (existing !== void 0) {
|
|
@@ -142540,7 +142642,8 @@ function createProviderRouteResolver(deps) {
|
|
|
142540
142642
|
};
|
|
142541
142643
|
},
|
|
142542
142644
|
quotaSource: antigravityQuotaOf(provider, antigravityProvider, config2),
|
|
142543
|
-
lastRouted: memoryFor(provider)
|
|
142645
|
+
lastRouted: memoryFor(provider),
|
|
142646
|
+
exhaustedModels: exhaustedModelsFor(provider)
|
|
142544
142647
|
},
|
|
142545
142648
|
directOrigin2(deps.directPort()),
|
|
142546
142649
|
provider
|
|
@@ -146837,20 +146940,21 @@ function windowsOf(states, nowMs) {
|
|
|
146837
146940
|
let fiveHourResetAt;
|
|
146838
146941
|
let sevenDayUsed;
|
|
146839
146942
|
let sevenDayResetAt;
|
|
146943
|
+
let bindingUsed;
|
|
146840
146944
|
for (const state of states) {
|
|
146841
146945
|
const unified = state.rateLimit?.unified;
|
|
146842
146946
|
if (unified === void 0) {
|
|
146843
146947
|
continue;
|
|
146844
146948
|
}
|
|
146845
146949
|
const five = livePercentOf(unified.fiveHour, nowMs);
|
|
146846
|
-
if (five !== void 0 && (fiveHourUsed === void 0 || five > fiveHourUsed)) {
|
|
146847
|
-
fiveHourUsed = five;
|
|
146848
|
-
fiveHourResetAt = unified.fiveHour?.resetsAt;
|
|
146849
|
-
}
|
|
146850
146950
|
const seven = livePercentOf(unified.sevenDay, nowMs);
|
|
146851
|
-
|
|
146951
|
+
const max = five === void 0 ? seven : seven === void 0 ? five : Math.max(five, seven);
|
|
146952
|
+
if (max !== void 0 && (bindingUsed === void 0 || max > bindingUsed)) {
|
|
146953
|
+
bindingUsed = max;
|
|
146954
|
+
fiveHourUsed = five;
|
|
146955
|
+
fiveHourResetAt = five === void 0 ? void 0 : unified.fiveHour?.resetsAt;
|
|
146852
146956
|
sevenDayUsed = seven;
|
|
146853
|
-
sevenDayResetAt = unified.sevenDay?.resetsAt;
|
|
146957
|
+
sevenDayResetAt = seven === void 0 ? void 0 : unified.sevenDay?.resetsAt;
|
|
146854
146958
|
}
|
|
146855
146959
|
}
|
|
146856
146960
|
return { fiveHourUsed, fiveHourResetAt, sevenDayUsed, sevenDayResetAt };
|
|
@@ -146896,8 +147000,9 @@ function antigravityQuotaMapOf(payload) {
|
|
|
146896
147000
|
);
|
|
146897
147001
|
}
|
|
146898
147002
|
function bucketView(bucket, nowMs) {
|
|
147003
|
+
const expired = bucket?.reset_in_seconds !== void 0 && Number.isFinite(bucket.reset_in_seconds) && bucket.reset_in_seconds <= 0;
|
|
146899
147004
|
return {
|
|
146900
|
-
used: bucket?.remaining_fraction === void 0 || !Number.isFinite(bucket.remaining_fraction) ? void 0 : (1 - Math.min(1, Math.max(0, bucket.remaining_fraction))) * FULL_PERCENT2,
|
|
147005
|
+
used: bucket?.remaining_fraction === void 0 || !Number.isFinite(bucket.remaining_fraction) ? void 0 : expired ? 0 : (1 - Math.min(1, Math.max(0, bucket.remaining_fraction))) * FULL_PERCENT2,
|
|
146901
147006
|
resetAt: bucket?.reset_in_seconds === void 0 || !Number.isFinite(bucket.reset_in_seconds) ? void 0 : isoOf(nowMs + bucket.reset_in_seconds * MS_PER_SECOND18)
|
|
146902
147007
|
};
|
|
146903
147008
|
}
|
|
@@ -146947,10 +147052,12 @@ function enrichStatuslinePayload(params) {
|
|
|
146947
147052
|
...params.modelChoice === void 0 ? {} : { modelChoice: params.modelChoice },
|
|
146948
147053
|
...params.doorCostUsd === void 0 ? {} : { doorCostUsd: params.doorCostUsd }
|
|
146949
147054
|
};
|
|
147055
|
+
let scopedName;
|
|
146950
147056
|
if (params.snapshot !== void 0) {
|
|
146951
|
-
const
|
|
147057
|
+
const routedProvider = routedProviderOf(params);
|
|
147058
|
+
scopedName = providerScopedState(params.snapshot, params.providerName, params.env.AGENT_SHIM_PROVIDER) ?? providerScopedState(params.snapshot, routedProvider, routedProvider);
|
|
146952
147059
|
const scopedState = scopedName === void 0 ? void 0 : params.snapshot.providers[scopedName];
|
|
146953
|
-
const states = summary.provider === void 0 ? Object.values(params.snapshot.providers) : scopedState === void 0 ? [] : [scopedState];
|
|
147060
|
+
const states = summary.provider === void 0 && scopedState === void 0 ? Object.values(params.snapshot.providers) : scopedState === void 0 ? [] : [scopedState];
|
|
146954
147061
|
let email3;
|
|
146955
147062
|
let sub;
|
|
146956
147063
|
let plan;
|
|
@@ -146981,7 +147088,7 @@ function enrichStatuslinePayload(params) {
|
|
|
146981
147088
|
);
|
|
146982
147089
|
summary = { ...summary, ...windowsOf(states, params.nowMs), providerAccountEmail: email3, providerAccountSub: sub, providerPlan: plan, providerQuotaWindows, quotaFamilies: quotaFamiliesOf(providerBuckets, params.nowMs) };
|
|
146983
147090
|
}
|
|
146984
|
-
if (summary.provider === void 0) {
|
|
147091
|
+
if (summary.provider === void 0 && scopedName === void 0) {
|
|
146985
147092
|
const agyBuckets = antigravityQuotaMapOf(params.payload);
|
|
146986
147093
|
if (agyBuckets !== void 0) {
|
|
146987
147094
|
summary = { ...summary, quotaFamilies: quotaFamiliesOf(agyBuckets, params.nowMs) };
|
|
@@ -147003,6 +147110,29 @@ function enrichStatuslinePayload(params) {
|
|
|
147003
147110
|
}
|
|
147004
147111
|
return { payload: enriched, summary };
|
|
147005
147112
|
}
|
|
147113
|
+
function routedProviderOf(params) {
|
|
147114
|
+
if (params.modelChoice?.provider !== void 0 && params.modelChoice.provider !== "") {
|
|
147115
|
+
return params.modelChoice.provider;
|
|
147116
|
+
}
|
|
147117
|
+
const targetPrefix = prefixBeforeSlash(params.routedTarget);
|
|
147118
|
+
if (targetPrefix !== void 0) {
|
|
147119
|
+
return targetPrefix;
|
|
147120
|
+
}
|
|
147121
|
+
const model = isObject4(params.payload) && isObject4(params.payload.model) ? params.payload.model : void 0;
|
|
147122
|
+
return prefixBeforeSlash(typeof model?.id === "string" ? model.id : void 0) ?? prefixBeforeSlash(typeof model?.display_name === "string" ? model.display_name : void 0);
|
|
147123
|
+
}
|
|
147124
|
+
function prefixBeforeSlash(value3) {
|
|
147125
|
+
if (value3 === void 0) {
|
|
147126
|
+
return void 0;
|
|
147127
|
+
}
|
|
147128
|
+
const slash = value3.indexOf("/");
|
|
147129
|
+
if (slash <= 0) {
|
|
147130
|
+
return void 0;
|
|
147131
|
+
}
|
|
147132
|
+
const prefix = value3.slice(0, slash).trim();
|
|
147133
|
+
const rest = value3.slice(slash + 1).trim();
|
|
147134
|
+
return prefix === "" || rest === "" ? void 0 : prefix;
|
|
147135
|
+
}
|
|
147006
147136
|
function providerScopedState(snapshot, providerName, providerDisplayName) {
|
|
147007
147137
|
if (providerName !== void 0 && providerName in snapshot.providers) {
|
|
147008
147138
|
return providerName;
|
package/dist/index.cjs
CHANGED
|
@@ -4853,7 +4853,7 @@ var init_package = __esm({
|
|
|
4853
4853
|
"package.json"() {
|
|
4854
4854
|
package_default = {
|
|
4855
4855
|
name: "agent-shim",
|
|
4856
|
-
version: "11.83.
|
|
4856
|
+
version: "11.83.6",
|
|
4857
4857
|
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.",
|
|
4858
4858
|
license: "MIT",
|
|
4859
4859
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
package/dist/index.mjs
CHANGED
|
@@ -4829,7 +4829,7 @@ var init_package = __esm({
|
|
|
4829
4829
|
"package.json"() {
|
|
4830
4830
|
package_default = {
|
|
4831
4831
|
name: "agent-shim",
|
|
4832
|
-
version: "11.83.
|
|
4832
|
+
version: "11.83.6",
|
|
4833
4833
|
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.",
|
|
4834
4834
|
license: "MIT",
|
|
4835
4835
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-shim",
|
|
3
|
-
"version": "11.83.
|
|
3
|
+
"version": "11.83.6",
|
|
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>",
|