@@ -41,6 +41,7 @@ import { onChatPrefill } from "@/lib/chat-prefill";
4141import { buildSkillsContext , type Skill } from "@/components/skills-selector" ;
4242import { AddContextMenu } from "@/components/add-context-menu" ;
4343import { ContextChipsBar } from "@/components/context-chips" ;
44+ import { ContextUsageIndicator } from "@/components/context-usage-indicator" ;
4445import { CitationBadge } from "@/components/citation-badge" ;
4546import { NotebookEntryChip , ReasoningBlock , ToolActivityList } from "@/components/tool-activity" ;
4647import { InterviewCard } from "@/components/interview-form" ;
@@ -54,7 +55,12 @@ import {
5455 type PromptImage ,
5556} from "@/lib/image-attachments" ;
5657import { suggestSkillsForFiles } from "@/lib/skill-suggestions" ;
57- import { useAgent , type ActivityItem , type ChatMessage } from "@/lib/use-agent" ;
58+ import {
59+ useAgent ,
60+ type ActivityItem ,
61+ type ChatMessage ,
62+ type ContextUsage ,
63+ } from "@/lib/use-agent" ;
5864import type { NotebookEntry } from "@/lib/notebook" ;
5965import { routeSubmit , steerNotStreamingFallback , type SendIntent } from "@/lib/chat-routing" ;
6066import { SpeechInput } from "@/components/ai-elements/speech-input" ;
@@ -462,6 +468,7 @@ function ChatInput({
462468 onDbsChange,
463469 selectedModel,
464470 onModelChange,
471+ contextUsage,
465472 selectedComputeTarget,
466473 onComputeTargetChange,
467474 thinkingLevel,
@@ -495,6 +502,7 @@ function ChatInput({
495502 onDbsChange : ( dbs : Database [ ] ) => void ;
496503 selectedModel : Model ;
497504 onModelChange : ( model : Model ) => void ;
505+ contextUsage : ContextUsage | null ;
498506 selectedComputeTarget : ModalInstance | null ;
499507 onComputeTargetChange : ( instance : ModalInstance | null ) => void ;
500508 thinkingLevel : ThinkingLevel ;
@@ -823,6 +831,7 @@ function ChatInput({
823831 onChange = { onComputeTargetChange }
824832 modalConfigured = { modalConfigured }
825833 />
834+ < ContextUsageIndicator usage = { contextUsage } />
826835 </ div >
827836 < div className = "flex items-center gap-1.5 shrink-0" >
828837 < InfoTooltip
@@ -1057,7 +1066,19 @@ export const ChatTab = forwardRef<ChatTabHandle, ChatTabProps>(function ChatTab(
10571066 } ,
10581067 ref ,
10591068) {
1060- const { messages, status, send, stop, steer, pendingSteers, getSessionId, loadSession, notebookEntries, subagentCompletions } = useAgent ( ) ;
1069+ const {
1070+ messages,
1071+ contextUsage,
1072+ status,
1073+ send,
1074+ stop,
1075+ steer,
1076+ pendingSteers,
1077+ getSessionId,
1078+ loadSession,
1079+ notebookEntries,
1080+ subagentCompletions,
1081+ } = useAgent ( ) ;
10611082 const isStreaming = status === "streaming" || status === "submitted" ;
10621083 // Scopes the deep-link querySelector to THIS tab's transcript.
10631084 const rootRef = useRef < HTMLDivElement > ( null ) ;
@@ -1468,6 +1489,7 @@ export const ChatTab = forwardRef<ChatTabHandle, ChatTabProps>(function ChatTab(
14681489 onDbsChange = { setSelectedDbs }
14691490 selectedModel = { selectedModel }
14701491 onModelChange = { setSelectedModel }
1492+ contextUsage = { contextUsage }
14711493 selectedComputeTarget = { selectedComputeTarget }
14721494 onComputeTargetChange = { setSelectedComputeTarget }
14731495 thinkingLevel = { thinkingLevel }
0 commit comments