tokenmaxxing 1.164.0 → 1.165.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tokenmaxxing",
3
- "version": "1.164.0",
3
+ "version": "1.165.0",
4
4
  "description": "Automatic Claude Code account switching: pool multiple accounts, start each session on its own account, and resume a session on a fresher account when quota fills.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -33,6 +33,11 @@ export type StatusOnlySpec = {
33
33
  samplePool: Provider["samplePool"];
34
34
  };
35
35
 
36
+ // An entry with no identity (a Muse Code provider without an email) has no harvest; the first one that has one is pooled.
37
+ function firstHarvest(entries: AuthEntry[]): Harvest | null {
38
+ return entries.find((e) => e.harvest)?.harvest ?? null;
39
+ }
40
+
36
41
  export function statusOnlyProvider(spec: StatusOnlySpec): Provider {
37
42
  const bin = { name: spec.binName, key: spec.binKey, versionOk: spec.versionOk };
38
43
 
@@ -57,12 +62,9 @@ export function statusOnlyProvider(spec: StatusOnlySpec): Provider {
57
62
  });
58
63
  await p.exited;
59
64
  try {
60
- const first = p.exitCode === 0 ? spec.readAuth(join(onboardDir, spec.onboardAuthRel))[0] : undefined;
61
- if (!first) {
62
- console.error(c.red(`no ${spec.name} login landed in the isolated home - nothing added.`));
63
- return null;
64
- }
65
- return first.harvest;
65
+ const harvest = p.exitCode === 0 ? firstHarvest(spec.readAuth(join(onboardDir, spec.onboardAuthRel))) : null;
66
+ if (!harvest) console.error(c.red(`no ${spec.name} login landed in the isolated home - nothing added.`));
67
+ return harvest;
66
68
  } finally {
67
69
  rmSync(onboardDir, { recursive: true, force: true });
68
70
  }
@@ -71,13 +73,11 @@ export function statusOnlyProvider(spec: StatusOnlySpec): Provider {
71
73
  async function importLive(): Promise<Harvest | null> {
72
74
  console.log(c.cyan(spec.importIntro));
73
75
  console.log();
74
- const live = spec.readAuth(spec.liveAuthPath());
75
- const first = live[0];
76
- if (first) {
77
- console.log(c.dim(spec.foundLive(live.length)));
78
- if (first.harvest) return first.harvest;
79
- }
80
- return login();
76
+ const live = spec.readAuth(spec.liveAuthPath()).filter((e) => e.harvest);
77
+ const harvest = live[0]?.harvest;
78
+ if (!harvest) return login();
79
+ console.log(c.dim(spec.foundLive(live.length)));
80
+ return harvest;
81
81
  }
82
82
 
83
83
  function preflight(): void {