tokenmaxxing 1.128.0 → 1.129.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.128.0",
3
+ "version": "1.129.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",
@@ -7,7 +7,7 @@ import { codexPaths, codexPool } from "../lib/paths.ts";
7
7
  import { withLock } from "../lib/lock.ts";
8
8
  import { CODEX_BIN, UNMANAGED_ENV, WRAP_DEPTH_ENV, resolveRealBin, wrapDepth } from "../lib/claudebin.ts";
9
9
  import { codexStoreUsable, ensureCodexStoreHome } from "../lib/codexauth.ts";
10
- import { CODEX_SUPERVISOR_ID_ENV, borrowCodexSeat, codexPickCtx, pickCodexSeat } from "../lib/codex.ts";
10
+ import { CODEX_CRED_ENV, CODEX_SUPERVISOR_ID_ENV, borrowCodexSeat, codexPickCtx, pickCodexSeat } from "../lib/codex.ts";
11
11
  import { clearPresence, livingPresences } from "../lib/presence.ts";
12
12
  import { isExhausted } from "../lib/picker.ts";
13
13
  import { exitStatus, loopGuardTripped, raceMarkerOrExit, recordPresenceOrStop, runPassthrough } from "../lib/supervise.ts";
@@ -100,12 +100,11 @@ export async function runCodexSupervisor(input: { argv: string[] }): Promise<num
100
100
  });
101
101
  const granted = borrowsCodexSeat({ argv }) ? await borrowCodexSeat(process.pid) : undefined;
102
102
  const seat = granted && !("denied" in granted) ? granted : null;
103
- if (seat) passthroughEnv.CODEX_HOME = seat.store;
104
- else if (granted !== undefined) log("codexsupervisor.borrow_none", { reason: granted && "denied" in granted ? granted.denied : "no usable account" });
103
+ if (!seat && granted !== undefined) log("codexsupervisor.borrow_none", { reason: granted && "denied" in granted ? granted.denied : "no usable account" });
105
104
  return runPassthrough({
106
105
  real,
107
106
  argv,
108
- env: passthroughEnv,
107
+ env: seat ? { ...omit(passthroughEnv, CODEX_CRED_ENV), CODEX_HOME: seat.store } : passthroughEnv,
109
108
  onSpawn: (p) => {
110
109
  child = p;
111
110
  return seat
@@ -148,7 +147,7 @@ export async function runCodexSupervisor(input: { argv: string[] }): Promise<num
148
147
  stdout: "inherit",
149
148
  stderr: "inherit",
150
149
  env: {
151
- ...childEnv,
150
+ ...(store ? omit(childEnv, CODEX_CRED_ENV) : childEnv),
152
151
  [CODEX_SUPERVISOR_ID_ENV]: supervisorId,
153
152
  ...(store ? { CODEX_HOME: store } : {}),
154
153
  },
package/src/lib/codex.ts CHANGED
@@ -21,6 +21,7 @@ import type { Account, CodexAuthJson, CodexUsage, Config } from "./types.ts";
21
21
  import { c } from "../cli/render.ts";
22
22
 
23
23
  export const CODEX_SUPERVISOR_ID_ENV = "TOKENMAXXING_CODEX_SUPERVISOR_ID";
24
+ export const CODEX_CRED_ENV = ["CODEX_ACCESS_TOKEN", "CODEX_API_KEY"] as const;
24
25
 
25
26
  function liveId(): string | null {
26
27
  return codexSeatFromEnv(loadAccounts(codexPool).accounts.map((a) => a.id));