claude-use 14.0.4 → 14.2.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,8 @@ 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)));
5249
+ fs17.removeRecursive(import_node_path13.default.join(sessionsDir, launchFactsName(session.pid)));
5241
5250
  fs17.writeFilePrivate(import_node_path13.default.join(sessionsDir, sessionRecordName(session.pid)), `${JSON.stringify(session, null, 2)}
5242
5251
  `);
5243
5252
  }
@@ -5245,7 +5254,13 @@ function sessionRecordName(pid) {
5245
5254
  return `${String(pid)}.json`;
5246
5255
  }
5247
5256
  function isSessionRecordName(name) {
5248
- return name.endsWith(".json");
5257
+ return /^[1-9]\d*\.json$/.test(name);
5258
+ }
5259
+ function launchRouteName(pid) {
5260
+ return `${String(pid)}.route.json`;
5261
+ }
5262
+ function launchFactsName(pid) {
5263
+ return `${String(pid)}.context.json`;
5249
5264
  }
5250
5265
  function summaryOf(session) {
5251
5266
  return { pid: session.pid, startedAt: session.startedAt, ...session.supervisorPid === void 0 ? {} : { supervisorPid: session.supervisorPid } };
@@ -5268,8 +5283,14 @@ function listFrontDoorSessions(fs17, sessionsDir) {
5268
5283
  }
5269
5284
  return sessions.sort((a, b) => a.pid - b.pid);
5270
5285
  }
5286
+ function routeFilePid(name) {
5287
+ const match = /^([1-9]\d*)\.(?:route|context)\.json$/.exec(name);
5288
+ return match?.[1] === void 0 ? void 0 : Number(match[1]);
5289
+ }
5271
5290
  function removeFrontDoorSession(fs17, sessionsDir, pid) {
5272
5291
  fs17.removeRecursive(import_node_path13.default.join(sessionsDir, sessionRecordName(pid)));
5292
+ fs17.removeRecursive(import_node_path13.default.join(sessionsDir, launchRouteName(pid)));
5293
+ fs17.removeRecursive(import_node_path13.default.join(sessionsDir, launchFactsName(pid)));
5273
5294
  }
5274
5295
  function pruneDeadFrontDoorSessions(fs17, sessionsDir, listed, isRunning) {
5275
5296
  const removed = [];
@@ -5279,9 +5300,16 @@ function pruneDeadFrontDoorSessions(fs17, sessionsDir, listed, isRunning) {
5279
5300
  removed.push(session.pid);
5280
5301
  }
5281
5302
  }
5303
+ const names = fs17.readdir(sessionsDir);
5304
+ for (const name of names) {
5305
+ const pid = routeFilePid(name);
5306
+ if (pid !== void 0 && !names.includes(sessionRecordName(pid))) {
5307
+ fs17.removeRecursive(import_node_path13.default.join(sessionsDir, name));
5308
+ }
5309
+ }
5282
5310
  return removed;
5283
5311
  }
5284
- var import_node_path13, import_zod9, FRONT_DOOR_PROTOCOL, FRONT_DOOR_HANDOVER_PROTOCOL, FrontDoorSessionSchema, FrontDoorStateSchema, FrontDoorDirectRecordSchema, RECORD_TEMPORARY_FILE;
5312
+ var import_node_path13, import_zod9, FRONT_DOOR_PROTOCOL, FRONT_DOOR_HANDOVER_PROTOCOL, FrontDoorSessionSchema, MAX_CONTEXT_TEXT_LENGTH, ContextText, LaunchRouteSchema, ContextFactsSchema, FrontDoorStateSchema, FrontDoorDirectRecordSchema, RECORD_TEMPORARY_FILE, LAUNCH_ROUTE_FILE_VERSION, LAUNCH_FACTS_FILE_VERSION, LaunchRouteFileSchema, LaunchFactsFileSchema;
5285
5313
  var init_state = __esm({
5286
5314
  "src/frontdoor/state.ts"() {
5287
5315
  "use strict";
@@ -5293,6 +5321,10 @@ var init_state = __esm({
5293
5321
  FRONT_DOOR_PROTOCOL = 8;
5294
5322
  FRONT_DOOR_HANDOVER_PROTOCOL = 6;
5295
5323
  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() });
5324
+ MAX_CONTEXT_TEXT_LENGTH = 256;
5325
+ ContextText = import_zod9.z.string().min(1).max(MAX_CONTEXT_TEXT_LENGTH);
5326
+ LaunchRouteSchema = 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) })]);
5327
+ ContextFactsSchema = import_zod9.z.strictObject({ credential: ContextText.optional(), requestedModel: ContextText.optional(), servedModel: ContextText.optional() });
5296
5328
  FrontDoorStateSchema = import_zod9.z.strictObject({
5297
5329
  /**
5298
5330
  * 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 +5357,10 @@ var init_state = __esm({
5325
5357
  });
5326
5358
  FrontDoorDirectRecordSchema = import_zod9.z.strictObject({ directPort: import_zod9.z.number().int().positive().max(MAX_TCP_PORT) });
5327
5359
  RECORD_TEMPORARY_FILE = /^[1-9]\d*\.json\.([1-9]\d*)\.tmp$/;
5360
+ LAUNCH_ROUTE_FILE_VERSION = 1;
5361
+ LAUNCH_FACTS_FILE_VERSION = 1;
5362
+ LaunchRouteFileSchema = import_zod9.z.strictObject({ version: import_zod9.z.literal(LAUNCH_ROUTE_FILE_VERSION), startedAt: import_zod9.z.number(), route: LaunchRouteSchema });
5363
+ LaunchFactsFileSchema = import_zod9.z.strictObject({ version: import_zod9.z.literal(LAUNCH_FACTS_FILE_VERSION), startedAt: import_zod9.z.number(), facts: ContextFactsSchema });
5328
5364
  }
5329
5365
  });
5330
5366
 
@@ -13876,7 +13912,7 @@ var init_package = __esm({
13876
13912
  "package.json"() {
13877
13913
  package_default = {
13878
13914
  name: "claude-use",
13879
- version: "14.0.4",
13915
+ version: "14.2.0",
13880
13916
  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
13917
  license: "MIT",
13882
13918
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -15661,6 +15697,21 @@ var init_catalogueCredential = __esm({
15661
15697
  }
15662
15698
  });
15663
15699
 
15700
+ // src/models/tiers.ts
15701
+ var TIER_ENV_VARIABLES;
15702
+ var init_tiers = __esm({
15703
+ "src/models/tiers.ts"() {
15704
+ "use strict";
15705
+ init_schema();
15706
+ TIER_ENV_VARIABLES = Object.freeze({
15707
+ fable: "ANTHROPIC_DEFAULT_FABLE_MODEL",
15708
+ opus: "ANTHROPIC_DEFAULT_OPUS_MODEL",
15709
+ sonnet: "ANTHROPIC_DEFAULT_SONNET_MODEL",
15710
+ haiku: "ANTHROPIC_DEFAULT_HAIKU_MODEL"
15711
+ });
15712
+ }
15713
+ });
15714
+
15664
15715
  // src/selection/engine.ts
15665
15716
  var init_engine = __esm({
15666
15717
  "src/selection/engine.ts"() {
@@ -15815,6 +15866,7 @@ var init_translate = __esm({
15815
15866
  "src/antigravity/translate.ts"() {
15816
15867
  "use strict";
15817
15868
  init_identity2();
15869
+ init_tiers();
15818
15870
  init_engine();
15819
15871
  init_quota();
15820
15872
  init_signatures();
@@ -15842,6 +15894,7 @@ function resolveCodexConfig(config) {
15842
15894
  var init_translate2 = __esm({
15843
15895
  "src/codex/translate.ts"() {
15844
15896
  "use strict";
15897
+ init_tiers();
15845
15898
  init_schema();
15846
15899
  init_anthropic();
15847
15900
  }
@@ -15965,7 +16018,7 @@ function safeExpand(name, models) {
15965
16018
  function modelPickerSettingsFromRows(options, replaceBuiltInOptions) {
15966
16019
  return options.length === 0 ? void 0 : JSON.stringify({ modelPicker: { options, replaceBuiltInOptions } });
15967
16020
  }
15968
- var TIER_BEHAVES_AS, TIER_ENV_VARIABLES;
16021
+ var TIER_BEHAVES_AS;
15969
16022
  var init_modelPicker = __esm({
15970
16023
  "src/launcher/modelPicker.ts"() {
15971
16024
  "use strict";
@@ -15976,18 +16029,13 @@ var init_modelPicker = __esm({
15976
16029
  init_identity2();
15977
16030
  init_families();
15978
16031
  init_modelsStore();
16032
+ init_tiers();
15979
16033
  TIER_BEHAVES_AS = Object.freeze({
15980
16034
  fable: "claude-fable-5-1",
15981
16035
  opus: "claude-opus-5-5",
15982
16036
  sonnet: "claude-sonnet-5-5",
15983
16037
  haiku: "claude-haiku-5-5"
15984
16038
  });
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
16039
  }
15992
16040
  });
15993
16041
 
@@ -16784,6 +16832,7 @@ function buildEnv(params) {
16784
16832
  launcherHeaders
16785
16833
  );
16786
16834
  inject("NODE_EXTRA_CA_CERTS", params.frontdoor.trustBundlePath);
16835
+ inject("CLAUDE_CODE_GATEWAY_HINT_HEADERS", "1");
16787
16836
  inject("HTTPS_PROXY", connectProxyUrl(params.frontdoor.connectPort, params.frontdoor.sessionToken));
16788
16837
  const bypassed = [...LOOPBACK_HOSTS, ...params.proxyBypass ?? []];
16789
16838
  for (const list of ["NO_PROXY", "no_proxy"]) {
@@ -25946,12 +25995,14 @@ function createLiveSessionRegistry(ports) {
25946
25995
  let tokens = /* @__PURE__ */ new Set();
25947
25996
  let byToken = /* @__PURE__ */ new Map();
25948
25997
  let bySessionId = /* @__PURE__ */ new Map();
25998
+ let launches = /* @__PURE__ */ new Set();
25949
25999
  const recordNames = () => fs17.readdir(sessionsDir).filter(isSessionRecordName);
25950
26000
  const rebuildIndexes = () => {
25951
26001
  const records = [...known.values()].flatMap(({ record }) => record === void 0 ? [] : [record]);
25952
26002
  tokens = new Set(records.map((record) => record.token));
25953
26003
  byToken = new Map(records.map((record) => [record.token, record]));
25954
26004
  bySessionId = new Map(records.flatMap((record) => record.sessionId === void 0 ? [] : [[record.sessionId, record]]));
26005
+ launches = new Set(records.map(launchKeyOf));
25955
26006
  };
25956
26007
  const load = (name, stat) => {
25957
26008
  known.set(name, { stat: { mtimeMs: stat.mtimeMs, sizeBytes: stat.sizeBytes }, record: readFrontDoorSessionRecord(fs17, sessionsDir, name) });
@@ -25993,6 +26044,11 @@ function createLiveSessionRegistry(ports) {
25993
26044
  const held = bySessionId.get(sessionId) ?? (reconcile() ? bySessionId.get(sessionId) : void 0);
25994
26045
  return held?.models;
25995
26046
  },
26047
+ launchOfToken: (token) => {
26048
+ const held = byToken.get(token) ?? (reconcile() ? byToken.get(token) : void 0);
26049
+ return held?.sessionId === void 0 ? void 0 : { pid: held.pid, startedAt: held.startedAt };
26050
+ },
26051
+ holdsLaunch: (launch) => launches.has(launchKeyOf(launch)) || reconcile() && launches.has(launchKeyOf(launch)),
25996
26052
  rescan: () => {
25997
26053
  known.clear();
25998
26054
  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,8 @@ 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)));
5226
+ fs17.removeRecursive(path13.join(sessionsDir, launchFactsName(session.pid)));
5218
5227
  fs17.writeFilePrivate(path13.join(sessionsDir, sessionRecordName(session.pid)), `${JSON.stringify(session, null, 2)}
5219
5228
  `);
5220
5229
  }
@@ -5222,7 +5231,13 @@ function sessionRecordName(pid) {
5222
5231
  return `${String(pid)}.json`;
5223
5232
  }
5224
5233
  function isSessionRecordName(name) {
5225
- return name.endsWith(".json");
5234
+ return /^[1-9]\d*\.json$/.test(name);
5235
+ }
5236
+ function launchRouteName(pid) {
5237
+ return `${String(pid)}.route.json`;
5238
+ }
5239
+ function launchFactsName(pid) {
5240
+ return `${String(pid)}.context.json`;
5226
5241
  }
5227
5242
  function summaryOf(session) {
5228
5243
  return { pid: session.pid, startedAt: session.startedAt, ...session.supervisorPid === void 0 ? {} : { supervisorPid: session.supervisorPid } };
@@ -5245,8 +5260,14 @@ function listFrontDoorSessions(fs17, sessionsDir) {
5245
5260
  }
5246
5261
  return sessions.sort((a, b) => a.pid - b.pid);
5247
5262
  }
5263
+ function routeFilePid(name) {
5264
+ const match = /^([1-9]\d*)\.(?:route|context)\.json$/.exec(name);
5265
+ return match?.[1] === void 0 ? void 0 : Number(match[1]);
5266
+ }
5248
5267
  function removeFrontDoorSession(fs17, sessionsDir, pid) {
5249
5268
  fs17.removeRecursive(path13.join(sessionsDir, sessionRecordName(pid)));
5269
+ fs17.removeRecursive(path13.join(sessionsDir, launchRouteName(pid)));
5270
+ fs17.removeRecursive(path13.join(sessionsDir, launchFactsName(pid)));
5250
5271
  }
5251
5272
  function pruneDeadFrontDoorSessions(fs17, sessionsDir, listed, isRunning) {
5252
5273
  const removed = [];
@@ -5256,9 +5277,16 @@ function pruneDeadFrontDoorSessions(fs17, sessionsDir, listed, isRunning) {
5256
5277
  removed.push(session.pid);
5257
5278
  }
5258
5279
  }
5280
+ const names = fs17.readdir(sessionsDir);
5281
+ for (const name of names) {
5282
+ const pid = routeFilePid(name);
5283
+ if (pid !== void 0 && !names.includes(sessionRecordName(pid))) {
5284
+ fs17.removeRecursive(path13.join(sessionsDir, name));
5285
+ }
5286
+ }
5259
5287
  return removed;
5260
5288
  }
5261
- var FRONT_DOOR_PROTOCOL, FRONT_DOOR_HANDOVER_PROTOCOL, FrontDoorSessionSchema, FrontDoorStateSchema, FrontDoorDirectRecordSchema, RECORD_TEMPORARY_FILE;
5289
+ var FRONT_DOOR_PROTOCOL, FRONT_DOOR_HANDOVER_PROTOCOL, FrontDoorSessionSchema, MAX_CONTEXT_TEXT_LENGTH, ContextText, LaunchRouteSchema, ContextFactsSchema, FrontDoorStateSchema, FrontDoorDirectRecordSchema, RECORD_TEMPORARY_FILE, LAUNCH_ROUTE_FILE_VERSION, LAUNCH_FACTS_FILE_VERSION, LaunchRouteFileSchema, LaunchFactsFileSchema;
5262
5290
  var init_state = __esm({
5263
5291
  "src/frontdoor/state.ts"() {
5264
5292
  "use strict";
@@ -5268,6 +5296,10 @@ var init_state = __esm({
5268
5296
  FRONT_DOOR_PROTOCOL = 8;
5269
5297
  FRONT_DOOR_HANDOVER_PROTOCOL = 6;
5270
5298
  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() });
5299
+ MAX_CONTEXT_TEXT_LENGTH = 256;
5300
+ ContextText = z9.string().min(1).max(MAX_CONTEXT_TEXT_LENGTH);
5301
+ LaunchRouteSchema = z9.union([z9.strictObject({ kind: z9.literal("anthropic") }), z9.strictObject({ kind: z9.literal("provider"), provider: z9.string().min(1) })]);
5302
+ ContextFactsSchema = z9.strictObject({ credential: ContextText.optional(), requestedModel: ContextText.optional(), servedModel: ContextText.optional() });
5271
5303
  FrontDoorStateSchema = z9.strictObject({
5272
5304
  /**
5273
5305
  * 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 +5332,10 @@ var init_state = __esm({
5300
5332
  });
5301
5333
  FrontDoorDirectRecordSchema = z9.strictObject({ directPort: z9.number().int().positive().max(MAX_TCP_PORT) });
5302
5334
  RECORD_TEMPORARY_FILE = /^[1-9]\d*\.json\.([1-9]\d*)\.tmp$/;
5335
+ LAUNCH_ROUTE_FILE_VERSION = 1;
5336
+ LAUNCH_FACTS_FILE_VERSION = 1;
5337
+ LaunchRouteFileSchema = z9.strictObject({ version: z9.literal(LAUNCH_ROUTE_FILE_VERSION), startedAt: z9.number(), route: LaunchRouteSchema });
5338
+ LaunchFactsFileSchema = z9.strictObject({ version: z9.literal(LAUNCH_FACTS_FILE_VERSION), startedAt: z9.number(), facts: ContextFactsSchema });
5303
5339
  }
5304
5340
  });
5305
5341
 
@@ -13849,7 +13885,7 @@ var init_package = __esm({
13849
13885
  "package.json"() {
13850
13886
  package_default = {
13851
13887
  name: "claude-use",
13852
- version: "14.0.4",
13888
+ version: "14.2.0",
13853
13889
  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
13890
  license: "MIT",
13855
13891
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -15632,6 +15668,21 @@ var init_catalogueCredential = __esm({
15632
15668
  }
15633
15669
  });
15634
15670
 
15671
+ // src/models/tiers.ts
15672
+ var TIER_ENV_VARIABLES;
15673
+ var init_tiers = __esm({
15674
+ "src/models/tiers.ts"() {
15675
+ "use strict";
15676
+ init_schema();
15677
+ TIER_ENV_VARIABLES = Object.freeze({
15678
+ fable: "ANTHROPIC_DEFAULT_FABLE_MODEL",
15679
+ opus: "ANTHROPIC_DEFAULT_OPUS_MODEL",
15680
+ sonnet: "ANTHROPIC_DEFAULT_SONNET_MODEL",
15681
+ haiku: "ANTHROPIC_DEFAULT_HAIKU_MODEL"
15682
+ });
15683
+ }
15684
+ });
15685
+
15635
15686
  // src/selection/engine.ts
15636
15687
  var init_engine = __esm({
15637
15688
  "src/selection/engine.ts"() {
@@ -15786,6 +15837,7 @@ var init_translate = __esm({
15786
15837
  "src/antigravity/translate.ts"() {
15787
15838
  "use strict";
15788
15839
  init_identity2();
15840
+ init_tiers();
15789
15841
  init_engine();
15790
15842
  init_quota();
15791
15843
  init_signatures();
@@ -15813,6 +15865,7 @@ function resolveCodexConfig(config) {
15813
15865
  var init_translate2 = __esm({
15814
15866
  "src/codex/translate.ts"() {
15815
15867
  "use strict";
15868
+ init_tiers();
15816
15869
  init_schema();
15817
15870
  init_anthropic();
15818
15871
  }
@@ -15936,7 +15989,7 @@ function safeExpand(name, models) {
15936
15989
  function modelPickerSettingsFromRows(options, replaceBuiltInOptions) {
15937
15990
  return options.length === 0 ? void 0 : JSON.stringify({ modelPicker: { options, replaceBuiltInOptions } });
15938
15991
  }
15939
- var TIER_BEHAVES_AS, TIER_ENV_VARIABLES;
15992
+ var TIER_BEHAVES_AS;
15940
15993
  var init_modelPicker = __esm({
15941
15994
  "src/launcher/modelPicker.ts"() {
15942
15995
  "use strict";
@@ -15947,18 +16000,13 @@ var init_modelPicker = __esm({
15947
16000
  init_identity2();
15948
16001
  init_families();
15949
16002
  init_modelsStore();
16003
+ init_tiers();
15950
16004
  TIER_BEHAVES_AS = Object.freeze({
15951
16005
  fable: "claude-fable-5-1",
15952
16006
  opus: "claude-opus-5-5",
15953
16007
  sonnet: "claude-sonnet-5-5",
15954
16008
  haiku: "claude-haiku-5-5"
15955
16009
  });
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
16010
  }
15963
16011
  });
15964
16012
 
@@ -16755,6 +16803,7 @@ function buildEnv(params) {
16755
16803
  launcherHeaders
16756
16804
  );
16757
16805
  inject("NODE_EXTRA_CA_CERTS", params.frontdoor.trustBundlePath);
16806
+ inject("CLAUDE_CODE_GATEWAY_HINT_HEADERS", "1");
16758
16807
  inject("HTTPS_PROXY", connectProxyUrl(params.frontdoor.connectPort, params.frontdoor.sessionToken));
16759
16808
  const bypassed = [...LOOPBACK_HOSTS, ...params.proxyBypass ?? []];
16760
16809
  for (const list of ["NO_PROXY", "no_proxy"]) {
@@ -25495,12 +25544,14 @@ function createLiveSessionRegistry(ports) {
25495
25544
  let tokens = /* @__PURE__ */ new Set();
25496
25545
  let byToken = /* @__PURE__ */ new Map();
25497
25546
  let bySessionId = /* @__PURE__ */ new Map();
25547
+ let launches = /* @__PURE__ */ new Set();
25498
25548
  const recordNames = () => fs17.readdir(sessionsDir).filter(isSessionRecordName);
25499
25549
  const rebuildIndexes = () => {
25500
25550
  const records = [...known.values()].flatMap(({ record }) => record === void 0 ? [] : [record]);
25501
25551
  tokens = new Set(records.map((record) => record.token));
25502
25552
  byToken = new Map(records.map((record) => [record.token, record]));
25503
25553
  bySessionId = new Map(records.flatMap((record) => record.sessionId === void 0 ? [] : [[record.sessionId, record]]));
25554
+ launches = new Set(records.map(launchKeyOf));
25504
25555
  };
25505
25556
  const load = (name, stat) => {
25506
25557
  known.set(name, { stat: { mtimeMs: stat.mtimeMs, sizeBytes: stat.sizeBytes }, record: readFrontDoorSessionRecord(fs17, sessionsDir, name) });
@@ -25542,6 +25593,11 @@ function createLiveSessionRegistry(ports) {
25542
25593
  const held = bySessionId.get(sessionId) ?? (reconcile() ? bySessionId.get(sessionId) : void 0);
25543
25594
  return held?.models;
25544
25595
  },
25596
+ launchOfToken: (token) => {
25597
+ const held = byToken.get(token) ?? (reconcile() ? byToken.get(token) : void 0);
25598
+ return held?.sessionId === void 0 ? void 0 : { pid: held.pid, startedAt: held.startedAt };
25599
+ },
25600
+ holdsLaunch: (launch) => launches.has(launchKeyOf(launch)) || reconcile() && launches.has(launchKeyOf(launch)),
25545
25601
  rescan: () => {
25546
25602
  known.clear();
25547
25603
  for (const name of recordNames()) {