(props: {
api: TuiApi
state: SessionState
messages: WithParts[]
onBack: () => void
})
| 26 | } |
| 27 | |
| 28 | export function ContextDialog(props: { |
| 29 | api: TuiApi |
| 30 | state: SessionState |
| 31 | messages: WithParts[] |
| 32 | onBack: () => void |
| 33 | }) { |
| 34 | const theme = props.api.theme.current |
| 35 | const breakdown = analyzeContextTokens(props.state, props.messages) |
| 36 | const total = Math.max(0, breakdown.total) |
| 37 | const activePruned = breakdown.prunedToolCount + breakdown.prunedMessageCount |
| 38 | |
| 39 | return ( |
| 40 | <DcpFrame api={props.api} title="Context" eyebrow="DCP" onBack={props.onBack}> |
| 41 | <Card theme={theme} title="Current"> |
| 42 | <Metric |
| 43 | theme={theme} |
| 44 | label="Total in context" |
| 45 | value={`~${formatTokenCount(total)}`} |
| 46 | hint="tokens" |
| 47 | /> |
| 48 | <Metric |
| 49 | theme={theme} |
| 50 | label="Tools in context" |
| 51 | value={`${breakdown.toolsInContextCount}`} |
| 52 | /> |
| 53 | <Metric theme={theme} label="Active pruned targets" value={`${activePruned}`} /> |
| 54 | <Metric |
| 55 | theme={theme} |
| 56 | label="Tokens pruned" |
| 57 | value={`~${formatTokenCount(breakdown.prunedTokens)}`} |
| 58 | hint="tokens" |
| 59 | /> |
| 60 | </Card> |
| 61 | <Card theme={theme} title="Breakdown"> |
| 62 | <Progress |
| 63 | theme={theme} |
| 64 | label="System" |
| 65 | value={breakdown.system} |
| 66 | total={total} |
| 67 | color="primary" |
| 68 | detail={`~${formatTokenCount(breakdown.system)} tokens`} |
| 69 | /> |
| 70 | <Progress |
| 71 | theme={theme} |
| 72 | label="User" |
| 73 | value={breakdown.user} |
| 74 | total={total} |
| 75 | color="primary" |
| 76 | detail={`~${formatTokenCount(breakdown.user)} tokens`} |
| 77 | /> |
| 78 | <Progress |
| 79 | theme={theme} |
| 80 | label="Assistant" |
| 81 | value={breakdown.assistant} |
| 82 | total={total} |
| 83 | color="primary" |
| 84 | detail={`~${formatTokenCount(breakdown.assistant)} tokens`} |
| 85 | /> |
nothing calls this directly
no test coverage detected