Skip to content

Improve visual annotation workflows - #4411

Open
shaunandrews wants to merge 7 commits into
trunkfrom
iterate-annotation-workflows
Open

Improve visual annotation workflows#4411
shaunandrews wants to merge 7 commits into
trunkfrom
iterate-annotation-workflows

Conversation

@shaunandrews

@shaunandrews shaunandrews commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Related issues

How AI was used in this PR

Built through an iterative Codex session with continuous human UX feedback. Codex implemented the feature, hardened the data flow, and added tests; the interaction design was manually reviewed in an isolated Electron build.

Proposed Changes

  • Reworks Studio's preview annotation composer to match the main composer, with compact glass styling, clear cancel/save/send actions, keyboard shortcuts, dragging, scroll locking, scrim isolation, persistent selection outlines, and viewport-safe markers.
  • Keeps annotation mode active between notes and supports selecting deeply layered or overlapping elements without moving the composer.
  • Replaces the toolbar icon with clearer Annotate / Cancel / Send to chat controls and improves tooltip, spacing, and states.
  • Sends each annotation to chat as its own user message with an attached element chip containing useful tag, ID/class, and nearby-text context.
  • Persists structured annotation metadata end-to-end across optimistic UI state, desktop IPC, local/hosted connectors, CLI input payloads, and session replay.
  • Hardens Studio and standalone CLI annotation bridges with authenticated commands, payload validation, size/count limits, safer browser lifecycle handling, and bounded stored state.
  • Improves drag and layer-selection performance and adds accessibility semantics for dialogs, markers, and controls.

Screenshots

1. Enter annotation mode — light

The preview toolbar exposes a clear Annotate action before any element is selected.

Studio preview with the Annotate toolbar action in light mode

2. Select an element and compose a note — light and dark

The selected element stays isolated by the scrim while the composer exposes element context, overlapping-layer navigation, cancel, save, and send actions.

Light Dark
Annotation composer and selected headline in light mode Annotation composer and selected headline in dark mode

3. Save several notes and keep annotating — dark

Saved elements retain numbered outlines while annotation mode stays active and Send to chat becomes available.

Two saved annotations with persistent outlines and numbered markers in dark mode

4. Keep edge markers visible — light

When the selected element extends beyond the viewport, its numbered marker clamps into view.

Annotation marker kept visible against the top viewport edge in light mode

5. Send annotations to chat — light

Each submitted note becomes a separate user message with its element context attached underneath.

Two annotation notes rendered as separate chat messages with element attachments

Review guide

Please focus on the injected preview inspector lifecycle, structured annotation persistence, and the security boundary between previewed pages and Studio. The styling and transcript rendering are comparatively self-contained.

⚠️ Visual change: needs human review in light + dark mode.

Testing Instructions

  1. Open a running site in Studio and click Annotate.
  2. Select normal and overlapping elements, cycle layers, drag the composer, and save several notes.
  3. Confirm selected/saved elements remain highlighted and edge markers stay visible.
  4. Use Return to save, Cmd/Ctrl+Return for a newline, then Send to chat.
  5. Confirm each note appears as a separate chat message with its element attachment.
  6. Run:
    • npm run typecheck
    • npm test -- apps/ui/src/components/site-preview/inspector-script.test.ts apps/ui/src/components/site-preview/index.test.tsx apps/ui/src/ui-classic/components/session-view/annotations.test.ts apps/ui/src/ui-classic/components/session-view/conversation/index.test.ts apps/ui/src/data/queries/use-agent-run.test.tsx apps/cli/ai/inspector/annotation-result.test.ts apps/cli/commands/ai/sessions/tests/resume.test.ts packages/common/ai/inspector-annotations.test.ts packages/common/ai/visual-annotations.test.ts
    • npm run build --workspace @studio/ui

Production hardening result: 83 focused tests passed. Full lint, monorepo typecheck, CLI build, Electron build, and the Agentic UI renderer build pass. The full repository suite was also attempted; unrelated environment-bound port, e2e, canvas, and color-output suites do not run cleanly in this local environment.

Pre-merge Checklist

  • Typecheck passes
  • Focused tests pass
  • Production UI build passes
  • Human visual review in light and dark mode
  • Full CI passes

@shaunandrews
shaunandrews marked this pull request as ready for review July 31, 2026 21:32
@wpmobilebot

wpmobilebot commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing 643029b vs trunk

app-size

Metric trunk 643029b Diff Change
App Size (Mac) 1402.84 MB 1402.90 MB +0.06 MB ⚪ 0.0%

site-editor

Metric trunk 643029b Diff Change
load 1061 ms 1052 ms 9 ms ⚪ 0.0%

site-startup

Metric trunk 643029b Diff Change
siteCreation 7537 ms 7544 ms +7 ms ⚪ 0.0%
siteStartup 2878 ms 2874 ms 4 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@shaunandrews
shaunandrews requested review from a team and bcotrim August 5, 2026 02:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants