feat(engine): add usage quota tracking and indicator ui for ai providers#423
Open
rust142 wants to merge 2 commits into
Open
feat(engine): add usage quota tracking and indicator ui for ai providers#423rust142 wants to merge 2 commits into
rust142 wants to merge 2 commits into
Conversation
Introduce a unified usage quota system across all supported AI engine adapters (Claude Code, Copilot, Codex, OpenCode). Each adapter parses provider-specific usage output (CLI commands, API responses, or database queries) into a common UsageSnapshot schema with typed UsageQuota entries. A new engine:get-usage WebSocket endpoint exposes snapshots to the frontend, where a compact UsageIndicator component displays remaining quota percentages in the chat panel header. The indicator adapts to narrow layouts via container queries and offers a detail popover with per-quota breakdowns, color-coded thresholds, reset timestamps, and a manual refresh button. Previously users had no visibility into their consumption limits; this change provides real-time awareness to prevent unexpected service interruptions.
…ta display Adds a usageError state to display a warning icon and 'Error' label when quota fetching fails, replacing the silent failure mode. Tracks sessionState.isLoading in the effect to ensure the usage indicator updates reactively when message generation state changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduce a unified usage quota system across all supported AI engine adapters (Claude Code, Copilot, Codex, OpenCode). Each adapter parses provider-specific usage output (CLI commands, API responses, or database queries) into a common UsageSnapshot schema with typed UsageQuota entries. A new engine:get-usage WebSocket endpoint exposes snapshots to the frontend, where a compact UsageIndicator component displays remaining quota percentages in the chat panel header. The indicator adapts to narrow layouts via container queries and offers a detail popover with per-quota breakdowns, color-coded thresholds, reset timestamps, and a manual refresh button. Previously users had no visibility into their consumption limits; this change provides real-time awareness to prevent unexpected service interruptions.