feat(opencode): TUI sidebar quota widget#37
Conversation
There was a problem hiding this comment.
2 issues found across 12 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
Unified quota cache and API gateway for main + fallback quota state. All consumers share one QuotaManager instance for consistent caching. Features: - Inflight deduplication prevents concurrent API calls - Exponential backoff (60s-15min) for 429/5xx errors - Persists main quota and backoff state to disk via callbacks - Cross-process file lock guard for quota API dedup - Seeds from persisted storage on construction - Integrates with FallbackAccountManager for shared staleness - Captures storage path at init to prevent test config corruption - Request-count-based refresh trigger (refreshEveryNRequests)
f59bd01 to
9651130
Compare
Adds a TUI sidebar widget showing real-time quota usage for main and fallback accounts. Displays usage bars, reset times, relay status, fast mode, and cache-keepalive state. New files: sidebar-state.ts, tui.tsx, scripts/copy-tui.mjs Modified: package.json (TUI deps, exports), index.ts (writeSidebarState)
9651130 to
8b20be7
Compare
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
Adds a TUI sidebar widget showing real-time quota usage for main and fallback accounts.
Displays:
Files:
packages/opencode/src/sidebar-state.ts— new, shared state type + file I/Opackages/opencode/src/tui.tsx— new, Solid.js sidebar componentpackages/opencode/scripts/copy-tui.mjs— new, build helperpackages/opencode/package.json— TUI deps,oc-pluginfield,./tuiexportpackages/opencode/src/index.ts—writeSidebarState()integrationpackages/core/src/cachekeep.ts—trackedCount()getterSummary by cubic
Adds a TUI sidebar that shows live Claude quota for main and fallback accounts, powered by a shared
QuotaManagerwith inflight dedupe, exponential backoff, on-disk persistence, and cross‑process locking to reduce 429s and stabilize routing.New Features
sidebar-state.jsonto tmp; TUI polls for near real-time updates.QuotaManagerin@cortexkit/anthropic-auth-core: unified main/fallback cache, inflight dedupe, cross-process file-lock guard, exponential backoff (60s–15m) for 429/5xx, persisted main quota and backoff, seeds from storage, and request-count refresh viarefreshEveryNRequests.FallbackAccountManager: shared staleness, seeding from persisted fallbacks, and skip refresh when quota API is backed off.failClosedOnUnknownQuota).CacheKeepManager.trackedCount()to display tracked sessions.Dependencies
@opentui/core,@opentui/solid,solid-js.exports["./tui"]andoc-plugininpackages/opencode; newscripts/copy-tui.mjs; build includessidebar-stateand copiestui.tsx.QuotaManagerfrom@cortexkit/anthropic-auth-core.Written for commit 8b20be7. Summary will update on new commits. Review in cubic