claude-use 14.0.4 → 14.1.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/index.cjs CHANGED
@@ -2258,7 +2258,7 @@ function mergeModels(current, layer) {
2258
2258
  }
2259
2259
  if (layer.tiers !== void 0) {
2260
2260
  const tiers = {};
2261
- for (const tier of ["fable", "opus", "sonnet", "haiku"]) {
2261
+ for (const tier of CLAUDE_TIERS) {
2262
2262
  const ref = layer.tiers[tier];
2263
2263
  const inherited = current?.tiers?.[tier];
2264
2264
  if (ref !== null && ref !== void 0) {
@@ -4341,7 +4341,7 @@ var init_baseUrlDisplay = __esm({
4341
4341
  });
4342
4342
 
4343
4343
  // src/usage/schema.ts
4344
- var import_zod5, USAGE_SCHEMA_VERSION, VersionSchema, InstantSchema, CLIENT_SESSION_ID_PATTERN, TokenCountSchema, TokenUsageSchema, LIMIT_KINDS, LimitClassificationSchema, UsageRecordSchema, QuotaWindowSchema, ExtraUsageSpendSchema, UnifiedRateLimitSchema, RateLimitStateSchema, LimitEventSchema, ProviderQuotaWindowSchema, ProviderAccountSchema, ProviderQuotaSchema, ProviderUsageStateSchema, AccountMetadataSchema, UsageSnapshotSchema;
4344
+ var import_zod5, USAGE_SCHEMA_VERSION, VersionSchema, InstantSchema, CLIENT_SESSION_ID_PATTERN, TokenCountSchema, TokenUsageSchema, LIMIT_KINDS, LimitClassificationSchema, REQUEST_CLASSES, RequestClassSchema, UsageRecordSchema, QuotaWindowSchema, ExtraUsageSpendSchema, UnifiedRateLimitSchema, RateLimitStateSchema, LimitEventSchema, ProviderQuotaWindowSchema, ProviderAccountSchema, ProviderQuotaSchema, ProviderUsageStateSchema, AccountMetadataSchema, UsageSnapshotSchema;
4345
4345
  var init_schema2 = __esm({
4346
4346
  "src/usage/schema.ts"() {
4347
4347
  "use strict";
@@ -4369,6 +4369,8 @@ var init_schema2 = __esm({
4369
4369
  /** The signals the classification rests on, each `<name>=<value>` from a response header or the error body's `type` or `code`. Never the error message. */
4370
4370
  evidence: import_zod5.z.array(import_zod5.z.string())
4371
4371
  });
4372
+ REQUEST_CLASSES = ["main", "subagent", "workflow", "compaction", "auxiliary", "side_reply", "unknown"];
4373
+ RequestClassSchema = import_zod5.z.enum(REQUEST_CLASSES);
4372
4374
  UsageRecordSchema = import_zod5.z.strictObject({
4373
4375
  schemaVersion: VersionSchema,
4374
4376
  /** When the front door received the request. */
@@ -4392,8 +4394,10 @@ var init_schema2 = __esm({
4392
4394
  endpoint: import_zod5.z.string(),
4393
4395
  /** The model the response named. */
4394
4396
  model: import_zod5.z.string().optional(),
4395
- /** The model the session requested when a routing layer chose a different model, or when no response model was available to compare it with. Absent when the response confirms that the requested name was served unchanged. */
4397
+ /** The model name the request asked for, as its body carried it before any routing layer rewrote it: compared with `model`, it tells a choice or tier mapping apart from a name served unchanged. Present when the response served a different model than the name asked for, and when the response names no model (an error response included) and the door had read the request's body; absent when the response confirms the name. */
4396
4398
  requestedModel: import_zod5.z.string().optional(),
4399
+ /** The request's class, as Claude Code stated it in its `x-claude-code-request-class` header: `main` for the conversation's own loop, otherwise `subagent`, `workflow`, `compaction`, `auxiliary` (a hook judge, a title) or `side_reply`; `unknown` when the header carried anything else, so a client-chosen string never reaches the log. `subagent` as well for a request that states no class but carries Claude Code's agent id header, which it sends on every non-main agent request. Absent when the client sent neither. Claude Code derives it from the request's query source, which it does not send, so the query source itself is never recorded. */
4400
+ requestClass: RequestClassSchema.optional(),
4397
4401
  /** 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. */
4398
4402
  candidateProviders: import_zod5.z.array(import_zod5.z.string()).optional(),
4399
4403
  status: import_zod5.z.number().int(),
@@ -5116,6 +5120,9 @@ function readCatalogueStatus(fs17, paths, pid, generation, name) {
5116
5120
  return void 0;
5117
5121
  }
5118
5122
  }
5123
+ function launchKeyOf(launch) {
5124
+ return `${String(launch.pid)}-${String(launch.startedAt)}`;
5125
+ }
5119
5126
  function writeFrontDoorCodexHome(fs17, frontdoorDir, pid, codexHome, generation) {
5120
5127
  const directory = import_node_path13.default.join(frontdoorDir, "codex-homes");
5121
5128
  fs17.mkdirp(directory);
@@ -5238,6 +5245,7 @@ function recordOf(details) {
5238
5245
  }
5239
5246
  function writeFrontDoorSession(fs17, sessionsDir, session) {
5240
5247
  fs17.mkdirPrivate(sessionsDir);
5248
+ fs17.removeRecursive(import_node_path13.default.join(sessionsDir, launchRouteName(session.pid)));
5241
5249
  fs17.writeFilePrivate(import_node_path13.default.join(sessionsDir, sessionRecordName(session.pid)), `${JSON.stringify(session, null, 2)}
5242
5250
  `);
5243
5251
  }
@@ -5245,7 +5253,10 @@ function sessionRecordName(pid) {
5245
5253
  return `${String(pid)}.json`;
5246
5254
  }
5247
5255
  function isSessionRecordName(name) {
5248
- return name.endsWith(".json");
5256
+ return /^[1-9]\d*\.json$/.test(name);
5257
+ }
5258
+ function launchRouteName(pid) {
5259
+ return `${String(pid)}.route.json`;
5249
5260
  }
5250
5261
  function summaryOf(session) {
5251
5262
  return { pid: session.pid, startedAt: session.startedAt, ...session.supervisorPid === void 0 ? {} : { supervisorPid: session.supervisorPid } };
@@ -5268,8 +5279,13 @@ function listFrontDoorSessions(fs17, sessionsDir) {
5268
5279
  }
5269
5280
  return sessions.sort((a, b) => a.pid - b.pid);
5270
5281
  }
5282
+ function routeFilePid(name) {
5283
+ const match = /^([1-9]\d*)\.route\.json$/.exec(name);
5284
+ return match?.[1] === void 0 ? void 0 : Number(match[1]);
5285
+ }
5271
5286
  function removeFrontDoorSession(fs17, sessionsDir, pid) {
5272
5287
  fs17.removeRecursive(import_node_path13.default.join(sessionsDir, sessionRecordName(pid)));
5288
+ fs17.removeRecursive(import_node_path13.default.join(sessionsDir, launchRouteName(pid)));
5273
5289
  }
5274
5290
  function pruneDeadFrontDoorSessions(fs17, sessionsDir, listed, isRunning) {
5275
5291
  const removed = [];
@@ -5279,9 +5295,16 @@ function pruneDeadFrontDoorSessions(fs17, sessionsDir, listed, isRunning) {
5279
5295
  removed.push(session.pid);
5280
5296
  }
5281
5297
  }
5298
+ const names = fs17.readdir(sessionsDir);
5299
+ for (const name of names) {
5300
+ const pid = routeFilePid(name);
5301
+ if (pid !== void 0 && !names.includes(sessionRecordName(pid))) {
5302
+ fs17.removeRecursive(import_node_path13.default.join(sessionsDir, name));
5303
+ }
5304
+ }
5282
5305
  return removed;
5283
5306
  }
5284
- var import_node_path13, import_zod9, FRONT_DOOR_PROTOCOL, FRONT_DOOR_HANDOVER_PROTOCOL, FrontDoorSessionSchema, FrontDoorStateSchema, FrontDoorDirectRecordSchema, RECORD_TEMPORARY_FILE;
5307
+ var import_node_path13, import_zod9, FRONT_DOOR_PROTOCOL, FRONT_DOOR_HANDOVER_PROTOCOL, FrontDoorSessionSchema, MainLoopRouteSchema, FrontDoorStateSchema, FrontDoorDirectRecordSchema, RECORD_TEMPORARY_FILE, LAUNCH_ROUTE_FILE_VERSION, LaunchRouteFileSchema;
5285
5308
  var init_state = __esm({
5286
5309
  "src/frontdoor/state.ts"() {
5287
5310
  "use strict";
@@ -5293,6 +5316,7 @@ var init_state = __esm({
5293
5316
  FRONT_DOOR_PROTOCOL = 8;
5294
5317
  FRONT_DOOR_HANDOVER_PROTOCOL = 6;
5295
5318
  FrontDoorSessionSchema = import_zod9.z.strictObject({ pid: import_zod9.z.number().int().positive(), startedAt: import_zod9.z.number(), token: import_zod9.z.string().min(1), supervisorPid: import_zod9.z.number().int().positive().optional(), sessionId: import_zod9.z.string().min(1).optional(), identity: import_zod9.z.string().min(1).optional(), models: ModelsConfigSchema.optional() });
5319
+ MainLoopRouteSchema = import_zod9.z.union([import_zod9.z.strictObject({ kind: import_zod9.z.literal("anthropic") }), import_zod9.z.strictObject({ kind: import_zod9.z.literal("provider"), provider: import_zod9.z.string().min(1) })]);
5296
5320
  FrontDoorStateSchema = import_zod9.z.strictObject({
5297
5321
  /**
5298
5322
  * The launcher-to-door wire protocol this supervisor speaks, written once it is serving; absent in state written by a release that predates the field, which `ensureFrontDoor` reads as protocol 0. A launcher replaces a door whose protocol is lower than its own (see `FRONT_DOOR_PROTOCOL`).
@@ -5325,6 +5349,8 @@ var init_state = __esm({
5325
5349
  });
5326
5350
  FrontDoorDirectRecordSchema = import_zod9.z.strictObject({ directPort: import_zod9.z.number().int().positive().max(MAX_TCP_PORT) });
5327
5351
  RECORD_TEMPORARY_FILE = /^[1-9]\d*\.json\.([1-9]\d*)\.tmp$/;
5352
+ LAUNCH_ROUTE_FILE_VERSION = 1;
5353
+ LaunchRouteFileSchema = import_zod9.z.strictObject({ version: import_zod9.z.literal(LAUNCH_ROUTE_FILE_VERSION), startedAt: import_zod9.z.number(), route: MainLoopRouteSchema });
5328
5354
  }
5329
5355
  });
5330
5356
 
@@ -13876,7 +13902,7 @@ var init_package = __esm({
13876
13902
  "package.json"() {
13877
13903
  package_default = {
13878
13904
  name: "claude-use",
13879
- version: "14.0.4",
13905
+ version: "14.1.0",
13880
13906
  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.",
13881
13907
  license: "MIT",
13882
13908
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -15661,6 +15687,21 @@ var init_catalogueCredential = __esm({
15661
15687
  }
15662
15688
  });
15663
15689
 
15690
+ // src/models/tiers.ts
15691
+ var TIER_ENV_VARIABLES;
15692
+ var init_tiers = __esm({
15693
+ "src/models/tiers.ts"() {
15694
+ "use strict";
15695
+ init_schema();
15696
+ TIER_ENV_VARIABLES = Object.freeze({
15697
+ fable: "ANTHROPIC_DEFAULT_FABLE_MODEL",
15698
+ opus: "ANTHROPIC_DEFAULT_OPUS_MODEL",
15699
+ sonnet: "ANTHROPIC_DEFAULT_SONNET_MODEL",
15700
+ haiku: "ANTHROPIC_DEFAULT_HAIKU_MODEL"
15701
+ });
15702
+ }
15703
+ });
15704
+
15664
15705
  // src/selection/engine.ts
15665
15706
  var init_engine = __esm({
15666
15707
  "src/selection/engine.ts"() {
@@ -15815,6 +15856,7 @@ var init_translate = __esm({
15815
15856
  "src/antigravity/translate.ts"() {
15816
15857
  "use strict";
15817
15858
  init_identity2();
15859
+ init_tiers();
15818
15860
  init_engine();
15819
15861
  init_quota();
15820
15862
  init_signatures();
@@ -15842,6 +15884,7 @@ function resolveCodexConfig(config) {
15842
15884
  var init_translate2 = __esm({
15843
15885
  "src/codex/translate.ts"() {
15844
15886
  "use strict";
15887
+ init_tiers();
15845
15888
  init_schema();
15846
15889
  init_anthropic();
15847
15890
  }
@@ -15965,7 +16008,7 @@ function safeExpand(name, models) {
15965
16008
  function modelPickerSettingsFromRows(options, replaceBuiltInOptions) {
15966
16009
  return options.length === 0 ? void 0 : JSON.stringify({ modelPicker: { options, replaceBuiltInOptions } });
15967
16010
  }
15968
- var TIER_BEHAVES_AS, TIER_ENV_VARIABLES;
16011
+ var TIER_BEHAVES_AS;
15969
16012
  var init_modelPicker = __esm({
15970
16013
  "src/launcher/modelPicker.ts"() {
15971
16014
  "use strict";
@@ -15976,18 +16019,13 @@ var init_modelPicker = __esm({
15976
16019
  init_identity2();
15977
16020
  init_families();
15978
16021
  init_modelsStore();
16022
+ init_tiers();
15979
16023
  TIER_BEHAVES_AS = Object.freeze({
15980
16024
  fable: "claude-fable-5-1",
15981
16025
  opus: "claude-opus-5-5",
15982
16026
  sonnet: "claude-sonnet-5-5",
15983
16027
  haiku: "claude-haiku-5-5"
15984
16028
  });
15985
- TIER_ENV_VARIABLES = Object.freeze({
15986
- fable: "ANTHROPIC_DEFAULT_FABLE_MODEL",
15987
- opus: "ANTHROPIC_DEFAULT_OPUS_MODEL",
15988
- sonnet: "ANTHROPIC_DEFAULT_SONNET_MODEL",
15989
- haiku: "ANTHROPIC_DEFAULT_HAIKU_MODEL"
15990
- });
15991
16029
  }
15992
16030
  });
15993
16031
 
@@ -16784,6 +16822,7 @@ function buildEnv(params) {
16784
16822
  launcherHeaders
16785
16823
  );
16786
16824
  inject("NODE_EXTRA_CA_CERTS", params.frontdoor.trustBundlePath);
16825
+ inject("CLAUDE_CODE_GATEWAY_HINT_HEADERS", "1");
16787
16826
  inject("HTTPS_PROXY", connectProxyUrl(params.frontdoor.connectPort, params.frontdoor.sessionToken));
16788
16827
  const bypassed = [...LOOPBACK_HOSTS, ...params.proxyBypass ?? []];
16789
16828
  for (const list of ["NO_PROXY", "no_proxy"]) {
@@ -25946,12 +25985,14 @@ function createLiveSessionRegistry(ports) {
25946
25985
  let tokens = /* @__PURE__ */ new Set();
25947
25986
  let byToken = /* @__PURE__ */ new Map();
25948
25987
  let bySessionId = /* @__PURE__ */ new Map();
25988
+ let launches = /* @__PURE__ */ new Set();
25949
25989
  const recordNames = () => fs17.readdir(sessionsDir).filter(isSessionRecordName);
25950
25990
  const rebuildIndexes = () => {
25951
25991
  const records = [...known.values()].flatMap(({ record }) => record === void 0 ? [] : [record]);
25952
25992
  tokens = new Set(records.map((record) => record.token));
25953
25993
  byToken = new Map(records.map((record) => [record.token, record]));
25954
25994
  bySessionId = new Map(records.flatMap((record) => record.sessionId === void 0 ? [] : [[record.sessionId, record]]));
25995
+ launches = new Set(records.map(launchKeyOf));
25955
25996
  };
25956
25997
  const load = (name, stat) => {
25957
25998
  known.set(name, { stat: { mtimeMs: stat.mtimeMs, sizeBytes: stat.sizeBytes }, record: readFrontDoorSessionRecord(fs17, sessionsDir, name) });
@@ -25993,6 +26034,11 @@ function createLiveSessionRegistry(ports) {
25993
26034
  const held = bySessionId.get(sessionId) ?? (reconcile() ? bySessionId.get(sessionId) : void 0);
25994
26035
  return held?.models;
25995
26036
  },
26037
+ launchOfToken: (token) => {
26038
+ const held = byToken.get(token) ?? (reconcile() ? byToken.get(token) : void 0);
26039
+ return held?.sessionId === void 0 ? void 0 : { pid: held.pid, startedAt: held.startedAt };
26040
+ },
26041
+ holdsLaunch: (launch) => launches.has(launchKeyOf(launch)) || reconcile() && launches.has(launchKeyOf(launch)),
25996
26042
  rescan: () => {
25997
26043
  known.clear();
25998
26044
  for (const name of recordNames()) {
package/dist/index.mjs CHANGED
@@ -2236,7 +2236,7 @@ function mergeModels(current, layer) {
2236
2236
  }
2237
2237
  if (layer.tiers !== void 0) {
2238
2238
  const tiers = {};
2239
- for (const tier of ["fable", "opus", "sonnet", "haiku"]) {
2239
+ for (const tier of CLAUDE_TIERS) {
2240
2240
  const ref = layer.tiers[tier];
2241
2241
  const inherited = current?.tiers?.[tier];
2242
2242
  if (ref !== null && ref !== void 0) {
@@ -4318,7 +4318,7 @@ var init_baseUrlDisplay = __esm({
4318
4318
 
4319
4319
  // src/usage/schema.ts
4320
4320
  import { z as z5 } from "zod";
4321
- var USAGE_SCHEMA_VERSION, VersionSchema, InstantSchema, CLIENT_SESSION_ID_PATTERN, TokenCountSchema, TokenUsageSchema, LIMIT_KINDS, LimitClassificationSchema, UsageRecordSchema, QuotaWindowSchema, ExtraUsageSpendSchema, UnifiedRateLimitSchema, RateLimitStateSchema, LimitEventSchema, ProviderQuotaWindowSchema, ProviderAccountSchema, ProviderQuotaSchema, ProviderUsageStateSchema, AccountMetadataSchema, UsageSnapshotSchema;
4321
+ var USAGE_SCHEMA_VERSION, VersionSchema, InstantSchema, CLIENT_SESSION_ID_PATTERN, TokenCountSchema, TokenUsageSchema, LIMIT_KINDS, LimitClassificationSchema, REQUEST_CLASSES, RequestClassSchema, UsageRecordSchema, QuotaWindowSchema, ExtraUsageSpendSchema, UnifiedRateLimitSchema, RateLimitStateSchema, LimitEventSchema, ProviderQuotaWindowSchema, ProviderAccountSchema, ProviderQuotaSchema, ProviderUsageStateSchema, AccountMetadataSchema, UsageSnapshotSchema;
4322
4322
  var init_schema2 = __esm({
4323
4323
  "src/usage/schema.ts"() {
4324
4324
  "use strict";
@@ -4345,6 +4345,8 @@ var init_schema2 = __esm({
4345
4345
  /** The signals the classification rests on, each `<name>=<value>` from a response header or the error body's `type` or `code`. Never the error message. */
4346
4346
  evidence: z5.array(z5.string())
4347
4347
  });
4348
+ REQUEST_CLASSES = ["main", "subagent", "workflow", "compaction", "auxiliary", "side_reply", "unknown"];
4349
+ RequestClassSchema = z5.enum(REQUEST_CLASSES);
4348
4350
  UsageRecordSchema = z5.strictObject({
4349
4351
  schemaVersion: VersionSchema,
4350
4352
  /** When the front door received the request. */
@@ -4368,8 +4370,10 @@ var init_schema2 = __esm({
4368
4370
  endpoint: z5.string(),
4369
4371
  /** The model the response named. */
4370
4372
  model: z5.string().optional(),
4371
- /** The model the session requested when a routing layer chose a different model, or when no response model was available to compare it with. Absent when the response confirms that the requested name was served unchanged. */
4373
+ /** The model name the request asked for, as its body carried it before any routing layer rewrote it: compared with `model`, it tells a choice or tier mapping apart from a name served unchanged. Present when the response served a different model than the name asked for, and when the response names no model (an error response included) and the door had read the request's body; absent when the response confirms the name. */
4372
4374
  requestedModel: z5.string().optional(),
4375
+ /** The request's class, as Claude Code stated it in its `x-claude-code-request-class` header: `main` for the conversation's own loop, otherwise `subagent`, `workflow`, `compaction`, `auxiliary` (a hook judge, a title) or `side_reply`; `unknown` when the header carried anything else, so a client-chosen string never reaches the log. `subagent` as well for a request that states no class but carries Claude Code's agent id header, which it sends on every non-main agent request. Absent when the client sent neither. Claude Code derives it from the request's query source, which it does not send, so the query source itself is never recorded. */
4376
+ requestClass: RequestClassSchema.optional(),
4373
4377
  /** 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. */
4374
4378
  candidateProviders: z5.array(z5.string()).optional(),
4375
4379
  status: z5.number().int(),
@@ -5093,6 +5097,9 @@ function readCatalogueStatus(fs17, paths, pid, generation, name) {
5093
5097
  return void 0;
5094
5098
  }
5095
5099
  }
5100
+ function launchKeyOf(launch) {
5101
+ return `${String(launch.pid)}-${String(launch.startedAt)}`;
5102
+ }
5096
5103
  function writeFrontDoorCodexHome(fs17, frontdoorDir, pid, codexHome, generation) {
5097
5104
  const directory = path13.join(frontdoorDir, "codex-homes");
5098
5105
  fs17.mkdirp(directory);
@@ -5215,6 +5222,7 @@ function recordOf(details) {
5215
5222
  }
5216
5223
  function writeFrontDoorSession(fs17, sessionsDir, session) {
5217
5224
  fs17.mkdirPrivate(sessionsDir);
5225
+ fs17.removeRecursive(path13.join(sessionsDir, launchRouteName(session.pid)));
5218
5226
  fs17.writeFilePrivate(path13.join(sessionsDir, sessionRecordName(session.pid)), `${JSON.stringify(session, null, 2)}
5219
5227
  `);
5220
5228
  }
@@ -5222,7 +5230,10 @@ function sessionRecordName(pid) {
5222
5230
  return `${String(pid)}.json`;
5223
5231
  }
5224
5232
  function isSessionRecordName(name) {
5225
- return name.endsWith(".json");
5233
+ return /^[1-9]\d*\.json$/.test(name);
5234
+ }
5235
+ function launchRouteName(pid) {
5236
+ return `${String(pid)}.route.json`;
5226
5237
  }
5227
5238
  function summaryOf(session) {
5228
5239
  return { pid: session.pid, startedAt: session.startedAt, ...session.supervisorPid === void 0 ? {} : { supervisorPid: session.supervisorPid } };
@@ -5245,8 +5256,13 @@ function listFrontDoorSessions(fs17, sessionsDir) {
5245
5256
  }
5246
5257
  return sessions.sort((a, b) => a.pid - b.pid);
5247
5258
  }
5259
+ function routeFilePid(name) {
5260
+ const match = /^([1-9]\d*)\.route\.json$/.exec(name);
5261
+ return match?.[1] === void 0 ? void 0 : Number(match[1]);
5262
+ }
5248
5263
  function removeFrontDoorSession(fs17, sessionsDir, pid) {
5249
5264
  fs17.removeRecursive(path13.join(sessionsDir, sessionRecordName(pid)));
5265
+ fs17.removeRecursive(path13.join(sessionsDir, launchRouteName(pid)));
5250
5266
  }
5251
5267
  function pruneDeadFrontDoorSessions(fs17, sessionsDir, listed, isRunning) {
5252
5268
  const removed = [];
@@ -5256,9 +5272,16 @@ function pruneDeadFrontDoorSessions(fs17, sessionsDir, listed, isRunning) {
5256
5272
  removed.push(session.pid);
5257
5273
  }
5258
5274
  }
5275
+ const names = fs17.readdir(sessionsDir);
5276
+ for (const name of names) {
5277
+ const pid = routeFilePid(name);
5278
+ if (pid !== void 0 && !names.includes(sessionRecordName(pid))) {
5279
+ fs17.removeRecursive(path13.join(sessionsDir, name));
5280
+ }
5281
+ }
5259
5282
  return removed;
5260
5283
  }
5261
- var FRONT_DOOR_PROTOCOL, FRONT_DOOR_HANDOVER_PROTOCOL, FrontDoorSessionSchema, FrontDoorStateSchema, FrontDoorDirectRecordSchema, RECORD_TEMPORARY_FILE;
5284
+ var FRONT_DOOR_PROTOCOL, FRONT_DOOR_HANDOVER_PROTOCOL, FrontDoorSessionSchema, MainLoopRouteSchema, FrontDoorStateSchema, FrontDoorDirectRecordSchema, RECORD_TEMPORARY_FILE, LAUNCH_ROUTE_FILE_VERSION, LaunchRouteFileSchema;
5262
5285
  var init_state = __esm({
5263
5286
  "src/frontdoor/state.ts"() {
5264
5287
  "use strict";
@@ -5268,6 +5291,7 @@ var init_state = __esm({
5268
5291
  FRONT_DOOR_PROTOCOL = 8;
5269
5292
  FRONT_DOOR_HANDOVER_PROTOCOL = 6;
5270
5293
  FrontDoorSessionSchema = z9.strictObject({ pid: z9.number().int().positive(), startedAt: z9.number(), token: z9.string().min(1), supervisorPid: z9.number().int().positive().optional(), sessionId: z9.string().min(1).optional(), identity: z9.string().min(1).optional(), models: ModelsConfigSchema.optional() });
5294
+ MainLoopRouteSchema = z9.union([z9.strictObject({ kind: z9.literal("anthropic") }), z9.strictObject({ kind: z9.literal("provider"), provider: z9.string().min(1) })]);
5271
5295
  FrontDoorStateSchema = z9.strictObject({
5272
5296
  /**
5273
5297
  * The launcher-to-door wire protocol this supervisor speaks, written once it is serving; absent in state written by a release that predates the field, which `ensureFrontDoor` reads as protocol 0. A launcher replaces a door whose protocol is lower than its own (see `FRONT_DOOR_PROTOCOL`).
@@ -5300,6 +5324,8 @@ var init_state = __esm({
5300
5324
  });
5301
5325
  FrontDoorDirectRecordSchema = z9.strictObject({ directPort: z9.number().int().positive().max(MAX_TCP_PORT) });
5302
5326
  RECORD_TEMPORARY_FILE = /^[1-9]\d*\.json\.([1-9]\d*)\.tmp$/;
5327
+ LAUNCH_ROUTE_FILE_VERSION = 1;
5328
+ LaunchRouteFileSchema = z9.strictObject({ version: z9.literal(LAUNCH_ROUTE_FILE_VERSION), startedAt: z9.number(), route: MainLoopRouteSchema });
5303
5329
  }
5304
5330
  });
5305
5331
 
@@ -13849,7 +13875,7 @@ var init_package = __esm({
13849
13875
  "package.json"() {
13850
13876
  package_default = {
13851
13877
  name: "claude-use",
13852
- version: "14.0.4",
13878
+ version: "14.1.0",
13853
13879
  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.",
13854
13880
  license: "MIT",
13855
13881
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -15632,6 +15658,21 @@ var init_catalogueCredential = __esm({
15632
15658
  }
15633
15659
  });
15634
15660
 
15661
+ // src/models/tiers.ts
15662
+ var TIER_ENV_VARIABLES;
15663
+ var init_tiers = __esm({
15664
+ "src/models/tiers.ts"() {
15665
+ "use strict";
15666
+ init_schema();
15667
+ TIER_ENV_VARIABLES = Object.freeze({
15668
+ fable: "ANTHROPIC_DEFAULT_FABLE_MODEL",
15669
+ opus: "ANTHROPIC_DEFAULT_OPUS_MODEL",
15670
+ sonnet: "ANTHROPIC_DEFAULT_SONNET_MODEL",
15671
+ haiku: "ANTHROPIC_DEFAULT_HAIKU_MODEL"
15672
+ });
15673
+ }
15674
+ });
15675
+
15635
15676
  // src/selection/engine.ts
15636
15677
  var init_engine = __esm({
15637
15678
  "src/selection/engine.ts"() {
@@ -15786,6 +15827,7 @@ var init_translate = __esm({
15786
15827
  "src/antigravity/translate.ts"() {
15787
15828
  "use strict";
15788
15829
  init_identity2();
15830
+ init_tiers();
15789
15831
  init_engine();
15790
15832
  init_quota();
15791
15833
  init_signatures();
@@ -15813,6 +15855,7 @@ function resolveCodexConfig(config) {
15813
15855
  var init_translate2 = __esm({
15814
15856
  "src/codex/translate.ts"() {
15815
15857
  "use strict";
15858
+ init_tiers();
15816
15859
  init_schema();
15817
15860
  init_anthropic();
15818
15861
  }
@@ -15936,7 +15979,7 @@ function safeExpand(name, models) {
15936
15979
  function modelPickerSettingsFromRows(options, replaceBuiltInOptions) {
15937
15980
  return options.length === 0 ? void 0 : JSON.stringify({ modelPicker: { options, replaceBuiltInOptions } });
15938
15981
  }
15939
- var TIER_BEHAVES_AS, TIER_ENV_VARIABLES;
15982
+ var TIER_BEHAVES_AS;
15940
15983
  var init_modelPicker = __esm({
15941
15984
  "src/launcher/modelPicker.ts"() {
15942
15985
  "use strict";
@@ -15947,18 +15990,13 @@ var init_modelPicker = __esm({
15947
15990
  init_identity2();
15948
15991
  init_families();
15949
15992
  init_modelsStore();
15993
+ init_tiers();
15950
15994
  TIER_BEHAVES_AS = Object.freeze({
15951
15995
  fable: "claude-fable-5-1",
15952
15996
  opus: "claude-opus-5-5",
15953
15997
  sonnet: "claude-sonnet-5-5",
15954
15998
  haiku: "claude-haiku-5-5"
15955
15999
  });
15956
- TIER_ENV_VARIABLES = Object.freeze({
15957
- fable: "ANTHROPIC_DEFAULT_FABLE_MODEL",
15958
- opus: "ANTHROPIC_DEFAULT_OPUS_MODEL",
15959
- sonnet: "ANTHROPIC_DEFAULT_SONNET_MODEL",
15960
- haiku: "ANTHROPIC_DEFAULT_HAIKU_MODEL"
15961
- });
15962
16000
  }
15963
16001
  });
15964
16002
 
@@ -16755,6 +16793,7 @@ function buildEnv(params) {
16755
16793
  launcherHeaders
16756
16794
  );
16757
16795
  inject("NODE_EXTRA_CA_CERTS", params.frontdoor.trustBundlePath);
16796
+ inject("CLAUDE_CODE_GATEWAY_HINT_HEADERS", "1");
16758
16797
  inject("HTTPS_PROXY", connectProxyUrl(params.frontdoor.connectPort, params.frontdoor.sessionToken));
16759
16798
  const bypassed = [...LOOPBACK_HOSTS, ...params.proxyBypass ?? []];
16760
16799
  for (const list of ["NO_PROXY", "no_proxy"]) {
@@ -25495,12 +25534,14 @@ function createLiveSessionRegistry(ports) {
25495
25534
  let tokens = /* @__PURE__ */ new Set();
25496
25535
  let byToken = /* @__PURE__ */ new Map();
25497
25536
  let bySessionId = /* @__PURE__ */ new Map();
25537
+ let launches = /* @__PURE__ */ new Set();
25498
25538
  const recordNames = () => fs17.readdir(sessionsDir).filter(isSessionRecordName);
25499
25539
  const rebuildIndexes = () => {
25500
25540
  const records = [...known.values()].flatMap(({ record }) => record === void 0 ? [] : [record]);
25501
25541
  tokens = new Set(records.map((record) => record.token));
25502
25542
  byToken = new Map(records.map((record) => [record.token, record]));
25503
25543
  bySessionId = new Map(records.flatMap((record) => record.sessionId === void 0 ? [] : [[record.sessionId, record]]));
25544
+ launches = new Set(records.map(launchKeyOf));
25504
25545
  };
25505
25546
  const load = (name, stat) => {
25506
25547
  known.set(name, { stat: { mtimeMs: stat.mtimeMs, sizeBytes: stat.sizeBytes }, record: readFrontDoorSessionRecord(fs17, sessionsDir, name) });
@@ -25542,6 +25583,11 @@ function createLiveSessionRegistry(ports) {
25542
25583
  const held = bySessionId.get(sessionId) ?? (reconcile() ? bySessionId.get(sessionId) : void 0);
25543
25584
  return held?.models;
25544
25585
  },
25586
+ launchOfToken: (token) => {
25587
+ const held = byToken.get(token) ?? (reconcile() ? byToken.get(token) : void 0);
25588
+ return held?.sessionId === void 0 ? void 0 : { pid: held.pid, startedAt: held.startedAt };
25589
+ },
25590
+ holdsLaunch: (launch) => launches.has(launchKeyOf(launch)) || reconcile() && launches.has(launchKeyOf(launch)),
25545
25591
  rescan: () => {
25546
25592
  known.clear();
25547
25593
  for (const name of recordNames()) {