claude-use 11.43.1 → 11.44.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 +50 -18
- package/dist/index.cjs +5 -1
- package/dist/index.mjs +5 -1
- package/dist/types/index.d.ts +465 -454
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -34071,6 +34071,10 @@ var init_schema2 = __esm({
|
|
|
34071
34071
|
endpoint: external_exports.string(),
|
|
34072
34072
|
/** The model the response named. */
|
|
34073
34073
|
model: external_exports.string().optional(),
|
|
34074
|
+
/** The model name the session asked for, when a routing layer chose among alternatives for it (a virtual model's or a tier alias's selection) and served the request under a different name. Absent when the session's own name reached the provider unchanged. */
|
|
34075
|
+
requestedModel: external_exports.string().optional(),
|
|
34076
|
+
/** The distinct providers the choice could have landed on, present only when there was more than one, so a reader can tell a choice that crossed providers from one that stayed inside a single provider's lineup. */
|
|
34077
|
+
candidateProviders: external_exports.array(external_exports.string()).optional(),
|
|
34074
34078
|
status: external_exports.number().int(),
|
|
34075
34079
|
/** Milliseconds from the request's arrival to its response head. */
|
|
34076
34080
|
latencyMs: external_exports.number().int().nonnegative(),
|
|
@@ -34697,7 +34701,7 @@ var init_package = __esm({
|
|
|
34697
34701
|
"package.json"() {
|
|
34698
34702
|
package_default = {
|
|
34699
34703
|
name: "claude-use",
|
|
34700
|
-
version: "11.
|
|
34704
|
+
version: "11.44.0",
|
|
34701
34705
|
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.",
|
|
34702
34706
|
license: "MIT",
|
|
34703
34707
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -35330,6 +35334,8 @@ function buildRecord(event, context) {
|
|
|
35330
35334
|
method: event.method,
|
|
35331
35335
|
endpoint,
|
|
35332
35336
|
...scan?.model === void 0 ? {} : { model: scan.model },
|
|
35337
|
+
...event.modelChoice === void 0 ? {} : { requestedModel: event.modelChoice.requested },
|
|
35338
|
+
...event.modelChoice !== void 0 && event.modelChoice.providers.length > 1 ? { candidateProviders: [...event.modelChoice.providers] } : {},
|
|
35333
35339
|
status: event.status,
|
|
35334
35340
|
latencyMs: Math.max(0, Math.round(context.headAt - event.receivedAt)),
|
|
35335
35341
|
durationMs: Math.max(0, Math.round(context.endedAt - event.receivedAt)),
|
|
@@ -130411,7 +130417,7 @@ function createRoutedResponse(response, context) {
|
|
|
130411
130417
|
start: (status, headers) => {
|
|
130412
130418
|
for (const observe of deps.responseObservers) {
|
|
130413
130419
|
try {
|
|
130414
|
-
const body = observe({ session, route, method: request7.method, path: request7.path, servedPath: context.servedPath, receivedAt: request7.receivedAt, viaHeadroom: request7.viaHeadroom, lineage: request7.thread.lineage, status, headers });
|
|
130420
|
+
const body = observe({ session, route, method: request7.method, path: request7.path, servedPath: context.servedPath, receivedAt: request7.receivedAt, viaHeadroom: request7.viaHeadroom, lineage: request7.thread.lineage, modelChoice: request7.modelChoice.value, status, headers });
|
|
130415
130421
|
if (body !== void 0) {
|
|
130416
130422
|
bodyObservers.push(body);
|
|
130417
130423
|
}
|
|
@@ -130422,6 +130428,9 @@ function createRoutedResponse(response, context) {
|
|
|
130422
130428
|
response.writeHead(status, headers);
|
|
130423
130429
|
headersSent = true;
|
|
130424
130430
|
},
|
|
130431
|
+
noteModelChoice: (choice) => {
|
|
130432
|
+
request7.modelChoice.value = choice;
|
|
130433
|
+
},
|
|
130425
130434
|
flush: () => {
|
|
130426
130435
|
response.flushHeaders();
|
|
130427
130436
|
},
|
|
@@ -130452,7 +130461,7 @@ function createRoutedResponse(response, context) {
|
|
|
130452
130461
|
};
|
|
130453
130462
|
}
|
|
130454
130463
|
async function serveRouted(request7, deps) {
|
|
130455
|
-
const observed = { method: request7.method, path: pathOf(request7.url), receivedAt: deps.now(), viaHeadroom: false, thread: { lineage: void 0 } };
|
|
130464
|
+
const observed = { method: request7.method, path: pathOf(request7.url), receivedAt: deps.now(), viaHeadroom: false, thread: { lineage: void 0 }, modelChoice: { value: void 0 } };
|
|
130456
130465
|
const identified = identifyRequest(request7.headers);
|
|
130457
130466
|
const admission = deps.admit({ url: request7.url, headers: request7.headers, forwardable: identified.forwardableHeaders });
|
|
130458
130467
|
if (!admission.ok) {
|
|
@@ -130479,6 +130488,9 @@ async function serveRouted(request7, deps) {
|
|
|
130479
130488
|
return;
|
|
130480
130489
|
}
|
|
130481
130490
|
const { headroom } = deps;
|
|
130491
|
+
if (resolution.modelChoice !== void 0) {
|
|
130492
|
+
observed.modelChoice.value = resolution.modelChoice;
|
|
130493
|
+
}
|
|
130482
130494
|
const wantsHeadroom = headroom !== void 0 && await deps.headroomDecision.decide(identified.session.sessionId, identified.session.headroom, deps.now(), async () => await headroomReady(headroom, request7.signal));
|
|
130483
130495
|
const viaHeadroom = wantsHeadroom && resolution.route.headroomEligible && deps.headroom !== void 0;
|
|
130484
130496
|
const response = createRoutedResponse(request7.response, { deps, session: identified.session, route: resolution.route.name, request: { ...observed, viaHeadroom }, servedPath: pathOf(resolution.request?.url ?? request7.url) });
|
|
@@ -131142,7 +131154,7 @@ function createAntigravityRelay(params) {
|
|
|
131142
131154
|
id: messageId,
|
|
131143
131155
|
type: "message",
|
|
131144
131156
|
role: "assistant",
|
|
131145
|
-
model: params.
|
|
131157
|
+
model: params.servedModel,
|
|
131146
131158
|
content: [],
|
|
131147
131159
|
stop_reason: null,
|
|
131148
131160
|
stop_sequence: null,
|
|
@@ -131545,7 +131557,8 @@ function createAntigravityRoute(ports) {
|
|
|
131545
131557
|
}
|
|
131546
131558
|
}
|
|
131547
131559
|
const relay = createAntigravityRelay({
|
|
131548
|
-
|
|
131560
|
+
// 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.
|
|
131561
|
+
servedModel: translated.model,
|
|
131549
131562
|
toolNames: translated.toolNames,
|
|
131550
131563
|
fallbackId
|
|
131551
131564
|
});
|
|
@@ -131649,7 +131662,9 @@ function createAntigravityRoute(ports) {
|
|
|
131649
131662
|
Connection: "keep-alive",
|
|
131650
131663
|
...quotaHeaders2
|
|
131651
131664
|
},
|
|
131652
|
-
body: stream()
|
|
131665
|
+
body: stream(),
|
|
131666
|
+
// The tier alias the session asked for, whenever the translation resolved it to a different model: the front door's mount turns it into the model choice the usage record keeps.
|
|
131667
|
+
...requestedModel !== translated.model ? { requestedModel } : {}
|
|
131653
131668
|
};
|
|
131654
131669
|
};
|
|
131655
131670
|
}
|
|
@@ -131718,6 +131733,9 @@ function createAntigravityRouteMount(ports, upstreamBase, provider) {
|
|
|
131718
131733
|
if (request7.signal.aborted) {
|
|
131719
131734
|
return;
|
|
131720
131735
|
}
|
|
131736
|
+
if (routed.requestedModel !== void 0) {
|
|
131737
|
+
response.noteModelChoice?.({ requested: routed.requestedModel, providers: [provider] });
|
|
131738
|
+
}
|
|
131721
131739
|
await writeRouteResponse2(routed, response, request7.signal);
|
|
131722
131740
|
}
|
|
131723
131741
|
};
|
|
@@ -131982,7 +132000,8 @@ function resolveRoutedModel(model, providerName, session, deps, memory, rotation
|
|
|
131982
132000
|
}
|
|
131983
132001
|
const [provider, ...rest] = selection.ref.split("/");
|
|
131984
132002
|
const chosen = rest.join("/");
|
|
131985
|
-
|
|
132003
|
+
const providers = [...new Set(members2.map((ref) => ref.split("/")[0] ?? ""))].filter((name) => name !== "");
|
|
132004
|
+
return provider === void 0 || chosen === "" ? void 0 : { provider, model: withoutContextMarker(chosen), ref: selection.ref, requested: model, providers };
|
|
131986
132005
|
}
|
|
131987
132006
|
function resolveAccountTarget(model, models) {
|
|
131988
132007
|
if (model.startsWith("acct:")) {
|
|
@@ -132140,6 +132159,7 @@ function createProviderRouteResolver(deps) {
|
|
|
132140
132159
|
let current = scopedRequest;
|
|
132141
132160
|
let replay;
|
|
132142
132161
|
let nameResolved = false;
|
|
132162
|
+
let modelChoice;
|
|
132143
132163
|
const visited = /* @__PURE__ */ new Set();
|
|
132144
132164
|
for (; ; ) {
|
|
132145
132165
|
const path65 = new URL(current.url, "http://127.0.0.1").pathname;
|
|
@@ -132183,9 +132203,12 @@ function createProviderRouteResolver(deps) {
|
|
|
132183
132203
|
const requested = scan2.model;
|
|
132184
132204
|
if (routed !== void 0) {
|
|
132185
132205
|
routingMemory.set(current.session.sessionId ?? "", routed.ref);
|
|
132206
|
+
if (routed.requested !== void 0) {
|
|
132207
|
+
modelChoice = { requested: routed.requested, providers: routed.providers ?? [routed.provider] };
|
|
132208
|
+
}
|
|
132186
132209
|
if (requested !== void 0 && routed.provider === providerName && routed.model === requested) {
|
|
132187
132210
|
const resolution2 = resolve2(current);
|
|
132188
|
-
return resolution2.ok ? { ok: true, route: servingRewritten(resolution2.route, { ...replay, url: current.url }), request: { ...replay, url: current.url } } : resolution2;
|
|
132211
|
+
return resolution2.ok ? { ok: true, route: servingRewritten(resolution2.route, { ...replay, url: current.url }), request: { ...replay, url: current.url }, ...modelChoice === void 0 ? {} : { modelChoice } } : resolution2;
|
|
132189
132212
|
}
|
|
132190
132213
|
if (requested !== void 0 && routed.model !== requested) {
|
|
132191
132214
|
const rewritten = (scan2.text ?? "").replace(new RegExp('"model":\\s*"' + requested.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") + '"'), '"model":"' + routed.model + '"');
|
|
@@ -132202,12 +132225,12 @@ function createProviderRouteResolver(deps) {
|
|
|
132202
132225
|
continue;
|
|
132203
132226
|
}
|
|
132204
132227
|
const resolution = resolve2(current);
|
|
132205
|
-
return resolution.ok ? { ok: true, route: servingRewritten(resolution.route, { ...replay, url: current.url }), request: { ...replay, url: current.url } } : resolution;
|
|
132228
|
+
return resolution.ok ? { ok: true, route: servingRewritten(resolution.route, { ...replay, url: current.url }), request: { ...replay, url: current.url }, ...modelChoice === void 0 ? {} : { modelChoice } } : resolution;
|
|
132206
132229
|
}
|
|
132207
132230
|
}
|
|
132208
132231
|
if (routes === void 0 || routes.length === 0) {
|
|
132209
132232
|
const resolution = resolve2(current);
|
|
132210
|
-
return resolution.ok && replay !== void 0 ? { ok: true, route: servingRewritten(resolution.route, { ...replay, url: current.url }), request: { ...replay, url: current.url } } : resolution.ok ? serveScoped(resolution) : resolution;
|
|
132233
|
+
return resolution.ok && replay !== void 0 ? { ok: true, route: servingRewritten(resolution.route, { ...replay, url: current.url }), request: { ...replay, url: current.url }, ...modelChoice === void 0 ? {} : { modelChoice } } : resolution.ok ? serveScoped(resolution) : resolution;
|
|
132211
132234
|
}
|
|
132212
132235
|
const whole = routes.some((entry) => entry.model !== void 0 || referencesFact(entry.when, "request.hasImage"));
|
|
132213
132236
|
const snapshot = deps.usageSnapshotOf?.(current.session.identity);
|
|
@@ -132241,7 +132264,7 @@ function createProviderRouteResolver(deps) {
|
|
|
132241
132264
|
}
|
|
132242
132265
|
if (matched === void 0) {
|
|
132243
132266
|
const resolution = resolve2(current);
|
|
132244
|
-
return resolution.ok ? { ok: true, route: servingRewritten(resolution.route, { ...replay, url: current.url }), request: { ...replay, url: current.url } } : resolution;
|
|
132267
|
+
return resolution.ok ? { ok: true, route: servingRewritten(resolution.route, { ...replay, url: current.url }), request: { ...replay, url: current.url }, ...modelChoice === void 0 ? {} : { modelChoice } } : resolution;
|
|
132245
132268
|
}
|
|
132246
132269
|
if (matched.model !== void 0 && scan.text !== void 0 && scan.model !== void 0) {
|
|
132247
132270
|
const rewritten = scan.text.replace(new RegExp('"model":\\s*"' + scan.model.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") + '"'), '"model":"' + matched.model + '"');
|
|
@@ -136023,7 +136046,8 @@ function enrichStatuslinePayload(params) {
|
|
|
136023
136046
|
providerQuotaWindows: [],
|
|
136024
136047
|
quotaFamilies: [],
|
|
136025
136048
|
headroom: params.headroom,
|
|
136026
|
-
routedTarget: params.routedTarget
|
|
136049
|
+
routedTarget: params.routedTarget,
|
|
136050
|
+
...params.modelChoice === void 0 ? {} : { modelChoice: params.modelChoice }
|
|
136027
136051
|
};
|
|
136028
136052
|
if (params.snapshot !== void 0) {
|
|
136029
136053
|
const scopedName = providerScopedState(params.snapshot, params.providerName, params.env.AGENT_SHIM_PROVIDER);
|
|
@@ -136384,14 +136408,16 @@ function layoutHeader(texts, maxWidth, separator) {
|
|
|
136384
136408
|
}
|
|
136385
136409
|
function renderStatuslineBlock(summary, view, terminalWidth, nowMs) {
|
|
136386
136410
|
const header = [];
|
|
136387
|
-
|
|
136388
|
-
|
|
136411
|
+
const choiceNamesProvider = summary.modelChoice !== void 0 && (summary.modelChoice.providers.length > 1 || summary.routedTarget !== void 0);
|
|
136412
|
+
const modelSegment = summary.modelChoice !== void 0 && view.modelDisplayName !== void 0 && view.modelDisplayName !== "" ? `${view.modelDisplayName} -> ${choiceNamesProvider ? `${summary.modelChoice.provider}/${summary.modelChoice.served}` : summary.modelChoice.served}` : view.modelDisplayName;
|
|
136413
|
+
if (modelSegment !== void 0 && modelSegment !== "") {
|
|
136414
|
+
header.push(modelSegment);
|
|
136389
136415
|
}
|
|
136390
136416
|
if (summary.provider !== void 0) {
|
|
136391
136417
|
const account = [summary.providerAccountEmail, summary.providerPlan].filter((part) => part !== void 0);
|
|
136392
136418
|
header.push(account.length > 0 ? `${summary.provider} \xB7 ${account.join(" \xB7 ")}` : summary.provider);
|
|
136393
136419
|
}
|
|
136394
|
-
if (summary.routedTarget !== void 0) {
|
|
136420
|
+
if (summary.routedTarget !== void 0 && !choiceNamesProvider) {
|
|
136395
136421
|
header.push(`via ${summary.routedTarget}`);
|
|
136396
136422
|
}
|
|
136397
136423
|
const loginPlan = summary.provider === void 0 ? summary.loginPlan ?? accountPlanLabel(summary) : void 0;
|
|
@@ -136546,17 +136572,23 @@ function registerStatuslineCommand(program2, deps) {
|
|
|
136546
136572
|
const headroom = target === void 0 || sessionId === void 0 ? void 0 : await fetchHeadroomSessionStats(realHeadroomGet, target, sessionId);
|
|
136547
136573
|
const sessionHeader = /x-agent-shim-session:\s*([A-Za-z0-9@._-]+)/i.exec(process.env.ANTHROPIC_CUSTOM_HEADERS ?? "")?.[1];
|
|
136548
136574
|
let routedTarget;
|
|
136575
|
+
let modelChoice;
|
|
136549
136576
|
if (sessionHeader !== void 0) {
|
|
136550
136577
|
try {
|
|
136551
136578
|
const last = readUsageLog(realFarmFs, deps.paths.usageLogDir, { sinceMs: nowMs - ROUTED_TARGET_LOOKBACK_MS }).records.filter((record2) => record2.sessionId === sessionHeader).at(-1);
|
|
136552
|
-
if (last?.model !== void 0
|
|
136553
|
-
|
|
136579
|
+
if (last?.model !== void 0) {
|
|
136580
|
+
if (last.provider !== providerName) {
|
|
136581
|
+
routedTarget = `${last.provider}/${last.model}`;
|
|
136582
|
+
}
|
|
136583
|
+
if (last.requestedModel !== void 0 && last.requestedModel !== last.model) {
|
|
136584
|
+
modelChoice = { requested: last.requestedModel, served: last.model, provider: last.provider, providers: last.candidateProviders ?? [] };
|
|
136585
|
+
}
|
|
136554
136586
|
}
|
|
136555
136587
|
} catch {
|
|
136556
136588
|
routedTarget = void 0;
|
|
136557
136589
|
}
|
|
136558
136590
|
}
|
|
136559
|
-
const { payload: enriched, summary } = enrichStatuslinePayload({ payload, env: process.env, snapshot, account, providerName, nowMs, headroom, routedTarget });
|
|
136591
|
+
const { payload: enriched, summary } = enrichStatuslinePayload({ payload, env: process.env, snapshot, account, providerName, nowMs, headroom, routedTarget, ...modelChoice === void 0 ? {} : { modelChoice } });
|
|
136560
136592
|
const renderer = process.env.AGENT_SHIM_STATUSLINE_CMD;
|
|
136561
136593
|
if (renderer !== void 0 && renderer !== "") {
|
|
136562
136594
|
const child = (0, import_node_child_process7.spawn)("/bin/sh", ["-c", renderer], { stdio: ["pipe", "inherit", "inherit"] });
|
package/dist/index.cjs
CHANGED
|
@@ -3151,7 +3151,7 @@ var init_package = __esm({
|
|
|
3151
3151
|
"package.json"() {
|
|
3152
3152
|
package_default = {
|
|
3153
3153
|
name: "claude-use",
|
|
3154
|
-
version: "11.
|
|
3154
|
+
version: "11.44.0",
|
|
3155
3155
|
description: "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
|
|
3156
3156
|
license: "MIT",
|
|
3157
3157
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -5132,6 +5132,10 @@ var init_schema2 = __esm({
|
|
|
5132
5132
|
endpoint: import_zod10.z.string(),
|
|
5133
5133
|
/** The model the response named. */
|
|
5134
5134
|
model: import_zod10.z.string().optional(),
|
|
5135
|
+
/** The model name the session asked for, when a routing layer chose among alternatives for it (a virtual model's or a tier alias's selection) and served the request under a different name. Absent when the session's own name reached the provider unchanged. */
|
|
5136
|
+
requestedModel: import_zod10.z.string().optional(),
|
|
5137
|
+
/** The distinct providers the choice could have landed on, present only when there was more than one, so a reader can tell a choice that crossed providers from one that stayed inside a single provider's lineup. */
|
|
5138
|
+
candidateProviders: import_zod10.z.array(import_zod10.z.string()).optional(),
|
|
5135
5139
|
status: import_zod10.z.number().int(),
|
|
5136
5140
|
/** Milliseconds from the request's arrival to its response head. */
|
|
5137
5141
|
latencyMs: import_zod10.z.number().int().nonnegative(),
|
package/dist/index.mjs
CHANGED
|
@@ -3127,7 +3127,7 @@ var init_package = __esm({
|
|
|
3127
3127
|
"package.json"() {
|
|
3128
3128
|
package_default = {
|
|
3129
3129
|
name: "claude-use",
|
|
3130
|
-
version: "11.
|
|
3130
|
+
version: "11.44.0",
|
|
3131
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.",
|
|
3132
3132
|
license: "MIT",
|
|
3133
3133
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -5106,6 +5106,10 @@ var init_schema2 = __esm({
|
|
|
5106
5106
|
endpoint: z10.string(),
|
|
5107
5107
|
/** The model the response named. */
|
|
5108
5108
|
model: z10.string().optional(),
|
|
5109
|
+
/** The model name the session asked for, when a routing layer chose among alternatives for it (a virtual model's or a tier alias's selection) and served the request under a different name. Absent when the session's own name reached the provider unchanged. */
|
|
5110
|
+
requestedModel: z10.string().optional(),
|
|
5111
|
+
/** The distinct providers the choice could have landed on, present only when there was more than one, so a reader can tell a choice that crossed providers from one that stayed inside a single provider's lineup. */
|
|
5112
|
+
candidateProviders: z10.array(z10.string()).optional(),
|
|
5109
5113
|
status: z10.number().int(),
|
|
5110
5114
|
/** Milliseconds from the request's arrival to its response head. */
|
|
5111
5115
|
latencyMs: z10.number().int().nonnegative(),
|