Skip to content
Merged
Show file tree
Hide file tree
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 Aug 13, 2026
3ae2a8a
fix: address review on MultiLoRA, reconciler, compare parse, fingerpr…
tonythethompson Aug 13, 2026
c5af684
fix: Fingerprint local model selections
qodo-code-review[bot] Aug 13, 2026
70a4dc2
fix: Reject malformed catalog trees
qodo-code-review[bot] Aug 13, 2026
19819c8
fix: 2 findings — Separate legacy adapter emission; Handle unknown VRAM
qodo-code-review[bot] Aug 13, 2026
77c7130
fix: infer catalog architecture/device from path and require hex SHA
tonythethompson Aug 13, 2026
2df8e66
fix: read top-level MultiLoRA state and emit valid ExtractAdapters
tonythethompson Aug 13, 2026
4bde847
fix: fingerprint batch jobs, floor elapsed time, and reconcile autofi…
tonythethompson Aug 13, 2026
135562f
fix: fetch pinned catalog recipe content at commit SHA
tonythethompson Aug 13, 2026
a56bad8
fix: override nanoid to >=3.3.18 for GHSA-2v37-7h3g-55p8
tonythethompson Aug 13, 2026
5bdba6d
fix: keep MCP MultiLoRA state and label ROCm catalog as CUDA
tonythethompson Aug 13, 2026
23c08ea
fix: reject incomplete MultiLoRA adapters at MCP recipe bridge
tonythethompson Aug 13, 2026
74a44a5
feat: add Execute agent mode, activity log, and batch comparison UI
tonythethompson Aug 13, 2026
f779e78
fix: Replace report booleans with detail variant
qodo-code-review[bot] Aug 13, 2026
d198282
fix: 2 findings — Scope agent streams by job ID; Preserve terminal agent
qodo-code-review[bot] Aug 13, 2026
7228974
fix: Replace catalog booleans with status
qodo-code-review[bot] Aug 13, 2026
9488948
fix: submit agent jobs, stream by jobId, and expose batch comparison
tonythethompson Aug 13, 2026
65b8dd6
fix: narrow agent stream jobId for encodeURIComponent
tonythethompson Aug 13, 2026
44a25d3
fix: cancel Olive jobs on stop and adapt live stream payloads
tonythethompson Aug 13, 2026
ec7a92b
fix: batch comparison labels, durations, export menu, and mode a11y
tonythethompson Aug 13, 2026
ac44c90
test: fix component mocks and scoped batch metric assertions
tonythethompson Aug 13, 2026
3bcea6b
fix: submit agent jobs as MCP and ignore late start/cancel races
tonythethompson Aug 13, 2026
ad4f916
fix: wire batch onCompare and expose disabled-compare hint
tonythethompson Aug 13, 2026
15f9d6d
fix: dedupe agent SSE replay and close leftover comparison/export med…
tonythethompson Aug 13, 2026
b988a5f
fix: compare selected records and ignore stale agent cancel
tonythethompson Aug 13, 2026
b491653
fix: await pending-submit cancel and dedupe streams by event id
tonythethompson Aug 13, 2026
7a4e917
fix: stop-requested flag and prefix-based SSE replay skip
tonythethompson Aug 13, 2026
667fc44
fix: settle stop-during-submit with no jobId and align truncated SSE …
tonythethompson Aug 13, 2026
1c1129e
fix: keep Agent mode until cancel succeeds and honor truncation replay
tonythethompson Aug 13, 2026
8c60b1f
fix: resolve stopAgent after deferred submit cancel
tonythethompson Aug 13, 2026
c3316f6
fix: do not resolve deferred stop on start timeout
tonythethompson Aug 13, 2026
6bcfd97
Update src/components/features/execute/useAgentStream.ts
tonythethompson Aug 13, 2026
ba1092f
Update src/components/features/execute/ActivityLogEntry.tsx
tonythethompson Aug 13, 2026
f572423
Update src/components/features/execute/ActivityLog.test.tsx
tonythethompson Aug 13, 2026
10cdd99
Update src/components/features/execute/AgentConfirmDialog.tsx
tonythethompson Aug 13, 2026
e1a3902
Update src/components/features/execute/BatchComparisonView.test.tsx
tonythethompson Aug 13, 2026
4ffbc31
Update src/components/features/execute/ExecutionWorkspace.tsx
tonythethompson Aug 13, 2026
fe71e58
Update src/components/features/execute/BatchProcessingPanel.tsx
tonythethompson Aug 13, 2026
8cb2a5d
Update src/components/features/execute/ExportReportMenu.tsx
tonythethompson Aug 13, 2026
00f5a27
Update src/components/features/execute/ExportReportMenu.tsx
tonythethompson Aug 13, 2026
fdeb66f
Update src/components/features/execute/useAgentMode.test.ts
tonythethompson Aug 13, 2026
5227a45
fix: consolidate duplicate imports reported by CodeFactor
tonythethompson Aug 13, 2026
e87eea0
fix: remove unused imports and variable in test files
tonythethompson Aug 13, 2026
5769c9b
Merge branch 'feat/shared-validation-review-libs' into feat/execute-a…
tonythethompson Aug 13, 2026
8d5b63c
feat: add shared pipeline validation, review, and catalog libraries
tonythethompson Aug 13, 2026
9e9997a
fix: address review on MultiLoRA, reconciler, compare parse, fingerpr…
tonythethompson Aug 13, 2026
f151a89
fix: Fingerprint local model selections
qodo-code-review[bot] Aug 13, 2026
593bb7f
fix: Reject malformed catalog trees
qodo-code-review[bot] Aug 13, 2026
f34b4be
fix: 2 findings — Separate legacy adapter emission; Handle unknown VRAM
qodo-code-review[bot] Aug 13, 2026
087bae5
fix: infer catalog architecture/device from path and require hex SHA
tonythethompson Aug 13, 2026
b4a12fd
fix: read top-level MultiLoRA state and emit valid ExtractAdapters
tonythethompson Aug 13, 2026
c641ccc
fix: fingerprint batch jobs, floor elapsed time, and reconcile autofi…
tonythethompson Aug 13, 2026
92c307e
fix: fetch pinned catalog recipe content at commit SHA
tonythethompson Aug 13, 2026
9118d29
fix: override nanoid to >=3.3.18 for GHSA-2v37-7h3g-55p8
tonythethompson Aug 13, 2026
3e9dc22
fix: keep MCP MultiLoRA state and label ROCm catalog as CUDA
tonythethompson Aug 13, 2026
2f70a6e
fix: reject incomplete MultiLoRA adapters at MCP recipe bridge
tonythethompson Aug 13, 2026
5d7bddf
fix: consolidate duplicate imports reported by CodeFactor
tonythethompson Aug 13, 2026
52e1391
fix: remove unused imports and variable in test files
tonythethompson Aug 13, 2026
3face8d
Merge branch 'feat/shared-validation-review-libs' into feat/execute-a…
tonythethompson Aug 13, 2026
9141238
fix(hooks): avoid calling setState directly in useWorkspaceFingerprin…
tonythethompson Aug 13, 2026
d598596
fix: exclude localFiles from fingerprint, totalize stableStringify, a…
tonythethompson Aug 13, 2026
dc1a140
Merge branch 'feat/shared-validation-review-libs' into feat/execute-a…
tonythethompson Aug 13, 2026
a910195
feat: add shared pipeline validation, review, and catalog libraries
tonythethompson Aug 13, 2026
27fd189
fix: address review on MultiLoRA, reconciler, compare parse, fingerpr…
tonythethompson Aug 13, 2026
c89d515
fix: Fingerprint local model selections
qodo-code-review[bot] Aug 13, 2026
cfd1ffb
fix: Reject malformed catalog trees
qodo-code-review[bot] Aug 13, 2026
6dfa2b9
fix: 2 findings — Separate legacy adapter emission; Handle unknown VRAM
qodo-code-review[bot] Aug 13, 2026
175a952
fix: infer catalog architecture/device from path and require hex SHA
tonythethompson Aug 13, 2026
54e1c74
fix: read top-level MultiLoRA state and emit valid ExtractAdapters
tonythethompson Aug 13, 2026
c074785
fix: fingerprint batch jobs, floor elapsed time, and reconcile autofi…
tonythethompson Aug 13, 2026
7879b3d
fix: fetch pinned catalog recipe content at commit SHA
tonythethompson Aug 13, 2026
7090804
fix: override nanoid to >=3.3.18 for GHSA-2v37-7h3g-55p8
tonythethompson Aug 13, 2026
bd4dbfb
fix: keep MCP MultiLoRA state and label ROCm catalog as CUDA
tonythethompson Aug 13, 2026
30bcd11
fix: reject incomplete MultiLoRA adapters at MCP recipe bridge
tonythethompson Aug 13, 2026
30e820b
fix: consolidate duplicate imports reported by CodeFactor
tonythethompson Aug 13, 2026
3c0a049
fix: remove unused imports and variable in test files
tonythethompson Aug 13, 2026
49bc943
fix(hooks): avoid calling setState directly in useWorkspaceFingerprin…
tonythethompson Aug 13, 2026
b5da42f
fix: exclude localFiles from fingerprint, totalize stableStringify, a…
tonythethompson Aug 13, 2026
efb6270
refactor: decompose complex methods in studioRecipeBridge and multiLo…
tonythethompson Aug 13, 2026
89cc67c
fix(execute): address PR review comments for agent mode and batch com…
tonythethompson Aug 14, 2026
812be8a
fix(execute): settle deferred stop and abort submission on startup ti…
tonythethompson Aug 14, 2026
4fde75f
Merge branch 'feat/shared-validation-review-libs' into feat/execute-a…
tonythethompson Aug 14, 2026
715cfe1
fix(execute): match stream deduplication bounds to server replay window
tonythethompson Aug 14, 2026
d1b2d73
fix: align MultiLoRA MCP adapter contract and import round-trip
tonythethompson Aug 14, 2026
b4c6470
fix: allow MultiLoRA rebuild when VRAM estimate is unset
tonythethompson Aug 14, 2026
1ae84a2
fix(execute): clear startup timer when stop settles during submit
tonythethompson Aug 14, 2026
7be652f
fix(security): avoid regex basename on MultiLoRA adapter paths
tonythethompson Aug 14, 2026
54823b7
refactor: reduce MultiLoRA parse/normalize method complexity
tonythethompson Aug 14, 2026
9a28044
fix(execute): bound agent cancel waits and keep log-only replay prefix
tonythethompson Aug 14, 2026
026425a
fix(execute): do not fake-cancel agent stop on startup timeout
tonythethompson Aug 14, 2026
87cfe2a
Merge branch 'feat/shared-validation-review-libs' into feat/execute-a…
tonythethompson Aug 14, 2026
27cd38f
feat: add shared pipeline validation, review, and catalog libraries
tonythethompson Aug 13, 2026
d8a08a6
fix: address review on MultiLoRA, reconciler, compare parse, fingerpr…
tonythethompson Aug 13, 2026
775da17
fix: Fingerprint local model selections
qodo-code-review[bot] Aug 13, 2026
5333a2b
fix: Reject malformed catalog trees
qodo-code-review[bot] Aug 13, 2026
dc3ecf2
fix: 2 findings — Separate legacy adapter emission; Handle unknown VRAM
qodo-code-review[bot] Aug 13, 2026
7fa5619
fix: infer catalog architecture/device from path and require hex SHA
tonythethompson Aug 13, 2026
36039b7
fix: read top-level MultiLoRA state and emit valid ExtractAdapters
tonythethompson Aug 13, 2026
527e9de
fix: fingerprint batch jobs, floor elapsed time, and reconcile autofi…
tonythethompson Aug 13, 2026
6da75fc
fix: fetch pinned catalog recipe content at commit SHA
tonythethompson Aug 13, 2026
e121a6f
fix: override nanoid to >=3.3.18 for GHSA-2v37-7h3g-55p8
tonythethompson Aug 13, 2026
9958803
fix: keep MCP MultiLoRA state and label ROCm catalog as CUDA
tonythethompson Aug 13, 2026
3a83aa9
fix: reject incomplete MultiLoRA adapters at MCP recipe bridge
tonythethompson Aug 13, 2026
f50ff89
fix: consolidate duplicate imports reported by CodeFactor
tonythethompson Aug 13, 2026
762484d
fix: remove unused imports and variable in test files
tonythethompson Aug 13, 2026
30a8df3
fix(hooks): avoid calling setState directly in useWorkspaceFingerprin…
tonythethompson Aug 13, 2026
dba4737
fix: exclude localFiles from fingerprint, totalize stableStringify, a…
tonythethompson Aug 13, 2026
03ce03d
refactor: decompose complex methods in studioRecipeBridge and multiLo…
tonythethompson Aug 13, 2026
8d568e3
fix: align MultiLoRA MCP adapter contract and import round-trip
tonythethompson Aug 14, 2026
ffa9f97
fix: allow MultiLoRA rebuild when VRAM estimate is unset
tonythethompson Aug 14, 2026
82939a3
fix(security): avoid regex basename on MultiLoRA adapter paths
tonythethompson Aug 14, 2026
a9919aa
refactor: reduce MultiLoRA parse/normalize method complexity
tonythethompson Aug 14, 2026
49b0bbb
Merge branch 'feat/shared-validation-review-libs' into feat/execute-a…
tonythethompson Aug 14, 2026
7e557fd
fix(execute): keep submit alive past start timeout and bound deferred…
tonythethompson Aug 14, 2026
9274394
fix(execute): size agent replay prefix to server log watermark
tonythethompson Aug 14, 2026
82a0d14
Merge branch 'feat/shared-validation-review-libs' into feat/execute-a…
tonythethompson Aug 14, 2026
f118755
fix(execute): bound late stop waiter after start timeout
tonythethompson Aug 14, 2026
b42339c
fix(execute): isolate stale submit from newer session stop
tonythethompson Aug 14, 2026
6811dde
fix(execute): keep truncation notices out of stream replay prefix
tonythethompson Aug 14, 2026
7317478
Merge branch 'main' into feat/execute-agent-mode-batch-comparison
tonythethompson Aug 14, 2026
4127140
Update src/components/features/execute/useAgentMode.ts
tonythethompson Aug 14, 2026
590551e
fix: resolve CodeFactor findings (duplicate import, useMemo deps, eff…
tonythethompson Aug 14, 2026
261208e
Merge branch 'main' into feat/execute-agent-mode-batch-comparison
tonythethompson Aug 14, 2026
c4b8216
refactor: extract complex methods flagged by CodeFactor
tonythethompson Aug 14, 2026
7232d63
refactor: split remaining CodeFactor complex methods
tonythethompson Aug 14, 2026
a2ea235
fix: remove duplicate Export Report control in More menu
tonythethompson Aug 14, 2026
d33922f
fix: surface failed agent cancel, use accurate step count
tonythethompson Aug 14, 2026
43e8faa
fix: reconcile orphaned agent job on grace timeout, dedupe replayed m…
tonythethompson Aug 14, 2026
f7663e8
fix: stale generation's grace-timer clear no longer strands a newer s…
tonythethompson Aug 14, 2026
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
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
"bin/"
],
"packageManager": "pnpm@11.17.0",
"pnpm": {
"overrides": {
"nanoid": ">=3.3.18"
}
},
"engines": {
"node": ">=22.16"
},
Expand Down
138 changes: 138 additions & 0 deletions src/components/features/execute/ActivityLog.test.tsx
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);
});
});
106 changes: 106 additions & 0 deletions src/components/features/execute/ActivityLog.tsx
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]);
Comment thread
macroscopeapp[bot] marked this conversation as resolved.
Resolved

// ─── 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>
);
}
91 changes: 91 additions & 0 deletions src/components/features/execute/ActivityLogEntry.tsx
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);
Comment thread
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>
);
}
Loading
Loading