claude-multiacc 2.0.11 → 2.0.12

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.
@@ -909,10 +909,13 @@ ceremony_token_check() { # $1 = token
909
909
  commit_ceremony_token() {
910
910
  local d="$1" tok="$2" id="$3" rc=0
911
911
  ceremony_token_check "$tok" || rc=$?
912
+ # A short capture is a wrapped one unless Claude itself has just answered with it:
913
+ # the length alone convicts it, so an inconclusive probe (429, network) must not let
914
+ # it through as merely "unverified" — that is the exact token the fleet then rejects.
915
+ if [ "$rc" -ne 0 ] && [ "${#tok}" -lt "$SETUP_TOKEN_FULL_LEN" ]; then
916
+ die "the captured token is ${#tok} characters and a complete setup-token is $SETUP_TOKEN_FULL_LEN (${CEREMONY_CHECK_DETAIL:-not proven by a real call}): the sign-in terminal wrapped it and only its first line was captured. Nothing saved for $id. Mint again from a terminal at least $CEREMONY_TTY_MIN_COLS columns wide, or from an updated panel."
917
+ fi
912
918
  if [ "$rc" -eq 1 ]; then
913
- if [ "${#tok}" -lt "$SETUP_TOKEN_FULL_LEN" ]; then
914
- die "Claude rejected the captured token (${CEREMONY_CHECK_DETAIL:-401}) — it is ${#tok} characters and a complete setup-token is $SETUP_TOKEN_FULL_LEN: the sign-in terminal wrapped it and only its first line was captured. Nothing saved for $id. Mint again from a terminal at least $CEREMONY_TTY_MIN_COLS columns wide, or from an updated panel."
915
- fi
916
919
  die "Claude rejected the captured token (${CEREMONY_CHECK_DETAIL:-401}) — nothing saved for $id; sign in again as the right account and retry"
917
920
  fi
918
921
  ( umask 077; printf '%s' "$tok" > "$d/server.token" )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-multiacc",
3
- "version": "2.0.11",
3
+ "version": "2.0.12",
4
4
  "description": "Unified Claude Code and OpenAI Codex subscription pooling with quota-aware selection.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -104,6 +104,10 @@ case "${CLAUDE_CODE_OAUTH_TOKEN:-}" in
104
104
  sk-ant-oat01-WWW*)
105
105
  # The wrapped fixture above: only the COMPLETE token (with its tail) authenticates;
106
106
  # its 79-character first line is what Claude answered 401 to, fleet-wide.
107
+ if [ -n "${FAKE_PROBE_FLAKY:-}" ]; then
108
+ # Not an auth verdict at all — the API is busy. The probe is inconclusive.
109
+ echo "API Error: 529 Overloaded" >&2; exit 1
110
+ fi
107
111
  case "$CLAUDE_CODE_OAUTH_TOKEN" in
108
112
  *TAILOK) : ;;
109
113
  *) echo "Failed to authenticate. API Error: 401 OAuth access token is invalid." >&2; exit 1 ;;
@@ -1308,8 +1312,31 @@ check "the refusal names the truncation" "79 characters" "$out"
1308
1312
  check "the refusal names the cause" "terminal wrapped it" "$out"
1309
1313
  [ "$(cat "$ACC/acct-04/server.token")" = "$orig" ] && t_ok "a refused capture leaves the old token in place" \
1310
1314
  || t_fail "refused capture" "server.token was overwritten"
1315
+ # An INCONCLUSIVE probe (the API is busy) must not let a wrapped capture through as
1316
+ # merely "unverified": its length alone convicts it, and that is the exact token the
1317
+ # fleet then rejects on every Mac.
1318
+ out="$(FAKE_TOKEN_FULL=1 FAKE_TOKEN_WRAP=1 FAKE_PROBE_FLAKY=1 claude-accounts mint acct-04 2>&1 </dev/null)"
1319
+ rc=$?
1320
+ [ "$rc" != "0" ] && t_ok "a wrapped capture is refused even when the probe is inconclusive" \
1321
+ || t_fail "wrapped+inconclusive rc" "rc=0"
1322
+ check "the inconclusive refusal still names the cause" "terminal wrapped it" "$out"
1323
+ [ "$(cat "$ACC/acct-04/server.token")" = "$orig" ] && t_ok "an unproven fragment saves nothing" \
1324
+ || t_fail "unproven fragment" "server.token was overwritten"
1325
+ # …while a COMPLETE token the probe cannot reach right now is saved as UNVERIFIED — the
1326
+ # shim proves it on first use — rather than blocking the operator on a busy API.
1327
+ out="$(FAKE_TOKEN_FULL=1 FAKE_PROBE_FLAKY=1 claude-accounts mint acct-04 2>&1 </dev/null)"
1328
+ rc=$?
1329
+ [ "$rc" = "0" ] && t_ok "a complete token survives an inconclusive probe" || t_fail "complete+inconclusive rc" "rc=$rc: $(printf '%s' "$out" | tail -c 200)"
1330
+ check "the inconclusive save says so" "saved as UNVERIFIED" "$out"
1331
+ [ "$(tr -d '[:space:]' < "$ACC/acct-04/server.token" | wc -c | tr -d ' ')" = "108" ] \
1332
+ && t_ok "the complete token was saved" || t_fail "complete token save" "wrong length"
1333
+ [ ! -f "$ACC/acct-04/.server-token-verified" ] && t_ok "an unproven save records no proof" \
1334
+ || t_fail "unproven proof marker" "marker present"
1335
+ printf '%s' "$orig" > "$ACC/acct-04/server.token"
1311
1336
  # A pasted token gets the same proof: a revoked one is refused, not saved.
1312
- out="$(printf 'sk-ant-oat01-REVOKEDREVOKEDREVOKEDREVOKEDREVOKEDREVOKEDREVOKED' | claude-accounts mint acct-04 --paste 2>&1)"
1337
+ # (A complete-length token, so the verdict is the rejection itself and not the
1338
+ # length rule that catches wrapped fragments first.)
1339
+ out="$(printf 'sk-ant-oat01-REVOKED%s' "$(printf '%88s' '' | tr ' ' R)" | claude-accounts mint acct-04 --paste 2>&1)"
1313
1340
  rc=$?
1314
1341
  [ "$rc" != "0" ] && t_ok "mint --paste refuses a token Claude rejects" || t_fail "paste rejected rc" "rc=0"
1315
1342
  check "the paste refusal says Claude rejected it" "Claude rejected the captured token" "$out"