claude-use 11.44.0 → 11.44.2

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 CHANGED
@@ -34701,7 +34701,7 @@ var init_package = __esm({
34701
34701
  "package.json"() {
34702
34702
  package_default = {
34703
34703
  name: "claude-use",
34704
- version: "11.44.0",
34704
+ version: "11.44.2",
34705
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.",
34706
34706
  license: "MIT",
34707
34707
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -34986,7 +34986,7 @@ function parseProviderPath(path65) {
34986
34986
  }
34987
34987
  return { provider: decodeURIComponent(tail.slice(0, slash)), rest: tail.slice(slash) };
34988
34988
  }
34989
- var HEADROOM_SESSION_HEADER, INTERNAL_HEADER_NAMES, IDENTITY_HEADER, SESSION_HEADER, PROVIDER_HEADER, HEADROOM_FLAG_HEADER, ROUTE_BY_NAME_HEADER, PROJECT_ID_HEADER, CLIENT_SESSION_HEADER, HEADROOM_BASE_URL_HEADER, AUTH_HEADER, HOP_SECRET_HEADER, HOP_ID_HEADER, PROVIDER_PATH_PREFIX;
34989
+ var HEADROOM_SESSION_HEADER, INTERNAL_HEADER_NAMES, IDENTITY_HEADER, SESSION_HEADER, PROVIDER_HEADER, HEADROOM_FLAG_HEADER, ROUTE_BY_NAME_HEADER, PROJECT_ID_HEADER, CLIENT_SESSION_HEADER, HEADROOM_BASE_URL_HEADER, AUTH_HEADER, HOP_SECRET_HEADER, HOP_ID_HEADER, MODEL_CHOICE_HEADER, PROVIDER_PATH_PREFIX;
34990
34990
  var init_route = __esm({
34991
34991
  "src/frontdoor/route.ts"() {
34992
34992
  "use strict";
@@ -35015,6 +35015,7 @@ var init_route = __esm({
35015
35015
  AUTH_HEADER = "x-agent-shim-auth";
35016
35016
  HOP_SECRET_HEADER = "x-agent-shim-hop";
35017
35017
  HOP_ID_HEADER = "x-agent-shim-hop-id";
35018
+ MODEL_CHOICE_HEADER = "x-agent-shim-model-choice";
35018
35019
  PROVIDER_PATH_PREFIX = "/providers/";
35019
35020
  }
35020
35021
  });
@@ -116916,6 +116917,8 @@ function createDoorPipelines(deps) {
116916
116917
  direct: {
116917
116918
  resolveRoute: deps.resolveRoute,
116918
116919
  responseObservers: [],
116920
+ // The direct pipeline's responses are consumed by this door's own headroom hop, never by a client, so the noted model choice rides the head home as MODEL_CHOICE_HEADER (see `exposeModelChoiceOnHead`) instead of dying with the observers this pipeline deliberately runs none of.
116921
+ exposeModelChoiceOnHead: true,
116919
116922
  admit: admitHop(deps.hopSecret, deps.custody),
116920
116923
  headroomDecision: deps.headroomDecision,
116921
116924
  now: deps.now,
@@ -130264,6 +130267,22 @@ async function collectBody(body) {
130264
130267
  });
130265
130268
  });
130266
130269
  }
130270
+ function parseModelChoiceHeader(value2) {
130271
+ if (value2 === void 0) return void 0;
130272
+ let parsed;
130273
+ try {
130274
+ parsed = JSON.parse(value2);
130275
+ } catch {
130276
+ return void 0;
130277
+ }
130278
+ if (typeof parsed !== "object" || parsed === null || !("requested" in parsed) || !("providers" in parsed) || typeof parsed.requested !== "string" || !Array.isArray(parsed.providers)) return void 0;
130279
+ const providers = [];
130280
+ for (const name of parsed.providers) {
130281
+ if (typeof name !== "string") return void 0;
130282
+ providers.push(name);
130283
+ }
130284
+ return { requested: parsed.requested, providers };
130285
+ }
130267
130286
  async function forwardThroughHeadroom(request7, response, target) {
130268
130287
  const collected = await collectBody(request7.body);
130269
130288
  if (collected.kind === "failed") {
@@ -130289,7 +130308,12 @@ async function hopOnce(request7, response, target, body, mayRetry) {
130289
130308
  const { socketPath, headers } = target;
130290
130309
  return await new Promise((resolve2) => {
130291
130310
  const onUpstreamResponse = (upstreamResponse) => {
130292
- response.start(upstreamResponse.statusCode ?? HTTP_BAD_GATEWAY2, responseHeaders(upstreamResponse.headers));
130311
+ const { [MODEL_CHOICE_HEADER]: choiceHeader, ...head } = responseHeaders(upstreamResponse.headers);
130312
+ const choice = parseModelChoiceHeader(choiceHeader);
130313
+ if (choice !== void 0) {
130314
+ response.noteModelChoice?.(choice);
130315
+ }
130316
+ response.start(upstreamResponse.statusCode ?? HTTP_BAD_GATEWAY2, head);
130293
130317
  response.flush();
130294
130318
  const stream = async () => {
130295
130319
  try {
@@ -130415,6 +130439,7 @@ function createRoutedResponse(response, context) {
130415
130439
  return headersSent;
130416
130440
  },
130417
130441
  start: (status, headers) => {
130442
+ const head = deps.exposeModelChoiceOnHead === true && request7.modelChoice.value !== void 0 ? { ...headers, [MODEL_CHOICE_HEADER]: JSON.stringify(request7.modelChoice.value) } : headers;
130418
130443
  for (const observe of deps.responseObservers) {
130419
130444
  try {
130420
130445
  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 });
@@ -130425,7 +130450,7 @@ function createRoutedResponse(response, context) {
130425
130450
  deps.log(`front door: response observer threw for ${route}: ${describeThrown(error63)}`);
130426
130451
  }
130427
130452
  }
130428
- response.writeHead(status, headers);
130453
+ response.writeHead(status, head);
130429
130454
  headersSent = true;
130430
130455
  },
130431
130456
  noteModelChoice: (choice) => {
@@ -135032,13 +135057,12 @@ function createRcStreamHub(deps) {
135032
135057
 
135033
135058
  // src/frontdoor/watchdog.ts
135034
135059
  var import_node_worker_threads2 = require("node:worker_threads");
135035
- init_schema();
135036
135060
  init_ensure2();
135037
135061
  init_probe();
135038
135062
  var DOOR_STALL_BOUND_MS = 2 * FRONTDOOR_PROBE_ATTEMPTS * PROBE_TIMEOUT_MS;
135039
- var MS_PER_MINUTE4 = 6e4;
135040
- var DOOR_RESPAWN_MIN_SERVING_MS = FRONTDOOR_DEFAULT_IDLE_SHUTDOWN_MINUTES * MS_PER_MINUTE4;
135041
135063
  var DOOR_AWAIT_PID_ENV = "AGENT_SHIM_FRONTDOOR_AWAIT_PID";
135064
+ var DOOR_RESPAWN_GENERATION_ENV = "AGENT_SHIM_FRONTDOOR_RESPAWN_GENERATION";
135065
+ var DOOR_RESPAWN_MAX_GENERATIONS = 3;
135042
135066
  var CHECKS_PER_PROBE_DEADLINE = 2;
135043
135067
  var DOOR_WATCHDOG_CHECK_MS = PROBE_TIMEOUT_MS / CHECKS_PER_PROBE_DEADLINE;
135044
135068
  var WATCHDOG_SOURCE = `
@@ -135046,8 +135070,7 @@ const { workerData, parentPort } = require("node:worker_threads");
135046
135070
  const fs = require("node:fs");
135047
135071
  const os = require("node:os");
135048
135072
  const inspector = require("node:inspector");
135049
- const { shared, boundMs, checkEveryMs, pauseWaitMs, stateFile, ownPid, action, logFile, respawn, respawnAfterServingMs, awaitPidEnv } = workerData;
135050
- const startedAt = Date.now();
135073
+ const { shared, boundMs, checkEveryMs, pauseWaitMs, stateFile, ownPid, action, logFile, respawn, respawnGeneration, respawnMaxGeneration, awaitPidEnv, respawnGenerationEnv } = workerData;
135051
135074
  const counter = new Int32Array(shared);
135052
135075
  let lastValue = Atomics.load(counter, 0);
135053
135076
  let lastChangeAt = Date.now();
@@ -135113,17 +135136,16 @@ const describeMainThread = (waitMs, resume) => new Promise((resolve) => {
135113
135136
  });
135114
135137
  const spawnReplacement = () => {
135115
135138
  if (respawn === undefined || logFile === undefined) return;
135116
- const servedMs = Date.now() - startedAt;
135117
- if (servedMs < respawnAfterServingMs) {
135118
- 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");
135139
+ if (respawnGeneration >= respawnMaxGeneration) {
135140
+ 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");
135119
135141
  return;
135120
135142
  }
135121
135143
  try {
135122
135144
  const out = fs.openSync(logFile, "a");
135123
- 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) }) });
135145
+ 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) }) });
135124
135146
  child.unref();
135125
135147
  fs.closeSync(out);
135126
- log("started replacement door " + String(child.pid) + ", which binds once this process is gone");
135148
+ log("started replacement door " + String(child.pid) + " of generation " + String(respawnGeneration + 1) + ", which binds once this process is gone");
135127
135149
  } catch (error) {
135128
135150
  log("could not start a replacement door: " + (error instanceof Error ? error.message : String(error)));
135129
135151
  }
@@ -135171,7 +135193,7 @@ function startThreadWatchdog(params) {
135171
135193
  const counter = new Int32Array(shared);
135172
135194
  const worker = new import_node_worker_threads2.Worker(WATCHDOG_SOURCE, {
135173
135195
  eval: true,
135174
- 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, respawnAfterServingMs: params.respawnAfterServingMs, awaitPidEnv: DOOR_AWAIT_PID_ENV }
135196
+ 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 }
135175
135197
  });
135176
135198
  worker.unref();
135177
135199
  worker.on("message", (message) => {
@@ -135299,6 +135321,10 @@ function createRealQuotaRefresher(params) {
135299
135321
 
135300
135322
  // src/frontdoor/commands.ts
135301
135323
  init_store2();
135324
+ function readRespawnGeneration() {
135325
+ const generation = Number(process.env[DOOR_RESPAWN_GENERATION_ENV]);
135326
+ return Number.isInteger(generation) && generation > 0 ? generation : 0;
135327
+ }
135302
135328
  function respawnInvocation(paths) {
135303
135329
  const env = {};
135304
135330
  for (const [name, value2] of Object.entries({ ...process.env, AGENT_SHIM_HOME: paths.root })) {
@@ -135325,7 +135351,7 @@ function realStatOwnExecutable(watchPath) {
135325
135351
  return st2?.isFile() !== true ? void 0 : { dev: st2.dev, ino: st2.ino, size: st2.size, mtimeMs: st2.mtimeMs };
135326
135352
  };
135327
135353
  }
135328
- function realFrontDoorSupervisorPorts(paths) {
135354
+ function realFrontDoorSupervisorPorts(paths, respawnGeneration) {
135329
135355
  const log = (line) => {
135330
135356
  appendLog(paths, `frontdoor ${String(process.pid)}: ${line}`);
135331
135357
  };
@@ -135742,7 +135768,8 @@ function realFrontDoorSupervisorPorts(paths) {
135742
135768
  action: "kill-process",
135743
135769
  logFile: paths.frontdoorLogPath,
135744
135770
  respawn: respawnInvocation(paths),
135745
- respawnAfterServingMs: DOOR_RESPAWN_MIN_SERVING_MS
135771
+ respawnGeneration,
135772
+ respawnMaxGeneration: DOOR_RESPAWN_MAX_GENERATIONS
135746
135773
  }),
135747
135774
  // 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.
135748
135775
  observeLaunchRegistry: createLaunchEventPublisher(doorEvents, () => Date.now()).observe,
@@ -135788,7 +135815,11 @@ function registerFrontDoorCommand(program2, deps) {
135788
135815
  registerRcCommand(frontdoor, paths);
135789
135816
  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 () => {
135790
135817
  const idleShutdownMinutes = readGlobalConfig(paths)?.frontdoor?.idleShutdownMinutes ?? FRONTDOOR_DEFAULT_IDLE_SHUTDOWN_MINUTES;
135791
- const supervisorPorts = realFrontDoorSupervisorPorts(paths);
135818
+ const awaited = Number(process.env[DOOR_AWAIT_PID_ENV]);
135819
+ const respawnGeneration = readRespawnGeneration();
135820
+ Reflect.deleteProperty(process.env, DOOR_AWAIT_PID_ENV);
135821
+ Reflect.deleteProperty(process.env, DOOR_RESPAWN_GENERATION_ENV);
135822
+ const supervisorPorts = realFrontDoorSupervisorPorts(paths, respawnGeneration);
135792
135823
  const ownPid = process.pid;
135793
135824
  process.on("exit", (code) => {
135794
135825
  supervisorPorts.log(`frontdoor ${String(ownPid)}: exiting with code ${String(code)}`);
@@ -135799,8 +135830,6 @@ function registerFrontDoorCommand(program2, deps) {
135799
135830
  deps.exit(0);
135800
135831
  });
135801
135832
  }
135802
- const awaited = Number(process.env[DOOR_AWAIT_PID_ENV]);
135803
- Reflect.deleteProperty(process.env, DOOR_AWAIT_PID_ENV);
135804
135833
  if (Number.isInteger(awaited) && awaited > 0) {
135805
135834
  const waitedMs = await awaitPidExit(awaited, supervisorPorts);
135806
135835
  supervisorPorts.log(`frontdoor ${String(ownPid)}: stalled door ${String(awaited)} released the sticky ports after ${String(waitedMs)}ms`);
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.44.0",
3154
+ version: "11.44.2",
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>",
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.44.0",
3130
+ version: "11.44.2",
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>",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-use",
3
- "version": "11.44.0",
3
+ "version": "11.44.2",
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>",