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): align desktop reading layout with Studio (#7731)

Louis Beaumont4f3d3d39ae89
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 e5f2bbcd9..ded2c8f4d 100644
--- a/apps/screenpipe-app-tauri/components/workflows/step-evidence.test.tsx
+++ b/apps/screenpipe-app-tauri/components/workflows/step-evidence.test.tsx
@@ -59,7 +59,7 @@ describe("missing attached screenshots", () => {
expect(load).not.toHaveBeenCalled();
act(() => observe([{ isIntersecting: true }]));
expect(await screen.findByRole("img")).toBeVisible();
- expect(disconnect).not.toHaveBeenCalled();
+ expect(disconnect).toHaveBeenCalled();
} finally { cleanup(); vi.unstubAllGlobals(); }
});
it("tries another source when the first capture is unavailable", async () => {
@@ -204,7 +204,7 @@ describe("step evidence media", () => {
describe("recorder references", () => {
- it("loads each reference only while visible and releases its image off screen", async () => {
+ it("loads references lazily, retains them off screen, and releases them on unmount", async () => {
const observers = new Map<Element, (entries: { isIntersecting: boolean }[]) => void>();
vi.stubGlobal("IntersectionObserver", class {
callback: (entries: { isIntersecting: boolean }[]) => void;
@@ -218,19 +218,24 @@ describe("recorder references", () => {
const second = { ...first, frameId: 9002, timestamp: "2026-09-22T11:02:00Z" };
const load = vi.fn().mockImplementation(async (_timestamp, _app, _signal, id) => ({ ...(id === first.frameId ? first : second), dataUrl: `blob:${id}` }));
try {
- const { container } = render(<WorkflowStepEvidence workflow={workflow} stage={{ ...stage, screenshot: null, screenshots: [first, second] }} platform={{ loadWorkflowScreenshot: load } as unknown as WorkflowsPlatform} />);
+ const { container, unmount } = render(<WorkflowStepEvidence workflow={workflow} stage={{ ...stage, screenshot: null, screenshots: [first, second] }} platform={{ loadWorkflowScreenshot: load } as unknown as WorkflowsPlatform} />);
const figures = container.querySelectorAll("figure");
expect(load).not.toHaveBeenCalled();
act(() => observers.get(figures[0])!([{ isIntersecting: true }]));
await screen.findByRole("img");
expect(load).toHaveBeenCalledTimes(1);
act(() => observers.get(figures[0])!([{ isIntersecting: false }]));
- await waitFor(() => expect(revoke).toHaveBeenCalledWith(`blob:${first.frameId}`));
- expect(load.mock.calls[0][2].aborted).toBe(true);
- expect(screen.queryByRole("img")).toBeNull();
+ expect(revoke).not.toHaveBeenCalled();
+ expect(load.mock.calls[0][2].aborted).toBe(false);
+ expect(screen.getByRole("img")).toHaveAttribute("src", `blob:${first.frameId}`);
act(() => observers.get(figures[1])!([{ isIntersecting: true }]));
- expect(await screen.findByRole("img")).toHaveAttribute("src", "blob:9002");
+ await waitFor(() => expect(screen.getAllByRole("img")).toHaveLength(2));
+ expect(screen.getAllByRole("img")[1]).toHaveAttribute("src", "blob:9002");
expect(load).toHaveBeenCalledTimes(2);
+ unmount();
+ expect(revoke).toHaveBeenCalledWith(`blob:${first.frameId}`);
+ expect(revoke).toHaveBeenCalledWith("blob:9002");
+ expect(load.mock.calls.every(call => call[2].aborted)).toBe(true);
} finally { cleanup(); vi.unstubAllGlobals(); }
});
diff --git a/apps/screenpipe-app-tauri/lib/workflows/workflow-walkthrough.test.tsx b/apps/screenpipe-app-tauri/lib/workflows/workflow-walkthrough.test.tsx
new file mode 100644
index 000000000..cd37f676e
--- /dev/null
+++ b/apps/screenpipe-app-tauri/lib/workflows/workflow-walkthrough.test.tsx
@@ -0,0 +1,169 @@
+// screenpipe — AI that knows everything you've seen, said, or heard
+// https://screenpipe.com
+import React from "react";
+import { afterEach, expect, it, vi } from "vitest";
+import { cleanup, fireEvent, render, screen, within } from "@testing-library/react";
+import { WorkflowEditor } from "../../../../packages/workflows-ui/src/workflow-editor";
+import { WorkflowStepEvidence } from "../../../../packages/workflows-ui/src/workflow-step-evidence";
+import { createFixtureWorkflowsPlatform, fixtureWorkflowAnalysis } from "../../../../packages/workflows-ui/src/fixture-platform";
+
+afterEach(cleanup);
+const workflow = () => structuredClone(fixtureWorkflowAnalysis.analysis.workflows[0]);
+const button = (name: string) => screen.getByRole("button", { name, exact: true });
+const title = (index: number) => screen.getByRole("textbox", { name: `Step ${index} title`, exact: true });
+function editor(stepsOnly = false) {
+ const change = vi.fn();
+ const save = vi.fn();
+ render(<WorkflowEditor workflow={workflow()} save={save} onDraftChange={change} sessionRecovery={false} saveDisabled stepsOnly={stepsOnly} />);
+ return { change, save };
+}
+
+it("shows one editable step, bounds navigation, and never saves a view change", () => {
+ const { change, save } = editor();
+ expect(screen.queryByRole("textbox", { name: "Step 3 title" })).toBeNull();
+ expect(screen.queryByRole("button", { name: "Add step at start" })).toBeNull();
+ expect(screen.queryByRole("textbox", { name: "Workflow trigger" })).toBeNull();
+ fireEvent.click(button("Walkthrough"));
+ expect(button("Walkthrough")).toHaveAttribute("aria-pressed", "true");
+ expect(title(1)).toBeVisible();
+ expect(screen.queryByRole("textbox", { name: "Step 2 title" })).toBeNull();
+ expect(button("Previous")).toBeDisabled();
+ fireEvent.click(button("Next"));
+ expect(title(2)).toBeVisible();
+ fireEvent.click(button("Next"));
+ expect(title(3)).toBeVisible();
+ expect(button("Next")).toBeDisabled();
+ expect(screen.getByText("Step 3 of 3")).toBeVisible();
+ fireEvent.click(button("Previous"));
+ fireEvent.click(button("Previous"));
+ expect(title(1)).toBeVisible();
+ expect(change).not.toHaveBeenCalled();
+ expect(save).not.toHaveBeenCalled();
+});
+
+it("keeps the same fields and unfinished edits when changing steps and views", () => {
+ const { change } = editor();
+ const first = title(1);
+ fireEvent.change(first, { target: { value: "My unfinished instruction" } });
+ fireEvent.click(button("Walkthrough"));
+ fireEvent.click(button("Next"));
+ fireEvent.click(button("Previous"));
+ expect(title(1)).toBe(first);
+ expect(title(1)).toHaveValue("My unfinished instruction");
+ fireEvent.click(button("Steps"));
+ expect(title(1)).toBe(first);
+ expect(title(3)).toBeVisible();
+ expect(change.mock.lastCall![0].stages).toHaveLength(3);
+ expect(change.mock.lastCall![0].stages[0]).toMatchObject({ name: "My unfinished instruction", sourceIndex: 0 });
+});
+
+it("follows the selected step identity when it moves, retaining its source reference", () => {
+ const { change } = editor();
+ fireEvent.click(button("Walkthrough"));
+ fireEvent.click(button("Step 1 actions"));
+ fireEvent.click(button("Move step 1 down"));
+ expect(title(2)).toHaveValue(workflow().stages[0].name);
+ expect(screen.queryByRole("textbox", { name: "Step 1 title" })).toBeNull();
+ expect(screen.getByText("Step 2 of 3")).toBeVisible();
+ expect(change.mock.lastCall![0].stages[1].sourceIndex).toBe(0);
+});
+
+it("opens inserted steps and keeps navigation valid after deleting them", () => {
+ editor();
+ fireEvent.click(button("Walkthrough"));
+ fireEvent.click(button("Step 1 actions"));
+ fireEvent.click(button("Add step below"));
+ expect(title(2)).toHaveValue("");
+ expect(screen.getByText("Step 2 of 4")).toBeVisible();
+ fireEvent.click(button("Step 2 actions"));
+ fireEvent.click(button("Delete step 2"));
+ expect(title(2)).toHaveValue(workflow().stages[1].name);
+ expect(screen.getByText("Step 2 of 3")).toBeVisible();
+});
+
+it("leaves the cloud steps-only consumer's view controls with its host", () => {
+ editor(true);
+ expect(screen.queryByRole("group", { name: "Workflow view" })).toBeNull();
+ expect(title(3)).toBeVisible();
+});
+
+it("keeps secondary step editing behind the step menu in both views", () => {
+ const { change } = editor();
+ for (const view of ["Walkthrough", "Steps"]) {
+ fireEvent.click(button(view));
+ expect(screen.queryByRole("button", { name: "Add detail to step 1" })).toBeNull();
+ expect(screen.queryByRole("region", { name: "Details for step 1" })).toBeNull();
+ fireEvent.click(button("Step 1 actions"));
+ fireEvent.click(button("Execution details and links"));
+ const details = screen.getByRole("region", { name: "Details for step 1" });
+ expect(within(details).getByRole("textbox", { name: "Required access for step 1" })).toBeVisible();
+ fireEvent.click(button("Close step details"));
+ expect(details).not.toBeVisible();
+ }
+ fireEvent.click(button("Step 1 actions"));
+ fireEvent.click(button("Add block"));
+ expect(change.mock.lastCall![0].stages[0].procedure).toHaveLength((workflow().stages[0].procedure?.length ?? 0) + 1);
+});
+
+it("keeps the same evidence mounted while switching presentation", () => {
+ const source = workflow();
+ render(<WorkflowEditor workflow={source} save={vi.fn()} sessionRecovery={false} saveDisabled renderSource={stage => <img alt={stage.name} src={stage.screenshot!.dataUrl} />} />);
+ const image = screen.getByRole("img", { name: source.stages[0].name });
+ fireEvent.click(button("Steps"));
+ expect(screen.getByRole("img", { name: source.stages[0].name })).toBe(image);
+ fireEvent.click(button("Walkthrough"));
+ fireEvent.click(button("Next"));
+ fireEvent.click(button("Previous"));
+ expect(screen.getByRole("img", { name: source.stages[0].name })).toBe(image);
+});
+
+it("adds an expected result using the existing check-block save contract", () => {
+ const { change } = editor();
+ fireEvent.click(button("Step 1 actions"));
+ fireEvent.click(button("Add expected result"));
+ expect(screen.getByText("Expected result", { exact: true })).toBeVisible();
+ expect(change.mock.lastCall![0].stages[0].procedure.at(-1)).toMatchObject({ kind: "check", text: "" });
+});
+
+it("uses the same selected step in Map and lets screenshots be hidden without editing the draft", () => {
+ const source = workflow(), change = vi.fn();
+ render(<WorkflowEditor workflow={source} save={vi.fn()} onDraftChange={change} sessionRecovery={false} saveDisabled renderSource={stage => <img alt={stage.name} src={stage.screenshot!.dataUrl} />} />);
+ const image = screen.getByRole("img", { name: source.stages[0].name });
+ fireEvent.click(button("Screenshots on"));
+ expect(image).not.toBeVisible();
+ expect(button("Screenshots off")).toHaveAttribute("aria-pressed", "true");
+ fireEvent.click(button("Map"));
+ fireEvent.click(button(`Go to step 3: ${source.stages[2].name}`));
+ expect(title(3)).toBeVisible();
+ fireEvent.click(button("Walkthrough"));
+ expect(title(3)).toBeVisible();
+ expect(button("Next")).toBeDisabled();
+ fireEvent.click(button("Screenshots off"));
+ fireEvent.click(button("Previous"));
+ fireEvent.click(button("Previous"));
+ expect(screen.getByRole("img", { name: source.stages[0].name })).toBe(image);
+ expect(change).not.toHaveBeenCalled();
+});
+
+it("enlarges an existing screenshot without selecting, deleting or reordering it", () => {
+ const prototype = HTMLDialogElement.prototype;
+ const originalShow = Object.getOwnPropertyDescriptor(prototype, "showModal");
+ const originalClose = Object.getOwnPropertyDescriptor(prototype, "close");
+ Object.defineProperty(prototype, "showModal", { configurable: true, value: function (this: HTMLDialogElement) { this.setAttribute("open", ""); } });
+ Object.defineProperty(prototype, "close", { configurable: true, value: function (this: HTMLDialogElement) { this.removeAttribute("open"); } });
+ try {
+ const source = workflow();
+ const change = vi.fn();
+ render(<WorkflowStepEvidence workflow={source} stage={source.stages[0]} platform={createFixtureWorkflowsPlatform()} onImageLayoutChange={change} />);
+ fireEvent.click(button(`Enlarge screenshot for ${source.stages[0].name}`));
+ const dialog = screen.getByRole("dialog", { name: `Enlarged screenshot for ${source.stages[0].name}` });
+ expect(within(dialog).getByRole("img")).toHaveAttribute("src", source.stages[0].screenshot!.dataUrl);
+ expect(button(`Select screenshot for ${source.stages[0].name}`)).toHaveAttribute("aria-pressed", "false");
+ fireEvent.click(within(dialog).getByRole("button", { name: "Close screenshot" }));
+ expect(screen.queryByRole("dialog")).toBeNull();
+ expect(change).not.toHaveBeenCalled();
+ } finally {
+ if (originalShow) Object.defineProperty(prototype, "showModal", originalShow); else Reflect.deleteProperty(prototype, "showModal");
+ if (originalClose) Object.defineProperty(prototype, "close", originalClose); else Reflect.deleteProperty(prototype, "close");
+ }
+});
diff --git a/docs/pr-assets/workflow-walkthrough/after-enlarged.png b/docs/pr-assets/workflow-walkthrough/after-enlarged.png
new file mode 100644
index 000000000..97a395ad5
Binary files /dev/null and b/docs/pr-assets/workflow-walkthrough/after-enlarged.png differ
diff --git a/docs/pr-assets/workflow-walkthrough/after-map.png b/docs/pr-assets/workflow-walkthrough/after-map.png
new file mode 100644
index 000000000..69c3e0f20
Binary files /dev/null and b/docs/pr-assets/workflow-walkthrough/after-map.png differ
diff --git a/docs/pr-assets/workflow-walkthrough/after-narrow-enlarged.png b/docs/pr-assets/workflow-walkthrough/after-narrow-enlarged.png
new file mode 100644
index 000000000..a65afcb37
Binary files /dev/null and b/docs/pr-assets/workflow-walkthrough/after-narrow-enlarged.png differ
diff --git a/docs/pr-assets/workflow-walkthrough/after-narrow.png b/docs/pr-assets/workflow-walkthrough/after-narrow.png
new file mode 100644
index 000000000..0742cbc34
Binary files /dev/null and b/docs/pr-assets/workflow-walkthrough/after-narrow.png differ
diff --git a/docs/pr-assets/workflow-walkthrough/after-questionnaire.png b/docs/pr-assets/workflow-walkthrough/after-questionnaire.png
new file mode 100644
index 000000000..6fd09ec98
Binary files /dev/null and b/docs/pr-assets/workflow-walkthrough/after-questionnaire.png differ
diff --git a/docs/pr-assets/workflow-walkthrough/after-screenshots-off.png b/docs/pr-assets/workflow-walkthrough/after-screenshots-off.png
new file mode 100644
index 000000000..c34d2bba4
Binary files /dev/null and b/docs/pr-assets/workflow-walkthrough/after-screenshots-off.png differ
diff --git a/docs/pr-assets/workflow-walkthrough/after-step-details.png b/docs/pr-assets/workflow-walkthrough/after-step-details.png
new file mode 100644
index 000000000..f196651b2
Binary files /dev/null and b/docs/pr-assets/workflow-walkthrough/after-step-details.png differ
diff --git a/docs/pr-assets/workflow-walkthrough/after-steps.png b/docs/pr-assets/workflow-walkthrough/after-steps.png
new file mode 100644
index 000000000..d8fabd619
Binary files /dev/null and b/docs/pr-assets/workflow-walkthrough/after-steps.png differ
diff --git a/docs/pr-assets/workflow-walkthrough/after-walkthrough.png b/docs/pr-assets/workflow-walkthrough/after-walkthrough.png
new file mode 100644
index 000000000..5d69c947a
Binary files /dev/null and b/docs/pr-assets/workflow-walkthrough/after-walkthrough.png differ
diff --git a/docs/pr-assets/workflow-walkthrough/before-evidence.png b/docs/pr-assets/workflow-walkthrough/before-evidence.png
new file mode 100644
index 000000000..f84f17528
Binary files /dev/null and b/docs/pr-assets/workflow-walkthrough/before-evidence.png differ
diff --git a/docs/pr-assets/workflow-walkthrough/before-steps.png b/docs/pr-assets/workflow-walkthrough/before-steps.png
new file mode 100644
index 000000000..c51b659bf
Binary files /dev/null and b/docs/pr-assets/workflow-walkthrough/before-steps.png differ
diff --git a/docs/pr-assets/workflow-walkthrough/walkthrough-controls-detail.png b/docs/pr-assets/workflow-walkthrough/walkthrough-controls-detail.png
new file mode 100644
index 000000000..40d6f64f4
Binary files /dev/null and b/docs/pr-assets/workflow-walkthrough/walkthrough-controls-detail.png differ
diff --git a/packages/workflows-ui/src/workflow-editor.module.css b/packages/workflows-ui/src/workflow-editor.module.css
index 6dfb5df4f..b27e54d53 100644
--- a/packages/workflows-ui/src/workflow-editor.module.css
+++ b/packages/workflows-ui/src/workflow-editor.module.css
@@ -37,7 +37,17 @@
.intro .title { font-family: var(--heading-font); font-size: 30px; font-weight: 600; line-height: 1.25; letter-spacing: -.03em; margin-bottom: 4px; }
.endpoint { display: block; color: var(--muted); font-size: 11px; padding: 6px 5px; }
.endpoint textarea { margin-left: -5px; }
-.stepsHeading { margin: 18px 0 8px; padding: 0 5px; }
+.stepsHeading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin: 48px 0 16px; padding: 0; min-height: 44px; border-bottom: 1px solid var(--line); }
+.editor:not(.localEditor) .stepsHeading { margin: 18px 0 8px; padding: 0 5px; min-height: 0; border: 0; }
+.workflowTab { align-self: stretch; display: flex; align-items: center; border-bottom: 2px solid var(--ink); color: var(--ink); font-size: 14px; font-weight: 550; }
+.viewTools, .viewSwitch { display: flex; align-items: center; gap: 2px; }
+.editor .viewTools button { min-height: 36px; min-width: 36px; padding: 6px 10px; font-size: 14px; gap: 8px; }
+.viewSwitch button[aria-pressed="true"], .viewTools > button[aria-expanded="true"] { background: var(--soft); color: var(--ink); }
+.walkthroughNavigation { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0; padding: 12px; min-height: 44px; border-top: 1px solid var(--line); }
+.editor .walkthroughNavigation button { min-height: 44px; min-width: 44px; padding: 6px 8px; font-size: 12px; }
+.walkthroughNavigation span { color: var(--muted); font: 12px var(--mono-font, monospace); }
+.step[hidden], .insertion[hidden] { display: none; }
+.step[tabindex="-1"] { scroll-margin-top: 80px; }
.stepsHeading strong { color: var(--muted); font-size: 11px; font-weight: 500; }
.steps { margin: 0 0 4px; padding-left: 26px; }
.step { position: relative; padding: 4px 0; margin: 0 0 24px; border: 0; background: transparent; }
@@ -55,7 +65,7 @@
.stepMenu { display: flex; flex-direction: column; position: absolute; top: 32px; left: 0; z-index: 3; width: 200px; padding: 4px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); box-shadow: 0 4px 12px #0000000d; }
.stepMenu > button { justify-content: flex-start; width: 100%; padding: 7px 6px; gap: 8px; }
.stepControls > .grip, .blockControls > .grip { opacity: 0; pointer-events: none; transition: opacity .12s ease; }
-.step:hover > .stepTop > .stepControls > .grip, .step:focus-within > .stepTop > .stepControls > .grip,
+.step:hover .stepTop > .stepControls > .grip, .step:focus-within .stepTop > .stepControls > .grip,
.stepControls[data-open] > .grip,
.block:hover > .blockControls > .grip, .block:focus-within > .blockControls > .grip,
.blockControls[data-open] > .grip { opacity: 1; pointer-events: auto; }
@@ -145,7 +155,7 @@
.editor .addDetail { margin: 4px 0 4px 25px; font-size: 12px; gap: 5px; }
/* Keep measured timing available without a permanent clock on every row. */
.stepActions > span, .titleRow > span { opacity: 0; pointer-events: none; }
-.step:hover > .stepTop > .stepActions > span, .step:focus-within > .stepTop > .stepActions > span,
+.step:hover .stepTop > .stepActions > span, .step:focus-within .stepTop > .stepActions > span,
.titleRow:hover > span, .titleRow:focus-within > span { opacity: 1; pointer-events: auto; }
@media (hover: none) {
.insertion > button, .stepActions > span, .titleRow > span { opacity: 1; pointer-events: auto; }
@@ -175,3 +185,60 @@
@container workflow-editor (max-width: 850px) { .withPanel .documentLayout { grid-template-columns:minmax(0,1fr); } .panel { position:static;max-height:none;grid-row:1; border-left:0;border-bottom:1px solid var(--line);padding:0 0 20px; } }
.editor a[href^="#workflow-io-"] { color:var(--ink); background:var(--soft); border-bottom:1px dashed var(--muted);border-radius:3px;padding:1px 3px;text-decoration:none; }
+
+/* Use the website's section toolbar, inspector card, and card footer. */
+.localEditor { max-width: 1024px; }
+.localEditor.withPanel { max-width: 1120px; }
+.metadata { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 12px; color: var(--muted); font-size: 12px; }
+.editor .metadata button { padding: 0; font-size: 14px; }
+.stepLayout { min-width: 0; }
+.stepBody { display: flex; flex-direction: column; }
+.instructions { display: contents; }
+.instructions > .stepTop { order: -2; }
+.instructions > [data-variable-field="description"] { margin-left: 24px; }
+.execution[hidden], .editor button[hidden], .endpoint[hidden], .source[hidden] { display: none; }
+.execution { padding: 12px; border: 1px solid var(--line); border-radius: 6px; }
+.execution > header { display: flex; justify-content: space-between; align-items: center; }
+.editor .stepBehavior { margin: 4px 0 0 24px; padding: 4px; gap: 6px; min-height: 36px; }
+.expectedLabel { grid-column: 1; grid-row: 1; color: var(--muted); font-size: 12px; padding: 8px 5px 0; }
+.localEditor .block[data-kind="check"] > [data-testid="procedure-markdown"] { grid-row: 2; }
+.localEditor .block[data-kind="check"] > .kindLabel { grid-row: 2; }
+.walkthrough .steps { padding-left: 0; }
+.walkthrough .insertion { display: none; }
+.walkthrough .step { padding: 0; margin: 0; border: 1px solid var(--line); }
+.walkthrough .stepBody { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
+.walkthrough .instructions { display: block; min-width: 0; grid-column: 2; grid-row: 1; padding: 20px; }
+.walkthrough .instructions:only-child, .noEvidence .instructions { grid-column: 1 / -1; }
+.noEvidence .stepBody { grid-template-columns: minmax(0, 1fr); }
+.walkthrough .source { grid-column: 1; grid-row: 1; margin: 0; padding: 20px; background: var(--soft); border-right: 1px solid var(--line); }
+.walkthrough .step .title { font-size: 18px; line-height: 1.5; font-weight: 600; }
+.walkthrough .stepTop { grid-template-columns: minmax(0, 1fr) auto; margin-bottom: 0; }
+.walkthrough .number { display: none; }
+.stepCounter { color: var(--muted); font: 12px var(--mono-font, monospace); margin: 0 0 12px; }
+.walkthrough .stepApps { margin: 6px 5px 20px; min-height: 24px; font-size: 12px; }
+.walkthrough .blocks, .walkthrough .instructions > [data-variable-field="description"] { margin-left: 0; }
+.walkthrough .block { grid-template-columns: minmax(0, 1fr); margin: 8px 0; }
+.walkthrough .kindLabel { grid-column: 1; grid-row: 3; opacity: 0; height: 0; overflow: hidden; }
+.walkthrough .block[data-kind="check"] > .kindLabel { grid-row: 3; }
+.walkthrough .block:hover .kindLabel, .walkthrough .block:focus-within .kindLabel { opacity: 1; height: auto; overflow: visible; }
+.walkthrough .stepControls { left: -24px; }
+.walkthrough .stepControls > .grip { opacity: 0; pointer-events: none; }
+.walkthrough .step:hover .stepControls > .grip, .walkthrough .step:focus-within .stepControls > .grip { opacity: 1; pointer-events: auto; }
+.walkthrough .stepMenu { left: 24px; }
+.walkthrough .stepBehavior { margin-left: 0; }
+.mapView .stepLayout { display: grid; grid-template-columns: 250px minmax(0, 1fr); align-items: start; gap: 20px; }
+.map { display: flex; flex-direction: column; align-items: center; gap: 12px; min-width: 0; color: var(--muted); }
+.editor .map > button { justify-content: flex-start; text-align: left; width: 100%; min-height: 64px; padding: 12px; border: 1px solid var(--line); background: var(--panel); font-size: 13px; gap: 12px; }
+.editor .map > button[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); }
+.map > button > span { color: var(--muted); font: 11px var(--mono-font, monospace); }
+.mapView .stepBody { grid-template-columns: minmax(0, 1fr); }
+.mapView .instructions { grid-column: 1; grid-row: 1; }
+.mapView .source { grid-column: 1; grid-row: 2; border-right: 0; border-top: 1px solid var(--line); }
+@container workflow-editor (max-width: 760px) {
+ .walkthrough .stepBody { grid-template-columns: minmax(0, 1fr); }
+ .walkthrough .instructions { grid-column: 1; grid-row: 1; padding: 16px; }
+ .walkthrough .source { grid-column: 1; grid-row: 2; border-right: 0; border-top: 1px solid var(--line); padding: 16px; }
+ .mapView .stepLayout { grid-template-columns: minmax(0, 1fr); }
+ .stepsHeading { gap: 8px; }
+ .editor .viewTools button { padding: 6px 8px; font-size: 12px; }
+}
diff --git a/packages/workflows-ui/src/workflow-editor.tsx b/packages/workflows-ui/src/workflow-editor.tsx
index 80bec769a..b7bffca25 100644
--- a/packages/workflows-ui/src/workflow-editor.tsx
+++ b/packages/workflows-ui/src/workflow-editor.tsx
@@ -15,6 +15,14 @@ import {
Braces,
History,
Info,
+ ChevronLeft,
+ ChevronRight,
+ PanelsTopLeft,
+ ListOrdered,
+ X,
+ GitBranch,
+ Image,
+ ImageOff,
} from "lucide-react";
import type { WorkflowMap, WorkflowStage } from "./model";
import {
@@ -89,6 +97,11 @@ export function WorkflowEditor({ workflow, save, actions, secondaryActions = [],
return initial;
});
const exports = useWorkflowDocumentExports(draft, downloadDocument);
+ const [view, setView] = useState<"steps" | "walkthrough" | "map">("walkthrough");
+ const [selectedStep, setSelectedStep] = useState(draft.stages[0]?.key);
+ const stepIndex = Math.max(0, draft.stages.findIndex(stage => stage.key === selectedStep));
+ const walkthrough = !stepsOnly && view !== "steps";
+ const [showEvidence, setShowEvidence] = useState(true);
const unchangedStages = draft.stages.length === workflow.stages.length && draft.stages.every((stage, index) => stage.sourceIndex === index && isUnchangedStage(stage, workflow.stages[index]));
const [panel, setPanel] = useState<"variables" | "history" | "details" | null>(null);
useEffect(()=>{
@@ -201,21 +214,22 @@ export function WorkflowEditor({ workflow, save, actions, secondaryActions = [],
if (draft.stages.length >= 100) return;
const stages = [...draft.stages];
stages.splice(index, 0, { key: crypto.randomUUID(), id: crypto.randomUUID(), sourceIndex: null, name: "", description: "", procedure: [] });
+ setSelectedStep(stages[index].key);
change({ ...draft, stages });
closeStepMenu(false);
focusField(`Step ${index + 1} title`);
}
- function addDetail(index: number) {
+ function addDetail(index: number, kind: StageEdit["procedure"][number]["kind"] = singleCheck ? "check" : "action") {
const stage = draft.stages[index];
if (stage.procedure.length >= 100 || (singleCheck && stage.procedure.length)) return;
stageChange(index, { ...stage, procedure: [...stage.procedure,
- { key: crypto.randomUUID(), id: crypto.randomUUID(), sourceIndex: null, kind: singleCheck ? "check" : "action", text: "" }],
+ { key: crypto.randomUUID(), id: crypto.randomUUID(), sourceIndex: null, kind, text: "" }],
});
closeStepMenu(false);
focusField(`Block ${stage.procedure.length + 1} in step ${index + 1}`);
}
function insertion(index: number) {
- return <div className={styles.insertion}>
+ return <div className={styles.insertion} hidden={walkthrough}>
<button type="button" aria-label={index === 0 ? "Add step at start" : `Add step after ${index}`}
title="Add step" disabled={draft.stages.length >= 100} onClick={() => addStage(index)}>
<Plus size={16} aria-hidden="true" />
@@ -230,6 +244,18 @@ export function WorkflowEditor({ workflow, save, actions, secondaryActions = [],
?.focus(),
);
}
+ function chooseStep(index: number) {
+ const stage = draft.stages[index];
+ if (!stage) return;
+ setSelectedStep(stage.key);
+ setStepMenu(null);
+ setBlockMenu(null);
+ requestAnimationFrame(() => {
+ const element = editorRoot.current?.querySelector<HTMLElement>(`[data-step-key="${stage.key}"]`);
+ element?.focus({ preventScroll: true });
+ element?.scrollIntoView?.({ block: "nearest" });
+ });
+ }
function useLatest() {
const next = keyedDraft(workflowEdit(workflow));
baseline.current = next;
@@ -289,7 +315,7 @@ export function WorkflowEditor({ workflow, save, actions, secondaryActions = [],
return (
<section
ref={editorRoot}
- className={`${styles.editor} ${panel ? styles.withPanel : ""}`}
+ className={`${styles.editor} ${!stepsOnly ? styles.localEditor : ""} ${walkthrough ? styles.walkthrough : ""} ${view === "map" && !stepsOnly ? styles.mapView : ""} ${!showEvidence || !renderSource ? styles.noEvidence : ""} ${panel ? styles.withPanel : ""}`}
onMouseUp={event => {
const selection = window.getSelection(); const value = selection?.toString().trim();
if (!value || value.length > 1000 || !event.currentTarget.contains(selection?.anchorNode ?? null) || !event.currentTarget.contains(selection?.focusNode ?? null)) return;
@@ -359,22 +385,48 @@ export function WorkflowEditor({ workflow, save, actions, secondaryActions = [],
<div className={styles.intro}>
<div className={styles.titleRow}>
{stepsOnly ? <h1 className={styles.title}>{workflow.title}</h1> : <Text title label="Workflow title" value={draft.title} onChange={title => change({ ...draft, title })} />}
- <TimingDisclosure hideWhenUnknown showDuration label="Workflow timing" value={unchangedStages ? workflow.timing : null}
- measured={unchangedStages && workflow.durationSource === "measured-meeting" ? { minutes: workflow.totalMinutes, samples: workflow.durationSampleCount ?? 0 } : undefined} />
+ {stepsOnly && <TimingDisclosure hideWhenUnknown showDuration label="Workflow timing" value={unchangedStages ? workflow.timing : null}
+ measured={unchangedStages && workflow.durationSource === "measured-meeting" ? { minutes: workflow.totalMinutes, samples: workflow.durationSampleCount ?? 0 } : undefined} />}
</div>
- {stepsOnly ? <p className={styles.readOnlyText}>{workflow.description}</p> : <Text label="Workflow description" value={draft.description} onChange={description => change({ ...draft, description })} />}
+ <div hidden={walkthrough}>{stepsOnly ? <p className={styles.readOnlyText}>{workflow.description}</p> : <Text label="Workflow description" value={draft.description} onChange={description => change({ ...draft, description })} />}</div>
+ {!stepsOnly && <div className={styles.metadata}>
+ <span>{draft.stages.length} steps</span>
+ {unchangedStages && (workflow.timing || workflow.durationSource === "measured-meeting") ? <TimingDisclosure showDuration label="Workflow timing" value={workflow.timing} measured={workflow.durationSource === "measured-meeting" ? {minutes: workflow.totalMinutes, samples: workflow.durationSampleCount ?? 0} : undefined} /> : <span>Time not measured</span>}
+ <button type="button" onClick={() => setPanel(panel === "details" ? null : "details")} aria-expanded={panel === "details"}><Info size={16} />Workflow details</button>
+ {renderSource && <button type="button" aria-pressed={!showEvidence} onClick={() => setShowEvidence(value => !value)}>{showEvidence ? <Image size={16} /> : <ImageOff size={16} />}{showEvidence ? "Screenshots on" : "Screenshots off"}</button>}
+ </div>}
</div>
- <label className={styles.endpoint}>
+ <label className={styles.endpoint} hidden={walkthrough}>
Starts when
{stepsOnly ? <span className={styles.readOnlyText}>{workflow.trigger}</span> : <Text label="Workflow trigger" value={draft.trigger} onChange={trigger => change({ ...draft, trigger })} />}
</label>
- <div className={styles.stepsHeading}><strong>Steps</strong></div>
+ <div className={styles.stepsHeading}>
+ {stepsOnly ? <strong>Steps</strong> : <>
+ <span className={styles.workflowTab}>Workflow</span>
+ <div className={styles.viewTools}>
+ <div role="group" aria-label="Workflow view" className={styles.viewSwitch}>
+ {([{ value: "walkthrough", label: "Walkthrough", icon: PanelsTopLeft }, { value: "map", label: "Map", icon: GitBranch }, { value: "steps", label: "Steps", icon: ListOrdered }] as const).map(({value, label, icon: Icon}) => <button key={value} type="button" aria-label={label} title={label} aria-pressed={view === value} onClick={() => setView(value)}><Icon size={16} aria-hidden="true" /><span hidden={view !== value}>{label}</span></button>)}
+ </div>
+ <button type="button" aria-label="Variables" title="Variables" aria-expanded={panel === "variables"} onClick={() => setPanel(panel === "variables" ? null : "variables")}><Braces size={16} /></button>
+ </div>
+ </>}
+ </div>
+ <div className={styles.stepLayout}>
+ {!stepsOnly && view === "map" && <nav className={styles.map} aria-label="Workflow map">
+ {draft.stages.map((stage, index) => <Fragment key={stage.key}>
+ {index > 0 && <ArrowDown size={16} aria-hidden="true" />}
+ <button type="button" aria-label={`Go to step ${index + 1}: ${stage.name || "Untitled step"}`} aria-pressed={index === stepIndex} onClick={() => chooseStep(index)}><span>{String(index + 1).padStart(2,"0")}</span>{stage.name || "Untitled step"}</button>
+ </Fragment>)}
+ </nav>}
<div className={styles.steps}>
{draft.stages.map((stage, index) => (
<Fragment key={stage.key}>
{insertion(index)}
<article
+ hidden={walkthrough && index !== stepIndex}
+ tabIndex={walkthrough ? -1 : undefined}
className={`${styles.step} ${dragOver === index ? styles.drop : ""}`}
+ data-step-key={stage.key}
data-step-id={stage.id ?? `step-${index}`}
aria-label={`Step ${index + 1}`}
onDragOver={(e) => {
@@ -398,6 +450,9 @@ export function WorkflowEditor({ workflow, save, actions, secondaryActions = [],
}
}}
>
+ <div className={styles.stepBody}>
+ <div className={styles.instructions}>
+ {walkthrough && <p className={styles.stepCounter} role="status" aria-live="polite">Step {index + 1} of {draft.stages.length}</p>}
<div className={styles.stepTop}>
<div data-step-actions data-open={stepMenu === stage.key || undefined} className={styles.stepControls}
onBlur={event => { if (!event.currentTarget.contains(event.relatedTarget as Node)) setStepMenu(null); }}
@@ -446,11 +501,13 @@ export function WorkflowEditor({ workflow, save, actions, secondaryActions = [],
{stepMenu === stage.key && <div className={styles.stepMenu} role="dialog" aria-label={`Actions for step ${index + 1}`}>
<button type="button" disabled={draft.stages.length >= 100} onClick={() => addStage(index + 1)}><Plus size={15} />Add step below</button>
{(!singleCheck || !stage.procedure.length) && <button type="button" disabled={stage.procedure.length >= 100} onClick={() => addDetail(index)}><Plus size={15} />{singleCheck ? "Add expected result" : "Add block"}</button>}
- {!stepsOnly && <button type="button" onClick={()=>{setExecutionOpen(stage.key);closeStepMenu(false);}}>Execution details and links</button>}
+ {!stepsOnly && !stage.procedure.some(block => block.kind === "check") && <button type="button" disabled={stage.procedure.length >= 100} onClick={() => addDetail(index, "check")}><Plus size={15} />Add expected result</button>}
+ {!stepsOnly && <button type="button" onClick={()=>{setExecutionOpen(stage.key);closeStepMenu(false);requestAnimationFrame(()=>editorRoot.current?.querySelector<HTMLElement>(`[aria-label="Details for step ${index + 1}"] [contenteditable=true]`)?.focus());}}>Execution details and links</button>}
<button type="button" aria-label={`Move step ${index + 1} up`} disabled={index === 0} onClick={() => { closeStepMenu(); moveStage(index, index - 1); }}><ArrowUp size={15} />Move up</button>
<button type="button" aria-label={`Move step ${index + 1} down`} disabled={index === draft.stages.length - 1} onClick={() => { closeStepMenu(); moveStage(index, index + 1); }}><ArrowDown size={15} />Move down</button>
<button type="button" aria-label={`Delete step ${index + 1}`} disabled={draft.stages.length === 1} onClick={() => {
closeStepMenu(false);
+ setSelectedStep(draft.stages[index + 1]?.key ?? draft.stages[index - 1]?.key);
change({ ...draft, stages: draft.stages.filter((_, i) => i !== index) });
focusField(`Step ${Math.min(index + 1, draft.stages.length - 1)} title`);
}}><Trash2 size={15} />Delete step</button>
@@ -471,7 +528,8 @@ export function WorkflowEditor({ workflow, save, actions, secondaryActions = [],
? workflow.stages[stage.sourceIndex]?.timing : null} />
</div>
</div>
- <div style={{ display: "flex", flexDirection: "column" }}>
+
+ {!stepsOnly && <p className={styles.stepApps}>{(stage.sourceIndex !== null ? workflow.stages[stage.sourceIndex]?.apps : [])?.join(" · ")}</p>}
<div data-variable-field="description"><Text
rich
label={`Step ${index + 1} description`}
@@ -484,6 +542,7 @@ export function WorkflowEditor({ workflow, save, actions, secondaryActions = [],
<div className={styles.blocks}>
{stage.procedure.map((detail, detailIndex) => (
<div
+ data-kind={detail.kind}
className={`${styles.block} ${blockDragOver === `${index}:${detailIndex}` ? styles.blockDrop : ""}`}
data-variable-field={`block/${detail.id ?? `block-${detailIndex}`}`}
key={detail.key}
@@ -590,6 +649,7 @@ export function WorkflowEditor({ workflow, save, actions, secondaryActions = [],
</select>
<ChevronDown size={12} aria-hidden="true" />
</div>
+ {!stepsOnly && detail.kind === "check" && <span className={styles.expectedLabel}>Expected result</span>}
<Text
rich
label={`Block ${detailIndex + 1} in step ${index + 1}`}
@@ -608,38 +668,47 @@ export function WorkflowEditor({ workflow, save, actions, secondaryActions = [],
</div>
))}
</div>
- {(!singleCheck || !stage.procedure.length) && <button type="button" className={styles.addDetail}
+ {(stepsOnly ? !singleCheck || !stage.procedure.length : singleCheck && !stage.procedure.length) && <button type="button" className={styles.addDetail}
aria-label={singleCheck ? `Add expected result to step ${index + 1}` : `Add detail to step ${index + 1}`}
disabled={stage.procedure.length >= 100} onClick={() => addDetail(index)}>
<Plus size={14} aria-hidden="true" />{singleCheck ? "Add expected result" : "Add detail"}
</button>}
- {!stepsOnly && <details className={styles.execution} open={executionOpen === stage.key || undefined} onToggle={event=>{if (event.currentTarget.open) setExecutionOpen(stage.key); else if (executionOpen===stage.key) setExecutionOpen(null);}}>
- <summary>Execution details{stage.linkedWorkflowId ? " · Linked workflow" : ""}</summary>
+ {!stepsOnly && <button type="button" className={styles.stepBehavior} aria-expanded={executionOpen === stage.key} onClick={event => {stepMenuTrigger.current = event.currentTarget;setExecutionOpen(executionOpen === stage.key ? null : stage.key);}}><Plus size={14} />Step behavior</button>}
+ {!stepsOnly && <section className={styles.execution} hidden={executionOpen !== stage.key} aria-label={`Details for step ${index + 1}`} onKeyDown={event => { if (event.key === "Escape") { setExecutionOpen(null); stepMenuTrigger.current?.focus(); } }}>
+ <header><strong>Step details</strong><button type="button" aria-label="Close step details" onClick={() => {setExecutionOpen(null);stepMenuTrigger.current?.focus();}}><X size={16} /></button></header>
{Object.entries(executionFields).map(([field,label])=><div key={field} data-variable-field={field}><label>{label}</label><WorkflowRichText label={`${label} for step ${index+1}`} value={stage[field as keyof typeof executionFields] ?? ""} onChange={value=>stageChange(index,{...stage,[field]:value})}/></div>)}
<label>Linked workflow<select value={stage.linkedWorkflowId ?? ""} onChange={e=>stageChange(index,{...stage,linkedWorkflowId:e.target.value})}><option value="">None</option>{relatedWorkflows.filter(w=>w.id && w.id!==workflow.id).map(w=><option key={w.id} value={w.id}>{w.title}{w.archived ? " (archived)" : ""}</option>)}</select></label>
- </details>}
+ </section>}
{stage.linkedWorkflowId && <button type="button" disabled={dirty || saving || !relatedWorkflows.some(w=>w.id===stage.linkedWorkflowId)} onClick={()=>openRelated?.(stage.linkedWorkflowId!)}>Open linked workflow: {relatedWorkflows.find(w=>w.id===stage.linkedWorkflowId)?.title ?? "Unavailable"}</button>}
- {stage.sourceIndex !== null && workflow.stages[stage.sourceIndex] && <div className={styles.source} style={stage.imageLayout?.beforeText ? { order: -1 } : undefined}>{renderSource?.({ ...workflow.stages[stage.sourceIndex], imageLayout: stage.imageLayout }, layout => stageChange(index, { ...stage, imageLayout: layout }))}</div>}
</div>
+ {stage.sourceIndex !== null && workflow.stages[stage.sourceIndex] && renderSource && <div className={styles.source} hidden={!stepsOnly && !showEvidence} style={stage.imageLayout?.beforeText ? { order: -1 } : undefined}>{renderSource?.({ ...workflow.stages[stage.sourceIndex], imageLayout: stage.imageLayout }, layout => stageChange(index, { ...stage, imageLayout: layout }))}</div>}
+ </div>
+ {walkthrough && <nav aria-label="Walkthrough navigation" className={styles.walkthroughNavigation}>
+ <button type="button" disabled={index === 0} onClick={() => chooseStep(index - 1)}><ChevronLeft size={16} />Previous</button>
+ <span>{index + 1} / {draft.stages.length}</span>
+ <button type="button" disabled={index === draft.stages.length - 1} onClick={() => chooseStep(index + 1)}>Next<ChevronRight size={16} /></button>
+ </nav>}
</article>
</Fragment>
))}
</div>
+ </div>
<button
type="button"
className={styles.addStep}
+ hidden={walkthrough}
disabled={draft.stages.length >= 100}
onClick={() => addStage(draft.stages.length)}
>
<Plus size={16} />
Add step
</button>
- <label className={styles.endpoint}>
+ <label className={styles.endpoint} hidden={walkthrough}>
Ends with
{stepsOnly ? <span className={styles.readOnlyText}>{workflow.outcome}</span> : <Text label="Workflow outcome" value={draft.outcome} onChange={outcome => change({ ...draft, outcome })} />}
</label>
</fieldset>
- {panel === "variables" && <WorkflowVariablePanel document={draft} change={change} selected={selectedVariable} select={setSelectedVariable} quote={quote} clearQuote={()=>setQuote(undefined)} source={id=>{const element = editorRoot.current?.querySelector<HTMLElement>(`[data-step-id="${id}"]`);element?.scrollIntoView({block:"center"}); element?.querySelector<HTMLElement>("textarea,[contenteditable=true]")?.focus();}} />}
+ {panel === "variables" && <WorkflowVariablePanel document={draft} change={change} selected={selectedVariable} select={setSelectedVariable} quote={quote} clearQuote={()=>setQuote(undefined)} source={id=>{setView("steps");setExecutionOpen(draft.stages.find(stage => stage.id === id)?.key ?? null);requestAnimationFrame(()=>{const element = editorRoot.current?.querySelector<HTMLElement>(`[data-step-id="${id}"]`);element?.scrollIntoView?.({block:"center"}); element?.querySelector<HTMLElement>("textarea,[contenteditable=true]")?.focus();});}} />}
{panel === "history" && <WorkflowVersionPanel workflow={workflow} disabled={dirty || saving || saveDisabled} restore={async revision=>{
if (busy.current) return;
busy.current = true; setSaving(true); setError("");
@@ -660,7 +729,7 @@ export function WorkflowEditor({ workflow, save, actions, secondaryActions = [],
<p>{draft.archived ? "Archived. Still available in the Archived filter." : "Archiving keeps this workflow and its sources."}</p>
</aside>}
</div>
- {renderSource && <p className={styles.note}>
+ {renderSource && !walkthrough && <p className={styles.note}>
Captured sources are preserved as references. Edited instructions are
not verified observations.
</p>}
diff --git a/packages/workflows-ui/src/workflow-step-evidence.module.css b/packages/workflows-ui/src/workflow-step-evidence.module.css
index 472eedfa2..43ae5bdc3 100644
--- a/packages/workflows-ui/src/workflow-step-evidence.module.css
+++ b/packages/workflows-ui/src/workflow-step-evidence.module.css
@@ -6,6 +6,16 @@
.figure { position: relative; max-width: 100%; margin: 0 0 20px; }
.figure .imageButton { display: block; padding: 0; position: relative; width: 100%; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--soft); cursor: pointer; }
.imageButton img { display: block; width: 100%; height: auto; object-fit: contain; }
+.imageSurface { position: relative; }
+.evidence .enlarge { position: absolute; right: 8px; bottom: 8px; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); color: var(--ink); cursor: pointer; }
+.evidence .enlarge:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
+.viewer { box-sizing: border-box; width: min(1280px, calc(100vw - 32px)); max-width: calc(100vw - 32px); max-height: calc(100vh - 32px); margin: auto; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); }
+.viewer::backdrop { background: #0009; }
+.viewerToolbar { display: flex; justify-content: flex-end; margin-bottom: 8px; }
+.viewerToolbar button { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); color: var(--ink); cursor: pointer; }
+.viewerToolbar button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
+.viewer > img { display: block; max-width: 100%; max-height: calc(100vh - 108px); width: auto; height: auto; object-fit: contain; margin: 0 auto; }
+@media (pointer: coarse) { .evidence .enlarge, .viewerToolbar button { width: 44px; height: 44px; } }
.figure figcaption { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 11px; line-height: 1.5; color: var(--muted); }
.figure figcaption > span { min-width: 0; overflow-wrap: anywhere; }
.links { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 4px 12px; font-size: 11px; color: var(--muted); }
diff --git a/packages/workflows-ui/src/workflow-step-evidence.tsx b/packages/workflows-ui/src/workflow-step-evidence.tsx
index f4a0a19e4..f084163d7 100644
--- a/packages/workflows-ui/src/workflow-step-evidence.tsx
+++ b/packages/workflows-ui/src/workflow-step-evidence.tsx
@@ -3,7 +3,7 @@
"use client";
import { useEffect, useMemo, useRef, useState } from "react";
-import { Loader2, ArrowUp, ArrowDown, Trash2, Play, X } from "lucide-react";
+import { Loader2, ArrowUp, ArrowDown, Trash2, Play, X, Maximize2 } from "lucide-react";
import type { WorkflowMap, WorkflowStage, WorkflowScreenshot } from "./model";
import type { WorkflowsPlatform } from "./platform";
import { WorkflowReplay } from "./workflow-replay";
@@ -114,12 +114,21 @@ function EvidenceFigure({ capture, stage, platform, suffix, selected, opening, s
const url = load ? preview.image?.dataUrl : capture.dataUrl;
const [failed, setFailed] = useState(false);
const [ratio, setRatio] = useState("16 / 10");
+ const viewer = useRef<HTMLDialogElement>(null);
useEffect(() => setFailed(false), [url]);
return <figure ref={preview.ref} className={`${styles.figure} ${selected ? styles.selected : ""}`}>
- {url && !failed ? <button className={styles.imageButton} type="button" aria-label={`Select screenshot${suffix} for ${stage.name}`} aria-pressed={selected} onClick={select}
+ {url && !failed ? <div className={styles.imageSurface}><button className={styles.imageButton} type="button" aria-label={`Select screenshot${suffix} for ${stage.name}`} aria-pressed={selected} onClick={select}
onKeyDown={event => { if (selected && actions && ["Delete", "Backspace"].includes(event.key)) { event.preventDefault(); event.stopPropagation(); actions.remove(); } }}>
<img src={url} alt={`Captured reference${suffix} for ${stage.name}`} loading="lazy" decoding="async" draggable={false} data-lm-disable="true" onLoad={event => { const image = event.currentTarget; if (image.naturalWidth && image.naturalHeight) setRatio(`${image.naturalWidth} / ${image.naturalHeight}`); }} onError={() => setFailed(true)} />
- </button> : <div className={styles.previewStatus} role="status" style={preview.status === "loading" && !failed ? { aspectRatio: ratio } : undefined}>
+ </button>
+ <button type="button" className={styles.enlarge} aria-label={`Enlarge screenshot${suffix} for ${stage.name}`} title="Enlarge screenshot" onClick={() => viewer.current?.showModal()}><Maximize2 size={16} /></button>
+ <dialog ref={viewer} className={styles.viewer} aria-label={`Enlarged screenshot${suffix} for ${stage.name}`}
+ onKeyDown={event => event.stopPropagation()}
+ onClick={event => { if (event.target === event.currentTarget) event.currentTarget.close(); }}>
+ <div className={styles.viewerToolbar}><button type="button" autoFocus aria-label="Close screenshot" onClick={() => viewer.current?.close()}><X size={18} /></button></div>
+ <img src={url} alt={`Captured reference${suffix} for ${stage.name}`} draggable={false} />
+ </dialog>
+ </div> : <div className={styles.previewStatus} role="status" style={preview.status === "loading" && !failed ? { aspectRatio: ratio } : undefined}>
{failed || preview.status === "error" ? "Could not load the source screenshot." : preview.status === "loading" ? "Loading source screenshot…" : "This screenshot is no longer available."}
{(failed || preview.status === "error") && load && <button onClick={() => { setFailed(false); preview.retry(); }}>Retry screenshot</button>}
</div>}
diff --git a/packages/workflows-ui/src/workflows-app.module.css b/packages/workflows-ui/src/workflows-app.module.css
index 4493e2e24..05b4fbbae 100644
--- a/packages/workflows-ui/src/workflows-app.module.css
+++ b/packages/workflows-ui/src/workflows-app.module.css
@@ -823,3 +823,7 @@
.catalogFilters { display:flex;flex-wrap:wrap;gap:16px;margin:0 0 20px;color:var(--muted);font-size:12px; }
.catalogFilters select { background:var(--panel);color:var(--ink);border:1px solid var(--line);padding:6px;font:inherit; }
+
+.workflowContext { max-width: 1180px; margin: 20px auto 0; }
+.workflowContext > summary { width: fit-content; cursor: pointer; font-size: 12px; color: var(--muted); padding: 8px 0; }
+.workflowContext > summary:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
diff --git a/packages/workflows-ui/src/workflows-app.tsx b/packages/workflows-ui/src/workflows-app.tsx
index 316b1d62a..bec1e780c 100644
--- a/packages/workflows-ui/src/workflows-app.tsx
+++ b/packages/workflows-ui/src/workflows-app.tsx
@@ -748,7 +748,6 @@ export function WorkflowDetail({ breadcrumb, relatedWorkflows, openRelated, edit
{saveEdits ? <WorkflowEditor {...editorOptions} relatedWorkflows={relatedWorkflows} openRelated={openRelated} key={workflow.id || workflow.title} workflow={workflow} save={saveEdits} actions={workflowActions} secondaryActions={secondaryActions} downloadDocument={platform.library?.downloadDocument} renderSource={observationsAvailable ? (stage, onImageLayoutChange) => <WorkflowStepEvidence workflow={workflow} stage={stage} platform={platform} onImageLayoutChange={onImageLayoutChange} /> : undefined} /> : <WorkflowDocument workflow={workflow} actions={workflowActions} secondaryActions={secondaryActions} downloadDocument={platform.library?.downloadDocument} sourceLabel={sourceLabel}
renderSource={observationsAvailable ? stage => <WorkflowStepEvidence workflow={workflow} stage={stage} platform={platform} /> : undefined} />}
<div className={styles.workflowNotes}>
- <p className={styles.workflowReviewState}>{workflow.userEditedAt ? ui("Edited by you · sources kept as references") : workflow.evidenceStatus === "supported-steps" ? ui("Source-backed steps · not execution-tested") : ui("Needs review")}</p>
{saveCorrection && !platform.assistant?.saveFeedback && <WorkflowCorrection key={`correction:${workflow.title}`} workflow={workflow} save={saveCorrection} />}
{observationsAvailable && <WorkflowQuestions workflow={workflow} active={active} voice={platform.questionnaireVoice} save={canSaveAnswers && platform.saveWorkflowAnswers ? async correction => {
try {
@@ -764,11 +763,15 @@ export function WorkflowDetail({ breadcrumb, relatedWorkflows, openRelated, edit
throw error;
}
} : undefined} />}
+ <details className={styles.workflowContext}>
+ <summary>Workflow context</summary>
+ <p className={styles.workflowReviewState}>{workflow.userEditedAt ? ui("Edited by you · sources kept as references") : workflow.evidenceStatus === "supported-steps" ? ui("Source-backed steps · not execution-tested") : ui("Needs review")}</p>
{!!workflow.variations.length && <section className={styles.panel}><h2>Variations</h2><ul className={styles.plainList}>{workflow.variations.map(item => <li key={item}>{item}</li>)}</ul></section>}
{!!actionableFriction.length && <section><div className={styles.sectionHeading}><div><h2>Friction you can affect</h2></div></div><BottleneckList items={actionableFriction.map((item) => ({ ...item, workflowTitle: workflow.title, repetitions: workflow.repetitions }))} /></section>}
{!!constraints.length && <section><div className={styles.sectionHeading}><div><h2>External and required constraints</h2></div></div><BottleneckList items={constraints.map((item) => ({ ...item, workflowTitle: workflow.title, repetitions: workflow.repetitions }))} numbered={false} /></section>}
+ </details>
</div>
{skillOpen && <WorkflowSkillDialog workflow={workflow} draft={skillDraft} generating={skillGenerating} saving={skillSaving} saved={skillSaved} preview={platform.skillInstallMode === "preview"} progress={skillProgress} error={skillError} update={draft => {
setSkillDraft(draft);