Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/ui/src/features/sessions/components/SessionView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,12 @@ export function SessionView({
lastActivityAt={staleGate.lastActivityAt}
costUsd={staleGate.costUsd}
onContinue={staleGate.onContinue}
onCompact={() => {
// Acknowledge so the gate clears and the dialog
// closes, then trigger the agent's manual compaction.
staleGate.onContinue();
onSendPrompt("/compact");
}}
onOpenChange={staleGate.onDialogOpenChange}
/>
<PromptInput
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ interface StaleConversationCostDialogProps {
/** Cumulative session cost so far, when the gateway reports it. */
costUsd: number | null;
onContinue: () => void;
/** Compact the history in place (runs `/compact`) instead of reloading it whole. */
onCompact: () => void;
onOpenChange: (open: boolean) => void;
}

Expand All @@ -19,6 +21,7 @@ export function StaleConversationCostDialog({
lastActivityAt,
costUsd,
onContinue,
onCompact,
onOpenChange,
}: StaleConversationCostDialogProps) {
const activity =
Expand All @@ -40,8 +43,9 @@ export function StaleConversationCostDialog({
message re-processes the whole conversation at full input price
instead of the ~10% cached rate
{costUsd !== null ? ` (≈$${costUsd.toFixed(2)} spent so far)` : ""}.
Starting a new conversation avoids the cost — continue only if you
need this thread's context.
Compacting summarizes the history so you keep this thread's context at
a fraction of the size, or start a new conversation to avoid the cost
entirely.
</AlertDialog.Description>

<Flex justify="end" gap="2" mt="4">
Expand All @@ -51,10 +55,15 @@ export function StaleConversationCostDialog({
</Button>
</AlertDialog.Cancel>
<AlertDialog.Action>
<Button variant="solid" size="1" onClick={onContinue}>
<Button variant="soft" color="gray" size="1" onClick={onContinue}>
Continue anyway
</Button>
</AlertDialog.Action>
<AlertDialog.Action>
<Button variant="solid" size="1" onClick={onCompact}>
Compact instead
</Button>
</AlertDialog.Action>
</Flex>
</AlertDialog.Content>
</AlertDialog.Root>
Expand Down
Loading