Skip to content

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

fix(workflows): load missing source screenshots inline (#7267)

Louis Beaumont085f3631a409
diff --git a/.github/pr-assets/workflow-source-previews/README.md b/.github/pr-assets/workflow-source-previews/README.md
new file mode 100644
index 000000000..fa6d77db2
--- /dev/null
+++ b/.github/pr-assets/workflow-source-previews/README.md
@@ -0,0 +1,10 @@
+# Workflow source screenshot previews
+
+These images show the real shared Workflows UI with fictional research data and fictional source images. No customer recordings or private catalog content are included.
+
+- `before.png`: recreated baseline from f02a3d069 using a workflow with empty screenshot attachments but retained source references.
+- `after.png`: same workflow and 1440 × 1100 viewport; an available exact source image loads inline.
+- `loading.png`, `missing.png`, `error.png`: bounded loading, unavailable capture, and failed lookup states.
+- `compact.png`: the same result at 600 × 1000.
+
+Captured with headless Chrome against the maintained Workflows web app, through a temporary fixture route removed before commit. The after preview exercised the selected frame handoff; API behavior is covered separately by adapter tests and a private read-only recorder lookup. These images do not establish installed native-app validation.
diff --git a/.github/pr-assets/workflow-source-previews/after.png b/.github/pr-assets/workflow-source-previews/after.png
new file mode 100644
index 000000000..f40312c77
Binary files /dev/null and b/.github/pr-assets/workflow-source-previews/after.png differ
diff --git a/.github/pr-assets/workflow-source-previews/before.png b/.github/pr-assets/workflow-source-previews/before.png
new file mode 100644
index 000000000..5825c17fa
Binary files /dev/null and b/.github/pr-assets/workflow-source-previews/before.png differ
diff --git a/.github/pr-assets/workflow-source-previews/compact.png b/.github/pr-assets/workflow-source-previews/compact.png
new file mode 100644
index 000000000..ffb1e2363
Binary files /dev/null and b/.github/pr-assets/workflow-source-previews/compact.png differ
diff --git a/.github/pr-assets/workflow-source-previews/error.png b/.github/pr-assets/workflow-source-previews/error.png
new file mode 100644
index 000000000..a06f028ab
Binary files /dev/null and b/.github/pr-assets/workflow-source-previews/error.png differ
diff --git a/.github/pr-assets/workflow-source-previews/loading.png b/.github/pr-assets/workflow-source-previews/loading.png
new file mode 100644
index 000000000..99d81f6bc
Binary files /dev/null and b/.github/pr-assets/workflow-source-previews/loading.png differ
diff --git a/.github/pr-assets/workflow-source-previews/missing.png b/.github/pr-assets/workflow-source-previews/missing.png
new file mode 100644
index 000000000..1ca85e31f
Binary files /dev/null and b/.github/pr-assets/workflow-source-previews/missing.png differ
diff --git a/apps/screenpipe-app-tauri/components/workflows/step-evidence.test.tsx b/apps/screenpipe-app-tauri/components/workflows/step-evidence.test.tsx
index 65379951a..faa233880 100644
--- a/apps/screenpipe-app-tauri/components/workflows/step-evidence.test.tsx
+++ b/apps/screenpipe-app-tauri/components/workflows/step-evidence.test.tsx
@@ -1,7 +1,7 @@
// screenpipe — AI that knows everything you've seen, said, or heard
// https://screenpipe.com
import React from "react";
-import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";
+import { act, cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";
import { afterEach, describe, expect, it, vi } from "vitest";
import { WorkflowStepEvidence } from "../../../../packages/workflows-ui/src/workflow-step-evidence";
import { fixtureWorkflowAnalysis } from "../../../../packages/workflows-ui/src/fixture-platform";
@@ -13,6 +13,96 @@ const close = () => fireEvent.click(screen.getByRole("button", { name: `Close re
const play = () => fireEvent.click(screen.getByRole("button", { name: `View recording for ${stage.name}` }));
afterEach(cleanup);
+describe("missing attached screenshots", () => {
+ const bare = { ...stage, screenshot: null, screenshots: [] };
+ it("automatically shows an exact source preview without changing evidence or starting replay", async () => {
+ const preview = { ...stage.screenshot!, visualVerified: false };
+ const load = vi.fn().mockResolvedValue(preview);
+ const recording = vi.fn();
+ const open = vi.fn().mockResolvedValue(undefined);
+ const before = JSON.stringify(bare);
+ render(<WorkflowStepEvidence workflow={workflow} stage={bare} platform={{ loadWorkflowScreenshot: load, loadWorkflowRecording: recording, openCapturedMoment: open } as unknown as WorkflowsPlatform} />);
+ expect(await screen.findByRole("img")).toHaveAttribute("src", preview.dataUrl);
+ expect(screen.getByText(/Source screenshot/)).toBeVisible();
+ expect(load).toHaveBeenCalledWith(bare.evidence[0].timestamp, bare.evidence[0].app, expect.any(AbortSignal));
+ expect(recording).not.toHaveBeenCalled();
+ expect(JSON.stringify(bare)).toBe(before);
+ fireEvent.click(screen.getByRole("button", { name: `Open recording for ${stage.name}` }));
+ await waitFor(() => expect(open).toHaveBeenCalledWith(preview.frameId, preview.timestamp));
+ });
+ it("keeps attached images without a lookup", () => {
+ const load = vi.fn();
+ render(<WorkflowStepEvidence workflow={workflow} stage={stage} platform={{ loadWorkflowScreenshot: load } as unknown as WorkflowsPlatform} />);
+ expect(screen.getByRole("img")).toBeVisible();
+ expect(load).not.toHaveBeenCalled();
+ });
+ it("recovers the source image when a catalog refresh omits the attachment", async () => {
+ const load = vi.fn().mockResolvedValue({ ...stage.screenshot!, visualVerified: false });
+ const platform = { loadWorkflowScreenshot: load } as unknown as WorkflowsPlatform;
+ const { rerender } = render(<WorkflowStepEvidence workflow={workflow} stage={stage} platform={platform} />);
+ expect(load).not.toHaveBeenCalled();
+ rerender(<WorkflowStepEvidence workflow={workflow} stage={bare} platform={platform} />);
+ expect(await screen.findByRole("img")).toHaveAttribute("src", stage.screenshot!.dataUrl);
+ expect(screen.getByText(/Source screenshot/)).toBeVisible();
+ });
+ it("does not look up media until the step approaches the viewport", async () => {
+ let observe!: (entries: { isIntersecting: boolean }[]) => void;
+ const disconnect = vi.fn();
+ vi.stubGlobal("IntersectionObserver", class {
+ constructor(callback: typeof observe) { observe = callback; }
+ observe() {} disconnect = disconnect;
+ });
+ try {
+ const load = vi.fn().mockResolvedValue(stage.screenshot);
+ render(<WorkflowStepEvidence workflow={workflow} stage={bare} platform={{ loadWorkflowScreenshot: load } as unknown as WorkflowsPlatform} />);
+ expect(load).not.toHaveBeenCalled();
+ act(() => observe([{ isIntersecting: true }]));
+ expect(await screen.findByRole("img")).toBeVisible();
+ expect(disconnect).toHaveBeenCalled();
+ } finally { cleanup(); vi.unstubAllGlobals(); }
+ });
+ it("tries another source when the first capture is unavailable", async () => {
+ const second = { ...bare.evidence[0], timestamp: "2026-09-23T10:00:00Z" };
+ const load = vi.fn().mockResolvedValueOnce(null).mockResolvedValueOnce({ ...stage.screenshot!, timestamp: second.timestamp });
+ render(<WorkflowStepEvidence workflow={workflow} stage={{ ...bare, evidence: [bare.evidence[0], second] }} platform={{ loadWorkflowScreenshot: load } as unknown as WorkflowsPlatform} />);
+ expect(await screen.findByRole("img")).toBeVisible();
+ expect(load).toHaveBeenCalledTimes(2);
+ });
+ it("shows missing capture and recovers from a transient failure with retry", async () => {
+ const load = vi.fn().mockResolvedValueOnce(null).mockRejectedValueOnce(new Error("offline")).mockResolvedValue(stage.screenshot);
+ render(<WorkflowStepEvidence workflow={workflow} stage={bare} platform={{ loadWorkflowScreenshot: load } as unknown as WorkflowsPlatform} />);
+ expect(await screen.findByText("No screenshot available for this step.")).toBeVisible();
+ fireEvent.click(screen.getByRole("button", { name: "Retry screenshot" }));
+ expect(await screen.findByText("Could not load the source screenshot.")).toBeVisible();
+ fireEvent.click(screen.getByRole("button", { name: "Retry screenshot" }));
+ expect(await screen.findByRole("img")).toBeVisible();
+ });
+ it("aborts navigation and releases a late blob without attaching it to another step", async () => {
+ const revoke = vi.fn();
+ Object.defineProperty(URL, "revokeObjectURL", { value: revoke, configurable: true });
+ let resolve!: (value: any) => void;
+ const load = vi.fn().mockImplementationOnce(() => new Promise(r => { resolve = r; })).mockResolvedValue(null);
+ const platform = { loadWorkflowScreenshot: load } as unknown as WorkflowsPlatform;
+ const { rerender } = render(<WorkflowStepEvidence workflow={workflow} stage={bare} platform={platform} />);
+ await waitFor(() => expect(load).toHaveBeenCalledTimes(1));
+ const signal = load.mock.calls[0][2];
+ rerender(<WorkflowStepEvidence workflow={workflow} stage={{ ...bare, evidence: [{ ...bare.evidence[0], timestamp: "2026-09-24T12:00:00Z" }] }} platform={platform} />);
+ await act(async () => resolve({ ...stage.screenshot!, dataUrl: "blob:late" }));
+ expect(signal.aborted).toBe(true);
+ expect(revoke).toHaveBeenCalledWith("blob:late");
+ expect(screen.queryByRole("img")).toBeNull();
+ });
+ it("releases visible preview blobs on unmount", async () => {
+ const revoke = vi.fn();
+ Object.defineProperty(URL, "revokeObjectURL", { value: revoke, configurable: true });
+ const load = vi.fn().mockResolvedValue({ ...stage.screenshot!, dataUrl: "blob:preview" });
+ const { unmount } = render(<WorkflowStepEvidence workflow={workflow} stage={bare} platform={{ loadWorkflowScreenshot: load } as unknown as WorkflowsPlatform} />);
+ await screen.findByRole("img");
+ unmount();
+ expect(revoke).toHaveBeenCalledWith("blob:preview");
+ });
+});
+
describe("step evidence media", () => {
it("shows all unique verified images, keeps independent sizing and opens the selected frame", async () => {
const second = { ...stage.screenshot!, frameId: 9002, timestamp: "2026-09-22T11:02:00Z" };
diff --git a/apps/screenpipe-app-tauri/lib/workflows/desktop-platform.ts b/apps/screenpipe-app-tauri/lib/workflows/desktop-platform.ts
index 84e624159..3a182c512 100644
--- a/apps/screenpipe-app-tauri/lib/workflows/desktop-platform.ts
+++ b/apps/screenpipe-app-tauri/lib/workflows/desktop-platform.ts
@@ -26,6 +26,7 @@ import {
} from "./disk-storage";
import { ensureWorkflowTask, startWorkflowJob, getWorkflowJob, latestWorkflowJob, stopWorkflowJob, loadScheduledCatalog, saveWorkflowCorrections, saveWorkflowEdits } from "./scheduled-discovery";
+import { loadWorkflowScreenshot } from "./source-screenshot";
const WORK_PROFILE_KEY = "screenpipe-workflows:work-profile:v1";
const BROWSER_ANALYSIS_KEY = "screenpipe-workflows:last-analysis-v2";
@@ -121,6 +122,7 @@ async function saveWorkProfile(profile: WorkProfile) {
export const desktopWorkflowsPlatform: WorkflowsPlatform = {
modelPreference: workflowModelPreference,
+ ...(!browserPreview ? { loadWorkflowScreenshot } : {}),
...(!browserPreview ? { loadWorkflowRecording: async (timestamp: string, app: string) => {
const media = await invoke<WorkflowRecording | null>("load_workflow_recording", { timestamp, appName: app });
if (!media) return null;
diff --git a/apps/screenpipe-app-tauri/lib/workflows/source-screenshot.test.ts b/apps/screenpipe-app-tauri/lib/workflows/source-screenshot.test.ts
new file mode 100644
index 000000000..a107e7d9f
--- /dev/null
+++ b/apps/screenpipe-app-tauri/lib/workflows/source-screenshot.test.ts
@@ -0,0 +1,47 @@
+// screenpipe — AI that knows everything you've seen, said, or heard
+// https://screenpipe.com
+import { beforeEach, describe, expect, it, vi } from "vitest";
+import { localFetch } from "@/lib/api";
+import { loadWorkflowScreenshot } from "./source-screenshot";
+vi.mock("@/lib/api", () => ({ localFetch: vi.fn() }));
+const fetch = vi.mocked(localFetch);
+const timestamp = "2026-09-23T19:07:42.820687-07:00";
+const frame = { frame_id: 42, timestamp: "2026-09-24T02:07:42.820687Z", app_name: "Obsidian" };
+const lookup = (rows = [frame]) => Response.json({ data: rows.map(content => ({ type: "OCR", content })) });
+const create = vi.fn().mockReturnValue("blob:source-preview");
+beforeEach(() => { fetch.mockReset(); create.mockClear(); Object.defineProperty(URL, "createObjectURL", { value: create, configurable: true }); });
+describe("exact source screenshot adapter", () => {
+ it("loads the exact frame thumbnail without borrowing a nearby recording or verifying the claim", async () => {
+ fetch.mockResolvedValueOnce(lookup()).mockResolvedValueOnce(new Response("image", { headers: { "content-type": "image/jpeg" } }));
+ const image = await loadWorkflowScreenshot(timestamp, "Obsidian", new AbortController().signal);
+ expect(image).toMatchObject({ frameId: 42, timestamp: frame.timestamp, visualVerified: false, matchDistanceSeconds: 0, dataUrl: "blob:source-preview" });
+ expect(fetch.mock.calls[1][0]).toBe("/frames/42/thumbnail?width=960&quality=80&fallback=false");
+ const params = new URLSearchParams(String(fetch.mock.calls[0][0]).split("?")[1]);
+ expect(params.get("app_name")).toBe("Obsidian");
+ expect(params.get("content_type")).toBe("ocr");
+ expect(fetch.mock.calls[0][1]?.signal).toBeInstanceOf(AbortSignal);
+ });
+ it("rejects another app, a nearby sub-millisecond frame and invalid frame IDs", async () => {
+ fetch.mockResolvedValueOnce(lookup([{ ...frame, timestamp: "2026-09-24T02:07:42.820688Z" }, { ...frame, app_name: "Mail" }, { ...frame, frame_id: -1 }]));
+ expect(await loadWorkflowScreenshot(timestamp, "Obsidian", new AbortController().signal)).toBeNull();
+ expect(fetch).toHaveBeenCalledTimes(1);
+ expect(create).not.toHaveBeenCalled();
+ });
+ it("distinguishes expired media from an offline recorder and rejects non-image responses", async () => {
+ fetch.mockResolvedValueOnce(lookup()).mockResolvedValueOnce(new Response(null, { status: 404 }));
+ expect(await loadWorkflowScreenshot(timestamp, "Obsidian", new AbortController().signal)).toBeNull();
+ fetch.mockResolvedValueOnce(new Response(null, { status: 503 }));
+ await expect(loadWorkflowScreenshot(timestamp, "Obsidian", new AbortController().signal)).rejects.toThrow("look up");
+ fetch.mockResolvedValueOnce(lookup()).mockResolvedValueOnce(new Response("html", { headers: { "content-type": "text/html" } }));
+ await expect(loadWorkflowScreenshot(timestamp, "Obsidian", new AbortController().signal)).rejects.toThrow("Invalid source");
+ });
+ it("does not create a preview after cancellation", async () => {
+ const controller = new AbortController();
+ fetch.mockResolvedValueOnce(lookup()).mockImplementationOnce(async () => {
+ controller.abort();
+ return new Response("image", { headers: { "content-type": "image/jpeg" } });
+ });
+ await expect(loadWorkflowScreenshot(timestamp, "Obsidian", controller.signal)).rejects.toThrow();
+ expect(create).not.toHaveBeenCalled();
+ });
+});
diff --git a/apps/screenpipe-app-tauri/lib/workflows/source-screenshot.ts b/apps/screenpipe-app-tauri/lib/workflows/source-screenshot.ts
new file mode 100644
index 000000000..74e725051
--- /dev/null
+++ b/apps/screenpipe-app-tauri/lib/workflows/source-screenshot.ts
@@ -0,0 +1,50 @@
+// screenpipe — AI that knows everything you've seen, said, or heard
+// https://screenpipe.com
+import { localFetch } from "@/lib/api";
+import type { WorkflowScreenshot } from "@screenpipe/workflows-ui/model";
+
+// Date.parse alone loses sub-millisecond identity. Recorder timestamps can
+// contain microseconds; tolerate timezone formatting, never a nearby frame.
+function instant(value: string): string | null {
+ const time = Date.parse(value);
+ if (!Number.isFinite(time)) return null;
+ const fraction = value.match(/\.(\d+)(?:Z|[+-]\d\d:\d\d)$/)?.[1] ?? "";
+ return `${Math.floor(time / 1000)}:${fraction.padEnd(9, "0")}`;
+}
+
+export async function loadWorkflowScreenshot(timestamp: string, app: string, signal: AbortSignal): Promise<WorkflowScreenshot | null> {
+ if (!instant(timestamp) || !app.trim()) return null;
+ const controller = new AbortController();
+ const abort = () => controller.abort();
+ signal.addEventListener("abort", abort, { once: true });
+ if (signal.aborted) abort();
+ const timeout = setTimeout(abort, 10_000);
+ try {
+ const time = Date.parse(timestamp);
+ const query = new URLSearchParams({ content_type: "ocr", app_name: app,
+ start_time: new Date(time - 1).toISOString(), end_time: new Date(time + 1).toISOString(),
+ limit: "20", offset: "0" });
+ const response = await localFetch(`/search?${query}`, { signal: controller.signal });
+ if (!response.ok) throw new Error("Could not look up the source screenshot");
+ const result = await response.json();
+ const frame = result.data?.map((row: { content?: Record<string, unknown> }) => row.content)
+ .find((row: Record<string, unknown> | undefined) => row
+ && typeof row.timestamp === "string" && instant(row.timestamp) === instant(timestamp)
+ && typeof row.app_name === "string" && row.app_name.toLowerCase() === app.toLowerCase()
+ && Number.isSafeInteger(row.frame_id) && Number(row.frame_id) > 0);
+ if (!frame) return null;
+ const image = await localFetch(`/frames/${frame.frame_id}/thumbnail?width=960&quality=80&fallback=false`, { signal: controller.signal });
+ if (image.status === 404 || image.status === 410) return null;
+ if (!image.ok) throw new Error("Could not load the source screenshot");
+ const blob = await image.blob();
+ if (!/^image\/(jpeg|png|webp)$/.test(blob.type) || !blob.size || blob.size > 2_000_000) {
+ throw new Error("Invalid source screenshot");
+ }
+ controller.signal.throwIfAborted();
+ return { frameId: frame.frame_id, timestamp: frame.timestamp, app: frame.app_name,
+ matchDistanceSeconds: 0, visualVerified: false, dataUrl: URL.createObjectURL(blob) };
+ } finally {
+ clearTimeout(timeout);
+ signal.removeEventListener("abort", abort);
+ }
+}
diff --git a/packages/workflows-ui/src/platform.ts b/packages/workflows-ui/src/platform.ts
index 3ce65839e..988a6ac82 100644
--- a/packages/workflows-ui/src/platform.ts
+++ b/packages/workflows-ui/src/platform.ts
@@ -56,6 +56,13 @@ export type WorkflowsPlatform = {
app: string,
) => Promise<WorkflowRecording | null>;
releaseWorkflowRecording?: (url: string) => Promise<void>;
+ /** Exact source preview, not verification of the step. Blob URLs are released
+ * by the view; never persist this transient image in the workflow catalog. */
+ loadWorkflowScreenshot?: (
+ timestamp: string,
+ app: string,
+ signal: AbortSignal,
+ ) => Promise<import("./model").WorkflowScreenshot | null>;
openCapturedMoment?: (frameId: number, timestamp: string) => Promise<void>;
assistant?: WorkflowsAssistantPlatform;
/** The host can discover context without uploaded sources. */
diff --git a/packages/workflows-ui/src/use-source-screenshot.ts b/packages/workflows-ui/src/use-source-screenshot.ts
new file mode 100644
index 000000000..a3e88b9a5
--- /dev/null
+++ b/packages/workflows-ui/src/use-source-screenshot.ts
@@ -0,0 +1,53 @@
+// screenpipe — AI that knows everything you've seen, said, or heard
+// https://screenpipe.com
+"use client";
+import { useEffect, useRef, useState } from "react";
+import type { WorkflowStage, WorkflowScreenshot } from "./model";
+import type { WorkflowsPlatform } from "./platform";
+
+export function useSourceScreenshot(stage: WorkflowStage, attached: boolean, load: WorkflowsPlatform["loadWorkflowScreenshot"]) {
+ const ref = useRef<HTMLElement>(null);
+ const [visible, setVisible] = useState(false);
+ const [attempt, setAttempt] = useState(0);
+ const sources = JSON.stringify(stage.evidence.filter(e => !["audio", "meeting"].includes(e.source ?? "")
+ && e.app && Number.isFinite(Date.parse(e.timestamp))).map(e => [e.timestamp, e.app]));
+ const key = `${sources}:${attempt}`;
+ const [state, setState] = useState<{ key: string; image?: WorkflowScreenshot; status: "loading" | "unavailable" | "error" | "ready" }>();
+ useEffect(() => {
+ if (!ref.current || visible) return;
+ if (typeof IntersectionObserver === "undefined") { setVisible(true); return; }
+ const observer = new IntersectionObserver(entries => {
+ if (entries.some(entry => entry.isIntersecting)) { setVisible(true); observer.disconnect(); }
+ }, { rootMargin: "200px" });
+ observer.observe(ref.current);
+ return () => observer.disconnect();
+ }, [visible]);
+ useEffect(() => {
+ if (attached || !load || !visible || sources === "[]") return;
+ const controller = new AbortController();
+ let disposed = false;
+ let image: WorkflowScreenshot | null = null;
+ const timeout = setTimeout(() => controller.abort(), 30_000);
+ setState({ key, status: "loading" });
+ void (async () => {
+ let failed = false;
+ for (const [timestamp, app] of JSON.parse(sources) as [string, string][]) {
+ if (controller.signal.aborted) break;
+ try {
+ image = await load(timestamp, app, controller.signal);
+ if (disposed) { if (image?.dataUrl.startsWith("blob:")) URL.revokeObjectURL(image.dataUrl); return; }
+ if (image) { setState({ key, image, status: "ready" }); return; }
+ } catch { failed = true; }
+ }
+ if (!disposed) setState({ key, status: failed || controller.signal.aborted ? "error" : "unavailable" });
+ })().finally(() => clearTimeout(timeout));
+ return () => {
+ disposed = true; controller.abort(); clearTimeout(timeout);
+ if (image?.dataUrl.startsWith("blob:")) URL.revokeObjectURL(image.dataUrl);
+ };
+ }, [sources, key, attached, load, visible]);
+ return { ref, image: !attached && state?.key === key ? state.image : undefined,
+ status: !load || sources === "[]" ? "unavailable" : state?.key === key ? state.status : "loading",
+ canRetry: !!load && sources !== "[]",
+ retry: () => setAttempt(value => value + 1) };
+}
diff --git a/packages/workflows-ui/src/workflow-step-evidence.module.css b/packages/workflows-ui/src/workflow-step-evidence.module.css
index d113b7aed..a2d37e50b 100644
--- a/packages/workflows-ui/src/workflow-step-evidence.module.css
+++ b/packages/workflows-ui/src/workflow-step-evidence.module.css
@@ -1,6 +1,8 @@
/* screenpipe — AI that knows everything you've seen, said, or heard */
/* https://screenpipe.com */
.evidence { margin: 12px 0 4px; min-width: 0; }
+.previewStatus { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 16px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); font-size: 12px; }
+.previewStatus button { text-decoration: underline; }
.figure { max-width: 360px; margin: 0 0 20px; }
.figure.expanded { max-width: 100%; }
.figure .imageButton { display: block; padding: 0; position: relative; width: 100%; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--soft); cursor: zoom-in; }
diff --git a/packages/workflows-ui/src/workflow-step-evidence.tsx b/packages/workflows-ui/src/workflow-step-evidence.tsx
index 5d0d58152..7f34b484f 100644
--- a/packages/workflows-ui/src/workflow-step-evidence.tsx
+++ b/packages/workflows-ui/src/workflow-step-evidence.tsx
@@ -9,6 +9,7 @@ import type { WorkflowsPlatform } from "./platform";
import { WorkflowQuestion } from "./workflow-question";
import { WorkflowReplay } from "./workflow-replay";
import { verifiedStageScreenshots } from "./screenshots";
+import { useSourceScreenshot } from "./use-source-screenshot";
import styles from "./workflow-step-evidence.module.css";
const when = (value: string) => Number.isFinite(Date.parse(value))
@@ -28,7 +29,9 @@ export function WorkflowStepEvidence({ workflow, stage, platform }: {
...stage, evidence: stage.evidence.filter(e => e.app.toLowerCase() === selected.app.toLowerCase()
&& Date.parse(e.timestamp) === Date.parse(selected.timestamp)),
} : stage] }), [workflow, stage, selected]);
- const screenshots = verifiedStageScreenshots(stage);
+ const attached = verifiedStageScreenshots(stage);
+ const preview = useSourceScreenshot(stage, attached.length > 0, platform.loadWorkflowScreenshot);
+ const screenshots = attached.length ? attached : preview.image ? [preview.image] : [];
const screenshot = screenshots[0];
const canReplay = platform.loadWorkflowRecording && stage.evidence.some(e => !["audio", "meeting"].includes(e.source ?? "") && Number.isFinite(Date.parse(e.timestamp)));
const openRecording = async (capture = screenshot) => {
@@ -51,7 +54,11 @@ export function WorkflowStepEvidence({ workflow, stage, platform }: {
else if (media?.url && platform.releaseWorkflowRecording) void platform.releaseWorkflowRecording(media.url).catch(() => {});
}
};
- return <section className={`${styles.evidence} ph-no-capture ph-mask`} aria-label={`References for ${stage.name}`}>
+ return <section ref={preview.ref} className={`${styles.evidence} ph-no-capture ph-mask`} aria-label={`References for ${stage.name}`}>
+ {!playing && !screenshots.length && <div className={styles.previewStatus} role="status">
+ {preview.status === "loading" ? "Loading source screenshot…" : preview.status === "error" ? "Could not load the source screenshot." : "No screenshot available for this step."}
+ {preview.canRetry && preview.status !== "loading" && <button type="button" onClick={preview.retry}>Retry screenshot</button>}
+ </div>}
{!playing && screenshots.map((capture, index) => {
const expanded = !reduced.has(capture.frameId);
const suffix = screenshots.length > 1 ? ` ${index + 1}` : "";
@@ -62,7 +69,7 @@ export function WorkflowStepEvidence({ workflow, stage, platform }: {
<img src={capture.dataUrl} alt={`Captured reference${suffix} for ${stage.name}`} loading="lazy" draggable={false} data-lm-disable="true" />
<span className={styles.zoom}>{expanded ? <Minimize2 size={15} /> : <Maximize2 size={15} />}</span>
</button>
- <figcaption><span>{capture.app} · {when(capture.timestamp)}</span>
+ <figcaption><span>{!capture.visualVerified ? "Source screenshot · " : ""}{capture.app} · {when(capture.timestamp)}</span>
{screenshots.length > 1 && (canReplay || platform.openCapturedMoment) && <button type="button" disabled={opening} onClick={() => void openRecording(capture)} aria-label={`${platform.openCapturedMoment ? "Open" : "View"} recording${suffix} for ${stage.name}`}><Play size={13} />{platform.openCapturedMoment ? "Open recording" : "View recording"}</button>}
</figcaption>
</figure>;