Skip to content

Comments

feat(quantum): add sidebar dashboard with credits, jobs, and compute status#7

Open
Kenny-Heitritter wants to merge 2 commits intofeat/codeq-telemetryfrom
feat/quantum-sidebar
Open

feat(quantum): add sidebar dashboard with credits, jobs, and compute status#7
Kenny-Heitritter wants to merge 2 commits intofeat/codeq-telemetryfrom
feat/quantum-sidebar

Conversation

@Kenny-Heitritter
Copy link
Member

Summary

  • Add a quantum resource dashboard to the TUI sidebar and footer, showing qBraid credits balance, active quantum jobs, and compute instance status
  • Build a centralized reactive state store (quantum/state.ts) using Instance.state() for per-instance isolation, with Bus events for TUI reactivity
  • Implement adaptive background polling via the Scheduler system (credits: 60s, jobs: 30s when active, compute: 60s)
  • Wire quantum tools to trigger state refresh after submit/cancel/get_result so the sidebar updates immediately

Design

Progressive disclosure — minimal when idle (just ⚛ qBraid $42.50 in footer), expands when resources are active (shows job rows, compute status in sidebar section).

Three pillars mirroring the qBraid account page:

  1. Credits — qBraid + AWS balance from /billing/credits/balance
  2. Quantum Jobs — active jobs with device, status, shots from /jobs
  3. Compute Instances — status from /compute/servers/status (management is future work)

New Files

  • quantum/state.ts — Centralized state store with Instance.state(), Bus event quantum.state.updated, refresh functions for credits/jobs/compute
  • quantum/poller.ts — Scheduler-based adaptive background polling with Instance.state() for per-instance timestamp tracking
  • cli/cmd/tui/component/quantum-status.tsxQuantumSidebarSection (collapsible), QuantumFooterIndicator (compact), useQuantumState() hook

Modified Files

  • quantum/client.ts — Added getCredits(), getComputeStatus(), listActiveJobs(), isConfigured(), CreditsBalanceSchema, ComputeStatusSchema
  • quantum/tools.ts — Added state refresh triggers after submit/cancel/get_result, fixed getCredits return type
  • quantum/index.ts — Added QuantumState and QuantumPoller exports
  • project/bootstrap.ts — Added QuantumPoller.init() + QuantumState.refreshAll() calls
  • cli/cmd/tui/routes/session/sidebar.tsx — Added qBraid section between Context and MCP
  • cli/cmd/tui/routes/session/footer.tsx — Added QuantumFooterIndicator between permissions and LSP

Architecture Patterns

  • Instance.state() for all per-instance state (matches all 25+ existing modules)
  • BusEvent.define() with explicit Zod schema z.object({}) for signal events
  • Scheduler for background polling with adaptive intervals
  • useTheme() for typed RGBA color access (no type-erasing helper functions)

Commits (2)

feat(quantum): add sidebar dashboard with credits, jobs, and compute status
refactor(quantum): consolidate schemas and remove dead code

Stats

9 files changed, 546 insertions(+), 7 deletions(-)

Depends On

…status

Add quantum resource dashboard to the TUI sidebar and footer:

- QuantumState: centralized reactive store tracking credits balance,
  active jobs, and compute instance status via Bus events
- QuantumPoller: Scheduler-based adaptive polling (credits/compute 60s,
  jobs 30s when active) with auto-detection of API key mid-session
- QuantumSidebarSection: collapsible sidebar panel showing credit balance,
  active job rows with status dots and elapsed time, compute status
- QuantumFooterIndicator: compact footer indicator (active QPU count)
- Extended client.ts with getCredits (billing/credits/balance endpoint),
  getComputeStatus, listActiveJobs, and Zod schemas for validation
- Fixed getCredits return type mismatch in estimate_cost tool
- Tools (submit, cancel, get_result) trigger state refresh for immediate
  sidebar updates after quantum operations
- Wired poller and initial refresh into InstanceBootstrap
- Move CreditsBalanceSchema and ComputeStatusSchema to the schema
  section at the top of client.ts, alongside QuantumDeviceSchema,
  QuantumJobSchema, and JobResultSchema
- Remove redundant formatCredits branch (n >= 10 and default were
  identical)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant