claude-use 11.72.0 → 11.72.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
@@ -37387,7 +37387,7 @@ var init_package = __esm({
37387
37387
  "package.json"() {
37388
37388
  package_default = {
37389
37389
  name: "claude-use",
37390
- version: "11.72.0",
37390
+ version: "11.72.2",
37391
37391
  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.",
37392
37392
  license: "MIT",
37393
37393
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -38399,36 +38399,71 @@ function readUsageLog(fs31, logDir, options = {}) {
38399
38399
  if (sinceMs !== void 0 && segment.endsAt <= sinceMs) {
38400
38400
  continue;
38401
38401
  }
38402
- const contents = fs31.readFileUtf8(import_node_path26.default.join(logDir, segment.name));
38403
- if (contents === void 0) {
38402
+ const read = readSegment(fs31, logDir, segment);
38403
+ if (read === void 0) {
38404
38404
  continue;
38405
38405
  }
38406
- const lines = contents.split("\n");
38407
- lines.pop();
38408
- for (const line of lines) {
38409
- if (line === "") {
38410
- continue;
38411
- }
38412
- let raw;
38413
- try {
38414
- raw = JSON.parse(line);
38415
- } catch {
38416
- invalidLines += 1;
38417
- continue;
38418
- }
38419
- const parsed = UsageRecordSchema.safeParse(raw);
38420
- if (!parsed.success) {
38421
- invalidLines += 1;
38422
- continue;
38423
- }
38424
- if (sinceMs === void 0 || Date.parse(parsed.data.at) >= sinceMs) {
38425
- records.push(parsed.data);
38406
+ invalidLines += read.invalidLines;
38407
+ for (const record2 of read.records) {
38408
+ if (sinceMs === void 0 || Date.parse(record2.at) >= sinceMs) {
38409
+ records.push(record2);
38426
38410
  }
38427
38411
  }
38428
38412
  }
38429
38413
  records.sort((left, right) => left.at.localeCompare(right.at));
38430
38414
  return { records, invalidLines };
38431
38415
  }
38416
+ function readSegment(fs31, logDir, segment) {
38417
+ const contents = fs31.readFileUtf8(import_node_path26.default.join(logDir, segment.name));
38418
+ if (contents === void 0) {
38419
+ return void 0;
38420
+ }
38421
+ const records = [];
38422
+ let invalidLines = 0;
38423
+ const lines = contents.split("\n");
38424
+ lines.pop();
38425
+ for (const line of lines) {
38426
+ if (line === "") {
38427
+ continue;
38428
+ }
38429
+ let raw;
38430
+ try {
38431
+ raw = JSON.parse(line);
38432
+ } catch {
38433
+ invalidLines += 1;
38434
+ continue;
38435
+ }
38436
+ const parsed = UsageRecordSchema.safeParse(raw);
38437
+ if (!parsed.success) {
38438
+ invalidLines += 1;
38439
+ continue;
38440
+ }
38441
+ records.push(parsed.data);
38442
+ }
38443
+ return { records, invalidLines };
38444
+ }
38445
+ function readRecentUsageRecords(fs31, logDir, count2) {
38446
+ const byDay = /* @__PURE__ */ new Map();
38447
+ for (const segment of listLogSegments(fs31, logDir)) {
38448
+ byDay.set(segment.day, [...byDay.get(segment.day) ?? [], segment]);
38449
+ }
38450
+ const days = [...byDay.values()];
38451
+ let records = [];
38452
+ for (let index = days.length - 1; index >= 0; index -= 1) {
38453
+ const dayRecords = [];
38454
+ for (const segment of days[index] ?? []) {
38455
+ dayRecords.push(...readSegment(fs31, logDir, segment)?.records ?? []);
38456
+ }
38457
+ records = [...dayRecords, ...records];
38458
+ records.sort((left, right) => left.at.localeCompare(right.at));
38459
+ const olderDay = days[index - 1]?.[0];
38460
+ const newestHeld = records[records.length - count2];
38461
+ if (olderDay === void 0 || newestHeld !== void 0 && Date.parse(newestHeld.at) >= olderDay.endsAt) {
38462
+ break;
38463
+ }
38464
+ }
38465
+ return records.slice(-count2);
38466
+ }
38432
38467
  function snapshotPath(snapshotsDir, identity) {
38433
38468
  if (!isIdentityName(identity)) {
38434
38469
  throw new Error(`"${identity}" is not a valid identity name.`);
@@ -119889,7 +119924,7 @@ function blendedPricePerMTok(prices, mix) {
119889
119924
  var SEED_LOOKBACK_RECORDS = 500;
119890
119925
  function createTargetObservationStore(fs31, paths) {
119891
119926
  let observations = /* @__PURE__ */ new Map();
119892
- const seeded = readUsageLog(fs31, paths.usageLogDir, {}).records.slice(-SEED_LOOKBACK_RECORDS);
119927
+ const seeded = readRecentUsageRecords(fs31, paths.usageLogDir, SEED_LOOKBACK_RECORDS);
119893
119928
  for (const record2 of seeded) {
119894
119929
  observations = observeRecord(observations, record2);
119895
119930
  }
@@ -120913,6 +120948,13 @@ function mergeLiveTasks(tree, live) {
120913
120948
 
120914
120949
  // src/frontdoor/rcSessions.ts
120915
120950
  var RC_SESSIONS_PATH_PREFIX = "/v1/code/sessions";
120951
+ function pathnameOf(url2) {
120952
+ return new URL(url2 ?? "/", "http://127.0.0.1").pathname;
120953
+ }
120954
+ function isRcSessionExchange(url2) {
120955
+ const path73 = pathnameOf(url2);
120956
+ return path73 === RC_SESSIONS_PATH_PREFIX || path73.startsWith(`${RC_SESSIONS_PATH_PREFIX}/`);
120957
+ }
120916
120958
  var RC_SESSION_ID_PREFIX = "cse_";
120917
120959
  var RC_IDLE_EXPIRY_MS = 45e3;
120918
120960
  var RC_CREATE_RESPONSE_CAP_BYTES = 8192;
@@ -121077,11 +121119,10 @@ function createRcSessionTracker(deps) {
121077
121119
  };
121078
121120
  const observeExchange = (request7) => {
121079
121121
  const method = (request7.method ?? "").toUpperCase();
121080
- const path73 = new URL(request7.url ?? "/", "http://127.0.0.1").pathname;
121081
- if (!path73.startsWith(RC_SESSIONS_PATH_PREFIX)) {
121122
+ if (!isRcSessionExchange(request7.url)) {
121082
121123
  return void 0;
121083
121124
  }
121084
- const tail = path73.slice(RC_SESSIONS_PATH_PREFIX.length);
121125
+ const tail = pathnameOf(request7.url).slice(RC_SESSIONS_PATH_PREFIX.length);
121085
121126
  const facts = {
121086
121127
  oauthAuthorization: oauthAuthorizationOf(request7.headers),
121087
121128
  anthropicVersion: singleHeader(request7.headers, "anthropic-version"),
@@ -134286,6 +134327,10 @@ async function collectBody(body) {
134286
134327
  resolve3(result);
134287
134328
  }
134288
134329
  };
134330
+ if (body.destroyed) {
134331
+ settle2({ kind: "failed" });
134332
+ return;
134333
+ }
134289
134334
  body.on("data", (chunk2) => {
134290
134335
  if (settled) {
134291
134336
  return;
@@ -134309,6 +134354,9 @@ async function collectBody(body) {
134309
134354
  body.on("error", () => {
134310
134355
  settle2({ kind: "failed" });
134311
134356
  });
134357
+ body.on("close", () => {
134358
+ settle2({ kind: "failed" });
134359
+ });
134312
134360
  });
134313
134361
  }
134314
134362
  function requestedModelOf(body) {
@@ -139201,6 +139249,7 @@ function createRcEventFanout() {
139201
139249
  function createRcStreamHub(deps) {
139202
139250
  const attachments = /* @__PURE__ */ new Map();
139203
139251
  let closed = false;
139252
+ const refusedAuthorizations = /* @__PURE__ */ new Map();
139204
139253
  const lastSavedSequenceNums = /* @__PURE__ */ new Map();
139205
139254
  const persistCursor = (sessionId) => {
139206
139255
  if (deps.saveSequenceNum === void 0) {
@@ -139304,7 +139353,6 @@ function createRcStreamHub(deps) {
139304
139353
  };
139305
139354
  const runLoop = async (attachment) => {
139306
139355
  let retriedUnauthorized = false;
139307
- let refusedAuthorization;
139308
139356
  for (; ; ) {
139309
139357
  if (attachment.isStopped()) {
139310
139358
  return;
@@ -139320,11 +139368,11 @@ function createRcStreamHub(deps) {
139320
139368
  }
139321
139369
  return;
139322
139370
  }
139323
- if (refusedAuthorization !== void 0 && credential.authorization === refusedAuthorization) {
139371
+ if (credential.authorization === refusedAuthorizations.get(attachment.sessionId)) {
139324
139372
  await deps.sleep(deps.backoffMs);
139325
139373
  continue;
139326
139374
  }
139327
- refusedAuthorization = void 0;
139375
+ refusedAuthorizations.delete(attachment.sessionId);
139328
139376
  let outcome;
139329
139377
  try {
139330
139378
  outcome = await attempt(attachment, credential);
@@ -139352,7 +139400,7 @@ function createRcStreamHub(deps) {
139352
139400
  continue;
139353
139401
  }
139354
139402
  deps.log?.(`rc stream ${attachment.sessionId}: the client read stream refused the observed Authorization bearer past one retry; waiting for a fresh one`);
139355
- refusedAuthorization = credential.authorization;
139403
+ refusedAuthorizations.set(attachment.sessionId, credential.authorization);
139356
139404
  await deps.sleep(deps.backoffMs);
139357
139405
  retriedUnauthorized = false;
139358
139406
  }
@@ -139392,6 +139440,7 @@ function createRcStreamHub(deps) {
139392
139440
  attachment.stop();
139393
139441
  }
139394
139442
  attachments.clear();
139443
+ refusedAuthorizations.clear();
139395
139444
  }
139396
139445
  };
139397
139446
  }
@@ -139794,9 +139843,13 @@ function respawnInvocation(paths) {
139794
139843
  function rcObservingResolver(resolve3, tracker, hub) {
139795
139844
  return async (request7) => {
139796
139845
  const resolution = await resolve3(request7);
139797
- return resolution.ok ? { ...resolution, route: observingRoutedRoute(resolution.route, tracker, hub === void 0 ? void 0 : { onExchangeSettled: () => {
139846
+ if (!resolution.ok) {
139847
+ return resolution;
139848
+ }
139849
+ const observing = observingRoutedRoute(resolution.route, tracker, hub === void 0 ? void 0 : { onExchangeSettled: () => {
139798
139850
  hub.reconcile();
139799
- } }) } : resolution;
139851
+ } });
139852
+ return { ...resolution, route: isRcSessionExchange(request7.url) ? { ...observing, headroomEligible: false } : observing };
139800
139853
  };
139801
139854
  }
139802
139855
  function realStatOwnExecutable(watchPath) {
@@ -140022,10 +140075,8 @@ function realFrontDoorSupervisorPorts(paths, respawnGeneration, lifecycle, track
140022
140075
  catalogueKeeper.tick();
140023
140076
  everyFreshnessInterval(catalogueKeeper.tick);
140024
140077
  const headroomDecision = createHeadroomDecision(createRoutingSettingReader(paths));
140025
- const targetObservations = createTargetObservationStore(realFarmFs, paths);
140026
140078
  const recordUsage = (record2) => {
140027
140079
  withQuotaRefresh(usageStore.record, quotaRefresher)(record2);
140028
- targetObservations.observe(record2);
140029
140080
  };
140030
140081
  const usageMiddleware = createUsageMiddleware({
140031
140082
  // Each finished response also tells the per-session headroom decision when the session's cache was last touched and whether it read from it.
package/dist/index.cjs CHANGED
@@ -4762,7 +4762,7 @@ var init_package = __esm({
4762
4762
  "package.json"() {
4763
4763
  package_default = {
4764
4764
  name: "claude-use",
4765
- version: "11.72.0",
4765
+ version: "11.72.2",
4766
4766
  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.",
4767
4767
  license: "MIT",
4768
4768
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -7606,36 +7606,49 @@ function readUsageLog(fs14, logDir, options = {}) {
7606
7606
  if (sinceMs !== void 0 && segment.endsAt <= sinceMs) {
7607
7607
  continue;
7608
7608
  }
7609
- const contents = fs14.readFileUtf8(import_node_path20.default.join(logDir, segment.name));
7610
- if (contents === void 0) {
7609
+ const read = readSegment(fs14, logDir, segment);
7610
+ if (read === void 0) {
7611
7611
  continue;
7612
7612
  }
7613
- const lines = contents.split("\n");
7614
- lines.pop();
7615
- for (const line of lines) {
7616
- if (line === "") {
7617
- continue;
7618
- }
7619
- let raw;
7620
- try {
7621
- raw = JSON.parse(line);
7622
- } catch {
7623
- invalidLines += 1;
7624
- continue;
7625
- }
7626
- const parsed = UsageRecordSchema.safeParse(raw);
7627
- if (!parsed.success) {
7628
- invalidLines += 1;
7629
- continue;
7630
- }
7631
- if (sinceMs === void 0 || Date.parse(parsed.data.at) >= sinceMs) {
7632
- records.push(parsed.data);
7613
+ invalidLines += read.invalidLines;
7614
+ for (const record of read.records) {
7615
+ if (sinceMs === void 0 || Date.parse(record.at) >= sinceMs) {
7616
+ records.push(record);
7633
7617
  }
7634
7618
  }
7635
7619
  }
7636
7620
  records.sort((left, right) => left.at.localeCompare(right.at));
7637
7621
  return { records, invalidLines };
7638
7622
  }
7623
+ function readSegment(fs14, logDir, segment) {
7624
+ const contents = fs14.readFileUtf8(import_node_path20.default.join(logDir, segment.name));
7625
+ if (contents === void 0) {
7626
+ return void 0;
7627
+ }
7628
+ const records = [];
7629
+ let invalidLines = 0;
7630
+ const lines = contents.split("\n");
7631
+ lines.pop();
7632
+ for (const line of lines) {
7633
+ if (line === "") {
7634
+ continue;
7635
+ }
7636
+ let raw;
7637
+ try {
7638
+ raw = JSON.parse(line);
7639
+ } catch {
7640
+ invalidLines += 1;
7641
+ continue;
7642
+ }
7643
+ const parsed = UsageRecordSchema.safeParse(raw);
7644
+ if (!parsed.success) {
7645
+ invalidLines += 1;
7646
+ continue;
7647
+ }
7648
+ records.push(parsed.data);
7649
+ }
7650
+ return { records, invalidLines };
7651
+ }
7639
7652
  function snapshotPath(snapshotsDir, identity) {
7640
7653
  if (!isIdentityName(identity)) {
7641
7654
  throw new Error(`"${identity}" is not a valid identity name.`);
@@ -13454,6 +13467,13 @@ function mergeLiveTasks(tree, live) {
13454
13467
 
13455
13468
  // src/frontdoor/rcSessions.ts
13456
13469
  var RC_SESSIONS_PATH_PREFIX = "/v1/code/sessions";
13470
+ function pathnameOf(url) {
13471
+ return new URL(url ?? "/", "http://127.0.0.1").pathname;
13472
+ }
13473
+ function isRcSessionExchange(url) {
13474
+ const path42 = pathnameOf(url);
13475
+ return path42 === RC_SESSIONS_PATH_PREFIX || path42.startsWith(`${RC_SESSIONS_PATH_PREFIX}/`);
13476
+ }
13457
13477
  var RC_SESSION_ID_PREFIX = "cse_";
13458
13478
  var RC_IDLE_EXPIRY_MS = 45e3;
13459
13479
  var RC_CREATE_RESPONSE_CAP_BYTES = 8192;
@@ -13618,11 +13638,10 @@ function createRcSessionTracker(deps) {
13618
13638
  };
13619
13639
  const observeExchange = (request4) => {
13620
13640
  const method = (request4.method ?? "").toUpperCase();
13621
- const path42 = new URL(request4.url ?? "/", "http://127.0.0.1").pathname;
13622
- if (!path42.startsWith(RC_SESSIONS_PATH_PREFIX)) {
13641
+ if (!isRcSessionExchange(request4.url)) {
13623
13642
  return void 0;
13624
13643
  }
13625
- const tail = path42.slice(RC_SESSIONS_PATH_PREFIX.length);
13644
+ const tail = pathnameOf(request4.url).slice(RC_SESSIONS_PATH_PREFIX.length);
13626
13645
  const facts = {
13627
13646
  oauthAuthorization: oauthAuthorizationOf(request4.headers),
13628
13647
  anthropicVersion: singleHeader(request4.headers, "anthropic-version"),
@@ -19527,6 +19546,7 @@ function createRcEventFanout() {
19527
19546
  function createRcStreamHub(deps) {
19528
19547
  const attachments = /* @__PURE__ */ new Map();
19529
19548
  let closed = false;
19549
+ const refusedAuthorizations = /* @__PURE__ */ new Map();
19530
19550
  const lastSavedSequenceNums = /* @__PURE__ */ new Map();
19531
19551
  const persistCursor = (sessionId) => {
19532
19552
  if (deps.saveSequenceNum === void 0) {
@@ -19630,7 +19650,6 @@ function createRcStreamHub(deps) {
19630
19650
  };
19631
19651
  const runLoop = async (attachment) => {
19632
19652
  let retriedUnauthorized = false;
19633
- let refusedAuthorization;
19634
19653
  for (; ; ) {
19635
19654
  if (attachment.isStopped()) {
19636
19655
  return;
@@ -19646,11 +19665,11 @@ function createRcStreamHub(deps) {
19646
19665
  }
19647
19666
  return;
19648
19667
  }
19649
- if (refusedAuthorization !== void 0 && credential.authorization === refusedAuthorization) {
19668
+ if (credential.authorization === refusedAuthorizations.get(attachment.sessionId)) {
19650
19669
  await deps.sleep(deps.backoffMs);
19651
19670
  continue;
19652
19671
  }
19653
- refusedAuthorization = void 0;
19672
+ refusedAuthorizations.delete(attachment.sessionId);
19654
19673
  let outcome;
19655
19674
  try {
19656
19675
  outcome = await attempt(attachment, credential);
@@ -19678,7 +19697,7 @@ function createRcStreamHub(deps) {
19678
19697
  continue;
19679
19698
  }
19680
19699
  deps.log?.(`rc stream ${attachment.sessionId}: the client read stream refused the observed Authorization bearer past one retry; waiting for a fresh one`);
19681
- refusedAuthorization = credential.authorization;
19700
+ refusedAuthorizations.set(attachment.sessionId, credential.authorization);
19682
19701
  await deps.sleep(deps.backoffMs);
19683
19702
  retriedUnauthorized = false;
19684
19703
  }
@@ -19718,6 +19737,7 @@ function createRcStreamHub(deps) {
19718
19737
  attachment.stop();
19719
19738
  }
19720
19739
  attachments.clear();
19740
+ refusedAuthorizations.clear();
19721
19741
  }
19722
19742
  };
19723
19743
  }
package/dist/index.mjs CHANGED
@@ -4738,7 +4738,7 @@ var init_package = __esm({
4738
4738
  "package.json"() {
4739
4739
  package_default = {
4740
4740
  name: "claude-use",
4741
- version: "11.72.0",
4741
+ version: "11.72.2",
4742
4742
  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.",
4743
4743
  license: "MIT",
4744
4744
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -7582,36 +7582,49 @@ function readUsageLog(fs14, logDir, options = {}) {
7582
7582
  if (sinceMs !== void 0 && segment.endsAt <= sinceMs) {
7583
7583
  continue;
7584
7584
  }
7585
- const contents = fs14.readFileUtf8(path20.join(logDir, segment.name));
7586
- if (contents === void 0) {
7585
+ const read = readSegment(fs14, logDir, segment);
7586
+ if (read === void 0) {
7587
7587
  continue;
7588
7588
  }
7589
- const lines = contents.split("\n");
7590
- lines.pop();
7591
- for (const line of lines) {
7592
- if (line === "") {
7593
- continue;
7594
- }
7595
- let raw;
7596
- try {
7597
- raw = JSON.parse(line);
7598
- } catch {
7599
- invalidLines += 1;
7600
- continue;
7601
- }
7602
- const parsed = UsageRecordSchema.safeParse(raw);
7603
- if (!parsed.success) {
7604
- invalidLines += 1;
7605
- continue;
7606
- }
7607
- if (sinceMs === void 0 || Date.parse(parsed.data.at) >= sinceMs) {
7608
- records.push(parsed.data);
7589
+ invalidLines += read.invalidLines;
7590
+ for (const record of read.records) {
7591
+ if (sinceMs === void 0 || Date.parse(record.at) >= sinceMs) {
7592
+ records.push(record);
7609
7593
  }
7610
7594
  }
7611
7595
  }
7612
7596
  records.sort((left, right) => left.at.localeCompare(right.at));
7613
7597
  return { records, invalidLines };
7614
7598
  }
7599
+ function readSegment(fs14, logDir, segment) {
7600
+ const contents = fs14.readFileUtf8(path20.join(logDir, segment.name));
7601
+ if (contents === void 0) {
7602
+ return void 0;
7603
+ }
7604
+ const records = [];
7605
+ let invalidLines = 0;
7606
+ const lines = contents.split("\n");
7607
+ lines.pop();
7608
+ for (const line of lines) {
7609
+ if (line === "") {
7610
+ continue;
7611
+ }
7612
+ let raw;
7613
+ try {
7614
+ raw = JSON.parse(line);
7615
+ } catch {
7616
+ invalidLines += 1;
7617
+ continue;
7618
+ }
7619
+ const parsed = UsageRecordSchema.safeParse(raw);
7620
+ if (!parsed.success) {
7621
+ invalidLines += 1;
7622
+ continue;
7623
+ }
7624
+ records.push(parsed.data);
7625
+ }
7626
+ return { records, invalidLines };
7627
+ }
7615
7628
  function snapshotPath(snapshotsDir, identity) {
7616
7629
  if (!isIdentityName(identity)) {
7617
7630
  throw new Error(`"${identity}" is not a valid identity name.`);
@@ -13039,6 +13052,13 @@ function mergeLiveTasks(tree, live) {
13039
13052
 
13040
13053
  // src/frontdoor/rcSessions.ts
13041
13054
  var RC_SESSIONS_PATH_PREFIX = "/v1/code/sessions";
13055
+ function pathnameOf(url) {
13056
+ return new URL(url ?? "/", "http://127.0.0.1").pathname;
13057
+ }
13058
+ function isRcSessionExchange(url) {
13059
+ const path42 = pathnameOf(url);
13060
+ return path42 === RC_SESSIONS_PATH_PREFIX || path42.startsWith(`${RC_SESSIONS_PATH_PREFIX}/`);
13061
+ }
13042
13062
  var RC_SESSION_ID_PREFIX = "cse_";
13043
13063
  var RC_IDLE_EXPIRY_MS = 45e3;
13044
13064
  var RC_CREATE_RESPONSE_CAP_BYTES = 8192;
@@ -13203,11 +13223,10 @@ function createRcSessionTracker(deps) {
13203
13223
  };
13204
13224
  const observeExchange = (request4) => {
13205
13225
  const method = (request4.method ?? "").toUpperCase();
13206
- const path42 = new URL(request4.url ?? "/", "http://127.0.0.1").pathname;
13207
- if (!path42.startsWith(RC_SESSIONS_PATH_PREFIX)) {
13226
+ if (!isRcSessionExchange(request4.url)) {
13208
13227
  return void 0;
13209
13228
  }
13210
- const tail = path42.slice(RC_SESSIONS_PATH_PREFIX.length);
13229
+ const tail = pathnameOf(request4.url).slice(RC_SESSIONS_PATH_PREFIX.length);
13211
13230
  const facts = {
13212
13231
  oauthAuthorization: oauthAuthorizationOf(request4.headers),
13213
13232
  anthropicVersion: singleHeader(request4.headers, "anthropic-version"),
@@ -19112,6 +19131,7 @@ function createRcEventFanout() {
19112
19131
  function createRcStreamHub(deps) {
19113
19132
  const attachments = /* @__PURE__ */ new Map();
19114
19133
  let closed = false;
19134
+ const refusedAuthorizations = /* @__PURE__ */ new Map();
19115
19135
  const lastSavedSequenceNums = /* @__PURE__ */ new Map();
19116
19136
  const persistCursor = (sessionId) => {
19117
19137
  if (deps.saveSequenceNum === void 0) {
@@ -19215,7 +19235,6 @@ function createRcStreamHub(deps) {
19215
19235
  };
19216
19236
  const runLoop = async (attachment) => {
19217
19237
  let retriedUnauthorized = false;
19218
- let refusedAuthorization;
19219
19238
  for (; ; ) {
19220
19239
  if (attachment.isStopped()) {
19221
19240
  return;
@@ -19231,11 +19250,11 @@ function createRcStreamHub(deps) {
19231
19250
  }
19232
19251
  return;
19233
19252
  }
19234
- if (refusedAuthorization !== void 0 && credential.authorization === refusedAuthorization) {
19253
+ if (credential.authorization === refusedAuthorizations.get(attachment.sessionId)) {
19235
19254
  await deps.sleep(deps.backoffMs);
19236
19255
  continue;
19237
19256
  }
19238
- refusedAuthorization = void 0;
19257
+ refusedAuthorizations.delete(attachment.sessionId);
19239
19258
  let outcome;
19240
19259
  try {
19241
19260
  outcome = await attempt(attachment, credential);
@@ -19263,7 +19282,7 @@ function createRcStreamHub(deps) {
19263
19282
  continue;
19264
19283
  }
19265
19284
  deps.log?.(`rc stream ${attachment.sessionId}: the client read stream refused the observed Authorization bearer past one retry; waiting for a fresh one`);
19266
- refusedAuthorization = credential.authorization;
19285
+ refusedAuthorizations.set(attachment.sessionId, credential.authorization);
19267
19286
  await deps.sleep(deps.backoffMs);
19268
19287
  retriedUnauthorized = false;
19269
19288
  }
@@ -19303,6 +19322,7 @@ function createRcStreamHub(deps) {
19303
19322
  attachment.stop();
19304
19323
  }
19305
19324
  attachments.clear();
19325
+ refusedAuthorizations.clear();
19306
19326
  }
19307
19327
  };
19308
19328
  }
@@ -297,8 +297,8 @@ declare const LaunchSchema: z.ZodObject<{
297
297
  }>>;
298
298
  layout: z.ZodOptional<z.ZodObject<{
299
299
  header: z.ZodOptional<z.ZodArray<z.ZodEnum<{
300
- account: "account";
301
300
  model: "model";
301
+ account: "account";
302
302
  identity: "identity";
303
303
  provider: "provider";
304
304
  version: "version";
@@ -1525,8 +1525,8 @@ declare const ConfigProfileSchema: z.ZodObject<{
1525
1525
  }>>;
1526
1526
  layout: z.ZodOptional<z.ZodObject<{
1527
1527
  header: z.ZodOptional<z.ZodArray<z.ZodEnum<{
1528
- account: "account";
1529
1528
  model: "model";
1529
+ account: "account";
1530
1530
  identity: "identity";
1531
1531
  provider: "provider";
1532
1532
  version: "version";
@@ -2373,8 +2373,8 @@ declare const DirectoryRuleSchema: z.ZodObject<{
2373
2373
  }>>;
2374
2374
  layout: z.ZodOptional<z.ZodObject<{
2375
2375
  header: z.ZodOptional<z.ZodArray<z.ZodEnum<{
2376
- account: "account";
2377
2376
  model: "model";
2377
+ account: "account";
2378
2378
  identity: "identity";
2379
2379
  provider: "provider";
2380
2380
  version: "version";
@@ -3148,8 +3148,8 @@ declare const DirectoryRulesSchema: z.ZodObject<{
3148
3148
  }>>;
3149
3149
  layout: z.ZodOptional<z.ZodObject<{
3150
3150
  header: z.ZodOptional<z.ZodArray<z.ZodEnum<{
3151
- account: "account";
3152
3151
  model: "model";
3152
+ account: "account";
3153
3153
  identity: "identity";
3154
3154
  provider: "provider";
3155
3155
  version: "version";
@@ -3923,8 +3923,8 @@ declare const PortableConfigSchema: z.ZodObject<{
3923
3923
  }>>;
3924
3924
  layout: z.ZodOptional<z.ZodObject<{
3925
3925
  header: z.ZodOptional<z.ZodArray<z.ZodEnum<{
3926
- account: "account";
3927
3926
  model: "model";
3927
+ account: "account";
3928
3928
  identity: "identity";
3929
3929
  provider: "provider";
3930
3930
  version: "version";
@@ -4679,8 +4679,8 @@ declare const GlobalConfigSchema: z.ZodObject<{
4679
4679
  }>>;
4680
4680
  layout: z.ZodOptional<z.ZodObject<{
4681
4681
  header: z.ZodOptional<z.ZodArray<z.ZodEnum<{
4682
- account: "account";
4683
4682
  model: "model";
4683
+ account: "account";
4684
4684
  identity: "identity";
4685
4685
  provider: "provider";
4686
4686
  version: "version";
@@ -9652,7 +9652,6 @@ declare function createConfigApiRouter(deps: ConfigApiDeps): {
9652
9652
  kind: zod.ZodLiteral<"profile">;
9653
9653
  name: zod.ZodString;
9654
9654
  value: zod.ZodObject<{
9655
- description: zod.ZodOptional<zod.ZodString>;
9656
9655
  entries: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodUnion<readonly [zod.ZodBoolean, zod.ZodObject<{
9657
9656
  value: zod.ZodBoolean;
9658
9657
  when: zod.ZodUnion<readonly [zod.ZodObject<{
@@ -9728,6 +9727,7 @@ declare function createConfigApiRouter(deps: ConfigApiDeps): {
9728
9727
  key: zod.ZodType<trilean.JsonValue, unknown, zod_v4_core.$ZodTypeInternals<trilean.JsonValue, unknown>>;
9729
9728
  }, zod_v4_core.$strip>], "kind">]>;
9730
9729
  }, zod_v4_core.$strict>]>>>;
9730
+ description: zod.ZodOptional<zod.ZodString>;
9731
9731
  models: zod.ZodOptional<zod.ZodObject<{
9732
9732
  virtual: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodUnion<readonly [zod.ZodObject<{
9733
9733
  mode: zod.ZodEnum<{
@@ -9815,8 +9815,8 @@ declare function createConfigApiRouter(deps: ConfigApiDeps): {
9815
9815
  }>>;
9816
9816
  layout: zod.ZodOptional<zod.ZodObject<{
9817
9817
  header: zod.ZodOptional<zod.ZodArray<zod.ZodEnum<{
9818
- account: "account";
9819
9818
  model: "model";
9819
+ account: "account";
9820
9820
  identity: "identity";
9821
9821
  provider: "provider";
9822
9822
  version: "version";
@@ -10375,7 +10375,6 @@ declare function createConfigApiRouter(deps: ConfigApiDeps): {
10375
10375
  kind: zod.ZodLiteral<"profile">;
10376
10376
  name: zod.ZodString;
10377
10377
  value: zod.ZodObject<{
10378
- description: zod.ZodOptional<zod.ZodString>;
10379
10378
  entries: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodUnion<readonly [zod.ZodBoolean, zod.ZodObject<{
10380
10379
  value: zod.ZodBoolean;
10381
10380
  when: zod.ZodUnion<readonly [zod.ZodObject<{
@@ -10451,6 +10450,7 @@ declare function createConfigApiRouter(deps: ConfigApiDeps): {
10451
10450
  key: zod.ZodType<trilean.JsonValue, unknown, zod_v4_core.$ZodTypeInternals<trilean.JsonValue, unknown>>;
10452
10451
  }, zod_v4_core.$strip>], "kind">]>;
10453
10452
  }, zod_v4_core.$strict>]>>>;
10453
+ description: zod.ZodOptional<zod.ZodString>;
10454
10454
  models: zod.ZodOptional<zod.ZodObject<{
10455
10455
  virtual: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodUnion<readonly [zod.ZodObject<{
10456
10456
  mode: zod.ZodEnum<{
@@ -10538,8 +10538,8 @@ declare function createConfigApiRouter(deps: ConfigApiDeps): {
10538
10538
  }>>;
10539
10539
  layout: zod.ZodOptional<zod.ZodObject<{
10540
10540
  header: zod.ZodOptional<zod.ZodArray<zod.ZodEnum<{
10541
- account: "account";
10542
10541
  model: "model";
10542
+ account: "account";
10543
10543
  identity: "identity";
10544
10544
  provider: "provider";
10545
10545
  version: "version";
@@ -11737,8 +11737,8 @@ declare function createConfigApiRouter(deps: ConfigApiDeps): {
11737
11737
  }>>;
11738
11738
  layout: zod.ZodOptional<zod.ZodObject<{
11739
11739
  header: zod.ZodOptional<zod.ZodArray<zod.ZodEnum<{
11740
- account: "account";
11741
11740
  model: "model";
11741
+ account: "account";
11742
11742
  identity: "identity";
11743
11743
  provider: "provider";
11744
11744
  version: "version";
@@ -12517,8 +12517,8 @@ declare function createConfigApiRouter(deps: ConfigApiDeps): {
12517
12517
  }>>;
12518
12518
  layout: zod.ZodOptional<zod.ZodObject<{
12519
12519
  header: zod.ZodOptional<zod.ZodArray<zod.ZodEnum<{
12520
- account: "account";
12521
12520
  model: "model";
12521
+ account: "account";
12522
12522
  identity: "identity";
12523
12523
  provider: "provider";
12524
12524
  version: "version";
@@ -13386,8 +13386,8 @@ declare const StatuslineSchema: z.ZodObject<{
13386
13386
  }>>;
13387
13387
  layout: z.ZodOptional<z.ZodObject<{
13388
13388
  header: z.ZodOptional<z.ZodArray<z.ZodEnum<{
13389
- account: "account";
13390
13389
  model: "model";
13390
+ account: "account";
13391
13391
  identity: "identity";
13392
13392
  provider: "provider";
13393
13393
  version: "version";
@@ -14246,8 +14246,8 @@ declare function createLaunchApiRouter(deps: LaunchApiDeps): {
14246
14246
  }>>;
14247
14247
  layout: zod.ZodOptional<zod.ZodObject<{
14248
14248
  header: zod.ZodOptional<zod.ZodArray<zod.ZodEnum<{
14249
- account: "account";
14250
14249
  model: "model";
14250
+ account: "account";
14251
14251
  identity: "identity";
14252
14252
  provider: "provider";
14253
14253
  version: "version";
@@ -15917,8 +15917,8 @@ declare function createDoorApiRouter(deps: DoorApiDeps): {
15917
15917
  }>>;
15918
15918
  layout: zod.ZodOptional<zod.ZodObject<{
15919
15919
  header: zod.ZodOptional<zod.ZodArray<zod.ZodEnum<{
15920
- account: "account";
15921
15920
  model: "model";
15921
+ account: "account";
15922
15922
  identity: "identity";
15923
15923
  provider: "provider";
15924
15924
  version: "version";
@@ -16717,7 +16717,6 @@ declare function createDoorApiRouter(deps: DoorApiDeps): {
16717
16717
  kind: zod.ZodLiteral<"profile">;
16718
16718
  name: zod.ZodString;
16719
16719
  value: zod.ZodObject<{
16720
- description: zod.ZodOptional<zod.ZodString>;
16721
16720
  entries: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodUnion<readonly [zod.ZodBoolean, zod.ZodObject<{
16722
16721
  value: zod.ZodBoolean;
16723
16722
  when: zod.ZodUnion<readonly [zod.ZodObject<{
@@ -16793,6 +16792,7 @@ declare function createDoorApiRouter(deps: DoorApiDeps): {
16793
16792
  key: zod.ZodType<trilean.JsonValue, unknown, zod_v4_core.$ZodTypeInternals<trilean.JsonValue, unknown>>;
16794
16793
  }, zod_v4_core.$strip>], "kind">]>;
16795
16794
  }, zod_v4_core.$strict>]>>>;
16795
+ description: zod.ZodOptional<zod.ZodString>;
16796
16796
  models: zod.ZodOptional<zod.ZodObject<{
16797
16797
  virtual: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodUnion<readonly [zod.ZodObject<{
16798
16798
  mode: zod.ZodEnum<{
@@ -16880,8 +16880,8 @@ declare function createDoorApiRouter(deps: DoorApiDeps): {
16880
16880
  }>>;
16881
16881
  layout: zod.ZodOptional<zod.ZodObject<{
16882
16882
  header: zod.ZodOptional<zod.ZodArray<zod.ZodEnum<{
16883
- account: "account";
16884
16883
  model: "model";
16884
+ account: "account";
16885
16885
  identity: "identity";
16886
16886
  provider: "provider";
16887
16887
  version: "version";
@@ -17440,7 +17440,6 @@ declare function createDoorApiRouter(deps: DoorApiDeps): {
17440
17440
  kind: zod.ZodLiteral<"profile">;
17441
17441
  name: zod.ZodString;
17442
17442
  value: zod.ZodObject<{
17443
- description: zod.ZodOptional<zod.ZodString>;
17444
17443
  entries: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodUnion<readonly [zod.ZodBoolean, zod.ZodObject<{
17445
17444
  value: zod.ZodBoolean;
17446
17445
  when: zod.ZodUnion<readonly [zod.ZodObject<{
@@ -17516,6 +17515,7 @@ declare function createDoorApiRouter(deps: DoorApiDeps): {
17516
17515
  key: zod.ZodType<trilean.JsonValue, unknown, zod_v4_core.$ZodTypeInternals<trilean.JsonValue, unknown>>;
17517
17516
  }, zod_v4_core.$strip>], "kind">]>;
17518
17517
  }, zod_v4_core.$strict>]>>>;
17518
+ description: zod.ZodOptional<zod.ZodString>;
17519
17519
  models: zod.ZodOptional<zod.ZodObject<{
17520
17520
  virtual: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodUnion<readonly [zod.ZodObject<{
17521
17521
  mode: zod.ZodEnum<{
@@ -17603,8 +17603,8 @@ declare function createDoorApiRouter(deps: DoorApiDeps): {
17603
17603
  }>>;
17604
17604
  layout: zod.ZodOptional<zod.ZodObject<{
17605
17605
  header: zod.ZodOptional<zod.ZodArray<zod.ZodEnum<{
17606
- account: "account";
17607
17606
  model: "model";
17607
+ account: "account";
17608
17608
  identity: "identity";
17609
17609
  provider: "provider";
17610
17610
  version: "version";
@@ -18802,8 +18802,8 @@ declare function createDoorApiRouter(deps: DoorApiDeps): {
18802
18802
  }>>;
18803
18803
  layout: zod.ZodOptional<zod.ZodObject<{
18804
18804
  header: zod.ZodOptional<zod.ZodArray<zod.ZodEnum<{
18805
- account: "account";
18806
18805
  model: "model";
18806
+ account: "account";
18807
18807
  identity: "identity";
18808
18808
  provider: "provider";
18809
18809
  version: "version";
@@ -19582,8 +19582,8 @@ declare function createDoorApiRouter(deps: DoorApiDeps): {
19582
19582
  }>>;
19583
19583
  layout: zod.ZodOptional<zod.ZodObject<{
19584
19584
  header: zod.ZodOptional<zod.ZodArray<zod.ZodEnum<{
19585
- account: "account";
19586
19585
  model: "model";
19586
+ account: "account";
19587
19587
  identity: "identity";
19588
19588
  provider: "provider";
19589
19589
  version: "version";
@@ -21240,7 +21240,6 @@ declare const ConfigProfileAddOutputSchema: z.ZodObject<{
21240
21240
  kind: z.ZodLiteral<"profile">;
21241
21241
  name: z.ZodString;
21242
21242
  value: z.ZodObject<{
21243
- description: z.ZodOptional<z.ZodString>;
21244
21243
  entries: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
21245
21244
  value: z.ZodBoolean;
21246
21245
  when: z.ZodUnion<readonly [z.ZodObject<{
@@ -21316,6 +21315,7 @@ declare const ConfigProfileAddOutputSchema: z.ZodObject<{
21316
21315
  key: z.ZodType<trilean.JsonValue, unknown, z.core.$ZodTypeInternals<trilean.JsonValue, unknown>>;
21317
21316
  }, z.core.$strip>], "kind">]>;
21318
21317
  }, z.core.$strict>]>>>;
21318
+ description: z.ZodOptional<z.ZodString>;
21319
21319
  models: z.ZodOptional<z.ZodObject<{
21320
21320
  virtual: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
21321
21321
  mode: z.ZodEnum<{
@@ -21403,8 +21403,8 @@ declare const ConfigProfileAddOutputSchema: z.ZodObject<{
21403
21403
  }>>;
21404
21404
  layout: z.ZodOptional<z.ZodObject<{
21405
21405
  header: z.ZodOptional<z.ZodArray<z.ZodEnum<{
21406
- account: "account";
21407
21406
  model: "model";
21407
+ account: "account";
21408
21408
  identity: "identity";
21409
21409
  provider: "provider";
21410
21410
  version: "version";
@@ -21965,7 +21965,6 @@ declare const ConfigProfileSetOutputSchema: z.ZodObject<{
21965
21965
  kind: z.ZodLiteral<"profile">;
21966
21966
  name: z.ZodString;
21967
21967
  value: z.ZodObject<{
21968
- description: z.ZodOptional<z.ZodString>;
21969
21968
  entries: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
21970
21969
  value: z.ZodBoolean;
21971
21970
  when: z.ZodUnion<readonly [z.ZodObject<{
@@ -22041,6 +22040,7 @@ declare const ConfigProfileSetOutputSchema: z.ZodObject<{
22041
22040
  key: z.ZodType<trilean.JsonValue, unknown, z.core.$ZodTypeInternals<trilean.JsonValue, unknown>>;
22042
22041
  }, z.core.$strip>], "kind">]>;
22043
22042
  }, z.core.$strict>]>>>;
22043
+ description: z.ZodOptional<z.ZodString>;
22044
22044
  models: z.ZodOptional<z.ZodObject<{
22045
22045
  virtual: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
22046
22046
  mode: z.ZodEnum<{
@@ -22128,8 +22128,8 @@ declare const ConfigProfileSetOutputSchema: z.ZodObject<{
22128
22128
  }>>;
22129
22129
  layout: z.ZodOptional<z.ZodObject<{
22130
22130
  header: z.ZodOptional<z.ZodArray<z.ZodEnum<{
22131
- account: "account";
22132
22131
  model: "model";
22132
+ account: "account";
22133
22133
  identity: "identity";
22134
22134
  provider: "provider";
22135
22135
  version: "version";
@@ -23329,8 +23329,8 @@ declare const ConfigRuleAddOutputSchema: z.ZodObject<{
23329
23329
  }>>;
23330
23330
  layout: z.ZodOptional<z.ZodObject<{
23331
23331
  header: z.ZodOptional<z.ZodArray<z.ZodEnum<{
23332
- account: "account";
23333
23332
  model: "model";
23333
+ account: "account";
23334
23334
  identity: "identity";
23335
23335
  provider: "provider";
23336
23336
  version: "version";
@@ -24111,8 +24111,8 @@ declare const ConfigRuleSetOutputSchema: z.ZodObject<{
24111
24111
  }>>;
24112
24112
  layout: z.ZodOptional<z.ZodObject<{
24113
24113
  header: z.ZodOptional<z.ZodArray<z.ZodEnum<{
24114
- account: "account";
24115
24114
  model: "model";
24115
+ account: "account";
24116
24116
  identity: "identity";
24117
24117
  provider: "provider";
24118
24118
  version: "version";
@@ -25150,8 +25150,8 @@ declare const LaunchResolveOutputSchema: z.ZodObject<{
25150
25150
  }>>;
25151
25151
  layout: z.ZodOptional<z.ZodObject<{
25152
25152
  header: z.ZodOptional<z.ZodArray<z.ZodEnum<{
25153
- account: "account";
25154
25153
  model: "model";
25154
+ account: "account";
25155
25155
  identity: "identity";
25156
25156
  provider: "provider";
25157
25157
  version: "version";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-use",
3
- "version": "11.72.0",
3
+ "version": "11.72.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>",