graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
gui: make /goal and Task plan cards dismissable
Rach Pradhancbfcc803991b
diff --git a/gui/src/components/PromptComposer.tsx b/gui/src/components/PromptComposer.tsxindex 2a2993da..0028a0f0 100644--- a/gui/src/components/PromptComposer.tsx+++ b/gui/src/components/PromptComposer.tsx@@ -46,6 +46,13 @@ export function PromptComposer({ binding, onCommandResult }: PromptComposerPropsconst [dismissedPlanDecisionId, setDismissedPlanDecisionId] = useState<string | null>(null);+ const [dismissedTodoSignature, setDismissedTodoSignature] = useState<+ string | null+ >(null);+ // Identify the current plan by its task ids; dismissing hides this plan but a+ // genuinely new one (different ids) re-shows the dock.+ const todoSignature = todos.map((todo) => todo.id).join("|");+ const showTodos = todos.length > 0 && todoSignature !== dismissedTodoSignature;const interrupt = getActiveInterrupt(messages);const lastAssistant = getPlanDecisionAssistant({messages,@@ -166,7 +173,13 @@ export function PromptComposer({ binding, onCommandResult }: PromptComposerPropsreturn (<div className="px-6 pb-6">- <SessionTodoDock isRequestActive={isRequestActive} todos={todos} />+ {showTodos ? (+ <SessionTodoDock+ isRequestActive={isRequestActive}+ todos={todos}+ onDismiss={() => setDismissedTodoSignature(todoSignature)}+ />+ ) : null}{interrupt != null &&!isRequestActive &&interrupt.id !== dismissedInterruptId ? (diff --git a/gui/src/components/chat/ChatCommandResultRow.tsx b/gui/src/components/chat/ChatCommandResultRow.tsxindex f88a76f2..7d690ee9 100644--- a/gui/src/components/chat/ChatCommandResultRow.tsx+++ b/gui/src/components/chat/ChatCommandResultRow.tsx@@ -3,6 +3,7 @@ import {GitBranchIcon,SearchIcon,ServerIcon,+ XIcon,} from "lucide-react";import { ChatMarkdown } from "./ChatMarkdown";@@ -11,13 +12,29 @@ import type {CommandPayload,CommandRunResult,} from "@/services/desktop/types/contracts";--export function ChatCommandResultRow({ result }: { result: CommandRunResult }) {+export function ChatCommandResultRow({+ result,+ onDismiss,+}: {+ result: CommandRunResult;+ onDismiss?: () => void;+}) {return (- <article className="w-full min-w-0 max-w-3xl overflow-hidden rounded-xl border border-border/60 bg-foreground/[0.02] px-3.5 py-3">+ <article className="group w-full min-w-0 max-w-3xl overflow-hidden rounded-xl border border-border/60 bg-foreground/[0.02] px-3.5 py-3"><div className="mb-2 flex items-center gap-2 text-xs font-medium text-muted-foreground">- <CheckCircle2Icon className="size-3.5 text-[color:var(--accent)]" />- <span>{result.title}</span>+ <CheckCircle2Icon className="size-3.5 shrink-0 text-[color:var(--accent)]" />+ <span className="min-w-0 flex-1 truncate">{result.title}</span>+ {onDismiss != null ? (+ <button+ type="button"+ onClick={onDismiss}+ aria-label="Dismiss"+ title="Dismiss"+ className="-mr-1 shrink-0 rounded-md p-0.5 text-muted-foreground/60 opacity-0 transition hover:bg-foreground/5 hover:text-foreground focus-visible:opacity-100 group-hover:opacity-100"+ >+ <XIcon className="size-3.5" />+ </button>+ ) : null}</div>{result.savedPath != null ? (<p className="mb-2 text-sm text-muted-foreground">diff --git a/gui/src/components/chat/ChatThread.tsx b/gui/src/components/chat/ChatThread.tsxindex a03afe50..5018cc78 100644--- a/gui/src/components/chat/ChatThread.tsx+++ b/gui/src/components/chat/ChatThread.tsx@@ -45,13 +45,25 @@ export function ChatThread({}return null;})();+ const [dismissedCommandKeys, setDismissedCommandKeys] = useState<Set<string>>(+ () => new Set(),+ );+ const handleDismissCommandResult = useCallback((key: string) => {+ setDismissedCommandKeys((prev) => {+ const next = new Set(prev);+ next.add(key);+ return next;+ });+ }, []);const items = [...buildChatThreadItems(messages, activeRequestIds),- ...commandResults.map((result, index) => ({- kind: "command_result" as const,- key: `command-result:${index}:${result.title}`,- result,- })),+ ...commandResults+ .map((result, index) => ({+ kind: "command_result" as const,+ key: `command-result:${index}:${result.title}`,+ result,+ }))+ .filter((item) => !dismissedCommandKeys.has(item.key)),];const setFollowing = useCallback((next: boolean) => {@@ -247,7 +259,6 @@ export function ChatThread({setFollowing(true);scrollToBottom();}, [scrollToBottom, setFollowing]);-return (<div className="relative h-full"><LegendList@@ -258,6 +269,7 @@ export function ChatThread({requestTimingsById,workspacePath,itemCount: items.length,+ onDismissCommandResult: handleDismissCommandResult,})}keyExtractor={(item) => item.key}diff --git a/gui/src/components/chat/types/chatComponents.ts b/gui/src/components/chat/types/chatComponents.tsindex 1a92ca54..dfea505f 100644--- a/gui/src/components/chat/types/chatComponents.ts+++ b/gui/src/components/chat/types/chatComponents.ts@@ -184,6 +184,8 @@ export interface RenderChatThreadItemOptions {requestTimingsById: Record<string, RequestTimingInfo>;workspacePath: string | null;itemCount: number;+ /** Dismiss a command-result card (e.g. a `/goal` echo) by its thread key. */+ onDismissCommandResult?: (key: string) => void;}export interface StatusOutputRowProps {diff --git a/gui/src/components/chat/utils/chatThreadList.tsx b/gui/src/components/chat/utils/chatThreadList.tsxindex 792e4199..a201c03a 100644--- a/gui/src/components/chat/utils/chatThreadList.tsx+++ b/gui/src/components/chat/utils/chatThreadList.tsx@@ -97,7 +97,12 @@ export function estimateChatThreadItemSize(item: ChatThreadItem): number {export function renderChatThreadItem({ item, index }: ChatThreadRenderItem,- { itemCount, requestTimingsById, workspacePath }: RenderChatThreadItemOptions,+ {+ itemCount,+ requestTimingsById,+ workspacePath,+ onDismissCommandResult,+ }: RenderChatThreadItemOptions,) {const row =item.kind === "message" ? (@@ -110,7 +115,14 @@ export function renderChatThreadItem(workspacePath={workspacePath}/>) : (- <ChatCommandResultRow result={item.result} />+ <ChatCommandResultRow+ result={item.result}+ onDismiss={+ onDismissCommandResult != null+ ? () => onDismissCommandResult(item.key)+ : undefined+ }+ />);return (diff --git a/gui/src/components/conversation-panel/SessionTodoDock.tsx b/gui/src/components/conversation-panel/SessionTodoDock.tsxindex 4d7e7655..fa10d6d1 100644--- a/gui/src/components/conversation-panel/SessionTodoDock.tsx+++ b/gui/src/components/conversation-panel/SessionTodoDock.tsx@@ -6,6 +6,7 @@ import {Circle,ListTodo,LoaderCircle,+ X,XCircle,} from "lucide-react";@@ -36,6 +37,7 @@ import {export function SessionTodoDock({isRequestActive,todos,+ onDismiss,}: SessionTodoDockProps) {const hasActiveTodo = todos.some(isActiveTodo);const isBusy = isRequestActive || hasActiveTodo;@@ -49,6 +51,7 @@ export function SessionTodoDock({key={isBusy ? "busy" : "idle"}isBusy={isBusy}isRequestActive={isRequestActive}+ onDismiss={onDismiss}summary={buildTodoSummary(todos)}todos={todos}/>@@ -58,6 +61,7 @@ export function SessionTodoDock({function SessionTodoDockCard({isBusy,isRequestActive,+ onDismiss,summary,todos,}: SessionTodoDockCardProps) {@@ -78,23 +82,36 @@ function SessionTodoDockCard({><Card size="sm"><CardHeader className="">- <CollapsibleTrigger className="group flex w-full items-start justify-between gap-3 text-left">- <div className="min-w-0 flex-1">- <div className="flex items-center gap-2">- <ListTodo className="size-4 text-muted-foreground" />- <CardTitle>Task plan</CardTitle>+ <div className="flex w-full items-start gap-2">+ <CollapsibleTrigger className="group flex min-w-0 flex-1 items-start justify-between gap-3 text-left">+ <div className="min-w-0 flex-1">+ <div className="flex items-center gap-2">+ <ListTodo className="size-4 text-muted-foreground" />+ <CardTitle>Task plan</CardTitle>+ </div>+ <CardDescription>{summary}</CardDescription></div>- <CardDescription>{summary}</CardDescription>- </div>- <span className="inline-flex shrink-0 items-center gap-1 text-xs text-muted-foreground">- {open ? "Hide" : "Show"}- {open ? (- <ChevronDown className="size-4" />- ) : (- <ChevronRight className="size-4" />- )}- </span>- </CollapsibleTrigger>+ <span className="inline-flex shrink-0 items-center gap-1 text-xs text-muted-foreground">+ {open ? "Hide" : "Show"}+ {open ? (+ <ChevronDown className="size-4" />+ ) : (+ <ChevronRight className="size-4" />+ )}+ </span>+ </CollapsibleTrigger>+ {onDismiss != null ? (+ <button+ type="button"+ onClick={onDismiss}+ aria-label="Dismiss task plan"+ title="Dismiss"+ className="-mr-1 -mt-0.5 shrink-0 rounded-md p-1 text-muted-foreground/60 transition hover:bg-foreground/5 hover:text-foreground"+ >+ <X className="size-4" />+ </button>+ ) : null}+ </div></CardHeader><CollapsibleContent className="-mt-2">diff --git a/gui/src/components/conversation-panel/types/conversationHeader.ts b/gui/src/components/conversation-panel/types/conversationHeader.tsindex 9bb11a38..a952067c 100644--- a/gui/src/components/conversation-panel/types/conversationHeader.ts+++ b/gui/src/components/conversation-panel/types/conversationHeader.ts@@ -136,6 +136,8 @@ export interface ProjectSwitcherMenuProps {export interface SessionTodoDockProps {isRequestActive: boolean;todos: SessionTodo[];+ /** Dismiss the current task-plan card. A new plan re-shows it. */+ onDismiss?: () => void;}export interface SessionTodoDockCardProps {@@ -143,6 +145,7 @@ export interface SessionTodoDockCardProps {isRequestActive: boolean;summary: string;todos: SessionTodo[];+ onDismiss?: () => void;}export type TodoStatus = SessionTodo["status"];