/** Runtime proxy mode exposed by the statusline. */ export type ProxyMode = 'oauth-first' | 'oauth-burst' | 'api-first'; /** Binary auth mode (back-compat field). */ export type AuthMode = 'oauth' | 'api'; /** Four-state effective mode the statusline renders. */ export type EffectiveMode = 'oauth' | 'oauth-burst' | 'api-auto' | 'api'; /** `claude switch list --json` — one entry per saved account. */ export interface AccountSummary { email: string; /** Primary alias, or null when the account has none. */ alias: string | null; /** All aliases pointing at this account. */ aliases: string[]; active: boolean; } /** Optional cache-health block embedded in the statusline payload. */ export interface StatuslineCacheHealth { hitRatio: number; flushCount: number; effectiveInputTokens: number; turns: number; } /** `claude switch sl --json` — full statusline snapshot. */ export interface StatuslineSnapshot { email: string | null; shortName: string | null; mode: AuthMode; effectiveMode: EffectiveMode; proxyRuntimeMode: ProxyMode | null; fallback: boolean; fallbackAutoEngaged: boolean; hasApiKey: boolean; fiveHour: number | null; sevenDay: number | null; profile: string | null; /** Present only when an active Claude Code session JSONL is detectable. */ cacheHealth?: StatuslineCacheHealth; } /** `claude switch usage-snapshot --json`. */ export interface UsageSnapshot { /** Canonical account email (field is named `account`, not `email`). */ account: string; fetchedAt: number | null; ageSec: number | null; fiveHourPct: number | null; sevenDayPct: number | null; sevenDayOpusPct: number | null; sevenDaySonnetPct: number | null; rateLimitedUntil: number | null; } /** `claude switch alias --list --json` — one entry per alias. */ export interface AliasEntry { alias: string; email: string; } /** `claude switch fallback status --json`. */ export interface FallbackStatus { enabled: boolean; autoRevert: { enabled: boolean; threshold: number; }; autoEngage: { enabled: boolean; threshold: number; }; activeAccount: string | null; hasApiKey: boolean; } /** `claude switch profile list --json` — one entry per profile. */ export interface ProfileEntry { name: string; /** Email the profile is logged into, or null when it needs login. */ account: string | null; hasLogin: boolean; /** Absolute config directory for the profile (`~/.claude/profiles/`). * Consumers spawn an isolated `claude` by setting `CLAUDE_CONFIG_DIR` to * this path. */ path: string; } /** `claude switch skills list --json` — one entry per globally installed skill. */ export interface SkillEntry { name: string; /** First line of the SKILL.md description, or null when absent. */ description: string | null; /** Origin of the skill. Currently only the user skills dir is inventoried. */ source: 'user'; /** Absolute path to the skill directory. */ path: string; } /** `claude switch profile skills list

--json` — one entry per skill known * to the profile (global skills, linked or available, plus broken links). */ export interface ProfileSkillEntry { name: string; /** A symlink for this skill exists in the profile's skills dir. */ linked: boolean; /** The link exists but its global target is gone. */ broken: boolean; /** Absolute path of the global skill dir (the link target). */ path: string; } /** Transport an MCP server speaks. */ export type McpTransport = 'stdio' | 'sse' | 'http'; /** `claude switch profile mcp list

--json` — one entry per MCP server * known to the profile: configured in it, available in the global config to * compose, or both. */ export interface ProfileMcpEntry { name: string; /** Present in this profile's `.claude.json` `mcpServers`. */ configured: boolean; /** Present in the global `~/.claude.json` `mcpServers` (composable). */ inGlobal: boolean; /** Configured AND in global, but the composed copy differs from the current * global definition — it has gone stale. False otherwise. */ globalDrift: boolean; /** Transport of the effective definition (the profile's when configured, * else the global one), or null when neither resolves. */ transport: McpTransport | null; /** One-line summary of the effective definition: the command (stdio) or the * url (sse/http). Null when neither resolves. */ detail: string | null; } /** `claude switch route list --json` — one entry per routing rule. */ export interface RouteRule { pattern: string; target: string; kind: 'email' | 'alias'; } /** * Full cache-health summary. Mirrors the domain `CacheHealthSummary` in * src/cache-health.ts — kept structurally identical so the handler's emit * type-checks against this contract (the enforcement seam). */ export interface CacheHealthSummary { turns: number; totalCacheRead: number; totalCacheCreation: number; totalInput: number; hitRatio: number; flushCount: number; effectiveInputTokens: number; lastFlushAt: number | null; } /** One detected cache-flush turn in the cache-health report. */ export interface FlushEvent { turn: number; line: number; timestamp: string | null; } /** `claude switch cache-health --json` — standalone cache-health report. */ export interface CacheHealthReport { summary: CacheHealthSummary; sessionPath: string; flushes: FlushEvent[]; } /** * `claude switch route test [] --json` — routing resolution for a path. * Named `RouteTestResult` (not `RoutingDecision`) to avoid colliding with the * internal `RoutingDecision` in src/routing.ts, which is a different shape. */ export interface RouteTestResult { cwd: string; activeAccount: string | null; savedAccounts: string[]; decision: null | { email: string; source: string; banner: string | null; warning: string | null; wouldSwitch: boolean; }; } /** Severity of a single doctor finding. `ok` = healthy, `warn` = degraded but * usable, `error` = will break a swap or show stale data until fixed. */ export type DoctorSeverity = 'ok' | 'warn' | 'error'; /** One credential-health finding from `claude switch doctor --json`. */ export interface DoctorFinding { /** Stable machine id so the GUI can map a finding to a fix action / * localized string. e.g. 'snapshot-token-collision', 'usage-rate-limited'. */ code: string; severity: DoctorSeverity; /** Human-readable one-liner (English; the GUI may localize off `code`). */ message: string; /** Whether `claude switch doctor --fix` can remediate this automatically. */ fixable: boolean; } /** * `claude switch doctor --json` — credential-store health snapshot. Read-only; * surfaces the conditions that silently break swaps or freeze the statusline * (snapshot token collisions, provenance mismatches, a rate-limited usage * cache, an undrained Keychain item on macOS). The GUI renders findings and * offers `--fix` for the `fixable` ones. */ export interface DoctorReport { /** Worst severity across all findings — drives the GUI's overall badge. */ status: DoctorSeverity; /** Active account email per `~/.claude.json`, or null when none. */ activeAccount: string | null; findings: DoctorFinding[]; /** True on macOS when a `Claude Code-credentials` Keychain item is still * present (reconcile will drain it on the next foreground command). */ keychainItemPresent: boolean; }