claude-use 11.42.0 → 11.43.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/cli.cjs CHANGED
@@ -34697,7 +34697,7 @@ var init_package = __esm({
34697
34697
  "package.json"() {
34698
34698
  package_default = {
34699
34699
  name: "claude-use",
34700
- version: "11.42.0",
34700
+ version: "11.43.0",
34701
34701
  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.",
34702
34702
  license: "MIT",
34703
34703
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -64597,24 +64597,40 @@ function selectAdaptive(candidates, needs) {
64597
64597
  return { ref: fallback.ref, reasons: [...reasons, "nothing stands: serving by order"] };
64598
64598
  }
64599
64599
  const current = standing.find((entry) => entry.candidate.isCurrent);
64600
- if (current !== void 0) {
64601
- return { ref: current.candidate.ref, reasons: [...reasons, `${current.candidate.ref} stands and is the model this session is already on, so the conversation is not re-sent`] };
64602
- }
64603
64600
  const ranked = by(
64604
64601
  (left, right) => compareMaybe(left.pressure, right.pressure, true) || compareMaybe(left.hoursToReset, right.hoursToReset, false) || compareMaybe(left.successRate, right.successRate, true),
64605
64602
  standing.map((entry) => entry.candidate)
64606
64603
  );
64607
64604
  const best = ranked[0];
64605
+ if (current !== void 0) {
64606
+ return stayOrSwitch(current.candidate, best, needs, reasons);
64607
+ }
64608
64608
  if (best === void 0) {
64609
64609
  return { ref: void 0, reasons };
64610
64610
  }
64611
64611
  return { ref: best.ref, reasons: [...reasons, `${best.ref} stands and carries the most allowance its reset would waste`] };
64612
64612
  }
64613
- var ADAPTIVE_HEALTH_FLOOR, availability;
64613
+ function stayOrSwitch(current, best, needs, reasons) {
64614
+ const stay = (why) => ({ ref: current.ref, reasons: [...reasons, `${current.ref} stands and is the model this session is already on${why}`] });
64615
+ if (best === void 0 || best.ref === current.ref) {
64616
+ return stay(", so the conversation is not re-sent");
64617
+ }
64618
+ if (needs === void 0 || best.pressure === void 0 || current.pressure === void 0 || current.pressure <= 0) {
64619
+ return stay(", and nothing says a move would pay for re-sending the conversation");
64620
+ }
64621
+ const gain = best.pressure / current.pressure - 1;
64622
+ const cost = needs.contextTokens / FULL_CONTEXT_TOKENS;
64623
+ if (gain > cost) {
64624
+ return { ref: best.ref, reasons: [...reasons, `${best.ref} carries ${gain.toFixed(2)} more of the allowance its reset would waste, more than the ${cost.toFixed(2)} of a full context that re-sending the conversation costs`] };
64625
+ }
64626
+ return stay(`, and ${best.ref}'s gain of ${gain.toFixed(2)} does not beat the ${cost.toFixed(2)} of a full context that re-sending the conversation costs`);
64627
+ }
64628
+ var ADAPTIVE_HEALTH_FLOOR, FULL_CONTEXT_TOKENS, availability;
64614
64629
  var init_engine = __esm({
64615
64630
  "src/selection/engine.ts"() {
64616
64631
  "use strict";
64617
64632
  ADAPTIVE_HEALTH_FLOOR = 0.5;
64633
+ FULL_CONTEXT_TOKENS = 1e6;
64618
64634
  availability = (candidate) => candidate.available ? "" : "quota spent";
64619
64635
  }
64620
64636
  });
@@ -131792,6 +131808,7 @@ init_quotaFacts();
131792
131808
  init_modelsStore();
131793
131809
 
131794
131810
  // src/selection/candidates.ts
131811
+ var MIN_PROJECTION_ELAPSED_SHARE = 0.1;
131795
131812
  var WINDOW_PERIOD_HOURS = { fiveHour: 5, sevenDay: 168, extraUsage: 168 };
131796
131813
  function candidateOf(ref, order, facts, isCurrent) {
131797
131814
  const present = Object.entries(facts.quota ?? {}).map(([name, window]) => ({ name, ...window }));
@@ -131804,6 +131821,15 @@ function candidateOf(ref, order, facts, isCurrent) {
131804
131821
  return period > 0 && window.hoursUntilReset > 0 ? window.remaining / (window.hoursUntilReset / period) : Number.NaN;
131805
131822
  })
131806
131823
  );
131824
+ const runsDry = present.some((window) => {
131825
+ const period = WINDOW_PERIOD_HOURS[window.name] ?? Number.NaN;
131826
+ const elapsed = period - window.hoursUntilReset;
131827
+ if (!(elapsed >= period * MIN_PROJECTION_ELAPSED_SHARE) || window.hoursUntilReset <= 0) {
131828
+ return false;
131829
+ }
131830
+ const pace = (1 - window.remaining) / elapsed;
131831
+ return pace > 0 && window.remaining / pace < window.hoursUntilReset;
131832
+ });
131807
131833
  return {
131808
131834
  ref,
131809
131835
  order,
@@ -131811,8 +131837,7 @@ function candidateOf(ref, order, facts, isCurrent) {
131811
131837
  ...remainingAllowance === void 0 ? {} : { remainingAllowance },
131812
131838
  ...hoursToReset === void 0 ? {} : { hoursToReset },
131813
131839
  ...pressure === void 0 || Number.isNaN(pressure) ? {} : { pressure },
131814
- // Feasibility at the observed burn needs a burn rate no signal yet carries, so an available candidate counts as feasible and the run-dry projection waits on one.
131815
- feasible: available,
131840
+ feasible: available && !runsDry,
131816
131841
  ...facts.observation?.latencyMs === void 0 ? {} : { latencyMs: facts.observation.latencyMs },
131817
131842
  ...facts.observation?.successRate === void 0 ? {} : { successRate: facts.observation.successRate },
131818
131843
  ...facts.price === void 0 || facts.observation?.tokenMix === void 0 ? {} : { pricePerMTok: blendedPricePerMTok(facts.price, facts.observation.tokenMix) },
package/dist/index.cjs CHANGED
@@ -3151,7 +3151,7 @@ var init_package = __esm({
3151
3151
  "package.json"() {
3152
3152
  package_default = {
3153
3153
  name: "claude-use",
3154
- version: "11.42.0",
3154
+ version: "11.43.0",
3155
3155
  description: "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
3156
3156
  license: "MIT",
3157
3157
  author: "Joseph Mearman <joseph@mearman.co.uk>",
package/dist/index.mjs CHANGED
@@ -3127,7 +3127,7 @@ var init_package = __esm({
3127
3127
  "package.json"() {
3128
3128
  package_default = {
3129
3129
  name: "claude-use",
3130
- version: "11.42.0",
3130
+ version: "11.43.0",
3131
3131
  description: "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
3132
3132
  license: "MIT",
3133
3133
  author: "Joseph Mearman <joseph@mearman.co.uk>",