claude-use 11.43.1 → 11.44.1
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 +70 -34
- 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.1",
|
|
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 + '"');
|
|
@@ -135009,13 +135032,12 @@ function createRcStreamHub(deps) {
|
|
|
135009
135032
|
|
|
135010
135033
|
// src/frontdoor/watchdog.ts
|
|
135011
135034
|
var import_node_worker_threads2 = require("node:worker_threads");
|
|
135012
|
-
init_schema();
|
|
135013
135035
|
init_ensure2();
|
|
135014
135036
|
init_probe();
|
|
135015
135037
|
var DOOR_STALL_BOUND_MS = 2 * FRONTDOOR_PROBE_ATTEMPTS * PROBE_TIMEOUT_MS;
|
|
135016
|
-
var MS_PER_MINUTE4 = 6e4;
|
|
135017
|
-
var DOOR_RESPAWN_MIN_SERVING_MS = FRONTDOOR_DEFAULT_IDLE_SHUTDOWN_MINUTES * MS_PER_MINUTE4;
|
|
135018
135038
|
var DOOR_AWAIT_PID_ENV = "AGENT_SHIM_FRONTDOOR_AWAIT_PID";
|
|
135039
|
+
var DOOR_RESPAWN_GENERATION_ENV = "AGENT_SHIM_FRONTDOOR_RESPAWN_GENERATION";
|
|
135040
|
+
var DOOR_RESPAWN_MAX_GENERATIONS = 3;
|
|
135019
135041
|
var CHECKS_PER_PROBE_DEADLINE = 2;
|
|
135020
135042
|
var DOOR_WATCHDOG_CHECK_MS = PROBE_TIMEOUT_MS / CHECKS_PER_PROBE_DEADLINE;
|
|
135021
135043
|
var WATCHDOG_SOURCE = `
|
|
@@ -135023,8 +135045,7 @@ const { workerData, parentPort } = require("node:worker_threads");
|
|
|
135023
135045
|
const fs = require("node:fs");
|
|
135024
135046
|
const os = require("node:os");
|
|
135025
135047
|
const inspector = require("node:inspector");
|
|
135026
|
-
const { shared, boundMs, checkEveryMs, pauseWaitMs, stateFile, ownPid, action, logFile, respawn,
|
|
135027
|
-
const startedAt = Date.now();
|
|
135048
|
+
const { shared, boundMs, checkEveryMs, pauseWaitMs, stateFile, ownPid, action, logFile, respawn, respawnGeneration, respawnMaxGeneration, awaitPidEnv, respawnGenerationEnv } = workerData;
|
|
135028
135049
|
const counter = new Int32Array(shared);
|
|
135029
135050
|
let lastValue = Atomics.load(counter, 0);
|
|
135030
135051
|
let lastChangeAt = Date.now();
|
|
@@ -135090,17 +135111,16 @@ const describeMainThread = (waitMs, resume) => new Promise((resolve) => {
|
|
|
135090
135111
|
});
|
|
135091
135112
|
const spawnReplacement = () => {
|
|
135092
135113
|
if (respawn === undefined || logFile === undefined) return;
|
|
135093
|
-
|
|
135094
|
-
|
|
135095
|
-
log("the door served for " + String(servedMs) + "ms before stalling, less than the " + String(respawnAfterServingMs) + "ms it must have served to be replaced; leaving the next launch to start one");
|
|
135114
|
+
if (respawnGeneration >= respawnMaxGeneration) {
|
|
135115
|
+
log("not starting another replacement: this door was replacement generation " + String(respawnGeneration) + " of " + String(respawnMaxGeneration) + ", so the stall has recurred through consecutive doors and the machine, not the door, is the one refusing to serve; leaving the next launch's ensure to start one");
|
|
135096
135116
|
return;
|
|
135097
135117
|
}
|
|
135098
135118
|
try {
|
|
135099
135119
|
const out = fs.openSync(logFile, "a");
|
|
135100
|
-
const child = require("node:child_process").spawn(respawn.command, respawn.args, { detached: true, stdio: ["ignore", out, out], env: Object.assign({}, respawn.env, { [awaitPidEnv]: String(ownPid) }) });
|
|
135120
|
+
const child = require("node:child_process").spawn(respawn.command, respawn.args, { detached: true, stdio: ["ignore", out, out], env: Object.assign({}, respawn.env, { [awaitPidEnv]: String(ownPid), [respawnGenerationEnv]: String(respawnGeneration + 1) }) });
|
|
135101
135121
|
child.unref();
|
|
135102
135122
|
fs.closeSync(out);
|
|
135103
|
-
log("started replacement door " + String(child.pid) + ", which binds once this process is gone");
|
|
135123
|
+
log("started replacement door " + String(child.pid) + " of generation " + String(respawnGeneration + 1) + ", which binds once this process is gone");
|
|
135104
135124
|
} catch (error) {
|
|
135105
135125
|
log("could not start a replacement door: " + (error instanceof Error ? error.message : String(error)));
|
|
135106
135126
|
}
|
|
@@ -135148,7 +135168,7 @@ function startThreadWatchdog(params) {
|
|
|
135148
135168
|
const counter = new Int32Array(shared);
|
|
135149
135169
|
const worker = new import_node_worker_threads2.Worker(WATCHDOG_SOURCE, {
|
|
135150
135170
|
eval: true,
|
|
135151
|
-
workerData: { shared, boundMs: params.boundMs, checkEveryMs: params.checkEveryMs, pauseWaitMs: params.pauseWaitMs, stateFile: params.stateFile, ownPid: params.ownPid, action: params.action, logFile: params.logFile, respawn: params.respawn,
|
|
135171
|
+
workerData: { shared, boundMs: params.boundMs, checkEveryMs: params.checkEveryMs, pauseWaitMs: params.pauseWaitMs, stateFile: params.stateFile, ownPid: params.ownPid, action: params.action, logFile: params.logFile, respawn: params.respawn, respawnGeneration: params.respawnGeneration, respawnMaxGeneration: params.respawnMaxGeneration, awaitPidEnv: DOOR_AWAIT_PID_ENV, respawnGenerationEnv: DOOR_RESPAWN_GENERATION_ENV }
|
|
135152
135172
|
});
|
|
135153
135173
|
worker.unref();
|
|
135154
135174
|
worker.on("message", (message) => {
|
|
@@ -135276,6 +135296,10 @@ function createRealQuotaRefresher(params) {
|
|
|
135276
135296
|
|
|
135277
135297
|
// src/frontdoor/commands.ts
|
|
135278
135298
|
init_store2();
|
|
135299
|
+
function readRespawnGeneration() {
|
|
135300
|
+
const generation = Number(process.env[DOOR_RESPAWN_GENERATION_ENV]);
|
|
135301
|
+
return Number.isInteger(generation) && generation > 0 ? generation : 0;
|
|
135302
|
+
}
|
|
135279
135303
|
function respawnInvocation(paths) {
|
|
135280
135304
|
const env = {};
|
|
135281
135305
|
for (const [name, value2] of Object.entries({ ...process.env, AGENT_SHIM_HOME: paths.root })) {
|
|
@@ -135302,7 +135326,7 @@ function realStatOwnExecutable(watchPath) {
|
|
|
135302
135326
|
return st2?.isFile() !== true ? void 0 : { dev: st2.dev, ino: st2.ino, size: st2.size, mtimeMs: st2.mtimeMs };
|
|
135303
135327
|
};
|
|
135304
135328
|
}
|
|
135305
|
-
function realFrontDoorSupervisorPorts(paths) {
|
|
135329
|
+
function realFrontDoorSupervisorPorts(paths, respawnGeneration) {
|
|
135306
135330
|
const log = (line) => {
|
|
135307
135331
|
appendLog(paths, `frontdoor ${String(process.pid)}: ${line}`);
|
|
135308
135332
|
};
|
|
@@ -135719,7 +135743,8 @@ function realFrontDoorSupervisorPorts(paths) {
|
|
|
135719
135743
|
action: "kill-process",
|
|
135720
135744
|
logFile: paths.frontdoorLogPath,
|
|
135721
135745
|
respawn: respawnInvocation(paths),
|
|
135722
|
-
|
|
135746
|
+
respawnGeneration,
|
|
135747
|
+
respawnMaxGeneration: DOOR_RESPAWN_MAX_GENERATIONS
|
|
135723
135748
|
}),
|
|
135724
135749
|
// The launch lifecycle publisher over the same backbone the typed API serves: the tick's registry facts go in here, and the door's own register, prune and end moments come out as source-tagged events.
|
|
135725
135750
|
observeLaunchRegistry: createLaunchEventPublisher(doorEvents, () => Date.now()).observe,
|
|
@@ -135765,7 +135790,11 @@ function registerFrontDoorCommand(program2, deps) {
|
|
|
135765
135790
|
registerRcCommand(frontdoor, paths);
|
|
135766
135791
|
program2.command("__frontdoor-supervisor", { hidden: true }).description("Internal: serve the front-door routing listeners. Started by the launcher; never run by hand.").allowUnknownOption().action(async () => {
|
|
135767
135792
|
const idleShutdownMinutes = readGlobalConfig(paths)?.frontdoor?.idleShutdownMinutes ?? FRONTDOOR_DEFAULT_IDLE_SHUTDOWN_MINUTES;
|
|
135768
|
-
const
|
|
135793
|
+
const awaited = Number(process.env[DOOR_AWAIT_PID_ENV]);
|
|
135794
|
+
const respawnGeneration = readRespawnGeneration();
|
|
135795
|
+
Reflect.deleteProperty(process.env, DOOR_AWAIT_PID_ENV);
|
|
135796
|
+
Reflect.deleteProperty(process.env, DOOR_RESPAWN_GENERATION_ENV);
|
|
135797
|
+
const supervisorPorts = realFrontDoorSupervisorPorts(paths, respawnGeneration);
|
|
135769
135798
|
const ownPid = process.pid;
|
|
135770
135799
|
process.on("exit", (code) => {
|
|
135771
135800
|
supervisorPorts.log(`frontdoor ${String(ownPid)}: exiting with code ${String(code)}`);
|
|
@@ -135776,8 +135805,6 @@ function registerFrontDoorCommand(program2, deps) {
|
|
|
135776
135805
|
deps.exit(0);
|
|
135777
135806
|
});
|
|
135778
135807
|
}
|
|
135779
|
-
const awaited = Number(process.env[DOOR_AWAIT_PID_ENV]);
|
|
135780
|
-
Reflect.deleteProperty(process.env, DOOR_AWAIT_PID_ENV);
|
|
135781
135808
|
if (Number.isInteger(awaited) && awaited > 0) {
|
|
135782
135809
|
const waitedMs = await awaitPidExit(awaited, supervisorPorts);
|
|
135783
135810
|
supervisorPorts.log(`frontdoor ${String(ownPid)}: stalled door ${String(awaited)} released the sticky ports after ${String(waitedMs)}ms`);
|
|
@@ -136023,7 +136050,8 @@ function enrichStatuslinePayload(params) {
|
|
|
136023
136050
|
providerQuotaWindows: [],
|
|
136024
136051
|
quotaFamilies: [],
|
|
136025
136052
|
headroom: params.headroom,
|
|
136026
|
-
routedTarget: params.routedTarget
|
|
136053
|
+
routedTarget: params.routedTarget,
|
|
136054
|
+
...params.modelChoice === void 0 ? {} : { modelChoice: params.modelChoice }
|
|
136027
136055
|
};
|
|
136028
136056
|
if (params.snapshot !== void 0) {
|
|
136029
136057
|
const scopedName = providerScopedState(params.snapshot, params.providerName, params.env.AGENT_SHIM_PROVIDER);
|
|
@@ -136384,14 +136412,16 @@ function layoutHeader(texts, maxWidth, separator) {
|
|
|
136384
136412
|
}
|
|
136385
136413
|
function renderStatuslineBlock(summary, view, terminalWidth, nowMs) {
|
|
136386
136414
|
const header = [];
|
|
136387
|
-
|
|
136388
|
-
|
|
136415
|
+
const choiceNamesProvider = summary.modelChoice !== void 0 && (summary.modelChoice.providers.length > 1 || summary.routedTarget !== void 0);
|
|
136416
|
+
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;
|
|
136417
|
+
if (modelSegment !== void 0 && modelSegment !== "") {
|
|
136418
|
+
header.push(modelSegment);
|
|
136389
136419
|
}
|
|
136390
136420
|
if (summary.provider !== void 0) {
|
|
136391
136421
|
const account = [summary.providerAccountEmail, summary.providerPlan].filter((part) => part !== void 0);
|
|
136392
136422
|
header.push(account.length > 0 ? `${summary.provider} \xB7 ${account.join(" \xB7 ")}` : summary.provider);
|
|
136393
136423
|
}
|
|
136394
|
-
if (summary.routedTarget !== void 0) {
|
|
136424
|
+
if (summary.routedTarget !== void 0 && !choiceNamesProvider) {
|
|
136395
136425
|
header.push(`via ${summary.routedTarget}`);
|
|
136396
136426
|
}
|
|
136397
136427
|
const loginPlan = summary.provider === void 0 ? summary.loginPlan ?? accountPlanLabel(summary) : void 0;
|
|
@@ -136546,17 +136576,23 @@ function registerStatuslineCommand(program2, deps) {
|
|
|
136546
136576
|
const headroom = target === void 0 || sessionId === void 0 ? void 0 : await fetchHeadroomSessionStats(realHeadroomGet, target, sessionId);
|
|
136547
136577
|
const sessionHeader = /x-agent-shim-session:\s*([A-Za-z0-9@._-]+)/i.exec(process.env.ANTHROPIC_CUSTOM_HEADERS ?? "")?.[1];
|
|
136548
136578
|
let routedTarget;
|
|
136579
|
+
let modelChoice;
|
|
136549
136580
|
if (sessionHeader !== void 0) {
|
|
136550
136581
|
try {
|
|
136551
136582
|
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
|
-
|
|
136583
|
+
if (last?.model !== void 0) {
|
|
136584
|
+
if (last.provider !== providerName) {
|
|
136585
|
+
routedTarget = `${last.provider}/${last.model}`;
|
|
136586
|
+
}
|
|
136587
|
+
if (last.requestedModel !== void 0 && last.requestedModel !== last.model) {
|
|
136588
|
+
modelChoice = { requested: last.requestedModel, served: last.model, provider: last.provider, providers: last.candidateProviders ?? [] };
|
|
136589
|
+
}
|
|
136554
136590
|
}
|
|
136555
136591
|
} catch {
|
|
136556
136592
|
routedTarget = void 0;
|
|
136557
136593
|
}
|
|
136558
136594
|
}
|
|
136559
|
-
const { payload: enriched, summary } = enrichStatuslinePayload({ payload, env: process.env, snapshot, account, providerName, nowMs, headroom, routedTarget });
|
|
136595
|
+
const { payload: enriched, summary } = enrichStatuslinePayload({ payload, env: process.env, snapshot, account, providerName, nowMs, headroom, routedTarget, ...modelChoice === void 0 ? {} : { modelChoice } });
|
|
136560
136596
|
const renderer = process.env.AGENT_SHIM_STATUSLINE_CMD;
|
|
136561
136597
|
if (renderer !== void 0 && renderer !== "") {
|
|
136562
136598
|
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.1",
|
|
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.1",
|
|
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(),
|