/** `ocx account` — list and switch provider credentials (issue #180). */ import { loadConfig } from "../config"; import { providerCodexAccountMode } from "../providers/registry"; import type { OcxConfig } from "../types"; import { cmdAddKey, cmdAlias, cmdAutoSwitch, cmdClearCooldown, cmdImport, cmdPause, cmdPauseExhausted, cmdPriority, cmdRefresh, cmdRemove, cmdSticky, cmdStrategy, } from "./account-extended"; import { apiError, apiJson, classifyAccount, fetchRows, proxyUnreachable, resolveBaseUrl, type AccountDeps, type AccountRow, type AccountType, type ApiResult } from "./account-api"; export { classifyAccount } from "./account-api"; export type { AccountDeps, AccountRow, AccountType, ClassifyResult } from "./account-api"; type TargetProvenance = "live-oauth-list" | "config" | "codex"; const MAIN_ALIAS = "main"; const MAIN_CODEX_ID = "__main__"; /** * Replacement-style single-slot OAuth (no stable identity; not HTTP-derivable). * * Empty since `d82b3049d` gave Kiro a quota-aware account pool: multiple Kiro accounts are * stored under multiauth, ranked by remaining headroom in `rankAccountsByHeadroom`, and * rotated on 429 by the generic OAuth failover path, which does not exclude Kiro. Printing a * "single login slot" note alongside a list of several pooled accounts told operators the * opposite of what the runtime does. * * Kept as a named seam rather than deleted: the replacement-style shape is a real category, * and a future provider without stable per-account identity belongs here. */ const REPLACEMENT_STYLE_OAUTH = new Set(); const ACCOUNT_USAGE = `Usage: ocx account list [provider] [--json] [--all] [--quota [--refresh]] ocx account current [--json] ocx account use [--json] ocx account refresh [--json] ocx account auto-switch > [--json] ocx account alias [--json] ocx account priority [<-100..100|first|earlier|normal|later|last|reset>] [--json] ocx account pause [--json] ocx account resume [--json] ocx account pause-exhausted [--json] ocx account strategy [] [--json] ocx account sticky [<1-100>] [--json] ocx account remove --yes [--json] ocx account clear-cooldown [--json] ocx account add-key [--label