claude-use 12.0.1 → 12.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
@@ -5269,6 +5269,23 @@ function identityIdResolver(identitiesDir, fs17) {
5269
5269
  return identityIdIn(records, name);
5270
5270
  };
5271
5271
  }
5272
+ function identityReader(identitiesDir, fs17) {
5273
+ const read = /* @__PURE__ */ new Map();
5274
+ const readOnce = (file) => {
5275
+ if (!read.has(file)) {
5276
+ read.set(file, fs17.readConfigFile(file));
5277
+ }
5278
+ return read.get(file);
5279
+ };
5280
+ const idOf = identityIdResolver(identitiesDir, { readdir: fs17.readdir, readConfigFile: readOnce });
5281
+ return {
5282
+ idOf,
5283
+ load: (name) => {
5284
+ const id = idOf(name);
5285
+ return id === void 0 ? void 0 : loadConfigFile(import_node_path15.default.join(identitiesDir, id, IDENTITY_FILE), IdentitySchema, readOnce)?.config;
5286
+ }
5287
+ };
5288
+ }
5272
5289
  function loadIdentity(identitiesDir, name, fs17) {
5273
5290
  if (!isFileName(name)) {
5274
5291
  throw new UnsafeNameError(name, "identity", FILE_NAME_RULE);
@@ -9243,7 +9260,8 @@ var init_identityAccounts = __esm({
9243
9260
  function candidateHeading(candidate) {
9244
9261
  const score = candidate.score === void 0 ? "" : ` score ${candidate.score.toFixed(2)}${candidate.scoreWindow === "fiveHour" ? " by 5h reset" : " by 7d reset"}`;
9245
9262
  const dry = candidate.feasible ? "" : " (5h would run dry)";
9246
- return `[${candidate.class}${score}]${dry}`;
9263
+ const onProvider = candidate.provider === void 0 ? "" : ` on provider ${candidate.provider}`;
9264
+ return `[${candidate.class}${score}]${dry}${onProvider}`;
9247
9265
  }
9248
9266
  function percent(fraction) {
9249
9267
  return `${String(Math.round(fraction * PERCENT))}%`;
@@ -9285,6 +9303,9 @@ function planOf(account) {
9285
9303
  }
9286
9304
  return { kind: "subscription", capacity: 1, recognised: BASE_TIER.test(tier), ...tierField };
9287
9305
  }
9306
+ function planOfProviderQuota(quota) {
9307
+ return planOf(quota?.level === void 0 ? void 0 : { organizationRateLimitTier: quota.level });
9308
+ }
9288
9309
  var import_zod17, PlanClassSchema, TIER_MULTIPLIER, ZERO_TIER, BASE_TIER;
9289
9310
  var init_plan2 = __esm({
9290
9311
  "src/usage/plan.ts"() {
@@ -9344,12 +9365,58 @@ var init_middleware = __esm({
9344
9365
  }
9345
9366
  });
9346
9367
 
9368
+ // src/usage/windowLengths.ts
9369
+ var MS_PER_HOUR2, HOURS_PER_DAY3, FIVE_HOURS, SEVEN_DAYS, FIVE_HOUR_WINDOW_MS, SEVEN_DAY_WINDOW_MS;
9370
+ var init_windowLengths = __esm({
9371
+ "src/usage/windowLengths.ts"() {
9372
+ "use strict";
9373
+ MS_PER_HOUR2 = 36e5;
9374
+ HOURS_PER_DAY3 = 24;
9375
+ FIVE_HOURS = 5;
9376
+ SEVEN_DAYS = 7;
9377
+ FIVE_HOUR_WINDOW_MS = FIVE_HOURS * MS_PER_HOUR2;
9378
+ SEVEN_DAY_WINDOW_MS = SEVEN_DAYS * HOURS_PER_DAY3 * MS_PER_HOUR2;
9379
+ }
9380
+ });
9381
+
9382
+ // src/usage/providerWindows.ts
9383
+ function bindingWindow(quota, periodMs) {
9384
+ const same = quota.windows.filter((window) => window.periodMs === periodMs);
9385
+ const tightest = same.reduce((binding, window) => binding === void 0 || window.utilization > binding.utilization ? window : binding, void 0);
9386
+ if (tightest === void 0) {
9387
+ return void 0;
9388
+ }
9389
+ return { utilization: tightest.utilization, ...tightest.resetsAt === void 0 ? {} : { resetsAt: tightest.resetsAt }, status: tightest.utilization >= 1 ? "rejected" : "allowed" };
9390
+ }
9391
+ function unifiedFromQuota(quota) {
9392
+ const fiveHour = bindingWindow(quota, FIVE_HOUR_WINDOW_MS);
9393
+ const sevenDay = bindingWindow(quota, SEVEN_DAY_WINDOW_MS);
9394
+ return fiveHour === void 0 && sevenDay === void 0 ? void 0 : { ...fiveHour === void 0 ? {} : { fiveHour }, ...sevenDay === void 0 ? {} : { sevenDay } };
9395
+ }
9396
+ function rankingWindowsOf(provider, state) {
9397
+ const recorded = state?.rateLimit;
9398
+ if (provider === void 0) {
9399
+ return recorded?.unified === void 0 ? void 0 : { unified: recorded.unified, observedAt: recorded.observedAt };
9400
+ }
9401
+ if (recorded?.unified !== void 0 && (recorded.unified.fiveHour !== void 0 || recorded.unified.sevenDay !== void 0)) {
9402
+ return { unified: recorded.unified, observedAt: recorded.observedAt };
9403
+ }
9404
+ const pulled = state?.quota === void 0 ? void 0 : unifiedFromQuota(state.quota);
9405
+ return state?.quota === void 0 || pulled === void 0 ? void 0 : { unified: pulled, observedAt: state.quota.observedAt };
9406
+ }
9407
+ var init_providerWindows = __esm({
9408
+ "src/usage/providerWindows.ts"() {
9409
+ "use strict";
9410
+ init_windowLengths();
9411
+ }
9412
+ });
9413
+
9347
9414
  // src/usage/quotaFacts.ts
9348
9415
  function windowFacts(window, nowMs) {
9349
9416
  if (window?.utilization === void 0 || window.resetsAt === void 0) {
9350
9417
  return void 0;
9351
9418
  }
9352
- return { remaining: Math.max(0, 1 - window.utilization), utilization: window.utilization, hoursUntilReset: Math.max(0, (Date.parse(window.resetsAt) - nowMs) / MS_PER_HOUR2) };
9419
+ return { remaining: Math.max(0, 1 - window.utilization), utilization: window.utilization, hoursUntilReset: Math.max(0, (Date.parse(window.resetsAt) - nowMs) / MS_PER_HOUR3) };
9353
9420
  }
9354
9421
  function quotaFactsOf(unified, nowMs) {
9355
9422
  const fiveHour = windowFacts(unified?.fiveHour, nowMs);
@@ -9357,19 +9424,16 @@ function quotaFactsOf(unified, nowMs) {
9357
9424
  const extraUsage = windowFacts(unified === void 0 ? void 0 : soleOverageWindow(unified), nowMs);
9358
9425
  return { ...fiveHour === void 0 ? {} : { fiveHour }, ...sevenDay === void 0 ? {} : { sevenDay }, ...extraUsage === void 0 ? {} : { extraUsage } };
9359
9426
  }
9360
- var MS_PER_HOUR2;
9427
+ var MS_PER_HOUR3;
9361
9428
  var init_quotaFacts = __esm({
9362
9429
  "src/usage/quotaFacts.ts"() {
9363
9430
  "use strict";
9364
9431
  init_rateLimit();
9365
- MS_PER_HOUR2 = 36e5;
9432
+ MS_PER_HOUR3 = 36e5;
9366
9433
  }
9367
9434
  });
9368
9435
 
9369
9436
  // src/usage/pick.ts
9370
- function unifiedOf(state) {
9371
- return state?.rateLimit?.unified;
9372
- }
9373
9437
  function limitBlockedUntil(state, nowMs) {
9374
9438
  const limit = state?.lastLimit;
9375
9439
  if (state === void 0 || limit === void 0) {
@@ -9459,6 +9523,10 @@ function assessRefusedNested(member, nested, nowMs) {
9459
9523
  };
9460
9524
  }
9461
9525
  function assess(member, nowMs) {
9526
+ const assessment = assessMember(member, nowMs);
9527
+ return member.provider === void 0 ? assessment : { ...assessment, candidate: { ...assessment.candidate, provider: member.provider } };
9528
+ }
9529
+ function assessMember(member, nowMs) {
9462
9530
  if (member.sameLoginAs !== void 0) {
9463
9531
  return { candidate: { identity: member.identity, class: "ineligible", plan: planOf(member.account), reasons: [`same login as ${member.sameLoginAs}`] } };
9464
9532
  }
@@ -9472,22 +9540,43 @@ function assess(member, nowMs) {
9472
9540
  const assessment = assessIdentity(member, nowMs);
9473
9541
  return { ...assessment, candidate: { ...assessment.candidate, reasons: [`picked by pool "${nested.pool}"`, ...nested.reasons] } };
9474
9542
  }
9543
+ function sliceOf(member) {
9544
+ return member.snapshot?.providers[member.provider ?? ANTHROPIC_PROVIDER];
9545
+ }
9546
+ function assessProviderWithoutWindows(member, provider, state, base, planReasons, nowMs) {
9547
+ const blockedUntil = limitBlockedUntil(state, nowMs);
9548
+ if (blockedUntil !== void 0) {
9549
+ return { candidate: { ...base, class: "ineligible", blockedUntilMs: blockedUntil, reasons: [`refused until ${new Date(blockedUntil).toISOString()} (in ${formatAge(blockedUntil - nowMs)})`, ...planReasons] } };
9550
+ }
9551
+ if (base.plan.kind === "pay-per-use") {
9552
+ return { candidate: { ...base, class: "pay-per-use", usageUnrecorded: true, reasons: [...planReasons, `provider ${provider} reports no plan windows, so its spend is not tracked`] } };
9553
+ }
9554
+ const why = state === void 0 ? `no usage recorded for provider ${provider} yet, so its quota is unknown` : `provider ${provider} reports no plan windows, so its quota is unknown`;
9555
+ return { candidate: { ...base, class: "unknown", reasons: [why, ...planReasons] } };
9556
+ }
9475
9557
  function assessIdentity(member, nowMs) {
9476
- const plan = planOf(member.account);
9558
+ const state = sliceOf(member);
9559
+ const plan = member.provider === void 0 ? planOf(member.account) : planOfProviderQuota(state?.quota);
9477
9560
  const planReasons = plan.kind === "pay-per-use" ? ["billed by use (no plan allowance)"] : plan.recognised ? [`${String(plan.capacity)}x plan`] : [`plan tier ${plan.tier === void 0 ? "not known" : `"${plan.tier}" not recognised`}, counted as 1x`];
9478
9561
  const base = { identity: member.identity, plan };
9479
9562
  if (member.readError !== void 0) {
9480
9563
  return { candidate: { ...base, class: "unknown", reasons: [`usage state unreadable: ${member.readError}`, ...planReasons] } };
9481
9564
  }
9482
- const state = member.snapshot?.providers[ANTHROPIC_PROVIDER];
9483
- const unified = unifiedOf(state);
9484
- if (member.snapshot === void 0 || state === void 0 || unified === void 0) {
9565
+ if (member.providerError !== void 0) {
9566
+ return { candidate: { ...base, class: "unknown", reasons: [`provider configuration unreadable: ${member.providerError}`, ...planReasons] } };
9567
+ }
9568
+ const windows = rankingWindowsOf(member.provider, state);
9569
+ if (member.snapshot === void 0 || state === void 0 || windows === void 0) {
9570
+ if (member.provider !== void 0) {
9571
+ return assessProviderWithoutWindows(member, member.provider, state, base, planReasons, nowMs);
9572
+ }
9485
9573
  if (plan.kind === "pay-per-use") {
9486
9574
  return { candidate: { ...base, class: "pay-per-use", usageUnrecorded: true, reasons: [...planReasons, "no usage recorded yet, so its spend is not tracked (turn on trackUsage for it)"] } };
9487
9575
  }
9488
9576
  return { candidate: { ...base, class: "unknown", reasons: ["no usage recorded yet, so its quota is unknown (turn on trackUsage for it)", ...planReasons] } };
9489
9577
  }
9490
- const observedAgo = state.rateLimit === void 0 ? "" : ` (last seen ${formatAge(nowMs - Date.parse(state.rateLimit.observedAt))} ago)`;
9578
+ const { unified } = windows;
9579
+ const observedAgo = ` (last seen ${formatAge(nowMs - Date.parse(windows.observedAt))} ago)`;
9491
9580
  const fiveHourWindow = unified.fiveHour;
9492
9581
  const sevenDayWindow = unified.sevenDay;
9493
9582
  const five = fiveHourWindow === void 0 ? void 0 : effectiveWindow(fiveHourWindow, nowMs);
@@ -9499,6 +9588,15 @@ function assessIdentity(member, nowMs) {
9499
9588
  const overageWindow = soleOverageWindow(unified);
9500
9589
  const overage = overageWindow === void 0 ? void 0 : effectiveWindow(overageWindow, nowMs);
9501
9590
  const overageReasons = overageWindow === void 0 || overage === void 0 ? [] : [describeWindow("extra usage", overageWindow, overage, nowMs)];
9591
+ if (member.provider !== void 0) {
9592
+ const spent = [
9593
+ { name: "5h", window: five },
9594
+ { name: "7d", window: seven }
9595
+ ].filter(({ window }) => window?.status === "rejected" && window.resetsAtMs === void 0).map(({ name }) => name);
9596
+ if (spent.length > 0) {
9597
+ return { candidate: { ...base, class: "ineligible", reasons: [`provider ${member.provider} ${spent.join(" and ")} window used in full with no reset time reported, so it is refused until it reports one`, ...windowReasons, ...planReasons] } };
9598
+ }
9599
+ }
9502
9600
  const blockedUntil = Math.max(
9503
9601
  windowBlockedUntil([five, seven, overage].flatMap((window) => window === void 0 ? [] : [window])) ?? 0,
9504
9602
  limitBlockedUntil(state, nowMs) ?? 0
@@ -9519,11 +9617,11 @@ function assessIdentity(member, nowMs) {
9519
9617
  }
9520
9618
  const remaining = Math.max(0, 1 - basis.window.utilization);
9521
9619
  const untilResetMs = basis.window.resetsAtMs === void 0 ? basis.windowMs : Math.max(basis.window.resetsAtMs - nowMs, MS_PER_SECOND5);
9522
- const weeklyScore = remaining * plan.capacity / (untilResetMs / MS_PER_HOUR3);
9620
+ const weeklyScore = remaining * plan.capacity / (untilResetMs / MS_PER_HOUR4);
9523
9621
  const fiveRemaining = five?.utilization === void 0 ? void 0 : Math.max(0, 1 - five.utilization);
9524
9622
  const fiveUntil = five?.resetsAtMs === void 0 ? FIVE_HOUR_WINDOW_MS : Math.max(five.resetsAtMs - nowMs, MS_PER_SECOND5);
9525
9623
  const ratio = windowRatio(member.records);
9526
- const fiveHourScore = basis.name === "sevenDay" && fiveRemaining !== void 0 && ratio !== void 0 ? Math.min(fiveRemaining * ratio, remaining) * plan.capacity / (fiveUntil / MS_PER_HOUR3) : void 0;
9624
+ const fiveHourScore = basis.name === "sevenDay" && fiveRemaining !== void 0 && ratio !== void 0 ? Math.min(fiveRemaining * ratio, remaining) * plan.capacity / (fiveUntil / MS_PER_HOUR4) : void 0;
9527
9625
  const fiveHourLeads = fiveHourScore !== void 0 && fiveHourScore > weeklyScore;
9528
9626
  const score = fiveHourLeads ? fiveHourScore : weeklyScore;
9529
9627
  const scoreWindow = fiveHourLeads ? "fiveHour" : basis.name;
@@ -9541,15 +9639,15 @@ function assessIdentity(member, nowMs) {
9541
9639
  };
9542
9640
  }
9543
9641
  function poolFactsOf(member, nowMs, resuming, sticky) {
9544
- const { fiveHour, sevenDay, extraUsage } = quotaFactsOf(member.snapshot?.providers[ANTHROPIC_PROVIDER]?.rateLimit?.unified, nowMs);
9642
+ const { fiveHour, sevenDay, extraUsage } = quotaFactsOf(rankingWindowsOf(member.provider, sliceOf(member))?.unified, nowMs);
9545
9643
  const burn = windowBurn(member.records, "fiveHour");
9546
9644
  return {
9547
9645
  ...fiveHour === void 0 ? {} : { fiveHour },
9548
9646
  ...sevenDay === void 0 ? {} : { sevenDay },
9549
9647
  ...extraUsage === void 0 ? {} : { extraUsage },
9550
- ...burn === void 0 ? {} : { burnPerHour: burn * MS_PER_HOUR3 },
9648
+ ...burn === void 0 ? {} : { burnPerHour: burn * MS_PER_HOUR4 },
9551
9649
  resuming,
9552
- ...sticky?.identity === member.identity ? { lastPickHoursAgo: Math.max(0, (nowMs - Date.parse(sticky.at)) / MS_PER_HOUR3) } : {}
9650
+ ...sticky?.identity === member.identity ? { lastPickHoursAgo: Math.max(0, (nowMs - Date.parse(sticky.at)) / MS_PER_HOUR4) } : {}
9553
9651
  };
9554
9652
  }
9555
9653
  function rankPool(input) {
@@ -9644,7 +9742,7 @@ function rankPool(input) {
9644
9742
  ...holdForReturn === void 0 ? {} : { holdForReturn }
9645
9743
  };
9646
9744
  }
9647
- var MS_PER_SECOND5, MS_PER_HOUR3, HOURS_PER_DAY3, FIVE_HOURS, PROMPT_CACHE_TTL_HOURS, SEVEN_DAYS, FIVE_HOUR_WINDOW_MS, SEVEN_DAY_WINDOW_MS, PROMPT_CACHE_TTL_MS, CLASS_ORDER;
9745
+ var MS_PER_SECOND5, MS_PER_HOUR4, PROMPT_CACHE_TTL_HOURS, PROMPT_CACHE_TTL_MS, CLASS_ORDER;
9648
9746
  var init_pick = __esm({
9649
9747
  "src/usage/pick.ts"() {
9650
9748
  "use strict";
@@ -9653,17 +9751,14 @@ var init_pick = __esm({
9653
9751
  init_plan2();
9654
9752
  init_middleware();
9655
9753
  init_preflight();
9754
+ init_providerWindows();
9656
9755
  init_quotaFacts();
9756
+ init_windowLengths();
9657
9757
  init_rateLimit();
9658
9758
  MS_PER_SECOND5 = 1e3;
9659
- MS_PER_HOUR3 = 36e5;
9660
- HOURS_PER_DAY3 = 24;
9661
- FIVE_HOURS = 5;
9759
+ MS_PER_HOUR4 = 36e5;
9662
9760
  PROMPT_CACHE_TTL_HOURS = 1;
9663
- SEVEN_DAYS = 7;
9664
- FIVE_HOUR_WINDOW_MS = FIVE_HOURS * MS_PER_HOUR3;
9665
- SEVEN_DAY_WINDOW_MS = SEVEN_DAYS * HOURS_PER_DAY3 * MS_PER_HOUR3;
9666
- PROMPT_CACHE_TTL_MS = PROMPT_CACHE_TTL_HOURS * MS_PER_HOUR3;
9761
+ PROMPT_CACHE_TTL_MS = PROMPT_CACHE_TTL_HOURS * MS_PER_HOUR4;
9667
9762
  CLASS_ORDER = { scored: 0, unknown: 1, "pay-per-use": 2, ineligible: 3 };
9668
9763
  }
9669
9764
  });
@@ -9798,7 +9893,7 @@ var init_store2 = __esm({
9798
9893
  function errorMessage(error) {
9799
9894
  return error instanceof Error ? error.message : String(error);
9800
9895
  }
9801
- function loadPoolMembers(fs17, paths, identities, nowMs, idOf) {
9896
+ function loadPoolMembers(fs17, paths, identities, nowMs, idOf, providerOf) {
9802
9897
  const windowStartMs = nowMs - FIVE_HOUR_WINDOW_MS;
9803
9898
  const log = readUsageLog(fs17, paths.usageLogDir, { sinceMs: windowStartMs });
9804
9899
  return identities.map((identity) => {
@@ -9806,14 +9901,20 @@ function loadPoolMembers(fs17, paths, identities, nowMs, idOf) {
9806
9901
  if (id === void 0) {
9807
9902
  return { identity, records: [] };
9808
9903
  }
9809
- const records = log.records.filter((record) => record.identity === id && record.provider === ANTHROPIC_PROVIDER && Date.parse(record.at) >= windowStartMs);
9904
+ const resolved = providerOf?.(identity);
9905
+ const provider = typeof resolved === "object" ? resolved.named : resolved;
9906
+ const providerField = {
9907
+ ...provider === void 0 ? {} : { provider },
9908
+ ...typeof resolved === "object" ? { providerError: resolved.reason } : {}
9909
+ };
9910
+ const records = log.records.filter((record) => record.identity === id && record.provider === (provider ?? ANTHROPIC_PROVIDER) && Date.parse(record.at) >= windowStartMs);
9810
9911
  try {
9811
9912
  const snapshot = readUsageSnapshot(fs17, paths.usageSnapshotsDir, id);
9812
9913
  const account = readAccountMetadata(fs17, paths.identitiesDir, id) ?? snapshot?.account;
9813
- return { identity, records, ...snapshot === void 0 ? {} : { snapshot }, ...account === void 0 ? {} : { account } };
9914
+ return { identity, records, ...providerField, ...snapshot === void 0 ? {} : { snapshot }, ...account === void 0 ? {} : { account } };
9814
9915
  } catch (error) {
9815
9916
  if (error instanceof UsageSnapshotError || error instanceof AccountMetadataError) {
9816
- return { identity, records, readError: errorMessage(error) };
9917
+ return { identity, records, ...providerField, readError: errorMessage(error) };
9817
9918
  }
9818
9919
  throw error;
9819
9920
  }
@@ -9823,7 +9924,7 @@ function snapshotAgeKey(member) {
9823
9924
  return member.snapshot === void 0 ? Number.NEGATIVE_INFINITY : Date.parse(member.snapshot.updatedAt);
9824
9925
  }
9825
9926
  function collapseSharedLogins(members) {
9826
- const groups = groupSharedLogins(members, (member) => member.nested === void 0 && member.account !== void 0 ? loginKeyOf(member.account) : void 0);
9927
+ const groups = groupSharedLogins(members, (member) => member.nested === void 0 && member.provider === void 0 && member.account !== void 0 ? loginKeyOf(member.account) : void 0);
9827
9928
  const representativeOf = /* @__PURE__ */ new Map();
9828
9929
  for (const group of groups) {
9829
9930
  const representative = group.reduce((freshest, member) => snapshotAgeKey(member) > snapshotAgeKey(freshest) ? member : freshest);
@@ -9853,7 +9954,7 @@ function rankNamedPool(input, poolName, stack, sticky) {
9853
9954
  const childStack = [...stack, poolName];
9854
9955
  const direct = pool.identities.filter((entry) => poolNameOf(poolMemberIdentity(entry)) === void 0);
9855
9956
  const missing = direct.filter((entry) => input.identityIdOf(poolMemberIdentity(entry)) === void 0).map((entry) => ({ pool: poolName, identity: poolMemberIdentity(entry) }));
9856
- const loaded = new Map(loadPoolMembers(input.fs, input.paths, direct.filter((entry) => input.identityIdOf(poolMemberIdentity(entry)) !== void 0).map(poolMemberIdentity), input.nowMs, input.identityIdOf).map((member) => [member.identity, member]));
9957
+ const loaded = new Map(loadPoolMembers(input.fs, input.paths, direct.filter((entry) => input.identityIdOf(poolMemberIdentity(entry)) !== void 0).map(poolMemberIdentity), input.nowMs, input.identityIdOf, input.providerOf).map((member) => [member.identity, member]));
9857
9958
  const members = [];
9858
9959
  for (const entry of pool.identities) {
9859
9960
  const nestedName = poolNameOf(poolMemberIdentity(entry));
@@ -9894,7 +9995,7 @@ function nestedMember(input, nestedName, childStack, sticky) {
9894
9995
  const nested = rankNamedPool(input, nestedName, childStack, sticky);
9895
9996
  const pick = nested.ranking.pick;
9896
9997
  if (pick !== void 0) {
9897
- const [member] = loadPoolMembers(input.fs, input.paths, [pick.identity], input.nowMs, input.identityIdOf);
9998
+ const [member] = loadPoolMembers(input.fs, input.paths, [pick.identity], input.nowMs, input.identityIdOf, input.providerOf);
9898
9999
  return { member: { ...member ?? { identity: pick.identity, records: [] }, nested: { kind: "pick", pool: nestedName, reasons: pick.reasons } }, missing: nested.missing };
9899
10000
  }
9900
10001
  const earliestReturn = nested.ranking.earliestReturn;
@@ -9991,6 +10092,7 @@ var init_poolPick = __esm({
9991
10092
  init_read();
9992
10093
  init_middleware();
9993
10094
  init_store2();
10095
+ init_windowLengths();
9994
10096
  PoolGraphError = class extends CliError {
9995
10097
  constructor(message) {
9996
10098
  super(message);
@@ -10763,7 +10865,7 @@ var init_package = __esm({
10763
10865
  "package.json"() {
10764
10866
  package_default = {
10765
10867
  name: "claude-use",
10766
- version: "12.0.1",
10868
+ version: "12.1.0",
10767
10869
  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.",
10768
10870
  license: "MIT",
10769
10871
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -11023,93 +11125,6 @@ var init_cascade = __esm({
11023
11125
  }
11024
11126
  });
11025
11127
 
11026
- // src/paths.ts
11027
- function resolveAgentShimHome(env = process.env, home = import_node_os4.default.homedir(), isDirectory = isExistingDirectory) {
11028
- const fromEnv = env.AGENT_SHIM_HOME;
11029
- if (fromEnv !== void 0 && fromEnv !== "") {
11030
- return fromEnv;
11031
- }
11032
- const current = import_node_path36.default.join(home, HOME_DIRNAME);
11033
- const legacy = import_node_path36.default.join(home, LEGACY_HOME_DIRNAME);
11034
- return !isDirectory(current) && isDirectory(legacy) ? legacy : current;
11035
- }
11036
- function isExistingDirectory(candidate) {
11037
- return import_node_fs9.default.statSync(candidate, { throwIfNoEntry: false })?.isDirectory() ?? false;
11038
- }
11039
- function resolveClaudeHome() {
11040
- const fromEnv = process.env.AGENT_SHIM_CLAUDE_HOME;
11041
- if (fromEnv !== void 0 && fromEnv !== "") {
11042
- return fromEnv;
11043
- }
11044
- return import_node_path36.default.join(import_node_os4.default.homedir(), ".claude");
11045
- }
11046
- function buildLayoutPaths(root) {
11047
- return {
11048
- root,
11049
- identitiesDir: import_node_path36.default.join(root, "identities"),
11050
- configProfilesDir: import_node_path36.default.join(root, "config-profiles"),
11051
- providersDir: import_node_path36.default.join(root, "providers"),
11052
- providerAliasesFile: import_node_path36.default.join(root, "provider-aliases.json"),
11053
- directoryRulesFile: import_node_path36.default.join(root, "directory-rules.json"),
11054
- activeIdentityFile: import_node_path36.default.join(root, "active-identity"),
11055
- globalConfigFile: import_node_path36.default.join(root, "config.json"),
11056
- categoriesLocalFile: import_node_path36.default.join(root, "categories.local.json"),
11057
- claudeShimFile: import_node_path36.default.join(root, "claude-shim.json"),
11058
- headroomDir: import_node_path36.default.join(root, "headroom"),
11059
- headroomStateFile: import_node_path36.default.join(root, "headroom", "state.json"),
11060
- headroomRoutingFile: import_node_path36.default.join(root, "headroom", "routing.json"),
11061
- headroomLegacyStateFile: import_node_path36.default.join(root, "headroom", "state.v2.json"),
11062
- headroomAllowlistFile: import_node_path36.default.join(root, "headroom", "run", "allowlist.txt"),
11063
- headroomSocketDir: import_node_path36.default.join(root, "headroom", "run"),
11064
- headroomLockFile: import_node_path36.default.join(root, "headroom", "start.lock"),
11065
- headroomSessionsDir: import_node_path36.default.join(root, "headroom", "sessions"),
11066
- logsDir: import_node_path36.default.join(root, "logs"),
11067
- headroomLogPath: import_node_path36.default.join(root, "logs", "headroom.log"),
11068
- frontdoorDir: import_node_path36.default.join(root, "frontdoor"),
11069
- frontdoorCaDir: import_node_path36.default.join(root, "frontdoor", "ca"),
11070
- frontdoorCaCertFile: import_node_path36.default.join(root, "frontdoor", "ca", "ca.pem"),
11071
- frontdoorCaKeyFile: import_node_path36.default.join(root, "frontdoor", "ca", "ca.key"),
11072
- frontdoorCaBundlesDir: import_node_path36.default.join(root, "frontdoor", "ca", "bundles"),
11073
- chatgptSignInFile: import_node_path36.default.join(root, "codex", "chatgpt-sign-in.json"),
11074
- frontdoorStateFile: import_node_path36.default.join(root, "frontdoor", "state.json"),
11075
- frontdoorLockFile: import_node_path36.default.join(root, "frontdoor", "start.lock"),
11076
- frontdoorControlTokenFile: import_node_path36.default.join(root, "frontdoor", "control-token"),
11077
- frontdoorSessionsDir: import_node_path36.default.join(root, "frontdoor", "sessions"),
11078
- frontdoorDirectRecordsDir: import_node_path36.default.join(root, "frontdoor", "direct"),
11079
- frontdoorDrainingDir: import_node_path36.default.join(root, "frontdoor", "draining"),
11080
- frontdoorRcCredentialsDir: import_node_path36.default.join(root, "frontdoor", "rc-credentials"),
11081
- frontdoorLogPath: import_node_path36.default.join(root, "logs", "frontdoor.log"),
11082
- usageDir: import_node_path36.default.join(root, "usage"),
11083
- usageLogDir: import_node_path36.default.join(root, "usage", "log"),
11084
- usageSnapshotsDir: import_node_path36.default.join(root, "usage", "snapshots"),
11085
- statuslineDir: import_node_path36.default.join(root, "statusline"),
11086
- catalogueDir: import_node_path36.default.join(root, "catalogues"),
11087
- usagePicksFile: import_node_path36.default.join(root, "usage", "picks.json"),
11088
- usageAnchorsFile: import_node_path36.default.join(root, "usage", "anchors.json"),
11089
- usageJobsFile: import_node_path36.default.join(root, "usage", "jobs.json"),
11090
- jobLogsDir: import_node_path36.default.join(root, "logs", "jobs"),
11091
- identityRenamesDir: import_node_path36.default.join(root, "identity-renames"),
11092
- identityNameRenamesDir: import_node_path36.default.join(root, "identity-name-renames"),
11093
- launchesDir: import_node_path36.default.join(root, "launches"),
11094
- superviseDir: import_node_path36.default.join(root, "supervise"),
11095
- modelMovesDir: import_node_path36.default.join(root, "model-moves"),
11096
- mcpPermissionsFile: import_node_path36.default.join(root, "mcp", "permissions.json")
11097
- };
11098
- }
11099
- function resolveLayoutPaths() {
11100
- return buildLayoutPaths(resolveAgentShimHome());
11101
- }
11102
- var import_node_fs9, import_node_os4, import_node_path36;
11103
- var init_paths = __esm({
11104
- "src/paths.ts"() {
11105
- "use strict";
11106
- import_node_fs9 = __toESM(require("node:fs"), 1);
11107
- import_node_os4 = __toESM(require("node:os"), 1);
11108
- import_node_path36 = __toESM(require("node:path"), 1);
11109
- init_legacy();
11110
- }
11111
- });
11112
-
11113
11128
  // src/providerAliases.ts
11114
11129
  function parseAliases(file, raw) {
11115
11130
  const parsed = ProviderAliasesSchema.safeParse(raw);
@@ -11366,7 +11381,7 @@ function providerJsonPath(paths, name) {
11366
11381
  return providerFilePath(paths.providersDir, name);
11367
11382
  }
11368
11383
  function providerExists(paths, name) {
11369
- return import_node_fs10.default.existsSync(providerJsonPath(paths, name));
11384
+ return import_node_fs9.default.existsSync(providerJsonPath(paths, name));
11370
11385
  }
11371
11386
  function requireProviderExists(paths, name) {
11372
11387
  const canonical = canonicalProviderName(name, (candidate) => providerExists(paths, candidate), () => readProviderAliases(paths));
@@ -11423,12 +11438,12 @@ function parseProviderFile(filePath, raw) {
11423
11438
  }
11424
11439
  function readProvider(paths, name) {
11425
11440
  const filePath = providerJsonPath(paths, name);
11426
- if (!import_node_fs10.default.existsSync(filePath)) {
11441
+ if (!import_node_fs9.default.existsSync(filePath)) {
11427
11442
  return void 0;
11428
11443
  }
11429
11444
  let raw;
11430
11445
  try {
11431
- raw = JSON.parse(import_node_fs10.default.readFileSync(filePath, "utf8"));
11446
+ raw = JSON.parse(import_node_fs9.default.readFileSync(filePath, "utf8"));
11432
11447
  } catch (error) {
11433
11448
  throw error instanceof SyntaxError ? new ConfigFileNotJsonError(filePath) : error;
11434
11449
  }
@@ -11444,7 +11459,7 @@ function reportInvalidProvider(name, message) {
11444
11459
  }
11445
11460
  function listProviders(paths, onInvalid = reportInvalidProvider) {
11446
11461
  const names = listProviderNames(
11447
- (dir) => import_node_fs10.default.readdirSync(dir),
11462
+ (dir) => import_node_fs9.default.readdirSync(dir),
11448
11463
  paths.providersDir
11449
11464
  );
11450
11465
  const result = [];
@@ -11611,7 +11626,7 @@ function removeProvider(paths, name) {
11611
11626
  if (!providerExists(paths, name)) {
11612
11627
  throw new ProviderNotFoundError(name);
11613
11628
  }
11614
- import_node_fs10.default.rmSync(providerJsonPath(paths, name));
11629
+ import_node_fs9.default.rmSync(providerJsonPath(paths, name));
11615
11630
  createRealCredentialCache(paths.root).remove("file", `provider ${name}`);
11616
11631
  }
11617
11632
  function cascadeProviderName(cascade, identityProvider) {
@@ -11623,13 +11638,19 @@ function cascadeProviderName(cascade, identityProvider) {
11623
11638
  }
11624
11639
  return name ?? identityProvider;
11625
11640
  }
11626
- function selectProvider(params) {
11641
+ function selectedProviderName(params) {
11627
11642
  const cliName = params.cliProvider !== void 0 && params.cliProvider !== "" ? params.cliProvider : void 0;
11628
11643
  const named = cliName ?? (params.cascade === void 0 ? params.identityProvider : cascadeProviderName(params.cascade, params.identityProvider));
11629
11644
  if (named === void 0) {
11630
11645
  return void 0;
11631
11646
  }
11632
- const name = canonicalProviderName(named, (candidate) => loadProvider(params.paths.providersDir, candidate, params.port) !== void 0, () => loadProviderAliases(params.paths.providerAliasesFile, params.port));
11647
+ return canonicalProviderName(named, (candidate) => loadProvider(params.paths.providersDir, candidate, params.port) !== void 0, () => loadProviderAliases(params.paths.providerAliasesFile, params.port));
11648
+ }
11649
+ function selectProvider(params) {
11650
+ const name = selectedProviderName(params);
11651
+ if (name === void 0) {
11652
+ return void 0;
11653
+ }
11633
11654
  const definition = loadProvider(params.paths.providersDir, name, params.port);
11634
11655
  if (definition === void 0) {
11635
11656
  const known = listProviderNames(params.port.readdir, params.paths.providersDir);
@@ -11718,11 +11739,11 @@ function resolveRoutedProviderCredentials(params) {
11718
11739
  }
11719
11740
  return { ok: true, checked: [...providerNames].sort() };
11720
11741
  }
11721
- var import_node_fs10, ProviderNotFoundError, ProviderAlreadyExistsError, LEGACY_PROVIDER_FIELDS, LEGACY_ENV_CREDENTIAL_KEYS, LEGACY_LITERAL_PLACEHOLDER, LegacyProviderFileError, ProviderKindMismatchError;
11742
+ var import_node_fs9, ProviderNotFoundError, ProviderAlreadyExistsError, LEGACY_PROVIDER_FIELDS, LEGACY_ENV_CREDENTIAL_KEYS, LEGACY_LITERAL_PLACEHOLDER, LegacyProviderFileError, ProviderKindMismatchError;
11722
11743
  var init_providersStore = __esm({
11723
11744
  "src/providersStore.ts"() {
11724
11745
  "use strict";
11725
- import_node_fs10 = __toESM(require("node:fs"), 1);
11746
+ import_node_fs9 = __toESM(require("node:fs"), 1);
11726
11747
  init_load();
11727
11748
  init_store();
11728
11749
  init_unrecognisedKeys();
@@ -11775,6 +11796,168 @@ var init_providersStore = __esm({
11775
11796
  }
11776
11797
  });
11777
11798
 
11799
+ // src/launcher/memberProvider.ts
11800
+ function unreadableFileReason(error) {
11801
+ if (error instanceof ConfigValidationError) {
11802
+ return `${error.filepath} is invalid`;
11803
+ }
11804
+ if (error instanceof ConfigFileNotJsonError) {
11805
+ return error.message.replace(/\.$/, "");
11806
+ }
11807
+ if (error instanceof LegacyProviderFileError) {
11808
+ return `${error.filePath} uses ${error.conversion.fields.join(", ")}, which a credential block replaced`;
11809
+ }
11810
+ return void 0;
11811
+ }
11812
+ function memberProviderResolver(params) {
11813
+ if (params.cliProvider === false) {
11814
+ return () => void 0;
11815
+ }
11816
+ const cliProvider = params.cliProvider;
11817
+ const identities = identityReader(params.paths.identitiesDir, params.fs);
11818
+ const cascades = /* @__PURE__ */ new Map();
11819
+ const cascadeOver = (baseConfigProfile) => {
11820
+ const cached = cascades.get(baseConfigProfile);
11821
+ if (cached !== void 0) {
11822
+ return cached;
11823
+ }
11824
+ const loaded = params.loadCascade(baseConfigProfile);
11825
+ cascades.set(baseConfigProfile, loaded);
11826
+ return loaded;
11827
+ };
11828
+ return (name) => {
11829
+ let declared;
11830
+ try {
11831
+ declared = identities.load(name);
11832
+ } catch (error) {
11833
+ if (!(error instanceof ConfigValidationError)) {
11834
+ throw error;
11835
+ }
11836
+ }
11837
+ const profile = decideConfigProfile({
11838
+ env: params.env,
11839
+ ...params.cliFlagConfigProfile === void 0 ? {} : { cliFlagConfigProfile: params.cliFlagConfigProfile },
11840
+ ...params.directoryRuleConfigProfile === void 0 ? {} : { directoryRuleConfigProfile: params.directoryRuleConfigProfile },
11841
+ ...declared?.defaultConfigProfile === void 0 ? {} : { identityDefaultConfigProfile: declared.defaultConfigProfile },
11842
+ ...params.globalDefaultConfigProfile === void 0 ? {} : { globalDefaultConfigProfile: params.globalDefaultConfigProfile }
11843
+ });
11844
+ const flagged = cliProvider !== void 0 && cliProvider !== "" ? cliProvider : void 0;
11845
+ let named = flagged ?? declared?.provider;
11846
+ try {
11847
+ const cascade = cascadeOver(profile.name);
11848
+ named = flagged ?? cascadeProviderName(cascade, declared?.provider);
11849
+ return selectedProviderName({
11850
+ paths: params.paths,
11851
+ port: params.fs,
11852
+ ...cliProvider === void 0 ? {} : { cliProvider },
11853
+ cascade,
11854
+ ...declared?.provider === void 0 ? {} : { identityProvider: declared.provider }
11855
+ });
11856
+ } catch (error) {
11857
+ const reason = unreadableFileReason(error);
11858
+ if (reason === void 0) {
11859
+ throw error;
11860
+ }
11861
+ return { ...named === void 0 ? {} : { named }, reason };
11862
+ }
11863
+ };
11864
+ }
11865
+ var init_memberProvider = __esm({
11866
+ "src/launcher/memberProvider.ts"() {
11867
+ "use strict";
11868
+ init_load();
11869
+ init_providersStore();
11870
+ init_identity();
11871
+ }
11872
+ });
11873
+
11874
+ // src/paths.ts
11875
+ function resolveAgentShimHome(env = process.env, home = import_node_os5.default.homedir(), isDirectory = isExistingDirectory) {
11876
+ const fromEnv = env.AGENT_SHIM_HOME;
11877
+ if (fromEnv !== void 0 && fromEnv !== "") {
11878
+ return fromEnv;
11879
+ }
11880
+ const current = import_node_path36.default.join(home, HOME_DIRNAME);
11881
+ const legacy = import_node_path36.default.join(home, LEGACY_HOME_DIRNAME);
11882
+ return !isDirectory(current) && isDirectory(legacy) ? legacy : current;
11883
+ }
11884
+ function isExistingDirectory(candidate) {
11885
+ return import_node_fs10.default.statSync(candidate, { throwIfNoEntry: false })?.isDirectory() ?? false;
11886
+ }
11887
+ function resolveClaudeHome() {
11888
+ const fromEnv = process.env.AGENT_SHIM_CLAUDE_HOME;
11889
+ if (fromEnv !== void 0 && fromEnv !== "") {
11890
+ return fromEnv;
11891
+ }
11892
+ return import_node_path36.default.join(import_node_os5.default.homedir(), ".claude");
11893
+ }
11894
+ function buildLayoutPaths(root) {
11895
+ return {
11896
+ root,
11897
+ identitiesDir: import_node_path36.default.join(root, "identities"),
11898
+ configProfilesDir: import_node_path36.default.join(root, "config-profiles"),
11899
+ providersDir: import_node_path36.default.join(root, "providers"),
11900
+ providerAliasesFile: import_node_path36.default.join(root, "provider-aliases.json"),
11901
+ directoryRulesFile: import_node_path36.default.join(root, "directory-rules.json"),
11902
+ activeIdentityFile: import_node_path36.default.join(root, "active-identity"),
11903
+ globalConfigFile: import_node_path36.default.join(root, "config.json"),
11904
+ categoriesLocalFile: import_node_path36.default.join(root, "categories.local.json"),
11905
+ claudeShimFile: import_node_path36.default.join(root, "claude-shim.json"),
11906
+ headroomDir: import_node_path36.default.join(root, "headroom"),
11907
+ headroomStateFile: import_node_path36.default.join(root, "headroom", "state.json"),
11908
+ headroomRoutingFile: import_node_path36.default.join(root, "headroom", "routing.json"),
11909
+ headroomLegacyStateFile: import_node_path36.default.join(root, "headroom", "state.v2.json"),
11910
+ headroomAllowlistFile: import_node_path36.default.join(root, "headroom", "run", "allowlist.txt"),
11911
+ headroomSocketDir: import_node_path36.default.join(root, "headroom", "run"),
11912
+ headroomLockFile: import_node_path36.default.join(root, "headroom", "start.lock"),
11913
+ headroomSessionsDir: import_node_path36.default.join(root, "headroom", "sessions"),
11914
+ logsDir: import_node_path36.default.join(root, "logs"),
11915
+ headroomLogPath: import_node_path36.default.join(root, "logs", "headroom.log"),
11916
+ frontdoorDir: import_node_path36.default.join(root, "frontdoor"),
11917
+ frontdoorCaDir: import_node_path36.default.join(root, "frontdoor", "ca"),
11918
+ frontdoorCaCertFile: import_node_path36.default.join(root, "frontdoor", "ca", "ca.pem"),
11919
+ frontdoorCaKeyFile: import_node_path36.default.join(root, "frontdoor", "ca", "ca.key"),
11920
+ frontdoorCaBundlesDir: import_node_path36.default.join(root, "frontdoor", "ca", "bundles"),
11921
+ chatgptSignInFile: import_node_path36.default.join(root, "codex", "chatgpt-sign-in.json"),
11922
+ frontdoorStateFile: import_node_path36.default.join(root, "frontdoor", "state.json"),
11923
+ frontdoorLockFile: import_node_path36.default.join(root, "frontdoor", "start.lock"),
11924
+ frontdoorControlTokenFile: import_node_path36.default.join(root, "frontdoor", "control-token"),
11925
+ frontdoorSessionsDir: import_node_path36.default.join(root, "frontdoor", "sessions"),
11926
+ frontdoorDirectRecordsDir: import_node_path36.default.join(root, "frontdoor", "direct"),
11927
+ frontdoorDrainingDir: import_node_path36.default.join(root, "frontdoor", "draining"),
11928
+ frontdoorRcCredentialsDir: import_node_path36.default.join(root, "frontdoor", "rc-credentials"),
11929
+ frontdoorLogPath: import_node_path36.default.join(root, "logs", "frontdoor.log"),
11930
+ usageDir: import_node_path36.default.join(root, "usage"),
11931
+ usageLogDir: import_node_path36.default.join(root, "usage", "log"),
11932
+ usageSnapshotsDir: import_node_path36.default.join(root, "usage", "snapshots"),
11933
+ statuslineDir: import_node_path36.default.join(root, "statusline"),
11934
+ catalogueDir: import_node_path36.default.join(root, "catalogues"),
11935
+ usagePicksFile: import_node_path36.default.join(root, "usage", "picks.json"),
11936
+ usageAnchorsFile: import_node_path36.default.join(root, "usage", "anchors.json"),
11937
+ usageJobsFile: import_node_path36.default.join(root, "usage", "jobs.json"),
11938
+ jobLogsDir: import_node_path36.default.join(root, "logs", "jobs"),
11939
+ identityRenamesDir: import_node_path36.default.join(root, "identity-renames"),
11940
+ identityNameRenamesDir: import_node_path36.default.join(root, "identity-name-renames"),
11941
+ launchesDir: import_node_path36.default.join(root, "launches"),
11942
+ superviseDir: import_node_path36.default.join(root, "supervise"),
11943
+ modelMovesDir: import_node_path36.default.join(root, "model-moves"),
11944
+ mcpPermissionsFile: import_node_path36.default.join(root, "mcp", "permissions.json")
11945
+ };
11946
+ }
11947
+ function resolveLayoutPaths() {
11948
+ return buildLayoutPaths(resolveAgentShimHome());
11949
+ }
11950
+ var import_node_fs10, import_node_os5, import_node_path36;
11951
+ var init_paths = __esm({
11952
+ "src/paths.ts"() {
11953
+ "use strict";
11954
+ import_node_fs10 = __toESM(require("node:fs"), 1);
11955
+ import_node_os5 = __toESM(require("node:os"), 1);
11956
+ import_node_path36 = __toESM(require("node:path"), 1);
11957
+ init_legacy();
11958
+ }
11959
+ });
11960
+
11778
11961
  // src/launcher/claudeVersion.ts
11779
11962
  function validated2(value, origin) {
11780
11963
  if (!NUMERIC_DOTTED_VERSION_RE.test(value)) {
@@ -11817,7 +12000,7 @@ function formatPeriod(window) {
11817
12000
  if (window.periodMs === void 0) {
11818
12001
  return window.period ?? "unknown period";
11819
12002
  }
11820
- const hours = window.periodMs / MS_PER_HOUR4;
12003
+ const hours = window.periodMs / MS_PER_HOUR5;
11821
12004
  return hours >= HOURS_PER_DAY4 && Number.isInteger(hours / HOURS_PER_DAY4) ? `${String(hours / HOURS_PER_DAY4)}d` : `${String(hours)}h`;
11822
12005
  }
11823
12006
  function groupOf(row) {
@@ -11857,13 +12040,13 @@ function collectResets(snapshots, nowMs) {
11857
12040
  );
11858
12041
  return { resets: rows.sort(compareRows) };
11859
12042
  }
11860
- var MS_PER_HOUR4, HOURS_PER_DAY4;
12043
+ var MS_PER_HOUR5, HOURS_PER_DAY4;
11861
12044
  var init_resets = __esm({
11862
12045
  "src/usage/resets.ts"() {
11863
12046
  "use strict";
11864
12047
  init_preflight();
11865
12048
  init_rateLimit();
11866
- MS_PER_HOUR4 = 36e5;
12049
+ MS_PER_HOUR5 = 36e5;
11867
12050
  HOURS_PER_DAY4 = 24;
11868
12051
  }
11869
12052
  });
@@ -12477,7 +12660,7 @@ function providerModels(paths) {
12477
12660
  if (entry.provider.kind === "codex") {
12478
12661
  if (catalogue !== void 0 && catalogue.supervisorPid !== supervisorPid) return [];
12479
12662
  const env = doorHome === void 0 ? process.env : { ...process.env, CODEX_HOME: doorHome };
12480
- const fingerprint = savedCatalogueFingerprint(entry.provider, paths, env, import_node_os6.default.homedir(), realFsPort.readFileUtf8);
12663
+ const fingerprint = savedCatalogueFingerprint(entry.provider, paths, env, import_node_os7.default.homedir(), realFsPort.readFileUtf8);
12481
12664
  if (fingerprint === void 0 || catalogue?.credentialFingerprint !== fingerprint) return [];
12482
12665
  }
12483
12666
  return providerModelRows(entry.provider, catalogue?.models).map((row) => ({ provider: entry.name, model: row.model }));
@@ -12486,11 +12669,11 @@ function providerModels(paths) {
12486
12669
  function targetRefs(paths) {
12487
12670
  return providerModels(paths).map((entry) => `${entry.provider}/${entry.model}`);
12488
12671
  }
12489
- var import_node_os6;
12672
+ var import_node_os7;
12490
12673
  var init_targets = __esm({
12491
12674
  "src/models/targets.ts"() {
12492
12675
  "use strict";
12493
- import_node_os6 = __toESM(require("node:os"), 1);
12676
+ import_node_os7 = __toESM(require("node:os"), 1);
12494
12677
  init_catalogueCredential();
12495
12678
  init_state();
12496
12679
  init_modelPicker();
@@ -13787,7 +13970,10 @@ var init_hold = __esm({
13787
13970
  // src/launcher/launchReport.ts
13788
13971
  function poolDetail(pool) {
13789
13972
  const [reason] = pool.reasons;
13790
- return reason === void 0 ? {} : { detail: reason };
13973
+ if (reason === void 0) {
13974
+ return {};
13975
+ }
13976
+ return { detail: pool.provider === void 0 ? reason : `${reason} (ranked on provider ${pool.provider})` };
13791
13977
  }
13792
13978
  function rankingNotes(ranking, picked) {
13793
13979
  return ranking.flatMap((candidate, index) => [
@@ -13949,6 +14135,7 @@ function resolvePoolLaunch(params) {
13949
14135
  resuming,
13950
14136
  ...params.resumeContextTokens === void 0 ? {} : { resumeContextTokens: params.resumeContextTokens },
13951
14137
  ...params.committedContextTokens === void 0 ? {} : { committedContextTokens: params.committedContextTokens },
14138
+ ...params.providerOf === void 0 ? {} : { providerOf: params.providerOf },
13952
14139
  identityIdOf: identityIdResolver(params.paths.identitiesDir, params.fs),
13953
14140
  ...stickyRead.sticky === void 0 ? {} : { sticky: stickyRead.sticky }
13954
14141
  });
@@ -13990,6 +14177,7 @@ function resolvePoolLaunch(params) {
13990
14177
  explanation: `pool ${poolName}: ${move}${pick.reasons.slice(0, REASONS_LOGGED).join("; ")}`,
13991
14178
  reasons: pick.reasons,
13992
14179
  candidates: graph.ranking.candidates,
14180
+ ...pick.provider === void 0 ? {} : { provider: pick.provider },
13993
14181
  ...movedOff === void 0 ? {} : { movedOff },
13994
14182
  ...stickyRead.sticky === void 0 ? {} : { lastRanAs: stickyRead.sticky }
13995
14183
  };
@@ -14027,7 +14215,7 @@ function childExitCode(result) {
14027
14215
  return result.status;
14028
14216
  }
14029
14217
  if (result.signal !== null) {
14030
- return SIGNAL_EXIT_CODE_OFFSET + import_node_os7.default.constants.signals[result.signal];
14218
+ return SIGNAL_EXIT_CODE_OFFSET + import_node_os8.default.constants.signals[result.signal];
14031
14219
  }
14032
14220
  return 1;
14033
14221
  }
@@ -14041,11 +14229,11 @@ function spawnClaude(params) {
14041
14229
  }
14042
14230
  return params.proc.exit(childExitCode(result));
14043
14231
  }
14044
- var import_node_os7, SIGNAL_EXIT_CODE_OFFSET;
14232
+ var import_node_os8, SIGNAL_EXIT_CODE_OFFSET;
14045
14233
  var init_spawn = __esm({
14046
14234
  "src/launcher/spawn.ts"() {
14047
14235
  "use strict";
14048
- import_node_os7 = __toESM(require("node:os"), 1);
14236
+ import_node_os8 = __toESM(require("node:os"), 1);
14049
14237
  SIGNAL_EXIT_CODE_OFFSET = 128;
14050
14238
  }
14051
14239
  });
@@ -14127,7 +14315,7 @@ function resolveIdentityCredential(identity, credential, env, port) {
14127
14315
  const resolution = resolveCredential({ credential, env, port, subject: `identity ${identity.name}`, cacheKey: identityCacheKey(identity.id) });
14128
14316
  return resolution.ok ? resolution : { ok: false, status: CREDENTIAL_UNAVAILABLE_EXIT, message: `agent-shim: ${resolution.message}` };
14129
14317
  }
14130
- function pickFromPool(decided, params, parsedArgv, readOnly) {
14318
+ function pickFromPool(decided, params, parsedArgv, readOnly, providerSelections) {
14131
14319
  const { paths, fs: fs17, proc, log } = params;
14132
14320
  if (decided.pool === void 0) {
14133
14321
  return { identityDecision: decided };
@@ -14142,6 +14330,17 @@ function pickFromPool(decided, params, parsedArgv, readOnly) {
14142
14330
  return proc.exit(1);
14143
14331
  }
14144
14332
  const resumeContextTokens = resumedContextTokens(farmRuntime.fs, { claudeHome: farmRuntime.claudeHome, cwd: farmRuntime.cwd, passthrough: parsedArgv.rest });
14333
+ const cliFlagConfigProfile = params.cliFlagConfigProfile ?? parsedArgv.configProfile;
14334
+ const providerOf = memberProviderResolver({
14335
+ paths,
14336
+ fs: fs17,
14337
+ env: providerSelections.env,
14338
+ cliProvider: parsedArgv.provider,
14339
+ ...cliFlagConfigProfile === void 0 ? {} : { cliFlagConfigProfile },
14340
+ ...params.directoryRuleConfigProfile === void 0 ? {} : { directoryRuleConfigProfile: params.directoryRuleConfigProfile },
14341
+ ...params.globalDefaultConfigProfile === void 0 ? {} : { globalDefaultConfigProfile: params.globalDefaultConfigProfile },
14342
+ loadCascade: (baseConfigProfile) => farmRuntime.loadCascade(baseConfigProfile, providerSelections.cliOverride)
14343
+ });
14145
14344
  const resolution = resolvePoolLaunch({
14146
14345
  poolName: decided.pool,
14147
14346
  selectedVia: decided.source,
@@ -14153,6 +14352,7 @@ function pickFromPool(decided, params, parsedArgv, readOnly) {
14153
14352
  now: farmRuntime.now,
14154
14353
  sleep: farmRuntime.lock.sleep,
14155
14354
  passthrough: parsedArgv.rest,
14355
+ providerOf,
14156
14356
  ...resumeContextTokens === void 0 ? {} : { resumeContextTokens },
14157
14357
  // A read-only decision never sleeps for a refused pool and never records its pick, so asking what a launch would pick leaves the next real launch's keep-warm preference as it was.
14158
14358
  wait: !readOnly && parsedArgv.wait === true,
@@ -14165,7 +14365,7 @@ function pickFromPool(decided, params, parsedArgv, readOnly) {
14165
14365
  }
14166
14366
  return {
14167
14367
  identityDecision: { ...decided, name: resolution.identity },
14168
- poolPick: { name: decided.pool, reasons: resolution.reasons, ...resolution.movedOff === void 0 ? {} : { movedOff: resolution.movedOff } },
14368
+ poolPick: { name: decided.pool, reasons: resolution.reasons, ...resolution.provider === void 0 ? {} : { provider: resolution.provider }, ...resolution.movedOff === void 0 ? {} : { movedOff: resolution.movedOff } },
14169
14369
  poolRanking: resolution.candidates,
14170
14370
  ...resolution.lastRanAs === void 0 ? {} : { lastRanAs: { identity: resolution.lastRanAs.identity, agoMs: farmRuntime.now() - Date.parse(resolution.lastRanAs.at) } }
14171
14371
  };
@@ -14201,7 +14401,7 @@ function decideLaunch(params, readOnly, onRecorded) {
14201
14401
  shareFlags: parsedArgv.shareFlags,
14202
14402
  hideFlags: parsedArgv.hideFlags
14203
14403
  });
14204
- const { identityDecision, poolPick, poolRanking, lastRanAs } = pickFromPool(decidedIdentity, params, parsedArgv, readOnly);
14404
+ const { identityDecision, poolPick, poolRanking, lastRanAs } = pickFromPool(decidedIdentity, params, parsedArgv, readOnly, { env, cliOverride });
14205
14405
  const lockFarm = !readOnly && !configDirEscapeHatchApplies && identityDecision.name !== void 0 ? params.farm : void 0;
14206
14406
  const lockPorts = params.namesLock ?? (lockFarm === void 0 ? realIdentityNamesLockPorts : { fs: lockFarm.fs, nowMs: lockFarm.now, ...lockFarm.lock });
14207
14407
  const namesLock = readOnly || configDirEscapeHatchApplies || identityDecision.name === void 0 ? void 0 : acquireIdentityNamesLock(paths, lockPorts);
@@ -14402,12 +14602,12 @@ function decideLaunch(params, readOnly, onRecorded) {
14402
14602
  if (definition.kind === "codex" && readOnly && cache !== void 0) {
14403
14603
  const binding = parseCatalogueBinding(params.fs.readFileUtf8(catalogueBindingPath(paths, name, catalogueOwner, generation)));
14404
14604
  const configuredHome = catalogueEnv.CODEX_HOME;
14405
- const home = configuredHome === void 0 || configuredHome === "" ? import_node_path51.default.join(import_node_os8.default.homedir(), ".codex") : configuredHome;
14605
+ const home = configuredHome === void 0 || configuredHome === "" ? import_node_path51.default.join(import_node_os9.default.homedir(), ".codex") : configuredHome;
14406
14606
  const source = definition.codex?.login === "chatgpt-sign-in" ? paths.chatgptSignInFile : import_node_path51.default.resolve(home, "auth.json");
14407
14607
  const revision = params.fs.fileRevision?.(source);
14408
14608
  if (binding === void 0 || binding.fingerprint !== cache.credentialFingerprint || binding.source !== source || revision === void 0 || revision !== binding.revision) return [];
14409
14609
  }
14410
- const fingerprint = definition.kind === "codex" && !readOnly ? savedCatalogueFingerprint(definition, paths, catalogueEnv, import_node_os8.default.homedir(), params.fs.readFileUtf8) : void 0;
14610
+ const fingerprint = definition.kind === "codex" && !readOnly ? savedCatalogueFingerprint(definition, paths, catalogueEnv, import_node_os9.default.homedir(), params.fs.readFileUtf8) : void 0;
14411
14611
  if (definition.kind === "codex" && !readOnly && cache !== void 0 && (fingerprint === void 0 || cache.credentialFingerprint !== fingerprint)) return [];
14412
14612
  return [[name, definition, cache?.models ?? []]];
14413
14613
  } catch {
@@ -14675,12 +14875,12 @@ function runLaunchPlan(plan, spawn3) {
14675
14875
  function runLauncher(params) {
14676
14876
  params.proc.exit(runLaunchPlan(prepareLaunch(params), params.spawn));
14677
14877
  }
14678
- var import_node_crypto17, import_node_os8, import_node_util2, import_node_path51;
14878
+ var import_node_crypto17, import_node_os9, import_node_util2, import_node_path51;
14679
14879
  var init_launcher = __esm({
14680
14880
  "src/launcher.ts"() {
14681
14881
  "use strict";
14682
14882
  import_node_crypto17 = require("node:crypto");
14683
- import_node_os8 = __toESM(require("node:os"), 1);
14883
+ import_node_os9 = __toESM(require("node:os"), 1);
14684
14884
  init_catalogueCredential();
14685
14885
  import_node_util2 = require("node:util");
14686
14886
  import_node_path51 = __toESM(require("node:path"), 1);
@@ -14706,6 +14906,7 @@ var init_launcher = __esm({
14706
14906
  init_state();
14707
14907
  init_providerCatalogue();
14708
14908
  init_providersStore();
14909
+ init_memberProvider();
14709
14910
  init_pool();
14710
14911
  init_resumeContext();
14711
14912
  init_lock();
@@ -14875,7 +15076,7 @@ function realFrontDoorPort(paths, spawnDaemon) {
14875
15076
  const cache2 = parseCatalogueCache(realFarmFs.readFileUtf8(catalogueCachePath(paths, name, supervisorPid, owner.generation)));
14876
15077
  let fingerprint;
14877
15078
  try {
14878
- fingerprint = savedCatalogueFingerprint(provider, paths, { ...process.env, CODEX_HOME: owner.codexHome }, import_node_os9.default.homedir(), realFarmFs.readFileUtf8);
15079
+ fingerprint = savedCatalogueFingerprint(provider, paths, { ...process.env, CODEX_HOME: owner.codexHome }, import_node_os10.default.homedir(), realFarmFs.readFileUtf8);
14879
15080
  } catch (error) {
14880
15081
  warnings.add(`Cannot read catalogue credentials for ${name}: ${error instanceof Error ? error.message : String(error)}`);
14881
15082
  return false;
@@ -14925,12 +15126,12 @@ function realFrontDoorPort(paths, spawnDaemon) {
14925
15126
  }
14926
15127
  };
14927
15128
  }
14928
- var import_node_fs17, import_node_os9, realTrustBundleFs;
15129
+ var import_node_fs17, import_node_os10, realTrustBundleFs;
14929
15130
  var init_realFrontDoorPort = __esm({
14930
15131
  "src/frontdoor/realFrontDoorPort.ts"() {
14931
15132
  "use strict";
14932
15133
  import_node_fs17 = __toESM(require("node:fs"), 1);
14933
- import_node_os9 = __toESM(require("node:os"), 1);
15134
+ import_node_os10 = __toESM(require("node:os"), 1);
14934
15135
  init_providersStore();
14935
15136
  init_providerCatalogue();
14936
15137
  init_catalogueCredential();
@@ -14957,7 +15158,7 @@ var init_realFrontDoorPort = __esm({
14957
15158
 
14958
15159
  // src/launchWiring.ts
14959
15160
  function buildFarmRuntime(paths, cwd, run = realRunPort) {
14960
- const home = import_node_os10.default.homedir();
15161
+ const home = import_node_os11.default.homedir();
14961
15162
  const read = cosmiconfigReader();
14962
15163
  const classification = loadClassification(paths);
14963
15164
  const loaded = loadCascadeInput({ paths, home, cwd, read });
@@ -15071,11 +15272,11 @@ function resolveClaudeLaunch(options, run = realRunPort) {
15071
15272
  };
15072
15273
  return { resolution: resolveLaunch(realPrepareLaunchParams(paths, { proc, log, spawnDaemon, run, farm: buildFarmRuntime(paths, options.cwd, run) })), warnings };
15073
15274
  }
15074
- var import_node_os10, import_node_path54, import_node_crypto19, LaunchRefusedError;
15275
+ var import_node_os11, import_node_path54, import_node_crypto19, LaunchRefusedError;
15075
15276
  var init_launchWiring = __esm({
15076
15277
  "src/launchWiring.ts"() {
15077
15278
  "use strict";
15078
- import_node_os10 = __toESM(require("node:os"), 1);
15279
+ import_node_os11 = __toESM(require("node:os"), 1);
15079
15280
  import_node_path54 = __toESM(require("node:path"), 1);
15080
15281
  import_node_crypto19 = require("node:crypto");
15081
15282
  init_cliError();
@@ -15233,7 +15434,7 @@ var init_anthropicUsageRefresh = __esm({
15233
15434
  init_schema();
15234
15435
  init_identity();
15235
15436
  init_middleware();
15236
- init_pick();
15437
+ init_windowLengths();
15237
15438
  init_plan2();
15238
15439
  PERCENT2 = 100;
15239
15440
  ANTHROPIC_USAGE_FRESHNESS_MS = FIVE_HOUR_WINDOW_MS / PERCENT2;
@@ -15439,14 +15640,14 @@ function createRealAnthropicUsageRefresher(params) {
15439
15640
  },
15440
15641
  now: () => Date.now(),
15441
15642
  log: params.log,
15442
- concurrency: (0, import_node_os11.availableParallelism)()
15643
+ concurrency: (0, import_node_os12.availableParallelism)()
15443
15644
  });
15444
15645
  }
15445
- var import_node_os11, PROBE_LAUNCH_FLAGS;
15646
+ var import_node_os12, PROBE_LAUNCH_FLAGS;
15446
15647
  var init_realAnthropicUsageProbe = __esm({
15447
15648
  "src/usage/realAnthropicUsageProbe.ts"() {
15448
15649
  "use strict";
15449
- import_node_os11 = require("node:os");
15650
+ import_node_os12 = require("node:os");
15450
15651
  init_identityStore();
15451
15652
  init_anthropicUsageRefresh();
15452
15653
  init_identityClaude();
@@ -15812,6 +16013,7 @@ __export(index_exports, {
15812
16013
  realCodexAppServerPort: () => realCodexAppServerPort,
15813
16014
  realConnectCertStore: () => realConnectCertStore,
15814
16015
  realConnectEffects: () => realConnectEffects,
16016
+ realMemberProviderResolver: () => realMemberProviderResolver,
15815
16017
  realRcControlTransport: () => realRcControlTransport,
15816
16018
  realRcEventDial: () => realRcEventDial,
15817
16019
  realRcStreamDial: () => realRcStreamDial,
@@ -19575,7 +19777,7 @@ var import_client8 = require("@orpc/client");
19575
19777
  var import_openapi9 = require("@orpc/openapi");
19576
19778
 
19577
19779
  // src/checkReport.ts
19578
- var import_node_os5 = __toESM(require("node:os"), 1);
19780
+ var import_node_os6 = __toESM(require("node:os"), 1);
19579
19781
  init_cliError();
19580
19782
 
19581
19783
  // src/codex/categories.ts
@@ -19605,7 +19807,7 @@ init_classify();
19605
19807
  init_load();
19606
19808
 
19607
19809
  // src/launchSelection.ts
19608
- var import_node_os3 = __toESM(require("node:os"), 1);
19810
+ var import_node_os4 = __toESM(require("node:os"), 1);
19609
19811
  init_load();
19610
19812
  init_cascade();
19611
19813
  init_identity();
@@ -19622,6 +19824,7 @@ function candidateView(candidate) {
19622
19824
  feasible: candidate.feasible,
19623
19825
  ...candidate.blockedUntilMs === void 0 ? {} : { blockedUntil: new Date(candidate.blockedUntilMs).toISOString() },
19624
19826
  plan: candidate.plan,
19827
+ ...candidate.provider === void 0 ? {} : { provider: candidate.provider },
19625
19828
  reasons: [...candidate.reasons]
19626
19829
  };
19627
19830
  }
@@ -19635,6 +19838,7 @@ function collectPoolPick(params) {
19635
19838
  nowMs: params.nowMs,
19636
19839
  resuming: false,
19637
19840
  identityIdOf: identityIdResolver(params.paths.identitiesDir, params.fs),
19841
+ ...params.providerOf === void 0 ? {} : { providerOf: params.providerOf },
19638
19842
  ...sticky.sticky === void 0 ? {} : { sticky: sticky.sticky }
19639
19843
  });
19640
19844
  return {
@@ -19649,6 +19853,29 @@ function collectPoolPick(params) {
19649
19853
  };
19650
19854
  }
19651
19855
 
19856
+ // src/poolProviderWiring.ts
19857
+ var import_node_os3 = __toESM(require("node:os"), 1);
19858
+ init_load();
19859
+ init_cascade();
19860
+ init_memberProvider();
19861
+ init_realPorts();
19862
+ function realMemberProviderResolver(params) {
19863
+ const home = import_node_os3.default.homedir();
19864
+ const read = cosmiconfigReader();
19865
+ const loaded = params.loaded ?? loadCascadeInput({ paths: params.paths, home, cwd: params.cwd, read });
19866
+ const selections = readDirectorySelections(loaded);
19867
+ return memberProviderResolver({
19868
+ paths: params.paths,
19869
+ fs: realFsPort,
19870
+ env: params.env,
19871
+ cliProvider: params.cliProvider,
19872
+ ...params.cliFlagConfigProfile === void 0 ? {} : { cliFlagConfigProfile: params.cliFlagConfigProfile },
19873
+ ...selections.configProfile === void 0 ? {} : { directoryRuleConfigProfile: selections.configProfile },
19874
+ ...loaded.globalConfig?.defaultConfigProfile === void 0 ? {} : { globalDefaultConfigProfile: loaded.globalConfig.defaultConfigProfile },
19875
+ loadCascade: (baseConfigProfile) => loadCascadeInput({ paths: params.paths, home, cwd: params.cwd, read, ...baseConfigProfile === void 0 ? {} : { baseConfigProfile } }).input
19876
+ });
19877
+ }
19878
+
19652
19879
  // src/launchSelection.ts
19653
19880
  init_poolStore();
19654
19881
  init_realPorts();
@@ -19674,7 +19901,8 @@ function selectLaunch(params, loaded) {
19674
19901
  if (pools[decidedIdentity.pool] === void 0) {
19675
19902
  throw new PoolNotFoundError(decidedIdentity.pool);
19676
19903
  }
19677
- poolPick = collectPoolPick({ paths, fs: realFsPort, usageFs: realFarmFs, poolName: decidedIdentity.pool, pools, directory: cwd, nowMs: Date.now() });
19904
+ const providerOf = realMemberProviderResolver({ paths, cwd, env: params.env, ...params.configProfile === void 0 ? {} : { cliFlagConfigProfile: params.configProfile }, loaded });
19905
+ poolPick = collectPoolPick({ paths, fs: realFsPort, usageFs: realFarmFs, poolName: decidedIdentity.pool, pools, directory: cwd, nowMs: Date.now(), providerOf });
19678
19906
  }
19679
19907
  const identity = poolPick?.pick === void 0 ? decidedIdentity : { ...decidedIdentity, name: poolPick.pick };
19680
19908
  const loadedIdentity = identity.name === void 0 ? void 0 : loadIdentity(paths.identitiesDir, identity.name, realFsPort);
@@ -19691,7 +19919,7 @@ function selectLaunch(params, loaded) {
19691
19919
  };
19692
19920
  }
19693
19921
  function resolveLaunchSelection(params) {
19694
- const loaded = loadCascadeInput({ paths: params.paths, home: import_node_os3.default.homedir(), cwd: params.cwd, read: cosmiconfigReader() });
19922
+ const loaded = loadCascadeInput({ paths: params.paths, home: import_node_os4.default.homedir(), cwd: params.cwd, read: cosmiconfigReader() });
19695
19923
  return selectLaunch(params, loaded).selection;
19696
19924
  }
19697
19925
 
@@ -20031,7 +20259,7 @@ function loadCheckProvider(paths, name) {
20031
20259
  }
20032
20260
  function collectCheckReport(params) {
20033
20261
  const { paths, cwd } = params;
20034
- const home = import_node_os5.default.homedir();
20262
+ const home = import_node_os6.default.homedir();
20035
20263
  const read = cosmiconfigReader();
20036
20264
  const loaded = loadCascadeInput({ paths, home, cwd, read });
20037
20265
  const git = resolveGitBranch(realRunPort, cwd);
@@ -20167,6 +20395,8 @@ var PoolPickCandidateViewSchema = import_zod28.z.strictObject({
20167
20395
  /** When an `ineligible` member can be used again, as an ISO instant. */
20168
20396
  blockedUntil: import_zod28.z.iso.datetime().optional(),
20169
20397
  plan: PlanClassSchema,
20398
+ /** The provider the member was ranked on, when its launch spends one in place of its Claude account: its windows, refusals and plan are the provider's own. Absent when ranked on the Claude account. */
20399
+ provider: import_zod28.z.string().optional(),
20170
20400
  /** The facts behind the class and score, in the order they matter. */
20171
20401
  reasons: import_zod28.z.array(import_zod28.z.string())
20172
20402
  });
@@ -22334,6 +22564,8 @@ var LaunchResolveInputSchema = import_zod41.z.strictObject({
22334
22564
  var LaunchPoolDecisionSchema = import_zod41.z.strictObject({
22335
22565
  name: import_zod41.z.string(),
22336
22566
  reasons: import_zod41.z.readonly(import_zod41.z.array(import_zod41.z.string())),
22567
+ /** The provider the ranking read for the chosen member, when the launch spends one in place of the member's Claude account. */
22568
+ provider: import_zod41.z.string().optional(),
22337
22569
  movedOff: import_zod41.z.strictObject({ identity: import_zod41.z.string(), reason: import_zod41.z.string() }).optional()
22338
22570
  });
22339
22571
  var LaunchDecisionSchema = import_zod41.z.strictObject({
@@ -23084,7 +23316,7 @@ function createDoorHealthPublisher(hub, now, pid) {
23084
23316
  }
23085
23317
 
23086
23318
  // src/frontdoor/quotaExpiringEvents.ts
23087
- init_pick();
23319
+ init_windowLengths();
23088
23320
  var FINAL_SPAN_DENOMINATOR = 30;
23089
23321
  var QUOTA_EXPIRING_WINDOW_FRACTION = 1 / FINAL_SPAN_DENOMINATOR;
23090
23322
  function createQuotaExpiringPublisher(hub, deps) {
@@ -25385,7 +25617,7 @@ init_launcher();
25385
25617
  init_launchWiring();
25386
25618
 
25387
25619
  // src/poolUsageRefresh.ts
25388
- var import_node_os12 = __toESM(require("node:os"), 1);
25620
+ var import_node_os13 = __toESM(require("node:os"), 1);
25389
25621
  init_load();
25390
25622
  init_launchWiring();
25391
25623
  init_argv();
@@ -25399,7 +25631,8 @@ async function refreshStalePoolMembers(params) {
25399
25631
  if (identities.size === 0) {
25400
25632
  return;
25401
25633
  }
25402
- await params.refresher.refreshStale(params.loadMembers([...identities]));
25634
+ const members = params.loadMembers([...identities]).filter((member) => member.provider === void 0 && member.providerError === void 0);
25635
+ await params.refresher.refreshStale(members);
25403
25636
  }
25404
25637
 
25405
25638
  // src/poolUsageRefresh.ts
@@ -25419,7 +25652,7 @@ async function refreshPools(params) {
25419
25652
  await refreshStalePoolMembers({
25420
25653
  poolNames: params.poolNames,
25421
25654
  pools: readPools(paths),
25422
- loadMembers: (identities) => loadPoolMembers(realFarmFs, paths, identities, Date.now(), (name) => identityIdOf(paths, name)),
25655
+ loadMembers: (identities) => loadPoolMembers(realFarmFs, paths, identities, Date.now(), (name) => identityIdOf(paths, name), params.providerOf),
25423
25656
  refresher
25424
25657
  });
25425
25658
  }
@@ -25441,12 +25674,13 @@ async function refreshPoolUsage(params) {
25441
25674
  poolNames: params.poolNames,
25442
25675
  spawnDaemon: daemonSpawnerFor(params.agentShim),
25443
25676
  log: params.log ?? (() => void 0),
25444
- ...params.refresher === void 0 ? {} : { refresher: params.refresher }
25677
+ ...params.refresher === void 0 ? {} : { refresher: params.refresher },
25678
+ ...params.providerOf === void 0 ? {} : { providerOf: params.providerOf }
25445
25679
  });
25446
25680
  }
25447
25681
  function poolSelectedByLaunch(options) {
25448
25682
  const paths = options.paths ?? resolveLayoutPaths();
25449
- const loaded = loadCascadeInput({ paths, home: import_node_os12.default.homedir(), cwd: options.cwd, read: cosmiconfigReader() });
25683
+ const loaded = loadCascadeInput({ paths, home: import_node_os13.default.homedir(), cwd: options.cwd, read: cosmiconfigReader() });
25450
25684
  return decideIdentity({
25451
25685
  env: options.env,
25452
25686
  argv0Identity: parseLauncherArgv(options.argv).identity,
@@ -25456,8 +25690,12 @@ function poolSelectedByLaunch(options) {
25456
25690
  }
25457
25691
  async function refreshLaunchPoolUsage(options) {
25458
25692
  const pool = poolSelectedByLaunch(options);
25693
+ const paths = options.paths ?? resolveLayoutPaths();
25694
+ const parsed = parseLauncherArgv(options.argv);
25459
25695
  await refreshPoolUsage({
25460
- ...options.paths === void 0 ? {} : { paths: options.paths },
25696
+ paths,
25697
+ // The provider each member's launch will spend, resolved as the launch resolves it, so a launch through a provider probes no Claude account.
25698
+ ...pool === void 0 ? {} : { providerOf: realMemberProviderResolver({ paths, cwd: options.cwd, env: options.env, ...parsed.provider === void 0 ? {} : { cliProvider: parsed.provider }, ...parsed.configProfile === void 0 ? {} : { cliFlagConfigProfile: parsed.configProfile } }) },
25461
25699
  cwd: options.cwd,
25462
25700
  poolNames: pool === void 0 ? [] : [pool],
25463
25701
  ...options.agentShim === void 0 ? {} : { agentShim: options.agentShim },
@@ -25830,6 +26068,7 @@ init_ownCli();
25830
26068
  realCodexAppServerPort,
25831
26069
  realConnectCertStore,
25832
26070
  realConnectEffects,
26071
+ realMemberProviderResolver,
25833
26072
  realRcControlTransport,
25834
26073
  realRcEventDial,
25835
26074
  realRcStreamDial,