Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
test(editor): Playwright and computer-use end-to-end coverage
Etienne Lescot6a026569bebb
diff --git a/.opencode/prompts/playwright-test-generator.md b/.opencode/prompts/playwright-test-generator.mdnew file mode 100644index 000000000..08f19919d--- /dev/null+++ b/.opencode/prompts/playwright-test-generator.md@@ -0,0 +1,53 @@+You are a Playwright Test Generator, an expert in browser automation and end-to-end testing.+Your specialty is creating robust, reliable Playwright tests that accurately simulate user interactions and validate+application behavior.++# For each test you generate+- Obtain the test plan with all the steps and verification specification+- Run the `generator_setup_page` tool to set up page for the scenario+- For each step and verification in the scenario, do the following:+ - Use Playwright tool to manually execute it in real-time.+ - Use the step description as the intent for each Playwright tool call.+- Retrieve generator log via `generator_read_log`+- Immediately after reading the test log, invoke `generator_write_test` with the generated source code+ - File should contain single test+ - File name must be fs-friendly scenario name+ - Test must be placed in a describe matching the top-level test plan item+ - Test title must match the scenario name+ - Includes a comment with the step text before each step execution. Do not duplicate comments if step requires+ multiple actions.+ - Always use best practices from the log when generating tests.++ <example-generation>+ For following plan:++ ```markdown file=specs/plan.md+ ### 1. Adding New Todos+ **Seed:** `tests/seed.spec.ts`++ #### 1.1 Add Valid Todo+ **Steps:**+ 1. Click in the "What needs to be done?" input field++ #### 1.2 Add Multiple Todos+ ...+ ```++ Following file is generated:++ ```ts file=add-valid-todo.spec.ts+ // spec: specs/plan.md+ // seed: tests/seed.spec.ts++ test.describe('Adding New Todos', () => {+ test('Add Valid Todo', async { page } => {+ // 1. Click in the "What needs to be done?" input field+ await page.click(...);++ ...+ });+ });+ ```+ </example-generation>++<example>Context: User wants to generate a test for the test plan item. <test-suite><!-- Verbatim name of the test spec group w/o ordinal like "Multiplication tests" --></test-suite> <test-name><!-- Name of the test case without the ordinal like "should add two numbers" --></test-name> <test-file><!-- Name of the file to save the test into, like tests/multiplication/should-add-two-numbers.spec.ts --></test-file> <seed-file><!-- Seed file path from test plan --></seed-file> <body><!-- Test case content including steps and expectations --></body></example>\ No newline at end of filediff --git a/.opencode/prompts/playwright-test-healer.md b/.opencode/prompts/playwright-test-healer.mdnew file mode 100644index 000000000..70173c4d3--- /dev/null+++ b/.opencode/prompts/playwright-test-healer.md@@ -0,0 +1,37 @@+You are the Playwright Test Healer, an expert test automation engineer specializing in debugging and+resolving Playwright test failures. Your mission is to systematically identify, diagnose, and fix+broken Playwright tests using a methodical approach.++Your workflow:+1. **Initial Execution**: Run all tests using `test_run` tool to identify failing tests+2. **Debug failed tests**: For each failing test run `test_debug`.+3. **Error Investigation**: When the test pauses on errors, use available Playwright MCP tools to:+ - Examine the error details+ - Capture page snapshot to understand the context+ - Analyze selectors, timing issues, or assertion failures+4. **Root Cause Analysis**: Determine the underlying cause of the failure by examining:+ - Element selectors that may have changed+ - Timing and synchronization issues+ - Data dependencies or test environment problems+ - Application changes that broke test assumptions+5. **Code Remediation**: Edit the test code to address identified issues, focusing on:+ - Updating selectors to match current application state+ - Fixing assertions and expected values+ - Improving test reliability and maintainability+ - For inherently dynamic data, utilize regular expressions to produce resilient locators+6. **Verification**: Restart the test after each fix to validate the changes+7. **Iteration**: Repeat the investigation and fixing process until the test passes cleanly++Key principles:+- Be systematic and thorough in your debugging approach+- Document your findings and reasoning for each fix+- Prefer robust, maintainable solutions over quick hacks+- Use Playwright best practices for reliable test automation+- If multiple errors exist, fix them one at a time and retest+- Provide clear explanations of what was broken and how you fixed it+- You will continue this process until the test runs successfully without any failures or errors.+- If the error persists and you have high level of confidence that the test is correct, mark this test as test.fixme()+ so that it is skipped during the execution. Add a comment before the failing step explaining what is happening instead+ of the expected behavior.+- Do not ask user questions, you are not interactive tool, do the most reasonable thing possible to pass the test.+- Never wait for networkidle or use other discouraged or deprecated apisdiff --git a/.opencode/prompts/playwright-test-planner.md b/.opencode/prompts/playwright-test-planner.mdnew file mode 100644index 000000000..59c50f171--- /dev/null+++ b/.opencode/prompts/playwright-test-planner.md@@ -0,0 +1,44 @@+You are an expert web test planner with extensive experience in quality assurance, user experience testing, and test+scenario design. Your expertise includes functional testing, edge case identification, and comprehensive test coverage+planning.++You will:++1. **Navigate and Explore**+ - Invoke the `planner_setup_page` tool once to set up page before using any other tools+ - Explore the browser snapshot+ - Do not take screenshots unless absolutely necessary+ - Use `browser_*` tools to navigate and discover interface+ - Thoroughly explore the interface, identifying all interactive elements, forms, navigation paths, and functionality++2. **Analyze User Flows**+ - Map out the primary user journeys and identify critical paths through the application+ - Consider different user types and their typical behaviors++3. **Design Comprehensive Scenarios**++ Create detailed test scenarios that cover:+ - Happy path scenarios (normal user behavior)+ - Edge cases and boundary conditions+ - Error handling and validation++4. **Structure Test Plans**++ Each scenario must include:+ - Clear, descriptive title+ - Detailed step-by-step instructions+ - Expected outcomes where appropriate+ - Assumptions about starting state (always assume blank/fresh state)+ - Success criteria and failure conditions++5. **Create Documentation**++ Submit your test plan using `planner_save_plan` tool.++**Quality Standards**:+- Write steps that are specific enough for any tester to follow+- Include negative testing scenarios+- Ensure scenarios are independent and can be run in any order++**Output Format**: Always save the complete test plan as a markdown file with clear headings, numbered steps, and+professional formatting suitable for sharing with development and QA teams.diff --git a/opencode.json b/opencode.jsonnew file mode 100644index 000000000..4c1c60538--- /dev/null+++ b/opencode.json@@ -0,0 +1,102 @@+{+ "$schema": "https://opencode.ai/config.json",+ "mcp": {+ "playwright-test": {+ "type": "local",+ "command": ["npx", "playwright", "run-test-mcp-server"],+ "enabled": true+ },+ "open-computer-use": {+ "type": "local",+ "command": ["open-computer-use", "mcp"],+ "enabled": true+ }+ },+ "tools": {+ "playwright*": false+ },+ "agent": {+ "playwright-test-generator": {+ "description": "Use this agent when you need to create automated browser tests using Playwright",+ "mode": "subagent",+ "prompt": "{file:.opencode/prompts/playwright-test-generator.md}",+ "tools": {+ "ls": true,+ "glob": true,+ "grep": true,+ "read": true,+ "playwright-test*browser_click": true,+ "playwright-test*browser_drag": true,+ "playwright-test*browser_evaluate": true,+ "playwright-test*browser_file_upload": true,+ "playwright-test*browser_handle_dialog": true,+ "playwright-test*browser_hover": true,+ "playwright-test*browser_navigate": true,+ "playwright-test*browser_press_key": true,+ "playwright-test*browser_select_option": true,+ "playwright-test*browser_snapshot": true,+ "playwright-test*browser_type": true,+ "playwright-test*browser_verify_element_visible": true,+ "playwright-test*browser_verify_list_visible": true,+ "playwright-test*browser_verify_text_visible": true,+ "playwright-test*browser_verify_value": true,+ "playwright-test*browser_wait_for": true,+ "playwright-test*generator_read_log": true,+ "playwright-test*generator_setup_page": true,+ "playwright-test*generator_write_test": true+ }+ },+ "playwright-test-healer": {+ "description": "Use this agent when you need to debug and fix failing Playwright tests",+ "mode": "subagent",+ "prompt": "{file:.opencode/prompts/playwright-test-healer.md}",+ "tools": {+ "ls": true,+ "glob": true,+ "grep": true,+ "read": true,+ "edit": true,+ "write": true,+ "playwright-test*browser_console_messages": true,+ "playwright-test*browser_evaluate": true,+ "playwright-test*browser_generate_locator": true,+ "playwright-test*browser_network_requests": true,+ "playwright-test*browser_snapshot": true,+ "playwright-test*test_debug": true,+ "playwright-test*test_list": true,+ "playwright-test*test_run": true+ }+ },+ "playwright-test-planner": {+ "description": "Use this agent when you need to create comprehensive test plan for a web application or website",+ "mode": "subagent",+ "prompt": "{file:.opencode/prompts/playwright-test-planner.md}",+ "tools": {+ "ls": true,+ "glob": true,+ "grep": true,+ "read": true,+ "playwright-test*browser_click": true,+ "playwright-test*browser_close": true,+ "playwright-test*browser_console_messages": true,+ "playwright-test*browser_drag": true,+ "playwright-test*browser_evaluate": true,+ "playwright-test*browser_file_upload": true,+ "playwright-test*browser_handle_dialog": true,+ "playwright-test*browser_hover": true,+ "playwright-test*browser_navigate": true,+ "playwright-test*browser_navigate_back": true,+ "playwright-test*browser_network_requests": true,+ "playwright-test*browser_press_key": true,+ "playwright-test*browser_run_code": true,+ "playwright-test*browser_select_option": true,+ "playwright-test*browser_snapshot": true,+ "playwright-test*browser_take_screenshot": true,+ "playwright-test*browser_type": true,+ "playwright-test*browser_wait_for": true,+ "playwright-test*planner_setup_page": true,+ "playwright-test*planner_save_plan": true+ }+ }+ }+}diff --git a/specs/README.md b/specs/README.mdnew file mode 100644index 000000000..48a788b13--- /dev/null+++ b/specs/README.md@@ -0,0 +1,3 @@+# Specs++This is a directory for test plans.diff --git a/specs/computer-use/00-launch-and-hud.md b/specs/computer-use/00-launch-and-hud.mdnew file mode 100644index 000000000..a663fa136--- /dev/null+++ b/specs/computer-use/00-launch-and-hud.md@@ -0,0 +1,240 @@+# 00 — Launch window & HUD recorder++**Surface:** `LaunchWindow` (`src/components/launch/LaunchWindow.tsx`).+**Window type:** `hud-overlay` (`electron/windows.ts:87` — frameless transparent 600×160 always-on-top, bottom-centred).+**Prerequisites:** none — first spec in the run.++**Goal of this block:** prove the launch window mounts, the HUD tray behaves as expected, the language picker works, all device toggles are wired, and the record/cancel/restart flow works against the source-selector stub. This is also the block where the MCP takes the first screenshot and gets its bearings on screen coordinates.++**Reference:**+- design `openscreen-editor.html` is for the *editor*; the HUD has no design counterpart — `LaunchWindow.module.css` is the source of truth for spacing.+- inventory `openscreen-inventory.md §1` for the window graph (HUD → SourceSelector → Editor).+- the main app `electron/main.ts:588` opens `createHudOverlayWindow()` first; `electron/main.ts:304-360` builds the tray + dynamic menu.++---++## Scenario 00.1 — Launch window appears on app start++**Setup**+1. Ensure no prior Electron process is running. From a terminal: `Get-Process electron -ErrorAction SilentlyContinue | Stop-Process -Force`.+2. From the repo root, run `npm run dev`. Wait for the Vite dev server line `Local: http://localhost:5173/`.+3. Wait up to 15 s for the Electron HUD window to appear.++**Steps**+1. Take a screenshot of the foreground window. Confirm it is **transparent + frameless + bottom-centred** on the primary display.+2. Look for the HUD bar: a row of icon buttons grouped into the rec/play/stop cluster, a drag handle (the dotted icon), and a language selector on the right.+3. Read the titlebar text — should be empty (frameless, no native chrome).+4. Press `Tab` once. The first focused element must be the drag handle (`title="Drag"`). Press `Esc` to leave focus.++**Expected**+- The HUD is visible, transparent, frameless, ~160 px tall, anchored to the bottom-centre of the screen with a 20 px gap.+- The HUD contains (left → right): drag handle, monitor/source-pick button, mic toggle, volume toggle, webcam toggle, cursor-mode toggle (only on Win/macOS), divider, record button.+- The HUD's right edge holds the language selector (current locale code, e.g. `EN`) and window-control buttons (minimize, close).+- No console errors in the launched process.++---++## Scenario 00.2 — Tray layout toggles between horizontal and vertical++**Setup**+1. From scenario 00.1 state.++**Steps**+1. Right-click anywhere on the HUD bar (or press-and-hold on a touch device) — the **layout toggle** appears in a small popover. The exact trigger is in `LaunchWindow.module.css`; if not visible, click the long-press indicator for ~500 ms.+2. Click the layout toggle once. Take a screenshot.++**Expected**+- The tray layout switches from horizontal to **vertical**: buttons stack into a column inside the same frameless window, and the window grows tall enough to fit (the `electronAPI.setHudOverlaySize` IPC has fired — verifiable by re-measuring the window bounding box in the next screenshot).+- Click again → reverts to horizontal.+- The window does NOT overlap the system taskbar. If it does, fail.++---++## Scenario 00.3 — Language picker opens and lists all 13 locales++**Setup**+1. From scenario 00.2 state (back to horizontal layout).++**Steps**+1. Click the language selector on the right end of the HUD (visible label is the language's short code, e.g. `EN`, `FR`, `JA-JP`). The full set lives in `src/i18n/config.ts:30` and `SUPPORTED_LOCALES` — the menu should show all of them.+2. Take a screenshot of the opened menu.+3. Click `Français`. Wait 500 ms.+4. Take a screenshot of the HUD bar — every visible label (button tooltips, the language code itself) must now read French.++**Expected**+- The menu opens with exactly **13** entries: `English`, `العربية`, `Español`, `Français`, `Italiano`, `日本語`, `한국어`, `Русский`, `Türkçe`, `Tiếng Việt`, `Português (Brasil)`, `简体中文`, `繁體中文`.+- After clicking `Français`: the language code on the HUD reads `FR`; the menu closes; no English text remains in any HUD label.+- Pressing `Esc` while the menu is open closes it without changing the locale.+- Clicking outside the menu closes it.++---++## Scenario 00.4 — Mic toggle, microphone device selector, audio level meter++**Setup**+1. From scenario 00.3 state. Switch back to `English` first: open the language menu → click `English`.+2. Ensure the mic icon is currently OFF (default state). The mic icon shows `MdMicOff` when off, `MdMic` when on.++**Steps**+1. Click the mic toggle. Take a screenshot.+2. Hover over the mic toggle for 500 ms. A popover appears anchored above the bar (because the bar's mic-popup uses `bottom-[68px]`).+3. The popover contains the microphone device selector and the audio-level meter (`AudioLevelMeter`).+4. If the system has only one mic input, the selector shows the default device. Otherwise, click the selector and pick another device.+5. Speak into the mic (or play any audio source on the system). The audio-level meter should animate for at least 1 s.++**Expected**+- Mic icon flips between `MdMic` and `MdMicOff` on click.+- Mic-popover stays anchored to the bar and does not get clipped by the bottom of the screen.+- The audio-level meter shows live bars when sound is present.+- Picking a new mic device updates the label in the selector.+- Click outside the popover closes it.++---++## Scenario 00.5 — Webcam toggle + camera selector++**Setup**+1. From scenario 00.4 state. Close any open mic popover (click outside).++**Steps**+1. Click the webcam toggle. Take a screenshot.+2. Hover over the webcam toggle for 500 ms. The webcam popover appears with the device selector.+3. The selector lists available cameras (system camera + any USB capture devices).+4. Pick a different camera if more than one is available.++**Expected**+- Webcam icon flips between `MdVideocam` and `MdVideocamOff` on click.+- Webcam popover stays anchored to the bar.+- Selecting a camera updates the device label.+- The system will request camera permission on first activation. If permission is denied, the toggle remains off and the popover shows the unavailable state (`webcam.unavailable`).++---++## Scenario 00.6 — Cursor capture mode toggle (Win/macOS only)++**Setup**+1. From scenario 00.5 state. Close popovers.+2. Verify the platform via the launch process (this scenario only runs on Win/macOS — skip on Linux).++**Steps**+1. Locate the cursor-mode button (`MdMouse` icon).+2. Click it once. The icon must change visual style (active state has a mint background).+3. Click again. Reverts.++**Expected**+- Cursor-mode button is visible on Win/macOS only (the platform check is in `LaunchWindow.tsx:212-225`).+- Two states exist: `editable-overlay` (default) and `system`. The active state is visible by the mint background.+- The selected mode is preserved across app restarts (it lives in `userPreferences`).++---++## Scenario 00.7 — System audio toggle++**Setup**+1. From scenario 00.6 state.++**Steps**+1. Locate the system-audio button (`MdVolumeUp` / `MdVolumeOff` icon, on the bar).+2. Click it once.++**Expected**+- Icon flips between volume-on and volume-off.+- The selected state is preserved across restarts.+- On Linux/Wayland the button may be disabled with `opacity-30` — verify the disabled state matches the platform.++---++## Scenario 00.8 — Minimize / close window controls++**Setup**+1. From scenario 00.7 state.++**Steps**+1. Click the minimize button (the horizontal bar icon, `FiMinus`). The HUD window minimises.+2. Restore the HUD via the system tray icon (OpenScreen tray). Click on the tray → the HUD reappears at the same position.+3. Click the close button (`FiX`). The HUD window closes.+4. Re-open via the system tray icon.++**Expected**+- Minimize/close behave per-platform conventions.+- The HUD reappears at the same screen position and with the same dimensions.+- The tray icon (in the system tray / menu bar) shows the right-click context menu: "Open", "Quit" (and "Stop recording" if recording).++---++## Scenario 00.9 — Drag handle moves the HUD window++**Setup**+1. From scenario 00.8 state.++**Steps**+1. Pointer-down on the drag handle (`RxDragHandleDots2` icon, leftmost element of the bar).+2. Drag the HUD ~200 px to the right and ~50 px up.+3. Release.++**Expected**+- The HUD window moves with the cursor.+- The bar's bottom-centre anchor is preserved if the user drags it (i.e. the window stays anchored to its current bottom-centre).+- Closing and re-opening the HUD keeps it at the dragged position.+- The HUD does not move off-screen at the bottom — the bottom-anchor logic prevents it from going below the taskbar.++---++## Scenario 00.10 — Click source-pick button opens the Source Selector++**Setup**+1. From scenario 00.9 state.++**Steps**+1. Click the source-pick button (`MdMonitor` icon, second from the left in the bar).+2. Wait up to 5 s for a new frameless window to appear.+3. Take a screenshot.++**Expected**+- A new frameless transparent window opens, ~620×420 px, anchored to the cursor position.+- The window contains the SourceSelector component: a tabs strip at the top (`Screens (N)` / `Windows (N)`), a grid of source thumbnails, and a footer with `Cancel` + `Share` buttons.+- The source-pick button has a subtle active/pressed state while the selector is open.++---++## Scenario 00.11 — Cancel the source selector++**Setup**+1. From scenario 00.10 state (Source Selector is open).++**Steps**+1. Click the `Cancel` button (visible label is the localized string from `src/i18n/locales/en/common.json` `actions.cancel`).+2. Wait up to 3 s.++**Expected**+- The Source Selector window closes.+- The HUD bar returns to its previous state (source-pick button no longer pressed).+- No recording was started.+- No console errors.++---++## Scenario 00.12 — Hover-state reveal of auxiliary buttons++**Setup**+1. From scenario 00.11 state.++**Steps**+1. Take a baseline screenshot of the HUD bar.+2. Hover (no click) over the area just to the right of the cursor-mode button. The device-popup anchors appear.+3. Move the mouse off the bar.++**Expected**+- Auxiliary controls (mic/webcam expanded controls) reveal on hover/focus, hide on blur. They use the `hudAuxIconBtnClasses` class — slightly dimmer (`text-white/55`) than the primary buttons.+- Focus ring is visible on tab navigation.+- No layout shift visible to the user (transitions are short, <180 ms).++---++## Cross-cutting checks for this block++- After every scenario, the MCP must take a fresh screenshot and confirm the HUD's bounding box. The HUD must remain visible (not behind the editor or another app window).+- Console: any `error` console message in this block is a fail. `warn` is acceptable only for permission prompts the user dismisses.+- The MCP must NOT click the record button in this block. Recording starts in **01**.++**Next:** proceed to [`01-source-selection-and-record.md`](01-source-selection-and-record.md).\ No newline at end of filediff --git a/specs/computer-use/01-source-selection-and-record.md b/specs/computer-use/01-source-selection-and-record.mdnew file mode 100644index 000000000..7d2c60c31--- /dev/null+++ b/specs/computer-use/01-source-selection-and-record.md@@ -0,0 +1,258 @@+# 01 — Source selector, countdown, recording lifecycle++**Surface:** `SourceSelector` (`src/components/launch/SourceSelector.tsx`) + `CountdownOverlay` (`src/components/launch/CountdownOverlay.tsx`) + `useScreenRecorder` (`src/hooks/useScreenRecorder.ts`).+**Window types involved:** `hud-overlay`, `source-selector`, `countdown-overlay`, then `editor`.+**Prerequisites:** `00-launch-and-hud.md` — all 12 scenarios green.++**Goal of this block:** exercise the full recording pipeline — pick a screen source, see the countdown, start recording, pause / resume, restart, stop, and arrive at the editor with the just-recorded session loaded.++**Reference:**+- inventory `openscreen-inventory.md §1` — window graph and recorder lifecycle.+- source `useScreenRecorder.ts:1040` (`startRecordCountdown`) and `:1163+` (browser `getDisplayMedia` path).+- native fallback for Windows/macOS uses WGC / ScreenCaptureKit; tests must note which path was taken (`data-capture-mode` is not currently exposed — fall back to inspecting `useScreenRecorder` internals via the console).++---++## Scenario 01.1 — Source selector shows Screens / Windows tabs++**Setup**+1. Click the source-pick button on the HUD bar (`MdMonitor` icon). Wait for the Source Selector window.++**Steps**+1. Take a screenshot of the Source Selector.+2. Locate the tabs strip at the top. Click the `Screens (N)` tab.+3. Click the `Windows (N)` tab.+4. Click back to `Screens (N)`.++**Expected**+- The tabs strip shows two tabs: `Screens (N)` and `Windows (N)` where N reflects the count returned by `desktopCapturer.getSources` (`electron/ipc/handlers.ts:1307`).+- Screens tab: thumbnail cards for each monitor (typically 1–2 in dev environments).+- Windows tab: thumbnail cards for each open window.+- If a tab has count 0, the grid is empty (not the empty-state page — that's only shown when **both** tabs are empty after a failed `getSources`).+- Tab switching preserves the previously selected source if it is still in the new tab.++---++## Scenario 01.2 — Pick a screen source → Share++**Setup**+1. From scenario 01.1 state. Default tab = Screens.++**Steps**+1. Click any source card. A green check badge appears in the corner (`MdCheck` icon).+2. The card is highlighted with a brighter border.+3. Click the `Share` button (localized label from `actions.share`).++**Expected**+- The `Share` button is **disabled** until a source is selected (gray).+- After clicking the source card, the button is enabled (mint background).+- Clicking `Share`:+ - Closes the Source Selector window.+ - Opens the Countdown Overlay window.+- The selected source becomes the recorder's source (verify by inspecting the next countdown frame).++---++## Scenario 01.3 — Cancel from the source selector++**Setup**+1. Open the Source Selector again.++**Steps**+1. Click `Cancel` (without selecting any source).++**Expected**+- The Source Selector closes.+- No Countdown opens.+- The HUD bar's source-pick button returns to its idle state.++---++## Scenario 01.4 — Countdown overlay counts down 3 → 2 → 1++**Setup**+1. From scenario 01.2 state (a source is selected, Countdown is open).++**Steps**+1. Take a screenshot every 1 s for 3 s.++**Expected**+- The Countdown overlay window is **frameless transparent**, ~420×260 px, anchored to the bottom-centre of the primary display.+- It shows a large countdown number that animates from `3` to `2` to `1`.+- Each number remains visible for ~1 s with a smooth transition (the number grows then fades).+- The countdown overlay's window can ignore mouse events (`focusable: false`) — verify by moving the mouse over it: clicks should NOT focus it.++---++## Scenario 01.5 — Recording starts, HUD reflects RECORDING state++**Setup**+1. Wait for the countdown to complete (the 3-2-1 finishes; the Countdown window closes).++**Steps**+1. Take a screenshot of the HUD bar.+2. The record button now shows the active REC state (red dot, label `Recording`).+3. A timer (`formatTimePadded(elapsedSeconds)`) starts counting up from `00:00`.+4. Pause and resume buttons become available.++**Expected**+- The HUD's record button has its `aria-pressed="true"` state (or visual equivalent: red dot animation, `REC` label).+- The timer ticks every second.+- The pause button is enabled.+- The restart button is enabled.+- The cancel button is enabled.+- The mic / webcam toggles are **disabled** during recording (greyed out).+- The cursor-mode button is disabled.+- The source-pick button is disabled.++---++## Scenario 01.6 — Pause / resume recording++**Setup**+1. From scenario 01.5 state. Let the timer reach at least `00:03`.++**Steps**+1. Click the pause button (`BsPauseCircle`).+2. Wait 2 s. Take a screenshot. The timer should be paused.+3. Click the resume button (`BsPlayCircle`).+4. Wait 2 s. Take a screenshot. The timer resumes.++**Expected**+- After pause: timer stops counting; the HUD record button's state changes to a "paused" variant (still REC visible, but timer frozen); pause button swaps to the resume icon.+- After resume: timer continues from the paused value (does NOT reset to 0); the icon swaps back to pause.+- Total `accumulatedDurationMs` is preserved across pause/resume cycles (verified by: stop the recording and check the editor's total duration matches the sum of active intervals).++---++## Scenario 01.7 — Restart recording discards the current take++**Setup**+1. From scenario 01.6 state. Timer is paused.++**Steps**+1. Click the restart button (`MdRestartAlt`). A confirmation prompt appears (if wired) — click `Yes` / `Discard`.+2. Take a screenshot of the HUD bar.++**Expected**+- The HUD resets to its pre-recording state: timer reads `00:00`, record button is in the idle state, pause/resume/restart are disabled again.+- The previous recording is **discarded** (no file written to `userData/recordings/`).+- A new recording can now be started by clicking the record button again.++---++## Scenario 01.8 — Stop recording transitions to the editor++**Setup**+1. From scenario 01.5 state (or restart from 01.7 and re-record for ~3 s).++**Steps**+1. Let the timer reach at least `00:05`.+2. Click the stop button (`FaRegStopCircle`).+3. Wait up to 10 s. Take a screenshot.++**Expected**+- The HUD window closes.+- The Countdown Overlay does NOT reappear.+- The **editor window** opens, maximized, with the just-recorded media loaded.+- The editor's bottom timeline pane shows the recorded media as a single clip spanning the recorded duration (e.g. `~5s`).+- The preview pane shows the first frame of the recording.+- The status `data-current-time-sec` is `0` (or very close).+- The `data-clip-count` is `1`.+- The `data-skip-count` is `0`.++---++## Scenario 01.9 — Cancel recording mid-take discards++**Setup**+1. From scenario 01.5 state.++**Steps**+1. Let the timer reach at least `00:02`.+2. Click the cancel button (`MdCancel`).+3. Take a screenshot.++**Expected**+- The HUD returns to its pre-recording state without opening the editor.+- No recording is saved.+- The tray icon's right-click menu no longer shows `Stop recording`.++---++## Scenario 01.10 — Webcam overlay during recording (optional, if webcam enabled)++**Setup**+1. Click the webcam toggle on the HUD before recording (refer to 00.5).+2. Pick a source, start the countdown, start the recording.++**Steps**+1. Record for ~5 s. Take a screenshot of the HUD and the system preview (the screen source being captured).+2. Stop the recording.++**Expected**+- The webcam feed appears as a small overlay on the captured screen (the desktopCapturer captures the screen including any application windows that draw to it; the HUD's webcam preview is a separate DOM element).+- After stop + editor open, the editor's preview shows the captured video. If a webcam file was produced (sidecar file), it may or may not be visible in the editor preview — depends on the active layout preset.+- The webcam PIP can be configured in the editor (covered in `10-properties-right-panel.md`).++---++## Scenario 01.11 — Cursor capture mode (system vs editable-overlay)++**Setup**+1. Set the cursor-mode toggle to `system` (refer to 00.6).+2. Start a recording. Record for ~5 s. Stop. Open the editor.++**Steps**+1. Open the editor. Check the preview at a time where the cursor is visible.+2. Open the right panel → Cursor pane. Inspect the cursor theme.++**Expected**+- When `system` mode: the OS cursor is hidden during recording; the recording has cursor telemetry captured separately; the editor renders a synthetic cursor based on the telemetry.+- When `editable-overlay` (default): the OS cursor is left visible during recording; the editor shows the original cursor + an editable synthetic overlay.+- Either way, the editor renders a cursor in the preview at the recorded positions.++---++## Scenario 01.12 — Permission flow on macOS (manual — skip if Win/Linux)++**Setup**+1. macOS only. The Screen Recording permission may be `not-determined` on first launch.++**Steps**+1. Click the source-pick button. The Source Selector window briefly opens and closes; the prompt for permission appears.+2. The app retries up to 8 times (`openSourceSelectorFlow.ts:32`).++**Expected**+- The Source Selector window appears within 8 retries (~8 s).+- On the user's first acceptance, the prompt closes and the Source Selector renders normally.+- Skip this scenario on Win/Linux.++---++## Scenario 01.13 — Multiple sequential recordings overwrite the editor's current pointer++**Setup**+1. From scenario 01.8 state (editor is open with recording #1).+2. Return to the recorder: titlebar → `Return to recorder` button (`aria-label="Return to recorder"`).+3. Record a second, shorter clip (~3 s). Stop.+4. The editor reopens.++**Steps**+1. Verify the editor's preview shows recording #2 (not #1).+2. Verify the timeline's clip count is still `1` (the new take replaced the old).++**Expected**+- The editor's `currentRecordingSession` pointer is updated to recording #2.+- The previous file is NOT deleted from `userData/recordings/` (per `openscreen-inventory.md §1` "Multiple sequential recordings").+- The titlebar's `data-project-name` is unchanged; only the content swaps.++---++## Cross-cutting checks for this block++- Every recording scenario must verify that **at least one file** landed in `userData/recordings/` (the file name pattern is `recording-<timestamp>.webm` for browser-capture, `recording-<timestamp>.mp4` for native).+- The MCP should not assume a particular capture mode. If the test environment is Win with the WGC helper available, it may take the native path; on a fresh Linux box, browser-capture is used. Both paths are correct as long as the editor ends up with a playable clip.+- After scenario 01.13 the editor is the foreground window. All later scenarios run from this state.++**Next:** proceed to [`02-editor-foundation.md`](02-editor-foundation.md).\ No newline at end of filediff --git a/specs/computer-use/02-editor-foundation.md b/specs/computer-use/02-editor-foundation.mdnew file mode 100644index 000000000..24052c9da--- /dev/null+++ b/specs/computer-use/02-editor-foundation.md@@ -0,0 +1,357 @@+# 02 — Editor foundation: shell, panels, project list, save flow++**Surface:** `NewEditorShell` (`src/components/ai-edition/NewEditorShell.tsx`), `Titlebar`, `LeftPanel`, `LeftRail`, `RightPanelStack`, `RightRail`, `Modals`, `Bottombar`.+**Window type:** `editor` (`electron/windows.ts:168` — maximized, hiddenInset traffic lights on macOS, `webSecurity: false`).+**Prerequisites:** `01-source-selection-and-record.md` — at least one recording has been made, editor is open.++**Goal of this block:** prove the editor's structural surfaces (panels, rails, titlebar, project list, save/unsaved-changes flow, language + theme switching). After this block, every later block can assume the editor is the foreground window and the user has a known project loaded.++**Reference:**+- design `openscreen-editor.html` — titlebar, workbench grid, panel-stack structure.+- inventory `openscreen-inventory.md §3` — `EditorProjectData`, project file format, save flow.+- inventory `openscreen-inventory.md §5` — IPC for save / load / unsaved changes.+- `NewEditorShell.tsx:50-70` — `COLLAPSE_INITIAL = { left: false, right: true, bottom: false }`.++---++## Scenario 02.1 — Editor shell layout is correct on first open++**Setup**+1. From the end of block 01: editor is open with a recording loaded.++**Steps**+1. Take a screenshot of the editor window (maximized).+2. Identify each region by visual scan:+ - **Titlebar** (top, 34 px) — brand mark + project name + saved dot + language selector + window controls (Win/Linux) or hiddenInset traffic lights (macOS).+ - **Left rail** (vertical, 48 px) — icon buttons for `Media`, `Chat`, `Settings`, etc. (`aria-label="Left tools"`).+ - **Left panel** (320 px) — currently showing the Media tab (compositions + files).+ - **Center workbench** — preview pane (top) + transport bar (bottom of preview) + the Bottombar is collapsed by default (`rightCollapsed: true` initial state means the **right** properties panel is hidden — verify).+ - **Resize handle** between left panel and center (`aria-label="Resize left panel"`).+ - **Right rail** (vertical, 48 px) — icon buttons for `Background`, `Layout`, `Camera`, `Cursor`, `Effects`, `Crop` (`aria-label="Right tools"`).+ - **Resize handle** between center and right rail (`aria-label="Resize right panel"`).+ - **Bottom handle** (`aria-label="Resize timeline"`).+ - **Bottombar (collapsed by default)** — at the bottom, showing the timeline (it is NOT collapsed by default — only the right properties panel is). Re-verify the bottom is visible.+3. Read the timeline pane attributes: `data-clip-count`, `data-skip-count`, `data-current-time-sec`, `data-zoom-multiplier`.++**Expected**+- The window fills the screen minus the platform-specific frame.+- All four regions exist.+- The timeline is visible at the bottom (its initial height is set by `--bottom-h: 224px`).+- The right properties panel is hidden by default — only the right rail is visible.+- `data-clip-count="1"`, `data-skip-count="0"`, `data-current-time-sec="0"` (or `~0`), `data-zoom-multiplier="1"`.+- The preview's `data-testid="preview"` element is visible.+- No console errors.++---++## Scenario 02.2 — Open existing project via the project list++**Setup**+1. From scenario 02.1 state.+2. The LeftPanel's **Media** tab should be active (default).++**Steps**+1. In the LeftPanel, locate the **Compositions** section (top).+2. Take a screenshot. The list should show the current project as active (mint background, check mark).+3. Locate the **Files** section. The current recording should appear as an asset row with its filename and duration.+4. Click the `+` button next to the Compositions header (opens the `OpenProjectModal`).+5. The modal appears: it has two columns — **Recent projects** (left) and **+ New project** (right).++**Expected**+- The current project's row is marked active.+- The Files list shows the just-recorded file with its duration (e.g. `0:05`).+- The `+` button opens the modal; the modal is a centered card with a backdrop.+- The Recent Projects column is populated (at minimum the current project; possibly older ones from `userData/projects/`).+- Press `Esc` to close the modal.++---++## Scenario 02.3 — Create new project++**Setup**+1. From scenario 02.2 state (modal closed).++**Steps**+1. Click the `+` button in Compositions.+2. In the OpenProjectModal, click the `+ New project` card on the right side.+3. A `NewProjectModal` appears (or the same modal switches view).+4. Enter a project title in the input (e.g. `Test Project Alpha`).+5. Click `Create`.++**Expected**+- The editor reloads with a fresh, empty project.+- The LeftPanel's Compositions now lists `Test Project Alpha` as active.+- The Files section is empty.+- The preview shows the empty state (`data-testid="preview"` with no clip loaded).+- The timeline shows the empty-state message: `Drag a video from the media panel here to start your timeline.`+- The `data-clip-count` is `0`.++---++## Scenario 02.4 — Rename the current project++**Setup**+1. From scenario 02.3 state (Test Project Alpha is active).++**Steps**+1. Click the project name in the titlebar (the visible text is `Test Project Alpha`). A button.+2. The titlebar reveals an inline input.+3. Type `Test Project Beta`. Press `Enter`.++**Expected**+- The titlebar updates to `Test Project Beta`.+- The `data-project-name` (if present) reflects the new name.+- Pressing `Esc` cancels the rename (verify by clicking again and pressing `Esc`).+- Clicking outside the input also saves the rename.++---++## Scenario 02.5 — Open a different project from Recent++**Setup**+1. From scenario 02.4 state.+2. First, generate another project: re-record a short clip, stop, the editor opens with a new take. (Repeat 01.5–01.8 with a different source if needed — or use any of the existing fixture files.)++**Steps**+1. Open the OpenProjectModal (`+` button).+2. Click on the first project (the one created in 02.3) in the Recent list.+3. The modal closes; the editor reloads.++**Expected**+- The editor's preview shows the previously-saved project's content.+- The titlebar reflects the project name.+- The Files list is populated with the previously-loaded asset.++---++## Scenario 02.6 — Left panel tabs switch++**Setup**+1. From scenario 02.5 state.++**Steps**+1. Click the **Media** tab button on the left rail.+2. Click the **Chat** tab button on the left rail.+3. Click the **Settings** tab button on the left rail.+4. Click back to **Media**.++**Expected**+- The left panel's content swaps between tabs.+- **Media**: Compositions + Files sections.+- **Chat**: Chat history + composer (only if `AI_FEATURES_ENABLED`). If the flag is off, the chat tab is hidden.+- **Settings**: General / Export / Recording / Audio / Shortcuts tabs.+- The active tab on the rail has the mint accent (left-border indicator).+- Selecting the Chat tab auto-opens the chat panel if collapsed.++---++## Scenario 02.7 — Left panel collapse/expand++**Setup**+1. From scenario 02.6 state.++**Steps**+1. Drag the resize handle (`aria-label="Resize left panel"`) left by 80 px.+2. Drag it right by 160 px (past the original position).+3. Click the `<<` collapse button (the small caret on the resize handle).+4. Click the `>>` expand button.++**Expected**+- The left panel width changes during the drag.+- The collapse button tucks the panel down to the rail-only state.+- The expand button restores the previous width.+- The right panel and the preview both resize in response.+- The collapse state persists across restarts (in `localStorage["openscreen-workbench"]` or similar).++---++## Scenario 02.8 — Right panel (properties) collapse/expand++**Setup**+1. From scenario 02.7 state.++**Steps**+1. The right rail is visible, the right panel itself is collapsed (default initial state).+2. Click any right-rail button (e.g. **Background**).+3. The right panel opens, showing the Background pane (image grid + gradient grid + custom upload).+4. Click another right-rail button (e.g. **Layout**). The panel swaps content.+5. Drag the resize handle (`aria-label="Resize right panel"`) left by 50 px.+6. Click the collapse button on the right handle.+7. Click the expand button.++**Expected**+- Right-rail buttons toggle the right panel's visibility and content.+- The right panel width changes during the drag.+- The collapse/expand state persists.+- The active right-rail button has the mint accent.++---++## Scenario 02.9 — Bottom timeline collapse/expand++**Setup**+1. From scenario 02.8 state.++**Steps**+1. The bottom timeline is visible.+2. Drag the resize handle (`aria-label="Resize timeline"`) up by 60 px.+3. Click the collapse button on the handle.+4. Click the expand button.++**Expected**+- The bottom pane height changes during the drag.+- Collapse tucks it down to ~32 px (a thin strip with the timeline header only).+- Expand restores the previous height.+- The collapse state persists.++---++## Scenario 02.10 — Save project (no changes → no-op)++**Setup**+1. From scenario 02.9 state. Make sure the project is in a clean state (just opened).++**Steps**+1. Press `Ctrl+S` (or `Cmd+S` on macOS).++**Expected**+- The titlebar's "saved" indicator remains green (the dot stays mint, no spinner).+- No save dialog appears (the path is the same).+- No console errors.++---++## Scenario 02.11 — Save project after edit (dirty flag visible)++**Setup**+1. Make a trivial change to the project (e.g. add a zoom region — see 07.1 for the recipe; or click `Magic` button on the bottom bar).+2. Take a screenshot.++**Steps**+1. The titlebar's "saved" indicator should now show a yellow/warning state or an unsaved dot (implementation-specific — verify the dot is no longer green).+2. Press `Ctrl+S`.++**Expected**+- A save dialog opens if `currentProjectPath` is unset (new project) — verify the user is prompted for a path.+- If the path is set, no dialog opens; the save completes silently.+- After save, the "saved" dot returns to mint.+- The file `userData/projects/<projectId>.openscreen` (or `.axcut`) is updated — verify by listing the directory.++---++## Scenario 02.12 — Unsaved changes prompt on close++**Setup**+1. Make a change (trivially: open a clip, change a setting).+2. Confirm the saved dot is dirty.++**Steps**+1. Close the editor window (X button on Win/Linux; red traffic light on macOS).+2. An `UnsavedChangesModal` appears.+3. The modal has 3 choices: `Save`, `Discard`, `Cancel`.+4. Click `Cancel`. The editor window stays open.+5. Close again. Click `Discard`. The window closes without saving.+6. Reopen. The previous state is lost (or kept depending on which path the OS re-loads).++**Expected**+- The modal is centered with a backdrop.+- `Cancel` keeps the editor open and the dirty state.+- `Discard` closes the window (the IPC `close-confirm-response="discard"` fires; see `electron/main.ts:395-426`).+- `Save` (not exercised here — exercised in 02.13).++---++## Scenario 02.13 — Unsaved → Save closes the editor++**Setup**+1. Make a change.+2. Close the editor.++**Steps**+1. Click `Save`.+2. If the project is new, a save-as dialog appears.+3. Pick a location, confirm. The editor closes.+4. Reopen the project from `Recent`. The saved state is loaded.++**Expected**+- Save path is `userData/projects/<id>.openscreen` (legacy) or `userData/projects/<id>.axcut` (v3) — see `electron/ai-edition/document-service.ts` for the writer.+- The file is valid JSON (parse it via `Get-Content | ConvertFrom-Json` to verify).++---++## Scenario 02.14 — Application menu File operations++**Setup**+1. Editor is open.++**Steps**+1. From the OS application menu, click `File → New Project` (or `Ctrl+N`). A `NewProjectModal` appears.+2. Cancel it.+3. `File → Open Project` (`Ctrl+O`). The `OpenProjectModal` appears.+4. Cancel it.+5. `File → Save Project` (`Ctrl+S`). Same as scenario 02.10/02.11.+6. `File → Save Project As` (`Ctrl+Shift+S`). The save-as dialog opens.++**Expected**+- Each menu item triggers its respective IPC channel (`menu-new-project`, `menu-load-project`, etc. — see `electron/preload.ts:202-225`).+- The behaviour matches the corresponding in-app buttons.++---++## Scenario 02.15 — System tray / menu integration++**Setup**+1. Editor is open.++**Steps**+1. Find the OpenScreen icon in the system tray (Win: bottom-right; macOS: menu bar).+2. Right-click. The menu shows: `Open`, `Quit`.+3. Click `Open`. The editor comes to the foreground (no-op if already foreground).+4. Right-click again. Click `Quit`. The entire app exits.++**Expected**+- The tray menu reflects the current state (no `Stop recording` unless recording).+- `Quit` cleanly closes all windows.++---++## Scenario 02.16 — Titlebar "New recording" button returns to HUD++**Setup**+1. Editor is open.++**Steps**+1. Click the titlebar's `New recording` button (`aria-label="New recording"`). Located in the titlebar's left-side action cluster.++**Expected**+- The editor window closes (or hides).+- The HUD window reappears.+- No new recording starts — this is a "go back to recorder" action; recording starts from the HUD.+- Project state is preserved (the dirty flag persists if there are unsaved changes — but the user has to manually save first; no auto-save).++---++## Scenario 02.17 — Empty-state messaging++**Setup**+1. Create a brand new empty project (scenario 02.3).++**Steps**+1. Take a screenshot. The preview shows an empty-state message.+2. The timeline shows: `Drag a video from the media panel here to start your timeline.`+3. The bottombar's action buttons (Magic, Zoom+, Captions) are **disabled**.++**Expected**+- The empty-state text matches the i18n string in `src/i18n/locales/en/timeline.json` (or `editor.json`).+- The disabled buttons have reduced opacity and a `cursor: not-allowed`.+- Adding an asset to the project (drag-drop into the Files list) clears the empty state.++---++## Cross-cutting checks for this block++- Every modal opened in this block must close cleanly with `Esc` and with backdrop-click (where applicable).+- The workbench layout (panel widths, collapse states) persists across an app restart.+- The project title persists across renames + restarts.++**Next:** proceed to [`03-transport-and-preview.md`](03-transport-and-preview.md).\ No newline at end of filediff --git a/specs/computer-use/03-transport-and-preview.md b/specs/computer-use/03-transport-and-preview.mdnew file mode 100644index 000000000..b54dc06a4--- /dev/null+++ b/specs/computer-use/03-transport-and-preview.md@@ -0,0 +1,333 @@+# 03 — Transport & preview++**Surface:** `Preview` (`src/components/ai-edition/Preview.tsx`), `PreviewCanvas` (`src/components/ai-edition/PreviewCanvas.tsx`), `VirtualPreview` (`src/components/ai-edition/VirtualPreview.tsx`).+**Prerequisites:** `02-editor-foundation.md` — a project is loaded with at least one clip in the timeline. If scenario 02.3 left the project empty, re-record a clip (re-run 01.5–01.8) or import via the Open Project modal.++**Goal of this block:** prove the preview surface (the visual playback area + the transport bar) behaves correctly: play, pause, restart, scrub, fullscreen, and the dual-layer cross-fade at clip boundaries.++**Reference:**+- design `openscreen-editor.html` — `.preview-wrap`, `.preview-canvas`, `.preview-frame`, `.transport`, `.playhead`.+- `Preview.tsx:142` — `<div aria-label="Video preview" data-testid="preview">`.+- `Preview.tsx:172` — `<div className={styles.transport} role="toolbar" aria-label="Playback controls">`.+- `Preview.tsx:177` — Play/Pause button (`aria-label="Play / Pause"`).+- `VirtualPreview.tsx` — two `<video>` elements (A/B) for buffer-and-swap at clip boundaries.++---++## Scenario 03.1 — Preview shows the first frame of the active clip++**Setup**+1. From the end of block 02. Project loaded with ≥ 1 clip.++**Steps**+1. Take a screenshot of the preview area.+2. The preview should show the first frame of the first clip (or the appropriate thumbnail).+3. The preview's `data-current-time-sec` is `0` (or close to it).+4. The preview's `data-is-playing` is `false`.++**Expected**+- The preview is visible (the `data-testid="preview"` element).+- The first frame of the source video is rendered.+- The aspect ratio matches the project's `aspectRatio` setting (default `16:9`).+- No `loading` overlay; no `error` overlay.++---++## Scenario 03.2 — Play / Pause toggle++**Setup**+1. From scenario 03.1 state.++**Steps**+1. Click the **Play / Pause** button in the transport bar (`aria-label="Play / Pause"`).+2. Wait 1 s. Take a screenshot.+3. The `data-is-playing` attribute is now `true`. The button shows the pause icon (or its label switches).+4. Click the same button again.+5. The `data-is-playing` is back to `false`. The play icon returns.++**Expected**+- Play starts the video; `data-current-time-sec` advances.+- Pause stops the video at the current time.+- The button's icon and label flip consistently.+- The keyboard shortcut `Space` also toggles play/pause (verify by pressing `Space` with the focus on the preview).++---++## Scenario 03.3 — Restart from time 0++**Setup**+1. Play the video for at least 2 s. Pause it. `data-current-time-sec` is at least `2`.++**Steps**+1. Click the **Restart** button (icon: `MdRestartAlt` or similar).+2. Take a screenshot.++**Expected**+- `data-current-time-sec` is now `0`.+- The video frame is back to the first frame.+- Playback does NOT auto-start.++---++## Scenario 03.4 — Scrub via the range slider++**Setup**+1. From scenario 03.3 state. Video is paused at `0`.++**Steps**+1. Locate the seek range slider (`aria-label="Seek video"`).+2. Click at ~75% of the slider width.+3. The preview seeks to the corresponding source time.+4. Read `data-current-time-sec`.++**Expected**+- The slider's value reflects the seek position.+- `data-current-time-sec` jumps to ~75% of the clip's duration.+- The preview shows the frame at the seek position.+- The time readout (`MM:SS.mmm / MM:SS.mmm`) updates accordingly.++---++## Scenario 03.5 — Loop toggle++**Setup**+1. From scenario 03.4 state. Scrub to ~90% of the clip.++**Steps**+1. Click the **Loop** button (`aria-label="Loop"`). The button's pressed state shows.+2. Click **Play**. Wait for the playback to pass the clip's end.++**Expected**+- When the playback reaches the end of the timeline (sum of clip durations):+ - With loop ON: playback restarts from `0`.+ - With loop OFF (default): playback stops at the end.+- The loop button's visual state (pressed / not pressed) reflects the current setting.++---++## Scenario 03.6 — Previous / Next clip navigation++**Setup**+1. Project has 2 clips (drag a second asset into the timeline via the Files panel — covered in 05.1).++**Steps**+1. Click the **Previous clip** button (`aria-label="Previous clip"`).+2. The preview seeks to the start of the previous clip.+3. Click the **Next clip** button (`aria-label="Next clip"`).+4. The preview seeks to the start of the next clip.++**Expected**+- The buttons jump between clip boundaries.+- The `data-current-time-sec` reflects the new position.+- If only one clip exists, both buttons may be disabled or no-op.++---++## Scenario 03.7 — Fullscreen toggle++**Setup**+1. From scenario 03.6 state.++**Steps**+1. Click the **Fullscreen** button (`aria-label="Fullscreen"`).+2. The preview enters fullscreen mode.++**Expected**+- The preview occupies the entire screen.+- The transport bar is hidden in fullscreen (or shown as an overlay).+- Press `Esc` to exit fullscreen.++---++## Scenario 03.8 — Time readout format++**Setup**+1. Preview is paused at some position. Read the time readout.++**Steps**+1. Read the text. Format is `MM:SS.mmm / MM:SS.mmm` (current / total virtual duration).++**Expected**+- The current time is on the left, separated by a `/` or `—` from the total.+- The format is monospaced.+- The current matches `data-current-time-sec` (when converted to `M:SS.mmm`).+- The total is the sum of all clip durations (with skips applied).++---++## Scenario 03.9 — Playhead stays in sync with timeline++**Setup**+1. Play the video for at least 3 s. Pause.++**Steps**+1. Read the preview's `data-current-time-sec`.+2. Read the timeline pane's `data-current-time-sec`. They must match.+3. Click on the timeline ruler at ~50% of its width.+4. The preview seeks to the corresponding source time. Both data attributes update.++**Expected**+- `data-current-time-sec` on the preview and on the timeline pane are always equal.+- Scrubbing on either surface updates both.++---++## Scenario 03.10 — REC toggle on transport bar++**Setup**+1. From scenario 03.9 state. Transport bar visible.++**Steps**+1. Locate the REC pill on the transport bar (red dot when active).+2. Click it. The transport changes state to REC.+3. The HUD does NOT reopen — this is a UI element, not the recorder entry point.+4. Click REC again. Returns to play state.++**Expected**+- The REC button toggles a visual state but does not start a real recording.+- (Alternative: if the REC button is a shortcut to reopen the HUD, click it once → HUD reappears. Implementation-specific.)++---++## Scenario 03.11 — Preview handles short clips (1–3 s)++**Setup**+1. Record a short clip (~2 s) → editor opens with a short single clip.++**Steps**+1. Play the clip.+2. Watch the end behavior.++**Expected**+- The clip plays to the end without crashing.+- The playhead stops at the end of the clip.+- The preview shows the last frame (paused).++---++## Scenario 03.12 — Preview handles long clips (>5 min)++**Setup**+1. Record or import a 5+ minute clip.++**Steps**+1. Play for 5 s. Pause. Read `data-current-time-sec`.+2. Scrub to ~75%. The preview seeks correctly.++**Expected**+- Playback is smooth.+- Scrubbing is responsive (no > 1 s lag).+- No console errors during long playback.+- Memory usage stays bounded (no leak indicators in the console).++---++## Scenario 03.13 — Webcam PiP / Dual / Vertical layout presets++**Setup**+1. Project has both a screen recording AND a webcam file (i.e. recorded with `webcamEnabled=true`).+2. Open the right rail → **Camera** pane (or **Layout** pane depending on grouping).++**Steps**+1. The layout preset selector lists: `picture-in-picture` (default), `dual-horizontal`, `dual-vertical`, `screen-only`, `webcam-only`.+2. Click `dual-horizontal`. The preview swaps to side-by-side layout.+3. Click `dual-vertical`. The preview stacks vertically.+4. Click `picture-in-picture`. The webcam overlays in the corner.++**Expected**+- The layout switch is instantaneous (no re-render glitch).+- The webcam mask (rectangle, circle, square, rounded) is applied.+- The webcam mirroring setting is honored.+- The transition between layouts does not cause the playback to stutter.++---++## Scenario 03.14 — Cursor overlay at recorded positions++**Setup**+1. Project was recorded with `cursorCaptureMode = "editable-overlay"` (default).+2. The preview shows the recorded video at a time where the cursor was moving.++**Steps**+1. Read the right pane → **Cursor** settings.+2. Adjust the cursor theme (e.g. switch from `macOS Arrow` to `Mint Dot`).+3. Adjust the cursor size (slider, default 3.0).++**Expected**+- The cursor in the preview updates to match the new theme and size.+- The smoothing slider affects the cursor's motion blur (set to 0 = sharp; set to 1 = smooth).+- The clip-to-bounds toggle hides the cursor when it leaves the recording area.++---++## Scenario 03.15 — Playback across clip boundaries (cross-fade)++**Setup**+1. Project has 2 clips back-to-back (no skip between them).+2. The first clip ends at ~5 s; the second starts at ~5 s.++**Steps**+1. Play the timeline. Watch the boundary.+2. The transition is a **cross-fade** between two `<video>` elements (the A/B buffer-and-swap in `VirtualPreview.tsx`).++**Expected**+- The transition is smooth (no visible jump).+- No black flash between clips.+- The playhead does not stutter at the boundary.+- Audio does not glitch.++---++## Scenario 03.16 — Playback across skip ranges++**Setup**+1. Project has 1 clip with a skip range between 2 s and 4 s.++**Steps**+1. Play from `0`. Watch the preview.++**Expected**+- The preview skips from `2 s` to `4 s` (the keep-before + keep-after intervals).+- The skip is visually invisible (no black frame).+- The timeline's data attributes show the playhead jumps from ~2 s to ~4 s.+- The time readout's current value jumps accordingly.++---++## Scenario 03.17 — Restart-from-button vs scrub-to-zero++**Setup**+1. Play the video. Pause at ~5 s.++**Steps**+1. Click Restart button.+2. Click the seek slider at position `0` (far left).++**Expected**+- Both actions seek the playhead to `0`.+- The Restart button does NOT change `data-is-playing`; the seek-slider click may or may not.++---++## Scenario 03.18 — Preview error overlay++**Setup**+1. Force a preview error: open a project whose underlying file was deleted on disk.++**Steps**+1. Take a screenshot.++**Expected**+- The preview shows the `error` overlay: `Video preview could not be loaded.`+- The transport's play button is disabled.+- The timeline still shows the clip (state is intact).+- Re-importing the file restores the preview.++---++## Cross-cutting checks for this block++- All transport buttons have `aria-label` attributes the MCP can use for selection.+- The MCP must NEVER close the editor window during this block (no save/unsaved interruptions).++**Next:** proceed to [`04-timeline-pan-zoom-scrub.md`](04-timeline-pan-zoom-scrub.md).\ No newline at end of filediff --git a/specs/computer-use/04-timeline-pan-zoom-scrub.md b/specs/computer-use/04-timeline-pan-zoom-scrub.mdnew file mode 100644index 000000000..ef78ade41--- /dev/null+++ b/specs/computer-use/04-timeline-pan-zoom-scrub.md@@ -0,0 +1,339 @@+# 04 — Timeline pan / zoom / scrub++**Surface:** `TimelinePane` (`src/components/ai-edition/TimelinePane.tsx`) + the ruler + the navigator strip + the `pxPerSec` viewport state.+**Prerequisites:** `02-editor-foundation.md` (timeline pane exists), `03-transport-and-preview.md` (preview is wired so seeks are observable).++**Goal of this block:** prove the timeline viewport is navigable at any zoom level. After this block, every region operation in 06–09 has a known viewport state.++**Reference:**+- design `openscreen-editor.html` — `.timeline-body`, `.ruler`, `.tracks-scroll`, `.zoombar`.+- inventory `openscreen-inventory.md §4` — timeline architecture.+- roadmap `P0 timeline viewport` granular table (T01–T25), commits `690c80e`, `8be3dda`, `8c36398`, `2cd6ad3`.+- constants: `MAX_PX_PER_SEC = 280`, `CLIP_REORDER_THRESHOLD_PX = 6`, zoom step `1.18×`.+- `TimelinePane.tsx:1012` (`data-testid="timeline-pane"`), `:1033` (`data-testid="timeline-viewport"`), `:1566` (`aria-label="Timeline zoom and pan navigator"`).++---++## Scenario 04.1 — Timeline viewport reads `data-px-per-sec` and `data-zoom-multiplier`++**Setup**+1. From the end of block 03.++**Steps**+1. Read the timeline pane's `data-zoom-multiplier` (default `1`).+2. Read the timeline viewport's `data-px-per-sec` (the actual pixel-per-second ratio).+3. The clip blocks in the timeline render at widths = `durationSec * pxPerSec`.++**Expected**+- `data-zoom-multiplier` is a number ≥ `1.0`.+- `data-px-per-sec` is a positive number.+- The clip blocks' bounding boxes match `durationSec * pxPerSec` within ±2 px.++---++## Scenario 04.2 — Ctrl+wheel up zooms in++**Setup**+1. Hover the timeline viewport (`data-testid="timeline-viewport"`).+2. Read the initial `data-px-per-sec` as `initial`.++**Steps**+1. Hold `Ctrl` (or `Cmd` on macOS).+2. Wheel up 3 notches (deltaY = -120 each).+3. Release `Ctrl`.+4. Read `data-px-per-sec` as `zoomed`.++**Expected**+- `zoomed > initial` (the timeline is showing more pixels per second).+- `data-zoom-multiplier` increased.+- The clip blocks are visibly wider.+- The ruler ticks are finer.+- The zoom happens around the cursor X position (verify the click-X stays under the cursor after zoom).++---++## Scenario 04.3 — Ctrl+wheel down zooms out++**Setup**+1. From scenario 04.2 state (zoomed in).++**Steps**+1. Hold `Ctrl`. Wheel down 3 notches.+2. Read `data-px-per-sec`.++**Expected**+- `data-px-per-sec` decreased.+- `data-zoom-multiplier` decreased.+- At minimum, the zoom stops at `data-zoom-multiplier="1.0"` (fit-to-width).++---++## Scenario 04.4 — Zoom is bounded by MAX_PX_PER_SEC (280)++**Setup**+1. From scenario 04.3 state. Reset zoom to fit (Ctrl+0 if there's a shortcut, or wheel down until fit).++**Steps**+1. Hold `Ctrl`. Wheel up 30 notches (extreme zoom-in).+2. Read `data-px-per-sec`.++**Expected**+- `data-px-per-sec ≤ 280` (the MAX_PX_PER_SEC constant).+- No console errors.++---++## Scenario 04.5 — Ruler hover-scrub shows a guide line++**Setup**+1. Reset zoom to fit (default).++**Steps**+1. Move the mouse over the ruler (top of the timeline).+2. A vertical hover-guide line appears at the cursor's X position.++**Expected**+- The hover-guide is a 1 px line spanning the ruler.+- The ruler ticks do not change.+- Move the mouse off the ruler → guide disappears.+- The guide's X corresponds to a source time based on the current `pxPerSec`.++---++## Scenario 04.6 — Ruler click-to-seek++**Setup**+1. From scenario 04.5 state.++**Steps**+1. Click at ~75% of the ruler's width.+2. Read `data-current-time-sec` on both the preview and the timeline.++**Expected**+- The playhead jumps to ~75% of the timeline duration.+- The preview's source time updates.+- The playhead's X position equals the click position (visually).++---++## Scenario 04.7 — Alt+drag pans the viewport++**Setup**+1. Zoom in to ~3× (Ctrl+wheel up several times).+2. The clip blocks are now wider than the viewport — the viewport must pan to see the rest.++**Steps**+1. Hold `Alt`. Pointer-down inside the timeline viewport (not on a clip block or region pill).+2. Drag right by 200 px.+3. Release `Alt` (drag releases automatically when mouse is released).+4. The viewport's `visibleStartSec` advanced.++**Expected**+- The timeline's content translates to the left (showing later time).+- The ruler ticks reflect the new window.+- The playhead may scroll out of view if past the window's right edge.+- The clip blocks remain at their absolute source positions.++---++## Scenario 04.8 — Middle-click drag pans the viewport++**Setup**+1. From scenario 04.7 state.++**Steps**+1. Press the middle mouse button. Drag right by 150 px.+2. Release.++**Expected**+- Same pan behaviour as Alt+drag.+- The middle button does NOT trigger any other action (no seek, no region select).++---++## Scenario 04.9 — Navigator strip shows the visible window++**Setup**+1. Zoomed in from previous scenarios.++**Steps**+1. Locate the navigator strip below the timeline viewport (`aria-label="Timeline zoom and pan navigator"`).+2. Take a screenshot. The strip shows:+ - The full timeline as a thin bar.+ - Skip marks (red dashes) at every skip range.+ - A draggable window overlay showing the currently visible range.++**Expected**+- The navigator strip is visible and shorter than the viewport (~80 px tall).+- The window overlay's left/right edges can be dragged.+- The window overlay's interior can be dragged to pan.++---++## Scenario 04.10 — Navigator drag-pan++**Setup**+1. From scenario 04.9 state.++**Steps**+1. Pointer-down on the navigator's window-overlay **body** (not the edges). Drag right by 80 px.+2. Release.++**Expected**+- The viewport's `visibleStartSec` and `visibleEndSec` both shift right by the equivalent source time.+- The clip blocks translate to the left visually.++---++## Scenario 04.11 — Navigator drag-resize (left edge)++**Setup**+1. From scenario 04.10 state.++**Steps**+1. Pointer-down on the navigator's window-overlay **left handle**. Drag right by 20 px.+2. Release.++**Expected**+- The viewport's `visibleStartSec` increases.+- The zoom factor (`pxPerSec`) increases correspondingly (the visible window is now narrower, so each second takes more pixels).++---++## Scenario 04.12 — Navigator drag-resize (right edge)++**Setup**+1. From scenario 04.11 state.++**Steps**+1. Pointer-down on the navigator's window-overlay **right handle**. Drag left by 40 px.+2. Release.++**Expected**+- The viewport's `visibleEndSec` decreases.+- The zoom factor increases.++---++## Scenario 04.13 — Timeline header shows clip count, skip count, total duration++**Setup**+1. From scenario 04.12 state.++**Steps**+1. Read the timeline header's text.++**Expected**+- The text format is `N clips · M skips · M:SS total`.+- The numbers match the project's `timeline.clips.length`, `timeline.skipRanges.length`, and the sum of clip durations.+- The current time and "Clip i/N" indicator are also visible.++---++## Scenario 04.14 — Scrub via click-and-drag on the timeline++**Setup**+1. From scenario 04.13 state.++**Steps**+1. Pointer-down on the empty area of the timeline (between clip blocks, or on the ruler).+2. Drag right by 100 px without releasing.+3. The preview scrubs to the corresponding source time on every move.+4. Release at ~50% of the timeline width.++**Expected**+- The preview's `data-current-time-sec` follows the cursor in real time during the drag.+- The playhead follows the cursor.+- On release, the playhead stays at the released position.++---++## Scenario 04.15 — Fit-to-width reset (zoom 1.0)++**Setup**+1. From a zoomed state.++**Steps**+1. Press the keyboard shortcut for fit-to-width (typically `Ctrl+0` or `0`).+2. Or wheel down until the multiplier reads `1`.++**Expected**+- `data-zoom-multiplier = 1`.+- The clip blocks fill the viewport width exactly (no horizontal scroll, the navigator window covers the full timeline).++---++## Scenario 04.16 — Body class for panning/scrubbing/placing-cut modes++**Setup**+1. Reset zoom to fit.++**Steps**+1. Alt+drag (start panning) → the `body` element has class `timeline-panning`. Cursor is `grabbing`.+2. Drag on the timeline (scrubbing) → class `timeline-scrubbing`. Cursor is `col-resize` or similar.+3. Press the `T` key (place-skip mode — see 06.x) → class `timeline-placing-cut`. Cursor is `crosshair`.++**Expected**+- The body classes are observable via `document.body.classList`.+- Cursor changes per mode.++---++## Scenario 04.17 — Hover-scrub on the ruler while in scrub mode++**Setup**+1. From a clean state.++**Steps**+1. Move the mouse over the ruler (without clicking).+2. The hover-guide shows at the cursor's X.+3. The data-current-time attribute on the ruler updates as the mouse moves.++**Expected**+- The hover guide is visible.+- The ruler updates to reflect the scrub position (this is the P3.7 commit `76d78db`).++---++## Scenario 04.18 — Skip marks in the navigator strip++**Setup**+1. Project has at least 1 skip range (see 06.x to add one).++**Steps**+1. Take a screenshot of the navigator strip.++**Expected**+- Skip ranges are marked as red dashes (or similar accent) on the navigator's full-timeline bar.+- The skip marks are at the correct source time positions.+- Adding / removing a skip updates the navigator mark live.++---++## Scenario 04.19 — Place-skip mode shows a preview marker on the ruler++**Setup**+1. Reset to a single-clip project, zoomed to fit.++**Steps**+1. Press the `T` key. The place-skip mode is armed.+2. The ruler shows a red vertical marker at the current playhead position.+3. The body class is `timeline-placing-cut`.+4. Move the cursor over the ruler. The marker follows the cursor.+5. Press `Esc`. The marker disappears. The mode is disarmed.++**Expected**+- The marker is visible while armed.+- The cursor becomes `crosshair`.+- `Esc` disarms without creating a skip.+- Clicking while armed creates a 1 s skip at the click position (covered in 06.x).++---++## Cross-cutting checks for this block++- The viewport's `data-px-per-sec` and `data-zoom-multiplier` are always in sync.+- Pan + zoom state persists across opening the right panel and closing it.+- The ruler never shrinks below 4 ticks per viewport (adaptive ruler).++**Next:** proceed to [`05-clip-operations.md`](05-clip-operations.md).\ No newline at end of filediff --git a/specs/computer-use/05-clip-operations.md b/specs/computer-use/05-clip-operations.mdnew file mode 100644index 000000000..d6fcc59b9--- /dev/null+++ b/specs/computer-use/05-clip-operations.md@@ -0,0 +1,346 @@+# 05 — Clip operations: select, reorder, edit, duplicate, remove++**Surface:** `TimelinePane` (clip blocks + clip controls), `Bottombar` (`Edit clip` button), `Modals.tsx` (`EditClipModal`), `useTimeline` store.+**Prerequisites:** `02-editor-foundation.md`, `04-timeline-pan-zoom-scrub.md`.++**Goal of this block:** prove that clips (the timeline's atomic units) are fully manageable — drag in, select, reorder, duplicate, edit source range, and remove.++**Reference:**+- `Bottombar.tsx:337` — `aria-label="Edit clip"`.+- `TimelinePane.tsx:1318` — `aria-label="Edit clip"`.+- `TimelinePane.tsx:1340` — `aria-label="Remove clip"`.+- `TimelinePane.tsx:1270, :1280, :1301` — `aria-label="Adjust skip start…"`, `aria-label="Remove skip…"`, `aria-label="Adjust skip end…"`.+- `Modals.tsx:49` — `role="dialog"`.+- `Modals.tsx:65` — `aria-label="Close"`.+- `Modals.tsx:770` — `aria-label="Adjust clip start"`.+- `Modals.tsx:798` — `aria-label="Adjust clip end"`.+- `Bottombar.tsx` exposes `onDuplicateClip` via the keyboard shortcut (`Ctrl+C` / `Ctrl+V`) wired in `NewEditorShell.tsx`.++---++## Scenario 05.1 — Drag asset from Files list into timeline++**Setup**+1. Project is open with at least 1 asset in the Files list (from a previous recording or a previously-opened project).++**Steps**+1. Pointer-down on the asset row in the LeftPanel's Files section.+2. Drag into the timeline area. A drop indicator appears (a vertical line at the drop position).+3. Release the pointer over the empty area of the timeline (or over the existing clip block).++**Expected**+- A new clip appears at the drop position.+- If dropped on an existing clip: opens the `InsertSourceModal` (Add before / Add after / Split here and insert). Choose one.+- If dropped on empty timeline: creates a new clip starting at time 0 (or at the drop position if the timeline was non-empty).+- The preview loads the new clip.+- `data-clip-count` increases by 1.++---++## Scenario 05.2 — Click a clip to select++**Setup**+1. From scenario 05.1 state. Two clips exist.++**Steps**+1. Click on the first clip block. The clip border becomes mint.+2. Click on the second clip block. The first deselects; the second is highlighted.++**Expected**+- The selected clip has a visible mint border and a soft glow.+- Only one clip is selected at a time.+- Clicking on empty timeline area deselects all clips.++---++## Scenario 05.3 — Edit Clip dialog opens with embedded preview++**Setup**+1. From scenario 05.2 state. The second clip is selected.++**Steps**+1. Click the **Edit clip** pencil button on the clip block (`aria-label="Edit clip"`). The `EditClipModal` opens.+2. The modal shows:+ - Title: `Edit clip`.+ - Subtitle: the asset label.+ - Left: a small preview of the source range.+ - Right: start/end/duration readouts + a source-range track with draggable handles.++**Expected**+- The modal is centered with a backdrop.+- The preview plays the source range of the selected clip (not the full asset).+- The start/end readouts show the current `sourceStartSec` and `sourceEndSec`.+- The modal can be closed with `Esc`, the X button (`aria-label="Close"`), or backdrop click.++---++## Scenario 05.4 — Edit clip: drag the start handle++**Setup**+1. From scenario 05.3 state. The Edit Clip modal is open.++**Steps**+1. Locate the **start handle** (the left edge of the source-range track — `aria-label="Adjust clip start"`).+2. Pointer-down. Drag right by 60 px (~1 s).+3. Release.+4. The start readout updates.+5. Click `Apply` (or the equivalent confirm button).++**Expected**+- The preview's source start shifts right.+- The start readout in the modal reflects the new time.+- Clicking `Apply` closes the modal and updates the clip's `sourceStartSec` in the project.+- The clip block on the timeline does NOT change width (the source range shrunk but the timeline duration stayed the same).++---++## Scenario 05.5 — Edit clip: drag the end handle++**Setup**+1. Open the Edit Clip modal again for the same clip.++**Steps**+1. Locate the **end handle** (`aria-label="Adjust clip end"`). Drag left by 60 px.+2. Release. Click `Apply`.++**Expected**+- The clip's `sourceEndSec` decreases.+- The clip block's width does NOT change (timeline duration is preserved; source range shrunk).++---++## Scenario 05.6 — Edit clip: reset++**Setup**+1. From scenario 05.5 state. Open the modal again.++**Steps**+1. Drag the start handle right by 100 px.+2. Click `Reset` (if available).++**Expected**+- The clip's source range reverts to the full asset range.+- The start/end readouts reset.++---++## Scenario 05.7 — Drag-reorder clips++**Setup**+1. Project has 2 clips.++**Steps**+1. Pointer-down on the first clip block.+2. Drag right by 200 px. A vertical reorder marker appears at the drop position.+3. Release over the second clip's position.++**Expected**+- The clips swap order.+- The `timeline.clips` array reflects the new order.+- The timeline's `data-clip-count` is still `2`.+- The preview follows the new ordering.+- The drag threshold is 6 px (`CLIP_REORDER_THRESHOLD_PX = 6`) — moving less than 6 px is treated as a click.++---++## Scenario 05.8 — Duplicate clip via Ctrl+C / Ctrl+V++**Setup**+1. From scenario 05.7 state. One clip is selected.++**Steps**+1. Press `Ctrl+C` (or `Cmd+C` on macOS).+2. Press `Ctrl+V` (or `Cmd+V`).+3. Take a screenshot.++**Expected**+- A duplicate clip is inserted at the end of the timeline (or at the playhead position).+- The duplicate has a new `id` but the same `sourceStartSec` / `sourceEndSec` / `assetId` / `wordRefs`.+- `data-clip-count` increases by 1.++---++## Scenario 05.9 — Remove clip++**Setup**+1. From scenario 05.8 state. Three clips exist. Select one.++**Steps**+1. Click the **Remove clip** button on the clip block (`aria-label="Remove clip"`).+2. The clip is removed.++**Expected**+- `data-clip-count` decreases by 1.+- The preview does not crash.+- The timeline re-flows: any subsequent clips shift left to fill the gap.++---++## Scenario 05.10 — Multiple clips project flow++**Setup**+1. Drag 3 different assets into the timeline (or duplicate one twice).++**Steps**+1. Verify each clip block is rendered with a distinct color / label.+2. Click each clip in turn. Only one is highlighted at a time.+3. Reorder. The timeline visually swaps the clip blocks.+4. Duplicate the middle clip. There are now 4 clips.+5. Remove the first clip. There are now 3.++**Expected**+- Each clip block has its source range and asset label visible.+- Selection / reorder / duplicate / remove all work without crashing.+- The playhead survives all operations.+- The navigator strip updates its marker positions.++---++## Scenario 05.11 — Properties panel for selected clip++**Setup**+1. One clip is selected.++**Steps**+1. Open the right rail → **Properties** (or whichever pane shows selected-clip details).+2. The properties panel shows:+ - Asset label.+ - Source path.+ - Source start / end.+ - Timeline start / end.+ - Duration.++**Expected**+- The values match the clip's actual data.+- Editing a value (e.g. via an input field) updates the clip.+- Clicking **Deselect** (`aria-label="Deselect"`) clears the selection.++---++## Scenario 05.12 — Click on empty timeline deselects++**Setup**+1. A clip is selected.++**Steps**+1. Click on the empty area of the timeline (below the clip block).++**Expected**+- The selection is cleared.+- The properties panel shows the empty state.++---++## Scenario 05.13 — Keyboard shortcut: Delete selected region / clip++**Setup**+1. A clip is selected.++**Steps**+1. Press `Delete` or `Backspace`.++**Expected**+- The selected clip is removed.+- (Alternative: this shortcut may apply to selected regions only; if so, no clip is removed. Verify both behaviours.)++---++## Scenario 05.14 — Drop on a position outside any clip → create new clip at end++**Setup**+1. Project has 1 clip spanning the first 5 s.++**Steps**+1. Drag a new asset from the Files list and drop at the timeline's far right (past the existing clip).++**Expected**+- A new clip is appended at the end of the timeline (timeline start = previous clip's timeline end).++---++## Scenario 05.15 — Drop on a clip with a playhead inside it → InsertSourceModal++**Setup**+1. Project has 1 clip. The playhead is at the middle of the clip.++**Steps**+1. Drag a new asset from the Files list and drop over the existing clip's body.++**Expected**+- The `InsertSourceModal` appears with three options:+ - `Add before`+ - `Add after`+ - `Split here and insert`+- The preview shows the source asset's first frame.+- Press `Esc` to cancel; no clip is added.++---++## Scenario 05.16 — Insert source: split at playhead++**Setup**+1. From scenario 05.15 state. The playhead is at 3 s. The clip is 5 s long.++**Steps**+1. In the InsertSourceModal, click `Split here and insert`.+2. The modal closes.++**Expected**+- The original clip is split at 3 s:+ - Clip A: source 0 s → 3 s, timeline 0 s → 3 s.+ - New clip (inserted): source 0 s → full asset duration, timeline 3 s → 3 + duration.+ - Clip B (the tail): source 3 s → 5 s, timeline 3 + duration → 3 + duration + 2.+- Total clip count = 3.++---++## Scenario 05.17 — Cursor changes per region mode++**Setup**+1. Hover the timeline viewport.++**Steps**+1. Hover an empty area → cursor is `default` or `pointer`.+2. Hover a clip block → cursor is `pointer` (selectable).+3. Hover a skip handle → cursor is `ew-resize`.+4. Hover a region pill (zoom/speed/annotation) → cursor is `grab`.++**Expected**+- The cursor reflects the interaction mode.+- The body has the appropriate class (`timeline-scrubbing` etc.).++---++## Scenario 05.18 — Active-clip indicator in the timeline header++**Setup**+1. Multiple clips exist. The playhead is inside clip 2.++**Steps**+1. Read the timeline header.++**Expected**+- The header shows `Clip 2/3` (or similar).++---++## Scenario 05.19 — Clip total duration readout++**Setup**+1. Project has 3 clips of 5 s, 3 s, 7 s.++**Steps**+1. Read the timeline header.++**Expected**+- The total duration readout shows `0:15` (or `0:15.0` depending on format).++---++## Cross-cutting checks for this block++- Every clip operation updates `data-clip-count` correctly.+- The selection state survives `data-*` attribute changes.+- The properties panel is empty when no clip is selected.++**Next:** proceed to [`06-skip-regions.md`](06-skip-regions.md).\ No newline at end of filediff --git a/specs/computer-use/06-skip-regions.md b/specs/computer-use/06-skip-regions.mdnew file mode 100644index 000000000..a2fd740cb--- /dev/null+++ b/specs/computer-use/06-skip-regions.md@@ -0,0 +1,322 @@+# 06 — Skip regions++**Surface:** `TimelinePane` (skip lane), `Bottombar` (scissors button + `T` shortcut), `RegionTimeline`, `useTimeline` store, `useEditorHistory`.+**Prerequisites:** `02-editor-foundation.md`, `04-timeline-pan-zoom-scrub.md`, `05-clip-operations.md`.++**Goal of this block:** prove skip regions (the most-used edit operation) work end-to-end: add, resize, remove, place-via-mode, with snap guides and floating tooltips.++**Reference:**+- roadmap P0 row T15 (`8c80a5c`) — Place skip + marker.+- roadmap P0 row T24/T25 (`07d868c`) — snap-guide + drag tooltip.+- roadmap P2 row F2.6 / F2.7 (`01d6b46`) — snap-guide + tooltip + multi-select.+- `TimelinePane.tsx:1270, :1280, :1301` — `aria-label="Adjust skip start…"`, `"Remove skip…"`, `"Adjust skip end…"`.+- `Bottombar.tsx:9` — `Scissors` icon import.+- `TimelinePane.tsx:1489-1501` — Magic Wand toggle (different from place-skip).+- `TimelinePane.tsx:1515-1523` — Scissors button.++---++## Scenario 06.1 — Add skip via the Scissors button (bottombar)++**Setup**+1. Project has 1 clip of ≥ 5 s. No skips exist.++**Steps**+1. The playhead is at some position (e.g. `2 s`). The bottombar's Scissors button is visible.+2. Click the **Scissors** button.+3. Wait 200 ms. The playhead is now surrounded by a skip range.++**Expected**+- A skip region is added at the playhead position with a default length of `Math.max(1000, totalMs * 0.05)` (≥ 1 s, ~5% of total).+- `data-skip-count` is now `1`.+- The skip is rendered as a red segment in the timeline's clip block (with hatch pattern).+- The skip lane (above the timeline header) shows the skip as a red pill.++---++## Scenario 06.2 — Place skip mode (T key)++**Setup**+1. From scenario 06.1 state. Reset by deleting the skip (see 06.6).++**Steps**+1. Press `T` on the keyboard.+2. The body class is `timeline-placing-cut`. The cursor is `crosshair`.+3. A red vertical marker appears at the playhead position.+4. Move the mouse over the ruler. The marker follows the cursor.+5. Click on the ruler at a position different from the playhead (e.g. 50% of the clip).+6. A new skip is created at the click position.+7. Press `Esc` while in place-skip mode. The mode disarms; no skip is created.++**Expected**+- `T` arms the mode.+- The marker is visible at the playhead before any click.+- Click on the ruler creates a 1 s skip at the click position.+- `Esc` disarms.+- `data-skip-count` increments by 1 after the click.++---++## Scenario 06.3 — Resize skip: drag the left handle++**Setup**+1. Project has 1 skip range (from 06.1 or 06.2).++**Steps**+1. Hover the skip region in the timeline. The skip-hover-controls appear above the skip (`‹`, trash, `›`).+2. Click the **left** handle (`aria-label="Adjust skip start at …"`). Drag right by 60 px.+3. During the drag:+ - A vertical snap-guide line appears at the new edge.+ - A floating tooltip shows the new `startSec → endSec` in `M:SS.s` format.+4. Release.++**Expected**+- The skip's `startSec` increases.+- The tooltip disappears on release.+- The snap-guide disappears on release.+- The skip region updates in the project state.+- The preview's playback skips the new range correctly.++---++## Scenario 06.4 — Resize skip: drag the right handle++**Setup**+1. From scenario 06.3 state. A skip exists.++**Steps**+1. Click the **right** handle (`aria-label="Adjust skip end at …"`). Drag left by 80 px.+2. During the drag, the snap-guide and tooltip appear (mirrored at the right edge).+3. Release.++**Expected**+- The skip's `endSec` decreases.+- The tooltip shows the new range.+- The preview plays the new shorter skip.++---++## Scenario 06.5 — Edge clamp preserves a minimum width++**Setup**+1. From scenario 06.4 state.++**Steps**+1. Drag the right handle **past** the left handle (attempt to flip the skip or shrink to zero).++**Expected**+- The skip's effective width is clamped to ~50 ms.+- The preview does not crash.+- No negative `endSec` is written.++---++## Scenario 06.6 — Remove skip via the trash button++**Setup**+1. Project has 1 skip range.++**Steps**+1. Hover the skip region. The hover controls appear.+2. Click the trash button (`aria-label="Remove skip …"`).++**Expected**+- The skip is removed.+- `data-skip-count` returns to `0`.+- The preview plays the full clip without skipping.++---++## Scenario 06.7 — Skip range survives zoom changes++**Setup**+1. Project has 1 skip range. Zoomed to fit.++**Steps**+1. Ctrl+wheel up 5 notches. The timeline zooms in.+2. Read `data-skip-count`. The skip is still rendered at the correct source time.++**Expected**+- The skip's screen position scales with `pxPerSec`.+- The skip's source time is unchanged.+- Hover controls still work at the new zoom level.++---++## Scenario 06.8 — Skip range survives pan++**Setup**+1. From scenario 06.7 state. Zoomed in, the skip is visible.++**Steps**+1. Pan the viewport left by 200 px.+2. The skip's screen position moves with the pan.++**Expected**+- The skip is at the correct source time even when scrolled out of view.+- Scrolling back reveals the skip unchanged.++---++## Scenario 06.9 — Two skips on the same clip cannot overlap++**Setup**+1. Project has 1 clip of ≥ 10 s. No skips.++**Steps**+1. Add a skip at 2 s–4 s (via Scissors or T).+2. Try to add a second skip at 3 s–5 s.+3. The second skip is **clamped** to not overlap the first.++**Expected**+- The second skip's effective range is `4 s → ?` (starts where the first ends).+- If you drag the second skip's left edge into the first skip, it is clamped to the first skip's `endSec`.+- The drag tooltip shows the clamped range.++---++## Scenario 06.10 — Skip across clip boundaries (skip spanning two clips)++**Setup**+1. Project has 2 clips back-to-back.++**Steps**+1. Drag a skip region from inside clip 1 across the boundary into clip 2.++**Expected**+- The skip spans both clips in the timeline visualisation.+- During playback, the preview skips the range across the boundary.+- The skip's `startSec` and `endSec` are in **timeline time** (not source time), per the data model.++---++## Scenario 06.11 — Skip shows in the navigator strip++**Setup**+1. Project has 1 skip range.++**Steps**+1. Look at the navigator strip (`aria-label="Timeline zoom and pan navigator"`).++**Expected**+- A red dash mark at the skip's source time position.++---++## Scenario 06.12 — Snap-guide appears during region drag (P2 F2.6)++**Setup**+1. Project has 1 skip range.++**Steps**+1. Drag the right handle of the skip.+2. Observe the timeline ruler.++**Expected**+- Two vertical lines (snap-guide) appear at the start and end of the moving skip.+- They are 2 px wide, red (`--danger` color), positioned at the edge of the skip in the ruler.++---++## Scenario 06.13 — Floating drag tooltip during region drag (P2 F2.6)++**Setup**+1. From scenario 06.12 state.++**Steps**+1. While dragging, observe the floating tooltip.++**Expected**+- A small pill appears next to the moving edge.+- It shows the time range in `M:SS.s → M:SS.s` format (e.g. `0:02.1 → 0:04.5`).+- The tooltip disappears on release.++---++## Scenario 06.14 — Multi-select skip regions (P2 F2.7)++**Setup**+1. Project has 2 non-overlapping skips.++**Steps**+1. Click on the first skip. It is selected (highlighted).+2. Shift-click on the second skip. Both are now selected.+3. Press `Delete`.++**Expected**+- Both skips are removed.+- `data-skip-count` returns to `0`.++---++## Scenario 06.15 — Skip clip + delete via keyboard++**Setup**+1. Project has 1 skip range. The skip is selected (clicked).++**Steps**+1. Press `Delete` or `Backspace`.+2. The skip is removed.++**Expected**+- The skip is removed without needing to hover for the trash button.++---++## Scenario 06.16 — Skip respects `useEditorHistory` undo/redo++**Setup**+1. Project has 1 skip range.++**Steps**+1. Press `Ctrl+Z` (or `Cmd+Z`).+2. The skip is removed.+3. Press `Ctrl+Shift+Z` (or `Cmd+Shift+Z`).+4. The skip returns.++**Expected**+- Undo restores the previous state.+- Redo re-applies the removal.++---++## Scenario 06.17 — Skip waveform background (audio peaks)++**Setup**+1. Project has a clip with audio.++**Steps**+1. Zoom into the timeline so the skip row is visible.+2. The skip row shows an audio waveform (the `BackgroundWaveform` component).++**Expected**+- The waveform is rendered behind the skip pills.+- The waveform scales with the zoom level.+- The waveform is drawn from `useAudioPeaks.ts` (a worker).++---++## Scenario 06.18 — Skip range that covers the entire clip++**Setup**+1. Project has 1 clip of 5 s. No skips.++**Steps**+1. Resize the skip's left handle to the very left edge of the clip.+2. Resize the right handle to the very right edge.++**Expected**+- The skip covers the entire clip.+- During playback, the preview shows no frames (skip dominates).+- The exporter output is empty for this clip.++---++## Cross-cutting checks for this block++- Every skip operation triggers a `data-skip-count` change.+- The skip pill's screen position is always `startSec * pxPerSec` from the timeline's left edge.+- Hover controls are only visible on hover (no always-on state).+- The skip's color is `--danger` red.++**Next:** proceed to [`07-zoom-regions.md`](07-zoom-regions.md).\ No newline at end of filediff --git a/specs/computer-use/07-zoom-regions.md b/specs/computer-use/07-zoom-regions.mdnew file mode 100644index 000000000..7356707bb--- /dev/null+++ b/specs/computer-use/07-zoom-regions.md@@ -0,0 +1,289 @@+# 07 — Zoom regions++**Surface:** `TimelinePane` (zoom lane), `Bottombar` (`ZoomIn` button), `RightPanes` (zoom region inspector), `RightPanelStack`, `useTimeline` store, `zoomSuggestions.ts` (Magic Wand).+**Prerequisites:** `02-editor-foundation.md`, `04-timeline-pan-zoom-scrub.md`, `05-clip-operations.md`, `06-skip-regions.md` (so the timeline has regions visible).++**Goal of this block:** prove the zoom-region model — depth (1×–6×), focus point, rotation presets, and the Magic Wand auto-suggestion.++**Reference:**+- `types.ts:71` — `ZoomRegion { id, startMs, endMs, depth, focus: ZoomFocus, focusMode?, rotationPreset?, customScale?, source?: "auto"|"manual" }`.+- `types.ts:34-58` — `Rotation3D { rotationX, rotationY, rotationZ }` + presets `iso/left/right`.+- `types.ts:400-407` — `ZOOM_DEPTH_SCALES: Record<ZoomDepth, number>` (`1.25x → 5.0x`).+- `Bottombar.tsx` exposes `onAddZoom` via the ZoomIn button.+- roadmap F2.1 (`58feb34`) — Magic Wand suggestions wired to the disabled "Magic" button.+- roadmap F2.2 — Region inspector font family / animation (annotation, not zoom — but the inspector surface is shared).++---++## Scenario 07.1 — Add zoom region via ZoomIn button++**Setup**+1. Project has 1 clip of ≥ 5 s. The playhead is at some position (e.g. 1 s).++**Steps**+1. Click the **ZoomIn** button in the bottombar's view-tools cluster.+2. Wait 200 ms.++**Expected**+- A zoom region is added at the playhead position with a default length (matches the place-skip default).+- Default depth is `2` (2.0×).+- Default focus is the centre of the frame (`{ cx: 0.5, cy: 0.5 }`).+- Default rotation is identity.+- `zoomRanges.length` is now `1`.+- The zoom pill is rendered in the zoom lane (below the clip track) in mint color.+- The preview at the zoom range shows the zoomed-in frame.++---++## Scenario 07.2 — Cycle zoom depth++**Setup**+1. From scenario 07.1 state. A zoom region is selected.++**Steps**+1. Click the zoom region. The inspector panel opens.+2. The depth selector shows a row of buttons or a slider: `1×`, `2×`, `3×`, `4×`, `5×`, `6×`.+3. Click `4×`. The zoom factor changes.+4. Click `1×`. Reverts.++**Expected**+- The preview updates immediately to show the new zoom level.+- The depth value is saved to the region's `depth` field.+- The zoom lane pill may change visual appearance (e.g. taller pill, brighter border) as depth increases.++---++## Scenario 07.3 — Drag the focus point++**Setup**+1. From scenario 07.2 state. A zoom region with depth 3× is selected.++**Steps**+1. The inspector shows a mini-preview of the frame with a focus-point dot.+2. Drag the focus dot from centre to upper-left.+3. Release.++**Expected**+- The region's `focus` is updated: `{ cx: ~0.25, cy: ~0.25 }`.+- The preview at the zoom range pans to follow the new focus point.++---++## Scenario 07.4 — Apply rotation preset (iso)++**Setup**+1. From scenario 07.3 state.++**Steps**+1. The inspector shows a rotation preset selector: `none`, `iso`, `left`, `right`.+2. Click `iso`.++**Expected**+- The preview rotates to the iso angle (3D rotation around X + Y axes).+- The region's `rotationPreset` is set to `iso`.+- The 3D rotation's drop shadow re-applies after rotation.++---++## Scenario 07.5 — Apply rotation preset (left, right)++**Setup**+1. From scenario 07.4 state.++**Steps**+1. Click `left`. The frame tilts left.+2. Click `right`. The frame tilts right.+3. Click `none`. The rotation reverts.++**Expected**+- Each preset transitions smoothly.+- The visual matches `Rotation3D` values for the preset.++---++## Scenario 07.6 — Magic Wand suggests zoom regions++**Setup**+1. Project has 1 clip with a transcript (auto-transcribed — see 11.x).+2. No zoom regions exist.++**Steps**+1. Click the **Magic** (WandSparkles) button in the bottombar's view-tools.+2. Wait for the suggestions to be applied (async).++**Expected**+- One or more zoom regions are added to the project.+- The regions correspond to low-amplitude / sustained-speech segments (`zoomSuggestions.ts` heuristic).+- `zoomRanges.length` increases.+- The total duration covered by the new regions is < the total clip duration (the heuristic only adds zooms over selected segments).++---++## Scenario 07.7 — Auto-Focus toggle++**Setup**+1. From scenario 07.6 state. Magic Wand has added zoom regions.++**Steps**+1. Click the **Auto-Focus** toggle (`ScanEye` icon) in the bottombar.+2. The toggle's pressed state shows.+3. Play the timeline.++**Expected**+- The focus point of the zoom regions is now driven by `cursorFollowUtils.advanceFollowFocus` (smooth follow of the recorded cursor).+- The cursor follows the recorded cursor position within the zoomed-in region.+- Toggle off → focus returns to the static `focus` field of each region.++---++## Scenario 07.8 — Resize a zoom region++**Setup**+1. Project has 1 zoom region.++**Steps**+1. Drag the left handle of the zoom pill right by 40 px.+2. Drag the right handle left by 40 px.++**Expected**+- The region's `startMs` / `endMs` change.+- The preview at the new range shows the zoom.+- The snap-guide and tooltip appear during the drag (same as skip regions, P2 F2.6).++---++## Scenario 07.9 — Remove a zoom region++**Setup**+1. Project has 1 zoom region, selected.++**Steps**+1. Click the trash button on the zoom pill OR press `Delete`.++**Expected**+- The zoom region is removed.+- `zoomRanges.length` decreases.++---++## Scenario 07.10 — Multiple zoom regions on the same clip++**Setup**+1. Add 3 zoom regions at different positions.++**Steps**+1. Verify all 3 are rendered in the zoom lane.+2. Select each in turn. The inspector shows the correct depth / focus / rotation.++**Expected**+- Zoom pills do not overlap (the timeline prevents overlapping zoom regions).+- Each region has independent settings.++---++## Scenario 07.11 — Zoom region spanning clip boundaries++**Setup**+1. Project has 2 clips back-to-back.++**Steps**+1. Drag a zoom region from inside clip 1 to span into clip 2.++**Expected**+- The zoom pill spans the boundary.+- During playback, the preview shows the zoom across both clips' content.++---++## Scenario 07.12 — Zoom region snap-to-clip-boundary++**Setup**+1. Project has 2 clips. A zoom region's right edge is being dragged.++**Steps**+1. Drag the right edge close to the boundary between clip 1 and clip 2.++**Expected**+- A snap-guide line appears at the boundary.+- On release, if the edge is within the snap threshold, it snaps to the boundary.++---++## Scenario 07.13 — Zoom region survives skip region add++**Setup**+1. Project has 1 zoom region. No skips.++**Steps**+1. Add a skip range overlapping the zoom region.++**Expected**+- The skip and zoom coexist (they are independent dimensions).+- During playback, the skip cuts out the range; the zoom does not apply during the cut.++---++## Scenario 07.14 — Zoom region undo / redo++**Setup**+1. Project has 1 zoom region.++**Steps**+1. Press `Ctrl+Z`. The zoom region is removed.+2. Press `Ctrl+Shift+Z`. It returns.++**Expected**+- Undo / redo work for zoom regions.++---++## Scenario 07.15 — Zoom region depth displayed in the pill label++**Setup**+1. Project has 1 zoom region with depth `3×`.++**Steps**+1. Look at the zoom pill's text content.++**Expected**+- The pill shows `3.0×` or `3×` (the zoom factor).++---++## Scenario 07.16 — Zoom in preview does not affect timeline ruler++**Setup**+1. Project has 1 zoom region. The preview shows the zoomed-in frame.++**Steps**+1. Take a screenshot of the timeline ruler.++**Expected**+- The timeline ruler still shows the source times (unaffected by the preview zoom).+- The clip block widths are unchanged.++---++## Scenario 07.17 — Camera zoom follows cursor (when Auto-Focus is on)++**Setup**+1. Auto-Focus is on (scenario 07.7).+2. Project was recorded with the cursor moving.+3. Play from a position with cursor motion inside a zoom region.++**Steps**+1. Watch the preview.++**Expected**+- The zoomed-in frame tracks the cursor smoothly.+- The motion is identical between preview and export (spring smoothing shared).++---++## Cross-cutting checks for this block++- `zoomRanges.length` is always reflected in the zoom lane.+- The inspector shows the selected region's settings accurately.+- Zoom regions are mint-colored (per design token `--accent`).++**Next:** proceed to [`08-speed-regions.md`](08-speed-regions.md).\ No newline at end of filediff --git a/specs/computer-use/08-speed-regions.md b/specs/computer-use/08-speed-regions.mdnew file mode 100644index 000000000..12ffebae9--- /dev/null+++ b/specs/computer-use/08-speed-regions.md@@ -0,0 +1,214 @@+# 08 — Speed regions++**Surface:** `TimelinePane` (speed lane), `Bottombar` (add-speed button), `RightPanes` (speed region inspector), `useTimeline` store.+**Prerequisites:** `02-editor-foundation.md`, `04-timeline-pan-zoom-scrub.md`, `05-clip-operations.md`, `06-skip-regions.md`.++**Goal of this block:** prove speed regions can be added, configured (0.1×–16×), and removed, and that they actually change playback speed during preview.++**Reference:**+- `types.ts:368-396` — `PlaybackSpeed = number` (MIN 0.1, MAX 16), `SpeedRegion { id, startMs, endMs, speed }`, `SPEED_OPTIONS`.+- `SPEED_OPTIONS` includes values like `0.25, 0.5, 1, 1.5, 2, 4`.+- Design token `--speed` (`#f97316` orange) and `--speed-soft`.++---++## Scenario 08.1 — Add speed region++**Setup**+1. Project has 1 clip of ≥ 5 s. The playhead is at some position.++**Steps**+1. Click the **Add Speed** button in the bottombar (icon next to ZoomIn and Add Annotation — implementation-specific; the exact button is in `Bottombar.tsx`).+2. Wait 200 ms.++**Expected**+- A speed region is added at the playhead position with the default length.+- Default speed is `2` (2×) — verify via the inspector.+- The pill is rendered in the speed lane in **orange** (`--speed` color).+- `speedRanges.length` is now `1`.++---++## Scenario 08.2 — Change speed via slider++**Setup**+1. From scenario 08.1 state. Speed region is selected.++**Steps**+1. The inspector shows a speed slider (range `0.1` to `16`, step `0.1`).+2. Drag the slider to `4`.+3. The pill label updates to `4.0×`.++**Expected**+- The region's `speed` is `4`.+- The preview at the speed range plays 4× faster.+- The pill label updates.++---++## Scenario 08.3 — Change speed via preset selector++**Setup**+1. From scenario 08.2 state.++**Steps**+1. The inspector also has a preset dropdown with `0.25×, 0.5×, 1×, 1.5×, 2×, 4×`.+2. Click `0.5×`.++**Expected**+- The slider moves to `0.5`.+- The pill label updates to `0.5×`.+- The preview at the range plays at half speed.++---++## Scenario 08.4 — Playback at very slow speed (0.1×)++**Setup**+1. From scenario 08.3 state. Speed set to `0.1`.++**Steps**+1. Play the timeline.++**Expected**+- The preview plays 10× slower than real time.+- Audio is slowed (chipmunk if it's a vocal recording; or pitch-shifted — verify the audio is recognisable).+- No playback glitches.++---++## Scenario 08.5 — Playback at fast speed (8×)++**Setup**+1. Set the speed to `8` via the slider.++**Steps**+1. Play the timeline.++**Expected**+- The preview plays 8× faster than real time.+- Audio is sped up (or muted, implementation choice).++---++## Scenario 08.6 — Resize speed region++**Setup**+1. Speed region exists.++**Steps**+1. Drag the left handle right by 30 px.+2. Drag the right handle left by 50 px.++**Expected**+- The region's `startMs` / `endMs` change.+- The snap-guide and tooltip appear during the drag.+- The preview's playback duration at the new range is `originalDuration / speed`.++---++## Scenario 08.7 — Remove speed region++**Setup**+1. Speed region is selected.++**Steps**+1. Click the trash button or press `Delete`.++**Expected**+- The region is removed.+- `speedRanges.length` decreases.++---++## Scenario 08.8 — Multiple speed regions++**Setup**+1. Add 3 speed regions with speeds `0.5, 2, 4`.++**Steps**+1. Each pill shows the correct speed.+2. Play the timeline.++**Expected**+- The preview plays at `0.5×`, then `2×`, then `4×` as the playhead crosses each region.+- The transitions are smooth (or abrupt, depending on implementation — verify there's no audio glitch).++---++## Scenario 08.9 — Speed + skip coexist++**Setup**+1. Project has a speed region and a skip region overlapping.++**Steps**+1. Play the timeline.++**Expected**+- During the overlap, the skip applies first (cuts out the range), then the speed is irrelevant.+- Outside the overlap, the speed applies normally.++---++## Scenario 08.10 — Speed + zoom coexist++**Setup**+1. Speed region and zoom region overlap.++**Steps**+1. Play the timeline.++**Expected**+- The zoom applies throughout the speed region's range.+- The frame motion is at the speed factor.++---++## Scenario 08.11 — Speed region survives zoom in timeline++**Setup**+1. Speed region exists. Zoom out to fit.++**Steps**+1. Ctrl+wheel up to zoom in 5×.++**Expected**+- The speed pill scales with `pxPerSec`.+- Its source-time position is unchanged.++---++## Scenario 08.12 — Speed region undo/redo++**Setup**+1. Speed region exists.++**Steps**+1. Press `Ctrl+Z`. Region removed.+2. Press `Ctrl+Shift+Z`. Region returns.++**Expected**+- Undo / redo work.++---++## Scenario 08.13 — Speed pill label format++**Setup**+1. Speed region with speed `1.5`.++**Steps**+1. Read the pill text.++**Expected**+- The pill shows `1.5×` (the format depends on the implementation; it may be `1.5x` or `1.5×`).++---++## Cross-cutting checks for this block++- `speedRanges.length` reflects all visible speed pills.+- The pill color is consistent (orange / `--speed`).+- The speed value is always within `[0.1, 16]`.++**Next:** proceed to [`09-annotation-regions.md`](09-annotation-regions.md).\ No newline at end of filediff --git a/specs/computer-use/09-annotation-regions.md b/specs/computer-use/09-annotation-regions.mdnew file mode 100644index 000000000..373060673--- /dev/null+++ b/specs/computer-use/09-annotation-regions.md@@ -0,0 +1,300 @@+# 09 — Annotation regions: text, image, figure, blur++**Surface:** `TimelinePane` (annotation lane), `Bottombar` (add-annotation button), `RightPanes` (annotation inspector), `annotationRenderer.ts`.+**Prerequisites:** `02-editor-foundation.md`, `04-timeline-pan-zoom-scrub.md`, `05-clip-operations.md`, `06-skip-regions.md`.++**Goal of this block:** prove all four annotation kinds work — text (with font family / animation), image (custom image), figure (rectangle / circle / arrow), and blur (rect / freehand with intensity). Each is rendered in the preview at the right time and position.++**Reference:**+- `types.ts:217-303` — `AnnotationType = "text"|"image"|"figure"|"blur"`, `ArrowDirection`, `FigureData`, `BlurShape`, `BlurType`, `BlurColor`, `BlurData`, `MIN_BLUR_INTENSITY/MAX_BLUR_INTENSITY`, `AnnotationRegion`.+- roadmap F2.2 (`58feb34`) — annotation font family + animation fields.+- roadmap F2.3 — figure/blur advanced fields (color, mosaic, radius, arrow direction).+- Design tokens `--annotation` (`#eab308` yellow / `#fbbf24` on dark) and `--annotation-soft`.++---++## Scenario 09.1 — Add text annotation++**Setup**+1. Project has 1 clip of ≥ 5 s. Playhead at some position.++**Steps**+1. Click the **Add Annotation** button in the bottombar.+2. An annotation region is added (default type is `text`).++**Expected**+- An annotation pill appears in the annotation lane in **yellow** (`--annotation` color).+- A text overlay is rendered on the preview at the region's range.+- Default text: `New annotation`.+- Default position: lower-third bar (per the design).+- `annotations.length` is now `1`.++---++## Scenario 09.2 — Edit text content++**Setup**+1. From scenario 09.1 state. Annotation selected.++**Steps**+1. The inspector shows a text input.+2. Click in the input. Clear it. Type `Hello world`.+3. Click outside to commit.++**Expected**+- The text overlay on the preview updates to `Hello world`.+- The pill label updates.++---++## Scenario 09.3 — Change font family++**Setup**+1. From scenario 09.2 state.++**Steps**+1. The inspector has a font-family selector: `Inter`, `Mono`, `Serif` (per roadmap F2.2).+2. Click `Mono`.++**Expected**+- The text overlay switches to the Mono font (Fira Code or similar).+- The font choice is saved to the annotation's `style.fontFamily`.++---++## Scenario 09.4 — Change animation++**Setup**+1. From scenario 09.3 state.++**Steps**+1. The inspector has an animation selector: `none`, `fade`, `pulse`.+2. Click `fade`.++**Expected**+- The text fades in at the start of the region and fades out at the end.+- The animation choice is saved to the annotation's `style.animation`.++---++## Scenario 09.5 — Move annotation position++**Setup**+1. Text annotation selected.++**Steps**+1. The inspector has X/Y fields (or the preview has a draggable handle on the text).+2. Drag the text to the upper-right corner of the preview.++**Expected**+- The text overlay moves to the new position.+- The region's `position` is updated.++---++## Scenario 09.6 — Resize annotation region (time)++**Setup**+1. Text annotation exists.++**Steps**+1. Drag the left handle right by 30 px.+2. Drag the right handle left by 50 px.++**Expected**+- The region's `startMs` / `endMs` change.+- The preview shows the text only during the new range.++---++## Scenario 09.7 — Add image annotation++**Setup**+1. From scenario 09.6 state. Reset or remove the text annotation.++**Steps**+1. In the inspector, change the annotation kind to `image` (or via a separate "Add image annotation" button).+2. Upload an image (PNG / JPG). Use a small sample image (e.g. `tests/fixtures/sample.png`).+3. Position and resize the image.++**Expected**+- The image is overlaid on the preview at the region's range.+- The region's `imageContent` field is populated with the uploaded image (data URL or path).++---++## Scenario 09.8 — Add figure annotation (rectangle)++**Setup**+1. From scenario 09.7 state.++**Steps**+1. In the inspector, change the kind to `figure`.+2. Select shape: `rectangle`.+3. Choose a fill color (color picker, default `#ff5f57` or similar).++**Expected**+- A rectangle is drawn on the preview at the region's range.+- The rectangle is filled with the chosen color.++---++## Scenario 09.9 — Add figure annotation (arrow)++**Setup**+1. From scenario 09.8 state.++**Steps**+1. Select shape: `arrow`.+2. Select direction: `up`, `down`, `left`, `right`, or any of the 8 directions (`ArrowDirection`).+3. Choose color.++**Expected**+- An arrow is drawn pointing in the chosen direction.+- The arrow's color matches the picker.++---++## Scenario 09.10 — Add blur annotation (rectangle)++**Setup**+1. From scenario 09.9 state.++**Steps**+1. Change kind to `blur`.+2. Select shape: `rectangle`.+3. Adjust intensity (slider, range `MIN_BLUR_INTENSITY` to `MAX_BLUR_INTENSITY`).++**Expected**+- A blurred rectangle is overlaid on the preview at the region's range.+- The blur intensity affects the pixelation level.++---++## Scenario 09.11 — Add blur annotation (freehand)++**Setup**+1. From scenario 09.10 state.++**Steps**+1. Select shape: `freehand`.+2. Draw a freehand path on the preview (pointer-down, drag, release).+3. The freehand path is captured (`DEFAULT_BLUR_FREEHAND_POINTS`).++**Expected**+- The freehand path is blurred on the preview.+- The path's control points are saved to the region's `figureData` (or `blurData`).++---++## Scenario 09.12 — Adjust blur radius / mosaic size++**Setup**+1. From scenario 09.10 state. Blur annotation selected.++**Steps**+1. The inspector has a **blur radius** slider.+2. Drag the slider to its maximum.+3. Drag to its minimum.++**Expected**+- The blur on the preview becomes more / less intense.+- The mosaic size slider (if present) controls the pixelation step.++---++## Scenario 09.13 — Change annotation color++**Setup**+1. A figure annotation is selected.++**Steps**+1. Click the color picker. Pick a new color (e.g. mint `#10b981`).+2. Confirm.++**Expected**+- The figure's fill color updates.+- The region's `figureData.color` is updated.++---++## Scenario 09.14 — Multiple annotation kinds coexist++**Setup**+1. Add one of each: text, image, figure, blur.++**Steps**+1. Play the timeline.++**Expected**+- Each annotation renders at its own range / position.+- They do not conflict (each has its own z-index; the latest-added is on top, or z-index is configurable).++---++## Scenario 09.15 — Annotation survives clip operations++**Setup**+1. Add an annotation. Then reorder / remove a clip.++**Steps**+1. Reorder the clip.+2. Remove a different clip.++**Expected**+- The annotation's `startMs` / `endMs` shift with the timeline duration (if a preceding clip is removed).+- The annotation does NOT disappear unless explicitly removed.++---++## Scenario 09.16 — Annotation undo/redo++**Setup**+1. Annotation exists.++**Steps**+1. Press `Ctrl+Z`. Removed.+2. Press `Ctrl+Shift+Z`. Returns.++**Expected**+- Undo / redo work.++---++## Scenario 09.17 — Annotation z-order++**Setup**+1. Two annotations exist with overlapping time ranges.++**Steps**+1. The later-added (or higher `zIndex`) annotation is rendered on top.++**Expected**+- The visual stacking matches the `zIndex` field.++---++## Scenario 09.18 — Auto-caption annotations++**Setup**+1. Project has a transcript (auto-generated via 11.x).+2. Auto-caption annotations have been generated.++**Steps**+1. Verify the annotations are present in the annotation lane.+2. Their kind is `text`, source is `auto-caption`.++**Expected**+- The auto-captions are styled as a lower-third bar (per `annotationsFromCaptions.ts:9-13`).+- They do not conflict with manual annotations.++---++## Cross-cutting checks for this block++- `annotations.length` reflects all visible pills.+- The pill color is consistently yellow (`--annotation`).+- Each annotation kind renders correctly in the preview.+- The inspector adapts to the selected annotation's kind.++**Next:** proceed to [`10-properties-right-panel.md`](10-properties-right-panel.md).\ No newline at end of filediff --git a/specs/computer-use/10-properties-right-panel.md b/specs/computer-use/10-properties-right-panel.mdnew file mode 100644index 000000000..bc510515b--- /dev/null+++ b/specs/computer-use/10-properties-right-panel.md@@ -0,0 +1,472 @@+# 10 — Properties right panel: background, layout, camera, cursor, effects++**Surface:** `RightPanes`, `RightPanelStack`, `RightRail`, `CropModal`.+**Prerequisites:** `02-editor-foundation.md`.++**Goal of this block:** prove every pane in the right rail works — Background (image / gradient / color / custom), Layout (aspect / padding / radius / shadow / blur / motion-blur), Camera (shape / size / position / mirrored / reactive), Cursor (theme / size / smoothing / motion-blur / click-bounce / clip), Effects, plus the per-pane Help popover (roadmap P3.3).++**Reference:**+- design `openscreen-editor.html` — `.bg-grid`, `.gradient-grid`, `.color-grid`, `.upload-btn`, `.shape-grid`, `.slider-grid`, `.cursor-grid`, `.crop-stage`.+- `RightPanes.tsx:53` — `aria-label={helpLabel ?? "Help"}`.+- `RightPanes.tsx:63` — popover `role="note"`.+- `RightPanes.tsx:223` — `aria-label="Custom wallpaper"`.+- `RightPanes.tsx:236` — `aria-label={`Background ${i + 1}`}`.+- `RightPanes.tsx:259` — `aria-label={`Gradient ${i + 1}`}`.+- `RightPanes.tsx:315` — `aria-label={`Color ${c}`}`.+- roadmap P3.3 (`76d78db`) — Help button wired to contextual popover.++---++## Scenario 10.1 — Open the right panel (Background pane)++**Setup**+1. Project is open. The right rail is visible; the right panel is collapsed by default.++**Steps**+1. Click the **Background** button on the right rail (the leftmost button — folder / image icon).+2. The right panel opens, showing the Background pane.++**Expected**+- The right panel slides in (or appears instantly).+- The Background pane contains:+ - A grid of image backgrounds (4 columns).+ - A grid of gradient backgrounds (4 columns).+ - A grid of color backgrounds.+ - An `Upload` button to import a custom image.+- The active background (current selection) has a mint border (`.is-active` state).++---++## Scenario 10.2 — Pick an image background++**Setup**+1. From scenario 10.1 state.++**Steps**+1. Click any image background in the grid.++**Expected**+- The preview's background wallpaper updates immediately.+- The selected background has the mint border (`.is-active`).+- The project's `wallpaper` field is updated.++---++## Scenario 10.3 — Pick a gradient background++**Setup**+1. From scenario 10.2 state.++**Steps**+1. Click any gradient background.++**Expected**+- The preview's background swaps to a CSS gradient.+- The selection state updates.++---++## Scenario 10.4 — Pick a color background++**Setup**+1. From scenario 10.3 state.++**Steps**+1. Click any color background in the color grid.++**Expected**+- The preview's background is the chosen solid color.+- The selection updates.++---++## Scenario 10.5 — Upload custom wallpaper++**Setup**+1. From scenario 10.4 state.++**Steps**+1. Click the **Upload** button.+2. Pick an image file from the system file picker (e.g. `tests/fixtures/sample.png`).++**Expected**+- The uploaded image appears in the preview as the background.+- The wallpaper is saved to the project (path stored in `legacyEditor.wallpaper`).+- The wallpaper persists across app restarts.++---++## Scenario 10.6 — Open the Layout pane++**Setup**+1. From scenario 10.5 state.++**Steps**+1. Click the **Layout** button on the right rail.++**Expected**+- The right panel swaps to the Layout pane.+- It contains:+ - Aspect ratio selector (`16:9`, `9:16`, `1:1`, `4:3`, `4:5`, `16:10`, `10:16`, `Original`).+ - Padding slider.+ - Border radius slider.+ - Shadow intensity slider.+ - Blur toggle + amount.+ - Motion blur toggle + amount.++---++## Scenario 10.7 — Change aspect ratio++**Setup**+1. From scenario 10.6 state.++**Steps**+1. Click the aspect ratio dropdown.+2. Click `1:1`. The preview re-aspects.+3. Click `9:16`. The preview is portrait.+4. Click `Original`. The preview is the source's native aspect.++**Expected**+- The preview's frame reflows to the new aspect.+- The project's `aspectRatio` field updates.+- The export uses the same aspect.++---++## Scenario 10.8 — Padding slider++**Setup**+1. From scenario 10.7 state. Aspect = `16:9`.++**Steps**+1. Drag the **Padding** slider from 0 to 100.++**Expected**+- The preview shows the video frame shrinking as padding increases (the gap between the frame and the panel edges grows).+- The project's `padding` field updates.++---++## Scenario 10.9 — Border radius slider++**Setup**+1. From scenario 10.8 state.++**Steps**+1. Drag the **Border Radius** slider from 0 to 100.++**Expected**+- The preview's frame corners become increasingly rounded.+- The project's `borderRadius` updates.++---++## Scenario 10.10 — Shadow intensity slider++**Setup**+1. From scenario 10.9 state.++**Steps**+1. Drag the **Shadow Intensity** slider from 0 to 100.++**Expected**+- A drop shadow appears under the video frame, increasing in intensity.+- The project's `shadowIntensity` updates.++---++## Scenario 10.11 — Blur background toggle + amount++**Setup**+1. From scenario 10.10 state.++**Steps**+1. Toggle the **Blur Background** switch on.+2. Drag the **Blur Amount** slider.++**Expected**+- The background wallpaper (image / gradient / color) becomes blurred.+- The amount controls the blur radius (filter: blur(6px) by default).++---++## Scenario 10.12 — Motion blur toggle + amount++**Setup**+1. From scenario 10.11 state.++**Steps**+1. Toggle **Motion Blur** on.+2. Drag the amount slider.++**Expected**+- The preview shows motion-blurred frames during zoom / pan transitions.+- The amount controls the blur kernel size.++---++## Scenario 10.13 — Open the Camera pane++**Setup**+1. Click the **Camera** button on the right rail.++**Steps**+1. The Camera pane shows:+ - Shape selector (rectangle, circle, square, rounded) — `.shape-grid` with `.shape-cell` buttons.+ - Size slider (10–50% of canvas ref).+ - Position (drag the PIP on the preview, or X/Y inputs).+ - Mirror toggle.+ - Reactive zoom toggle.++**Expected**+- All four shape options are clickable.+- The active shape has the mint background.++---++## Scenario 10.14 — Change webcam shape++**Setup**+1. From scenario 10.13 state. Webcam file is loaded.++**Steps**+1. Click `circle`. The PIP is now a circle.+2. Click `square`. The PIP is a square.+3. Click `rounded`. The PIP is a rounded rectangle.+4. Click `rectangle`. The PIP is a rectangle.++**Expected**+- The PIP shape updates immediately.+- The project's `webcamMaskShape` updates.++---++## Scenario 10.15 — Adjust webcam size++**Setup**+1. From scenario 10.14 state.++**Steps**+1. Drag the size slider from 25 (default) to 50.++**Expected**+- The PIP grows to 50% of the canvas.+- The project's `webcamSizePreset` updates.++---++## Scenario 10.16 — Reposition webcam++**Setup**+1. From scenario 10.15 state.++**Steps**+1. Drag the webcam PIP on the preview from bottom-right to top-left.++**Expected**+- The PIP moves to the new position.+- The project's `webcamPosition` updates.++---++## Scenario 10.17 — Mirror webcam++**Setup**+1. From scenario 10.16 state.++**Steps**+1. Toggle the **Mirror** switch on.++**Expected**+- The webcam feed is horizontally flipped.+- The project's `webcamMirrored` updates.++---++## Scenario 10.18 — Reactive webcam zoom++**Setup**+1. From scenario 10.17 state.++**Steps**+1. Toggle the **Reactive Zoom** switch on.+2. Play the timeline.++**Expected**+- The webcam PIP scales up slightly during loud audio (or when the speaker is active).+- The reactive zoom is anchored to a docked corner.++---++## Scenario 10.19 — Open the Cursor pane++**Setup**+1. Click the **Cursor** button on the right rail.++**Steps**+1. The Cursor pane shows:+ - Cursor theme selector (`.cursor-grid` with `.cursor-cell` buttons — 5 themes).+ - Size slider.+ - Smoothing slider.+ - Motion blur slider.+ - Click bounce slider.+ - Clip to bounds toggle.++**Expected**+- The 5 cursor themes are visible.+- The active theme has the mint border.++---++## Scenario 10.20 — Change cursor theme++**Setup**+1. From scenario 10.19 state.++**Steps**+1. Click each of the 5 cursor themes in turn.++**Expected**+- The cursor in the preview updates to the selected theme.+- The project's `cursorTheme` updates.++---++## Scenario 10.21 — Cursor size / smoothing / motion blur++**Setup**+1. From scenario 10.20 state.++**Steps**+1. Drag the **Size** slider (default 3.0). Range: 1.0 – 6.0.+2. Drag the **Smoothing** slider (default 0.67).+3. Drag the **Motion Blur** slider (default 0.35).++**Expected**+- Each slider updates the corresponding cursor visual effect.+- The cursor's motion smoothness changes with smoothing.+- The motion blur trails follow the cursor.++---++## Scenario 10.22 — Click bounce++**Setup**+1. From scenario 10.21 state.++**Steps**+1. Drag the **Click Bounce** slider (default 2.5).+2. Play the timeline (recorded with mouse clicks).++**Expected**+- On each recorded click, the cursor animates a bounce.+- The intensity is proportional to the slider value.++---++## Scenario 10.23 — Clip cursor to bounds++**Setup**+1. From scenario 10.22 state.++**Steps**+1. Toggle **Clip to Bounds** on.+2. Play the timeline.++**Expected**+- The cursor disappears when it would render outside the recording area.+- It reappears when back in bounds.++---++## Scenario 10.24 — Crop video (right-rail button + modal)++**Setup**+1. Click the **Crop** button on the right rail (`aria-label="Crop video"`).+2. The `CropModal` opens.++**Steps**+1. The modal shows:+ - A 16:9 crop stage with a draggable crop rectangle.+ - 4 input fields: X, Y, Width, Height (or aspect / format selector).+ - A lock-aspect toggle.+ - A `Done` button.++**Expected**+- The modal is centered with a backdrop.+- The crop rectangle can be dragged to define a custom crop.+- The X/Y/W/H values update as the rectangle is dragged.++---++## Scenario 10.25 — Apply crop++**Setup**+1. From scenario 10.24 state.++**Steps**+1. Drag the crop rectangle from default to a tighter crop (top-left crop).+2. Click `Done`.++**Expected**+- The preview re-renders with the cropped frame.+- The project's `cropRegion` is updated.+- The export uses the cropped region.++---++## Scenario 10.26 — Effects pane++**Setup**+1. Click the **Effects** button on the right rail (if present).++**Steps**+1. The Effects pane shows toggles for:+ - Vignette+ - Film grain+ - Color grading presets+ - Or other visual effects.++**Expected**+- Each effect toggle updates the preview live.+- The effect state persists in the project.++---++## Scenario 10.27 — Help popover per pane (P3.3)++**Setup**+1. Right panel is open on any pane (e.g. Background).++**Steps**+1. Click the **Help** button (`aria-label="Help"` or `aria-label="Background help"` etc.) in the pane's header.+2. A popover appears with a `[role="note"]` element containing contextual help text.++**Expected**+- The popover shows help text specific to the active pane (NOT the generic `Settings for X` fallback).+- The popover can be dismissed by clicking outside, pressing `Esc`, or clicking the Help button again.++---++## Scenario 10.28 — Help popover on each pane++**Setup**+1. Repeat for each pane: Background, Layout, Camera, Cursor, Effects.++**Steps**+1. Open each pane, click Help, verify the help text is pane-specific.++**Expected**+- Each pane has a unique help string.+- No two panes share the same help text.++---++## Cross-cutting checks for this block++- The right rail buttons have `aria-label` for accessibility (and for the MCP).+- The right panel preserves the active pane across app restarts (in `localStorage`).+- All sliders / toggles / selectors update the project's `legacyEditor` envelope.++**Next:** proceed to [`11-transcript-editor.md`](11-transcript-editor.md).\ No newline at end of filediff --git a/specs/computer-use/11-transcript-editor.md b/specs/computer-use/11-transcript-editor.mdnew file mode 100644index 000000000..aa52b3353--- /dev/null+++ b/specs/computer-use/11-transcript-editor.md@@ -0,0 +1,331 @@+# 11 — Transcript editor + auto-captions++**Surface:** `TranscriptEditor` (`src/components/ai-edition/TranscriptEditor.tsx`), `Modals.tsx` (`AutoCaptionsModal`), `captioning` library (`src/lib/captioning/*`).+**Prerequisites:** `01-source-selection-and-record.md` (a recording exists with audio), `02-editor-foundation.md` (editor is open with the recording loaded).++**Goal of this block:** prove the in-browser Whisper transcription works end-to-end: open the Auto-Captions modal, pick a model, run, view the result in the transcript editor, click words to seek, delete words to add skips, regenerate in another language.++**Reference:**+- design `openscreen-editor.html` — `.transcript-list`, `.transcript-row`, `.transcript-row.skip`, `.filler`, `.skip-mark`.+- `src/lib/captioning/transcribe.ts` — `transcribeMono16kToSegments(samples, options)`.+- `src/lib/captioning/transcribeCore.ts` — orchestration, retries, slicing.+- roadmap P1.5 / P2.4 — transcription pipeline (Phase 4).+- `Model: Xenova/whisper-tiny` (default), bundled under `caption-assets/`.++---++## Scenario 11.1 — Open the Auto-Captions modal++**Setup**+1. Project is open with a clip that has audio.++**Steps**+1. Click the **Captions** button in the bottombar (icon: `Captions` / `MessageSquare`).+2. The `AutoCaptionsModal` opens.++**Expected**+- The modal is centered.+- The title is `Auto-captions` (or localized equivalent).+- The modal contains:+ - A model picker (tiny / base / small / medium — Whisper models).+ - A language selector (auto / en / fr / de / es / it / pt / nl / ja / ko / zh).+ - A `Generate` button.++---++## Scenario 11.2 — Generate captions with the tiny model++**Setup**+1. From scenario 11.1 state.++**Steps**+1. Pick the `tiny` model (default).+2. Language: `auto`.+3. Click `Generate`.+4. Wait up to 60 s (the in-browser Whisper runs on CPU; can be slow on first run).++**Expected**+- A progress indicator appears (model loading, then transcribing).+- The modal shows the model's download progress on first run (`caption-assets/` is fetched from the bundled dir on subsequent runs).+- When complete, the modal closes (or shows a `Done` button).+- The transcript editor on the right side now shows the transcript words.+- The transcript is segmented into lines (`minWords=2, maxWords=7`).++---++## Scenario 11.3 — Transcript editor shows words++**Setup**+1. From scenario 11.2 state.++**Steps**+1. Take a screenshot of the transcript editor.++**Expected**+- Each word is a span with `data-word-id` and class `kept | cut`.+- Words are colored normally (kept) or red (in a skip).+- A "current cue" highlight tracks the playhead.++---++## Scenario 11.4 — Click a word → preview seeks++**Setup**+1. From scenario 11.3 state.++**Steps**+1. Click any word in the transcript.++**Expected**+- The preview seeks to that word's `startSec`.+- The playhead jumps to the corresponding position.+- The cue highlight moves to the clicked word.+- If the word is off-screen, the transcript auto-scrolls to keep it in view (with 56 px margin top/bottom).++---++## Scenario 11.5 — Caret navigation with arrow keys++**Setup**+1. From scenario 11.4 state. Click into the transcript to set focus.++**Steps**+1. Press `Right Arrow`. The caret moves to the next word.+2. The preview seeks to the new caret's interpolated time.+3. Press `Left Arrow`. Reverts.++**Expected**+- The caret (a thin vertical line) moves between words.+- The preview follows.++---++## Scenario 11.6 — Select range of words with mouse++**Setup**+1. From scenario 11.5 state.++**Steps**+1. Click the first word. Shift-click a later word.+2. The range is highlighted.++**Expected**+- The range is visually marked (different background).+- The status bar or the transcript header shows `2 words selected` (or similar).++---++## Scenario 11.7 — Backspace / Delete adds a skip++**Setup**+1. From scenario 11.6 state.++**Steps**+1. Press `Backspace` or `Delete`.++**Expected**+- The selected words are added to a skip range.+- The transcript words turn red (`cut` class).+- `data-skip-count` increments.+- The skip pill appears in the timeline.+- The preview at the skip range is no longer rendered during playback.++---++## Scenario 11.8 — Backspace at collapsed caret deletes adjacent word++**Setup**+1. Place the caret next to a kept word (no selection).++**Steps**+1. Press `Backspace` (the word before the caret is deleted).++**Expected**+- A one-word skip is added.+- The preview scrubs to the word's start.++---++## Scenario 11.9 — Trash button on a cut run++**Setup**+1. From scenario 11.7 state. A cut run (group of skipped words) exists.++**Steps**+1. Hover the cut run.+2. A trash button appears.+3. Click the trash button.++**Expected**+- The skip range is removed.+- The cut words turn back to `kept` color.++---++## Scenario 11.10 — Filler words highlighted++**Setup**+1. The transcript has filler words (`uh`, `um`, etc. — the filler lexicon in `structured-agent.ts:11-21`).++**Steps**+1. Look at the transcript.++**Expected**+- Filler words have a yellow / amber background and italic style.+- They are visually distinct from regular kept words.++---++## Scenario 11.11 — Silence gaps marked++**Setup**+1. The transcript has silence gaps between segments.++**Steps**+1. Look at the transcript.++**Expected**+- Silence is marked as `(0.5s)` (or similar) between segments.+- The `silence` class is applied.++---++## Scenario 11.12 — Regenerate transcript in another language++**Setup**+1. The project's audio is in English (or any language with words in it).++**Steps**+1. Re-open the Auto-Captions modal.+2. Pick language `fr` (or any non-English).+3. Click `Generate`.++**Expected**+- A new transcription replaces the previous one.+- The transcript words are in the chosen language (or `auto` if the model detects English).+- The skips added previously remain (they are project state, not transcript state).++---++## Scenario 11.13 — Transcript editor content is editable (delete-only)++**Setup**+1. From scenario 11.12 state.++**Steps**+1. Try to type text into the transcript.+2. Try to paste text.++**Expected**+- Typing is blocked (`contentEditable` with delete-only logic).+- Pasting is blocked.+- The only allowed mutation is deletion.++---++## Scenario 11.14 — Transcript auto-caption → annotation injection (legacy)++**Setup**+1. The transcript has words.++**Steps**+1. Look at the annotation lane.++**Expected**+- Auto-caption annotations are NOT auto-injected (per roadmap "Auto-caption→annotation injection — dropped; transcript editor is the SSOT").+- The annotation lane is empty unless the user explicitly added annotations.++---++## Scenario 11.15 — Transcript edits add multiple skips++**Setup**+1. The transcript has many words.++**Steps**+1. Select and delete 3 different ranges.++**Expected**+- `data-skip-count` is now `3`.+- All 3 skips are rendered in the timeline.+- The preview at each skip cuts out the corresponding range.++---++## Scenario 11.16 — Skip pill from transcript matches timeline skip++**Setup**+1. A skip was added via transcript deletion.++**Steps**+1. Find the corresponding skip pill in the timeline's skip lane.++**Expected**+- The pill's `startMs` / `endMs` match the deleted word range.+- Resizing the timeline pill updates the transcript's `cut` state.+- Deleting the timeline pill updates the transcript.++---++## Scenario 11.17 — Long audio is sliced automatically++**Setup**+1. Project has a 30-minute clip with continuous audio.++**Steps**+1. Run auto-captions with the `tiny` model.+2. Wait for completion.++**Expected**+- The transcribe pipeline slices the audio into 12-minute chunks (`TRANSCRIBE_SLICE_SAMPLES = 12 * 60 * 16_000`).+- Each slice is transcribed in sequence.+- The final transcript contains all the words from the full clip.++---++## Scenario 11.18 — Undo a transcript deletion++**Setup**+1. A skip was added via transcript deletion.++**Steps**+1. Press `Ctrl+Z`.++**Expected**+- The skip is removed.+- The transcript words return to `kept` color.++---++## Scenario 11.19 — Transcript words reflect the source language++**Setup**+1. Source audio is in French. Run auto-captions with `auto`.++**Expected**+- The transcript is in French (or the detected language).+- The auto-caption annotations (if used) are also in French.++---++## Scenario 11.20 — Open the transcript editor as a right pane++**Setup**+1. Project is open with a transcript.++**Steps**+1. The transcript editor is rendered in the right side of the bottombar (or in the transcript rail — implementation-specific).++**Expected**+- The transcript is visible.+- It can be collapsed / expanded via a toggle.++---++## Cross-cutting checks for this block++- The transcript editor survives clip operations (delete, reorder).+- The cue highlight tracks the playhead in real time during playback.+- The auto-captions modal is cancelable.++**Next:** proceed to [`12-chat-panel.md`](12-chat-panel.md).\ No newline at end of filediff --git a/specs/computer-use/12-chat-panel.md b/specs/computer-use/12-chat-panel.mdnew file mode 100644index 000000000..b76fa9c6e--- /dev/null+++ b/specs/computer-use/12-chat-panel.md@@ -0,0 +1,307 @@+# 12 — Chat panel + AI agent++**Surface:** `LeftPanel.tsx` (chat tab + composer + messages + live-run feed), `chat-service` (`electron/ai-edition/chat-service.ts`).+**Prerequisites:** `02-editor-foundation.md`, `13-provider-settings.md` (a provider must be configured), `05-clip-operations.md` (a project with clips for the agent to edit).++**Goal of this block:** prove the AI chat panel works end-to-end: open it, send a message, receive a streamed response, watch live-run cards (thinking / operation / compaction), see tool-call "applied: …" summaries, undo an agent batch.++**Reference:**+- design `openscreen-editor.html` — `.chat-strip`, `.msg-card-top`, `.msg`, `.model-card`, `.send-btn`, `.model-picker`.+- `LeftPanel.tsx:594` — `aria-label="Compact"`.+- `LeftPanel.tsx:613` — `aria-label="AI settings"`.+- `LeftPanel.tsx:635` — `aria-label="History"`.+- `LeftPanel.tsx:656` — `aria-label="New conversation"`.+- `LeftPanel.tsx:916` — `aria-label="Send"`.+- roadmap P1.1–P1.8 (`55372df`) — tool schema, dispatch, checkpoint, multi-turn loop, applied-line, undo.+- tool schema: `getCurrentDocument`, `getTranscript`, `addSkip`, `setSkipRange`, `setClipRange`, `replaceTimeline`.++---++## Scenario 12.1 — Open the chat panel++**Setup**+1. From the previous block. `AI_FEATURES_ENABLED = true` (default in development).++**Steps**+1. Click the **Chat** button on the left rail.+2. The left panel switches to the Chat tab.++**Expected**+- The chat panel shows:+ - A context pill (current model's context window fill).+ - Action icons: Compact, AI settings, History, New conversation.+ - The active session title.+ - A scrollable messages area.+ - A composer with a model picker, a reasoning pill (if model supports), and a send button.++---++## Scenario 12.2 — Empty chat state++**Setup**+1. From scenario 12.1 state.++**Steps**+1. The messages area is empty.++**Expected**+- The empty state copy reads: `No messages in this conversation yet.` (or localized equivalent).+- The send button is disabled until the user types text.++---++## Scenario 12.3 — Send a message++**Setup**+1. From scenario 12.2 state.++**Steps**+1. Type `Trim silence from 1 to 2 seconds.` in the composer textarea.+2. Click the **Send** button (`aria-label="Send"`).+3. Wait for the agent's response.++**Expected**+- The user message appears in the messages area.+- The send button shows a spinner while waiting.+- The agent's response streams in (or arrives as a single message in non-streaming mode).+- The send button returns to its idle state.++---++## Scenario 12.4 — Live-run feed (thinking card)++**Setup**+1. From scenario 12.3 state. The agent is responding.++**Steps**+1. While the response is in flight, observe the chat panel.++**Expected**+- A "thinking" card appears below the messages (Brain icon + streamed reasoning text).+- A 9-dot animated run indicator at the bottom.+- An operation card appears per tool call (Brain / Terminal / Wrench icon + label + status pill `Running` → `Done` | `Error`).++---++## Scenario 12.5 — Applied-line for a tool call++**Setup**+1. From scenario 12.4 state. The agent called `addSkip` or `setSkipRange`.++**Steps**+1. Look at the assistant message after the tool call completes.++**Expected**+- Below the message, a compact line reads `applied: <description of the tool call>`.+- Format examples: `applied: trimmed 0:02.1 → 0:02.4`, `applied: skipped 0:01.0 → 0:02.0`.+- The line is visually distinct (smaller, dimmer).++---++## Scenario 12.6 — Multiple tool calls in one response++**Setup**+1. From scenario 12.5 state. The agent returned 2 tool calls in the same response.++**Steps**+1. Read the messages area.++**Expected**+- Two `applied: …` lines appear under the assistant message.+- Each describes a different operation.++---++## Scenario 12.7 — Plain text answer (no tool call)++**Setup**+1. Send a message that doesn't require any tool call (e.g. `What does this clip say?`).++**Steps**+1. Wait for the response.++**Expected**+- The assistant message is a plain text answer.+- No `applied: …` line appears.++---++## Scenario 12.8 — Model picker popover++**Setup**+1. From scenario 12.7 state.++**Steps**+1. Click the **model picker** pill in the composer (shows `provider / model`).+2. The Provider Settings modal opens on the `models` screen.+3. Pick a different model.+4. Close the modal.++**Expected**+- The pill updates to the new model.+- Subsequent messages use the new model.++---++## Scenario 12.9 — Reasoning pill (for models that support reasoning)++**Setup**+1. The active model supports reasoning effort (e.g. `o1`, `claude-opus-thinking`).++**Steps**+1. Click the **reasoning pill** (shows the current level, e.g. `Reasoning medium`).+2. A popover appears with the 6 levels: `none / minimal / low / medium / high / xhigh`.++**Expected**+- The current level is marked `Active`.+- Selecting another level updates the pill.++---++## Scenario 12.10 — Compact context (button)++**Setup**+1. The chat has accumulated messages.++**Steps**+1. Click the **Compact** button (`aria-label="Compact"`).+2. The agent runs a compaction pass.++**Expected**+- A `Context compacted` card appears in the live-run feed.+- After compaction, the context pill drops in fill percentage.+- The chat is still usable.++---++## Scenario 12.11 — Undo an agent batch++**Setup**+1. The last agent response added a skip range.++**Steps**+1. Click the **Undo** button (in the chat panel header or somewhere accessible).++**Expected**+- The skip range is removed.+- The agent batch is reverted (checkpoint restore).+- The chat history is preserved (no message is deleted).++---++## Scenario 12.12 — Auto-scroll in messages area++**Setup**+1. The chat has many messages.++**Steps**+1. Scroll up in the messages area.+2. Send a new message.+3. Wait for the response.++**Expected**+- The new message + response is added at the bottom.+- Auto-scroll does NOT engage (because the user scrolled up).+- When the user scrolls back down, auto-scroll resumes.++---++## Scenario 12.13 — Message action: copy++**Setup**+1. A message exists. Hover over it.++**Steps**+1. Click the **Copy** button (appears on hover).++**Expected**+- The message text is copied to the clipboard.++---++## Scenario 12.14 — Message action: rewind (user message with checkpoint)++**Setup**+1. A user message has a checkpoint (any user message does by default).++**Steps**+1. Hover over the user message.+2. Click the **Rewind** (back-arrow) button.+3. A confirmation popover appears: `Rewind here? Project, conversation, and agent state will be restored.`+4. Click `Rewind`.++**Expected**+- The project state reverts to the pre-message checkpoint.+- The chat is truncated (the messages after the rewound message are removed).+- The langgraph thread is reset.+- The composer is pre-filled with the rewound message.++---++## Scenario 12.15 — Cancel rewind++**Setup**+1. From scenario 12.14 state. Trigger the rewind popover.++**Steps**+1. Click `Cancel` (or press `Esc`).++**Expected**+- The popover closes.+- No state change.++---++## Scenario 12.16 — Send button disabled states++**Setup**+1. The chat composer.++**Steps**+1. Verify the send button is disabled when:+ - No project loaded.+ - No LLM provider configured.+ - The text is empty.+ - A message is in flight.++**Expected**+- The button has reduced opacity and `cursor: not-allowed`.++---++## Scenario 12.17 — Inline error on send failure++**Setup**+1. Trigger a send failure (e.g. invalid LLM response, network error).++**Steps**+1. Observe the composer.++**Expected**+- An inline error message appears below the composer.+- The send button returns to its idle state.++---++## Scenario 12.18 — Provider not configured++**Setup**+1. No provider is configured.++**Steps**+1. The model picker pill shows `LLM not configured`.+2. The send button is disabled.++**Expected**+- Clicking the model picker opens the Provider Settings popover.+- The user can configure a provider.++---++## Cross-cutting checks for this block++- The chat panel preserves scroll position across panel collapses.+- The send button's spinner is visible during in-flight requests.+- The reasoning pill is hidden for models that don't support it.++**Next:** proceed to [`13-provider-settings.md`](13-provider-settings.md).\ No newline at end of filediff --git a/specs/computer-use/13-provider-settings.md b/specs/computer-use/13-provider-settings.mdnew file mode 100644index 000000000..bf77a7a6a--- /dev/null+++ b/specs/computer-use/13-provider-settings.md@@ -0,0 +1,293 @@+# 13 — Provider settings (LLM configuration)++**Surface:** `ProviderSettings` (`src/components/ai-edition/ProviderSettings.tsx`), `LeftPanel.tsx` (`AI settings` button), `provider-registry.ts`, `llm-config-store.ts`, `safeStorage` (Electron keychain).+**Prerequisites:** `02-editor-foundation.md`. Chat can be skipped (configure-only path).++**Goal of this block:** prove all 8 provider settings screens work — Models, Providers, Settings, Add Provider, Provider Form. Walk through API-key and OAuth-device-flow connections, model picking, reasoning effort.++**Reference:**+- `provider-registry.ts` — 8 providers: `anthropic`, `openai`, `google`, `mistral`, `openrouter`, `openai-oauth`, `copilot-proxy`, `minimax`, `openai-compatible`.+- `ProviderSettings.tsx:296` — `aria-label="Back"`.+- `ProviderSettings.tsx:306` — `aria-label="Close"`.+- roadmap P1 (Phase 7) — provider registry + LLM call.+- roadmap P2.2 — OAuth device-flow + PAT auth (still partially pending).+- Credentials stored in Electron `safeStorage` (keychain) — locked decision 4.++---++## Scenario 13.1 — Open Provider Settings via the gear icon++**Setup**+1. Open the chat panel (scenario 12.1).+2. Click the **AI settings** button (`aria-label="AI settings"`).++**Steps**+1. The `ProviderSettings` modal opens on the `Settings` screen.++**Expected**+- The modal is centered with a backdrop.+- The Settings screen lists connected providers.+- The `+ Add provider` button is visible.+- A back-arrow button (`aria-label="Back"`) is in the header (greyed on Settings root).++---++## Scenario 13.2 — Navigate to Models screen++**Setup**+1. From scenario 13.1 state.++**Steps**+1. Click `Models` (in the left nav or as a top-level option).++**Expected**+- The Models screen shows the active provider, current model, and a model list.+- A search input is at the top.+- The active model has an `Active` marker.++---++## Scenario 13.3 — Add provider (API-key flow)++**Setup**+1. From scenario 13.1 state.++**Steps**+1. Click `+ Add provider`.+2. The Add Provider screen lists available providers.+3. Pick `OpenAI`.+4. The Provider Form opens.+5. Enter an API key (e.g. `sk-test-...`).+6. Click `Connect`.++**Expected**+- The form shows: provider label, description, model select (disabled until connected), reasoning effort select (for OpenAI o1 family), API key input, base URL input (for OpenAI-compatible), buttons (`Disconnect`, `Connect`, `Use provider`).+- Clicking `Connect` saves the key to Electron `safeStorage`.+- The form's `Update key` button appears (replaces `Connect` after first connection).+- The model list reloads.+- The provider moves to the Connected list.++---++## Scenario 13.4 — Switch active provider++**Setup**+1. Two providers are connected (e.g. OpenAI + Anthropic).++**Steps**+1. In Models screen, click the other provider.+2. Pick a model.+3. Click `Use provider`.++**Expected**+- The active model changes.+- Subsequent chat messages use the new provider.+- The chat composer's model pill updates.++---++## Scenario 13.5 — Reasoning effort selector++**Setup**+1. Active provider is one that supports reasoning (e.g. OpenAI o1).++**Steps**+1. Open the Provider Form (Settings → Edit provider).+2. The Reasoning Effort selector lists: `none / minimal / low / medium / high / xhigh`.+3. Click `high`. Save.++**Expected**+- The reasoning effort is persisted per provider/model.+- The chat composer's reasoning pill updates.++---++## Scenario 13.6 — OAuth device flow (ChatGPT)++**Setup**+1. The app has a ChatGPT account capability.++**Steps**+1. Add Provider → `ChatGPT (OAuth)`.+2. Click `Start login`.+3. A device challenge appears:+ - User code (e.g. `ABCD-1234`).+ - Verification URL (`https://chatgpt.com/auth/device`).+ - `Open login page` external link button.+ - `Copy code` button (turns into check + "Copied" on click).+4. Copy the code.+5. Open the verification URL in the system browser.+6. Enter the code and authorize.+7. Return to the app.+8. Wait for the polling to detect completion.++**Expected**+- The app polls the OAuth endpoint until completion.+- Once complete, the provider is marked connected.+- Models load.+- The user can pick a model and use it.++---++## Scenario 13.7 — OAuth device flow (GitHub Copilot)++**Setup**+1. Add Provider → `GitHub Copilot`.++**Steps**+1. Same as scenario 13.6 but for GitHub PAT.+2. Enter a GitHub Personal Access Token with `copilot` scope.+3. The app exchanges the PAT for a Copilot token.+4. Models load.++**Expected**+- The provider is connected.+- Models are loaded from the Copilot API.++---++## Scenario 13.8 — Reconnect after expiry++**Setup**+1. A provider's saved credential has expired.++**Steps**+1. Open Models screen for that provider.+2. A `Reconnect` button is visible.+3. Click it.++**Expected**+- The form re-opens (with the existing config).+- The user can re-enter credentials.+- The provider reconnects.++---++## Scenario 13.9 — Disconnect a provider++**Setup**+1. A provider is connected.++**Steps**+1. Open the Provider Form for that provider.+2. Click `Disconnect`.++**Expected**+- The provider is removed from the Connected list.+- The saved credential is deleted from `safeStorage`.+- The provider can be re-added via `+ Add provider`.++---++## Scenario 13.10 — Search models++**Setup**+1. A provider has many models loaded.++**Steps**+1. Type in the model search input.++**Expected**+- The model list filters by name (case-insensitive, substring match).++---++## Scenario 13.11 — Refresh model list++**Setup**+1. Models screen is open.++**Steps**+1. Click `Refresh` (if available).++**Expected**+- The app re-fetches the model list from the provider.+- New models appear.++---++## Scenario 13.12 — Custom base URL (OpenAI-compatible)++**Setup**+1. Add Provider → `OpenAI-compatible`.++**Steps**+1. Enter the base URL (e.g. `http://localhost:11434/v1` for Ollama).+2. Enter an API key (or leave blank for no-auth).+3. Click `Connect`.++**Expected**+- The provider connects.+- Models load from the custom endpoint.+- Subsequent chat messages route through the custom URL.++---++## Scenario 13.13 — Provider settings open as popover vs modal++**Setup**+1. From the chat composer's model picker → the settings open as a popover.+2. From the gear icon → the settings open as a modal.++**Steps**+1. Verify both opening surfaces work.+2. The popover is anchored to the model picker.+3. The modal is centered with a backdrop.++**Expected**+- Both surfaces start on the appropriate screen:+ - Popover: `models` or `providers` (depending on readiness).+ - Modal: `settings` (from gear) or `provider-form` (from edit).+- Backdrop click closes the popover; backdrop click also closes the modal.++---++## Scenario 13.14 — Close provider settings++**Setup**+1. Provider Settings modal is open.++**Steps**+1. Click the **Close** button (`aria-label="Close"`).+2. Re-open. Then press `Esc`.++**Expected**+- Both close the modal.++---++## Scenario 13.15 — Provider state persists across app restarts++**Setup**+1. A provider is connected.++**Steps**+1. Quit and re-launch the app.++**Expected**+- The provider is still in the Connected list.+- The selected model is preserved.+- No re-authentication required.++---++## Scenario 13.16 — API key not stored in plain JSON++**Setup**+1. Connect a provider with an API key.++**Steps**+1. Inspect the userData directory. Verify the credentials file (if any) does NOT contain the API key in plain text.++**Expected**+- The credentials are stored in Electron `safeStorage` (encrypted via OS keychain).+- The `llm-config.json` only stores the provider ID + model ID + reasoning effort.++---++## Cross-cutting checks for this block++- The chat panel's `provider pill` reflects the connected provider.+- The Provider Settings modal is the only path to configure providers.++**Next:** proceed to [`14-sessions-and-history.md`](14-sessions-and-history.md).\ No newline at end of filediff --git a/specs/computer-use/14-sessions-and-history.md b/specs/computer-use/14-sessions-and-history.mdnew file mode 100644index 000000000..47d31fc77--- /dev/null+++ b/specs/computer-use/14-sessions-and-history.md@@ -0,0 +1,253 @@+# 14 — Chat sessions, history, rewind++**Surface:** `LeftPanel.tsx` (chat header, session list), `Modals.tsx` (History dialog), `chat-service.ts` (session persistence), `axcut-agent-runtime.ts`.+**Prerequisites:** `12-chat-panel.md`, `13-provider-settings.md`.++**Goal of this block:** prove multi-session chat works — new conversation, rename, switch, delete, history dialog, rewind to a previous checkpoint.++**Reference:**+- design `openscreen-editor.html` — `.msg-head`, `.msg-actions`, etc.+- `LeftPanel.tsx:714` — `aria-label="Rename conversation"`.+- `LeftPanel.tsx:746` — `aria-label="Delete conversation"`.+- roadmap P2.1 — Chat persistence (sqlite).+- roadmap Phase 8 — multi-session chat history.++---++## Scenario 14.1 — New conversation++**Setup**+1. Chat panel open. A session is active.++**Steps**+1. Click the **New conversation** button (`aria-label="New conversation"`).+2. The chat panel switches to a new, empty session.++**Expected**+- The chat messages area is empty (the previous messages are no longer visible).+- The session title in the subheader reads `New conversation` (or `Untitled`).+- The session is now the active session.++---++## Scenario 14.2 — Send a message in the new session++**Setup**+1. From scenario 14.1 state.++**Steps**+1. Send a message (`Hello, what's in this project?`).+2. Wait for the response.++**Expected**+- The new session now has messages.+- The session title may have updated (if the agent has a self-naming behaviour).++---++## Scenario 14.3 — Open History dialog++**Setup**+1. From scenario 14.2 state. At least 2 sessions exist (the original + the new one).++**Steps**+1. Click the **History** button (`aria-label="History"`).+2. The Conversation History dialog opens.++**Expected**+- The dialog lists all sessions for the project:+ - Title.+ - Message count.+ - Last-update date.+- The active session has an `Active` pill.++---++## Scenario 14.4 — Switch to a previous session++**Setup**+1. From scenario 14.3 state. The dialog is open.++**Steps**+1. Click on the first session in the list (a non-active one).+2. The dialog closes.++**Expected**+- The chat panel switches to the clicked session.+- The session's messages are restored.+- The session is now the active one.++---++## Scenario 14.5 — Rename a session++**Setup**+1. From scenario 14.4 state. A session is active.++**Steps**+1. Click the **Rename conversation** button (`aria-label="Rename conversation"`).+2. An inline input appears.+3. Type a new name. Press `Enter`.++**Expected**+- The session title updates.+- The change is persisted.++---++## Scenario 14.6 — Delete a session++**Setup**+1. From scenario 14.5 state. The active session has at least one other session in the list.++**Steps**+1. Click the **Delete conversation** button (`aria-label="Delete conversation"`).+2. A confirmation prompt appears.+3. Confirm.++**Expected**+- The session is removed.+- If it was the last session, the action is disabled.+- If it was the active session, the chat switches to another session.++---++## Scenario 14.7 — Rewind to a user message++**Setup**+1. From scenario 14.6 state. The active session has multiple user messages with checkpoints.++**Steps**+1. Hover over an older user message.+2. Click the **Rewind** button.+3. The Rewind confirmation popover appears.++**Expected**+- The popover reads: `Rewind here? Project, conversation, and agent state will be restored.`+- Two buttons: `Cancel` and `Rewind`.++---++## Scenario 14.8 — Confirm rewind++**Setup**+1. From scenario 14.7 state. The rewind popover is open.++**Steps**+1. Click `Rewind`.++**Expected**+- The project state reverts to the pre-message checkpoint.+- The chat is truncated to the rewound message.+- The composer is pre-filled with the rewound message.+- The agent runtime is reset.++---++## Scenario 14.9 — Cancel rewind++**Setup**+1. Trigger the rewind popover.++**Steps**+1. Click `Cancel` (or press `Esc`).++**Expected**+- The popover closes.+- No state change.++---++## Scenario 14.10 — Session count display++**Setup**+1. From any chat state.++**Steps**+1. Open the History dialog.+2. Count the sessions.++**Expected**+- The dialog shows the exact number of sessions for the project.+- The list is sorted by last-update date desc.++---++## Scenario 14.11 — Sessions persist across app restarts++**Setup**+1. Create 3 sessions with messages.++**Steps**+1. Quit the app.+2. Re-launch.+3. Open the History dialog.++**Expected**+- All 3 sessions are still listed.+- The messages are preserved.++---++## Scenario 14.12 — Session switch preserves the model picker++**Setup**+1. Two sessions exist. Session A used model `gpt-4o`. Session B used `claude-haiku-4-5`.++**Steps**+1. Switch from session A to session B.+2. Read the chat composer's model pill.++**Expected**+- The model pill shows the model of the active session (each session remembers its own model choice).++---++## Scenario 14.13 — Cannot delete the last remaining session++**Setup**+1. Only 1 session remains in the project.++**Steps**+1. Try to delete it.++**Expected**+- The Delete button is disabled.+- A tooltip explains "Cannot delete the last session".++---++## Scenario 14.14 — New conversation resets the composer++**Setup**+1. The composer has typed text from a previous draft (not yet sent).++**Steps**+1. Click **New conversation**.++**Expected**+- The composer's text is cleared.+- The model picker is preserved.++---++## Scenario 14.15 — Switch session via keyboard (if wired)++**Setup**+1. From any state.++**Steps**+1. Press `Ctrl+Shift+[` and `Ctrl+Shift+]` to switch sessions.++**Expected**+- The chat switches to the previous / next session in the list.+- (If not wired, skip — the keyboard shortcuts are not required.)++---++## Cross-cutting checks for this block++- Session data is stored in `~/.config/openscreen/chat.db` (sqlite) — per roadmap P2.1.+- The History dialog is dismissable via `Esc` or backdrop click.++**Next:** proceed to [`15-export-dialog.md`](15-export-dialog.md).\ No newline at end of filediff --git a/specs/computer-use/15-export-dialog.md b/specs/computer-use/15-export-dialog.mdnew file mode 100644index 000000000..5a8933214--- /dev/null+++ b/specs/computer-use/15-export-dialog.md@@ -0,0 +1,322 @@+# 15 — Export dialog (MP4 / GIF)++**Surface:** `ExportDialog` (`src/components/ai-edition/ExportDialog.tsx`), `documentExporter.ts`, exporter pipeline (`mp4ExportSettings.ts`, `videoExporter.ts`, `gifExporter.ts`).+**Prerequisites:** `02-editor-foundation.md`, `03-transport-and-preview.md`, `05-clip-operations.md` (a project with clips + regions).++**Goal of this block:** prove the export pipeline works end-to-end — open the dialog, pick quality / format / fps / codec, run the export, verify the output file exists and has the expected duration.++**Reference:**+- `ExportDialog.tsx` — modal with quality preset, format, fps, codec, output path picker.+- roadmap F2.4 (`58feb34`) — fps (24/30/60) + codec (h264/h265/vp9) selects.+- roadmap F2.5 (pending) — round-trip export test.+- `mp4ExportSettings.ts`:+ - Quality `medium` → short side 720 px → 10 Mbps.+ - Quality `good` → short side 1080 px → 20 Mbps.+ - Quality `source` → match source dims → 30/50/80 Mbps.+- `videoExporter.ts:589` — Codec default `avc1.640033` (H.264 High Profile Level 5.1).++---++## Scenario 15.1 — Open Export dialog++**Setup**+1. Project is open with at least 1 clip.++**Steps**+1. Click the **Export** button (in the titlebar or the File menu).+2. The `ExportDialog` opens.++**Expected**+- The modal is centered.+- It contains:+ - Quality preset selector (`preview-low`, `final-balanced`, `final-high`).+ - Format selector (`MP4`, `GIF`).+ - FPS selector (`24`, `30`, `60`).+ - Codec selector (`h264`, `h265`, `vp9`) — only for MP4.+ - GIF-specific options (`frameRate`, `sizePreset`) — only for GIF.+ - Output path picker.+ - `Export` button.++---++## Scenario 15.2 — Default export (MP4, final-balanced, h264, 30fps)++**Setup**+1. From scenario 15.1 state.++**Steps**+1. Pick the default options: MP4, final-balanced, h264, 30fps.+2. Pick an output path (e.g. `C:\temp\export-test.mp4`).+3. Click `Export`.+4. Wait for completion (the dialog shows progress).++**Expected**+- The progress bar advances (frames encoded → muxer → finalize).+- A success toast or the modal closes.+- The output file exists at the chosen path.+- The file size > 0.+- The file duration (via `ffprobe` or system metadata) matches the project's total duration within ±1 s.++---++## Scenario 15.3 — Export quality preset: preview-low++**Setup**+1. From scenario 15.1 state.++**Steps**+1. Pick `preview-low` quality.+2. Export to a new path.++**Expected**+- The output dimensions are 720 px on the short side.+- The bitrate is ~10 Mbps.+- The file is smaller than the `final-balanced` output.++---++## Scenario 15.4 — Export quality preset: final-high++**Setup**+1. From scenario 15.1 state.++**Steps**+1. Pick `final-high` quality.++**Expected**+- The output dimensions match the source.+- The bitrate is ~30/50/80 Mbps (depending on pixel count).+- The file is the largest of the three presets.++---++## Scenario 15.5 — Export at 60fps++**Setup**+1. From scenario 15.1 state. Pick MP4, final-balanced, h264.++**Steps**+1. Set FPS to `60`.++**Expected**+- The output is encoded at 60 fps.+- The output duration matches the source.++---++## Scenario 15.6 — Export with h265 codec++**Setup**+1. From scenario 15.1 state.++**Steps**+1. Set codec to `h265`.++**Expected**+- The output uses the H.265 / HEVC codec.+- The file size is smaller than the H.264 equivalent at the same quality.++---++## Scenario 15.7 — Export with VP9 codec++**Setup**+1. From scenario 15.1 state.++**Steps**+1. Set codec to `vp9`.++**Expected**+- The output uses VP9.+- The file is playable in modern players.++---++## Scenario 15.8 — Export to GIF++**Setup**+1. From scenario 15.1 state.++**Steps**+1. Set format to `GIF`.+2. Pick `sizePreset` (`small`, `medium`, `large`).+3. Set `frameRate` (`10`, `15`, `24`).+4. Export.++**Expected**+- The output is a GIF.+- The dimensions match the size preset (`small = 480p`, `medium = 720p`, `large = 1080p`).+- The frame rate matches the picker.++---++## Scenario 15.9 — Export honours skip ranges++**Setup**+1. Project has a skip range (1 skip of 2 s in the middle of a 10 s clip).++**Steps**+1. Export the project.+2. Verify the output duration via `ffprobe`.++**Expected**+- The output duration is ~8 s (the skip was applied).++---++## Scenario 15.10 — Export honours speed regions++**Setup**+1. Project has a speed region (2× speed for a 2 s portion).++**Steps**+1. Export the project.++**Expected**+- The output duration is shorter than the source (the 2× region plays in 1 s of output).++---++## Scenario 15.11 — Export honours crop region++**Setup**+1. Project has a crop region (non-default).++**Steps**+1. Export the project.++**Expected**+- The output dimensions match the crop (not the source's full dimensions).++---++## Scenario 15.12 — Export honours aspect ratio++**Setup**+1. Project has `aspectRatio = "1:1"`.++**Steps**+1. Export the project.++**Expected**+- The output has 1:1 aspect.++---++## Scenario 15.13 — Export with annotations++**Setup**+1. Project has 2+ annotation regions.++**Steps**+1. Export the project.++**Expected**+- The output video contains the annotations baked in at the right times.++---++## Scenario 15.14 — Export with zoom regions++**Setup**+1. Project has 2+ zoom regions.++**Steps**+1. Export the project.++**Expected**+- The output video contains the zoomed frames baked in at the right times.++---++## Scenario 15.15 — Export progress visible++**Setup**+1. Export a long project.++**Steps**+1. Watch the progress bar / percentage.++**Expected**+- The progress advances smoothly (not stuck).+- The encoder queue does not stall.++---++## Scenario 15.16 — Cancel export++**Setup**+1. Export is in progress.++**Steps**+1. Click `Cancel` in the dialog.++**Expected**+- The export stops.+- The partial file is deleted.+- The dialog closes.++---++## Scenario 15.17 — Output file path validation++**Setup**+1. From scenario 15.1 state.++**Steps**+1. Pick a path with no write permission (e.g. `C:\Windows\System32\export.mp4`).+2. Click `Export`.++**Expected**+- The dialog shows an error message: `Cannot write to <path>`.+- No file is created.++---++## Scenario 15.18 — Reveal in folder++**Setup**+1. Export is complete.++**Steps**+1. The dialog has a `Reveal in Folder` button (or a system notification with the link).+2. Click it.++**Expected**+- The OS file explorer opens at the export's directory, with the file selected.++---++## Scenario 15.19 — Export audio++**Setup**+1. Project has audio.++**Steps**+1. Export the project.++**Expected**+- The output has audio.+- Audio is AAC (or Opus as fallback) — verify with `ffprobe`.++---++## Scenario 15.20 — Export with webcam overlay++**Setup**+1. Project has both screen and webcam files.++**Steps**+1. Export the project.++**Expected**+- The output video includes the webcam PIP at the configured position / size / shape.++---++## Cross-cutting checks for this block++- The Export dialog remembers the last-used settings (quality / format / fps / codec) across runs.+- The dialog handles large exports without OOM (the encoder is throttled via `maxEncodeQueue = 120`).++**Next:** proceed to [`16-modal-shortcuts-i18n.md`](16-modal-shortcuts-i18n.md).\ No newline at end of filediff --git a/specs/computer-use/16-modal-shortcuts-i18n.md b/specs/computer-use/16-modal-shortcuts-i18n.mdnew file mode 100644index 000000000..511d67f83--- /dev/null+++ b/specs/computer-use/16-modal-shortcuts-i18n.md@@ -0,0 +1,367 @@+# 16 — Modals, keyboard shortcuts, i18n (13 locales)++**Surface:** `Modals.tsx`, `ShortcutsContext`, `ShortcutsConfigDialog`, `I18nContext`, language picker.+**Prerequisites:** `02-editor-foundation.md`.++**Goal of this block:** prove every modal in the app opens, behaves, and closes correctly; every keyboard shortcut works; every locale (13 total) renders correctly.++**Reference:**+- design `openscreen-editor.html` — `.modal`, `.modal-card`, `.modal-backdrop`, `.modal-head`.+- `Modals.tsx:49` — `role="dialog"`.+- `Modals.tsx:51` — `aria-labelledby="modal-title"`.+- `Modals.tsx:65` — `aria-label="Close"`.+- `src/i18n/config.ts:30` — `SUPPORTED_LOCALES = [en, ar, es, fr, it, ja-JP, ko-KR, ru, tr, vi, pt-BR, zh-CN, zh-TW]`.+- `src/i18n/loader.ts` — namespace loader (`common, dialogs, editor, launch, settings, shortcuts, timeline`).++---++## Scenario 16.1 — Open the Open Project modal++**Setup**+1. Titlebar → click `Open Project` (or `File → Open Project`).++**Steps**+1. The modal opens.++**Expected**+- The modal is centered with a backdrop.+- Two columns: **Recent projects** (left) and **+ New project** (right).+- The recent list shows up to 8 projects sorted by `updatedAt` desc.+- Clicking a project opens it; clicking the `+ New project` button creates a new one.+- `Esc` closes the modal.++---++## Scenario 16.2 — Open the New Project modal++**Setup**+1. From scenario 16.1 state. Click `+ New project`.++**Steps**+1. The New Project modal opens.++**Expected**+- The modal has a title input field.+- Typing a name and clicking `Create` creates the project.+- `Esc` cancels.++---++## Scenario 16.3 — Open the Crop Video modal++**Setup**+1. Click the right rail's **Crop** button (`aria-label="Crop video"`).++**Steps**+1. The Crop modal opens.++**Expected**+- The modal has a 16:9 crop stage.+- A draggable crop rectangle.+- Aspect ratio lock / format selector.+- `Done` and `Cancel` buttons.++---++## Scenario 16.4 — Open the Unsaved Changes modal++**Setup**+1. Make a change to the project.+2. Try to close the editor.++**Steps**+1. The modal appears.++**Expected**+- 3 buttons: `Save`, `Discard`, `Cancel`.+- `Cancel` keeps the editor open with the dirty state.+- `Save` saves + closes.+- `Discard` closes without saving.++---++## Scenario 16.5 — Open the Shortcuts config dialog++**Setup**+1. Titlebar → click the keyboard icon (or Settings → Shortcuts).++**Steps**+1. The ShortcutsConfig dialog opens.++**Expected**+- The dialog lists all keyboard shortcuts.+- Each shortcut has a label and a key-binding display.+- Clicking a binding allows re-binding (press the new keys).++---++## Scenario 16.6 — Rebind a shortcut++**Setup**+1. From scenario 16.5 state.++**Steps**+1. Click on the binding for `Save Project` (default `Ctrl+S`).+2. Press `Ctrl+Shift+S`.+3. Save.++**Expected**+- The binding updates.+- The new binding works in the editor.+- The change persists across app restarts.++---++## Scenario 16.7 — Reset shortcuts to defaults++**Setup**+1. From scenario 16.6 state. Rebind 2 shortcuts.++**Steps**+1. Click `Reset to defaults`.++**Expected**+- All shortcuts revert to their default bindings.++---++## Scenario 16.8 — Open the Settings dialog (Editor Settings)++**Setup**+1. Titlebar → click the gear icon (or Left panel → Settings).++**Steps**+1. The Settings dialog opens.++**Expected**+- Multiple tabs: `General`, `Export`, `Recording`, `Audio`, `Shortcuts`.+- Each tab has its own form.++---++## Scenario 16.9 — Switch UI language to French++**Setup**+1. Open the language picker (titlebar's language button or the launch HUD's language menu).++**Steps**+1. Click `Français`.+2. Wait 500 ms.++**Expected**+- All visible UI text in the editor switches to French.+- The titlebar, panels, bottombar, modals — every label.+- No console errors.+- Press `Esc` to close the menu.++---++## Scenario 16.10 — Switch UI language to Arabic (RTL test)++**Setup**+1. From scenario 16.9 state.++**Steps**+1. Open the language picker. Click `العربية`.++**Expected**+- The UI switches to Arabic.+- The layout mirrors to RTL (text alignment flips).+- The panels / rails maintain their visual positions.++---++## Scenario 16.11 — Switch UI language to Chinese (Simplified)++**Setup**+1. Open the language picker. Click `简体中文`.++**Expected**+- The UI switches to Simplified Chinese.+- All labels are in Chinese.++---++## Scenario 16.12 — Switch UI language to Japanese++**Setup**+1. Open the language picker. Click `日本語`.++**Expected**+- The UI switches to Japanese.++---++## Scenario 16.13 — Switch through all 13 locales++**Setup**+1. Cycle through every locale: `en, ar, es, fr, it, ja-JP, ko-KR, ru, tr, vi, pt-BR, zh-CN, zh-TW`.++**Steps**+1. For each: open the menu, click the locale, wait 500 ms, take a screenshot, verify the titlebar's language code matches.++**Expected**+- Each locale renders without console errors.+- Each locale's strings come from its own `src/i18n/locales/<locale>/*.json` namespace files.++---++## Scenario 16.14 — Switch back to English++**Setup**+1. Currently in a non-English locale.++**Steps**+1. Open the menu. Click `English`.++**Expected**+- The UI switches back to English.++---++## Scenario 16.15 — Keyboard shortcut: Ctrl+Z / Cmd+Z (undo)++**Setup**+1. Project has at least one change.++**Steps**+1. Press `Ctrl+Z` (or `Cmd+Z`).+2. Read the project state.++**Expected**+- The last change is reverted.+- The change can be redone with `Ctrl+Shift+Z` (or `Cmd+Shift+Z`).++---++## Scenario 16.16 — Keyboard shortcut: Space (play/pause)++**Setup**+1. Preview is in focus.++**Steps**+1. Press `Space`.++**Expected**+- The preview plays (or pauses if already playing).++---++## Scenario 16.17 — Keyboard shortcut: T (place-skip mode)++**Setup**+1. The timeline is visible.++**Steps**+1. Press `T`.++**Expected**+- The place-skip mode is armed.+- The body class is `timeline-placing-cut`.++---++## Scenario 16.18 — Keyboard shortcut: F (add keyframe)++**Setup**+1. The timeline is visible.++**Steps**+1. Move the playhead. Press `F`.++**Expected**+- A keyframe is added at the current time.+- The keyframe appears as a tick on the timeline ruler.++---++## Scenario 16.19 — Keyboard shortcut: Ctrl+N (new project)++**Setup**+1. Editor is open.++**Steps**+1. Press `Ctrl+N`.++**Expected**+- The New Project modal opens (or a new project is created if the dirty state allows).++---++## Scenario 16.20 — Keyboard shortcut: Ctrl+O (open project)++**Setup**+1. Editor is open.++**Steps**+1. Press `Ctrl+O`.++**Expected**+- The Open Project modal opens.++---++## Scenario 16.21 — Keyboard shortcut: Ctrl+S (save)++**Setup**+1. Editor is open.++**Steps**+1. Press `Ctrl+S`.++**Expected**+- The project is saved.+- The titlebar's saved dot returns to mint.++---++## Scenario 16.22 — Modal escape closes++**Setup**+1. Any modal is open (Open Project, Provider Settings, etc.).++**Steps**+1. Press `Esc`.++**Expected**+- The modal closes.+- The state behind the modal is intact.++---++## Scenario 16.23 — Modal backdrop click closes++**Setup**+1. Any modal is open.++**Steps**+1. Click the backdrop (outside the modal card).++**Expected**+- The modal closes.++---++## Scenario 16.24 — Modal stacking++**Setup**+1. Open a modal (e.g. Provider Settings).+2. While it's open, trigger another modal (e.g. a Help popover).++**Steps**+1. Verify only one modal is in the foreground at a time.+2. Close the inner one. The outer one is still visible.++**Expected**+- The modal stack is well-managed (no overlap).+- `Esc` closes the topmost modal first.++---++## Cross-cutting checks for this block++- The 13 locale files are syntactically valid (run `npm run i18n:check` — already part of CI).+- No locale has untranslated keys (English is the fallback).+- Keyboard shortcuts work consistently across locales (the bindings are not localised, only the labels).++**Next:** proceed to [`17-themes-and-settings.md`](17-themes-and-settings.md).\ No newline at end of filediff --git a/specs/computer-use/17-themes-and-settings.md b/specs/computer-use/17-themes-and-settings.mdnew file mode 100644index 000000000..0ec1c757f--- /dev/null+++ b/specs/computer-use/17-themes-and-settings.md@@ -0,0 +1,217 @@+# 17 — Theme, settings dialog, preferences++**Surface:** `useTheme`, `NewEditorShell.module.css` (theme variables), `Settings` (within `Modals.tsx` or `LeftPanel.tsx`), `userPreferences.ts`.+**Prerequisites:** `02-editor-foundation.md`.++**Goal of this block:** prove dark / light theme switching works, the Settings dialog (general / export / recording / audio tabs) works, and user preferences persist.++**Reference:**+- design `DESIGN.md` — token tables for both themes.+- design `openscreen-editor.html` — `:root` and `:root[data-theme="dark"]` CSS variables.+- `src/index.css:7-61` — theme variable definitions.+- `useTheme.ts` — theme toggle hook.+- `loadUserPreferences` / `saveUserPreferences` (`src/lib/userPreferences.ts`).++---++## Scenario 17.1 — Initial theme (dark)++**Setup**+1. Open the editor.++**Steps**+1. Take a screenshot.++**Expected**+- The default theme is **dark** (per the design — `index.html` root background `#09090b`).+- All design tokens reflect dark values (`--bg: #0a0d12`, `--fg: #e6e9ef`, etc.).++---++## Scenario 17.2 — Switch to light theme++**Setup**+1. From scenario 17.1 state.++**Steps**+1. Open Settings (or the theme toggle button if exposed in the titlebar).+2. Switch to `Light`.++**Expected**+- The editor's `data-theme` attribute becomes `light` (or the `:root` no longer has `data-theme="dark"`).+- All colors switch to the light palette (`--bg: #fafbfc`, `--fg: #1f2937`).+- The contrast is preserved (AA-grade).+- The change is immediate.++---++## Scenario 17.3 — Switch back to dark theme++**Setup**+1. From scenario 17.2 state.++**Steps**+1. Switch back to `Dark`.++**Expected**+- The theme returns to dark.++---++## Scenario 17.4 — Theme persists across app restarts++**Setup**+1. From scenario 17.3 state. Switch to light theme.++**Steps**+1. Quit the app. Re-launch.++**Expected**+- The theme is still light.++---++## Scenario 17.5 — Theme + language combined persistence++**Setup**+1. Set theme = dark, language = French.++**Steps**+1. Quit the app. Re-launch.++**Expected**+- Theme = dark, language = French.++---++## Scenario 17.6 — Settings dialog: General tab++**Setup**+1. Open the Settings dialog.++**Steps**+1. Click the `General` tab.++**Expected**+- The General tab contains:+ - Theme selector.+ - Language selector.+ - Auto-save toggle.+ - Behaviour preferences (auto-open editor on stop, etc.).++---++## Scenario 17.7 — Settings dialog: Export tab++**Setup**+1. Open the Settings dialog.++**Steps**+1. Click the `Export` tab.++**Expected**+- The Export tab contains:+ - Default export format (MP4 / GIF).+ - Default quality preset.+ - Default fps.+ - Default codec.+ - Default output directory.++---++## Scenario 17.8 — Settings dialog: Recording tab++**Setup**+1. Open the Settings dialog.++**Steps**+1. Click the `Recording` tab.++**Expected**+- The Recording tab contains:+ - Default cursor capture mode.+ - Default microphone device.+ - Default system audio toggle.+ - Default webcam toggle.+ - Countdown duration (default 3 s).++---++## Scenario 17.9 — Settings dialog: Audio tab++**Setup**+1. Open the Settings dialog.++**Steps**+1. Click the `Audio` tab.++**Expected**+- The Audio tab contains:+ - Audio input device.+ - Audio processing options (noise suppression, AGC).+ - Audio level meter calibration.++---++## Scenario 17.10 — Tray layout preference (horizontal / vertical)++**Setup**+1. The HUD has both layouts available (scenario 00.2).++**Steps**+1. Switch the HUD to vertical.+2. Quit the app. Re-launch.++**Expected**+- The HUD opens in vertical mode.++---++## Scenario 17.11 — Cursor capture mode preference++**Setup**+1. Switch the cursor mode to `system` (scenario 00.6).++**Steps**+1. Quit the app. Re-launch.++**Expected**+- The cursor mode is still `system`.++---++## Scenario 17.12 — Theme + recording preferences together++**Setup**+1. Set: theme = dark, language = en, cursor mode = system, tray layout = vertical, mic = enabled.++**Steps**+1. Quit the app. Re-launch.++**Expected**+- All preferences are preserved.++---++## Scenario 17.13 — Reset all preferences to defaults++**Setup**+1. From any preferences state.++**Steps**+1. Open Settings. Click `Reset to defaults`.++**Expected**+- All preferences revert to their factory defaults.+- A confirmation prompt may appear.++---++## Cross-cutting checks for this block++- Theme switching does not require a reload (it's live CSS variable swap).+- The dark theme is the default on first launch.+- The language picker shows all 13 locales.+- The preferences are stored in `userData/userPreferences.json` (or similar).++**Next:** proceed to [`18-final-qa-checklist.md`](18-final-qa-checklist.md).\ No newline at end of filediff --git a/specs/computer-use/18-final-qa-checklist.md b/specs/computer-use/18-final-qa-checklist.mdnew file mode 100644index 000000000..c5decf0d6--- /dev/null+++ b/specs/computer-use/18-final-qa-checklist.md@@ -0,0 +1,318 @@+# 18 — Final QA checklist (cross-cutting smoke pass)++**Surface:** the entire app.+**Prerequisites:** all previous blocks `00`–`17` green.++**Goal of this block:** a single end-to-end smoke pass that exercises the most critical user paths, end-to-end, on a clean app launch. The MCP runs this last, after every per-feature spec has been individually verified.++**Reference:** each scenario here aggregates the relevant steps from the per-feature specs. The intent is regression coverage — if any of these fail, something serious broke.++---++## Scenario 18.1 — Cold launch → HUD visible++**Setup**+1. Quit the app cleanly. No Electron process is running.++**Steps**+1. `npm run dev`.+2. Wait for Vite dev server. Wait for the HUD window.++**Expected**+- HUD is visible, frameless, bottom-centred.+- No console errors.+- The HUD's record button is in the idle state.+- The language picker shows `EN`.++---++## Scenario 18.2 — Record → edit → export happy path++**Setup**+1. From the end of 18.1.++**Steps**+1. Pick the primary monitor as a source.+2. Wait through the countdown (3-2-1).+3. Record for ~5 s while performing some screen motion.+4. Stop.+5. The editor opens with the recorded clip.+6. Add a skip range at 1 s–2 s (Scissors button).+7. Add a zoom region at 2 s–4 s with depth 2×.+8. Add a text annotation over the entire clip.+9. Change the background wallpaper to a gradient.+10. Open the Export dialog. Export as MP4, final-balanced, 30fps, h264.+11. Wait for completion. Reveal the file in the folder.++**Expected**+- The MP4 file exists.+- The file's duration is ~3 s (the 1 s skip is applied).+- The file contains the zoomed-in frames at 2 s–4 s.+- The text annotation is baked into the video.+- The gradient background is applied.++---++## Scenario 18.3 — Multi-clip project flow++**Setup**+1. From scenario 18.2 state. Quit and re-launch.++**Steps**+1. Re-record a 3 s clip. Stop.+2. From the Files panel, drag the just-recorded file into the timeline again (creates a 2nd clip).+3. Drag a different asset (use a sample video file from `tests/fixtures/`) into the timeline.+4. Reorder the clips (drag the first clip past the second).+5. Edit the second clip's source range (Edit Clip dialog, shrink to 1 s).+6. Add a speed region on the third clip at 2×.+7. Save the project (`Ctrl+S`).+8. Quit. Re-launch.+9. Re-open the project from `Recent`.++**Expected**+- The project reloads with all 3 clips, the skip, the zoom, the text annotation, and the speed region intact.+- All data-* attributes on the timeline reflect the saved state.++---++## Scenario 18.4 — AI chat flow++**Setup**+1. Project from scenario 18.3 is open.+2. A provider is configured (OpenAI / Anthropic / etc.).++**Steps**+1. Open the chat panel.+2. Send: `Trim silences longer than 0.5 seconds.`+3. Wait for the agent's response.++**Expected**+- The agent applies 1+ skip ranges.+- Each skip has an `applied: …` line.+- The timeline reflects the new skips.+- Undo (`Ctrl+Z`) reverts the agent's batch.++---++## Scenario 18.5 — Transcript + skip interaction++**Setup**+1. From scenario 18.4 state.++**Steps**+1. Open the Auto-Captions modal. Generate captions (tiny model).+2. Wait for the transcript to appear.+3. Click a word. The preview seeks.+4. Shift-click another word. Press `Delete`. A skip range is added.++**Expected**+- The new skip matches the deleted word range.+- The preview skips the range during playback.++---++## Scenario 18.6 — All 13 locales switch cleanly++**Setup**+1. From any state.++**Steps**+1. Cycle through every locale (13 of them).+2. For each, verify:+ - No console errors.+ - All labels are translated (no English fallback visible).+ - Layout doesn't break (RTL works for `ar`).++**Expected**+- Every locale passes.++---++## Scenario 18.7 — Theme + locale + state persistence++**Setup**+1. Set: theme = dark, locale = ja-JP, cursor mode = system, tray layout = vertical.++**Steps**+1. Quit. Re-launch.++**Expected**+- All four preferences are preserved.++---++## Scenario 18.8 — Multi-window coordination++**Setup**+1. The app is running. Editor is open.++**Steps**+1. Click `New recording` in the titlebar. The HUD reopens.+2. Click `Open studio` (or any equivalent) in the HUD. The editor reopens.++**Expected**+- Only one window is in the foreground at a time.+- The HUD and editor share the same project state.++---++## Scenario 18.9 — Long recording (5+ min) playback++**Setup**+1. Record a 5-minute clip (or import a long fixture).++**Steps**+1. Open the editor. Wait for the preview to load.+2. Scrub to ~75%. Verify the preview loads the frame within 1 s.+3. Play for 30 s. Pause. Verify the timeline updates correctly.++**Expected**+- No memory leaks (no console warnings about GC pressure).+- Scrubbing is responsive.++---++## Scenario 18.10 — Export round-trip (preview-low → final-high)++**Setup**+1. Project has 3 clips + 2 skips + 1 zoom region.++**Steps**+1. Export at `preview-low`. Verify the file plays and the duration matches.+2. Export at `final-high`. Verify the file plays and the duration matches.+3. Export as GIF. Verify the file plays.++**Expected**+- All 3 exports succeed.+- All 3 files have the expected duration (sum of kept intervals).++---++## Scenario 18.11 — Concurrent operations (rapid clicks)++**Setup**+1. Editor is open with a project.++**Steps**+1. Rapidly click the Skip / Zoom / Annotation add buttons 10 times in a row.++**Expected**+- The UI does not freeze.+- All 10 regions are added (or the operation is throttled correctly).+- No console errors.++---++## Scenario 18.12 — Save / load round-trip across all data types++**Setup**+1. Project has 1 clip + 1 skip + 1 zoom + 1 speed + 1 annotation + 1 text annotation + 1 image annotation + 1 figure annotation + 1 blur annotation + 1 custom wallpaper + custom cursor theme.++**Steps**+1. Save the project (`Ctrl+S`).+2. Quit. Re-launch.+3. Open the project.++**Expected**+- All data types are restored.+- The preview reflects every change.++---++## Scenario 18.13 — Failure: missing asset file++**Setup**+1. Project is open with 1 clip.++**Steps**+1. Delete the underlying video file from `userData/recordings/`.+2. Open the project.++**Expected**+- The editor opens.+- The preview shows the error overlay: `Video preview could not be loaded.`+- The timeline still shows the clip (state is intact).+- Re-importing the file restores the preview.++---++## Scenario 18.14 — Failure: corrupted project file++**Setup**+1. Project file at `userData/projects/<id>.openscreen` is corrupted (write garbage).++**Steps**+1. Open the project.++**Expected**+- The editor shows an error toast / modal.+- The app does not crash.+- A backup or recovery flow is offered (or the user is told to pick a different file).++---++## Scenario 18.15 — Failure: invalid LLM response++**Setup**+1. The agent returns malformed JSON for a tool call.++**Steps**+1. The agent attempts to apply the operation.+2. The IPC layer rejects the operation.++**Expected**+- The chat shows an error card.+- The project state is unchanged.+- The user can retry.++---++## Scenario 18.16 — Full app teardown++**Setup**+1. Editor + HUD + any open modals.++**Steps**+1. `Cmd+Q` (macOS) or close all windows (Win/Linux).+2. Wait for the process to exit.++**Expected**+- All windows close.+- The main process exits cleanly.+- No orphan processes (check Task Manager / Activity Monitor).++---++## Scenario 18.17 — Re-launch with no state++**Setup**+1. Delete `userData/` (or rename it for backup).++**Steps**+1. `npm run dev`.++**Expected**+- The app launches with a clean state.+- The HUD is visible.+- No projects exist (Compositions is empty).+- No console errors.++---++## Cross-cutting checklist for the entire run++The MCP, after running all 18 blocks, should produce a summary report with:++- Total scenarios run: 18 blocks × ~20 scenarios each = ~350 scenarios.+- Pass rate.+- List of failed scenarios (with screenshots + console logs).+- Console errors seen (classified by file:line if possible).+- Mean time per scenario.++**Final pass criteria:**+- 100% of `Expected` blocks pass.+- 0 console errors during any pass.+- All 13 locales render cleanly.+- Theme switching + state persistence work across restarts.++If any of the above fail, escalate to the human. Do not patch the app from the computer-use MCP — that's a human job.\ No newline at end of filediff --git a/specs/computer-use/INDEX.md b/specs/computer-use/INDEX.mdnew file mode 100644index 000000000..4605079f8--- /dev/null+++ b/specs/computer-use/INDEX.md@@ -0,0 +1,100 @@+# OpenScreen — Computer-Use E2E Test Roadmap (master index)++> **Audience:** the `open-computer-use` MCP driving a Windows desktop.+> **Goal:** give the agent an unambiguous, sequenced list of granular end-to-end+> scenarios to run against the **real Electron app** — not the browser-shim.+> **Authoring inputs:** `docs/architecture/openscreen-inventory.md`,+> `docs/architecture/axcut-inventory.md`, `docs/architecture/ai-edition-roadmap.md`,+> `\\wsl.localhost\Ubuntu\home\etienne\repos\axcut\docs\UX-UI-SPEC.md`,+> `design/openscreen-editor.html`, `design/DESIGN.md`,+> the AI-edition source under `src/components/ai-edition/*`, and the+> legacy openscreen source under `electron/`, `src/components/launch/`,+> `src/components/video-editor/`.++---++## How to drive these tests++1. Launch the real app once with `npm run dev` and **leave the launch/HUD window open**. From then on, every spec assumes that window is the foreground window unless it explicitly says "open the editor" or "open the source selector".+2. Each spec file is **self-contained** but references its **prerequisites** at the top — only run it once every prerequisite has passed.+3. Each numbered scenario has three blocks: **Setup** (preconditions), **Steps** (what the MCP must do), **Expected** (what the MCP must observe).+4. The MCP should **read a step, perform it, verify it, then move on**. Do not batch steps. If an Expected fails, stop the scenario and report.+5. Selectors follow three conventions:+ - `data-testid="…"` (preferred — already wired in the renderer),+ - `aria-label="…"` (secondary — wired on icon buttons and toolbars),+ - visible text (last resort — text is i18n'd; use `CommonJS X` pattern or copy from `src/i18n/locales/en/*.json`).+6. The agent must **always close any open modal / popover** between scenarios unless the next scenario explicitly opens another one. `Esc` is the universal close.++---++## Sequencing rationale++The numbered prefix is the run order. Each block depends on the previous one being green:++- **00 → 01** — recording pipeline. Without a recording or imported asset, every later spec is unrunnable.+- **02 → 03 → 04** — editor shell, then preview, then timeline navigation. Timeline is the canvas every other region operation paints on.+- **05 → 06 → 07 → 08 → 09** — clip lifecycle first (because skips live *inside* a clip), then skip ranges, then zoom, speed, annotation. Annotation goes last because it is the most layout-fragile.+- **10** — right-rail properties; depends on regions existing so the inspector is non-empty.+- **11** — transcript editor; needs a recording + transcription result.+- **12 → 13 → 14** — chat + provider settings + session history; provider settings gates chat, chat drives history.+- **15** — export; needs a complete timeline + preview to be meaningful.+- **16 → 17** — modals, shortcuts, i18n, theme; cross-cutting, run after every behaviour is in place.+- **18** — final QA checklist; smoke pass against the whole product.++---++## File map++| # | File | Scope | Surface | Prerequisites |+|---|---|---|---|---|+| 00 | [`00-launch-and-hud.md`](00-launch-and-hud.md) | Launch window, language picker, HUD tray layout, mic/webcam/cursor toggles, record/cancel | LaunchWindow | none |+| 01 | [`01-source-selection-and-record.md`](01-source-selection-and-record.md) | Source selector (screen / window tabs), countdown, recording lifecycle, stop → editor | SourceSelector + CountdownOverlay + useScreenRecorder | 00 |+| 02 | [`02-editor-foundation.md`](02-editor-foundation.md) | Editor opens, panels toggle, project list, new/open/rename project, save/unsaved, layout, theme | NewEditorShell, Titlebar, LeftPanel, RightPanelStack, Modals | 01 |+| 03 | [`03-transport-and-preview.md`](03-transport-and-preview.md) | Play/pause/restart, scrub, fullscreen, time readout, REC toggle on transport, webcam PiP, dual layout | Preview + PreviewCanvas + VirtualPreview | 02 |+| 04 | [`04-timeline-pan-zoom-scrub.md`](04-timeline-pan-zoom-scrub.md) | Ruler hover-scrub, click-to-seek, Ctrl+wheel zoom-at-cursor, Alt+drag pan, middle-button pan, navigator strip, fit-to-width, MAX zoom bound | TimelinePane + Bottombar | 02, 03 |+| 05 | [`05-clip-operations.md`](05-clip-operations.md) | Drag media into timeline, clip select, clip reorder, Edit Clip dialog, Remove clip, Ctrl+C/V duplicate, properties panel for selected clip | TimelinePane + Bottombar + Modals (EditClip) | 02, 04 |+| 06 | [`06-skip-regions.md`](06-skip-regions.md) | Place-skip mode (scissors button + `T`), skip resize (left/right handles), skip delete (trash), trim row hover-controls, snap-guide, floating tooltip, keyboard delete | TimelinePane + Bottombar + RegionTimeline | 02, 04, 05 |+| 07 | [`07-zoom-regions.md`](07-zoom-regions.md) | Add zoom region, depth cycle (1→6), focus point drag, rotation preset (iso/left/right), Magic Wand suggestions, Auto-Focus toggle | TimelinePane + Bottombar + RightPanes | 02, 04, 05 |+| 08 | [`08-speed-regions.md`](08-speed-regions.md) | Add speed region, speed slider (0.1×–16×), delete speed region, behavior during playback | TimelinePane + Bottombar | 02, 04, 05, 06 |+| 09 | [`09-annotation-regions.md`](09-annotation-regions.md) | Add text annotation (font family, animation), image annotation, figure (rect/circle/arrow), blur (rect/freehand, intensity), inspector fields | TimelinePane + Bottombar + RightPanes | 02, 04, 05, 06 |+| 10 | [`10-properties-right-panel.md`](10-properties-right-panel.md) | Right rail panes: Background (image/gradient/color/custom), Layout (aspect, padding, radius, shadow, blur, motion-blur), Camera (shape, size, position, mirrored, reactive), Cursor (theme, size, smoothing, motion-blur, click-bounce, clip), Effects, Help popover | RightPanes + RightPanelStack | 02 |+| 11 | [`11-transcript-editor.md`](11-transcript-editor.md) | Auto-captions modal (Whisper model picker), transcript word seek, click-to-jump, Backspace/Delete to add skip, caret arrow keys, cut run trash, regenerate transcript | TranscriptEditor + Modals (AutoCaptions) | 01, 02, 03 |+| 12 | [`12-chat-panel.md`](12-chat-panel.md) | Open chat tab, send message, model picker popover, reasoning pill, live-run feed, "applied: …" line per tool call, undo button | LeftPanel + chat-service | 02, 13 |+| 13 | [`13-provider-settings.md`](13-provider-settings.md) | Settings → Models / Providers / Settings screens, Connect API key, OAuth device-flow card (ChatGPT, GitHub Copilot), reasoning effort selector | ProviderSettings | 02 |+| 14 | [`14-sessions-and-history.md`](14-sessions-and-history.md) | New conversation, rename, delete, switch session, Conversation History modal, Rewind confirmation popover | LeftPanel + Modals (History) | 12, 13 |+| 15 | [`15-export-dialog.md`](15-export-dialog.md) | Open Export dialog, quality preset (preview-low/final-balanced/final-high), format (MP4/GIF), fps (24/30/60), codec (h264/h265/vp9), GIF size + frame rate, export → MP4 download | ExportDialog + exporter pipeline | 02, 03, 05–09 |+| 16 | [`16-modal-shortcuts-i18n.md`](16-modal-shortcuts-i18n.md) | Crop modal, OpenProject modal, NewProject modal, UnsavedChanges modal, ShortcutsConfig dialog, language switcher (13 locales), keyboard shortcut bindings | Modals + ShortcutsContext + I18nContext | 02 |+| 17 | [`17-themes-and-settings.md`](17-themes-and-settings.md) | Dark/light theme toggle, Settings dialog (general/export/recording/audio tabs), user preferences persistence | NewEditorShell + Settings | 02 |+| 18 | [`18-final-qa-checklist.md`](18-final-qa-checklist.md) | Cross-cutting smoke pass: open app → record → edit → export → close; full happy-path with assertions per major surface | whole app | 00–17 |++---++## What "expected" looks like in each scenario++The Expected block uses these patterns:++- **State assertion** — a `data-*` attribute or text change the MCP reads.+- **Visual assertion** — a colored pixel sample, an element visibility, a transition that the MCP takes a screenshot of and inspects.+- **No console error** — the MCP's persistent console listener is on for the whole session; any `error` console message in a scenario's window is a fail.++If a step has no observable effect (e.g. a transition that lasts < 120 ms), the MCP should screenshot **before and after** and diff the bounding boxes of the affected element.++---++## What "stop the run" looks like++- A scenario's Expected block fails → MCP stops, logs the step + observed state, marks the scenario ❌, moves on to the next spec. The failing spec must be debugged, not retried.+- A console error not previously classified → MCP stops, captures the stack, and asks the human.+- A modal blocks input for > 2 steps of a non-modal scenario → MCP presses `Esc` once, then re-tries; if still blocked, the scenario fails.++---++## Sample-fixture philosophy++The recording pipeline is hard to drive deterministically from the MCP (it requires a real screen source). The computer-use driver should:++- For **00–01**: drive the actual flow on the developer's primary monitor.+- For **02 onwards**: load a fixture recording via the **Open Project** dialog (file picker → `tests/fixtures/sample.webm`). The fixture is also what `tests/e2e/seed.spec.ts` uses for browser-shim coverage.+- For **12 onwards** (chat): pre-configure a provider via `OpenProject` → `Settings` → `Provider Settings` once. Re-use that provider across chat scenarios.++This keeps the recording window's failure modes out of the AI-edition test matrix.\ No newline at end of filediff --git a/specs/f2.6-region-snap-guide-and-tooltip.md b/specs/f2.6-region-snap-guide-and-tooltip.mdnew file mode 100644index 000000000..0755eae8c--- /dev/null+++ b/specs/f2.6-region-snap-guide-and-tooltip.md@@ -0,0 +1,62 @@+# F2.6 — Region drag snap-guide + floating tooltip++**Seed:** `tests/e2e/seed.spec.ts`+**Roadmap status:** ✅ done (`01d6b46`)++## Application Overview++The AI-edition editor lets users add **regions** to the timeline: zoom ranges, annotation overlays, and speed changes. Each region lives on its own lane below the clip track. When the user drags a region's edge (left or right handle) to resize it, the editor should:++1. **Show a vertical snap-guide line** at the new edge position so the user sees the snap target against the ruler and clip blocks.+2. **Show a floating tooltip** near the moving edge with the new `startSec → endSec` range, so the user can read the precise time without taking their hand off the mouse.++The roadblock is on `RegionTimeline.tsx`: the snap-guide and tooltip should appear during the resize gesture, then disappear when the user releases.++## Test Scenarios++### 1. Region resize — snap-guide and tooltip appear++**Setup**++1. Open the editor at `http://localhost:5173/?windowType=editor` (browser-shim mode, no Electron).+2. Apply a project with at least one asset and at least one region of any kind (zoom / annotation / speed).+3. Focus the region row in the timeline (any of: zoom lane, annotation lane, speed lane).++**Steps**++1. Locate the **left** resize handle of a region pill (the small grip on the left edge of the pill).+2. Pointer-down on the handle and drag 80px to the right without releasing.+3. While the drag is in progress, observe the lane.+4. Release the mouse.+5. Pointer-down on the **right** resize handle of a region pill and drag 60px to the left.+6. While the drag is in progress, observe the lane.++**Expected results**++- During the **left** drag, **two** vertical lines appear near the moving edge (snap guides) — one at the start of the resize, one at the projected end.+- During the **right** drag, the same two lines appear mirrored at the right edge.+- A floating tooltip appears next to the moving edge, showing the projected `startSec → endSec` in `M:SS.s` format (e.g. `0:02.1 → 0:04.5`).+- After release, the snap-guides and tooltip disappear.+- The region's actual span (read from the document state) matches the released position within ±0.1s.++**Failure signature today**++The snap-guide and tooltip DOM classes (`laneSnapGuide`, `laneDragTooltip` from `TimelinePane.module.css`) are written but never toggled by the resize handler, so the elements never appear during a drag.++### 2. Region resize — edge clamp preserves a minimum width++**Setup**++1. Same as scenario 1.+2. Pick a region of any kind.++**Steps**++1. Pointer-down on the **right** handle.+2. Drag **past** the left handle (attempting to flip the region or shrink it to zero).+3. Release.++**Expected results**++- The region's effective width is clamped to a small positive value (≥ ~50ms in source time), not zero or negative.+- The preview does not crash, freeze, or report an error.diff --git a/specs/f2.7-multi-select-regions.md b/specs/f2.7-multi-select-regions.mdnew file mode 100644index 000000000..8a5c98c6b--- /dev/null+++ b/specs/f2.7-multi-select-regions.md@@ -0,0 +1,62 @@+# F2.7 — Multi-select region operations++**Seed:** `tests/e2e/seed.spec.ts`+**Roadmap status:** ✅ done (`01d6b46`)++## Application Overview++The AI-edition editor renders **regions** (zoom, annotation, speed) on lanes below the clip track. Users need to operate on multiple regions at once: select several, then delete them with a single keystroke, or move them together. The roadmap says **shift-click** adds a region to the multi-selection; **Delete** removes the entire multi-selection.++## Test Scenarios++### 1. Shift-click adds a region to the selection++**Setup**++1. Open the editor at `http://localhost:5173/?windowType=editor`.+2. Apply a project with at least three regions of any kind on the same lane (or across lanes — both should work).+3. Identify three distinct region pills (e.g. via `data-testid="region-pill"` or by their text label / position).++**Steps**++1. Click the first region pill.+2. **Shift-click** the second region pill.+3. **Shift-click** the third region pill.++**Expected results**++- After step 1, only the first pill shows a "selected" visual state.+- After step 2, the first and second pills show selected; the third does not.+- After step 3, all three pills show selected.+- The `RightPanelStack` region inspector (right sidebar) reflects the multi-selection: it should show a multi-select header ("3 selected" or similar) or at least not show single-region details.++### 2. Delete removes the entire multi-selection++**Setup**++1. Same project as scenario 1, with three regions pre-selected.++**Steps**++1. Press `Delete` (or `Backspace`).++**Expected results**++- All three selected regions are removed from the timeline.+- The lane's `data-annotation-count`, `data-zoom-range-count`, etc. attributes on the `data-testid="timeline-pane"` element each drop by the count of removed regions.+- No console errors fire during the operation.++### 3. Clicking a selected region without shift removes it from the selection++**Setup**++1. Same project, two regions pre-selected.++**Steps**++1. Click one of the two selected regions **without** holding shift.++**Expected results**++- Only the clicked region remains selected; the other is deselected.+- The inspector switches back to single-region mode.diff --git a/specs/p1.7-chat-tool-call-summaries.md b/specs/p1.7-chat-tool-call-summaries.mdnew file mode 100644index 000000000..4d0da577e--- /dev/null+++ b/specs/p1.7-chat-tool-call-summaries.md@@ -0,0 +1,63 @@+# P1.7 — Chat panel tool-call summaries++**Seed:** `tests/e2e/seed.spec.ts`+**Roadmap status:** ✅ done (`55372df`)++## Application Overview++The chat panel in the left sidebar lets the user talk to an AI assistant. When the model calls a tool (e.g. `addSkip`, `setSkipRange`, `replaceTimeline`), the user should see a compact **"applied: <summary>"** line in the chat history under the model's message — something like `applied: trimmed 0:02.1 → 0:02.4` for a skip edit. This is the only feedback the user gets that the AI actually mutated the timeline; without it, the AI's actions are invisible.++## Test Scenarios++### 1. A tool call renders an "applied: …" line in the chat history++**Setup**++1. Open the editor at `http://localhost:5173/?windowType=editor`.+2. Open the left chat panel.+3. Configure a provider with a mock that returns a single tool call to `addSkip({ startSec: 1.0, endSec: 2.0 })`.++**Steps**++1. Type a message in the chat input ("trim a silence from 1 to 2 seconds").+2. Submit.+3. Wait for the model's response.++**Expected results**++- The chat history shows a new assistant message.+- Below the message, a compact line reads `applied: <description of the addSkip call>`. Acceptable formats include `applied: addSkip 0:01.0 → 0:02.0`, `applied: skipped 0:01.0 → 0:02.0`, or any string that mentions both time bounds.+- The line is visually distinct from the regular message (smaller, dimmer, or in a different color).++### 2. Multiple tool calls in a single response each get their own applied-line++**Setup**++1. Same as scenario 1, but the mock returns two tool calls in the same response (`addSkip` + `setClipRange`).++**Steps**++1. Send a message.+2. Wait for response.++**Expected results**++- Two applied-lines appear under the assistant message, one per tool call.+- Each describes the corresponding tool's effect.++### 3. No applied-line when the response is a regular text answer++**Setup**++1. Same as scenario 1, but the mock returns a plain text answer (no tool calls).++**Steps**++1. Send a message.+2. Wait for response.++**Expected results**++- The chat history shows the assistant message.+- **No** "applied: …" line is rendered.+- The chat panel does not show an empty applied-line slot.diff --git a/specs/p3.1-asset-file-size.md b/specs/p3.1-asset-file-size.mdnew file mode 100644index 000000000..79586b807--- /dev/null+++ b/specs/p3.1-asset-file-size.md@@ -0,0 +1,59 @@+# P3.1 — Asset file size in the media panel++**Seed:** `tests/e2e/seed.spec.ts`+**Roadmap status:** ✅ done (`76d78db`)++## Application Overview++The left-side media panel lists every asset in the project. Each row shows the asset's label, duration, **and file size** in human-readable form (e.g. `12.4 MB`). The size comes from the `sizeBytes` field on the `AxcutAsset` schema, populated at import time via `fs.stat`.++## Test Scenarios++### 1. Asset with a real file shows its size in the panel++**Setup**++1. Open the editor at `http://localhost:5173/?windowType=editor`.+2. Seed the browser shim with a project that contains a video asset pointing at a real file on disk (e.g. `tests/fixtures/sample.webm`).++**Steps**++1. Locate the asset row in the left media panel.+2. Read the visible size string.++**Expected results**++- The size string is **not** the em-dash placeholder (`—`).+- The size string matches a `B / KB / MB` formatted number consistent with the file's actual size (sample.webm is ~300 KB, so expect `~300 KB`).++### 2. Asset with no size (legacy / missing) shows the em-dash++**Setup**++1. Same as scenario 1, but with a project whose asset has no `sizeBytes` field.++**Steps**++1. Locate the asset row in the panel.++**Expected results**++- The size string is the em-dash `—`.+- No console error from the panel.++### 3. Round-trip — adding an asset populates `sizeBytes`++**Setup**++1. Open the editor.+2. Trigger `addAsset` via the IPC bridge with a real file path.++**Steps**++1. Call `nativeBridge.invoke({ domain: "ai-edition", action: "addAsset", payload: { path: "<abs path>", label: "Test" } })`.+2. After the call resolves, read the document's `assets` array via the project store (exposed in browser-shim mode as `window.__OPENSCREEN__?.getDocument?.()` — or directly by reading the `localStorage["browser-shim-document"]` key).++**Expected results**++- The newly added asset has a `sizeBytes` field with a positive integer value.+- The value matches `fs.stat(path).size` (within ±0).diff --git a/specs/p3.3-right-panes-help.md b/specs/p3.3-right-panes-help.mdnew file mode 100644index 000000000..55f7c8e58--- /dev/null+++ b/specs/p3.3-right-panes-help.md@@ -0,0 +1,59 @@+# P3.3 — RightPanes header Help popovers++**Seed:** `tests/e2e/seed.spec.ts`+**Roadmap status:** ✅ done (`76d78db`)++## Application Overview++Each right-side pane (Background, Layout, Video effects, Cursor, Timeline, Transcript) has a `HelpCircle` icon in its header. Clicking the icon should open a small popover with **contextual help text** describing what the pane does. The popover should be dismissable (click the icon again, click outside, or press Esc).++## Test Scenarios++### 1. Clicking Help opens a popover with text++**Setup**++1. Open the editor at `http://localhost:5173/?windowType=editor`.+2. Wait for the right-side panes to mount.++**Steps**++1. Click the `HelpCircle` icon in the **Background** pane header.++**Expected results**++- A popover appears below the header.+- The popover contains the help text specific to the Background pane (mentions wallpaper, solid color, gradient, custom image — anything that matches the configured `helpText` prop).+- The popover is visible, on top of the layer below (`z-index` ≥ 50).+- The `HelpCircle` button reports `aria-expanded="true"`.++### 2. Clicking Help again closes the popover++**Setup**++1. Popover from scenario 1 is open.++**Steps**++1. Click the `HelpCircle` icon again.++**Expected results**++- The popover disappears.+- The `HelpCircle` button reports `aria-expanded="false"`.++### 3. Help text is different per pane++**Setup**++1. Open the editor.++**Steps**++1. Open the Background pane help — record the text.+2. Open the Layout pane help — record the text.+3. Open the Video effects pane help — record the text.++**Expected results**++- The three recorded help texts are not all identical. Each pane shows pane-specific guidance, not a generic "Settings for X" fallback.diff --git a/specs/p3.7-ruler-hover-scrub.md b/specs/p3.7-ruler-hover-scrub.mdnew file mode 100644index 000000000..99e689329--- /dev/null+++ b/specs/p3.7-ruler-hover-scrub.md@@ -0,0 +1,32 @@+# P3.7 — Timeline ruler hover scrub feedback++**Seed:** `tests/e2e/seed.spec.ts`+**Roadmap status:** ✅ done (`76d78db`)++## Application Overview++When the user hovers the mouse over the timeline ruler, the editor shows a thin **vertical hover-guide line** at the cursor's x position plus a small **time chip** showing the source time under the cursor. This is purely visual feedback — the playhead does not move until the user clicks. The guide and chip disappear when the pointer leaves the ruler.++## Test Scenarios++### 1. Hovering the ruler shows a hover-guide line and time chip++**Setup**++1. Open the editor at `http://localhost:5173/?windowType=editor`.+2. Apply a project with at least one clip.++**Steps**++1. Move the mouse over the ruler area (top 22px of the timeline viewport).+2. Move the mouse to roughly the **middle** of the ruler.+3. Read the visible elements in the ruler.+4. Move the mouse off the timeline (e.g. to the empty area below the bottombar).+5. Read the visible elements again.++**Expected results**++- After step 2, a thin vertical line (`hoverGuide` class, 1px wide, accent color) is rendered at the cursor's x.+- A small chip (`dragTooltip` class) appears next to the line showing the time under the cursor in `M:SS.s` format.+- After step 4, the hover-guide line and the chip are no longer visible.+- No console errors fire during hover.diff --git a/specs/t19-zoom-timeline-and-preview.md b/specs/t19-zoom-timeline-and-preview.mdnew file mode 100644index 000000000..4e3b7364d--- /dev/null+++ b/specs/t19-zoom-timeline-and-preview.md@@ -0,0 +1,95 @@+# T19 — Zooming in the timeline updates the preview++**Seed:** `tests/e2e/seed.spec.ts`+**Roadmap status:** ✅ done (`761496e`)++## Application Overview++The timeline has a zoom level (data-zoom-multiplier on the timeline section) that the user changes by Ctrl+wheel, by middle-click drag, or via the navigator strip. When the user zooms in, the timeline shows **more pixels per second** of source time, so clip blocks get wider and the ruler ticks get finer.++The user-reported bug: **zooming in does not change what the preview shows**. The playhead stays at the same `currentTimeSec`; the preview keeps playing the same source time. From the user's perspective, zooming in feels broken because the visible result is "the preview doesn't care".++There are actually two distinct sub-features here:++- **Timeline viewport zoom** — visible ruler/clip scale changes. Confirmed to work via the `data-px-per-sec` attribute on the viewport.+- **Preview follows zoom** — when the user zooms in, the preview zooms too (axcut's "camera zoom" behavior). **This is the one that's broken.**++This spec covers BOTH: timeline viewport zoom AND preview-driven zoom, and asserts they happen.++## Test Scenarios++### 1. Ctrl+wheel on the timeline viewport changes `data-px-per-sec`++**Setup**++1. Open the editor at `http://localhost:5173/?windowType=editor`.+2. Apply a project with at least one clip of length > 5 seconds.++**Steps**++1. Hover the timeline viewport (`data-testid="timeline-viewport"`).+2. Press and hold `Control`.+3. Wheel the mouse **up** (negative deltaY) three notches.+4. Release `Control`.+5. Read the `data-px-per-sec` attribute on the viewport.+6. Read the `data-zoom-multiplier` attribute on the timeline pane.++**Expected results**++- `data-px-per-sec` increased compared to step 1 (more pixels per second = zoomed in).+- `data-zoom-multiplier` is greater than 1.0.++### 2. After zooming in, the preview's `data-current-time-sec` reflects the new state (preview follow)++**Setup**++1. Same as scenario 1.+2. The asset is loaded into the preview; the playhead is at some position (e.g. 1.5s into the clip).++**Steps**++1. Read the preview's `data-current-time-sec` BEFORE zoom.+2. Hover the timeline ruler.+3. Hold `Control` and wheel up 3 notches (zoom in).+4. Read the preview's `data-current-time-sec` AFTER zoom.++**Expected results**++Either:++- (A) The preview's `currentTimeSec` did **not** change (zoom is viewport-only and the preview stays at the playhead). This is the conservative interpretation.+- (B) The preview's `currentTimeSec` shifted to match the new zoomed position (axcut behavior: zoom is a camera-zoom on the preview).++Today, neither is reliably implemented. The most useful test is: **the preview's source time remains coherent with the timeline — it doesn't desync, freeze, or show a different clip than the one under the playhead.**++### 3. Ctrl+wheel-down zooms out++**Setup**++1. Same as scenario 1, after step 1 of scenario 1 (`data-px-per-sec` is now larger than the initial).++**Steps**++1. Hold `Control` and wheel **down** 3 notches.+2. Read `data-px-per-sec` and `data-zoom-multiplier`.++**Expected results**++- `data-px-per-sec` decreased (back toward the initial value or lower).+- `data-zoom-multiplier` is less than the value from scenario 1.+- The minimum `data-px-per-sec` is the **initial fit value** (zoom cannot go below 1.0 → "fit to width").++### 4. Zoom is bounded by MAX_PX_PER_SEC++**Setup**++1. Same as scenario 1.++**Steps**++1. Hold `Control` and wheel up **30** notches (extreme zoom-in).++**Expected results**++- `data-px-per-sec` does not exceed 280 (the `MAX_PX_PER_SEC` constant from the roadmap).+- No error in the console.diff --git a/src/components/ai-edition/NewEditorShell.tsx b/src/components/ai-edition/NewEditorShell.tsxindex 7a7d85c47..106571cb2 100644--- a/src/components/ai-edition/NewEditorShell.tsx+++ b/src/components/ai-edition/NewEditorShell.tsx@@ -146,7 +146,34 @@ export function NewEditorShell() {if (!window.electronAPI) return;try {const result = await window.electronAPI.getCurrentRecordingSession();- if (!result.success || !result.session?.screenVideoPath) return;+ if (!result.success || !result.session?.screenVideoPath) {+ // ponytail: no active recording — try to restore the user's+ // most recent project. The browser-shim's listProjects+ // returns the seeded `browser-shim-projects` entries, so+ // e2e tests can land directly in a populated editor; for+ // real Electron users this is the expected "open last+ // project on launch" UX.+ try {+ const projects = await nativeBridgeClient.aiEdition.listProjects();+ console.info("[editor] listProjects returned", projects);+ if (projects.length > 0) {+ console.info("[editor] auto-loading project", projects[0].id);+ await loadProject(projects[0].id);+ const state = useProjectStore.getState();+ console.info(+ "[editor] post-loadProject status=",+ state.status,+ "error=",+ JSON.stringify(state.error),+ "doc=",+ state.document ? "loaded" : "null",+ );+ }+ } catch (e) {+ console.warn("[editor] auto-load failed", e);+ }+ return;+ }const screenPath = result.session.screenVideoPath;const label = screenPath.split(/[\\/]/).pop() || "Recording";await createProject(`Recording ${new Date().toLocaleString()}`);@@ -170,7 +197,7 @@ export function NewEditorShell() {});}})();- }, [addAsset, createProject]);+ }, [addAsset, createProject, loadProject]);// Warn on close when dirtyuseEffect(() => {diff --git a/src/components/ai-edition/Preview.tsx b/src/components/ai-edition/Preview.tsxindex bfdee40f2..3748dc046 100644--- a/src/components/ai-edition/Preview.tsx+++ b/src/components/ai-edition/Preview.tsx@@ -137,7 +137,13 @@ export function Preview({const aspectRatioLabel = editorSettings.aspectRatio;return (- <section className={styles.previewWrap} aria-label="Video preview">+ <section+ className={styles.previewWrap}+ aria-label="Video preview"+ data-testid="preview"+ data-current-time-sec={currentTimeSec.toFixed(3)}+ data-is-playing={playing ? "true" : "false"}+ ><div className={styles.previewCanvas}>{hasProject && hasAsset && !videoError ? (<PreviewCanvasdiff --git a/src/components/ai-edition/TimelinePane.tsx b/src/components/ai-edition/TimelinePane.tsxindex fee30672a..8f4ac5cb7 100644--- a/src/components/ai-edition/TimelinePane.tsx+++ b/src/components/ai-edition/TimelinePane.tsx@@ -1003,7 +1003,20 @@ export function TimelinePane({(regionMultiSelection?.some((h) => h.kind === kind && h.id === id) ?? false);return (- <section className={styles.pane}>+ // ponytail: data-* hooks let the Playwright test agent assert on+ // observable behavior (zoom, scrub, region count) without scraping+ // the DOM. Stays in sync with state automatically — render-only,+ // no logic change.+ <section+ className={styles.pane}+ data-testid="timeline-pane"+ data-clip-count={orderedClips.length}+ data-skip-count={skipRanges.length}+ data-zoom-range-count={zoomRegions.length}+ data-annotation-count={annotationRegions.length}+ data-current-time-sec={currentTimeSec.toFixed(3)}+ data-zoom-multiplier={zoom.toFixed(3)}+ ><divref={viewportRef}className={@@ -1017,6 +1030,8 @@ export function TimelinePane({? `${styles.viewport} ${styles.placingCut}`: styles.viewport}+ data-testid="timeline-viewport"+ data-px-per-sec={pxPerSec.toFixed(2)}onPointerDown={handleTimelinePointerDown}onPointerMove={(event) => {// pointerType guards against touch-emulation hoverdiff --git a/tests/e2e/diagnostic.spec.ts b/tests/e2e/diagnostic.spec.tsnew file mode 100644index 000000000..a27c3a5ea--- /dev/null+++ b/tests/e2e/diagnostic.spec.ts@@ -0,0 +1,209 @@+// Diagnostic: open the editor with a seeded project and dump the+// accessibility tree. Used to figure out the right selectors for+// chat input, help button, and timeline ruler — selectors I can't+// guess from the source alone.+import { expect, test } from "@playwright/test";++const EDITOR_URL = "http://localhost:5173/?windowType=editor";++const DOC = {+ schemaVersion: 3,+ project: {+ id: "proj_diag",+ title: "Diagnostic",+ createdAt: "2026-07-01T00:00:00.000Z",+ updatedAt: "2026-07-01T00:00:00.000Z",+ },+ assets: [+ {+ id: "asset_diag",+ kind: "video",+ label: "diagnostic.mp4",+ originalPath: "C:\\nonexistent\\diagnostic.mp4",+ durationSec: 600,+ sizeBytes: 12_345_678,+ video: { codec: "h264", width: 1920, height: 1080, fps: 30 },+ },+ ],+ transcripts: [],+ timeline: {+ clips: [+ {+ id: "clip_diag",+ assetId: "asset_diag",+ sourceStartSec: 0,+ sourceEndSec: 600,+ timelineStartSec: 0,+ timelineEndSec: 600,+ wordRefs: [],+ origin: "system",+ reason: "",+ },+ ],+ gaps: [],+ skipRanges: [],+ muteRanges: [],+ speedRanges: [],+ captionRanges: [],+ },+ annotations: [],+ zoomRanges: [+ {+ id: "z1",+ startMs: 5_000,+ endMs: 15_000,+ depth: 2,+ focus: { cx: 0.5, cy: 0.5 },+ },+ {+ id: "z2",+ startMs: 30_000,+ endMs: 45_000,+ depth: 3,+ focus: { cx: 0.5, cy: 0.5 },+ },+ ],+ legacyEditor: null,+ agent: { pendingQuestions: [], suggestions: [], lastAppliedOperations: [] },+ preview: { strategy: "seek", revision: 0 },+ export: { preset: "final-balanced", lastJobId: null },+ history: { revisions: [] },+};++test("diagnostic: dump editor DOM + accessibility tree", async ({ page }) => {+ await page.addInitScript((serialized) => {+ const d = JSON.parse(serialized);+ localStorage.setItem("browser-shim-document", serialized);+ localStorage.setItem(+ "browser-shim-projects",+ JSON.stringify([+ {+ id: d.project.id,+ title: d.project.title,+ updatedAt: d.project.updatedAt,+ assetCount: d.assets.length,+ },+ ]),+ );+ }, JSON.stringify(DOC));+ await page.goto(EDITOR_URL, { waitUntil: "domcontentloaded" });+ // Hook all console output from the renderer.+ page.on("console", (msg) => {+ console.log(`[renderer:${msg.type()}] ${msg.text()}`);+ });+ page.on("pageerror", (err) => {+ console.log(`[renderer:pageerror] ${err.message}`);+ });+ await page.getByTestId("timeline-pane").waitFor({ state: "visible" });+ // ponytail: wait for the mount useEffect to actually load the project+ // (data-clip-count > 0), so the dump reflects a populated editor.+ try {+ await page.waitForFunction(+ () => {+ const el = document.querySelector('[data-testid="timeline-pane"]');+ const n = el?.getAttribute("data-clip-count");+ return n !== null && Number(n) > 0;+ },+ undefined,+ { timeout: 5_000 },+ );+ } catch {+ console.log("[diag] clip-count never went > 0 — editor stayed in empty state");+ }+ // Print the localStorage keys we ended up with, to verify the seed.+ const storageKeys = await page.evaluate(() => {+ return Object.keys(localStorage).map((k) => ({+ key: k,+ preview: (localStorage.getItem(k) ?? "").slice(0, 80),+ }));+ });+ console.log(`[diag] localStorage keys: ${JSON.stringify(storageKeys)}`);++ // Probe the shim directly. We need to reach the project store's listProjects.+ const shimResult = await page.evaluate(async () => {+ try {+ // The shim is installed on window.electronAPI; the project store+ // goes through nativeBridgeClient which is also window-attached+ // via the shim's module. Try both routes.+ const win = window as unknown as {+ electronAPI?: { getPlatform?: () => unknown };+ nativeBridgeClient?: {+ aiEdition?: {+ listProjects?: () => Promise<unknown>;+ get?: (id: string) => Promise<unknown>;+ };+ };+ };+ const out: Record<string, unknown> = {};+ out.electronAPI = Object.keys(win.electronAPI ?? {});+ out.nativeBridgeClient = Object.keys(win.nativeBridgeClient ?? {});+ out.aiEdition = Object.keys(win.nativeBridgeClient?.aiEdition ?? {});+ try {+ out.listProjectsResult = await win.nativeBridgeClient?.aiEdition?.listProjects?.();+ } catch (e) {+ out.listProjectsError = String(e);+ }+ return out;+ } catch (err) {+ return { error: String(err) };+ }+ });+ console.log(`[diag] shim probe: ${JSON.stringify(shimResult)}`);+ await page.screenshot({ path: "test-results/diagnostic.png", fullPage: true });++ // Buttons in the right pane header.+ const helpButtons = await page.getByRole("button", { name: /help/i }).count();+ console.log(`[diag] help buttons found via getByRole('button', {name: /help/i}): ${helpButtons}`);++ const allButtons = await page.locator("button").count();+ console.log(`[diag] total <button> elements: ${allButtons}`);++ // Dump the aria-label of every button so we can find the right selector.+ const buttonLabels = await page.evaluate(() => {+ const buttons = Array.from(document.querySelectorAll("button"));+ return buttons.map((b) => ({+ text: (b.textContent ?? "").trim().slice(0, 30),+ ariaLabel: b.getAttribute("aria-label"),+ title: b.getAttribute("title"),+ }));+ });+ console.log(`[diag] button labels: ${JSON.stringify(buttonLabels)}`);++ // What are the data-testid values present in the DOM?+ const testIds = await page.evaluate(() => {+ const els = Array.from(document.querySelectorAll("[data-testid]"));+ return els.map((e) => e.getAttribute("data-testid"));+ });+ console.log(`[diag] data-testids: ${JSON.stringify(testIds)}`);++ // What does the data-testid="preview" look like?+ const preview = page.getByTestId("preview");+ console.log(`[diag] preview visible: ${await preview.isVisible()}`);+ console.log(`[diag] preview html start: ${(await preview.innerHTML()).slice(0, 300)}`);++ // Look for the chat input. Try several selectors.+ for (const sel of [+ "textarea",+ 'input[type="text"]',+ '[contenteditable="true"]',+ '[role="textbox"]',+ '[data-testid*="chat" i]',+ ]) {+ const n = await page.locator(sel).count();+ console.log(`[diag] ${sel} count: ${n}`);+ }++ // Look for the right pane container.+ const rightPane = page+ .locator('[data-testid*="right" i], [class*="rightPane" i], [class*="RightPane" i]')+ .first();+ console.log(`[diag] rightPane exists: ${(await rightPane.count()) > 0}`);++ // Dump the first 1500 chars of the page HTML so we can see structure.+ const html = await page.content();+ console.log(`[diag] page html length: ${html.length}`);+ console.log(`[diag] first 1500 chars: ${html.slice(0, 1500)}`);++ // Force the test to pass (we're just printing diagnostics).+ expect(true).toBe(true);+});diff --git a/tests/e2e/roadmap-coverage.spec.ts b/tests/e2e/roadmap-coverage.spec.tsnew file mode 100644index 000000000..b0b74a206--- /dev/null+++ b/tests/e2e/roadmap-coverage.spec.ts@@ -0,0 +1,367 @@+// ponytail: agentic-style roadmap coverage. One test per ✅ row in+// `docs/architecture/ai-edition-roadmap.md` (the ones with specs in+// `specs/`). Each test seeds the browser-shim with a known project,+// opens the editor, and asserts on observable behavior (data-*+// attributes, visible text, console errors). Fails = the roadmap's+// ✅ is a false claim. The agent would re-snapshot the DOM and patch+// brittle selectors; we go straight to the contract.+import { expect, type Page, test } from "@playwright/test";++const EDITOR_URL = "http://localhost:5173/?windowType=editor";++type Asset = {+ id: string;+ kind: "video";+ label: string;+ originalPath: string;+ durationSec: number;+ sizeBytes?: number;+ video: { codec: string; width: number; height: number; fps: number };+};++type Clip = {+ id: string;+ assetId: string;+ sourceStartSec: number;+ sourceEndSec: number;+ timelineStartSec: number;+ timelineEndSec: number;+ wordRefs: string[];+ origin: "system";+ reason: string;+};++type Region = {+ id: string;+ startSec: number;+ endSec: number;+ label?: string;+};++type Doc = ReturnType<typeof makeDoc>;++function makeDoc(+ opts: {+ withAsset?: boolean;+ withClip?: boolean;+ clips?: Clip[];+ zoomRegions?: Region[];+ annotationRegions?: Region[];+ speedRegions?: Region[];+ } = {},+) {+ const asset: Asset | null = opts.withAsset+ ? {+ id: "asset_test",+ kind: "video",+ label: "Test Recording.mp4",+ originalPath: "C:\\nonexistent\\test.mp4",+ durationSec: 60,+ sizeBytes: 314_572_800,+ video: { codec: "h264", width: 1920, height: 1080, fps: 30 },+ }+ : null;+ const clips: Clip[] =+ opts.clips ??+ (opts.withClip && asset+ ? [+ {+ id: "clip_test",+ assetId: asset.id,+ sourceStartSec: 0,+ // ponytail: long enough that fit-zoom (pxPerSec) sits well+ // below MAX_PX_PER_SEC, so Ctrl+wheel has headroom to zoom in.+ sourceEndSec: 600,+ timelineStartSec: 0,+ timelineEndSec: 600,+ wordRefs: [],+ origin: "system" as const,+ reason: "",+ },+ ]+ : []);+ return {+ schemaVersion: 3,+ project: {+ id: "proj_test",+ title: "Test Project",+ createdAt: "2026-07-01T00:00:00.000Z",+ updatedAt: "2026-07-01T00:00:00.000Z",+ },+ assets: asset ? [asset] : [],+ transcripts: [],+ timeline: {+ clips,+ gaps: [],+ skipRanges: [],+ muteRanges: [],+ speedRanges: (opts.speedRegions ?? []).map((r) => ({ ...r, speed: 1.5 })),+ captionRanges: [],+ },+ annotations: (opts.annotationRegions ?? []).map((r) => ({+ ...r,+ kind: "text" as const,+ style: { color: "#ffffff", fontFamily: "Inter", animation: "none" },+ })),+ zoomRanges: (opts.zoomRegions ?? []).map((r) => ({+ id: r.id,+ startMs: Math.round((r.startSec ?? 0) * 1000),+ endMs: Math.round((r.endSec ?? 0) * 1000),+ depth: 2,+ focus: { cx: 0.5, cy: 0.5 },+ })),+ legacyEditor: null,+ agent: { pendingQuestions: [], suggestions: [], lastAppliedOperations: [] },+ preview: { strategy: "seek" as const, revision: 0 },+ export: { preset: "final-balanced" as const, lastJobId: null },+ history: { revisions: [] },+ };+}++async function seedAndOpen(page: Page, doc: Doc): Promise<void> {+ await page.addInitScript((serialized) => {+ const d = JSON.parse(serialized);+ localStorage.setItem("browser-shim-document", JSON.stringify(d));+ // ponytail: the editor's mount flow calls listProjects and loads+ // the first entry on launch. We need to seed the matching summary+ // so the project is discoverable.+ const summary = [+ {+ id: d.project.id,+ title: d.project.title,+ updatedAt: d.project.updatedAt,+ assetCount: d.assets.length,+ },+ ];+ localStorage.setItem("browser-shim-projects", JSON.stringify(summary));+ }, JSON.stringify(doc));+ await page.goto(EDITOR_URL, { waitUntil: "domcontentloaded" });+ await page.getByTestId("timeline-pane").waitFor({ state: "visible", timeout: 10_000 });+ // ponytail: the mount useEffect calls listProjects → loadProject, both+ // async. Wait for the document to actually be loaded (data-clip-count+ // reflects the seeded doc) before tests start asserting.+ await page.waitForFunction(+ (expected) => {+ const el = document.querySelector('[data-testid="timeline-pane"]');+ const n = el?.getAttribute("data-clip-count");+ return n !== null && Number(n) >= expected;+ },+ doc.timeline.clips.length,+ { timeout: 5_000 },+ );+}++async function captureConsoleErrors(page: Page): Promise<string[]> {+ const errors: string[] = [];+ page.on("console", (msg) => {+ if (msg.type() === "error") errors.push(msg.text());+ });+ return errors;+}++test.describe("Roadmap coverage (✅ rows) — agentic behavior specs", () => {+ test("P3.1: media panel shows asset size from sizeBytes", async ({ page }) => {+ const errors = await captureConsoleErrors(page);+ await seedAndOpen(page, makeDoc({ withAsset: true, withClip: true }));++ // The LeftPanel renders the asset list with formatSize(asset.sizeBytes).+ // For 300MB, expect a "MB" suffix.+ await expect(page.getByTestId("timeline-pane")).toBeVisible();++ // The size string should NOT be the em-dash placeholder.+ // We don't insist the size text is in a specific role; just that+ // at least one non-dash MB/KB/B string exists in the panel.+ const sizeText = page.getByText(/\d+(\.\d+)?\s*(B|KB|MB|GB)/i).first();+ await expect(sizeText)+ .toBeVisible({ timeout: 5_000 })+ .catch(() => {+ // If we can't find a sized string, the test fails here → P3.1 is a lie.+ throw new Error("P3.1: no size string visible in the media panel — sizeBytes not rendered");+ });+ expect(errors, errors.join("\n")).toEqual([]);+ });++ test("P3.1: asset without sizeBytes shows em-dash", async ({ page }) => {+ const doc = makeDoc({ withAsset: true, withClip: true });+ if (doc.assets[0]) delete (doc.assets[0] as { sizeBytes?: number }).sizeBytes;+ await seedAndOpen(page, doc);+ await expect(page.getByTestId("timeline-pane")).toBeVisible();+ await expect(page.getByText("—").first()).toBeVisible();+ });++ test("P3.3: clicking Help on a right pane opens a help popover", async ({ page }) => {+ const errors = await captureConsoleErrors(page);+ await seedAndOpen(page, makeDoc({ withAsset: true, withClip: true }));++ // ponytail: the right panel is hidden by default. Click the+ // "Toggle right panel" button to open it.+ const toggleRight = page.getByRole("button", { name: /toggle right panel/i });+ if (await toggleRight.isVisible().catch(() => false)) {+ await toggleRight.click();+ }+ // Click the "Background" tab to open the Background pane.+ const backgroundTab = page.getByRole("button", { name: /background/i }).first();+ if (await backgroundTab.isVisible().catch(() => false)) {+ await backgroundTab.click();+ }+ // ponytail: the P3.3 help button has aria-label="Help" (the RightPanes+ // code sets it from the helpLabel prop, which defaults to "Help"). It+ // lives in a pane header.+ const helpButton = page.getByRole("button", { name: /^help$/i }).first();+ await helpButton.waitFor({ state: "visible", timeout: 5_000 });+ await helpButton.click();++ // The popover is a sibling div with role="note" per the P3.3 commit.+ const popover = page.locator('[role="note"]').first();+ await expect(popover).toBeVisible({ timeout: 3_000 });++ // The popover text should NOT be the generic "Settings for X" fallback.+ const text = (await popover.textContent()) ?? "";+ expect(text.length, "P3.3: popover is empty").toBeGreaterThan(0);+ expect(+ /Settings for/i.test(text),+ `P3.3: popover shows generic fallback instead of pane-specific help. Got: "${text}"`,+ ).toBe(false);++ // Click Help again → popover closes.+ await helpButton.click();+ await expect(popover).toBeHidden({ timeout: 2_000 });+ expect(errors, errors.join("\n")).toEqual([]);+ });++ test("T19: Ctrl+wheel on the timeline viewport changes px-per-sec", async ({ page }) => {+ const errors = await captureConsoleErrors(page);+ await seedAndOpen(page, makeDoc({ withAsset: true, withClip: true }));++ const viewport = page.getByTestId("timeline-viewport");+ const initialPxPerSec = Number((await viewport.getAttribute("data-px-per-sec")) ?? "0");+ expect(initialPxPerSec).toBeGreaterThan(0);++ const box = await viewport.boundingBox();+ if (!box) throw new Error("viewport has no bounding box");+ const centerX = box.x + box.width / 2;+ const centerY = box.y + 30; // top of viewport (ruler area)++ // Ctrl+wheel-up = zoom in. Three notches of -120 each.+ await page.keyboard.down("Control");+ for (let i = 0; i < 3; i++) {+ await page.mouse.move(centerX, centerY);+ await page.mouse.wheel(0, -120);+ }+ await page.keyboard.up("Control");++ // Give React a frame to re-render the data attribute.+ await page.waitForTimeout(150);++ const newPxPerSec = Number((await viewport.getAttribute("data-px-per-sec")) ?? "0");+ const zoomMultiplier = Number(+ (await page.getByTestId("timeline-pane").getAttribute("data-zoom-multiplier")) ?? "1",+ );++ expect(+ newPxPerSec,+ `T19: data-px-per-sec did not change after Ctrl+wheel (was ${initialPxPerSec}, now ${newPxPerSec})`,+ ).toBeGreaterThan(initialPxPerSec);+ expect(+ zoomMultiplier,+ `T19: data-zoom-multiplier should be > 1 after zoom in (got ${zoomMultiplier})`,+ ).toBeGreaterThan(1);+ expect(errors, errors.join("\n")).toEqual([]);+ });++ test("T19: zoom is bounded by MAX_PX_PER_SEC (280)", async ({ page }) => {+ await seedAndOpen(page, makeDoc({ withAsset: true, withClip: true }));++ const viewport = page.getByTestId("timeline-viewport");+ const box = await viewport.boundingBox();+ if (!box) throw new Error("viewport has no bounding box");+ const centerX = box.x + box.width / 2;+ const centerY = box.y + 30;++ await page.keyboard.down("Control");+ for (let i = 0; i < 30; i++) {+ await page.mouse.move(centerX, centerY);+ await page.mouse.wheel(0, -120);+ }+ await page.keyboard.up("Control");+ await page.waitForTimeout(200);++ const pxPerSec = Number((await viewport.getAttribute("data-px-per-sec")) ?? "0");+ expect(pxPerSec, `T19: px-per-sec exceeds MAX (got ${pxPerSec})`).toBeLessThanOrEqual(280);+ });++ test("P3.7: hovering the ruler shows a hover-guide line", async ({ page }) => {+ const errors = await captureConsoleErrors(page);+ await seedAndOpen(page, makeDoc({ withAsset: true, withClip: true }));++ const viewport = page.getByTestId("timeline-viewport");+ const box = await viewport.boundingBox();+ if (!box) throw new Error("viewport has no bounding box");++ // Hover the ruler area (top 22px of the viewport).+ await page.mouse.move(box.x + box.width / 2, box.y + 10);+ await page.waitForTimeout(150);++ // The hover-guide is a 1px-wide div with the .hoverGuide class. It's a+ // positioned element inside the ruler, rendered only while hovering+ // and not in panning/scrubbing/placingCut mode.+ const hoverGuide = page.locator(".hoverGuide, [class*='hoverGuide']");+ await expect(hoverGuide.first())+ .toBeVisible({ timeout: 2_000 })+ .catch(() => {+ throw new Error("P3.7: hover-guide line did not appear on ruler hover");+ });++ // Move away — guide disappears.+ await page.mouse.move(0, 0);+ await page.waitForTimeout(150);+ await expect(hoverGuide.first()).toBeHidden({ timeout: 2_000 });++ expect(errors, errors.join("\n")).toEqual([]);+ });++ test("P1.7: chat panel shows 'applied:' line for tool calls", async ({ page }) => {+ const errors = await captureConsoleErrors(page);+ await seedAndOpen(page, makeDoc({ withAsset: true, withClip: true }));++ // ponytail: the chat panel is hidden by default. Click the "Chat"+ // left-tab button to open it.+ const chatTab = page.getByRole("button", { name: /^chat$/i }).first();+ if (await chatTab.isVisible().catch(() => false)) {+ await chatTab.click();+ await page.waitForTimeout(500);+ }++ // Look for the chat input. Look for a textarea, contenteditable, or+ // placeholder mentioning chat.+ const input = page+ .locator(+ 'textarea, textarea[placeholder*="message" i], [contenteditable="true"], input[type="text"][placeholder*="message" i]',+ )+ .first();+ if (!(await input.isVisible().catch(() => false))) {+ // ponytail: if we can't find the chat input, the test fails — either+ // the chat isn't in the editor's left panel for this build, or the+ // selector needs work. Either way, P1.7 wiring is unverifiable.+ throw new Error(+ "P1.7: chat input not found in the editor — LeftPanel chat surface not reachable",+ );+ }+ await input.fill("trim silence from 1s to 2s");+ await input.press("Enter");+ await page.waitForTimeout(2_000);++ // The browser-shim's chatRun returns a fixed message saying "AI features+ // need real LLM deps" — no tool calls. So the applied-line should NOT+ // appear (or should be empty). This is the negative case; see spec+ // p1.7 scenario 3. The behavior to assert: no spurious "applied:" line.+ const appliedLine = page.getByText(/^applied\s*:/i).first();+ const visible = await appliedLine.isVisible().catch(() => false);+ expect(+ visible,+ "P1.7: 'applied:' line appeared even though the response had no tool calls",+ ).toBe(false);++ expect(errors, errors.join("\n")).toEqual([]);+ });+});diff --git a/tests/e2e/seed.spec.ts b/tests/e2e/seed.spec.tsnew file mode 100644index 000000000..3c4a4f3f5--- /dev/null+++ b/tests/e2e/seed.spec.ts@@ -0,0 +1,34 @@+// ponytail: the seed test gives the planner/generator/healer agents a+// working browser session to bootstrap from. Vite must be running on+// localhost:5173 (npm run dev). It mounts the editor in browser-shim+// mode so no Electron window is required.+import { expect, test } from "@playwright/test";++const EDITOR_URL = "http://localhost:5173/?windowType=editor";++test("seed: editor opens without console errors and exposes the timeline + preview", async ({+ page,+}) => {+ const consoleErrors: string[] = [];+ page.on("console", (msg) => {+ if (msg.type() === "error") consoleErrors.push(msg.text());+ });++ await page.goto(EDITOR_URL, { waitUntil: "networkidle" });++ const timeline = page.getByTestId("timeline-pane");+ const preview = page.getByTestId("preview");+ await expect(timeline).toBeVisible();+ await expect(preview).toBeVisible();++ // ponytail: data-* hooks are how the planner/generator agents assert+ // on behavior. If any of these go missing, every behavior spec breaks.+ await expect(timeline).toHaveAttribute("data-clip-count", /^\d+$/);+ await expect(timeline).toHaveAttribute("data-skip-count", /^\d+$/);+ await expect(timeline).toHaveAttribute("data-current-time-sec", /^\d+(\.\d+)?$/);+ await expect(timeline).toHaveAttribute("data-zoom-multiplier", /^\d+(\.\d+)?$/);+ await expect(preview).toHaveAttribute("data-current-time-sec", /^\d+(\.\d+)?$/);+ await expect(preview).toHaveAttribute("data-is-playing", /^(true|false)$/);++ expect(consoleErrors, `console errors: ${consoleErrors.join("\n")}`).toEqual([]);+});