agent-shim 11.89.0 → 11.89.1

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
@@ -36838,6 +36838,9 @@ function assessIdentity(member, nowMs) {
36838
36838
  const state = member.snapshot?.providers[ANTHROPIC_PROVIDER];
36839
36839
  const unified = unifiedOf(state);
36840
36840
  if (member.snapshot === void 0 || state === void 0 || unified === void 0) {
36841
+ if (plan.kind === "pay-per-use") {
36842
+ 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)"] } };
36843
+ }
36841
36844
  return { candidate: { ...base, class: "unknown", reasons: ["no usage recorded yet, so its quota is unknown (turn on trackUsage for it)", ...planReasons] } };
36842
36845
  }
36843
36846
  const observedAgo = state.rateLimit === void 0 ? "" : ` (last seen ${formatAge(nowMs - Date.parse(state.rateLimit.observedAt))} ago)`;
@@ -36969,7 +36972,7 @@ function rankPool(input2) {
36969
36972
  return { ...candidate, feasible: false, runsDryAtMs: nowMs + Math.min(...dryAfterMs), reasons: [...drySpots, ...candidate.reasons] };
36970
36973
  });
36971
36974
  const ordered = input2.preference === "listed" ? [...candidates] : [...candidates].sort(
36972
- (left, right) => CLASS_ORDER[left.class] - CLASS_ORDER[right.class] || Number(left.policyDemoted ?? false) - Number(right.policyDemoted ?? false) || Number(right.feasible) - Number(left.feasible) || (right.headroom ?? 1) - (left.headroom ?? 1) || (right.score ?? 0) - (left.score ?? 0) || left.identity.localeCompare(right.identity)
36975
+ (left, right) => CLASS_ORDER[left.class] - CLASS_ORDER[right.class] || Number(left.policyDemoted ?? false) - Number(right.policyDemoted ?? false) || Number(right.feasible) - Number(left.feasible) || Number(left.usageUnrecorded ?? false) - Number(right.usageUnrecorded ?? false) || (right.headroom ?? 1) - (left.headroom ?? 1) || (right.score ?? 0) - (left.score ?? 0) || left.identity.localeCompare(right.identity)
36973
36976
  );
36974
36977
  const sticky = input2.sticky;
36975
36978
  const stickyIndex = sticky === void 0 ? -1 : ordered.findIndex((candidate) => candidate.identity === sticky.identity);
@@ -41986,7 +41989,7 @@ var init_package = __esm({
41986
41989
  "package.json"() {
41987
41990
  package_default = {
41988
41991
  name: "agent-shim",
41989
- version: "11.89.0",
41992
+ version: "11.89.1",
41990
41993
  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.",
41991
41994
  license: "MIT",
41992
41995
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -137375,7 +137378,7 @@ init_zod();
137375
137378
  init_plan();
137376
137379
  var PoolPickCandidateViewSchema = external_exports.strictObject({
137377
137380
  identity: external_exports.string(),
137378
- /** In pick order: `scored` has usable quota data, `unknown` has none, `pay-per-use` bills by use, `ineligible` is refused right now. */
137381
+ /** In pick order: `scored` has usable quota data, `unknown` has none and no plan known to bill by use, `pay-per-use` bills by use whether or not usage is recorded, `ineligible` is refused right now. */
137379
137382
  class: external_exports.enum(["scored", "unknown", "pay-per-use", "ineligible"]),
137380
137383
  /** Plan-size-weighted remaining quota per hour until its reset; present for `scored` only. */
137381
137384
  score: external_exports.number().optional(),
package/dist/index.cjs CHANGED
@@ -9238,6 +9238,9 @@ function assessIdentity(member, nowMs) {
9238
9238
  const state = member.snapshot?.providers[ANTHROPIC_PROVIDER];
9239
9239
  const unified = unifiedOf(state);
9240
9240
  if (member.snapshot === void 0 || state === void 0 || unified === void 0) {
9241
+ if (plan.kind === "pay-per-use") {
9242
+ 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)"] } };
9243
+ }
9241
9244
  return { candidate: { ...base, class: "unknown", reasons: ["no usage recorded yet, so its quota is unknown (turn on trackUsage for it)", ...planReasons] } };
9242
9245
  }
9243
9246
  const observedAgo = state.rateLimit === void 0 ? "" : ` (last seen ${formatAge(nowMs - Date.parse(state.rateLimit.observedAt))} ago)`;
@@ -9369,7 +9372,7 @@ function rankPool(input) {
9369
9372
  return { ...candidate, feasible: false, runsDryAtMs: nowMs + Math.min(...dryAfterMs), reasons: [...drySpots, ...candidate.reasons] };
9370
9373
  });
9371
9374
  const ordered = input.preference === "listed" ? [...candidates] : [...candidates].sort(
9372
- (left, right) => CLASS_ORDER[left.class] - CLASS_ORDER[right.class] || Number(left.policyDemoted ?? false) - Number(right.policyDemoted ?? false) || Number(right.feasible) - Number(left.feasible) || (right.headroom ?? 1) - (left.headroom ?? 1) || (right.score ?? 0) - (left.score ?? 0) || left.identity.localeCompare(right.identity)
9375
+ (left, right) => CLASS_ORDER[left.class] - CLASS_ORDER[right.class] || Number(left.policyDemoted ?? false) - Number(right.policyDemoted ?? false) || Number(right.feasible) - Number(left.feasible) || Number(left.usageUnrecorded ?? false) - Number(right.usageUnrecorded ?? false) || (right.headroom ?? 1) - (left.headroom ?? 1) || (right.score ?? 0) - (left.score ?? 0) || left.identity.localeCompare(right.identity)
9373
9376
  );
9374
9377
  const sticky = input.sticky;
9375
9378
  const stickyIndex = sticky === void 0 ? -1 : ordered.findIndex((candidate) => candidate.identity === sticky.identity);
@@ -10516,7 +10519,7 @@ var init_package = __esm({
10516
10519
  "package.json"() {
10517
10520
  package_default = {
10518
10521
  name: "agent-shim",
10519
- version: "11.89.0",
10522
+ version: "11.89.1",
10520
10523
  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.",
10521
10524
  license: "MIT",
10522
10525
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -19361,7 +19364,7 @@ var import_zod27 = require("zod");
19361
19364
  init_plan2();
19362
19365
  var PoolPickCandidateViewSchema = import_zod27.z.strictObject({
19363
19366
  identity: import_zod27.z.string(),
19364
- /** In pick order: `scored` has usable quota data, `unknown` has none, `pay-per-use` bills by use, `ineligible` is refused right now. */
19367
+ /** In pick order: `scored` has usable quota data, `unknown` has none and no plan known to bill by use, `pay-per-use` bills by use whether or not usage is recorded, `ineligible` is refused right now. */
19365
19368
  class: import_zod27.z.enum(["scored", "unknown", "pay-per-use", "ineligible"]),
19366
19369
  /** Plan-size-weighted remaining quota per hour until its reset; present for `scored` only. */
19367
19370
  score: import_zod27.z.number().optional(),
package/dist/index.mjs CHANGED
@@ -9211,6 +9211,9 @@ function assessIdentity(member, nowMs) {
9211
9211
  const state = member.snapshot?.providers[ANTHROPIC_PROVIDER];
9212
9212
  const unified = unifiedOf(state);
9213
9213
  if (member.snapshot === void 0 || state === void 0 || unified === void 0) {
9214
+ if (plan.kind === "pay-per-use") {
9215
+ 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)"] } };
9216
+ }
9214
9217
  return { candidate: { ...base, class: "unknown", reasons: ["no usage recorded yet, so its quota is unknown (turn on trackUsage for it)", ...planReasons] } };
9215
9218
  }
9216
9219
  const observedAgo = state.rateLimit === void 0 ? "" : ` (last seen ${formatAge(nowMs - Date.parse(state.rateLimit.observedAt))} ago)`;
@@ -9342,7 +9345,7 @@ function rankPool(input) {
9342
9345
  return { ...candidate, feasible: false, runsDryAtMs: nowMs + Math.min(...dryAfterMs), reasons: [...drySpots, ...candidate.reasons] };
9343
9346
  });
9344
9347
  const ordered = input.preference === "listed" ? [...candidates] : [...candidates].sort(
9345
- (left, right) => CLASS_ORDER[left.class] - CLASS_ORDER[right.class] || Number(left.policyDemoted ?? false) - Number(right.policyDemoted ?? false) || Number(right.feasible) - Number(left.feasible) || (right.headroom ?? 1) - (left.headroom ?? 1) || (right.score ?? 0) - (left.score ?? 0) || left.identity.localeCompare(right.identity)
9348
+ (left, right) => CLASS_ORDER[left.class] - CLASS_ORDER[right.class] || Number(left.policyDemoted ?? false) - Number(right.policyDemoted ?? false) || Number(right.feasible) - Number(left.feasible) || Number(left.usageUnrecorded ?? false) - Number(right.usageUnrecorded ?? false) || (right.headroom ?? 1) - (left.headroom ?? 1) || (right.score ?? 0) - (left.score ?? 0) || left.identity.localeCompare(right.identity)
9346
9349
  );
9347
9350
  const sticky = input.sticky;
9348
9351
  const stickyIndex = sticky === void 0 ? -1 : ordered.findIndex((candidate) => candidate.identity === sticky.identity);
@@ -10489,7 +10492,7 @@ var init_package = __esm({
10489
10492
  "package.json"() {
10490
10493
  package_default = {
10491
10494
  name: "agent-shim",
10492
- version: "11.89.0",
10495
+ version: "11.89.1",
10493
10496
  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.",
10494
10497
  license: "MIT",
10495
10498
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -18919,7 +18922,7 @@ init_plan2();
18919
18922
  import { z as z27 } from "zod";
18920
18923
  var PoolPickCandidateViewSchema = z27.strictObject({
18921
18924
  identity: z27.string(),
18922
- /** In pick order: `scored` has usable quota data, `unknown` has none, `pay-per-use` bills by use, `ineligible` is refused right now. */
18925
+ /** In pick order: `scored` has usable quota data, `unknown` has none and no plan known to bill by use, `pay-per-use` bills by use whether or not usage is recorded, `ineligible` is refused right now. */
18923
18926
  class: z27.enum(["scored", "unknown", "pay-per-use", "ineligible"]),
18924
18927
  /** Plan-size-weighted remaining quota per hour until its reset; present for `scored` only. */
18925
18928
  score: z27.number().optional(),
@@ -27275,7 +27275,7 @@ interface RankPoolInput {
27275
27275
  /** How members are ordered: "score" (the default when absent) by the use-it-or-lose-it ranking, "listed" strictly in `members` order. */
27276
27276
  readonly preference?: "score" | "listed";
27277
27277
  }
27278
- /** In pick order. `scored` has usable quota data; `unknown` has none (never recorded, or unreadable); `pay-per-use` bills by use instead of drawing on a plan; `ineligible` is refused right now. */
27278
+ /** In pick order. `scored` has usable quota data; `unknown` has none and no plan known to bill by use (never recorded, or unreadable); `pay-per-use` bills by use instead of drawing on a plan, whether or not any usage is recorded; `ineligible` is refused right now. */
27279
27279
  type CandidateClass = "scored" | "unknown" | "pay-per-use" | "ineligible";
27280
27280
  interface Candidate {
27281
27281
  readonly identity: string;
@@ -27290,6 +27290,8 @@ interface Candidate {
27290
27290
  readonly runsDryAtMs?: number;
27291
27291
  /** The fraction of the extra-usage allowance still unspent, for a `pay-per-use` member whose only budget is that allowance (an Enterprise account). A member reporting none ranks as having all of it: no cap is known to bind. */
27292
27292
  readonly headroom?: number;
27293
+ /** True for a `pay-per-use` member with no usage recorded: its account metadata says it bills by use, but its extra-usage meter has never been read, so its spend is invisible to `agent-shim usage` and its headroom is unknown rather than full. It ranks behind every `pay-per-use` member whose allowance is on record. */
27294
+ readonly usageUnrecorded?: boolean;
27293
27295
  /** When an `ineligible` candidate can be used again. */
27294
27296
  readonly blockedUntilMs?: number;
27295
27297
  /** When the exhausted plan window of a `pay-per-use` candidate that is only on extra usage because its plan ran out resets, so a launch can hold for it rather than spend. Absent for a candidate that bills by use with no plan allowance. */
@@ -27329,9 +27331,9 @@ interface PoolRanking {
27329
27331
  /**
27330
27332
  * Ranks `members` for a launch.
27331
27333
  *
27332
- * A member is `ineligible` while a window of its plan, or a refusal it last hit, still binds; it is `unknown` without recorded quota, `pay-per-use` when its usage bills by use, and otherwise `scored`. Scored members order by how much plan-size-weighted quota would expire unused per hour of runway, with any whose five-hour window would run dry at the observed pace (their own, or the person's pace on another member rescaled by plan size) or whose seven-day window would run dry at its own observed pace placed behind those that would not. The member last picked for this directory then moves to the front if it still serves on plan quota and is not projected to run dry, and either the launch resumes a conversation or its prompt cache is still warm; a resumed conversation that cannot keep its member re-ranks and continues on the pick, with the move named in `movedOff`.
27334
+ * A member is `ineligible` while a window of its plan, or a refusal it last hit, still binds; it is `pay-per-use` when its usage bills by use (including an account whose metadata says so and that has no usage recorded yet), `unknown` without recorded quota and no such plan, and otherwise `scored`. Scored members order by how much plan-size-weighted quota would expire unused per hour of runway, with any whose five-hour window would run dry at the observed pace (their own, or the person's pace on another member rescaled by plan size) or whose seven-day window would run dry at its own observed pace placed behind those that would not. The member last picked for this directory then moves to the front if it still serves on plan quota and is not projected to run dry, and either the launch resumes a conversation or its prompt cache is still warm; a resumed conversation that cannot keep its member re-ranks and continues on the pick, with the move named in `movedOff`.
27333
27335
  *
27334
- * How members are ordered depends on `preference`. The default, "score", is the order above: class first, then feasibility, then score, with ties by name. "listed" keeps the order of `members`, which callers build in pool member order, so member order, not class, decides: an `unknown` (no usage recorded) or `pay-per-use` member can be picked before a later `scored` one, which is the list owner's stated preference, and a `scored` member that is not feasible keeps its place and its reason line rather than being demoted. In both modes the pick is the first non-`ineligible` candidate, `earliestReturn` still reports the soonest returning refused member, and the sticky-pick promotion applies unchanged.
27336
+ * How members are ordered depends on `preference`. The default, "score", is the order above: class first, then feasibility, then (among members that bill by use) those whose usage is recorded before those whose is not, then headroom, then score, with ties by name. "listed" keeps the order of `members`, which callers build in pool member order, so member order, not class, decides: an `unknown` (no usage recorded) or `pay-per-use` member can be picked before a later `scored` one, which is the list owner's stated preference, and a `scored` member that is not feasible keeps its place and its reason line rather than being demoted. In both modes the pick is the first non-`ineligible` candidate, `earliestReturn` still reports the soonest returning refused member, and the sticky-pick promotion applies unchanged.
27335
27337
  */
27336
27338
  declare function rankPool(input: RankPoolInput): PoolRanking;
27337
27339
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-shim",
3
- "version": "11.89.0",
3
+ "version": "11.89.1",
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>",