@@ -76,6 +76,7 @@ import {
7676 renderProviderTraitsPicker ,
7777} from "./composerProviderState" ;
7878import { ContextWindowMeter } from "./ContextWindowMeter" ;
79+ import { ProviderUsageMeter } from "./ProviderUsageMeter" ;
7980import { buildExpandedImagePreview , type ExpandedImagePreview } from "./ExpandedImagePreview" ;
8081import { basenameOfPath } from "../../vscode-icons" ;
8182import { cn , randomUUID } from "~/lib/utils" ;
@@ -105,6 +106,7 @@ import type { SessionPhase, Thread } from "../../types";
105106import type { PendingUserInputDraftAnswer } from "../../pendingUserInput" ;
106107import type { PendingApproval , PendingUserInput } from "../../session-logic" ;
107108import { deriveLatestContextWindowSnapshot } from "../../lib/contextWindow" ;
109+ import { deriveLatestProviderUsageSnapshot } from "../../lib/providerUsage" ;
108110import { formatProviderSkillDisplayName } from "../../providerSkillPresentation" ;
109111import { searchProviderSkills } from "../../providerSkillSearch" ;
110112
@@ -273,6 +275,7 @@ const ComposerFooterModeControls = memo(function ComposerFooterModeControls(prop
273275const ComposerFooterPrimaryActions = memo ( function ComposerFooterPrimaryActions ( props : {
274276 compact : boolean ;
275277 activeContextWindow : ReturnType < typeof deriveLatestContextWindowSnapshot > ;
278+ activeProviderUsage : ReturnType < typeof deriveLatestProviderUsageSnapshot > ;
276279 isPreparingWorktree : boolean ;
277280 pendingAction : {
278281 questionIndex : number ;
@@ -293,6 +296,7 @@ const ComposerFooterPrimaryActions = memo(function ComposerFooterPrimaryActions(
293296} ) {
294297 return (
295298 < >
299+ { props . activeProviderUsage ? < ProviderUsageMeter usage = { props . activeProviderUsage } /> : null }
296300 { props . activeContextWindow ? < ContextWindowMeter usage = { props . activeContextWindow } /> : null }
297301 { props . isPreparingWorktree ? (
298302 < span className = "text-muted-foreground/70 text-xs" > Preparing worktree...</ span >
@@ -648,6 +652,14 @@ export const ChatComposer = memo(
648652 [ activeThreadActivities ] ,
649653 ) ;
650654
655+ // ------------------------------------------------------------------
656+ // Provider usage (rate limits / session %)
657+ // ------------------------------------------------------------------
658+ const activeProviderUsage = useMemo (
659+ ( ) => deriveLatestProviderUsageSnapshot ( activeThreadActivities ?? [ ] ) ,
660+ [ activeThreadActivities ] ,
661+ ) ;
662+
651663 // ------------------------------------------------------------------
652664 // Composer-local state
653665 // ------------------------------------------------------------------
@@ -1962,6 +1974,7 @@ export const ChatComposer = memo(
19621974 < ComposerFooterPrimaryActions
19631975 compact = { isComposerPrimaryActionsCompact }
19641976 activeContextWindow = { activeContextWindow }
1977+ activeProviderUsage = { activeProviderUsage }
19651978 pendingAction = { pendingPrimaryAction }
19661979 isRunning = { phase === "running" }
19671980 showPlanFollowUpPrompt = {
0 commit comments