YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
feat(ui): redesign tool calls with progress rail timeline
Louis Beaumont6c23e1399d33
diff --git a/apps/screenpipe-app-tauri/components/standalone-chat.tsx b/apps/screenpipe-app-tauri/components/standalone-chat.tsxindex f59bd41d3..4b8b11a94 100644--- a/apps/screenpipe-app-tauri/components/standalone-chat.tsx+++ b/apps/screenpipe-app-tauri/components/standalone-chat.tsx@@ -329,78 +329,115 @@ function friendlyToolLabel(toolCall: ToolCall): string {function FriendlyToolDetails({ toolCall }: { toolCall: ToolCall }) {if (toolCall.toolName === "edit" && toolCall.args.old_string && toolCall.args.new_string) {return (- <div className="px-3 py-2 text-xs font-mono space-y-0.5">+ <div className="py-1.5 text-xs font-mono space-y-0">{String(toolCall.args.old_string).split("\n").map((line: string, i: number) => (- <div key={`old-${i}`} className="text-red-400/80">- {line}</div>+ <div key={`old-${i}`} className="text-foreground/40">- {line}</div>))}{String(toolCall.args.new_string).split("\n").map((line: string, i: number) => (- <div key={`new-${i}`} className="text-green-400/80">+ {line}</div>+ <div key={`new-${i}`} className="text-foreground/80">+ {line}</div>))}</div>);}if (toolCall.toolName === "bash" && toolCall.args.command) {return (- <div className="px-3 py-2">- <pre className="whitespace-pre-wrap break-words text-neutral-100 text-xs font-mono max-h-[200px] overflow-y-auto overflow-x-hidden max-w-full">+ <div className="py-1.5">+ <pre className="whitespace-pre-wrap break-words text-foreground/70 text-xs font-mono max-h-[200px] overflow-y-auto overflow-x-hidden max-w-full">{toolCall.args.command}</pre></div>);}- // Fallback: show args as key-value pairs, not raw JSONconst entries = Object.entries(toolCall.args).filter(([k]) => k !== "path" && k !== "command");if (entries.length === 0) return null;return (- <div className="px-3 py-2 text-xs text-muted-foreground space-y-0.5">+ <div className="py-1.5 text-xs font-mono text-muted-foreground space-y-0">{entries.map(([key, val]) => (<div key={key} className="truncate">- <span className="text-neutral-500">{key}:</span>{" "}- <span className="text-neutral-300">{typeof val === "string" ? val.slice(0, 200) : JSON.stringify(val).slice(0, 200)}</span>+ <span className="text-foreground/40">{key}:</span>{" "}+ <span className="text-foreground/70">{typeof val === "string" ? val.slice(0, 200) : JSON.stringify(val).slice(0, 200)}</span></div>))}</div>);}-function ToolCallBlock({ toolCall }: { toolCall: ToolCall }) {+// Single tool call row in the progress rail+function ToolCallRailItem({ toolCall, isLast }: { toolCall: ToolCall; isLast: boolean }) {const [expanded, setExpanded] = useState(false);- const icon = TOOL_ICONS[toolCall.toolName] || "🔧";const label = friendlyToolLabel(toolCall);return (- <div className="rounded-lg border border-border/50 bg-background/50 text-xs overflow-hidden w-full min-w-0">- <button- onClick={() => setExpanded(!expanded)}- className="w-full flex items-center gap-2 px-3 py-1.5 hover:bg-muted/50 transition-colors text-left min-w-0"- >- {toolCall.isRunning ? (- <Loader2 className="h-3 w-3 animate-spin text-muted-foreground flex-shrink-0" />- ) : toolCall.isError ? (- <span className="text-destructive flex-shrink-0">✗</span>- ) : (- <span className="text-green-500 flex-shrink-0">✓</span>- )}- <span className="text-muted-foreground flex-shrink-0">{icon}</span>- <span className="truncate flex-1">{label}</span>- <span className="text-muted-foreground flex-shrink-0">{expanded ? "▾" : "▸"}</span>- </button>- {expanded && (- <div className="border-t border-border/50 bg-neutral-900/50 dark:bg-neutral-950/50">- <FriendlyToolDetails toolCall={toolCall} />- {/* Result */}- {toolCall.result !== undefined && (- <div className="px-3 py-2 text-neutral-300 border-t border-neutral-800/50">- <pre className={cn(- "whitespace-pre-wrap break-words max-h-[300px] overflow-y-auto overflow-x-hidden max-w-full text-xs",- toolCall.isError ? "text-red-400" : "text-neutral-100"- )}>- {toolCall.result}- </pre>- </div>+ <div className="relative flex min-w-0">+ {/* Vertical rail line */}+ <div className="flex flex-col items-center flex-shrink-0 w-5">+ {/* Dot */}+ <div className="relative flex items-center justify-center w-5 h-5">+ {toolCall.isRunning ? (+ // Pulsing hollow dot for running+ <motion.div+ className="w-2 h-2 border border-foreground"+ animate={{ opacity: [1, 0.3, 1] }}+ transition={{ duration: 1, repeat: Infinity, ease: "steps(2)" }}+ />+ ) : toolCall.isError ? (+ // X mark for error+ <span className="text-[10px] font-mono font-bold text-foreground leading-none">✗</span>+ ) : (+ // Solid dot for success+ <motion.div+ className="w-2 h-2 bg-foreground"+ initial={{ scale: 0 }}+ animate={{ scale: 1 }}+ transition={{ duration: 0.15, ease: "easeOut" }}+ />)}</div>- )}+ {/* Connecting line */}+ {!isLast && (+ <div className="w-px flex-1 bg-border" />+ )}+ </div>++ {/* Content */}+ <div className="flex-1 min-w-0 pb-2">+ <button+ onClick={() => setExpanded(!expanded)}+ className="w-full flex items-center gap-1.5 text-left min-w-0 group py-0.5"+ >+ <span className="truncate flex-1 text-xs font-mono text-foreground/70 group-hover:text-foreground transition-colors duration-150">+ {label}+ </span>+ <span className="text-foreground/30 flex-shrink-0 text-[10px] font-mono group-hover:text-foreground/60 transition-colors duration-150">+ {expanded ? "−" : "+"}+ </span>+ </button>+ <AnimatePresence>+ {expanded && (+ <motion.div+ initial={{ height: 0, opacity: 0 }}+ animate={{ height: "auto", opacity: 1 }}+ exit={{ height: 0, opacity: 0 }}+ transition={{ duration: 0.15 }}+ className="overflow-hidden"+ >+ <div className="border-l border-border ml-0 pl-3 mt-1 mb-1">+ <FriendlyToolDetails toolCall={toolCall} />+ {toolCall.result !== undefined && (+ <div className="mt-1 pt-1 border-t border-border/50">+ <pre className={cn(+ "whitespace-pre-wrap break-words max-h-[300px] overflow-y-auto overflow-x-hidden max-w-full text-xs font-mono",+ toolCall.isError ? "text-foreground/50" : "text-foreground/60"+ )}>+ {toolCall.result}+ </pre>+ </div>+ )}+ </div>+ </motion.div>+ )}+ </AnimatePresence>+ </div></div>);}@@ -510,7 +547,7 @@ function MarkdownBlock({ text, isUser }: { text: string; isUser: boolean }) {},pre({ children, ...props }) {return (- <pre className="overflow-x-auto rounded-lg bg-neutral-900 dark:bg-neutral-950 text-neutral-100 p-3 my-2 text-xs max-w-full" {...props}>+ <pre className="overflow-x-auto rounded-lg bg-muted text-foreground p-3 my-2 text-xs max-w-full" {...props}>{children}</pre>);@@ -609,69 +646,78 @@ function ToolCallGroup({ toolCalls }: { toolCalls: ToolCall[] }) {const allDone = !hasRunning;const doneCount = toolCalls.filter((tc) => !tc.isRunning).length;const total = toolCalls.length;-- // Auto-collapse: expanded while running, collapsed when done (unless user overrides)- const isExpanded = manualExpand !== null ? manualExpand : hasRunning;-- const activeCall = toolCalls.find((tc) => tc.isRunning);- const activeLabel = activeCall ? friendlyToolLabel(activeCall) : "";const summary = allDone ? buildToolSummary(toolCalls) : "";- // For a single completed tool, show just a compact inline summary- if (toolCalls.length === 1 && allDone) {- return (- <div className="flex items-center gap-2 text-xs text-muted-foreground py-1 px-1">- {hasError ? (- <span className="text-destructive">✗</span>- ) : (- <span className="text-green-500">✓</span>- )}- <span>{friendlyToolLabel(toolCalls[0])}</span>- <button onClick={() => setManualExpand(manualExpand === null ? true : !manualExpand)} className="ml-auto text-muted-foreground/60 hover:text-muted-foreground">▸</button>- {manualExpand && (- <div className="w-full mt-1">- <ToolCallBlock toolCall={toolCalls[0]} />- </div>- )}- </div>- );- }+ // Auto-expand while running, auto-collapse when done (user can override)+ const isExpanded = manualExpand !== null ? manualExpand : hasRunning;return (- <div className={cn(- "rounded-lg border bg-background/50 text-xs overflow-hidden w-full min-w-0 transition-colors duration-700",- hasRunning ? "border-blue-400/30" : "border-border/50"- )}>+ <div className="w-full min-w-0">+ {/* Header bar — clickable to toggle */}<buttononClick={() => setManualExpand(isExpanded ? false : true)}- className="w-full flex items-center gap-2 px-3 py-1.5 hover:bg-muted/50 transition-colors text-left min-w-0"+ className="w-full flex items-center gap-2 py-1 text-left min-w-0 group">- {hasRunning ? (- <Loader2 className="h-3 w-3 animate-spin text-muted-foreground flex-shrink-0" />- ) : hasError ? (- <span className="text-destructive flex-shrink-0">✗</span>- ) : (- <span className="text-green-500 flex-shrink-0">✓</span>- )}- {hasRunning ? (- <>- <span className="text-muted-foreground flex-shrink-0">{doneCount}/{total}</span>- <span className="truncate flex-1 text-muted-foreground">{activeLabel}</span>- </>- ) : (- <span className="truncate flex-1 text-muted-foreground">- {summary || `${total} steps`}- </span>- )}- <span className="text-muted-foreground flex-shrink-0">{isExpanded ? "▾" : "▸"}</span>+ {/* Status indicator */}+ <span className="flex-shrink-0 text-xs font-mono text-foreground/40">+ {hasRunning ? (+ <motion.span+ className="inline-block"+ animate={{ opacity: [1, 0.3, 1] }}+ transition={{ duration: 1, repeat: Infinity, ease: "steps(2)" }}+ >+ [{doneCount}/{total}]+ </motion.span>+ ) : (+ <span>[{total}]</span>+ )}+ </span>++ {/* Summary text */}+ <span className="truncate flex-1 text-xs font-mono text-foreground/50 group-hover:text-foreground/80 transition-colors duration-150">+ {hasRunning+ ? friendlyToolLabel(toolCalls.find((tc) => tc.isRunning)!)+ : summary || `${total} steps`+ }+ {hasError && allDone && (+ <span className="ml-1.5 text-foreground/30">· {toolCalls.filter(tc => tc.isError).length} failed</span>+ )}+ </span>++ {/* Expand chevron */}+ <span className="flex-shrink-0 text-[10px] font-mono text-foreground/30 group-hover:text-foreground/60 transition-colors duration-150">+ {isExpanded ? "▾" : "▸"}+ </span></button>- {isExpanded && (- <div className="border-t border-border/50 space-y-1 p-2">- {toolCalls.map((tc) => (- <ToolCallBlock key={tc.id} toolCall={tc} />- ))}- </div>- )}++ {/* Expanded rail view */}+ <AnimatePresence>+ {isExpanded && (+ <motion.div+ initial={{ height: 0, opacity: 0 }}+ animate={{ height: "auto", opacity: 1 }}+ exit={{ height: 0, opacity: 0 }}+ transition={{ duration: 0.15 }}+ className="overflow-hidden"+ >+ <div className="pl-1 pt-1">+ {toolCalls.map((tc, i) => (+ <motion.div+ key={tc.id}+ initial={{ opacity: 0, x: -8 }}+ animate={{ opacity: 1, x: 0 }}+ transition={{ duration: 0.15, delay: i * 0.03 }}+ >+ <ToolCallRailItem+ toolCall={tc}+ isLast={i === toolCalls.length - 1}+ />+ </motion.div>+ ))}+ </div>+ </motion.div>+ )}+ </AnimatePresence></div>);}