/** * Confirmation dialog shown when the user runs `/goal ` * while a non-complete goal is already active. */ import * as React from 'react'; import { Box, Text } from '@anthropic/ink'; import type { GoalState } from 'src/types/logs.js'; import { Select } from 'src/components/CustomSelect/index.js'; import { PermissionDialog } from 'src/components/permissions/PermissionDialog.js'; import { formatGoalElapsed, formatGoalStatusLabel } from 'src/services/goal/goalState.js'; type Props = { currentGoal: GoalState; newObjective: string; onConfirm: () => void; onCancel: () => void; }; export function GoalReplaceConfirmDialog({ currentGoal, newObjective, onConfirm, onCancel }: Props): React.ReactNode { function handleResponse(value: 'yes' | 'no'): void { if (value === 'yes') onConfirm(); else onCancel(); } const tokensDisplay = currentGoal.tokenBudget !== null ? `${currentGoal.tokensUsed} / ${currentGoal.tokenBudget}` : `${currentGoal.tokensUsed}`; return ( A goal is already in progress. Replacing it will reset all progress and counters. Current goal: · Objective: {currentGoal.objective} · Status: {formatGoalStatusLabel(currentGoal.status)} · Time: {formatGoalElapsed(currentGoal)} · Tokens: {tokensDisplay} New objective: {newObjective}