@@ -239,25 +239,20 @@ import { proposedPlanTitle } from "@t3tools/shared/proposedPlanText";
239239import { hasProviderSetup } from "./ProviderStatusBanner" ;
240240import { type AppModelOption , getAppModelOptionsForInstance } from "../../modelSelection" ;
241241import type { UnifiedSettings } from "@t3tools/contracts/settings" ;
242- import {
243- isVideoAttachment ,
244- type ChatMessage ,
245- type SessionPhase ,
246- type Thread ,
247- type ThreadShell ,
248- } from "../../types" ;
242+ import { isVideoAttachment , type SessionPhase , type Thread , type ThreadShell } from "../../types" ;
249243import { type ComposerPromptHistoryPosition } from "./composerPromptHistory" ;
250244import type { PendingUserInputDraftAnswer } from "@t3tools/client-runtime/state/pending-user-input" ;
251245import type {
252246 LatestProposedPlanState ,
253247 PendingApproval ,
254248 PendingUserInput ,
249+ TimelineEntry ,
255250} from "../../session-logic" ;
256251import {
257252 resolveComposerDispatchMode ,
258253 type ComposerDispatchMode ,
259254} from "@t3tools/client-runtime/state/composer-dispatch" ;
260- import type { ContextWindowSnapshot } from "../../lib/contextWindow" ;
255+ import { deriveLatestContextWindowSnapshot } from "../../lib/contextWindow" ;
261256import {
262257 resolveProviderSkillsForCwd ,
263258 resolveProviderSlashCommandsForCwd ,
@@ -371,7 +366,7 @@ export interface ChatComposerProps {
371366 activeThreadId : ThreadId | null ;
372367 activeThread : Thread | undefined ;
373368 activeThreadShell : ThreadShell | null ;
374- promptHistoryMessages : ReadonlyArray < ChatMessage > ;
369+ promptHistoryEntries : ReadonlyArray < TimelineEntry > ;
375370 forceExpandedOnMobile : boolean ;
376371 projectSelectionRequired : boolean ;
377372
@@ -433,7 +428,9 @@ export interface ChatComposerProps {
433428 reportedModelSelection ?: ModelSelection | null ;
434429 activeProjectId : ProjectId | null ;
435430
436- activeContextWindow : ContextWindowSnapshot | null ;
431+ contextWindowEntries : Parameters < typeof deriveLatestContextWindowSnapshot > [ 0 ] ;
432+ contextWindowLiveUsage : Parameters < typeof deriveLatestContextWindowSnapshot > [ 1 ] ;
433+ contextWindowProviderThread : Parameters < typeof deriveLatestContextWindowSnapshot > [ 2 ] ;
437434 compactThreadUnavailable : boolean ;
438435 compactDisabled : boolean ;
439436 compactDisabledReason : string | null ;
@@ -524,7 +521,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
524521 onMultipleModelSelectionsChange : setMultipleModelSelections ,
525522 activeThreadId,
526523 activeThread,
527- promptHistoryMessages ,
524+ promptHistoryEntries ,
528525 forceExpandedOnMobile,
529526 projectSelectionRequired,
530527 phase,
@@ -557,7 +554,9 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
557554 activeThreadModelSelection,
558555 reportedModelSelection,
559556 activeProjectId,
560- activeContextWindow,
557+ contextWindowEntries,
558+ contextWindowLiveUsage,
559+ contextWindowProviderThread,
561560 compactThreadUnavailable,
562561 compactDisabled,
563562 compactDisabledReason,
@@ -602,6 +601,11 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
602601 editingQueuedAttachments,
603602 onRemoveEditingQueuedAttachment,
604603 } = props ;
604+ const activeContextWindow = deriveLatestContextWindowSnapshot (
605+ contextWindowEntries ,
606+ contextWindowLiveUsage ,
607+ contextWindowProviderThread ,
608+ ) ;
605609 const primaryEnvironmentId = usePrimaryEnvironmentId ( ) ;
606610 const composerDraftTargetKey = composerTargetKey ( composerDraftTarget ) ;
607611 const {
@@ -2210,7 +2214,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
22102214 planModeUiEnabled,
22112215 isLiteralPendingAnswer,
22122216 pendingUserInputs,
2213- promptHistoryMessages ,
2217+ promptHistoryEntries ,
22142218 promptHistoryPositionRef,
22152219 composerDraftTarget,
22162220 promptRef,
0 commit comments