Repository navigation
feat: add Execute agent mode, activity log, and batch comparison UI #285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
tonythethompson
merged 129 commits into
main
from
feat/execute-agent-mode-batch-comparison
Aug 14, 2026
Merged
Changes from 128 commits
Commits
Show all changes
129 commits
Select commit
Hold shift + click to select a range
c387687
feat: add shared pipeline validation, review, and catalog libraries
tonythethompson 3ae2a8a
fix: address review on MultiLoRA, reconciler, compare parse, fingerpr…
tonythethompson c5af684
fix: Fingerprint local model selections
qodo-code-review[bot] 70a4dc2
fix: Reject malformed catalog trees
qodo-code-review[bot] 19819c8
fix: 2 findings — Separate legacy adapter emission; Handle unknown VRAM
qodo-code-review[bot] 77c7130
fix: infer catalog architecture/device from path and require hex SHA
tonythethompson 2df8e66
fix: read top-level MultiLoRA state and emit valid ExtractAdapters
tonythethompson 4bde847
fix: fingerprint batch jobs, floor elapsed time, and reconcile autofi…
tonythethompson 135562f
fix: fetch pinned catalog recipe content at commit SHA
tonythethompson a56bad8
fix: override nanoid to >=3.3.18 for GHSA-2v37-7h3g-55p8
tonythethompson 5bdba6d
fix: keep MCP MultiLoRA state and label ROCm catalog as CUDA
tonythethompson 23c08ea
fix: reject incomplete MultiLoRA adapters at MCP recipe bridge
tonythethompson 74a44a5
feat: add Execute agent mode, activity log, and batch comparison UI
tonythethompson f779e78
fix: Replace report booleans with detail variant
qodo-code-review[bot] d198282
fix: 2 findings — Scope agent streams by job ID; Preserve terminal agent
qodo-code-review[bot] 7228974
fix: Replace catalog booleans with status
qodo-code-review[bot] 9488948
fix: submit agent jobs, stream by jobId, and expose batch comparison
tonythethompson 65b8dd6
fix: narrow agent stream jobId for encodeURIComponent
tonythethompson 44a25d3
fix: cancel Olive jobs on stop and adapt live stream payloads
tonythethompson ec7a92b
fix: batch comparison labels, durations, export menu, and mode a11y
tonythethompson ac44c90
test: fix component mocks and scoped batch metric assertions
tonythethompson 3bcea6b
fix: submit agent jobs as MCP and ignore late start/cancel races
tonythethompson ad4f916
fix: wire batch onCompare and expose disabled-compare hint
tonythethompson 15f9d6d
fix: dedupe agent SSE replay and close leftover comparison/export med…
tonythethompson b988a5f
fix: compare selected records and ignore stale agent cancel
tonythethompson b491653
fix: await pending-submit cancel and dedupe streams by event id
tonythethompson 7a4e917
fix: stop-requested flag and prefix-based SSE replay skip
tonythethompson 667fc44
fix: settle stop-during-submit with no jobId and align truncated SSE …
tonythethompson 1c1129e
fix: keep Agent mode until cancel succeeds and honor truncation replay
tonythethompson 8c60b1f
fix: resolve stopAgent after deferred submit cancel
tonythethompson c3316f6
fix: do not resolve deferred stop on start timeout
tonythethompson 6bcfd97
Update src/components/features/execute/useAgentStream.ts
tonythethompson ba1092f
Update src/components/features/execute/ActivityLogEntry.tsx
tonythethompson f572423
Update src/components/features/execute/ActivityLog.test.tsx
tonythethompson 10cdd99
Update src/components/features/execute/AgentConfirmDialog.tsx
tonythethompson e1a3902
Update src/components/features/execute/BatchComparisonView.test.tsx
tonythethompson 4ffbc31
Update src/components/features/execute/ExecutionWorkspace.tsx
tonythethompson fe71e58
Update src/components/features/execute/BatchProcessingPanel.tsx
tonythethompson 8cb2a5d
Update src/components/features/execute/ExportReportMenu.tsx
tonythethompson 00f5a27
Update src/components/features/execute/ExportReportMenu.tsx
tonythethompson fdeb66f
Update src/components/features/execute/useAgentMode.test.ts
tonythethompson 5227a45
fix: consolidate duplicate imports reported by CodeFactor
tonythethompson e87eea0
fix: remove unused imports and variable in test files
tonythethompson 5769c9b
Merge branch 'feat/shared-validation-review-libs' into feat/execute-a…
tonythethompson 8d5b63c
feat: add shared pipeline validation, review, and catalog libraries
tonythethompson 9e9997a
fix: address review on MultiLoRA, reconciler, compare parse, fingerpr…
tonythethompson f151a89
fix: Fingerprint local model selections
qodo-code-review[bot] 593bb7f
fix: Reject malformed catalog trees
qodo-code-review[bot] f34b4be
fix: 2 findings — Separate legacy adapter emission; Handle unknown VRAM
qodo-code-review[bot] 087bae5
fix: infer catalog architecture/device from path and require hex SHA
tonythethompson b4a12fd
fix: read top-level MultiLoRA state and emit valid ExtractAdapters
tonythethompson c641ccc
fix: fingerprint batch jobs, floor elapsed time, and reconcile autofi…
tonythethompson 92c307e
fix: fetch pinned catalog recipe content at commit SHA
tonythethompson 9118d29
fix: override nanoid to >=3.3.18 for GHSA-2v37-7h3g-55p8
tonythethompson 3e9dc22
fix: keep MCP MultiLoRA state and label ROCm catalog as CUDA
tonythethompson 2f70a6e
fix: reject incomplete MultiLoRA adapters at MCP recipe bridge
tonythethompson 5d7bddf
fix: consolidate duplicate imports reported by CodeFactor
tonythethompson 52e1391
fix: remove unused imports and variable in test files
tonythethompson 3face8d
Merge branch 'feat/shared-validation-review-libs' into feat/execute-a…
tonythethompson 9141238
fix(hooks): avoid calling setState directly in useWorkspaceFingerprin…
tonythethompson d598596
fix: exclude localFiles from fingerprint, totalize stableStringify, a…
tonythethompson dc1a140
Merge branch 'feat/shared-validation-review-libs' into feat/execute-a…
tonythethompson a910195
feat: add shared pipeline validation, review, and catalog libraries
tonythethompson 27fd189
fix: address review on MultiLoRA, reconciler, compare parse, fingerpr…
tonythethompson c89d515
fix: Fingerprint local model selections
qodo-code-review[bot] cfd1ffb
fix: Reject malformed catalog trees
qodo-code-review[bot] 6dfa2b9
fix: 2 findings — Separate legacy adapter emission; Handle unknown VRAM
qodo-code-review[bot] 175a952
fix: infer catalog architecture/device from path and require hex SHA
tonythethompson 54e1c74
fix: read top-level MultiLoRA state and emit valid ExtractAdapters
tonythethompson c074785
fix: fingerprint batch jobs, floor elapsed time, and reconcile autofi…
tonythethompson 7879b3d
fix: fetch pinned catalog recipe content at commit SHA
tonythethompson 7090804
fix: override nanoid to >=3.3.18 for GHSA-2v37-7h3g-55p8
tonythethompson bd4dbfb
fix: keep MCP MultiLoRA state and label ROCm catalog as CUDA
tonythethompson 30bcd11
fix: reject incomplete MultiLoRA adapters at MCP recipe bridge
tonythethompson 30e820b
fix: consolidate duplicate imports reported by CodeFactor
tonythethompson 3c0a049
fix: remove unused imports and variable in test files
tonythethompson 49bc943
fix(hooks): avoid calling setState directly in useWorkspaceFingerprin…
tonythethompson b5da42f
fix: exclude localFiles from fingerprint, totalize stableStringify, a…
tonythethompson efb6270
refactor: decompose complex methods in studioRecipeBridge and multiLo…
tonythethompson 89cc67c
fix(execute): address PR review comments for agent mode and batch com…
tonythethompson 812be8a
fix(execute): settle deferred stop and abort submission on startup ti…
tonythethompson 4fde75f
Merge branch 'feat/shared-validation-review-libs' into feat/execute-a…
tonythethompson 715cfe1
fix(execute): match stream deduplication bounds to server replay window
tonythethompson d1b2d73
fix: align MultiLoRA MCP adapter contract and import round-trip
tonythethompson b4c6470
fix: allow MultiLoRA rebuild when VRAM estimate is unset
tonythethompson 1ae84a2
fix(execute): clear startup timer when stop settles during submit
tonythethompson 7be652f
fix(security): avoid regex basename on MultiLoRA adapter paths
tonythethompson 54823b7
refactor: reduce MultiLoRA parse/normalize method complexity
tonythethompson 9a28044
fix(execute): bound agent cancel waits and keep log-only replay prefix
tonythethompson 026425a
fix(execute): do not fake-cancel agent stop on startup timeout
tonythethompson 87cfe2a
Merge branch 'feat/shared-validation-review-libs' into feat/execute-a…
tonythethompson 27cd38f
feat: add shared pipeline validation, review, and catalog libraries
tonythethompson d8a08a6
fix: address review on MultiLoRA, reconciler, compare parse, fingerpr…
tonythethompson 775da17
fix: Fingerprint local model selections
qodo-code-review[bot] 5333a2b
fix: Reject malformed catalog trees
qodo-code-review[bot] dc3ecf2
fix: 2 findings — Separate legacy adapter emission; Handle unknown VRAM
qodo-code-review[bot] 7fa5619
fix: infer catalog architecture/device from path and require hex SHA
tonythethompson 36039b7
fix: read top-level MultiLoRA state and emit valid ExtractAdapters
tonythethompson 527e9de
fix: fingerprint batch jobs, floor elapsed time, and reconcile autofi…
tonythethompson 6da75fc
fix: fetch pinned catalog recipe content at commit SHA
tonythethompson e121a6f
fix: override nanoid to >=3.3.18 for GHSA-2v37-7h3g-55p8
tonythethompson 9958803
fix: keep MCP MultiLoRA state and label ROCm catalog as CUDA
tonythethompson 3a83aa9
fix: reject incomplete MultiLoRA adapters at MCP recipe bridge
tonythethompson f50ff89
fix: consolidate duplicate imports reported by CodeFactor
tonythethompson 762484d
fix: remove unused imports and variable in test files
tonythethompson 30a8df3
fix(hooks): avoid calling setState directly in useWorkspaceFingerprin…
tonythethompson dba4737
fix: exclude localFiles from fingerprint, totalize stableStringify, a…
tonythethompson 03ce03d
refactor: decompose complex methods in studioRecipeBridge and multiLo…
tonythethompson 8d568e3
fix: align MultiLoRA MCP adapter contract and import round-trip
tonythethompson ffa9f97
fix: allow MultiLoRA rebuild when VRAM estimate is unset
tonythethompson 82939a3
fix(security): avoid regex basename on MultiLoRA adapter paths
tonythethompson a9919aa
refactor: reduce MultiLoRA parse/normalize method complexity
tonythethompson 49b0bbb
Merge branch 'feat/shared-validation-review-libs' into feat/execute-a…
tonythethompson 7e557fd
fix(execute): keep submit alive past start timeout and bound deferred…
tonythethompson 9274394
fix(execute): size agent replay prefix to server log watermark
tonythethompson 82a0d14
Merge branch 'feat/shared-validation-review-libs' into feat/execute-a…
tonythethompson f118755
fix(execute): bound late stop waiter after start timeout
tonythethompson b42339c
fix(execute): isolate stale submit from newer session stop
tonythethompson 6811dde
fix(execute): keep truncation notices out of stream replay prefix
tonythethompson 7317478
Merge branch 'main' into feat/execute-agent-mode-batch-comparison
tonythethompson 4127140
Update src/components/features/execute/useAgentMode.ts
tonythethompson 590551e
fix: resolve CodeFactor findings (duplicate import, useMemo deps, eff…
tonythethompson 261208e
Merge branch 'main' into feat/execute-agent-mode-batch-comparison
tonythethompson c4b8216
refactor: extract complex methods flagged by CodeFactor
tonythethompson 7232d63
refactor: split remaining CodeFactor complex methods
tonythethompson a2ea235
fix: remove duplicate Export Report control in More menu
tonythethompson d33922f
fix: surface failed agent cancel, use accurate step count
tonythethompson 43e8faa
fix: reconcile orphaned agent job on grace timeout, dedupe replayed m…
tonythethompson f7663e8
fix: stale generation's grace-timer clear no longer strands a newer s…
tonythethompson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,138 @@ | ||
| /** | ||
| * Component tests for ActivityLog. | ||
| * Validates Requirements 7.1, 7.3, 7.5, 7.6 at the component level. | ||
| */ | ||
| import { describe, it, expect } from "vitest"; | ||
| import { render, screen, fireEvent } from "@testing-library/react"; | ||
|
|
||
| import { ActivityLog } from "./ActivityLog"; | ||
| import type { ActivityLogEntry } from "@/lib/types/agentTypes"; | ||
|
|
||
| // ─── Helpers ──────────────────────────────────────────────────────────────────── | ||
|
|
||
| function makeEntry(overrides: Partial<ActivityLogEntry> = {}): ActivityLogEntry { | ||
| return { | ||
| id: `entry-${Math.random().toString(36).slice(2, 8)}`, | ||
| kind: "reasoning", | ||
| timestamp: "12:34:56", | ||
| text: "Test entry text", | ||
| ...overrides, | ||
| }; | ||
| } | ||
|
|
||
| function makeEntries(count: number): ActivityLogEntry[] { | ||
| return Array.from({ length: count }, (_, i) => | ||
| makeEntry({ id: `entry-${i}`, text: `Entry ${i}` }), | ||
| ); | ||
| } | ||
|
|
||
| // ─── Tests ────────────────────────────────────────────────────────────────────── | ||
|
|
||
| describe("ActivityLog", () => { | ||
| describe("empty state", () => { | ||
| it("renders empty state message when no entries are provided", () => { | ||
| render(<ActivityLog entries={[]} />); | ||
| expect(screen.getByText("No activity yet")).toBeTruthy(); | ||
| }); | ||
|
|
||
| it("does not render a log region when empty", () => { | ||
| render(<ActivityLog entries={[]} />); | ||
| expect(screen.queryByRole("log")).toBeNull(); | ||
| }); | ||
| }); | ||
|
|
||
| describe("entry rendering", () => { | ||
| it("renders all provided entries in chronological order", () => { | ||
| const entries = [ | ||
| makeEntry({ id: "a", text: "First" }), | ||
| makeEntry({ id: "b", text: "Second" }), | ||
| makeEntry({ id: "c", text: "Third" }), | ||
| ]; | ||
| render(<ActivityLog entries={entries} />); | ||
| expect(screen.getByText("First")).toBeTruthy(); | ||
| expect(screen.getByText("Second")).toBeTruthy(); | ||
| expect(screen.getByText("Third")).toBeTruthy(); | ||
| }); | ||
|
|
||
| it("renders entries with their timestamps", () => { | ||
| const entries = [makeEntry({ timestamp: "09:15:30", text: "Hello" })]; | ||
| render(<ActivityLog entries={entries} />); | ||
| expect(screen.getByText("09:15:30")).toBeTruthy(); | ||
| }); | ||
|
|
||
| it("uses a log role for accessibility", () => { | ||
| render(<ActivityLog entries={[makeEntry()]} />); | ||
| const log = screen.getByRole("log"); | ||
| expect(log).toBeTruthy(); | ||
| expect(log.getAttribute("aria-label")).toBe("Agent activity log"); | ||
| }); | ||
| }); | ||
|
|
||
| describe("className prop", () => { | ||
| it("applies additional className to the container when entries exist", () => { | ||
| const { container } = render( | ||
| <ActivityLog entries={[makeEntry()]} className="custom-class" />, | ||
| ); | ||
| const log = container.querySelector("[role='log']"); | ||
| expect(log?.className).toContain("custom-class"); | ||
| }); | ||
|
|
||
| it("applies additional className to the empty state container", () => { | ||
| const { container } = render( | ||
| <ActivityLog entries={[]} className="custom-empty" />, | ||
| ); | ||
| const div = container.firstElementChild; | ||
| expect(div?.className).toContain("custom-empty"); | ||
| }); | ||
| }); | ||
|
|
||
| describe("auto-scroll behavior", () => { | ||
| it("scrolls to bottom when entries are added while at bottom", () => { | ||
| const entries = makeEntries(5); | ||
| const { rerender } = render(<ActivityLog entries={entries} />); | ||
| const log = screen.getByRole("log"); | ||
|
|
||
| // Simulate being at bottom: scrollHeight === scrollTop + clientHeight | ||
| Object.defineProperty(log, "scrollHeight", { value: 500, configurable: true }); | ||
| Object.defineProperty(log, "clientHeight", { value: 500, configurable: true }); | ||
| Object.defineProperty(log, "scrollTop", { value: 0, writable: true, configurable: true }); | ||
|
|
||
| // Add a new entry — should trigger auto-scroll | ||
| const newEntries = [...entries, makeEntry({ id: "new", text: "New entry" })]; | ||
| rerender(<ActivityLog entries={newEntries} />); | ||
|
|
||
| // scrollTop should be set to scrollHeight (auto-scroll) | ||
| expect(log.scrollTop).toBe(500); | ||
| }); | ||
|
|
||
| it("does not auto-scroll when user has scrolled away from bottom", () => { | ||
| const entries = makeEntries(5); | ||
| const { rerender } = render(<ActivityLog entries={entries} />); | ||
| const log = screen.getByRole("log"); | ||
|
|
||
| // Simulate user scrolled away: scrollHeight - scrollTop - clientHeight > 50 | ||
| Object.defineProperty(log, "scrollHeight", { value: 1000, configurable: true }); | ||
| Object.defineProperty(log, "clientHeight", { value: 300, configurable: true }); | ||
| Object.defineProperty(log, "scrollTop", { value: 100, writable: true, configurable: true }); | ||
|
|
||
| // Fire scroll event to update the isNearBottom ref | ||
| fireEvent.scroll(log); | ||
|
|
||
| // Add new entry | ||
| const newEntries = [...entries, makeEntry({ id: "new2", text: "New entry 2" })]; | ||
| rerender(<ActivityLog entries={newEntries} />); | ||
|
|
||
| // scrollTop should NOT be changed (user scrolled away) | ||
| expect(log.scrollTop).toBe(100); | ||
| }); | ||
| }); | ||
|
|
||
| describe("large entry count", () => { | ||
| it("renders up to 2000 entries without error", () => { | ||
| const entries = makeEntries(2000); | ||
| const { container } = render(<ActivityLog entries={entries} />); | ||
| const log = container.querySelector("[role='log']"); | ||
| expect(log?.children.length).toBe(2000); | ||
| }, 15000); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| /** | ||
| * ActivityLog — Scrollable chronological activity log for Agent execution mode. | ||
| * | ||
| * Renders a list of ActivityLogEntry items with: | ||
| * - Auto-scroll to latest entry unless user has scrolled away from bottom | ||
| * - Empty state message when no entries exist | ||
| * - Max-height scrollable container for up to 2000 entries | ||
| * | ||
| * Requirements: 7.1, 7.3, 7.5, 7.6 | ||
| */ | ||
|
|
||
| import { useCallback, useEffect, useRef } from "react"; | ||
|
|
||
| import { cn } from "@/lib/utils"; | ||
| import type { ActivityLogEntry as ActivityLogEntryType } from "@/lib/types/agentTypes"; | ||
| import { ActivityLogEntry } from "./ActivityLogEntry"; | ||
|
|
||
| // ─── Constants ────────────────────────────────────────────────────────────────── | ||
|
|
||
| /** Threshold (px) from the bottom within which auto-scroll stays active. */ | ||
| const AUTO_SCROLL_THRESHOLD = 50; | ||
|
|
||
| // ─── Props ────────────────────────────────────────────────────────────────────── | ||
|
|
||
| export interface ActivityLogProps { | ||
| /** Chronological activity log entries. */ | ||
| entries: ActivityLogEntryType[]; | ||
| /** Optional additional CSS class names. */ | ||
| className?: string; | ||
| } | ||
|
|
||
| // ─── Component ────────────────────────────────────────────────────────────────── | ||
|
|
||
| export function ActivityLog({ entries, className }: ActivityLogProps) { | ||
| const containerRef = useRef<HTMLDivElement>(null); | ||
| const isNearBottomRef = useRef(true); | ||
|
|
||
| /** | ||
| * Check whether the scroll container is near the bottom. | ||
| * "Near bottom" means within AUTO_SCROLL_THRESHOLD pixels of the max scroll. | ||
| */ | ||
| const checkIfNearBottom = useCallback(() => { | ||
| const el = containerRef.current; | ||
| if (!el) return true; | ||
| const { scrollTop, scrollHeight, clientHeight } = el; | ||
| return scrollHeight - scrollTop - clientHeight <= AUTO_SCROLL_THRESHOLD; | ||
| }, []); | ||
|
|
||
| /** | ||
| * Handle scroll events to track whether user is near bottom. | ||
| */ | ||
| const handleScroll = useCallback(() => { | ||
| isNearBottomRef.current = checkIfNearBottom(); | ||
| }, [checkIfNearBottom]); | ||
|
|
||
| /** | ||
| * Auto-scroll to bottom when new entries arrive AND user was at bottom. | ||
| */ | ||
| useEffect(() => { | ||
| if (entries.length === 0) { | ||
| isNearBottomRef.current = true; | ||
| return; | ||
| } | ||
| if (isNearBottomRef.current && containerRef.current) { | ||
| containerRef.current.scrollTop = containerRef.current.scrollHeight; | ||
| } | ||
| }, [entries]); | ||
|
|
||
| // ─── Empty State ──────────────────────────────────────────────────────────── | ||
|
|
||
| if (entries.length === 0) { | ||
| return ( | ||
| <div | ||
| className={cn( | ||
| "flex items-center justify-center rounded-md border border-dashed", | ||
| "border-slate-800 bg-slate-900/40", | ||
| "min-h-[200px] text-sm text-slate-400", | ||
| className, | ||
| )} | ||
| > | ||
| No activity yet | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| // ─── Activity List ────────────────────────────────────────────────────────── | ||
|
|
||
| return ( | ||
| <div | ||
| ref={containerRef} | ||
| onScroll={handleScroll} | ||
| className={cn( | ||
| "overflow-y-auto max-h-[600px] rounded-md border", | ||
| "border-slate-800 bg-slate-950/60", | ||
| className, | ||
| )} | ||
| role="log" | ||
| aria-label="Agent activity log" | ||
| aria-live="polite" | ||
| > | ||
| {entries.map((entry) => ( | ||
| <ActivityLogEntry key={entry.id} entry={entry} /> | ||
| ))} | ||
| </div> | ||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| /** | ||
| * ActivityLogEntry — Renders a single activity log entry with kind-specific styling. | ||
| * | ||
| * Displays a timestamp, kind-specific icon with color, entry text, and an | ||
| * expand/collapse toggle when the entry was truncated (expandedText present). | ||
| * | ||
| * Requirements: 7.2 | ||
| */ | ||
|
|
||
| import { useState } from "react"; | ||
| import { | ||
| Brain, | ||
| Terminal, | ||
| CheckCircle, | ||
| Zap, | ||
| AlertTriangle, | ||
| } from "lucide-react"; | ||
| import { cn } from "@/lib/utils"; | ||
| import type { ActivityLogEntry as ActivityLogEntryType } from "@/lib/types/agentTypes"; | ||
|
|
||
| // ─── Kind Configuration ───────────────────────────────────────────────────────── | ||
|
|
||
| const KIND_CONFIG = { | ||
| reasoning: { icon: Brain, color: "text-blue-400", label: "Reasoning" }, | ||
| tool_call: { icon: Terminal, color: "text-purple-400", label: "Tool Call" }, | ||
| tool_result: { icon: CheckCircle, color: "text-emerald-400", label: "Tool Result" }, | ||
| decision: { icon: Zap, color: "text-amber-400", label: "Decision" }, | ||
| error: { icon: AlertTriangle, color: "text-rose-400", label: "Error" }, | ||
| } as const; | ||
|
|
||
| // ─── Props ────────────────────────────────────────────────────────────────────── | ||
|
|
||
| export interface ActivityLogEntryProps { | ||
| entry: ActivityLogEntryType; | ||
| } | ||
|
|
||
| // ─── Component ────────────────────────────────────────────────────────────────── | ||
|
|
||
| export function ActivityLogEntry({ entry }: ActivityLogEntryProps) { | ||
| const [expanded, setExpanded] = useState(false); | ||
| const config = KIND_CONFIG[entry.kind as keyof typeof KIND_CONFIG] ?? { | ||
| icon: AlertTriangle, | ||
| color: "text-slate-400", | ||
| label: entry.kind || "Activity", | ||
| }; | ||
| const Icon = config.icon; | ||
| const hasTruncated = Boolean(entry.expandedText); | ||
|
tonythethompson marked this conversation as resolved.
Resolved
|
||
|
|
||
| return ( | ||
| <div className="flex items-start gap-2 px-2 py-1.5 text-sm group"> | ||
| {/* Timestamp */} | ||
| <span className="shrink-0 font-mono text-xs text-slate-500 dark:text-slate-400 pt-0.5"> | ||
| {entry.timestamp} | ||
| </span> | ||
|
|
||
| {/* Kind icon + text label for screen readers */} | ||
| <Icon className={cn("h-4 w-4 shrink-0 mt-0.5", config.color)} aria-hidden="true" /> | ||
| <span className="sr-only">[{config.label}]</span> | ||
|
|
||
| {/* Text content */} | ||
| <div className="min-w-0 flex-1"> | ||
| <p | ||
| className={cn( | ||
| "whitespace-pre-wrap break-words text-zinc-700 dark:text-zinc-300", | ||
| entry.kind === "error" && "text-rose-600 dark:text-rose-400", | ||
| )} | ||
| > | ||
| {expanded && entry.expandedText ? entry.expandedText : entry.text} | ||
| </p> | ||
|
|
||
| {/* Expand toggle */} | ||
| {hasTruncated && ( | ||
| <button | ||
| type="button" | ||
| onClick={() => setExpanded((prev) => !prev)} | ||
| className="mt-0.5 text-xs text-blue-500 hover:text-blue-400 focus:outline-none focus-visible:underline" | ||
| > | ||
| {expanded ? "Show less" : "Show more"} | ||
| </button> | ||
| )} | ||
|
|
||
| {/* Step reference for error entries */} | ||
| {entry.stepRef && ( | ||
| <span className="ml-2 text-xs text-zinc-400 dark:text-zinc-500"> | ||
| (step: {entry.stepRef}) | ||
| </span> | ||
| )} | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.