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
docs: drop the _harvest staging directory
Etienne Lescot96d61cfde124
diff --git a/technical-documentation/_harvest/_BRIEF.md b/technical-documentation/_harvest/_BRIEF.mddeleted file mode 100644index 0dd06d59b..000000000--- a/technical-documentation/_harvest/_BRIEF.md+++ /dev/null@@ -1,80 +0,0 @@-# Reorganization brief (temporary — this whole `_harvest/` directory is deleted at the end)--`./docs` has been renamed to `./technical-documentation`. Files that survive roughly as-is were-already `git mv`'d into the target skeleton. Everything in `_harvest/` is **source material to-harvest and then delete** — migration plans, merge audits, inventories of a repo we merged from,-POC stage logs, and per-task test plans for work that already shipped.--## The one rule that overrides everything--**The docs must describe this branch's code, not its history.** Before writing a sentence about-how something works, open the file that implements it and confirm. If a `_harvest/` doc says-something the code contradicts, the code wins and the doc's claim is dropped — not footnoted.--Concretely, these are the traps (all verified stale as of this branch):--| `_harvest/` says | Reality on this branch |-|---|---|-| `TimelinePane.tsx` renders the timeline | Deleted. `src/components/ai-edition/v4/V4Timeline.tsx` |-| `Titlebar` / `Bottombar` / `RightPanelStack` | Deleted. `v4/EditorTopBar.tsx` + `v4/FloatingInspector.tsx` |-| `TranscriptEditor.tsx` edits the transcript | Deleted. `CaptionsPane.tsx` + `src/lib/ai-edition/captions/` |-| `AxcutDocument` is a "v3 Zod schema" | `schemaVersion` is **5** (`src/lib/ai-edition/schema/index.ts`); v3→v4→v5 migrations live in the same file |-| the browser exporter is the export path | `exportMultiNative` via the native compositor addon |-| "the merge with Axcut", phases 0–9, `AI_FEATURES_ENABLED` rollout | The merge is done. Axcut is not a thing a reader needs to know about |--## Style contract--- **English.** Some `_harvest/` docs are in French; the output tree is English (the repo's- README/AGENTS.md/CONTRIBUTING.md are English and this is a public repo).-- **Present tense, descriptive.** These are architecture and engineering references, not plans.- No task tables, no `✅ done (commit abc123)` columns, no phase numbering, no "recently fixed",- no "supersedes X". History belongs in git.-- **Keep the hard-won specifics.** Measured numbers, file:line anchors, invariants, gotchas, and- "why not the obvious thing" notes are the whole value of these docs. Deleting the narrative- around a measurement is right; deleting the measurement is not.-- Every doc opens with one paragraph: what this subsystem is and where its code lives.-- Close with `## Known gaps` when there are real ones (unwired capabilities, known bugs,- platform holes). Drop anything that is already fixed.-- Cross-reference with relative links (`[document model](document-model.md)`,- `[preview](../architecture/preview.md)`). The link checker enforces that they resolve.-- Use mermaid for diagrams (GitHub renders it). Reuse and correct the existing diagrams rather- than inventing new notation.--## Verification gate--```bash-node scripts/check-docs.mjs-```--It enforces: every required file exists and is more than a stub, every relative link resolves,-no `docs/…` path prefixes survive, and no doc names a deleted component or a deleted doc.-`architecture/decisions.md` is the only file allowed to name removed things (that is its job).--## The diagram that was never integrated--A whiteboard diagram of the authoring levels was referenced by the old timeline doc but never-committed. Embed this mermaid **verbatim** in `architecture/overview.md`, under a heading like-`## Authoring levels`, with a short prose gloss:--```mermaid-flowchart LR- subgraph levels["Authoring levels"]- direction TB- M["<b>Edits / Modifiers level</b><br/>zooms, speeds, trims, …"]- T["<b>Timeline level</b><br/>clip order (1, 2, …)"]- C["<b>Clip level</b><br/>attached media: screen · camera · mic · system audio<br/>crop + in/out timestamps"]- end- DSL[["<b>DSL — AxcutDocument</b><br/>single source of truth"]]- P["Preview"]- R["Render / Export"]-- M -- "authored above the timeline,<br/>stored down on the clip" --> C- T --> DSL- C --> DSL- DSL --> P- DSL --> R-```--The gloss must make the load-bearing point explicit: **modifiers are presented above the timeline-in the UX but stored down on the clip in the data**, which is exactly the invariant-`architecture/timeline-model.md` exists to protect.diff --git a/technical-documentation/_harvest/ai-edition-collision-analysis.md b/technical-documentation/_harvest/ai-edition-collision-analysis.mddeleted file mode 100644index 1828fe33e..000000000--- a/technical-documentation/_harvest/ai-edition-collision-analysis.md+++ /dev/null@@ -1,355 +0,0 @@-# AI Edition Merge — Collision Analysis & Edge Cases--> Cross-references `ai-edition-roadmap.md`, `openscreen-inventory.md`, `axcut-inventory.md`. Every collision listed here must be resolved before its owning phase starts.->-> **Severity legend:** 🔴 breaks the merge · 🟠 will cause user-visible regressions · 🟡 polish / nice-to-have.-------## 1. Schema collisions (Phase 0)--### 1.1 Both projects have `version: 2` but mean different things 🔴-- OpenScreen: `projectPersistence.ts:65` — `PROJECT_VERSION = 2`, denotes the `EditorProjectData` envelope.-- axcut: `axcut-schema/src/index.ts:1` — `axcutSchemaVersion = 2`, denotes the `AxcutDocument` shape.-- **Resolution:** bump everything to v3. Single `SCHEMA_VERSION = 3` constant lives in `src/lib/ai-edition/schema/`. Migration is bidirectional: v2 OpenScreen ↔ v3 ↔ v2 axcut. Document the migration paths in `migrateDocument(value, fromVersion)`:- - `fromVersion = 2, source = 'openscreen'` → wrap `EditorProjectData` into `AxcutDocument` (single asset, single clip spanning full duration, trimRegions inverted to skipRanges).- - `fromVersion = 2, source = 'axcut'` → pass-through (already valid).- - `fromVersion = 3` → no-op.-- Auto-detect source by sniffing for `media.screenVideoPath` (OpenScreen) vs `assets[]` (axcut). No source-of-origin field needed in v3.--### 1.2 Axcut's merged primary `transcript` vs per-asset `transcripts[]` 🟠-- `axcut-schema/src/index.ts:96-100` — `documentSchema` carries **both** a single merged `transcript` and a `transcripts[]` array.-- `document-service.ts:73-83` — every `updateTranscript` call merges all per-asset transcripts into the single primary via `mergeTranscripts`.-- The merge exists because axcut's `VirtualPreview` only consumes one transcript.-- **Collision:** with multi-asset projects, the merge is lossy — you can't tell which words came from which asset.-- **Resolution:** Phase 1 stores only `transcripts[]`; `VirtualPreview` (Phase 2) reads the per-clip `clip.wordRefs[]` instead of a single primary. Drop the `transcript` (singular) field in v3.--### 1.3 OpenScreen's `trimRegions` are inverses of axcut's `skipRanges` 🟠-- OpenScreen: `types.ts:211` — `TrimRegion { id, startMs, endMs }` — regions are **kept**.-- axcut: `axcut-schema/src/index.ts:79` — `skipRangeSchema` — regions are **removed**.-- **Resolution:** migration from v2 OpenScreen inverts: each `trimRegion` becomes a `skipRange` pair (everything outside trim = kept, inside trim = skipped). For the simple case of a single trim region `[a, b]`, you get `skipRanges = [{startSec: 0, endSec: a}, {startSec: b, endSec: duration}]`.-- **Edge case:** when an OpenScreen project has **zero trim regions** (entire recording kept), the migrated project has `skipRanges: []` and **one clip spanning the full duration**. This is the "single-take" baseline — should be the most common migration result.--### 1.4 OpenScreen has fields axcut lacks 🔴-| OpenScreen field | Map to AxcutDocument v3 |-|---|---|-| `editor.trimRegions[]` | invert into `skipRanges[]` |-| `editor.zoomRegions[]` | new `zoomRanges[]` field in `documentSchema` |-| `editor.annotationRegions[]` | new `annotations[]` field in `documentSchema` |-| `editor.speedRegions[]` | already in axcut as `timeline.speedRanges[]` (rangeSchema shape) |-| `editor.{wallpaper, shadowIntensity, showBlur, motionBlurAmount, borderRadius, padding, cropRegion, aspectRatio, webcamLayoutPreset, webcamMaskShape, webcamMirrored, webcamReactiveZoom, webcamSizePreset, webcamPosition, cursorTheme}` | new `legacyEditor` envelope; applied at export time |-| Cursor telemetry (`useScreenRecorder.ts` writes `.cursor.json` next to WebM) | **NOT** in document; stays as sidecar asset metadata. Add `asset.cursorTelemetryPath?` to `assetSchema`. |--### 1.5 Schema fields need asset-scoped addressing 🟠-- In a single-asset OpenScreen project, `zoomRegion.startMs/endMs` are timeline-absolute.-- In a multi-asset project, a zoom region applies to **one source asset** within one **clip**. The simplest model is: zoom regions are clip-scoped, not document-scoped.-- **Resolution:** in v3, `zoomRanges[]`, `annotations[]`, and `speedRanges[]` all carry `clipId?` (optional — null means "apply globally if there's exactly one clip, otherwise error"). OpenScreen's migrated projects (one clip) keep their regions with `clipId: null`. Multi-clip projects require `clipId`.-- This needs a `resolveRegionScope(document, region)` helper.--### 1.6 axcut's `clip_<n>` id generation is fragile 🟡-- `timeline.ts:50-66` — auto-generated ids `clip_1, clip_2, ...`. New clips scan for the next free index. Could collide with user-provided ids.-- **Resolution:** use `crypto.randomUUID()` for all auto-generated clip ids (matching `TimelineEditor.tsx:17` pattern OpenScreen already uses). Update `retimeClips` to skip the numeric generation.-------## 2. Process model collisions (Phases 0, 6)--### 2.1 Python worker + Faster-Whisper → drop entirely 🔴-- axcut spawns Python as a child process via `PythonWorker` (`apps/server/src/services/python-worker.ts:14`). On Windows, finding `python` on PATH is unreliable; on macOS, codesigning a Python interpreter is a nightmare.-- OpenScreen's `transformers.js` Whisper (`src/lib/captioning/transcribe.ts:44`) runs in a Web Worker, already bundled via `caption-assets/`.-- **Resolution:** axcut's `enqueueTranscription` becomes a renderer-side call to `transcribeMono16kToSegments`. `enqueueAssetIngest` (which calls probe + proxy + transcribe) becomes: renderer reads metadata via `mediabunny` probe; transcribes via Whisper; updates the document.-- **Edge case:** axcut's Whisper defaults to `medium` (1.5 GB); OpenScreen bundles `tiny` (~75 MB). Need a user setting `transcriptionModel` (default `tiny`, opt-in to `medium`). The model download flow must happen in the renderer (transformers.js) — no Python download server.--### 2.2 Fastify + SSE → Electron IPC + `webContents.send` 🔴-- axcut: Fastify listens on `127.0.0.1:4010`, SSE stream at `GET /api/projects/:id/events`.-- OpenScreen: Electron main process + IPC handlers.-- **Resolution:** every axcut route becomes a `native-bridge:invoke` domain action (or a new `ai-edition:invoke` channel). The EventBus stays in the main process; fan-out happens via `webContents.send('ai-edition:event', { projectId, event })`. Renderer subscribes via a new `useAiEditionEvents(projectId)` hook.-- **Edge case:** SSE supports auto-reconnect; raw `webContents.send` does not. If the renderer reloads (e.g. user opens DevTools and hits Cmd+R), it must re-subscribe on mount. Plan accordingly in `VideoEditor.tsx`'s `useEffect`.-- **Edge case:** `webContents.send` only reaches the window it targets. Multiple editor windows? OpenScreen currently has one editor window; verify the renderer doesn't open multiple before assuming fan-out works.--### 2.3 SQLite location `.axcut-data/metadata.sqlite` → `app.getPath('userData')` 🔴-- axcut hardcodes the data dir under the repo.-- OpenScreen uses `app.getPath('userData')` (the OS-standard user data location: `~/Library/Application Support/OpenScreen` on macOS, `%APPDATA%/openscreen` on Windows).-- **Resolution:** move SQLite to `app.getPath('userData')/ai-edition/metadata.sqlite`. WAL mode is fine for Electron.-- **Edge case:** `better-sqlite3` is a native module. OpenScreen already has `@electron/rebuild` in devDeps — verify it's wired in `electron-builder.json5` rebuild step. If not, add `npm rebuild better-sqlite3` to the build script.--### 2.4 axcut's `queueMicrotask` job runner → real cancellation 🔴-- axcut `job-service.ts:18-22` schedules work via `queueMicrotask(() => void runX(...))`. No way to cancel.-- **Edge case:** user closes the editor mid-ingest. axcut's Fastify stays alive, the job keeps running, the renderer never sees the result. User is confused.-- **Resolution:** main-process job runner tracks `Set<JobId>` per window. When the editor window closes, mark all its jobs as `cancelled` and abort the underlying `Worker.terminate()` (caption) or `AbortController.abort()` (HTTP fetch for transcription).--### 2.5 axcut credentials in plain JSON → `safeStorage` 🟠-- axcut: `llm-credentials.json` is plain JSON, written under `.axcut-data/`.-- **Security regression:** OpenScreen should not store credentials as plain JSON. Use Electron's `safeStorage.encryptString()` (OS keychain: Keychain on macOS, DPAPI on Windows, libsecret on Linux).-- **Resolution:** `LlmConfigService` (Phase 7) encrypts keys with `safeStorage` before write; decrypts on read. Keys migrate: on first run, detect plain JSON and re-encrypt.-- **Edge case:** `safeStorage.isEncryptionAvailable()` may return false on Linux without a desktop session. Fallback: `electron-store` with a user-set passphrase, or warn + opt-out.-------## 3. UX / UI collisions (Phases 1, 5)--### 3.1 Single recording vs multi-take workflow 🔴-- Today: `useScreenRecorder.ts:621` `stopRecording` → `switchToEditor()` is unconditional.-- Plan said: stay-in-recorder with prompt. **Conflict with the existing flow.** Need a decision:- - **Stay-in-recorder** (Screen Studio feel): every stop → toast "Saved to project X. Record another or open editor?" → two buttons.- - **Auto-open-editor** (today's feel): every stop → editor opens. The user's mental model matches existing.-- **Recommendation:** default to **stay-in-recorder** when `aiEdition` flag is on and there's an active project; default to **auto-open-editor** when there's no active project. The HUD needs a "Switch project" / "New project" affordance.-- **Edge case:** if the user starts recording without an active project, axcut's flow says "create a new project first." OpenScreen today has no project concept on the HUD. Need a quick-create button.-- **Edge case:** what if recording fails (stream error)? Plan path: don't create the asset; don't switch window; show toast.--### 3.2 `Ctrl+C / Ctrl+V` clip duplicate collides with Electron Edit menu 🔴-- Inventory §9 already flagged this. **Resolution:**- - Override the application menu's `Edit > Copy` / `Edit > Paste` roles to call `webContents.send('editor:clipboard', { op: 'copy' | 'paste' })` when the editor window is focused. The editor's React handler intercepts and triggers clip duplicate.- - In text inputs (`<input>`, `<textarea>`, `[contenteditable]`), let the default behavior happen.- - Existing `Ctrl+D` (`deleteSelected`) collision: rename to `Ctrl+Backspace` for delete (less common) OR keep `Ctrl+D` and pick another binding for duplicate-clip (`Cmd+Shift+D`?).-- **Edge case:** axcut's web app has no system menu to override. The Electron-native approach is new to axcut's clip-dup UX. Test on all three platforms.--### 3.3 Modals stack: axcut uses many modals; OpenScreen uses dialogs + sonner 🟠-- axcut has `ProviderSettingsDialog`, `LoadVideoDialog`, `SessionHistoryDialog`, `WorktreeDialog`, `TranscriptDialog`, `InsertAssetDialog`. All rendered as `modal-backdrop` divs.-- OpenScreen uses `@radix-ui/react-dialog` (`src/components/ui/dialog.tsx`, z-index 9999/10000) and `@radix-ui/react-select` (z-index 100000).-- **Collision:** z-index wars. axcut's CSS uses `.modal` and `.modal-backdrop` classes; mixing with Radix's portal-based stacking is fragile.-- **Resolution:** rewrite axcut's modals to use Radix `Dialog` primitive. Keep the surface (`models / providers / settings` screens) but back them with Radix's portal.-- **Edge case:** the `ProviderSettingsDialog` has a "popover" mode (anchored to a button) and a "modal" mode (full screen). Map popover → Radix `Popover`, modal → Radix `Dialog`. Single component, two surfaces.--### 3.4 Window model: 4 OpenScreen windows vs 1 axcut web app 🟠-- OpenScreen: HUD-overlay, SourceSelector, CountdownOverlay, Editor. They coordinate via IPC + main-process singletons.-- axcut: one web page with everything.-- **Resolution:** the AI-edition view is part of the Editor window. When AI-edition is enabled and a project is open, the editor renders the new layout (resources + preview + transcript + chat + timeline). No new window.-- **Edge case:** during recording, the HUD is open. Should the chat be visible? **No.** Chat is editor-only. Plan accordingly.--### 3.5 i18n: axcut has none; OpenScreen has 13 locales × 7 namespaces 🔴-- axcut: every UI string is hardcoded English.-- OpenScreen: 91 JSON files; `npm run i18n:check` enforces parity.-- **Resolution:** every AI-edition string must go through `useScopedT(namespace)` from `I18nContext.tsx`. Two new namespaces: `ai-edition.editor`, `ai-edition.transcript`, `ai-edition.chat`, `ai-edition.providers`. Run `npm run i18n:check` before each PR.-- **Edge case:** axcut has lots of long descriptive text ("Click a word, then shift-click another..."). Translation to 13 languages will require a translator pass — not just machine translation, since some of these are domain-specific. Plan a translator round before Phase 9 ships.--### 3.6 Markdown rendering for chat bubbles 🟡-- axcut's `CurrentTranscriptView` likely renders assistant messages as markdown (verify by reading the file in detail). OpenScreen has no markdown renderer.-- **Resolution:** add `react-markdown` + `remark-gfm` to deps. Bundle cost ~30 KB gzipped.-- **Edge case:** markdown content from the LLM can be hostile (XSS, prompt injection). Sanitize with `rehype-sanitize`. Do NOT use `dangerouslySetInnerHTML`.--### 3.7 React Query vs plain IPC 🟠-- axcut uses `@tanstack/react-query` extensively. OpenScreen has no React Query.-- **Resolution:** add React Query as a dependency, OR replace with `useEffect` + `useState` + an event subscription. React Query is 13 KB gzipped but adds value (caching, retries, optimistic updates). **Recommendation:** add React Query. Phase 6 (agent runtime) leans on it heavily for the message list + project snapshot queries.--### 3.8 Radix `Select` z-index 100000 vs Dialog z-index 9999 🟡-- OpenScreen's `select.tsx:86` uses z-index 100000 to sit above dialog.-- axcut's modals don't use Radix. After rewriting modals to Radix Dialog (z-index 9999), the Select z-index is correct (above dialog content but below modal backdrop is not quite right — select should close when dialog opens).-- **Resolution:** in the new Radix-backed modals, use `Dialog.Close` to dismiss on outside interaction. Select inside Dialog should work normally.--### 3.9 The `Cursor` recorder is not in axcut 🟠-- OpenScreen has cursor telemetry → editable overlay cursor in preview/export.-- axcut's `clips[]` and `skipRanges[]` don't model cursor at all. In a multi-asset timeline, when a clip replays, the cursor must replay the asset's telemetry for the clip's source-time range.-- **Resolution:** extend `axcut-schema` v3 `clipSchema` with `cursorEnabled?: boolean` (default `true` if the asset has cursor telemetry). Phase 3 (exporter) reads this and applies `getSmoothedCursorPath` per clip.-- **Edge case:** axcut's `applySkipRangesToClips` clones the clip and changes its `id` (e.g. `clip_1__skip_part_1`). The clone needs to inherit cursorEnabled.-------## 4. Feature collisions (each phase)--### 4.1 OpenScreen-only features to preserve-- **Auto-caption annotation injection** (`annotationsFromCaptions.ts`). After Phase 4 (transcription), the renderer should write to **both** `transcripts[]` (axcut-style) **and** auto-create `AnnotationRegion[]` from the same words (OpenScreen-style). Or: pick one. **Recommendation:** drop the auto-caption annotation flow in favor of axcut's TranscriptDialog; lower-third captions are a different feature (user-added annotations), not auto-captions. Users who want captions-on-video can add them manually or via a "render captions as overlay" export preset (future).-- **3D rotation presets** (`Rotation3D`, `types.ts:34`). Stay in v3 schema.-- **GIF export** (`gifExporter.ts`). Keep; out of scope for AI-edition but harmless to preserve.-- **Native capture helpers** (Swift/CMake). Frozen; no changes.-- **Single-instance lock + tray** (`singleInstanceLock.ts`, `main.ts:304-360`). Keep.-- **Shortcuts file** (`userData/shortcuts.json`). Keep — extend for clip-dup, move-clip, etc.--### 4.2 axcut-only features to drop or rewrite-- **`worktreeService`** — drop entirely. Video projects don't need git worktrees.-- **`proxy.mp4` per asset** — axcut generates a low-res proxy during ingest for fast preview scrubbing. OpenScreen already has the streaming decoder. **Decision (locked 2026-06-25):** no proxy files; rely on `StreamingVideoDecoder` (WebCodecs) to seek the source on demand. **Known concern:** users have reported scrubbing lag on long recordings (>30 min). Documented in `ai-edition-roadmap.md §5 (deferred)` with a revival path (per-asset "Generate proxy" button + auto-enable threshold at 30 min duration).-- **`.axcut-data/` directory tree** — replaced by `app.getPath('userData')/ai-edition/` and `app.getPath('userData')/projects/`.-- **ChatGPT device-flow OAuth** (`openai-account.ts`) — keep; it works in Electron main process.-- **GitHub Copilot token exchange** (`copilot-account.ts`) — keep.-- **`@axcut/schema` package as a separate package** — fold into `src/lib/ai-edition/schema/`. No monorepo.--### 4.3 Recording format collisions 🟠-- OpenScreen outputs: `.webm` (browser), `.mp4` (native Windows), `.mp4` + separate `.mp4` (native macOS for screen + webcam).-- axcut accepts: `.mp4, .mov, .m4v, .webm, .mkv`.-- **Resolution:** the AI-edition asset validator accepts the same set. Macos webcam `.mp4` from native recording flows in fine. Browser recording `.webm` flows in fine.--### 4.4 Cursor file sidecar format 🟠-- OpenScreen writes `<screenFileName>.session.json` (manifest) + `<screenFileName>.cursor.json` (telemetry v2 format).-- axcut doesn't know about these.-- **Resolution:** when ingesting an OpenScreen-recorded asset, copy the `.cursor.json` into `app.getPath('userData')/projects/<id>/assets/<assetId>.cursor.json` (or symlink). Reference it from `asset.cursorTelemetryPath`.--### 4.5 Webcam-as-separate-file (macOS) vs muxed (Windows) 🟠-- macOS native: screen WebM/MP4 + webcam MP4 as two separate files. `attachNativeMacWebcamRecording` (`handlers.ts:2141`) binds them into a session.-- Windows native: muxed.-- **Resolution:** an AI-edition "Recording" asset is logically one recording session that may produce two physical files (screen + webcam). Model as: `RecordingSessionAsset { screenAsset: AxcutAsset, webcamAsset?: AxcutAsset, sessionManifestPath: string }`. The composite is opaque to the timeline; the renderer/exporter reads both.-- **Edge case:** user records without webcam (browser-only or native screen-only). Webcam asset is absent. Renderer handles null.-------## 5. Edge cases the plan didn't cover--### 5.1 Chat session per project, not global 🔴-- axcut: each project has N sessions; `projectId × sessionId` is the unit.-- OpenScreen's `currentRecordingSession` is a single value, replaced wholesale.-- **Resolution:** introduce `ai-edition:projects:list` IPC, `ai-edition:projects:set-active` to switch the active project. The Editor window always renders the active project. Chat is per-active-project.--### 5.2 What if the recording file is moved/deleted? 🟠-- axcut trusts absolute paths. If the file is moved, ops referencing `startSec/endSec` still work but rendering breaks (file not found).-- **Resolution:** on every render of VirtualPreview or export, check `await fetch(asset.originalPath)` for 200/404. On 404, show a "file missing" banner with a "Locate file" button. `electron/dialog.showOpenDialog` to pick the replacement. Update `asset.originalPath` via `updateAsset`.--### 5.3 Migration of v2 project opened in AI-edition mode, then user toggles back off 🟡-- Project is migrated to v3 on first AI-edition save. If the user toggles AI-edition off, the project has already been saved as v3. The legacy `EditorProjectData` reader can't open v3.-- **Resolution:** either (a) never migrate in place — keep a v2 copy next to v3; or (b) the legacy reader learns to read v3 and discard unknown fields. **(b)** is simpler and the right call: extend `projectPersistence.ts` `validateProjectData` to accept v3 and ignore `clips/skipRanges` etc.--### 5.4 Undo/redo across checkpoints 🟠-- OpenScreen has `useEditorHistory.ts` (80-step ring buffer) for UI-driven undo.-- axcut has `document.history.revisions[]` for full restoration.-- **Resolution:** pick one as SSOT. **Recommendation:** `revisions[]` is the SSOT. UI undo = pop the last revision, restore document. The 80-step ring buffer goes away. Existing OpenScreen undo history migrates to a single `revision` with `operations[]` of the diff (compute via `JSON.parse(JSON.stringify(prev))` for now, optimize later).--### 5.5 Auto-caption annotation regeneration after timeline edits 🟠-- OpenScreen's `captionSegmentsToAnnotationRegions` is idempotent; the editor merges new regions with existing.-- After AI-edition timeline edits (clips added, skips added), the captions are still in `transcripts[]` but the annotations are stale (referring to times that no longer exist in the timeline).-- **Resolution:** clear `annotations[]` of `annotationSource = 'auto-caption'` on any timeline op. Re-run auto-caption generation. Or: skip auto-caption entirely (recommendation in §4.1).--### 5.6 Multiple sequential recordings append to the same project 🔴-- Today: each `stopRecording` overwrites the current pointer.-- Post-merge: each stop appends to active project.-- **Edge case:** the user records take 1, takes a break, records take 2 (after pause/resume → 2 segments, 1 file) → 1 new asset, 1 new clip. Records take 3 (after switching source) → 1 new asset, 1 new clip. Project has 3 assets, 3 clips.-- **Edge case:** what if the user does NOT want to add to the current project? Need a "Save to project..." picker or "New project" button in the HUD. Today there's none.--### 5.7 Recording while a chat run is in flight 🟠-- New recording → new asset → document updates → agent's next tool call sees the new asset → op might apply to the wrong asset.-- **Resolution:** at the start of every chat turn, snapshot the document. At the end, check if any `assetId` referenced by applied ops still exists. If not, the op is dropped with a warning logged.-- Alternatively: lock the document during chat run (UI shows "Editing in progress"). **Recommendation:** snapshot + verify, not lock. Locks feel slow.--### 5.8 Provider config in env vs UI 🔴-- axcut reads env keys (`OPENAI_API_KEY` etc.) and they win over stored keys.-- OpenScreen currently has no LLM provider; doesn't matter.-- **Resolution:** port axcut's env precedence. Document in the AI-edition settings UI: "Detected OPENAI_API_KEY in environment — using that." with an option to override.--### 5.9 ChatGPT OAuth device flow in Electron 🟠-- axcut's `chat-codex-oauth.ts` uses `https://chatgpt.com/backend-api/codex/responses`. The device-flow challenge shows a code + URL the user opens in a browser.-- **Resolution:** show the code in a Radix Dialog. On completion, optionally open the URL via `electron.shell.openExternal`. Store the refresh token in `safeStorage`-encrypted JSON.-- **Edge case:** the `codex_cli_rs` originator header is hardcoded. If OpenAI rate-limits the originator, the auth still works but the chat completion fails. Need a retry + clear error.--### 5.10 Reasoning effort persistence 🟠-- axcut stores `reasoningEffort` per project.-- OpenScreen has no equivalent.-- **Resolution:** Phase 7 adds `reasoningEffort` to `UserPreferences` (global default) + `AxcutLocalConfig` (per-provider) + `AxcutDocument.export` (last-used).--### 5.11 App quit during in-flight LLM stream 🔴-- User starts chat → 30s into the LLM response → closes the window.-- axcut's Fastify stays alive; the run completes; user sees no result.-- **Resolution:** the main process `before-quit` waits up to N seconds for in-flight runs to finish (saving the final assistant message + checkpoint). After timeout, force-quit. Use Electron's `app.on('before-quit', e => e.preventDefault(); await drain(); app.quit())`.--### 5.12 Concurrent edits: agent + user 🟠-- User clicks "Add skip" while agent is mid-run.-- axcut's `DocumentService.applyOperation` reads + writes; no locking.-- **Resolution:** serialize via a per-project async lock (a simple promise chain). User ops get queued. After agent run, queued ops apply.--### 5.13 Transcript quality vs project scale 🟠-- A 1-hour screen recording × `medium` Whisper model = ~30 minutes transcription + 1.5 GB model download.-- **Resolution:** show a warning when transcription is starting on a long file. Allow cancellation (`AbortController` on the caption worker). Allow user to pick model size before transcription starts.--### 5.14 Cross-platform path handling 🟠-- axcut: pure POSIX path semantics in `paths.ts`.-- OpenScreen: Windows uses `\` or `/` depending on context. `fromFileUrl` / `toFileUrl` (`projectPersistence.ts:148-184`) handles this.-- **Resolution:** all axcut paths in `electron/ai-edition/` use Node `path.join` (already cross-platform). The renderer receives `file://` URLs via the existing pattern.--### 5.15 File watcher on `app.getPath('userData')` 🟡-- AI-edition writes to userData frequently. If a backup tool or `git init` runs in there, things break.-- **Resolution:** no fix needed; document that the userData dir is managed by Electron.--### 5.16 Schema v3 → v4 in the future 🟡-- If we change the schema again, we need migration code.-- **Resolution:** Phase 0 introduces `migrateDocument(value, fromVersion): { document: AxcutDocument, fromVersion: number }`. Set the bar for future migrations now.-------## 6. Performance / scaling--### 6.1 VirtualPreview with many clips 🟠-- Two `<video>` layers with crossfade. For 2 clips, perfect. For 10 clips, the next clip must preload in the inactive layer. If the user seeks across 5 clips rapidly, you get 5 sequential seek+play cycles.-- **Resolution:** keep the two-layer design but add a "smart preload" — preload the next 2 clips when within 0.5s of a boundary. For 10+ clips, consider adding a single-frame "thumbnail strip" seek bar.--### 6.2 Export with mediabunny across multiple sources 🟠-- Each source clip needs a separate demuxer instance. mediabunny supports this but each demuxer has its own decoder pool.-- **Resolution:** prototype in Phase 3 PR 3.1 with a 3-clip fixture. If memory blows up (>2 GB), consider a sequential approach: render each clip to an intermediate file, then concat via `mp4box.js`.--### 6.3 Project file size 🟡-- A 5-clip project with full transcripts (each ~30 KB JSON) + zoom + annotation + cursor telemetry refs = ~500 KB JSON. Per-save JSON.stringify on 500 KB is fast but not free.-- **Resolution:** debounce saves to 250ms after last edit. Or write incrementally (only the changed slice). For Phase 0, debounce is enough.-------## 7. Testing strategy additions--### 7.1 E2E for AI-edition happy path 🟠-- New `tests/e2e/ai-edition-happy-path.spec.ts`: launch Electron → record 5s → editor opens → add asset → trigger transcription (mock LLM) → chat "remove silences" (mock LLM) → preview → export → ffprobe the output.-- **Edge case:** ffprobe may not be on CI. Mark assertion as conditional.--### 7.2 Mock LLM responses 🟠-- axcut doesn't mock LLMs in tests (relies on canned transcripts).-- OpenScreen tests don't involve LLMs.-- **Resolution:** create a `MockChatModel` class that returns canned `AIMessage`s from fixtures. Used in agent-runtime unit tests + e2e. Lives in `electron/ai-edition/__mocks__/`.--### 7.3 SQLite migration test 🟡-- `database.ts` migrations are inline ALTER TABLEs. Need a test that creates a v1 schema, applies v2 + v3 migrations, asserts final schema.-- **Resolution:** add a `database.test.ts` that uses an in-memory `:memory:` SQLite db.--### 7.4 Cursor telemetry replay test 🟡-- A multi-clip timeline with cursor telemetry must replay the right cursor per clip's source-time range.-- **Resolution:** fixture: 3 clips × cursor telemetry. Assert: at virtual time 0:05 (inside clip 1), cursor reads from clip 1's telemetry; at virtual time 0:30 (inside clip 2), from clip 2's.-------## 8. Phase ordering adjustments (delta from the plan)--Based on the above, two phase adjustments:--### Phase 0 needs to grow-- ✅ Schema v3 with `annotations`, `zoomRanges`, `legacyEditor`, `cursorTelemetryPath`.-- ✅ Real `migrateDocument(value, fromVersion, source)` — bidirectional v2 ↔ v3.-- ✅ Drop axcut's `transcript` (singular) field — only `transcripts[]` in v3.-- ✅ Add `clipSchema.cursorEnabled` and region `clipId?` scoping.-- ✅ `crypto.randomUUID()` for all auto-generated clip ids.--### Phase 6 (agent runtime) needs to split-- 6.1: document + chat-service + event-bus + IPC channels + SQLite (no LLM yet).-- 6.2: LLM config + provider-registry port.-- 6.3: agent-runtime + deepagent integration + streaming events + suggestion approval flow.-- 6.4: checkpoints + restore (depends on 6.1 + 6.3).--Reasoning: the streaming agent code is hard to test without a working chat pipeline underneath. Splitting lets 6.1 land first and provide the IPC contract that 6.3 builds on.--### New Phase 2.5: cursor in multi-clip-- After Phase 2 (VirtualPreview) but before Phase 3 (exporter), add cursor-aware clip playback.-- This is a small phase (~200 LOC) but important for parity with OpenScreen's existing cursor editing.-------## 9. Locked decisions (resolved 2026-06-25)--All questions resolved with the user before Phase 0. Decisions are also recorded in `ai-edition-roadmap.md §3`.--1. **Stop behavior** — ✅ first recording = auto-open (current behavior); second-and-later recordings in an active AI-edition project = stay-in-recorder with "Open editor / Record another" prompt. Preserves existing UX for users who don't use AI Edition. Decision §3.1.-2. **Auto-caption annotations** — ✅ drop entirely. AI-edition's transcript is richer; users add overlay annotations manually if needed. Decision §4.1.-3. **React Query** — ✅ add `@tanstack/react-query` as a dependency. Phase 6 leans on it. Decision §3.7.-4. **Credential storage** — ✅ use Electron's `safeStorage` (OS keychain). Plain JSON is a security regression. Decision §2.5.-5. **Whisper model default** — ✅ bundle OpenScreen's existing smaller model. Add a "Transcription model" picker in settings with download size + speed hints; user opts into larger. Decision §2.1 + §5.13.-6. **Proxy MP4 generation** — ✅ drop. Rely on `StreamingVideoDecoder`. **Documented limitation:** users have reported scrubbing lag on long recordings (>30 min). Revival path in `ai-edition-roadmap.md §5 (deferred)`. Decision §4.2.-7. **File extension** — ✅ keep `.openscreen`. No rename. Decision §3 of the merge plan + §6.3.-8. **Repository / packaging model** — ✅ **single package, in-tree.** AI-edition lives inside the openscreen repo at `src/lib/ai-edition/`, `electron/ai-edition/`, `src/components/ai-edition/`, `src/i18n/locales/<locale>/ai-edition.*`. One `package.json`, one CI, one release. No monorepo, no separate npm package, no separate repo. Decision §4.2 + §6 of the merge plan.-------## 10. Summary of deltas to the original plan--| Original plan | This analysis recommends | Why |-|---|---|---|-| Phase 0: vendor schema, add v3 fields | Phase 0+: real `migrateDocument`, drop primary transcript field, add `clipId?` scoping | The original was too light on migration; primary transcript is lossy. |-| Phase 1: 3 PRs | Phase 1: 3 PRs as planned | Same. |-| Phase 2: VirtualPreview | Phase 2 + 2.5: VirtualPreview + cursor-aware playback | Cursor in multi-clip is a small but important addition. |-| Phase 3: Exporter | Phase 3: as planned, with explicit perf testing on 3-clip fixture | Same. |-| Phase 4: Transcription | Phase 4: as planned + drop auto-caption annotation flow | Auto-caption collides with axcut's transcript model. |-| Phase 5: Recorder preservation | Phase 5: as planned, with the "first recording auto-opens editor" carve-out | Preserves existing UX. |-| Phase 6: Agent runtime (2 PRs) | Phase 6: split into 6.1/6.2/6.3/6.4 | Testability + ordering. |-| Phase 7: Providers | Phase 7: as planned + `safeStorage` | Security. |-| Phase 8: History + checkpoints | Phase 8: as planned + revisions become the SSOT (replace useEditorHistory) | Single source of truth. |-| Phase 9: Polish | Phase 9: as planned + add `ai-edition.*` i18n namespaces | i18n. |-| Phase 10: Cut-over | Phase 10: as planned | Same. |\ No newline at end of filediff --git a/technical-documentation/_harvest/ai-edition-remediation-spec.md b/technical-documentation/_harvest/ai-edition-remediation-spec.mddeleted file mode 100644index 8e6fd033f..000000000--- a/technical-documentation/_harvest/ai-edition-remediation-spec.md+++ /dev/null@@ -1,216 +0,0 @@-# feat/ai-edition — spec de remédiation--Suite de [main-vs-ai-edition-audit.md](main-vs-ai-edition-audit.md). Ce document est la-spec d'implémentation : quatre lots à causes distinctes, à traiter sur une branche neuve-partant de `feat/ai-edition`.--Convention de statut :-**[C]** cherry-pick depuis la branche parquée · **[N]** à écrire · **[M]** à mesurer avant-de décider.--## État au 2026-07-25--Livré sur `claude/ai-edition-remediation` : **lot 1 en entier** (1.1 à 1.5), **lot 2 en-entier** (2.1 réordonnancement, 2.2 mixage audio natif, 2.3 annotation vide), **3.1**-vitesse libre et **3.2** bascule focus zoom. Validation : `tsc` propre, `biome` propre,-423 tests front + 25 tests Rust verts, dont 15 nouveaux.--S'y ajoutent, après une session de test : la rampe d'ease-in du zoom manuel (le focus-dérivait latéralement), le lissage du suivi auto (étage `cursorFollowUtils` jamais porté),-le toggle Auto-Focus global de la barre d'outils avec verrouillage du contrôle par région,-et la suppression de la note « au-delà de 16× » qui décrivait l'éditeur legacy.--Reste ouvert : **3.3** rotation de zoom, **3.5** annotations non-texte, le **lot 4**-(arbitrage produit), et les trois différés — MSIX, #120 playhead, #127 partie 2.--Validé en application : rampe manuelle, pan auto lissé, verrou du toggle global, multiclip-réordonné, enregistrement avec webcam. Reste non vérifié faute de fichier source :-**l'export d'un enregistrement multipiste réel** (2.2) — la logique de mixage est couverte-par des tests unitaires, pas par un export bout en bout.--La branche parquée `claude/rebase-ai-edition-main-c65d0d` (PR #154) a été **vidée de ce-qu'on en voulait** : elle peut être fermée sans merge. Ses deux commits de portage #109-(exporteur navigateur) ne sont pas repris — 2.2 les remplace côté Rust.-------## Lot 1 — Correctifs partagés venus de main (risque faible)--Cinq bugs corrigés sur main, toujours vivants chez nous. Le code concerné est quasi-identique entre les deux branches : ce sont des cherry-picks, déjà faits et compilés sur-`claude/rebase-ai-edition-main-c65d0d` (PR #154).--| # | Symptôme | Fix | Statut |-| --- | --- | --- | --- |-| 1.1 | Enregistrer une **fenêtre** aux dimensions client impaires → vidéo entièrement noire. H.264 exige des dimensions paires ; `CopyResource` no-op silencieusement sur écart de taille. | `roundUpToEven()` dans `WgcSession::createCaptureItem(HWND)`, utilisé pour le frame pool **et** `captureWidth/Height()`. Capture moniteur intouchée. | **[C]** PR #122 |-| 1.2 | Sous encodeur **logiciel**, l'arrêt de l'enregistrement peut ne jamais aboutir : `WriteSample` bloquant tenu sous le mutex partagé affame le thread principal qui attend `stopRequested`. | Scinder en `captureVideoSample` (sous mutex) / `submitVideoSample` (hors mutex). | **[C]** PR #119 |-| 1.3 | Filet de sécurité du précédent : l'attente par frame du writer n'a pas de timeout, une notification manquée fige le `join()`. | `wait_for(100ms)` dans la boucle frame. | **[C]** PR #123 |-| 1.4 | **Linux/Wayland** : l'enregistrement ne produit aucune frame exploitable (`EGL_BAD_MATCH`, renégociation DMA-BUF). Chromium initialise Vulkan, incompatible avec le backend Ozone Wayland. | `appendSwitch("disable-features", "Vulkan")` sous Wayland, dans `electron/main.ts`. | **[C]** PR #91 |-| 1.5 | Déplacer le HUD par sa poignée : la fenêtre **dérive** au lieu de suivre le curseur. Deux canaux IPC repositionnent la fenêtre (delta de drag + recalage d'ancre du `ResizeObserver`) et se composent. | Geler la mesure de taille pendant le drag (`isDraggingHudRef`), re-mesurer une fois au relâchement. | **[C]** PR #125 + son test |--**Point d'attention unique** : `main.cpp` (1.2/1.3) demande un merge à la main — ai-edition-a sa propre cadence CFR webcam sur horloge réelle, qu'il faut préserver en n'important que-le découpage capture/submit. Ce merge est déjà fait et compilé sur la branche parquée.--**Validation lot 1** : rebuild natif, puis enregistrement avec webcam (synchro A/V en fin de-vidéo, pause/reprise, stop immédiat) + capture d'une fenêtre redimensionnée en dimensions-impaires (vérifier l'absence de frames noires).-------## Lot 2 — Bugs propres à ai-edition (le cœur du sujet)--### 2.1 — Le playhead revient en arrière à la jonction, après réordonnancement **[N]**--**Symptôme (rapporté).** En multi-clips le playback enchaîne sans pause. Après avoir changé-l'ordre des clips, la tête de lecture s'arrête à la jonction et revient au début du clip-qu'elle vient de parcourir. Reproduit avec **deux assets distincts**.--**Cause.** Staleness de closure dans `VirtualPreview.tsx`.--- `seekToVirtualTime` est un `useCallback` de deps `[clips, videoSources, sourceIndex, updateVirtualTime]`- (ligne 440) : nouvelle identité **à chaque réordonnancement**.-- La boucle rAF (ligne 183) est délibérément re-créée **uniquement** sur- `[activeSource?.id]`, avec un `biome-ignore useExhaustiveDependencies`.-- Tout ce que lit le `tick` passe par des refs tenues à jour (`clipsRef.current`,- `virtualTimeSecRef.current`) — **sauf `seekToVirtualTime`**, appelé directement depuis- la closure (lignes 289 et 315).--Enchaînement : le `tick` détecte correctement la fin de clip et calcule le bon clip suivant-via `findNextClipByTimelineOrder(clipsRef.current, …)` — données **fraîches**. Puis il-appelle un `seekToVirtualTime` **figé sur l'ordre d'avant le réordonnancement**, qui résout-`nextClip.timelineStartSec` contre l'**ancien** layout via `locateVirtualPosition(clips, …)`-et retombe donc sur le clip qui occupait cette position avant — celui qu'on vient de jouer.-D'où le retour au début.--Sans réordonnancement, ancien et nouveau tableau sont identiques : aucun symptôme. C'est-exactement le conditionnement observé. `sourceIndex` est stale lui aussi, mais s'auto-guérit-(un changement d'asset re-crée la rAF) ; l'ordre des clips, non.--**Pourquoi c'est intermittent.** Le handler `onEnded` (ligne 549) fait le même enchaînement-mais depuis le JSX, donc avec une closure **fraîche** — il est correct. Pour un clip **non-trimé**, la fin de fichier coïncide avec la fin de fenêtre timeline et `ended` gagne la-course contre le rAF → pas de bug. Pour un clip **trimé**, seul le rAF déclenche → bug.--**Fix.** `seekToVirtualTimeRef` **existe déjà** (ligne 462) mais n'est consommé que par-l'effet `seekTarget`. Remonter sa déclaration au-dessus de l'effet rAF et faire appeler-`seekToVirtualTimeRef.current(…)` par le `tick` (lignes 289 et 315). Cela préserve-l'intention d'origine — ne pas re-créer la rAF à chaque rendu — en supprimant la staleness.--**Non-régression.** Le commentaire ligne 451 documente pourquoi les deps avaient été-retirées : les remettre ferait rejouer un ancien `seekTarget` et figerait la lecture. Le-passage par ref est précisément la solution déjà retenue là-bas ; on l'étend au rAF.--**Statut de la preuve.** Mécanisme établi par lecture du code, **non reproduit en live**. À-confirmer avant de considérer le lot fermé.--**Validation** : deux clips **trimés** issus de deux assets → lire, vérifier l'enchaînement ;-réordonner → relire, vérifier l'enchaînement ; refaire avec des clips non trimés (chemin-`ended`, doit rester correct) ; scrub manuel puis lecture (chemin `seekTarget`, ne doit pas-régresser).--### 2.2 — Le micro est absent de l'export **[N]**--**Symptôme.** Les enregistrements natifs macOS écrivent audio système et micro en **deux-pistes AAC séparées**, toutes deux marquées `default`. Si rien ne joue sur le système, la-première piste est silencieuse — et c'est celle qui est exportée. Le micro est perdu.--**Cause chez nous.** `poc-d3d/src/audio.rs:177` — `decode_clip_audio_inner` appelle-`av_find_best_stream(…AVMEDIA_TYPE_AUDIO…)` et ne décode **qu'une seule** piste. C'est-exactement le bug #108, mais dans l'exporteur **natif**.--**Ce qui n'est pas la solution.** Le correctif de main (#109) vit dans l'exporteur-navigateur (`videoExporter` / `audioEncoder` / `streamingDecoder`), chemin que-`ExportDialog` n'emprunte plus (`ExportDialog.tsx:289` → `exportMultiNative`). Les deux-commits correspondants de la branche parquée sont **à jeter**.--**Fix.** Réimplémenter en Rust dans `audio.rs` : énumérer **toutes** les pistes audio du-conteneur, décoder chacune, les sommer alignées sur leur offset temporel, downmix vers le-format cible, clamp `[-1, 1]`. Miroir de `mixPlanarSources` côté main, dont la logique et-les cas de test sont réutilisables tels quels comme spec.--**Validation** : export d'un enregistrement natif macOS multipiste → le micro est audible.-Un enregistrement mono-piste doit rester bit-identique au comportement actuel. Test unitaire-Rust sur la sommation (piste silencieuse + tonalité → tonalité présente).--### 2.3 — L'annotation texte naît remplie **[C]**--**Symptôme.** Une nouvelle annotation texte est créée avec `"New annotation"` en dur-(`useTimeline.ts:259`). Le placeholder de l'inspecteur ne s'affiche jamais et la saisie-s'ajoute derrière le texte existant.--**Fix.** `content: ""` / `textContent: ""`, ajouter le `placeholder` sur le champ, et-sélectionner l'annotation fraîchement créée (une annotation vide ne rend rien : sans-sélection elle serait invisible et non cliquable). Déjà fait sur la branche parquée.-------## Lot 3 — Capacités présentes mais non câblées au shell V4--Aucune ne vient de main. Ce sont des contrôles perdus au passage à l'éditeur V4 : la-logique est là, l'UX a disparu avec les conteneurs démontés (`RightPanelStack`,-`Bottombar`, `TimelinePane`, ~2600 lignes plus montées).--| # | Manque | Ce qui existe déjà | Effort |-| --- | --- | --- | --- |-| 3.1 | **Vitesse plafonnée à 3×** : `FloatingInspector.tsx:275` propose un `<select>` `[0.5 … 3]`. | `MAX_PLAYBACK_SPEED = 100` et `MAX_NATIVE_PLAYBACK_RATE = 16` (`types.ts:384/388`) ; l'UX select + champ libre + avertissement au-delà de 16× vit dans `RightPanelStack.tsx:672-696`, non monté. | faible — récupérer l'UX, la brancher sur l'inspecteur V4 |-| 3.2 | **Pas de bascule zoom auto / manuel** : `focusMode` n'est que *lu* (`ZoomFocusOverlay`), `"auto"` n'arrive que par les suggestions automatiques. | Le suivi curseur fonctionne (`zoomSuggestions.ts:63`). | faible — un contrôle dans le pane Zoom |-| 3.3 | Pas de preset de **rotation** de zoom. | Le shader de tilt 3D existe dans `compositor.rs`. | moyen |-| 3.5 | Seules les annotations **texte** sont créables. | Image / figure / flou sont rendues par le compositeur, inatteignables faute de chemin de création. | moyen |--**3.4 « zoom réactif webcam » — retiré, l'audit était faux.** La fonction est complète et-câblée : le contrôle « Shrink on zoom » vit dans `LayoutPane`-(`RightPanes.tsx:1428`, monté par l'inspecteur V4) et le compositeur natif l'honore-(`compositor.rs:1381`, `reactive_scale`, parité `reactiveWebcamScale` côté TS — la webcam-rétrécit pendant un zoom écran, sauf en Full Camera). Cause de l'erreur : le grep de-recensement cherchait `reactiveZoom`, or le réglage s'appelle `webcamReactiveZoom` — un R-majuscule suffisait à le rendre invisible à une recherche sensible à la casse. Les deux-autres lignes de ce tableau ont été re-vérifiées sans casse ; elles tiennent.--Ordre proposé : 3.1 d'abord (meilleur rapport valeur/effort, capacité complète, seul le-contrôle manque), puis 3.2. Le reste après arbitrage.-------## Lot 4 — Robustesse (à arbitrer)--| # | Sujet | État | Remarque |-| --- | --- | --- | --- |-| 4.1 | `preferSoftwareEncoder` est lu au démarrage de l'enregistrement (`useScreenRecorder.ts:843`) mais **aucune UI ne le règle**. | non câblé | Repli utile sur machines dont l'encodeur matériel échoue. Lot 1.2/1.3 corrige justement les blocages propres à ce mode. |-| 4.2 | Le moteur D3D n'a **aucun repli logiciel** : `D3D_DRIVER_TYPE_HARDWARE` seul, `bail!` si le feature level n'est pas `11_1` (`poc-d3d/src/d3d.rs`). | absent | Échec sec sur machine sans GPU compatible. Un repli WARP est possible mais lent ; décision produit, pas technique. À trancher avant toute distribution large. |-------## Différé, avec la raison--- **PR #142 (packaging MSIX / Microsoft Store)** — correct et prêt sur la branche parquée,- mais sans objet tant qu'on ne release pas depuis cette branche. À reprendre au moment de- la release.-- **PR #120 (playhead qui retarde)** — **[M]**. Sur main, la position venait d'un `useState`- remonté en haut de l'arbre, forçant une cascade de rendu à 60 Hz. Chez nous- l'architecture diffère (preview native), mais `V4Timeline` reçoit `currentTimeSec` en- **prop** — donc le parent re-rend à chaque tick même si `PlayheadOverlay` est mémoïsé. À- **mesurer** avant de décider : si le retard est réel, le remède est le même (le playhead- lit l'horloge dans sa propre boucle rAF avec son état local).-- **PR #127 partie 2 (durée plafonnée après Save → Load)** — **[M]**. Le modèle document- d'ai-edition n'a pas le `lastResolvedDurationRef` en cause. À reproduire avant de spécifier- quoi que ce soit.-- **PR #126 (checklist RC end-to-end)** — à reprendre quand on stabilisera la branche.-------## Exécution--Branche neuve depuis `feat/ai-edition`. Un commit par item, dans cet ordre :--1. **Lot 1** (1.1 → 1.5) — cherry-picks, puis rebuild natif et validation enregistrement.-2. **2.3** — annotation vide (cherry-pick, trivial).-3. **2.1** — bug de réordonnancement (le plus visible pour l'utilisateur).-4. **2.2** — mixage multipiste natif en Rust (le plus lourd du lot 2).-5. **3.1** puis **3.2** — recâblage UX.--Lot 4 et différés : après arbitrage.--PR #154 reste ouverte comme réserve jusqu'à ce que les cherry-picks aient été rejoués,-puis sera fermée sans merge. Ses deux commits de portage #109 (exporteur navigateur) ne-sont **pas** repris.diff --git a/technical-documentation/_harvest/ai-edition-roadmap.md b/technical-documentation/_harvest/ai-edition-roadmap.mddeleted file mode 100644index c55d7def7..000000000--- a/technical-documentation/_harvest/ai-edition-roadmap.md+++ /dev/null@@ -1,196 +0,0 @@-# AI-Edition Merge — Roadmap (feuille de route)--**Single source of truth for the OpenScreen × Axcut merge.**-Last updated: 2026-07-02 · Branch: `feat/ai-edition`--> This file supersedes `ai-edition-handover.md` and `ai-edition-comprehensive-handover.md`-> (both deleted) and the phasing detail of `ai-edition-merge-plan.md`. For deep reference-> keep: [`ai-edition-collision-analysis.md`](ai-edition-collision-analysis.md) (decision-> rationale), [`openscreen-inventory.md`](openscreen-inventory.md) and-> [`axcut-inventory.md`](axcut-inventory.md) (source catalogs). The canonical UI target is-> [`design/openscreen-editor.html`](../../design/openscreen-editor.html) + `design/DESIGN.md`.-> For a diagram of who reads/writes the DSL document, see-> [`ai-edition-data-flow.md`](ai-edition-data-flow.md).-------## 1. Goal & strategy--Make OpenScreen the host of the Axcut editing engine. The recorder stays the front door;-Axcut's **data model + UX patterns** are re-implemented on OpenScreen's own primitives —-**no Python sidecar, no Fastify server, no monorepo**. The Python/Fastify layers die; the-schema, agent runtime, and UI patterns live on in-tree.--Two layers, different rollout:--| Layer | What | Default? | Gate |-|---|---|---|---|-| **Editing model** | Multi-asset projects, clips + skip/zoom/speed/annotation ranges, transcript editing, virtual preview, document-driven exporter | **Default for everyone** | none |-| **AI features** | LLM providers (BYO key), agent chat, suggestions, session history, checkpoints | **Opt-in** | `AI_FEATURES_ENABLED` |--Local Whisper transcription is bundled and runs in-browser (`@xenova/transformers`) — **not**-gated, privacy-safe by construction.--## 2. Architecture (SSOT)--`AxcutDocument` (v3 Zod schema, `src/lib/ai-edition/schema/`) is the canonical project model:-`project · assets[] · transcripts[] · timeline{clips,gaps,skip/mute/speed/captionRanges} ·-annotations[] · zoomRanges[] · legacyEditor · agent · preview · export · history`. Renderer-holds it in a Zustand store (`store/projectStore.ts`); main process persists to-`userData/projects/<id>.axcut`. Legacy `.openscreen` v2 projects migrate to v3 on first open.--```-src/lib/ai-edition/ schema · document(migrate/timeline/transcribe/ids) · store · timeline · exporter-src/components/ai-edition/ NewEditorShell + Titlebar/Bottombar/LeftPanel/RightPanes/Preview/PreviewCanvas/- TimelinePane/VirtualPreview/TranscriptEditor/Modals/ExportDialog/ProviderSettings-electron/ai-edition/ document-service · chat-service · llm-call · llm-config-store · provider-registry-```--## 3. Locked decisions--1. **Stop behavior** — first recording auto-opens the editor; later ones stay in the recorder with a prompt.-2. **Auto-caption→annotation injection** — dropped; transcript editor is the SSOT for spoken words.-3. **React Query** — adopted for the agent layer.-4. **LLM credentials** — Electron `safeStorage` (OS keychain), not plain JSON.-5. **Whisper** — bundle a small model; picker (tiny/base/small/medium) in settings. Not an AI-feature gate.-6. **Proxy MP4** — dropped; rely on WebCodecs `StreamingVideoDecoder`. Known lag >30 min (§6 revival path).-7. **File extension** — keep `.openscreen`.-8. **Packaging** — single package, single repo, in-tree `ai-edition/` namespaces.-9. **`AI_FEATURES_ENABLED`** — gates only the LLM/agent surface; default off. Everything else ships to all.-------## 4. Current status (2026-07-02)--Build health: **`tsc --noEmit` clean · 434 tests pass (55 files)** · lint clean.--| Area | State |-|---|---|-| **Phase 0** schema + v2↔v3 migration + timeline math | ✅ done, tested |-| **Phase 1** multi-asset, clips/skips, Resources panel, new editor is the **only** editor (`App.tsx` → `AiEditionShell`, no kill-switch) | ✅ done |-| **Phase 2** VirtualPreview + `PreviewCanvas` (wallpaper, blur, drop-shadow, radius, padding, webcam PiP/dual/vertical/masks, cursor overlay, zoom, annotations) + transport/scrub | ✅ done |-| **Phase 3** document-driven exporter + Export dialog (MP4 720/1080/source, GIF) | ✅ done (round-trip test pending) |-| **Phase 4** transcription pipeline + TranscriptEditor + auto-captions (auto-transcribe first) | ✅ done |-| **Phase 6.1/6.2** chat-service + IPC + LeftPanel chat + ProviderSettings (8 providers) | ✅ done (P1 agent runtime, tool loop, checkpoints, undo added in `55372df`) |-| **Phase 7** provider registry + fetch-based LLM call (OpenAI-compat + Anthropic) | ✅ done (OAuth/PAT stubbed) |-| **Phase 8** multi-session chat history (create/list/select/rename/delete) | ✅ done in-memory (`9203c34`), tested |-| **Phase 9** i18n (`useScopedT` across components, 13 locales), undo/redo (Cmd+Z/⇧Z, works), region clipboard, EmptyState, keyboard shortcuts | partial — i18n sweep (P3.5) still open |--**Recently fixed on this branch:** design-token aliases (`--primary/--card/--card-foreground/--muted-foreground/--primary-foreground` were referenced but undefined → broke light theme; now mapped in `design-tokens.css`); Settings gear now opens `ShortcutsConfigDialog` (was a toast); dead `ChatPanel.tsx`/`ProjectPanel.tsx` removed; **TimelinePane rewritten to a multi-clip track model + media→timeline drag-drop fixed** (`90b4b3b` — the drop handler was on the whole workbench `<main>`, so drops only ever landed on the Preview); **`handleLoadedMetadata` clip-duration corruption fixed** (`3a4bc91` — it patched `clips[0]` unconditionally regardless of which asset's `<video>` fired the event, desyncing the progress bar from the timeline ruler/playhead whenever a second clip's asset loaded).--**Audit false alarms (verified NOT bugs):** undo/redo works (`useUndoRedoShortcuts` calls `undo()/redo()` internally; `pushHistory` wired in `setDocument`); `provider-registry.ts` exists.-------## 5. Remaining work (prioritized)--### P0 — timeline viewport, pan, zoom, reorder (axcut port — granular plan, 2026-07-01)--**Reference sources (read in full this round):**-- **Axcut, local WSL clone** — `\\wsl.localhost\Ubuntu\home\etienne\repos\axcut\apps\web\src\components\TimelinePane.tsx` (1537 lines). **Authoritative**; the GitHub mirror at `EtienneLescot/axcut` is stale (699 lines). Always read from the WSL path until both reconcile.-- **Axcut helper:** `\\wsl.localhost\Ubuntu\home\etienne\repos\axcut\apps\web\src\lib\pointer-drag.ts` — `startGlobalPointerDrag`, the single primitive that backs resize / reorder / scrub / pan / navigator-drag.-- **OpenScreen `main`** — `git show main:src/components/video-editor/timeline/{TimelineWrapper,Item,Row,TimelineEditor}.tsx` for the dnd-timeline region model (already used here).-- **Design:** `design/openscreen-editor.html` — `.tracks-scroll` is `overflow-y: auto, overflow-x: hidden` (vertical-only). Lanes and tracks share the **same** coordinate system (clip blocks at `flex: 36.5`/`flex: 63.5`, pills at `left: 5%`/`left: 27%`/etc.). The two-handle slim zoombar at the bottom is purely cosmetic; there is **no navigator strip** in the design.--**Architectural decision (lock this in):**-The new editor's timeline follows **axcut's custom viewport model**, not the design's "fit-to-width only". A single `.timeline-canvas` holds the ruler + clip track + lanes + playhead, translated horizontally by `visibleStartSec * pxPerSec`. The viewport is `overflow: hidden`; native horizontal scroll is not used. This keeps lanes and clip track aligned at every zoom level (the previous attempt broke this by keeping them in separate containers — see `e965a5f` reverted in `2e4e4ee`).--**Granular task table:**--| # | Task | Axcut ref | Design ref | Status | Commit |-|---|------|-----------|------------|--------|--------|-| T01 | Port `startGlobalPointerDrag` helper | `lib/pointer-drag.ts` | — | ✅ done | `690c80e` |-| T02 | Port `ResizeState` / `PanState` / `NavigatorDragState` / `ClipReorderState` types + refs | `TimelinePane.tsx:54-87` | — | ✅ done | `8be3dda` |-| T03 | Compute `pxPerSec = fitPxPerSec * zoom` with `MAX_PX_PER_SEC = 280` | `:88, :163-169` | — | ✅ done | `8be3dda` |-| T04 | Replace `overflow-x: auto` with `transform: translateX(-visibleStartSec * pxPerSec)` on inner `.timeline-canvas`; viewport itself stays `overflow: hidden` | `:170, :907-908` | — | ✅ done | `8be3dda` |-| T05 | Adaptive ruler ticks (`chooseTickStep(90 / pxPerSec)` major + minor/4) | `:1529-1542`, `:917-925` | `.timeline-ruler` | ✅ done | `8be3dda` |-| T06 | Ctrl+wheel = `zoomAt(zoom * ±1.18, clientX)` — zooms **around the cursor** | `:752-756`, `:370-388` | — | ✅ done | `8be3dda` |-| T07 | Alt+drag AND middle-click-drag = `startPan` → updates `visibleStartSec` | `:693-726`, `:735-740` | — | ✅ done | `8c36398` |-| T08 | Clip body pointerdown = `startClipReorder` with `CLIP_REORDER_THRESHOLD_PX = 6` → live insert marker + `onMoveClip(clipId, insertIndex)` on release | `:618-689`, `:445-490` | — | ✅ done | `8c36398` |-| T09 | Clip join borders (`hasJoinedPrev/Next` within 1.5px) — extend left by 1px, width by 1px | `:962-991` | — | ✅ done (later reverted per user feedback) | `8c36398` |-| T10 | Move `.lanes` into the same `.timeline-canvas` as the clip track | — | `.annotation-track-row`, `.speed-track-row`, `.zoom-track-row` (lanes share container) | ✅ done | `ba328d5` |-| T11 | Build the navigator strip (`<div class="timeline-navigator">`) below the viewport: skip mini-marks + visible-window overlay (start/end/move handles) | `TimelinePane.tsx:1036-1066` | — (not in design) | ✅ done | `2cd6ad3` |-| T12 | Wire navigator window drag → `setVisibleWindow(start, end)` | `:821-842` | — | ✅ done (move-mode only — pxPerSec adjustment lands in C4/T12 follow-up if needed) | `2cd6ad3` |-| T13 | Remove the bottom zoombar slider (now redundant — the navigator IS the zoom UI). Keep the hint row only. | — | `.zoombar` is just two buttons | ✅ done (slider removed earlier in `f9d62e1`; replaced with navigator in `2cd6ad3`) | `f9d62e1` + `2cd6ad3` |-| T14 | Header row inside TimelinePane: "N clips · M skips · X:XX total" + clip N/M indicator + current time + "Place skip" button | `:849-895` | — | ✅ done | `8c80a5c` |-| T15 | "Place skip" toggle → `pendingCutPlacement` mode → next click adds a 1s skip via `onAddSkipRange`. Live `pendingCutPreviewSec` marker while armed. Esc cancels. | `:438-475, :495-518` | — | ✅ done | `8c80a5c` |-| T16 | Add `body.timeline-panning` / `body.timeline-scrubbing` / `body.timeline-placing-cut` / `body.timeline-reordering` cursor classes. Hover cursor = `pointer`, drag-state cursors per mode. | `:497-512, :654-656, :706-708, :723-725` | — | ✅ done | `6dc2358` |-| T17 | Compact skip mode: when `(endSec - startSec) * pxPerSec < 18`, render controls icon-only (no labels). | `:990-993`, `styles.css .timeline-skip-strip.compact` | — | ✅ done (no-op — skip controls are icon-only by default; documented here for tracking) | `6dc2358` |-| T18 | Skip hover-controls viewport-aware positioning (`controlsShiftPx` keeps controls onscreen near viewport edge) | `:1001-1010` | — | ✅ done | `6dc2358` |-| T19 | Wire `onPreviewSource` during pointer drag so the preview scrubs to the cut/skip edge being dragged | `:540-543` | — | ✅ done | `761496e` |-| T20 | Clip projection during reorder: `cursorSec` resequencing so non-dragged clips reflow when the dragged clip is held out of order | `:439-490` | — | ✅ done | `761496e` (already shipped, see `projectedClipLayoutById` in `TimelinePane.tsx`) |-| T21 | Wire `onDuplicateClip` parity — confirm Ctrl+C/V uses `selectedClipId` not `copiedClipId` fallback (axcut's flow) | `:480-505` | — | ✅ done | already shipped in spine (`2f53b2f`); `tl.duplicateClip(clipId)` exposed from `useTimeline` and called by the Ctrl+C/V handler in `NewEditorShell.tsx` |-| T22 | Design parity: `.tracks-scroll { overflow-y: auto, overflow-x: hidden }` — vertical scroll only (no horizontal scroll feature in the design). Axcut's translateX-pan replaces it. | — | `.tracks-scroll` | ✅ done | implicit — `bottombar` uses `overflow: hidden` + `display: grid` + `flex: 1` on the timeline body, achieving the same effect via flex instead of overflow |-| T23 | Design parity: clip blocks at `flex: 36.5` (proportional), not absolute pixels — multi-clip blocks share the row | — | `.track-block.block-1 { flex: 36.5 }` | ✅ done | implicit — clip blocks are sized by `width: durationSec * pxPerSec` (absolute px) but the SUM of widths equals the total timeline width, giving the same proportional behavior as `flex-grow` on a known total |-| T24 | Snap-guide line during region drag — visualizes the dnd-timeline collision-clamp | — | — | ✅ done | `07d868c` — `.snapGuide` renders 2px-wide red vertical lines in the timing ruler at both edges of the moving skip during resize |-| T25 | Floating drag tooltip showing time + range during resize/move (axcut has none; design shows `0:00.0 – 0:02.5` in pill labels; visual polish on top of T01–T23) | — | `.pill-value` already shows label | ✅ done | `07d868c` — `.dragTooltip` is a small floating pill just to the right of the moving edge showing `startSec → endSec` during resize |--**Already shipped (kept):**-- Multi-clip track + working media drag-drop → `90b4b3b`-- Skip (trim) resize + delete inside clip block → `7edfe49`-- Real Edit Clip dialog with embedded preview + draggable range → `96787e1`-- Ctrl+C/V clip duplicate → `2f53b2f`-- Region drag/resize for zoom/speed/annotation via dnd-timeline → `f70b7c4`-- Placeholder duration unification (60s) → `9837481`--**Sequencing for the spine PR (T01–T09):** T01 helper → T02 types → T03 pxPerSec → T04 viewport translateX → T05 adaptive ruler → T06 Ctrl+wheel-zoom-at-cursor → T07 Alt+drag-pan → T08 pointer-reorder → T09 join borders. Each commits cleanly on its own; T01–T04 are the load-bearing ones, T05–T09 are polish on top.--**Reverted:**-- `2e4e4ee` — reverts `e965a5f` (the broken `overflow-x:auto` + `BASE_PX_PER_SEC * zoomLevel` attempt). Lanes-back-in-canvas (T10) and navigator-strip (T11) will replace it properly.--### P1 — functional plumbing (the heart of "AI editor")--| # | Task | File / line anchor | Status | Commit |-|---|------|--------------------|--------|--------|-| P1.1 | Define a tool schema: `getCurrentDocument`, `getTranscript`, `addSkip`, `setSkipRange`, `setClipRange`, `replaceTimeline`. JSON-schema per tool, fed to the model as `tools[]`. Lives in `electron/ai-edition/agent-tools.ts` (new). | `chat-service.ts:65-78` (current SYSTEM_PROMPT) | ✅ done | `55372df` |-| P1.2 | Implement tool execution dispatch: when the LLM returns `tool_calls`, validate args against the schema, run the matching store action (via the IPC bridge in `useTimeline.ts`), and return a JSON result to the model. | `electron/ai-edition/chat-service.ts:130-200` (the `runChat` function) | ✅ done | `55372df` |-| P1.3 | Save a checkpoint to `chat-service.ts` (or new `agent-runtime.ts`) **before** running each tool — current `replace_timeline` style. The user can roll back. | `chat-service.ts` (no checkpoint layer) | ✅ done | `55372df` |-| P1.4 | Multi-turn tool loop: the model may chain tools (`addSkip` → `setSkipRange` → `replaceTimeline`). Max iterations cap (e.g. 8). Surface intermediate "I'm trimming silences…" toasts. | `chat-service.ts:150-200` | ✅ done | `55372df` |-| P1.5 | Replace the system prompt with a tool-aware one: list the tools, give the model a "current document JSON" snapshot it can `replaceTimeline` against. | `chat-service.ts:18-22` (current SYSTEM_PROMPT) | ✅ done | `55372df` |-| P1.6 | Bridge `agent-runtime` ↔ main process: spawn the runtime inside an Electron `utilityProcess` so long agent runs don't block the renderer. The IPC entry point `ai-edition.runAgent(chatId, message)` returns when done. | new `electron/ai-edition/agent-runtime-main.ts` + `src/native/contracts.ts` | ✅ done | `55372df` |-| P1.7 | In the chat panel, show a compact "applied: trimmed 0:02.1–0:02.4" line per tool call so the user sees what the model did. | `src/components/ai-edition/LeftPanel.tsx` (chat history block) | ✅ done | `55372df` |-| P1.8 | Undo button: a single click reverts the last tool batch by re-applying the pre-batch checkpoint. | `chat-service.ts` (no undo yet) | ✅ done | `55372df` |-| **P2.1** | **Chat persistence (Phase 8 remainder).** Move `sessionsByProject: Map<string, Map<string, ChatSession>>` (in `chat-service.ts:14`) into `better-sqlite3` under `~/.config/openscreen/chat.db`. Tables: `sessions(id, project_id, title, created_at, last_checkpoint_json)`, `messages(id, session_id, role, content, tool_calls_json, created_at)`, `checkpoints(id, session_id, label, document_json, created_at)`. | `electron/ai-edition/chat-service.ts:14` + new `electron/ai-edition/database.ts` | ❌ | — |-| **P2.2** | **OAuth device-flow + PAT auth (Phase 7 remainder).** Replace the `authKind === "oauth-device"` stub at `llm-call.ts:68-72` with a real device flow: `POST /device/code` → poll `/device/token` → store `access_token` in the OS keychain (`keytar`). Wire `ProviderSettings.tsx:372, 512` "Connect" button to launch the flow and surface the verification URL in a toast. PAT: read from env (`OPENAI_PAT`, `ANTHROPIC_PAT`) at startup. | `llm-call.ts:68-72` + `ProviderSettings.tsx:372, 512` | ❌ | — |-| **P2.3** | **Provider-registry expand.** Add `google` (gemini-1.5-pro via OAuth) and `github-copilot` (device flow) to `provider-registry.ts:PROVIDER_DEFINITIONS`. | `electron/ai-edition/provider-registry.ts` | ❌ | — |-| **P2.4** | **Streaming responses.** `runChat` returns a single buffered string today (`chat-service.ts`). Add SSE-style streaming so the chat panel can render tokens as they arrive. | `chat-service.ts` (no stream) | ❌ | — |-| **P2.5** | **Tool-call permission gate.** Before running a write tool (`setSkipRange`, `replaceTimeline`, etc.), check a "dangerous tools" flag — if disabled, return a friendly "I need you to confirm before I edit your project" message and pause. The user can toggle it in `ProviderSettings.tsx`. | new permission check in `chat-service.ts:runChat` | ❌ | — |--### P2 — feature completeness vs old editor / design--| # | Task | File / line anchor | Status | Commit |-|---|------|--------------------|--------|--------|-| **F2.1** | **Auto-zoom "wand" suggestions.** Add a `suggestZoomRegions` store action that scans `transcript.segments` for low-amplitude ranges (silence heuristic) and proposes `zoomRanges` covering them. Wire to the disabled "Magic" button in `Bottombar.tsx:160-162` (currently `disabled` with no `onClick`). | new helper in `src/lib/ai-edition/store/zoomSuggestions.ts` + `Bottombar.tsx:160-162` | ✅ done | `58feb34` |-| **F2.2** | **Region inspector — annotation options.** Add `fontFamily` (Inter / Mono / Serif) and `animation` (none / fade / pulse) fields to the `AnnotationRegion` schema; expose a `<select>` per field in `RightPanelStack.tsx`. | `RightPanelStack.tsx` annotation inspector panel + `lib/ai-edition/schema/index.ts` (`annotationSchema`) | ✅ done | `58feb34` |-| **F2.3** | **Region inspector — figure/blur advanced.** Color picker (already partial), mosaic size slider, blur radius slider, arrow direction toggle for shapes. | `RightPanelStack.tsx` figure/blur subpanel | ✅ done | `58feb34` |-| **F2.4** | **Advanced export options.** Expose `fps` (24/30/60) and `codec` (h264/h265/vp9) selects in `ExportDialog.tsx` next to the quality preset. Pipe to the existing exporter options object. | `ExportDialog.tsx` form + `src/lib/ai-edition/documentExporter.ts` (consumer) | ✅ done | `58feb34` |-| **F2.5** | **Round-trip export test.** A vitest (or Playwright) test that creates a 3-clip + 1-skip project in a temp dir, calls the exporter end-to-end, then runs `ffprobe` on the output to assert the duration is the expected sum of clip durations. Marked `test:e2e` so it only runs in CI. | new `src/lib/ai-edition/documentExporter.e2e.test.ts` | ❌ | — |-| **F2.6** | **Region drag snap-guide + floating tooltip.** axcut has both during region resize. Already shipped on the clip timeline (T24/T25). Port to `RegionTimeline.tsx`: a vertical guide at the snap point + a small tooltip showing the new `startSec` / `endSec` as the user drags a region handle. | `RegionTimeline.tsx` (region handle drag logic) | ✅ done | `01d6b46` |-| **F2.7** | **Multi-select region operations.** Shift-click to add a region to the selection, then Delete removes all selected. Currently single-region-only. | `RegionTimeline.tsx` selection state + `useTimeline.removeRegion` | ✅ done | `01d6b46` |-| **F2.8** | **Region clipboard (cut/copy/paste).** Cut removes + remembers, copy remembers, paste inserts at playhead. Currently only `regionClipboard.ts` exists with the storage layer but no UI wiring. | `regionClipboard.ts` (exists) + new shortcut handler in `NewEditorShell.tsx` | ✅ done | `01d6b46` |--### P3 — polish / fake-data displays--| # | Task | File / line anchor | Status | Commit |-|---|------|--------------------|--------|--------|-| **P3.1** | **Asset file size.** Add `sizeBytes: z.number().int().nonnegative().optional()` to `assetSchema` in `lib/ai-edition/schema/index.ts`. In `electron/ai-edition/document-service.ts` `addAsset()`, call `fs.stat(input.path).then(s => s.size)` (or sync) and store on the new asset. Renderer `LeftPanel.tsx:formatSize(undefined)` already exists; just thread the bytes through. | `lib/ai-edition/schema/index.ts:assetSchema` + `document-service.ts:addAsset` + `LeftPanel.tsx:formatSize` | ✅ done | `76d78db` |-| **P3.2** | **Camera-sidecar toast on failure.** In `NewEditorShell.tsx:145` (the `addAsset` flow), wrap the `findRecordingCamera` call in a try/catch and surface failure as `toast.error("No camera file found next to <recording>")`. | `NewEditorShell.tsx:145` + `projectStore.ts:154` | ✅ done | `76d78db` |-| **P3.3** | **RightPanes header Help buttons.** The `HelpCircle` button at `RightPanes.tsx:48-54` is rendered but `onClick` is a no-op. Wire to a popover that shows contextual help text per right pane (image, color, gradient, custom, effects, transcript). | `RightPanes.tsx:48-54` | ✅ done | `76d78db` |-| **P3.4** | **Pixel nits.** (a) `RightPanelStack.tsx:296` — annotation color default `#ffffff` → `var(--annotation)`. (b) `.transport .rec[aria-pressed]` hardcoded `#ffffff` → `var(--danger)`. (c) Modal backdrop `rgba(22,23,29,.55)` → `var(--overlay-dark)` (define the var if missing). | `RightPanelStack.tsx`, `NewEditorShell.module.css` (.transport .rec), `design-tokens.css` (modal backdrop) | (a) stale — `<input type="color">` needs hex, schema default already `#ffffff` by design. (b) stale — selector doesn't exist in current code. (c) ✅ done. | `76d78db` (c) |-| **P3.5** | **i18n sweep.** `ai-edition/*` still has hardcoded English: chat panel strings (`LeftPanel.tsx`), Header readouts in `TimelinePane.tsx` ("2 clips · 2 skips · 0:09.5 total"), modal titles in `Modals.tsx`, `ProviderSettings.tsx` labels, error toasts. Add a new `src/i18n/locales/en/ai-edition.json` namespace + 12 other locales + a smoke test in `src/i18n/__tests__/`. | `LeftPanel.tsx`, `TimelinePane.tsx`, `Modals.tsx`, `ProviderSettings.tsx` | ❌ | — |-| **P3.6** | **Region drag visual polish (F2.6 in P2).** Tracked under P2 row F2.6. |-| **P3.7** | **Timeline ruler hover scrub.** Hover the ruler with the mouse, click to seek to that time. Currently the ruler only handles pointerdown for the scrub gesture; a separate `pointermove → setCurrentTime` is missing for hover-feedback. | `TimelinePane.tsx` ruler `<div onPointerDown={handleRulerPointerDown}>` | ✅ done | `76d78db` |-| **P3.8** | **Track-lane empty state for "no clips".** When `clips.length === 0` and a drop happens, drop a single auto-generated clip from the dropped asset (already does this in `insertClipAt`). But if the asset is unknown format, the placeholder is unhelpful — add a clear "Drag a video from the left to start" hint. Already exists at `TimelinePane.tsx:907-911` ("Drag a video from the media panel here to start your timeline."). Verify the message survives the i18n sweep (P3.5). | `TimelinePane.tsx:907-911` | pending P3.5 — message is in place, awaiting i18n wrap | — |-| **P3.9** | **NPM-side CSS for the bottombar.** Confirm `Bottombar.module.css` exists or move the bottombar-specific CSS out of `NewEditorShell.module.css`. Currently scattered. | `NewEditorShell.module.css` vs new `Bottombar.module.css` | ❌ | — |-| **P3.10** | **Stable drag handle ordering.** `RegionTimeline.tsx` — the row handles (.left / .right) are currently absolute-positioned but their stacking doesn't match the design (right handle above the left). Add explicit `z-index: 1` on `.right` to keep it on top. | `RegionTimeline.tsx` | moot — dnd-timeline owns handles now, no `.left`/`.right` CSS in current code | — |--### Deferred / known limitations-- **Long-recording scrub lag (>30 min)** — proxy MP4 dropped by decision 6; revival = per-asset "Generate proxy" button.-- **SSE streaming for project changes** — unnecessary in single-user Electron.-------## 6. Verification protocol-- **Per change:** `npx tsc --noEmit` clean · `npm run test` green · new tests for new logic (vitest/jsdom).-- **Dev loop:** `npm run dev` → `http://localhost:5173/?windowType=editor` (browser shim persists to `localStorage["browser-shim-document"]`).-- **Per phase:** manual smoke on Win/mac for any exporter- or recorder-touching change (native helpers are frozen).diff --git a/technical-documentation/_harvest/axcut-inventory.md b/technical-documentation/_harvest/axcut-inventory.mddeleted file mode 100644index 179f03b9d..000000000--- a/technical-documentation/_harvest/axcut-inventory.md+++ /dev/null@@ -1,458 +0,0 @@-# Axcut Inventory — Merge into OpenScreen--> Catalog of the axcut codebase at `/home/etienne/repos/axcut/` (in WSL Ubuntu) as it stands for the AI-edition merge. Path notation is `path:line` relative to the axcut repo root.-------## 1. Schema (`@axcut/schema` package)--`packages/axcut-schema/src/index.ts` (402 lines) is the SSOT Zod schema for the project. Re-exports `axcutSchemaVersion = 2`.--### Core types (every Zod schema → inferred type)-| Schema | Fields | Notes |-|---|---|---|-| `wordSchema` | `id`, `assetId?`, `segmentId`, `startSec`, `endSec`, `text` | Whisper tokens; `assetId` is optional for back-compat with single-asset transcripts. |-| `transcriptSegmentSchema` | `id`, `assetId?`, `kind: 'speech'\|'silence'`, `startSec`, `endSec`, `text`, `wordIds[]` | `kind = 'silence'` is rendered separately by the editor. |-| `transcriptSchema` | `assetId`, `language`, `sourceDslPath?`, `sourceJsonPath?`, `segments[]`, `words[]` | One transcript per asset. |-| `assetSchema` | `id`, `kind: 'video'`, `label`, `originalPath`, `proxyPath?`, `waveformPath?`, `durationSec?`, `video?`, `audio?` | `video`/`audio` populated by Python `probe_media`. |-| `clipSchema` | `id`, `assetId`, `sourceStartSec`, `sourceEndSec`, `timelineStartSec`, `timelineEndSec`, `wordRefs[]`, `origin: 'system'\|'agent'\|'user'`, `reason` | The mounted unit on the timeline. |-| `gapSchema` | `id`, `timelineStartSec`, `timelineEndSec`, `reason` | Placeholder gaps between clips (rarely used). |-| `rangeSchema` | `startSec`, `endSec`, `reason` | Shared shape for `muteRanges`, `speedRanges`, `captionRanges`. |-| `skipRangeSchema` | `id`, `assetId`, `startSec`, `endSec`, `reason`, `origin` | Skips reference source-time on the **asset**, not the timeline. |-| `timelineSchema` | `clips[]`, `gaps[]`, `skipRanges[]`, `muteRanges[]`, `speedRanges[]`, `captionRanges[]` | All ranges in source-time coordinates. |-| `pendingQuestionSchema` | `id`, `question`, `reason`, `startWordId?`, `endWordId?` | Agent asks the user. |-| `suggestionSchema` | `id`, `status: 'pending'\|'approved'\|'rejected'`, `category`, `suggestion`, `reason`, `startWordId?`, `endWordId?`, `startSec?`, `endSec?`, `proposedOperation?` | The agent's pending edits. |-| `agentStateSchema` | `baseIntent?`, `pendingQuestions[]`, `suggestions[]`, `lastAppliedOperations[]`, `lastReasoningSummary?` | Per-project agent memory. |-| `previewSchema` | `strategy: 'seek'\|'mse-proxy'`, `revision: number` | `revision` increments on any change that affects playback. |-| `exportStateSchema` | `preset: 'preview-low'\|'final-balanced'\|'final-high'`, `lastJobId?` | |-| `timelineOperationSchema` | discriminated union of `replace_timeline`, `drop_range`, `drop_word_range`, `add_skip_range`, `update_skip_range`, `remove_skip_range`, `update_clip_range`, `duplicate_clip`, `move_clip`, `restore_full_timeline`, `insert_asset_clip` | Every edit the UI or agent can apply. |-| `revisionSchema` | `id`, `createdAt`, `author`, `summary`, `operations[]` | History entry. |-| `documentSchema` | wraps `project`, `assets[]`, `transcript` (merged primary), `transcripts[]` (per-asset), `timeline`, `agent`, `preview`, `export`, `history` | Full document. |--### Helpers in the schema package-- `createEmptyDocument(input)` — fresh empty doc with empty arrays.-- `ensureDocument(value)` — Zod-parse an unknown, throw on mismatch.-- `normalizeSkipRanges(skipRanges[])` — merge overlapping/adjacent skips, sort, return dedup'd list. Used everywhere.-- `applySkipRangesToClips(clips[], skipRanges[])` — materialize the timeline by walking each clip, splitting on overlapping skip ranges, retiming into a flat clip array (the "kept" segments). **This is the key function the exporter must call.**--### Schema migration story-- Only v1 → v2 is documented in code. There are no migration functions — `ensureDocument` just parses whatever version it finds.-- **For OpenScreen, this is a problem.** Phase 0 must add a real `migrateDocument(value, fromVersion)` function so legacy `EditorProjectData` (v2) and axcut `AxcutDocument` (also v2, different shape) both round-trip cleanly into the new v3 `AxcutDocument`.--### Things missing from axcut's schema (OpenScreen has them)-- `annotations[]` (text/image/figure/blur overlay regions) — `types.ts:287`.-- `zoomRegions[]` (zoom regions with depth, focus, rotation preset) — `types.ts:71`.-- `legacyEditor` envelope (wallpaper, aspect ratio, padding, crop, cursor, webcam, etc.) — `projectPersistence.ts:67`.-- Cursor telemetry data (raw points) — `types.ts:178`.-- Speed regions (`SpeedRegion[]`) — already in axcut's schema (`rangeSchema`-shaped `speedRanges`).-- Trim regions — **NOT in axcut's schema** (replaced by `skipRanges`).-------## 2. Server services (`apps/server/src/services/`)--### `document-service.ts` — DocumentService-- Owns the on-disk `.axcut` document; `readDocument / writeDocument / mutateDocument / appendRevision`.-- `addAsset(projectId, input)` resolves `path` to absolute, validates extension set `{mp4, mov, m4v, webm, mkv}`, creates `AxcutAsset`, sets `project.primaryAssetId` if first asset.-- `updateTranscript` normalizes + re-sorts transcripts per asset, **merges to a single primary transcript** (used by VirtualPreview which only consumes one), calls `retimeClips`.-- `applyOperation` (the workhorse) — applies any `AxcutOperation`, appends a `revision`, returns `{ document, revisionId }`.-- `replaceTimeline(projectId, intervals[], summary, author)` — full structural rebuild of clips from normalized intervals (used by `replace_timeline` op and the manual "Restore" button).-- `setSuggestions` — replaces `agent.suggestions[]`.-- `updateExportState` — toggles preset/lastJobId.--### `agent-session-service.ts` — AgentSessionService-- Per-session records persisted under `.axcut-data/deepagent-sessions/records/` (one JSON file per session).-- Per-session checkpoints persisted under `.axcut-data/deepagent-sessions/checkpoints/` (langgraph checkpoint tuples).-- `PersistentFileCheckpointSaver` (custom) implements `BaseCheckpointSaver` against `langgraph-checkpoint`. Uses `WRITES_IDX_MAP` from `@langchain/langgraph-checkpoint`.-- `CheckpointReason` = `'manual' | 'auto' | 'before-message' | 'after-run' | 'before-compaction' | 'after-compaction'`.-- `SessionCheckpointPayload { version: 1, projectId, document, messages, compactedContext? }` is the snapshot of full state at checkpoint time. **This is the rollback unit.**-- `restoreCheckpoint(sessionId, checkpointId)` returns `{ checkpoint, payload?, langGraphRestored, warnings }`. Two restore paths: langgraph state (for runtime thread) + document state (for user-visible timeline).-- `compactedContext` is the post-compaction summary that the agent sees instead of the raw message history.--### `axcut-deep-agent.ts` — AxcutDeepAgentService-- Wraps `createDeepAgent(...)` from `deepagents` (LangGraph-based) with six tools:- - `transcriptSearch` (query, limit)- - `suggestCuts` (kind: filler|pause, minDurationSec, limit)- - `applyTimelineOperation` — dispatches to all 11 timeline ops- - `approveSuggestion` / `rejectSuggestion`-- `AXCUT_DEEP_AGENT_PROMPT` is hardcoded — system prompt defining Axcut's editorial rules (prefer skip ops for cleanup, structural ops for montage, never invent timestamps).-- Streaming via `agent.streamEvents()` parses `on_chat_model_start|stream|end`, `on_tool_start|end|error`, `on_chain_end` to emit `agent.operation`, `agent.message.delta` events on the `EventBus`.-- Per-session langgraph thread keyed by `sessions.buildSessionConfig(sessionId)`.--### `axcut-agent-runtime.ts` — AxcutAgentRuntime-- Thin façade over `AxcutDeepAgentService`. Exposes `getOrCreateSession`, `createSession`, `getSession`, `listSessions`, `renameSession`, `deleteSession`, `listCheckpoints`, `saveCheckpoint`, `restoreCheckpoint`, `runTurn`.-- `runTurn(projectId, sessionId, userMessage, history)` — runs the agent and returns `{ text, state, document }`.-- Checkpoint orchestration: every user message creates a `before-message` checkpoint; every agent response creates an `after-run` checkpoint.-- **Critical**: `restoreCheckpoint` rewrites the `AxcutDocument` AND truncates messages AND resets the langgraph thread.--### `chat-service.ts` — ChatService-- Single public method `run(projectId, input)`: validates `ChatInput`, gets/creates session, saves `before-message` checkpoint, inserts user message, calls runtime, inserts assistant message, saves `after-run` checkpoint, emits events.-- Returns `{ assistantMessage, document, sessionId }`.--### `database.ts` — DatabaseService (better-sqlite3)-- File: `.axcut-data/metadata.sqlite` (WAL mode).-- Tables: `projects (id, title, document_path, created_at, updated_at)`, `messages (id, project_id, session_id, role, content, revision_id, checkpoint_id, created_at)`, `jobs (id, project_id, kind, status, progress, message, payload_json, result_json, created_at, updated_at)`.-- Indexes: `idx_messages_project_created`, `idx_messages_project_session_created`, `idx_jobs_project_updated`.-- Schema migrations inline (no migration framework). Notable: `messages.session_id` and `messages.checkpoint_id` were added later via `ALTER TABLE`.--### `event-bus.ts` — EventBus-- Simple per-project Node `EventEmitter`. Topics keyed by `project:<projectId>`.-- Events emitted by axcut: `agent.message.user`, `agent.message.assistant`, `agent.message.delta`, `agent.operation`, `agent.checkpoint.saved`, `agent.checkpoint.restored`, `project.revision.created`, `project.asset.updated`, `preview.ready`, `job.queued`, `job.completed`, `job.failed`.-- Renderer subscribes via Fastify SSE endpoint (`/api/projects/:id/events`).-- **For OpenScreen**: replace the EventEmitter fan-out with `webContents.send` so each renderer window receives events. Reuse the existing `NativeBridgeEventName` (`src/native/contracts.ts:230-238`) as the event-channel union.--### `job-service.ts` — JobService-- Long-running async operations queue: `enqueueAssetIngest`, `enqueueTranscription`, `enqueueExport`.-- For asset ingest: probe → proxy → optional transcribe. Each step emits `project.asset.updated`, `preview.ready`, etc.-- Uses `queueMicrotask` to schedule work — no real worker pool. **Edge case**: if the user closes the editor mid-ingest, the job keeps running. axcut handles this implicitly because the Fastify process stays alive; OpenScreen needs explicit "cancel on editor close" logic.--### `llm-config-service.ts` — LlmConfigService-- Wraps `LlmConfigStore` (config on disk + credentials).-- `getSnapshot()` returns `ready, source, stored, effective, providers, connectedProviders, availableProviders` — the shape `ProviderSettingsDialog` consumes.-- Handles `connectProvider`, `selectModel`, OAuth device-flow for ChatGPT (`beginCodexDeviceAuth`, `completeCodexDeviceAuth`), GitHub Copilot (`fetchGitHubCopilotModels`).--### `python-worker.ts` — PythonWorker-- Spawns the Python CLI as a child process: `python -m axcut_worker.cli <args>`.-- Args: `probe`, `proxy`, `transcribe`, `export`, `export-sequence`.-- JSON in, JSON out (`{ ok, data }` or stderr).-- `PYTHONPATH` set to `py/axcut-core/src:py/axcut-worker/src`.-- Uses `pythonExecutable = path.join(repoRoot, '.venv', 'bin', 'python')` — assumes local venv. **Drop with the Python worker in the merge.**--### `worktree-service.ts` — WorktreeService-- Spawns `git worktree add` / `git worktree list --porcelain` / `git worktree remove`.-- Stores worktrees under `.axcut-data/worktrees/<branch>`.-- **Why it exists**: axcut's earlier design (now superseded) let the agent edit *project source files* in an isolated git worktree. The current UX still exposes a "Worktrees" dialog but most users don't use it. **Drop entirely in OpenScreen merge** — video projects don't need git isolation.-------## 3. Server libs (`apps/server/src/lib/`)--### `timeline.ts` (~200 lines)-- `normalizeIntervals(durationSec, intervals)` — clamp + sort + merge overlapping → flat kept intervals.-- `timelineIntervals(document)` — derives current kept intervals from `document.timeline.clips` filtered to primary asset.-- `buildTimelineFromIntervals(assetId, intervals, { origin, reason, transcript })` — creates clips with retimed `timelineStartSec/EndSec` and collected `wordRefs`.-- `retimeClips(clips, transcript)` — re-flows `timelineStartSec/EndSec` and regenerates `clip_N` ids for new clips.-- `subtractInterval(intervals, cut)` — used by `editable-transcript.ts` LCS deletion.-- `resolveWordRange(document, startWordId, endWordId)` — throws if cross-asset ambiguous; prefers mounted clips over all transcripts.-- `applySourceCutToAsset(clips, assetId, cut, origin, reason)` — internal split helper.-- `applyTimelineOperation(document, operation, origin)` — the big dispatcher (every timeline op).--### `document-operations.ts`-- `applyDocumentOperation(document, operation, origin)` — top-level dispatch (timeline ops + approve/reject_suggestion).-- `replaceSuggestions(document, suggestions, lastReasoningSummary)`.-- `clearExecutedSuggestions(suggestions, operation)` — when an op matches a pending suggestion, mark it `approved`.-- **Uses `JSON.stringify` to compare operations** (`sameOperation`). Fast and works for primitive ops; risk if any op carries non-JSON fields.--### `document-history.ts`-- `appendRevision(document, input, createRevisionId, createdAt?)` — appends a `revision` to `document.history.revisions[]`.-- `refreshProjectUpdatedAt(document, updatedAt?)` — bumps `project.updatedAt`.--### `structured-agent.ts`-- `searchTranscript(document, query, limit)` — tokenized BM25-lite scoring across all transcripts.-- `buildFillerSuggestions(document, minDurationSec, limit)` — finds filler-word runs ("uh", "um", etc.) and emits `AxcutSuggestion[]` with proposed `add_skip_range` ops.-- `buildPauseSuggestions(document, minDurationSec, limit)` — finds long silence pauses similarly.-- Filler lexicon hardcoded at `:11-21`.-- These run **without LLM** — they're cheap pre-LLM suggestions.--### `ids.ts`-- `createId(prefix)` — `prefix_<random>` via `crypto.randomUUID()`.--### `paths.ts` (66 lines)-- `repoRoot`, `dataRoot = '.axcut-data'`, `runtimeRoot`, `projectsRoot`, `agentSessionsRoot`, `llmConfigPath`, `llmCredentialsPath`, `accountAuthRoot`, `databasePath`, `serverRuntimePath`.-- `projectRoot(projectId)`, `projectArtifactsRoot(projectId)`, `projectDocumentPath(projectId)` = `projectRoot/projectId/project.axcut`.-- **No `app.getPath('userData')`** — axcut lives in the repo. **For OpenScreen, swap to `app.getPath('userData')`** (the standard Electron user-data path).--### `media-stream.ts`-- Helpers for video source URL construction (asset-id → file:// URL).--### `utils.ts`-- Generic helpers (`safeStringify`, `truncate`).-------## 4. LLM provider layer (`apps/server/src/llm/`)--### `provider-registry.ts` — `PROVIDER_DEFINITIONS`-10 providers with full metadata:-| ID | Label | Default model | Auth | Reasoning effort |-|---|---|---|---|---|-| `anthropic` | Claude API | `claude-haiku-4-5` | API key | Yes |-| `openai` | OpenAI API | `gpt-4o` | API key | Yes (gpt-5 family) |-| `google` | Gemini API | `gemini-3-flash-preview` | API key | Yes (gemini-thinking) |-| `mistral` | Mistral API | (uses model name) | API key | No |-| `openrouter` | OpenRouter | (configurable) | API key | Yes |-| `openai-oauth` | ChatGPT (OAuth) | `gpt-5.4` | Device-flow OAuth | Yes |-| `copilot-proxy` | GitHub Copilot | `gpt-4.1` | GitHub PAT | Yes |-| `minimax` | MiniMax API | `MiniMax-M2.7` | API key | No (per axcut) |-| `minimax-token-plan` | MiniMax token-plan | (configurable) | API key | No |-| `openai-compatible` | OpenAI-compatible endpoint | (configurable) | Optional | (model-dep) |--Each definition carries `envKeys[]` (env vars to auto-pick the API key).--### `create-chat-model.ts`-- Returns a LangChain `BaseChatModel` based on `LlmConfigStore.getRuntimeConfig()`.-- Routes by `provider`: `ChatAnthropic`, `ChatMistralAI`, `ChatOpenAI`, or `createLocalProviderLangChainModel` for the four OAuth/special providers.-- For `openrouter/google/openai-compatible` it picks the right `baseURL`.--### `create-langchain-model.ts` — `createLocalProviderLangChainModel`-- `openai-oauth` → `ChatCodexOAuth` (custom subclass of `BaseChatModel`).-- `copilot-proxy` → `ChatOpenAI` with token exchanged from GitHub PAT (`resolveCopilotApiToken`), `defaultHeaders` spoofing VS Code Copilot Chat UA. Custom `CopilotCompletionsModel` extracts `reasoning_text` deltas.-- `minimax` / `minimax-token-plan` → also routes through `ChatOpenAI` against MiniMax's OpenAI-compatible endpoint.--### `openai-account.ts` — ChatGPT OAuth-- `OPENAI_ACCOUNT_BASE_URL = 'https://chatgpt.com/backend-api'`.-- `CODEX_ORIGINATOR = 'codex_cli_rs'` — device-flow origin (matches Codex CLI so backend attributes usage).-- `CODEX_RESPONSES_PATH = '/codex/responses'`, `CODEX_MODELS_PATH = '/codex/models'`.-- `CODEX_REASONING_EFFORT_OPTIONS = ['none','minimal','low','medium','high','xhigh']`.-- `ModelDiscoveryCache` — ETag-cached `/codex/models` response.-- Per-account JSON file under `accountAuthRoot/<id>.json` (refresh tokens).--### `copilot-account.ts`-- Token exchange: `POST https://api.github.com/copilot_internal/v2/token` with `Authorization: Bearer <github_pat>`.-- Caches resolved Copilot token + base URL to `accountAuthRoot/copilot-token.json` with `expiresAt`.-- Reads token, derives base URL via base64-decoding `proxy-ep=` claim in JWT.--### `chat-codex-oauth.ts`-- `ChatCodexOAuth extends BaseChatModel` — implements LangChain v1 chat-model contract.-- Per-session state: `previousPrompt`, `previousResponseId` — supports response-id chaining for efficient multi-turn.-- `CODEX_DEFAULT_INSTRUCTIONS` — system prompt prefix sent on the first turn (Codex identity).--### `tool-schema.ts`-- `normalizeFunctionToolParametersSchema` — turns Zod schemas into OpenAI function-calling JSON schema.--### `agent-provider-capabilities.ts`-- `getReasoningCapability(provider, model)` returns `{ supported, efforts[], defaultEffort?, strategy? }`.-- Strategies: `'custom-openai-account'`, `'openai-responses'`, `'anthropic-thinking'`, `'openrouter-reasoning'`, `'google-thinking'`.-- `buildLangChainReasoningOptions(provider, model, effort)` — translates effort into LangChain options (`{ reasoning, thinking, outputConfig, modelKwargs, useResponsesApi }`).-- `shouldDisableModelStreamingForToolCalling(provider, model)` — for tool-calling models where streaming tool deltas break.--### `llm-config-store.ts` — LlmConfigStore-- File-backed JSON config: `.axcut-data/llm-config.json`.-- API keys stored separately: `.axcut-data/llm-credentials.json` (encrypted? **no — plain JSON**).-- Environment-variable precedence: if `envKeys[i]` is set in `process.env`, it wins over the stored key.-- `getApiKey(provider)` returns the active key (env or stored).--### `utils.ts`-- `withRetry(fn, config)`, `timeoutSignal(ms)`, `CODEX_UPSTREAM_TIMEOUT_MS`, `RETRY_CONFIG`.-------## 5. Python worker (`py/`)--### `pyproject.toml`-- Python ≥ 3.12 required.-- Dependencies: `faster-whisper>=1.1.1,<2.0.0`, `huggingface-hub>=1.0.0,<2.0.0`, `pydantic>=2.11.0,<3.0.0`, `python-dotenv>=1.1.1,<2.0.0`.--### `axcut_worker/cli.py`-Five subcommands:-- `probe --video <path>` → `{durationSec, video: {codec, width, height, fps}, audio: {codec, sampleRate, channels}}` via `ffprobe`.-- `proxy --video <path> --output <path>` → runs ffmpeg to produce a low-res proxy MP4.-- `transcribe --video <path> --asset-id <id> --dsl-output <dsl> --json-output <json> --model <name> --language <code?>` → runs `faster-whisper` with word timestamps, writes both a custom DSL text format and a JSON payload.-- `export --video <path> --intervals <json> --output <path>` → cuts a single source by intervals.-- `export-sequence --clips <json> --output <path>` → concatenates multiple clips into one MP4.--### `axcut_core/transcribe.py`-- Models: `MODEL_REPOS = { tiny, base, small, medium, large-v3 }` from `Systran/faster-whisper-*` on Hugging Face.-- `transcribe_video(video_path, *, model_name, device, compute_type, language)` → `Transcript`.-- `beam_size=5`, `word_timestamps=True`, `vad_filter=False`.-- Returns pydantic `Transcript` (see models.py).--### `axcut_core/models.py`-Pydantic models mirror the Zod schema but in Python:-- `WordToken (id, segment_id, start, end, text)`-- `Segment (id, kind, start, end, text, words[])`-- `Transcript (source_video, duration, language, kind, edit_prompt, segments[])`-- `DeleteRange (start_word_id, end_word_id, reason)`-- `FollowUpQuestion`, `EditSuggestion`, `EditPlan`-- `KeepInterval (start, end)`--### `axcut_core/dsl.py`-- `write_transcript(path, transcript)` writes a custom plain-text format `AXCUT_TRANSCRIPT v1` with `META`, `SEGMENT`, `WORD`, `ENDSEGMENT`, `SILENCE` lines.-- `read_transcript(path)` round-trips. **This format is the "ingest/export artifact" the README mentions.** Not used by the runtime — only by Python.--### `axcut_core/render.py`-- `create_proxy_video(video_path, output_path)` — ffmpeg command for proxy.-- `render_cut_video(video_path, output_path, keep_intervals)` — ffmpeg concat with negative filter expressions.-- `render_clip_sequence(clips_path, output_path)` — multi-clip sequence.-- `compute_keep_intervals_from_cleaned(source, cleaned)` — derives intervals from a "cleaned" transcript.-- **No high-level effects** (zoom, annotations, blur, cursor). Pure ffmpeg cut/concat. Visual polish is left to a future iteration.--### `axcut_worker/__init__.py` — empty.-------## 6. Web app (`apps/web/src/`)--### `App.tsx` (top-level — ~1500 lines)-Layout (top-down, all on a single page):-1. **Header** — title, project picker, history dialog toggle, worktree dialog toggle, provider settings toggle, load video dialog.-2. **Status chips** — model status, export status with download button, transcription jobs.-3. **Left sidebar** — ProjectPanel: compositions (recent projects) + files (asset list with drag-source handles).-4. **Center** — VirtualPreview + TranscriptEditor stacked.-5. **Right sidebar** — CurrentTranscriptView (chat panel + suggestions).-6. **Bottom** — TimelinePane with skip ranges, drag-drop assets, clip editing, navigation.-- State from `@tanstack/react-query`: `useQuery(['project', projectId])`, `useMutation` for all ops.-- Local state: `activeSessionId`, `selectedProjectId`, `transcriptLanguage`, `currentTimeSec`, `transcriptModalAssetId`, `sourcePreviewTarget`.-- ~20 modal/dialog components mounted conditionally (history, worktree, provider settings, load video, insert asset, transcript, etc.).--### `components/TimelinePane.tsx` (~1500 lines — longest file in the repo)-The full timeline component. Key features:-- **Clips**: drawn as colored blocks per source, multi-asset layout.-- **Skip ranges**: rendered as gaps between kept segments, with left+right resize handles.-- **Resize modes**:- - Always-on: skip-handle resize.- - Pencil-button mode: clip-handle resize (changes `sourceStartSec`/`sourceEndSec`).-- **Pan/zoom** via `NavigatorDragState` (mini-map at top).-- **Asset drop** via HTML5 DnD — sets `pendingAssetInsert` for the InsertAssetDialog.-- **Clip reorder** via `ClipReorderState` (ghost + insert marker).-- **Clip duplicate** via Ctrl+C/V (intercepted at `window.addEventListener('keydown')`).-- **Skip pointer-drag** via `startGlobalPointerDrag` (in `lib/pointer-drag.ts`).-- Calls `onAddSkipRange / onUpdateSkipRange / onRemoveSkipRange / onUpdateClipRange / onDuplicateClip / onMoveClip / onAssetDrop` props.--### `components/VirtualPreview.tsx`-- Two `<video>` elements (`videoARef`, `videoBRef`), crossfade at clip boundary.-- `locateVirtualPosition(clips, virtualTimeSec)` returns `{ clip, clipIndex, virtualTimeSec, sourceTimeSec }`.-- Layer A and layer B swap on clip transitions: when crossing a clip boundary, seek the inactive layer to the next clip's source time, then swap.-- Pending seek queue (`pendingSourceSeekRef`) to avoid race between user seek + clip-boundary seek.-- Preloads next clip's source when within `CLIP_END_LOOKAHEAD_SEC = 0.04` of the end.-- Subscribes to `seekTarget` and `sourcePreviewTarget` props.--### `components/TranscriptEditor.tsx`-- Click a word, shift-click another word → range → "Cut" → `dropWordRange` op.-- "Restore" button → `restore_full_timeline` op.-- Word styling: kept = default, in-skip = red.--### `components/CurrentTranscriptView.tsx`-- Chat panel + suggestions list.-- Renders agent's "operations" (thinking, tool runs) as they stream.-- Markdown rendering for assistant messages (presumably `react-markdown`).--### `components/SuggestionList.tsx`-- Pending suggestions with proposed operation preview; Approve / Reject buttons.--### `components/LlmSetupPanel.tsx`-- The "first-run" provider setup (smaller version of `ProviderSettingsDialog`).--### `components/ProviderSettingsDialog.tsx` (1300+ lines — huge)-- Models screen (per-provider model picker, search, refresh).-- Providers screen (connected provider list).-- Settings screen (edit / add providers).-- Provider-create-select screen (choose which provider to add).-- Provider-form screen (per-provider credentials: API key, base URL, reasoning effort, OAuth device challenge).-- Device challenge UI for OAuth flows (verification URL, user code, copy button).--### Other modals-- `LoadVideoDialog` — recent projects + new-project button.-- `InsertAssetDialog` — when dropping a source on the timeline.-- `TranscriptDialog` — view raw transcript for an asset, regenerate in different language.-- `SessionHistoryDialog` — list, rename, delete sessions.-- `WorktreeDialog` — list/create/remove worktrees (drop in OpenScreen merge).--### `lib/virtual-preview.ts`-Pure-function library used by both React components and server-side timeline math:-- `totalVirtualDuration(clips)` — `clips.at(-1)?.timelineEndSec ?? 0`.-- `clampVirtualTime(clips, value)`.-- `locateVirtualPosition(clips, virtualTimeSec)` — binary search.-- `locateSourcePosition(clips, sourceTimeSec, assetId?, epsilon?)`.-- `resolvePlaybackPosition(clips, currentClip, currentSourceTimeSec, playState)` — `{ inside | next | ended | empty }`.-- `keptWordIdSet(clips)` — for highlighting kept vs. skipped words.-- `selectWordRange(words[], anchorWordId, focusWordId)` — transcript range selection.--### `lib/pointer-drag.ts`-- `startGlobalPointerDrag(target, event, onDelta, onEnd?)` — captures pointer and dispatches `onDelta(dx, dy, event)`.--### `lib/editable-transcript.ts`-- LCS-based deletion algorithm: `deriveEditableTranscriptUpdate(document, editedText)` → returns `{ intervals, deletedWordIds }`.-- Tokenizes by line (`# Clip X` prefixes excluded) → split by whitespace → normalize (`toLocaleLowerCase`, strip non-letter/non-digit punctuation).-- Returns intervals after subtracting the deleted-word ranges.--### `lib/optimistic-timeline.ts`-- Optimistic UI updates for timeline ops.--### `lib/live-run.ts`-- Live-run state for an in-progress agent run (tool-call status, partial deltas).--### Tests-- `lib/{editable-transcript,virtual-preview,optimistic-timeline,live-run}.test.ts` (Vitest).-- `components/{CurrentTranscriptView,TranscriptEditor}.test.ts` (testing-library).-- **No Playwright / browser tests** — everything is jsdom or Node.-------## 7. Worktree service--Already covered in §2. `WorktreeService` exists for axcut's "agent edits source files in an isolated git worktree" feature, which is **not relevant to a video-editing project**. Drop entirely.-------## 8. Tests in axcut--- `apps/server/src/services/{document-operations,document-history,agent-session-service,axcut-deep-agent,timeline,chat-service}.test.ts`.-- `apps/server/src/lib/{timeline,document-operations,structured-agent}.test.ts`.-- `apps/server/src/llm/{create-chat-model,llm-config-store}.test.ts`.-- `apps/web/src/components/{CurrentTranscriptView,TranscriptEditor}.test.tsx` + `lib/{editable-transcript,virtual-preview,optimistic-timeline,live-run}.test.ts`.-- `packages/axcut-schema/src/index.test.ts`.-- **No Playwright / browser tests**.-- Total: ~15 test files.-------## 9. Documentation in axcut--- `README.md` (6759 bytes) — quickstart, architecture, env vars, commands.-- `clip-skip.md` (9597 bytes) — **the conceptual spec** for the clips/skip model. Read when implementing Phase 1.-- `Dockerfile`, `docker-compose.yml`, `.env.example`, `pyproject.toml` — already covered.-- No `AGENTS.md`, no `ROADMAP.md`, no `docs/` folder.-------## 10. Anything else--### `Dockerfile`, `docker-compose.yml`-- Image installs Python 3.12, Node, ffmpeg, runs `npm install` + `uv pip install -e .`.-- Volumes: `axcut-data` (persisted), `axcut-credentials`, `axcut-cache` (Whisper models).-- Mounts repo at `/workspace` (read-only) so recordings can be imported by absolute path inside the container.-- **For OpenScreen: completely irrelevant** — Electron app, no container.--### `.env.example`-- Common env keys: `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `GEMINI_API_KEY`, `OPENROUTER_API_KEY`, `OPENAI_COMPATIBLE_API_KEY`, `AXCUT_MODEL_CACHE`, server ports.--### `scripts/`-- `clean-processes.mjs` — kills leftover dev servers.-- `generate-assets.mjs` — generates `assets/generated/logo_full_h_readme.png` (README logo).--### `.kilo/`-- Empty or near-empty. Kilo is an AI-agent IDE config; not relevant.--### Settings & state shape (`LlmConfigSnapshot`)-```ts-{- ready: boolean,- source: { homeDir, configPath, credentialsPath, accountAuthRoot },- stored: { provider, model, baseUrl, reasoningEffort, apiKeyStored },- effective: { provider, providerLabel, model, baseUrl, reasoningEffort,- supportsReasoningEffort, apiKeyAvailable, apiKeySource },- providers: ProviderState[],- connectedProviders: ProviderState[],- availableProviders: ProviderState[],-}-```--### `apps/server/src/app.ts`-Fastify server with routes:-- `GET /api/projects` (list), `POST /api/projects` (create).-- `GET /api/projects/:id` (snapshot: document + messages + jobs).-- `POST /api/projects/:id/operations` (apply op).-- `POST /api/projects/:id/timeline/replace` (full replace).-- `POST /api/projects/:id/chat` (run chat turn).-- `POST /api/projects/:id/assets` (add asset by path).-- `GET /api/projects/:id/transcript/:assetId` (raw transcript artifact).-- `POST /api/projects/:id/assets/:assetId/transcribe` (transcription job).-- `POST /api/projects/:id/sessions` (create), `GET` (list), `PATCH` (rename), `DELETE`.-- `POST /api/projects/:id/sessions/:sessionId/checkpoints` (save), `GET` (list), `POST :restore`.-- `POST /api/projects/:id/worktrees` (create), `GET` (list), `POST :select`, `DELETE`.-- `GET /api/llm/providers` (snapshot), `POST /api/llm/providers/:id/connect`, `POST :device/complete`, `POST :select`, `DELETE`, `GET :/models`.-- `GET /api/projects/:id/events` (SSE).-- `POST /api/exports` (enqueue export job).--**For OpenScreen**: replace all of this with `native-bridge:invoke` handlers in the main process. The SSE pub-sub becomes a `webContents.send` event stream. Each axcut service becomes a TypeScript module in `electron/ai-edition/`.\ No newline at end of filediff --git a/technical-documentation/_harvest/axcut-ux-ui-spec.md b/technical-documentation/_harvest/axcut-ux-ui-spec.mddeleted file mode 100644index 66bc809d6..000000000--- a/technical-documentation/_harvest/axcut-ux-ui-spec.md+++ /dev/null@@ -1,397 +0,0 @@-# Axcut Web UI — UX/UI Specification--Single-page dark web app at `http://127.0.0.1:5173`. Five-zone resizable grid, no client-side routing, persistent server connection via SSE.--## 1. Layout--CSS grid, full viewport, drag-to-resize on every gutter. Open/closed state for each side panel is persisted in `localStorage`.--```text-┌──────────────────────────────────────────────────────────────────────┐-│ scene-header (56 px) │-├──────────┬───┬─────────────────────────┬───┬─────────────────────────┤-│ │ ↔ │ preview-pane │ ↔ │ transcript-rail │-│ left-rail│ │ │ │ │-│ (tabs + │ │ │ │ │-│ panel) │ │ │ │ │-│ │ │ │ │ │-├──────────┴───┴─────────────────────────┴───┴─────────────────────────┤-│ timeline-resizer (1 px) │-├──────────────────────────────────────────────────────────────────────┤-│ timeline-pane │-└──────────────────────────────────────────────────────────────────────┘-```--- `chatPanelOpen`, `timelinePanelOpen`, `transcriptPanelOpen` — toggle from header.-- Below 980 px viewport, resize handles are disabled (panels stack).-- Chat width default 610 px, transcript width default 360 px, timeline height default 170 px.-------## 2. Scene Header (top bar)--Left: **project title** (button → click to rename → inline input; Enter saves, Esc cancels, blur saves). Right: **Export** button + **panel toggle group** (hide/show chat, timeline, transcript — icon swaps between panel-open and panel-closed variants).--- Export is disabled if there are no clips, no session token, or an export job is already running.-- Rename error renders inline under the title.-------## 3. Left Rail — Tabs--Vertical tab strip on the left edge, 74 px wide. Two tabs:--- **Project** (folder icon) — file and composition browser.-- **Axcut** (mascot icon) — chat.--Selecting a tab auto-opens the chat panel if collapsed.-------## 4. Project Panel (left rail, "Project" tab)--Scrollable. Two sections.--### 4.1 Compositions-- Up to **4 most recently updated** projects listed, sorted by `updatedAt` desc.-- Active project shows a check mark and "active" highlight.-- Header `+` icon opens the **Projects dialog** (see §10.1).--### 4.2 Files-- **Upload** icon triggers hidden `<input type="file" accept="video/*,.mp4,.mov,.m4v,.webm,.mkv">`.-- Read-only **Search** field (placeholder, not wired).-- **File list**: each row = draggable item, label + duration. Shows one of four transcript-status indicators: `pending` (gray dot), `running` (spinner), `complete` (green dot), `failed` (red dot).-- During upload: row replaced by "Uploading video..." status card with spinner.-- **Click** a file → opens Source Transcript modal (§10.4).-- **Drag** a file into the timeline → drops at pointer time, opens Insert Source dialog (§10.3).-- Hover tooltip clarifies drag vs click.-- Upload errors render inline above the list.-------## 5. Axcut Panel — Chat (left rail, "Axcut" tab)--Three vertical blocks: header, messages (scrollable), composer (sticky).--### 5.1 Chat header-Header row of icon buttons (icon + tooltip; text on hover via `title`):--- **Context pill** — `% context` fill of the model window; tooltip shows prompt tokens / window.-- **Worktree pill** — current worktree branch or path, click opens Worktrees dialog. Only when a session is active.-- **Worktrees button** — same target.-- **Compact context button** — triggers `compact_context`; disabled when no active session, compaction pending, or chat in flight.-- **Settings (gear)** — opens Provider Settings modal, initial screen = "settings".-- **History** — opens Conversation History dialog.-- **New chat** — creates a fresh session and activates it.--Subheader: active session title (or "New conversation"). Read-only.--### 5.2 Messages area-Auto-scroll to bottom while near bottom. Scroll up = manual mode (auto-scroll suspends).--Each message is one of `user | assistant | system`. Renders:-- Role label (`you`, `Axcut`, or system), timestamp.-- Content paragraph.-- Per-message action row (appears on hover):- - **Rewind** (back arrow) — only on user messages with a checkpoint. Opens a confirmation popover ("Rewind here? Project, conversation, and agent state will be restored." Cancel / Rewind). Sends a rewind request; on success the prompt is pre-filled with the rewound message and live-run state resets.- - **Copy** — copies message text to clipboard.--Empty state: "No messages in this conversation yet." or, with no project, "Start the server with AXCUT_VIDEO_PATH set to a local video file."--### 5.3 Live-run feed (appended below messages while running)-Cards shown only while the agent is active. Disappears when no run is in flight:-- **Thinking** card — agent's streamed reasoning text (Brain icon).-- **Operation card** — one per tool/operation (Brain / Terminal / Wrench icon + label + status pill `Running`/`Done`/`Error`, optional one-line summary, expandable "Show details" with full body).-- **Context compacted** card — short compaction summary + source tag.-- **Streaming assistant draft** — assistant reply as it streams; ends when the final message arrives.-- **Run indicator** — 9-dot animated bar at the bottom while active.--### 5.4 Composer-- Multi-line textarea (2 rows), placeholder "Describe the edit you want." Resize vertical.-- `Enter` sends, `Shift+Enter` inserts newline.-- **Provider pill** (sliders icon + `provider / model`) — click opens Provider Settings popover; opens on "models" if ready, on "providers" otherwise.-- **Reasoning pill** — only shown when the model supports it; shows current level (e.g. "Reasoning medium"). Click opens the Reasoning popover with the six levels (`none / minimal / low / medium / high / xhigh`).-- "Waiting for the agent response…" muted text while the first byte is pending.-- **Send button** (paper plane) — disabled until there is a project, a session token, a configured LLM, non-empty trimmed text, and no in-flight chat. Icon swaps to a spinner mid-send.-- Inline error message under the form when the chat request fails.-------## 6. Preview Pane (center)--Two stacked `<video>` layers (A/B) for buffer-and-swap at clip boundaries, plus a controls bar. Renders the **playback timeline** (timeline minus skip ranges).--### 6.1 Video frame-- Layers preload the next clip before its boundary (cross-fade by swapping active layer).-- States shown as overlay text:- - `loading` — "Loading preview media..."- - `error` — "Video preview could not be loaded."- - `idle` / no sources — "Attach a video to start previewing." placeholder.-- Click on the frame toggles play/pause.-- Fullscreen toggle via the controls (button); the frame itself responds to the Fullscreen API.--### 6.2 Controls bar (under frame)-- **Play / Pause** (icon swaps), disabled if no clips or not ready.-- **Restart** — seek to 0.-- **Fullscreen** — enter / exit fullscreen on the frame.-- **Time readout** — `MM:SS.mmm / MM:SS.mmm` (current / total virtual duration).-- **Range slider** — scrub through the virtual duration; thumb progress is color-filled; click jumps, drag scrubs. Disabled until ready.--The current playback position drives the transcript cue highlight, the timeline playhead, and the time readout in the timeline header.-------## 7. Transcript Rail (right)--Header "Current Transcription". Below, one of three states:-- "No timeline clips yet."-- "No transcript is available for timeline clips yet."-- **ContentEditable transcript view** (one block per clip, in timeline order):- - Per-clip header: numbered badge, asset label, `Clip N · start - end`.- - Words rendered as `<span data-word-id>`. Per-word class: `kept | cut`, optional `cue` (current playback position) and `silence` (gap tokens shown as `(0.5s)`).- - **Kept runs** group kept words; **cut runs** group skipped words and show a hover-revealed trash button (Removes skip).- - Whole region is `contentEditable` (disabled while `busy`); typing/pasting is blocked; only deletions are meaningful.--### 7.1 Interactions-- **Click a word** → seek preview to that source time; auto-scroll to the cue word if it leaves the viewport.-- **Select a range of words** with the mouse → press `Backspace` or `Delete` (or fire the `deleteContent*` input event) → adds a skip range for those words (only kept words; cross-asset selection is ignored).-- **Backspace/Delete at a collapsed caret** deletes the adjacent kept word (Backward = Backspace, Forward = Delete), producing a one-word skip.-- **Trash button** on a cut run → removes that skip.-- **Caret moves with arrow keys** → preview seeks to the new caret's interpolated time.-- Auto-scroll keeps the cue word visible with a 56 px top/bottom margin.-------## 8. Timeline Pane (bottom)--Header row + viewport + navigator strip.--### 8.1 Header-- Left: title "Timeline", subtitle `N clips · M skips · total duration`.-- Right:- - **Scissors button** — toggles "place-skip" mode. While active, hover shows a vertical placement marker; click anywhere in the timeline creates a skip at that source time. Disabled while busy or no clips.- - Current timeline time, plus "Clip i/N" or "No active clip".--### 8.2 Viewport (scrollable)-Ruler + clip lane + overlays.-- **Ruler** with major/minor ticks; major ticks labelled with `mm:ss.s`.-- **Clip blocks** — one per timeline clip in playback order. Each shows:- - A skip strip across the top (small dim segments at skip positions).- - A body with the asset label, `timeline start - end`, and `source start - end`.- - **Edit (pencil) button** → opens the Clip Edit modal.-- **Clip selection / drag**: pointer-down on a clip starts a drag-to-reorder. Threshold (6 px) before it engages; once dragging, the clip snaps to the nearest drop position with a vertical reorder marker. Releasing dispatches `move_clip`.-- **Click a clip** → selects it (highlight).-- **Hover a skip** → skip-hover-controls appear above the strip with:- - `‹` resize handle (only if the skip is not pinned to the clip edge).- - Trash button (remove skip).- - `›` resize handle.- - Drag the handles to adjust start/end (`update_skip_range`).-- **Playhead** — vertical line at the current source time.-- **Pending cut marker** — vertical preview line in scissors mode.-- **Reorder marker** — vertical line during drag-to-reorder.--### 8.3 Interactions on the empty surface-- **Click / drag** → scrub (preview seeks on every move).-- **Alt + drag** or **middle-button drag** → pan horizontally when the visible window is narrower than the source duration.-- **Ctrl + wheel** → zoom (in/out by 1.18×), anchored at the cursor X.-- **Drop an asset** (`application/x-axcut-asset`) → opens Insert Source dialog.-- **Wheel** without Ctrl → default page scroll.--### 8.4 Navigator strip (under viewport)-Horizontal overview with skip markers. A draggable window shows the currently visible range:-- Drag the **body** → pan.-- Drag the **left handle** → resize window from the start.-- Drag the **right handle** → resize window from the end.--### 8.5 Clip Edit modal-- Title "Edit clip", subtitle asset label, close (X) button.-- Left: Virtual preview of the source range only.-- Right: start / end / duration readouts, source-range track with draggable handles (start / end), reset / cancel / apply.-- Apply dispatches `update_clip_range` and closes.-- Esc closes the dialog.-------## 9. Modals & Popovers--All modals: backdrop click closes; Esc closes (where wired).--### 9.1 Projects dialog (LoadVideoDialog)-Opens from the `+` button next to Compositions.-- Left column: "Recent projects" (up to 8, sorted by `updatedAt`); each row shows title + date, active gets "Open" pill.-- Right column: "New project" with description and `+ New project` button. Inline error on failure. New project becomes the active project, dialog closes.--### 9.2 Conversation History dialog-- Lists every session for the active project: title, message count, last-update date.-- Active session shows "Active" pill.-- Per-row: **Rename** (pencil → inline editor → save), **Delete** (trash, disabled if only one session remains).-- Click on the main body switches to that session and closes.--### 9.3 Worktrees dialog-- "Main workspace" entry (the repo checkout) + each available worktree (branch name, full path, "Locked" pill when applicable, "Active" pill when selected).-- **Create** button → `createWorktree`.-- **Select** → activates that worktree.-- Trash → removes (disabled when locked).--### 9.4 Source Transcript modal-- Header: "Source Transcript" + asset label (or artifact filename).-- Top: source-only video preview (full asset range).-- Toolbar: status pill (`Not generated yet / Generating / Generated / Generation failed`), `Detected language: xx`, language selector for regeneration (`auto / en / fr / de / es / it / pt / nl / ja / ko / zh`), **Regenerate transcript** button (spinner while running).-- Body: `<pre>` showing the raw transcript artifact text, with loading state and error copy.-- Closing clears the modal.--### 9.5 Provider Settings — opening surfaces-Same component, two surfaces:-- **Popover** anchored at the provider pill / gear: starts on `models` or `providers` depending on readiness.-- **Modal**: starts on `settings` (from gear) or `provider-form` (from edit).--Screens (deep-linking via `initialScreen`, back-arrow on top-left):-- **Models** — provider label, current model, model search input, scrollable model list (`Active` marker on the selected one). If the saved login is expired, shows **Reconnect**. If a device challenge is open: code card with the user code, copy button (turns into check + "Copied"), "Open login page" external link.-- **Providers** — grid of connected providers; pick one → Models screen. `Provider settings` button at the bottom.-- **Provider Settings (settings screen)** — list of connected providers with per-row edit; `+ Add provider` button.-- **Add Provider (provider-create-select)** — list of available providers; pick one → provider form (create mode).-- **Provider form** — provider label, description (e.g. "Sign in with your ChatGPT account."), Model select (populated when connected; shows "Connect this provider to load…" otherwise), Reasoning effort select (when supported), Base URL input (when required), API key input (password; placeholder notes "Leave blank to keep stored key" when connected). Buttons:- - `Disconnect` (danger, only when connected).- - `Connect` / `Update key` / `Start login` / `Reconnect login` (label depends on whether the provider uses OAuth and whether it is connected).- - `Use provider` (commits the selected model and closes the modal/popover).- - Device challenge panel appears in-form for OAuth providers, identical to the Models screen card.--Backdrop click on the popover closes; on the modal, click on the backdrop also closes.--### 9.6 Reasoning popover-Anchored at the reasoning pill. Lists the six reasoning-effort options with the current one marked `Active`. Selecting dispatches an update and closes.--### 9.7 Insert Source modal-Triggered by dropping an asset onto the timeline. Header shows source label and insertion time. Three choices:-- **Add before** — insert the whole source before the target clip.-- **Add after** — insert the whole source after the target clip.-- **Split here and insert** — split the target clip at the drop point and insert the source in between.--### 9.8 Rewind confirmation popover-Anchor-below the rewind button. "Rewind here?" + warning copy. Cancel / Rewind.-------## 10. Status & Feedback Surfaces--### 10.1 Status chips-Inline chips for two jobs:-- **Transcription** — `idle | running | ready | error`; label + detail (e.g. "120 segments · 1840 words · en"); progress fill on the dot.-- **Export** — `idle | running | ready | error`; on `ready` adds a **MP4 download** button (anchored `<a download>`).--### 10.2 File transcript indicators-Four-state dot in the Files list (see §4.2).--### 10.3 Live-run visual signals-Thinking/operation/compaction cards + streaming draft + run indicator (see §5.3).--### 10.4 Errors-- Per-mutation inline error message under the relevant form / button.-- Provider Settings surfaces a `reconnectRequired` banner when the saved credential no longer works.-------## 11. Conversation Lifecycle (end-to-end flow)--1. User lands on the app → first project auto-selected if any.-2. Empty state: chat shows "Start the server with AXCUT_VIDEO_PATH set to a local video file." if no project; otherwise the chat says "No messages in this conversation yet."-3. If LLM is not configured: send button is disabled, provider pill shows "LLM not configured". User clicks it → Provider Settings popover.-4. User configures a provider (API key or OAuth device flow), selects a model, closes popover.-5. User opens the Project tab → uploads a file (drag-and-drop or button). File appears with `running` indicator; ffmpeg probes + creates proxy + Whisper transcribes.-6. User can switch to the file's transcript modal to inspect / regenerate it.-7. User drags the file into the timeline, or asks the agent to "Add this file to the timeline." Drop → Insert Source dialog → timeline now has a clip.-8. User asks the agent to edit: e.g. "Remove silences and hesitations." → live-run feed streams thinking + operations → final assistant message + applied timeline edits.-9. User reviews transcript; selects words and presses Backspace to add manual skips; drags skip edges in the timeline to fine-tune; clicks the pencil on a clip to retune its source range.-10. User scrubs the preview, watches it, adjusts again.-11. User clicks **Export** → render job queued → progress chip → MP4 download button.-12. User opens History, switches to a previous session, or **Rewinds** to an earlier user message to undo a chain of edits.-13. User closes the panel group via header toggles; positions persist.-------## 12. Models (LLM Providers)--Configured from the UI; stored credentials live in the `axcut-data` volume (Docker) or `.env` (manual). Source for the live key shown in the provider card (`stored` vs `environment`).--| Provider | Auth | Notes |-|---|---|---|-| OpenAI | API key | Optional base URL for compat. |-| Anthropic | API key | |-| Google (Gemini) | API key | |-| Mistral | API key | |-| OpenRouter | API key | |-| OpenAI-compatible | API key + base URL | Required base URL. |-| GitHub Copilot | OAuth (device flow) | "Sign in with your GitHub account." |-| MiniMax | API key | |-| ChatGPT / OpenAI account | OAuth (device flow) | "Sign in with your ChatGPT account." |--- **Reasoning effort**: shown as a pill next to the provider pill when the active model supports it. Values: `none, minimal, low, medium, high, xhigh`. Selection persists for that provider/model.-- **Device flow** sequence: user clicks Connect → server returns `userCode`, `verificationUri(Complete)`, `intervalMs`, `expiresAt` → UI shows code card → user copies the code, opens the verification URL, approves → UI polls until complete → provider becomes Connected, models load, user picks one.-- **Reconnect**: when the server reports `provider_auth_expired` / `reconnectRequired`, the Models screen shows a **Reconnect** button and the provider-form banner explains that the saved credential no longer works.-------## 13. Keyboard Shortcuts & Gestures--| Where | Input | Action |-|---|---|---|-| Chat composer | `Enter` | Send message |-| Chat composer | `Shift+Enter` | Newline |-| Transcript view | `Backspace` / `Delete` | Skip selected / adjacent kept word |-| Transcript view | Arrow keys | Move caret → preview seeks |-| Transcript view | `Cmd/Ctrl + A` then type/paste | Blocked (only deletion is allowed) |-| Timeline viewport | Click / drag | Scrub preview |-| Timeline viewport | `Alt` + drag or middle-button drag | Pan |-| Timeline viewport | `Ctrl/Cmd` + wheel | Zoom around cursor |-| Timeline ruler / clip / drop | Drop asset | Open Insert Source dialog |-| Clip block | Drag | Reorder clip |-| Skip strip | Drag `‹` / `›` | Resize skip |-| Skip strip | Hover, click trash | Remove skip |-| Skip strip | Click | (no action; selection is in transcript) |-| Clip edit pencil | Click | Open Clip Edit modal |-| Header toggles | Click | Show/hide chat / timeline / transcript panels |-| Resize gutters | Drag | Resize panels (persisted) |-| Modals | `Esc` / backdrop click | Close |-| Rewind popover | `Esc` / outside click | Cancel |-| Rename title | `Enter` save / `Esc` cancel | Rename project |-------## 14. Persistence--- Panel open/closed flags and widths/heights: `localStorage` (`axcut.workbench.*`).-- Provider credentials, selected provider/model, reasoning effort: server-side (`.axcut-data` volume) with `.env` override.-- Project state, transcripts, jobs, sessions, checkpoints, worktrees: server-side JSON under `.axcut-data`.-- The UI revalidates on a 5-second poll and via SSE stream (`/api/projects/:id/stream`) for live updates.-------## 15. Streaming Events (UX-visible effects)--The UI subscribes to the project SSE stream. Visible behaviours:-- `job.progress` / `job.completed` / `job.failed` → status chips and file-list indicators update.-- `project.transcript.updated` → transcript modal reloads, source-transcript query invalidates.-- `project.revision.created` → timeline re-renders (clip / skip changes).-- `preview.ready` → preview reloads the affected layer.-- `agent.message.user / assistant / delta` → messages list and live-run draft update.-- `agent.thinking.delta` → Thinking card text streams.-- `agent.operation` → operation card enters/updates/exits.-- `agent.compaction` → Context-compacted card appears; live-run state resets.-- `agent.checkpoint.*` → rewind availability per user message updates.-- `agent.session.*` → header session title and History list update.-------## 16. Empty / Failure / Disabled States--- No project → chat empty copy + disabled send; Project panel shows "No compositions yet." / "No files in this project."-- No LLM configured → provider pill says "LLM not configured"; send disabled.-- No clips → timeline shows "No virtual clips yet."; export disabled; preview shows placeholder; transcript shows empty copy.-- Transcription not ready → status chip `Transcription waiting` / `Preparing transcription`; transcript view shows "No transcript is available…".-- Transcription failed → status chip `Transcription failed` + reason; file list shows red dot.-- Export queued / running → button label "Exporting", disabled until the job completes or fails.-- Export failed → status chip `Export failed` + reason.-- Models loading → list shows "Loading models..."; search input disabled.-- Reconnect required → Reconnect button on Models screen; banner in provider form.-- OAuth pending → device challenge card replaces the connect button until complete or expired.-- Drop on empty timeline (no clips) → still opens Insert Source modal, but the three buttons disable when the asset has no probed duration yet.\ No newline at end of filediff --git a/technical-documentation/_harvest/macos-native-cursor.md b/technical-documentation/_harvest/macos-native-cursor.mddeleted file mode 100644index b79064f8c..000000000--- a/technical-documentation/_harvest/macos-native-cursor.md+++ /dev/null@@ -1,183 +0,0 @@-# macOS native cursor test pipeline--This document covers manual and diagnostic testing for macOS native cursor capture — the path that records real system cursor bitmaps via `NSCursor.currentSystem` and surfaces them through the OpenScreen editor and export pipeline.--## How the macOS cursor helper works--The helper binary (`openscreen-macos-cursor-helper`) runs as a child process of Electron during recording. It:--- polls `NSCursor.currentSystem` at the configured sample interval-- converts each cursor image to PNG and computes a SHA-256 content hash as a stable asset id-- emits the full base64 bitmap payload **once** per unique cursor shape per session; subsequent samples carry only the `assetId` so stdout stays small-- tracks left-button down/up events via `CGEventTap` and tags each sample with `interactionType`-- uses the Accessibility API to detect `text` and `pointer` affordances (link/button/input roles) when Accessibility is granted; these shapes use the bundled high-quality SVG replacements instead of the raw bitmap--Each sample line is newline-delimited JSON:--```json-{ "type": "ready", "timestampMs": 1234567890, "accessibilityTrusted": true, "mouseTapReady": true }-{ "type": "sample", "timestampMs": 1234567891, "assetId": "a7472...", "asset": { "id": "a7472...", "imageDataUrl": "data:image/png;base64,...", "width": 64, "height": 64, "hotspotX": 16, "hotspotY": 16, "scaleFactor": 2.0 }, "cursorType": null, "leftButtonDown": false, "leftButtonPressed": false, "leftButtonReleased": false }-{ "type": "sample", "timestampMs": 1234567924, "assetId": "a7472...", "cursorType": null, "leftButtonDown": false, "leftButtonPressed": false, "leftButtonReleased": false }-```--`asset` is present only the first time a given `assetId` appears. The TypeScript session (`MacNativeCursorRecordingSession`) collects unique assets into a map and sets `provider: "native"` in the final `CursorRecordingData` when at least one bitmap was captured.--## Build the helper--```bash-npm run build:native:mac-```--This builds both Swift helpers (`openscreen-screencapturekit-helper` and `openscreen-macos-cursor-helper`) and copies them to:--- `electron/native/screencapturekit/build/` — used by the local dev server-- `electron/native/bin/darwin-arm64/` or `darwin-x64/` — used by packaged builds--Requires Xcode (not just Command Line Tools). If you see a build error about missing SDK metadata, run:--```bash-sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer-sudo xcodebuild -license accept-```--## Smoke-test the helper directly--You can run the cursor helper standalone to inspect its raw output before involving the full app:--```bash-BIN=electron/native/screencapturekit/build/openscreen-macos-cursor-helper-("$BIN" '{"sampleIntervalMs":100}' & PID=$!; sleep 2; kill $PID) | head -20-```--Expected first line:--```json-{"type":"ready","mouseTapReady":true,"accessibilityTrusted":false,"timestampMs":...}-```--`accessibilityTrusted: false` is normal in dev/unsigned builds. It means text/pointer affordance detection is disabled; native bitmap capture still works.--Expected sample lines:--```json-{"type":"sample","assetId":"a7472...","asset":{"id":"a7472...","imageDataUrl":"data:image/png;base64,...","width":64,"height":64,"hotspotX":26,"hotspotY":16,"scaleFactor":2.0},...}-{"type":"sample","assetId":"a7472...",...}-```--Move the cursor over a text input while the helper is running and check that a new `assetId` appears with a different bitmap (if Accessibility is granted — see below).--## Point the app at a custom helper binary--```bash-export OPENSCREEN_MAC_CURSOR_HELPER_EXE=/path/to/openscreen-macos-cursor-helper-npm run dev-```--## macOS permissions--Two separate permissions are needed:--| Permission | What it enables | Where to grant |-|---|---|---|-| Screen Recording | ScreenCaptureKit video capture | System Settings → Privacy & Security → Screen & System Audio Recording → Electron ✅ |-| Accessibility | `text` / `pointer` cursor type detection (affordance hints) | System Settings → Privacy & Security → Accessibility → Electron ✅ |--**Screen Recording** is required to record. Without it the recording never starts.--**Accessibility** is optional. Without it, `cursorType` will always be `null` and all cursors render from their captured bitmaps (no SVG substitution). This is the expected fallback and does not degrade cursor quality for non-text/pointer shapes.--After granting either permission in System Settings, **fully quit and relaunch** the dev server — `getMediaAccessStatus` caches the result per-process.--## Manual test checklist--### P0 — core bitmap capture--- [ ] Record a short clip. Open the editor. Confirm the default arrow cursor is the real system arrow (not the bundled SVG approximation).-- [ ] Record while hovering over a web browser. Confirm custom-CSS cursors (e.g. `cursor: grab`, `cursor: crosshair`) appear as their actual shapes.-- [ ] Export to MP4. Confirm the cursor renders correctly in the exported video.-- [ ] Export to GIF. Same check.--### P1 — affordance substitution (requires Accessibility)--- [ ] Grant Accessibility permission and restart the app.-- [ ] Record hovering over a text input field. Confirm the text I-beam uses the bundled SVG version (prettier than the system bitmap).-- [ ] Record hovering over a link/button. Confirm the pointer hand uses the bundled SVG.--### P1 — hotspot alignment (Retina)--- [ ] On a Retina display, record a precise click on a small button. In the editor, confirm the cursor tip aligns with the actual click point. The helper reports `scaleFactor: 2.0`; the renderer divides pixel dimensions and hotspot by this value to recover point sizes.--### P1 — click detection--- [ ] Record several left-clicks. In the editor, confirm the click-bounce animation fires on each click.-- [ ] Confirm `interactionType: "click"` and `"mouseup"` events are present in the recording session sidecar (`cursorRecordingData` inside `<videoPath>.cursor.json`).--### P2 — graceful degradation--- [ ] Remove **both** build-output copies of the helper binary and start a recording. The session should succeed with `provider: "none"` (position-only telemetry, default arrow rendered). Restore both binaries afterward.- ```bash- ARCH=$([ "$(uname -m)" = "arm64" ] && echo darwin-arm64 || echo darwin-x64)- mv electron/native/screencapturekit/build/openscreen-macos-cursor-helper /tmp/cursor-helper-build- mv electron/native/bin/$ARCH/openscreen-macos-cursor-helper /tmp/cursor-helper-bin- # ... start recording, then restore:- mv /tmp/cursor-helper-bin electron/native/bin/$ARCH/openscreen-macos-cursor-helper- mv /tmp/cursor-helper-build electron/native/screencapturekit/build/openscreen-macos-cursor-helper- ```-- [ ] Revoke Accessibility. Confirm recording still works and cursors render from bitmaps (no SVG substitution).--### P2 — multi-display--- [ ] Move the cursor to a secondary display during recording. Confirm the cursor clips to the canvas edge rather than snapping invisible on fast swipes. Confirm it hides after ≈100 ms of sustained out-of-bounds movement.--### P2 — long recording memory--- [ ] Record for 3–5 minutes while switching between many apps (browser, terminal, editor). The helper should not grow in memory because each iteration drains Cocoa objects via `autoreleasepool`. Check `Activity Monitor` → `openscreen-macos-cursor-helper` RSS stays flat after the first few seconds.--## What a healthy recording looks like--Inspect the cursor sidecar file written alongside the recorded video (`<videoPath>.cursor.json`). For a recording saved to `/tmp/rec.mp4`, the sidecar is `/tmp/rec.mp4.cursor.json`:--```json-{- "version": 2,- "provider": "native",- "assets": [- { "id": "a7472...", "platform": "darwin", "imageDataUrl": "data:image/png;base64,...", "width": 64, "height": 64, "hotspotX": 26.0, "hotspotY": 16.0, "scaleFactor": 2.0 }- ],- "samples": [- { "timeMs": 0, "cx": 0.42, "cy": 0.38, "visible": true, "assetId": "a7472...", "interactionType": "move" },- ...- ]-}-```--`provider: "native"` and a non-empty `assets` array confirm bitmap capture is active. If you see `provider: "none"` and `assets: []`, the helper was not found or exited before `ready`.--## Native macOS capture backend--The app routes macOS recordings through the ScreenCaptureKit helper (`openscreen-screencapturekit-helper`) when it is available, so the real system cursor is excluded from the video frame. The cursor position and bitmap are captured separately by the cursor helper and composited in the editor and export pipeline.--Current native availability rules:--- macOS 13 (Ventura) or newer-- `openscreen-screencapturekit-helper` binary is present-- Screen Recording permission is granted--Build both helpers locally:--```bash-npm run build:native:mac-```--For local diagnostics with a custom helper binary, use the environment override:--```bash-export OPENSCREEN_MAC_CURSOR_HELPER_EXE=/path/to/openscreen-macos-cursor-helper-npm run dev-```--## Known limitations--- **Intel (x86\_64) Macs**: the distributed helper is built for `darwin-arm64`. On Intel Macs, you need to build from source with `npm run build:native:mac` on the target machine.-- **Accessibility permission in unsigned/dev builds**: `getMediaAccessStatus("accessibility")` may not reflect the toggle state for unsigned Electron in dev mode. The helper will always probe and report `accessibilityTrusted` in its `ready` event — use that as the authoritative signal.-- **App-defined custom cursors (CGS layer)**: `NSCursor.currentSystem` captures the active AppKit cursor. Cursors set at the CoreGraphics/CGS layer by some games or GPU-accelerated apps may not be visible here. This is a known macOS API limitation.diff --git a/technical-documentation/_harvest/macos-native-recorder-roadmap.md b/technical-documentation/_harvest/macos-native-recorder-roadmap.mddeleted file mode 100644index 63afc423b..000000000--- a/technical-documentation/_harvest/macos-native-recorder-roadmap.md+++ /dev/null@@ -1,210 +0,0 @@-# macOS Native Recorder Roadmap--OpenScreen's macOS recorder should follow the same architecture boundaries as the Windows native recorder: Electron owns session orchestration and persistence, while a platform-native helper owns capture, timing, encoding, and platform-specific permissions.--This work is intentionally scoped as a macOS-only port. Windows native capture remains owned by the WGC helper, and Linux remains on the existing Electron path.--## Goals--- Capture displays and windows through ScreenCaptureKit.-- Exclude the real system cursor during capture when using the editable OpenScreen cursor overlay.-- Preserve the current high-quality cursor overlay path in preview and export.-- Capture macOS system audio through ScreenCaptureKit on supported macOS versions.-- Capture microphone audio through the same native timing domain where the OS supports it, or through an explicit companion path until it can be moved into the helper.-- Mix system audio and microphone audio into the primary MP4 without renderer-side track assembly.-- Capture webcam video natively and compose it into the helper-owned MP4 during the native-recording migration.-- Keep screen video, audio, webcam, and cursor aligned to one native timing origin.-- Package per-architecture helper binaries with macOS builds.--## Non-Goals--- Replacing the editor/export pipeline.-- Changing Windows native capture behavior.-- Adding Linux native capture.-- Shipping a silent fallback from native macOS capture to Electron capture when the user explicitly requested a native-only feature.--## Architecture--The renderer keeps the existing recording controls. On macOS, `useScreenRecorder` should eventually send a complete recording request to Electron instead of assembling display, audio, microphone, webcam, and cursor streams in the browser.--Electron owns the native recording session:--- resolves the selected display/window source;-- resolves output paths;-- starts cursor telemetry capture when editable cursor mode is selected;-- starts the ScreenCaptureKit helper process;-- sends pause/resume/stop/cancel commands;-- writes `RecordingSession` manifests;-- reports explicit errors when a macOS-native capability is unavailable.--The helper owns macOS media capture:--- ScreenCaptureKit display/window frames;-- ScreenCaptureKit system audio where supported;-- microphone capture or helper-owned companion audio capture;-- webcam capture and initial picture-in-picture composition;-- AVFoundation/VideoToolbox encoding and muxing;-- stream timestamp normalization.--## Helper Contract V1--The helper receives a single JSON argument:--```json-{- "schemaVersion": 1,- "recordingId": 1234567890,- "source": {- "type": "display",- "sourceId": "screen:0:0",- "displayId": 1,- "windowId": null,- "bounds": { "x": 0, "y": 0, "width": 1920, "height": 1080 }- },- "video": {- "fps": 60,- "width": 1920,- "height": 1080,- "bitrate": 18000000,- "hideSystemCursor": true- },- "audio": {- "system": { "enabled": true },- "microphone": {- "enabled": true,- "deviceId": "default",- "deviceName": "MacBook Pro Microphone",- "gain": 1.4- }- },- "webcam": {- "enabled": true,- "deviceId": "default",- "deviceName": "FaceTime HD Camera",- "width": 1280,- "height": 720,- "fps": 30- },- "cursor": {- "mode": "editable-overlay"- },- "outputs": {- "screenPath": "/Users/me/Library/Application Support/openscreen/recordings/recording-123.mp4",- "manifestPath": "/Users/me/Library/Application Support/openscreen/recordings/recording-123.session.json"- }-}-```--The helper emits newline-delimited JSON events to stdout:--```json-{ "event": "ready", "schemaVersion": 1 }-{ "event": "recording-started", "timestampMs": 1234567890 }-{ "event": "warning", "code": "microphone-unavailable", "message": "..." }-{ "event": "recording-stopped", "screenPath": "..." }-{ "event": "error", "code": "screen-permission-denied", "message": "..." }-```--## Implementation Phases--Current PR status: macOS screen/window capture routes through the ScreenCaptureKit helper when it is available so editable-cursor recordings can hide the system cursor. The helper now writes ScreenCaptureKit system audio into the primary MP4 and attempts runtime-gated native microphone capture on macOS versions that expose ScreenCaptureKit microphone output. Webcam capture is currently an Electron-recorded sidecar attached to the same recording session; native AVFoundation webcam composition remains the target end state.--### 1. Native Session Boundary--- Add a structured macOS native recording request type.-- Add a macOS helper resolver and build script placeholders.-- Keep the helper contract process-based, matching the Windows helper boundary.-- Do not route production macOS recording through this helper until the helper is available and validated.--Acceptance:--- TypeScript build passes.-- The macOS helper path and request contract are documented and testable without affecting Windows/Linux behavior.--### 2. ScreenCaptureKit Display Capture--- Implement a Swift helper using ScreenCaptureKit.-- Select display captures by `displayId`.-- Encode H.264 MP4 through AVFoundation/VideoToolbox.-- Set `showsCursor = false` when editable cursor overlay mode is selected.--Acceptance:--- Display-only recording produces a valid MP4.-- The real cursor is not baked into editable-cursor recordings.--### 3. ScreenCaptureKit Window Capture--- Resolve Electron `window:*` selections to ScreenCaptureKit window ids.-- Capture `SCContentFilter(desktopIndependentWindow:)`.-- Handle closed/minimized/protected windows with explicit errors.-- Keep window selection and capture source resolution in Electron/main, not the renderer.--Acceptance:--- Capturing a normal app window works with cursor/audio/webcam disabled.-- Unsupported windows return clear native errors.--### 4. System Audio--- Enable ScreenCaptureKit system audio on supported macOS versions.-- Keep audio format and timing owned by the helper.-- Encode or mux AAC audio into the primary MP4.--Acceptance:--- System-audio-only recordings produce a valid AAC track.-- Unsupported macOS versions return an explicit capability error.--### 5. Microphone--- Resolve the selected microphone device from the renderer-provided browser `deviceId` and user-visible label.-- Capture microphone audio in the helper timing domain.-- Apply OpenScreen microphone gain policy.-- Mix system and microphone audio before final AAC output.--Acceptance:--- Mic-only and mic-plus-system recordings produce a valid, balanced AAC track.-- Device selection honors the selected microphone, not only the default device.--### 6. Webcam Composition--- Capture the selected camera natively through AVFoundation.-- Match browser device id first where possible, then user-visible label.-- Compose an initial picture-in-picture overlay into the primary MP4.-- Hide webcam output until the first usable frame to avoid black startup flashes.--Acceptance:--- Native display/window recordings can include webcam without returning to Electron capture.-- Selected camera is honored.--### 7. Runtime Controls--- Add pause/resume commands to the helper.-- Add cancel command that removes partial outputs.-- Keep restart as stop-discard-start until the helper exposes a native restart operation.--Acceptance:--- Pause/resume keeps output duration coherent.-- Cancel leaves no stale media/session files.--### 8. Test Pipeline--- `npm run build:native:mac`: builds Swift helper binaries on macOS.-- `npm run test:sck-helper:mac`: display-only helper smoke test.-- `npm run test:sck-window:mac`: window capture smoke test.-- `npm run test:sck-audio:mac`: system audio smoke test when supported.-- `npm run test:sck-mic:mac`: microphone smoke test.-- `npm run test:sck-webcam:mac`: webcam smoke test when a webcam is available.-- Packaging check: confirms helpers are available under `electron/native/bin/darwin-${arch}` in packaged builds.--## SSOT Rules--- `src/lib/nativeMacRecording.ts` is the renderer/main TypeScript request contract.-- This document is the feature-level contract and phase checklist.-- The Swift helper owns ScreenCaptureKit/AVFoundation media timing.-- Electron owns output paths, session manifests, and selected source/device resolution.-- Renderer code must use existing hooks/client APIs and should not bind directly to helper process details.diff --git a/technical-documentation/_harvest/main-vs-ai-edition-audit.md b/technical-documentation/_harvest/main-vs-ai-edition-audit.mddeleted file mode 100644index c6d7e87b4..000000000--- a/technical-documentation/_harvest/main-vs-ai-edition-audit.md+++ /dev/null@@ -1,94 +0,0 @@-# main vs feat/ai-edition — audit fonctionnel--Point de divergence : `68d3a685` (2026-07-15).-Comparaison faite entre `origin/main` et `origin/feat/ai-edition` **directement**, sans-passer par la branche de portage `claude/rebase-ai-edition-main-c65d0d` (PR #154), qui est-mise de côté.--Périmètre : les **15 PR mergées sur main après la divergence**. Sept autres PR portent la-date du 2026-07-15 (#87, #85, #81, #73, #66, #58, #19 — Full Camera, éditeur de dégradés,-encodeur logiciel, WebGL, capture parallèle) mais leur commit de merge est **ancêtre** de-`68d3a685` : elles sont déjà dans ai-edition. Vérifié par-`git merge-base --is-ancestor <mergeCommit> 68d3a685`.--Verdict global : **main n'a produit aucune nouvelle fonctionnalité produit depuis la-divergence.** Ce sont des correctifs et de l'outillage de release. Mais quatre de ces-correctifs couvrent des bugs qui sont **toujours vivants dans ai-edition**.-------## A. Release / CI / packaging — aucun impact sur le produit édité--| PR | Sujet | Verdict |-| --- | --- | --- |-| #90 | Dispatch build sur le bon tag, nommage de la branche de release | hors périmètre branche |-| #134 | Release v1.7.0 dans main (bump de version) | hors périmètre branche |-| #137 / #138 | Workflow Discord ponctuel (ajouté puis retiré) | sans objet |-| #126 | Checklist de validation RC end-to-end (docs) | à reprendre au moment de stabiliser |-| #142 | Packaging Microsoft Store (MSIX) — `electron-builder.json5` + script `build:win:store` | à prendre **au moment de la release**, pas maintenant |--## B. Bugs du recorder natif — code partagé, **absents d'ai-edition**--Ces quatre correctifs touchent du code que les deux branches partagent presque à-l'identique. Les bugs sont donc reproductibles tels quels sur ai-edition.--| PR | Bug utilisateur | État dans ai-edition |-| --- | --- | --- |-| #122 | Enregistrer une **fenêtre** (pas l'écran entier) donne une vidéo **entièrement noire** quand ses dimensions client sont impaires (redimensionnement libre, arrondi DPI). H.264 exige des dimensions paires ; `CopyResource` no-op silencieusement sur un écart de taille. | **ABSENT** — `wgc_session.cpp` prend `item_.Size()` verbatim |-| #119 | Sous encodeur **logiciel**, l'arrêt de l'enregistrement peut ne jamais aboutir : `WriteSample` bloquant tenu sous le mutex partagé affame le thread principal qui attend `stopRequested`. | **ABSENT** — pas de `submitVideoSample` |-| #123 | Filet de sécurité pour #119 : l'attente par frame du writer n'a pas de timeout, une notification manquée fige le `join()`. | **ABSENT** — pas de `wait_for(100ms)` dans la boucle frame |-| #91 | **Linux/Wayland** : l'enregistrement d'écran ne produit aucune frame exploitable (`EGL_BAD_MATCH`, renégociation DMA-BUF) parce que Chromium initialise Vulkan, incompatible avec le backend Ozone Wayland. | **ABSENT** — `electron/main.ts` n'a que le switch macOS |--Ces quatre-là sont des **cherry-picks propres** (le seul point délicat est `main.cpp` sur-#119, où ai-edition a sa propre cadence CFR webcam à préserver).--## C. HUD — code partagé, bug présent--| PR | Bug utilisateur | État dans ai-edition |-| --- | --- | --- |-| #125 | Déplacer le HUD par sa poignée : la fenêtre **dérive** au lieu de suivre le curseur au pixel. Deux canaux IPC repositionnent la fenêtre (delta de drag + recalage d'ancre du `ResizeObserver`) et se composent. | **ABSENT** — `LaunchWindow.tsx` a bien `measureHudSize` + `ResizeObserver`, sans le gel pendant le drag |--## D. Éditeur — divergence forte, à traiter fonctionnellement--Ici le correctif de main vit dans l'ancien éditeur (`VideoEditor.tsx`, `TimelineEditor.tsx`,-exporteur navigateur), qui n'est plus le chemin d'exécution d'ai-edition. La question n'est-donc pas « le patch s'applique-t-il » mais « le bug existe-t-il chez nous, et où ».--| PR | Bug utilisateur | État dans ai-edition |-| --- | --- | --- |-| #118 | Les zooms auto-placés se calent sur le curseur au début de la région puis restent figés, au lieu de le suivre sur toute leur durée. | **DÉJÀ COUVERT** — `zoomSuggestions.ts:63` pose `focusMode: "auto"` à la création. *(Reste un manque UX distinct : aucun contrôle ne permet de basculer une région entre `auto` et `manual`.)* |-| #127 (1/2) | Une nouvelle annotation texte naît avec du texte en dur au lieu d'être vide : le placeholder ne s'affiche jamais et la saisie s'ajoute derrière. | **BUG PRÉSENT** — `useTimeline.ts:259` pose `content: "New annotation"` |-| #127 (2/2) | Après Save → Load, la durée du projet est plafonnée à la fin du dernier élément au lieu de la vraie durée d'enregistrement. | modèle document différent — **à vérifier en situation** |-| #120 | Le playhead de la timeline retarde sur la lecture, et le scrub pendant lecture est mou : la position vient d'un `useState` remonté tout en haut de l'arbre, forçant une cascade de rendu à 60 Hz. | architecture différente (preview native). `V4Timeline` reçoit `currentTimeSec` en **prop** et `PlayheadOverlay` est memo — donc le parent re-rend quand même à chaque tick. **À mesurer** avant de conclure |-| #109 | **Le micro est absent de l'export.** Les enregistrements natifs macOS écrivent audio système et micro en **deux pistes AAC séparées** ; l'exporteur n'en décodait qu'une (`av_find_best_stream`), la première, souvent silencieuse. | **BUG PRÉSENT, MAIS AILLEURS.** Le correctif de main est dans l'exporteur navigateur, qui est mort chez nous (l'export passe par `exportMultiNative`). Le même bug vit dans **`poc-d3d/src/audio.rs:177`**, qui appelle exactement `av_find_best_stream(…AVMEDIA_TYPE_AUDIO…)` et ne décode qu'une piste. **À réimplémenter en Rust**, pas à cherry-picker |-------## Ce qui est réutilisable depuis la branche mise de côté--`claude/rebase-ai-edition-main-c65d0d` (PR #154) contient déjà, testés et compilés :--- #122, #119, #123, #91 (bloc B) — dont le merge à la main de `main.cpp` qui préserve la- cadence CFR webcam d'ai-edition ;-- #125 + son test de non-régression (bloc C) ;-- #142 MSIX (bloc A, à différer) ;-- l'annotation vide + placeholder (#127 partie 1, bloc D) ;-- le portage #109 dans l'exporteur navigateur — **sans valeur**, puisque ce chemin est- contourné par l'export natif ; c'est le portage Rust qu'il faut, pas celui-là.--## Manques UX propres à ai-edition (hors main)--Constatés en inspectant l'UI vivante, sans rapport avec la divergence — ce sont des-capacités présentes dans le code mais jamais câblées au shell V4 :--- vitesse plafonnée à 3× (`<select>` de `FloatingInspector`) alors que- `MAX_PLAYBACK_SPEED = 100` existe et que l'UX champ libre vit dans `RightPanelStack`,- qui n'est plus monté ;-- pas de bascule `focusMode` auto/manuel sur une région de zoom ;-- pas de preset de rotation de zoom ;-- pas de zoom réactif webcam ;-- seules les annotations **texte** sont créables (image / figure / flou sont rendues par le- compositeur mais inatteignables) ;-- `preferSoftwareEncoder` est lu au démarrage de l'enregistrement, aucune UI ne le règle ;-- le moteur D3D n'a **aucun repli logiciel** (`D3D_DRIVER_TYPE_HARDWARE` seul, `bail!` si le- feature level n'est pas 11_1) — échec sec sur machine sans GPU compatible.diff --git a/technical-documentation/_harvest/openscreen-inventory.md b/technical-documentation/_harvest/openscreen-inventory.mddeleted file mode 100644index cc1db3e30..000000000--- a/technical-documentation/_harvest/openscreen-inventory.md+++ /dev/null@@ -1,713 +0,0 @@-# OpenScreen Inventory — Merge with Axcut--> Catalog of the OpenScreen codebase at `G:\repos\openscreen\.worktrees\wt-9ce78f24\` as it stands for the AI-edition merge. Path notation is `path:line` relative to the repo root. All file paths are absolute under that worktree.-------## 1. Recorder pipeline (full lifecycle)--### Window graph-There is **one renderer entry point** (`src/App.tsx:11`) that lazy-loads the window component by `?windowType=…` query param. Four window types are produced:--- `hud-overlay` → `LaunchWindow.tsx:92` (frameless transparent HUD with the record/stop buttons). Created by `electron/windows.ts:87` `createHudOverlayWindow`.-- `source-selector` → `SourceSelector.tsx:16`. Created by `electron/windows.ts:231` `createSourceSelectorWindow`.-- `countdown-overlay` → `CountdownOverlay.tsx`. Created by `electron/windows.ts:275` `createCountdownOverlayWindow`.-- `editor` → `VideoEditor.tsx` (lazy). Created by `electron/windows.ts:168` `createEditorWindow`.--`electron/main.ts:50` sets `RECORDINGS_DIR = path.join(app.getPath("userData"), "recordings")` — this is the canonical on-disk home for media.--### LaunchWindow → SourceSelector flow-- The HUD always opens first (`electron/main.ts:588` `createWindow()` → `createHudOverlayWindow()`).-- When the user clicks the "screen / window" pick, `LaunchWindow.tsx` calls `openSourceSelectorWithPermissionRetry(...)` (defined in `src/components/launch/openSourceSelectorFlow.ts:32`), which calls `window.electronAPI.openSourceSelector()` and, on macOS, retries up to 8× while a `not-determined` Screen Recording permission resolves.-- The main process opens `createSourceSelectorWindow()` (`electron/ipc/handlers.ts:1423`) and the renderer renders `SourceSelector.tsx`. `getSources` (`electron/ipc/handlers.ts:1307`) drives the picker via `desktopCapturer.getSources(...)`. Picking calls `selectSource` IPC (`electron/ipc/handlers.ts:1319`) which closes the selector.--### Source selected → record-- `useScreenRecorder.ts:1527` `toggleRecording()` calls `startRecordCountdown()` (`useScreenRecorder.ts:1040`) which opens the `CountdownOverlay` (`useScreenRecorder.ts:1090`) for a 3-2-1, then routes to one of three branches:- - Windows + native helper available → `startNativeWindowsRecordingIfAvailable` (`useScreenRecorder.ts:781`).- - macOS + native helper available → `startNativeMacRecording` (`useScreenRecorder.ts:912`, payload at `:963` with `schemaVersion: 1`).- - Otherwise → browser `getDisplayMedia` + `MediaRecorder` for screen and webcam (`useScreenRecorder.ts:1163+`).-- The recorder uses a wrapper around `MediaRecorder` defined at `src/hooks/recorderHandle.ts:31` `createRecorderHandle`. With `fileName`, MediaRecorder chunks are streamed to disk via IPC (see §5) so a long recording never buffers the whole video in the renderer.-- Pause/resume restart splits (`useScreenRecorder.ts:1541` `restartRecording`) maintain `accumulatedDurationMs` and `segmentStartedAt` refs (`useScreenRecorder.ts` lines ~22-31) so total duration survives pause gaps.--### Stop → save → switch to editor-- `useScreenRecorder.ts:621` `stopRecording` (held in a ref) branches by transport:- - **Browser / streaming finalize** — `finalizeRecording` (`:337`): calls `fixWebmDuration` (`@fix-webm-duration/fix`), then `window.electronAPI.storeRecordedSession(...)` (`:369`) with `{ screen: { videoData, fileName }, webcam?: ..., createdAt: recordingId, cursorCaptureMode, durationMs }`. On success calls `setCurrentRecordingSession` (`:391`) then `switchToEditor()` (`:396`).- - **Native Windows** — `finalizeNativeWindowsRecording` (`:422`): calls `stopNativeWindowsRecording(discard)` and may then call `storeRecordedSession` to merge the webcam blob, then `setCurrentRecordingSession` and `switchToEditor()` (`:503`).- - **Native macOS** — `finalizeNativeMacRecording` (`:522`): calls `stopNativeMacRecording(discard)` then `attachNativeMacWebcamRecording` (`:582`) to bind the webcam into the session, then `setCurrentRecordingSession` and `switchToEditor()` (`:603`).-- The IPC handler `store-recorded-session` lives at `electron/ipc/handlers.ts:2207` → `storeRecordedSessionFiles` (`:2220`):- - Resolves final paths via `resolveRecordingOutputPath` (`:270`) → `path.join(RECORDINGS_DIR, parsedPath.base)`.- - For each track it calls `finalizeRecordingFile` which either finalizes the open stream or writes the buffer (see §5).- - Patches the WebM `Duration` header on disk when `durationMs` is finite (`:2251-2257`, `electron/recording/webm-duration.ts`).- - Builds `RecordingSession` (`{ screenVideoPath, webcamVideoPath?, createdAt, cursorCaptureMode? }`) and stores it via `setCurrentRecordingSessionState` (`:1183`).- - Writes a JSON manifest `<screenFileName>.session.json` next to the WebM (`:2273-2277`).- - Calls `writePendingCursorTelemetry` (`:2271`) to persist any pending cursor telemetry.-- `setCurrentRecordingSession` and `setCurrentVideoPath` are also exposed individually (`electron/ipc/handlers.ts:2784`, `:2780`).--### What does the editor do with this state?-- On open, `VideoEditor.tsx:540` `loadInitialData` first tries `nativeBridgeClient.project.loadCurrentProjectFile()` (loads the `.openscreen` project file from its last-known path), then falls back to `window.electronAPI.getCurrentRecordingSession()` (`:554`), then `nativeBridgeClient.project.getCurrentVideoPath()` (`:582`). The three are ordered: explicit saved project → just-recorded session → just-recorded single video.-- The recorded files live at `RECORDINGS_DIR/recording-<timestamp>[ -webcam].{webm,mp4}` depending on platform (`electron/ipc/handlers.ts:49` `RECORDING_FILE_PREFIX`, `:1572` for native Windows output naming).--### Where the recording file path lives-- After stop, the canonical paths are:- - **Last successful recording's screen path** → `app.getPath('userData')/recordings/recording-<id>.webm` (or `.mp4` for native captures).- - **Main-process session state** → `currentRecordingSession: RecordingSession | null` (`electron/ipc/handlers.ts:358`) and `currentVideoPath: string | null` (`:364`) and `currentProjectPath: string | null` (`:357`).- - **Renderer "current" view** → mirror via `nativeBridgeClient.project.getCurrentContext()` (`src/native/client.ts:71`) plus the same value fetched through `window.electronAPI.getCurrentRecordingSession()` / `getCurrentVideoPath()`.--### Multiple sequential recordings — what happens today-- **They overwrite the renderer's "current" pointer**, but not the files on disk. Each `stopRecording` calls `setCurrentRecordingSession` / `setCurrentVideoPath` which replaces `currentRecordingSession` / `currentVideoPath` in main (`electron/ipc/handlers.ts:1183`, `:2780`). The editor's `loadInitialData` always reads *the last* one.-- Files keep accumulating in `RECORDINGS_DIR` because file names include a unique `recordingId` (timestamp). There is **no in-app UI to list, append, or manage multiple takes** — `electron/ipc/handlers.ts:2303` `getRecordedVideoPath` does scan the dir to find the latest, but that is only used when no session pointer exists.-- There is **no prompt** before the editor opens, and **no notion of "stay in recorder after Stop"**. Stop → save → `switchToEditor()` is the wired path (all three transports call it). `LaunchWindow.tsx:1008-1018` exposes a single "Open studio" Clapperboard button that also calls `switchToEditor()` manually.-- **Restart** (`useScreenRecorder.ts:1541`) discards the in-progress recording and starts a new one with a fresh `recordingId` — same overwrite-on-stop semantics apply.--### `recordingSession.ts` (`src/lib/recordingSession.ts`, 85 lines)-Pure type module — no runtime behavior. Defines:--- `ProjectMedia { screenVideoPath, webcamVideoPath?, cursorCaptureMode? }` (`recordingSession.ts:1`).-- `CursorCaptureMode = "editable-overlay" | "system"` (`:7`).-- `RecordingSession extends ProjectMedia { createdAt: number }` (`:9`).-- `RecordedVideoAssetInput { fileName: string, videoData: ArrayBuffer }` (`:13`).-- `StoreRecordedSessionInput` — payload from renderer for `store-recorded-session`, includes `durationMs?: number` (`:18`).-- `normalizeProjectMedia`, `normalizeCursorCaptureMode`, `normalizeRecordingSession` — tolerant guards used on every load to drop malformed fields.--### `media-stream.ts`-**There is no `media-stream.ts` file.** The closest is `src/hooks/useScreenRecorder.ts` (1686 lines) which manages screen + webcam MediaStreams; `src/hooks/recorderHandle.ts` wraps `MediaRecorder`. `src/lib/compositeLayout.ts` describes webcam layout math.-------## 2. Exporter pipeline (full chain)--The exporter pipeline is purely in-browser / in-renderer. The main process only owns the source `MediaRecorder` / native capture and writes the resulting files to disk; once the file is on disk, the renderer reads it (`window.electronAPI.readBinaryFile` via `electron/ipc/handlers.ts:2523`) and feeds it into the exporter.--### Entry points-- `src/lib/exporter/videoExporter.ts` `VideoExporter` class (`:170`) — MP4 / H.264.-- `src/lib/exporter/gifExporter.ts` `GifExporter` class (`:117`) — GIF via `gif.js` worker.-- `src/lib/exporter/index.ts` — barrel re-exporting both.-- Called from `VideoEditor.tsx:1927` (gifExporter) and `VideoEditor.tsx:1979` (VideoExporter).--### Chain (MP4)-1. `VideoExporter.export()` → `exportWithEncoderPreference(prefer-hardware)` (`videoExporter.ts:228`):- - Loads source metadata via `StreamingVideoDecoder.loadMetadata(videoUrl)` (`:248`).- - Tries a **source-copy fast path** (`:684` `trySourceCopyFastPath`) — if the source is an MP4 and no trim/zoom/annotation/etc. edits are active, returns the source blob verbatim. Disabled when crop, padding, border radius, shadow, blur, motion blur, webcam overlay, or any time regions are present (`getSourceCopyFastPathBlockers`, `:126-155`).- - Optionally loads webcam metadata (`:255`).-2. `FrameRenderer` (`frameRenderer.ts:135`) is built with `wallpaper, zoomRegions, showShadow, shadowIntensity, showBlur, motionBlurAmount, borderRadius, padding, cropRegion, cursorRecordingData, cursorScale, …, webcamSize, webcamLayoutPreset, …, annotationRegions, speedRegions, …, cursorTelemetry, cursorClickTimestamps, platform` (`:261-296`). `await renderer.initialize()` creates the Pixi.js `Application`, two canvases (`composite`, `foreground`) plus a `raster` canvas for the Linux read-back path (`:182-279`).-3. `VideoEncoder` (WebCodecs) is configured (`:521` `initializeEncoder`):- - Codec default `avc1.640033` (`:589`), `latencyMode: "quality"`, `bitrateMode: "variable"`.- - On Windows it tries `["prefer-software", "prefer-hardware"]`; everywhere else `["prefer-hardware", "prefer-software"]` (`:677-682`).- - `maxEncodeQueue = 120` (or `32` for software) (`:181`, `:324-327`).-4. `VideoMuxer` (`muxer.ts:13`) wraps `mediabunny`:- - `Mp4OutputFormat({ fastStart: "in-memory" })` (`:32`).- - `EncodedVideoPacketSource("avc")` (`:39`).- - Optional `EncodedAudioPacketSource("aac" | "opus")` chosen at runtime via `AudioProcessor.selectSupportedExportCodecForSource` (`:304`).-5. `streamingDecoder.decodeAll(...)` (`:365`) iterates source frames at the requested `frameRate` honoring `trimRegions` and `speedRegions`. Per frame:- - Render to Pixi via `renderer.renderFrame(videoFrame, sourceTimestampUs, webcamFrame)` (`:389`).- - For Linux, force a `getImageData` CPU readback (`:397-412`); otherwise `new VideoFrame(canvas, …)` (`:414`).- - Throttle via `waitForEncoderQueueSpace` (`:30`) with a 15s stall timer.- - `encoder.encode(exportFrame, { keyFrame: frameIndex % 150 === 0 })` (`:431`).- - Webcam frames flow through `TimestampedVideoFrameQueue` (`timestampedVideoFrameQueue.ts`, 75 lines) — webcam decoder runs in parallel (`:330-363`).-6. Encoder output callback (`:528-586`) pushes each chunk into the muxer (`muxer.addVideoChunk`, `:52`) with the first chunk carrying `decoderConfig.description` / `colorSpace`.-7. After decode finishes, encoder is flushed with a 20s timeout (`:469`), then audio is processed via `AudioProcessor.process(...)` (`:497`).-8. `muxer.finalize()` → `Blob({ type: "video/mp4" })` (`:509`, `muxer.ts:72`).--### Compositor layer order (inside `FrameRenderer.renderFrame` at `frameRenderer.ts:374`)-1. Background wallpaper (`compositeCanvas`) — color / linear gradient / image, loaded in `setupBackground` (`:281-372`); blurred with `filter: blur(6px)` when `showBlur` is on (`:978-984`).-2. Pixi.js video stage with zoom camera (`cameraContainer` → `videoContainer`) — sprites the decoded `VideoFrame`, applies zoom (with spring smoothing, see `videoPlayback/zoomSpring.ts`), motion blur, blur filter, mask `roundRect` matching `compositeLayout.screenRect` (`:672-767`). When `Rotation3D` is non-identity, `threeDPass` (`threeDPass.ts`) projects the foreground canvas.-3. Webcam composite (`compositeWithShadows`, `:950`) — drawn into `foregroundCanvas` with mask shape (`rectangle`/`circle`/`square`/`rounded`), shadow from preset, mirroring, reactive scale anchored to a docked corner.-4. Native cursor overlay (`drawNativeCursor`, `:546`) — placed using `getSmoothedCursorPath` (`lib/cursor/cursorPathSmoothing.ts`) for the position and the native cursor sprite from `CursorRecordingData`; motion blur / click bounce / clip-to-bounds applied.-5. Editable cursor from cursor telemetry — same pipeline, reads `config.cursorRecordingData`.-6. Annotations — `renderAnnotations(foregroundCtx, …)` (`annotationRenderer.ts`) draws text / image / figure / blur regions (`frameRenderer.ts:462`).-7. Drop shadow — baked on the flat path (`compositeWithShadows`), re-applied after rotation on the 3D path (`:492-522`).-8. Final readback from `compositeCanvas` (`getCanvas`, `:1100`).--### Output format pipeline-- **MP4** — `mediabunny` (vendor `mediabunny: ^1.40.1`). Fast-start in-memory.-- **GIF** — `gif.js: ^0.2.0` via web worker `gif.js/dist/gif.worker.js` (`gifExporter.ts:25`). `GifExporter` (`:117`) loops `StreamingVideoDecoder.decodeAll` → `FrameRenderer.renderFrame` → `gif.addFrame(canvas, { delay, copy: true })`. GIF is the only non-medibunny exporter.--### Encoder settings-- Default codec `avc1.640033` (High Profile Level 5.1) — `videoExporter.ts:589`.-- Bitrate/width/height computed in `mp4ExportSettings.ts` `calculateMp4ExportSettings`:- - Quality `medium` → short side 720 px → 10 Mbps (`:106`).- - Quality `good` → short side 1080 px → 20 Mbps (`:107`).- - Quality `source` → match source dims → 30/50/80 Mbps depending on pixel count (`:101-104`).- - Width/height always even (`:17-23`).-- Frame rate passed in via `ExportConfig.frameRate` (set by `VideoEditor.tsx:1979` from `calculateMp4ExportSettings`).-- Aspect ratio is preserved via `calculateSourceDimensions` / `calculateDimensionsForShortSide` (`mp4ExportSettings.ts:39-95`).-- Audio: `AudioProcessor.selectSupportedExportCodecForSource(demuxer)` returns AAC by default, Opus as fallback (`audioEncoder.ts`).--### Exporter tests-- `videoExporter.test.ts` (vitest, jsdom) — unit tests around `isSourceCopyFastPathEligible` / `getSourceCopyFastPathBlockers`.-- `videoExporter.browser.test.ts` — Playwright headless; runs real `VideoExporter` on a fixture WebM.-- `frameRenderer.test.ts` — Pixi-free render logic tests.-- `mp4ExportSettings.test.ts` — bitrate / dimension math.-- `gradientParser.test.ts` — CSS gradient parser used by the wallpaper path.-- `audioEncoder.test.ts` — audio processor units.-- `streamingDecoder.test.ts` — duration validation (`validateDuration`, `shouldFailDecodeEndedEarly`).-- `timestampedVideoFrameQueue.test.ts` — webcam frame queue.-- `gifExporter.test.ts` / `gifExporter.browser.test.ts` — same split for GIF.-- E2E: `tests/e2e/gif-export.spec.ts` (158 lines) launches Electron, loads `tests/fixtures/sample.webm`, exports, and asserts file size > 0.-------## 3. Project state (current SSOT)--### `src/components/video-editor/types.ts` (433 lines) — every type the editor reads/writes-- `WebcamLayoutPreset` re-exported from `lib/compositeLayout` (`types.ts:1-5`).-- `ZoomDepth = 1|2|3|4|5|6`, `ZoomFocusMode = "manual"|"auto"` (`:3-4`).-- `WebcamSizePreset = number` (10–50, percent of canvas ref dim).-- `WebcamMaskShape = "rectangle"|"circle"|"square"|"rounded"` (`:13`).-- `WebcamPosition { cx, cy }` normalized 0-1 (`:22`).-- `ZoomRegion { id, startMs, endMs, depth, focus: ZoomFocus, focusMode?, rotationPreset?, customScale?, source?: "auto"|"manual" }` (`:71`).-- `Rotation3D { rotationX, rotationY, rotationZ }` + presets `iso/left/right` + `computeRotation3DContainScale` math (`:34-176`).-- `CursorTelemetryPoint { timeMs, cx, cy, interactionType?, cursorType? }` (`:178`).-- `CursorVisualSettings { size, smoothing, motionBlur, clickBounce, clipToBounds }` + defaults (`:195-208`).-- `TrimRegion { id, startMs, endMs }` (`:211`).-- `AnnotationType = "text"|"image"|"figure"|"blur"` + `ArrowDirection`, `FigureData` (`:217-233`).-- `BlurShape`, `BlurType`, `BlurColor`, `BlurData`, `MIN_BLUR_INTENSITY/MAX_BLUR_INTENSITY`, etc. (`:235-254`).-- `AnnotationPosition`, `AnnotationSize`, `AnnotationTextStyle`, `AnnotationTextAnimation`, `AnnotationRegion { id, startMs, endMs, type, content, textContent?, imageContent?, position, size, style, zIndex, annotationSource?: "auto-caption", figureData?, blurData? }` (`:256-303`).-- `DEFAULT_ANNOTATION_POSITION`, `DEFAULT_ANNOTATION_SIZE`, `DEFAULT_ANNOTATION_STYLE`, `DEFAULT_FIGURE_DATA`, `DEFAULT_BLUR_FREEHAND_POINTS`, `DEFAULT_BLUR_DATA` (`:305-352`).-- `CropRegion { x, y, width, height }` normalized 0-1 (`DEFAULT_CROP_REGION = {0,0,1,1}` at `:354-366`).-- `PlaybackSpeed = number` (MIN 0.1, MAX 16), `SpeedRegion { id, startMs, endMs, speed }`, `SPEED_OPTIONS` (`:368-396`).-- `ZOOM_DEPTH_SCALES: Record<ZoomDepth, number>` (1.25x → 5.0x at `:400-407`), `MIN_ZOOM_SCALE/MAX_ZOOM_SCALE` (`:409-410`), `getZoomScale(region)` (`:415-421`).--### `src/components/video-editor/editorDefaults.ts` (99 lines)-- `DEFAULT_SOURCE_DIMENSIONS = { width: 1920, height: 1080 }` (`:23`).-- `DEFAULT_GIF_OUTPUT_DIMENSIONS = { width: 1280, height: 720 }` (`:28`).-- `DEFAULT_EDITOR_APPEARANCE_SETTINGS { shadowIntensity: 0, showBlur: false, motionBlurAmount: 0, borderRadius: 0, showTrimWaveform: true }` (`:33`).-- `DEFAULT_EDITOR_LAYOUT_SETTINGS { padding: 50, aspectRatio: "16:9", cropRegion: {0,0,1,1}, wallpaper: DEFAULT_WALLPAPER }` (`:47`).-- `DEFAULT_WEBCAM_SETTINGS { layoutPreset: "picture-in-picture", maskShape: "rectangle", sizePreset: 25, position: null }` (`:59`).-- `DEFAULT_CURSOR_SETTINGS { show: true, size: 3.0, smoothing: 0.67, motionBlur: 0.35, clickBounce: 2.5, clipToBounds: false, theme: DEFAULT_CURSOR_THEME_ID }` (`:71`).-- `DEFAULT_EXPORT_SETTINGS { quality: "good", format: "mp4" }` (`:81`).-- `DEFAULT_GIF_SETTINGS { frameRate: 15, loop: true, sizePreset: "medium", outputDimensions: 1280x720 }` (`:89`).--### `src/components/video-editor/projectPersistence.ts` (561 lines)-- Defines `ProjectEditorState` (`:67`) with 27 fields including `wallpaper`, `shadowIntensity`, `showBlur`, `motionBlurAmount`, `borderRadius`, `padding`, `cropRegion`, `zoomRegions[]`, `autoZoomEnabled`, `autoFocusAll`, `trimRegions[]`, `speedRegions[]`, `annotationRegions[]`, `aspectRatio`, `webcamLayoutPreset`, `webcamMaskShape`, `webcamMirrored`, `webcamReactiveZoom`, `webcamSizePreset`, `webcamPosition`, `exportQuality`, `exportFormat`, `gifFrameRate`, `gifLoop`, `gifSizePreset`, `cursorTheme`.-- `EditorProjectData { version: number, media?: ProjectMedia, editor: ProjectEditorState, videoPath?: string }` (`:97`).-- `PROJECT_VERSION = 2` (`:65`).-- `createProjectData(media, editor)` (`:536`) → the v2 envelope written to disk.-- `normalizeProjectEditor(editor)` (`:220`) — clamps every field, normalizes wallpaper file URLs (`LEGACY_FILE_WALLPAPER_RE` at `:54`), infers `motionBlurAmount` from legacy `motionBlurEnabled`, etc.-- `toFileUrl(filePath)` / `fromFileUrl(fileUrl)` (`:148` / `:162`) — platform-correct `file://` URL conversion (Windows drive handling).-- `deriveNextId(prefix, ids)` (`:186`) — pure numeric id suffix generator.-- `validateProjectData(candidate)` (`:196`) — required for load.-- `resolveProjectMedia(candidate)` (`:205`) — accepts both the modern `media` envelope and the legacy `videoPath` string.-- `createProjectSnapshot`, `hasProjectUnsavedChanges` (`:547`, `:554`) — JSON-string comparison.--### On-disk format-- File extension `.openscreen` (`PROJECT_FILE_EXTENSION = "openscreen"`, `electron/ipc/handlers.ts:46`).-- JSON: `{ version: 2, media: { screenVideoPath, webcamVideoPath?, cursorCaptureMode? }, editor: ProjectEditorState }`.-- Saved via main-process dialog → `RECORDINGS_DIR` default, but the user can pick anywhere (the path is then remembered as `currentProjectPath`).-- Path validation: `isTrustedProjectPath` (`electron/ipc/handlers.ts:391`) — the renderer can rewrite into the same file path without the save dialog; otherwise dialog appears.-- `loadProjectFileFromPath` (`electron/ipc/handlers.ts:2712`) supports deep-loading a specific `.openscreen` path. A `.session.json` sidecar holds the matching `RecordingSession` (`:1190-1235`).--### IPC contract for save / load-- `native-bridge:invoke` (single channel, typed envelope) hosts the project's save/load RPCs (`src/native/contracts.ts:130-200`):- - `project.saveProjectFile(payload: { projectData, suggestedName?, existingProjectPath? })` → `ProjectFileResult`.- - `project.loadProjectFile(payload?: { projectFolder? })` → `ProjectFileResult`.- - `project.loadCurrentProjectFile()` → re-reads `currentProjectPath`.- - `project.loadProjectFileFromPath(payload: { path })` → `ProjectFileResult`.- - `project.setCurrentVideoPath / getCurrentVideoPath / clearCurrentVideoPath`.- - `project.getCurrentContext` returns `{ currentProjectPath, currentVideoPath }`.-- Legacy aliases still exist on `window.electronAPI` (`electron/preload.ts:182-202`): `saveProjectFile`, `loadProjectFile`, `loadProjectFileFromPath`, `loadCurrentProjectFile`, `setCurrentVideoPath`, `getCurrentVideoPath`, `clearCurrentVideoPath`, `setCurrentRecordingSession`, `getCurrentRecordingSession`. New code is expected to use the bridge (`docs/architecture/native-bridge.md:38`).--### Multiple windows / shared project state-- **Single window at a time carries the editor.** Either the HUD-overlay is open (recording) or the editor window is open (`createEditorWindowWrapper` at `electron/main.ts:385` swaps HUD → editor on first open; `createEditorWindow` runs `win.maximize()`, sets `title: "OpenScreen"`).-- State sharing is via **main-process singletons + bridge calls**:- - `currentProjectPath`, `currentVideoPath`, `currentRecordingSession` live in `electron/ipc/handlers.ts:357-358`, `:364`. Mutated by IPC, read by `getCurrentContext`.- - `NativeBridgeStateStore` (`electron/native-bridge/store.ts:24`) holds `{ system, project, cursor }` snapshots for the renderer.- - The renderer always re-reads on mount (`VideoEditor.tsx:540` `loadInitialData`) — there is **no live pub/sub across windows**. Each window independently fetches its state via `loadCurrentProjectFile` / `getCurrentRecordingSession` / `getCurrentVideoPath`.-------## 4. Timeline--Files: `src/components/video-editor/timeline/` plus `useAudioPeaks`/`BackgroundWaveform`/`KeyframeMarkers` helpers. Backed by the `dnd-timeline` npm library (`package.json:75`).--### Data model-- All times are **milliseconds** as integers (no floating point rounding). `Span = { start: number, end: number }`, `Range = { start: number, end: number }` (`TimelineEditor.tsx:1` imports).-- The timeline owns **5 stacked rows** (`TimelineEditor.tsx:40-44`):- - `ZOOM_ROW_ID = "row-zoom"`- - `TRIM_ROW_ID = "row-trim"`- - `ANNOTATION_ROW_ID = "row-annotation"`- - `BLUR_ROW_ID = "row-blur"` (gated by `BLUR_REGIONS_ENABLED` flag, currently `false` in `featureFlags.ts:1`)- - `SPEED_ROW_ID = "row-speed"`-- Regions on each row are typed `TimelineRenderItem` (`TimelineEditor.tsx:106`) with a per-row `variant`.-- There is also a **keyframe track** (`TimelineEditor.tsx:945`) — opaque time markers stored as `{ id, time }[]`, snap targets during drag/resize. Rendered by `KeyframeMarkers.tsx`.--### Zoom / pan-- `TimelineEditor.tsx:118-153` `calculateAxisScale(visibleRangeMs)` picks an interval (`SCALE_CANDIDATES`) that yields ~12 major markers; ticks subdivide by 5.-- **Pan** is via wheel events without modifier (`TimelineEditor.tsx:707-745` `handleTimelineWheel`); **zoom** is Ctrl/Meta + scroll (`TimelineWrapper.tsx:496-519` `handleRangeChange`).-- Drag-the-playhead past the visible window also pans (`TimelineEditor.tsx:289-372` `PlaybackCursor` `handleMouseMove`).-- `TimelineEditor.tsx:179-184` `createInitialRange(totalMs)` starts at `[0, totalMs]`.-- `TimelineWrapper.tsx:107-131` `clampSpanToBounds` and `:133-161` `clampRange` clamp items + visible range to `[0, totalMs]`.-- `TimelineWrapper.tsx:164-194` `clampToNeighbours` prevents zoom/trim/speed from overlapping.-- `TimelineWrapper.tsx:201-293` `snapSpanToTargets` snaps to region edges, playhead, keyframes, and timeline bounds. Threshold scales with zoom (~1% of visible range, min 50 ms). `:299-311` `inferResizeMode` guesses left vs right resize from pre/post deltas.-- `TimelineWrapper.tsx:39-87` `SnapGuide` paints an amber guide on snap during drag/resize.-- The renderer's spring smoothing (`zoomSpring.ts`) and the preview's transform math (`zoomTransform.ts`) are reused by the exporter so the timeline's camera motion matches what is rendered.--### Trim UX-- Trim is one row in the same DnD lane. The `Item.tsx` template (`:43-184`) renders **left + right end-caps** (`:110-130`, `cursor: "col-resize"`) that act as resize handles. dnd-timeline drives resize from those.-- Two trim regions on the same row **cannot overlap** (`TimelineEditor.tsx:1069-1104` `hasOverlap` enforces it; `clampToNeighbours` re-clamps instead of rejecting when possible).-- Add-trim is via the `Scissors` button (`TimelineEditor.tsx:1515-1523`) or the `addTrim` shortcut (`shortcuts.ts:111` `t`). Default length is `Math.max(1000, totalMs * 0.05)` (`TimelineEditor.tsx:1107`).-- Trim is *also* where the **audio waveform** appears (`BackgroundWaveform.tsx`, peaks from `useAudioPeaks.ts` which spins up `audioPeaksWorker.ts`).--### Zoom / spring / cursor / wallpaper features-- **Spring-smoothed zoom camera**: `zoomSpring.ts` (`createZoomSpringState`, `stepZoomSpring`, `resetZoomSpring`) is consumed by both the preview and the exporter (`frameRenderer.ts:881-898`) so motion is identical in export and preview.-- **Auto-zoom (magic wand)** — `autoZoomEnabled` is editor state (`useEditorHistory.ts:31`). The `WandSparkles` button toggles it (`TimelineEditor.tsx:1489-1501`). When on, `zoomRegionUtils.ts:findDominantRegion` chooses a cursor-follow zoom at run time.-- **Auto-Focus** — `autoFocusAll` (`useEditorHistory.ts:33`), `ScanEye` toggle (`TimelineEditor.tsx:1502-1514`). `cursorFollowUtils.ts:advanceFollowFocus` smooths the focus point.-- **3D rotation** — `zoomRegion.rotationPreset` (`types.ts:46-58`) with three presets (`iso`, `left`, `right`); applied in the exporter's `threeDPass.ts` and as CSS transforms in the preview.-- **Cursor smoothing** — `cursorPathSmoothing.ts` `getSmoothedCursorPath(...)` (used at `frameRenderer.ts:566` and `:569`).-- **Wallpaper** — `wallpaper.ts` `classifyWallpaper` (color / gradient / image) feeds `FrameRenderer.setupBackground` (`frameRenderer.ts:281-372`).-- **Keyframes** — `KeyframeMarkers.tsx`; `addKeyframe` shortcut (`f`, `TimelineEditor.tsx:1245`); add/delete/move wired via `TimelineEditor.tsx:960-982`.--### Multi-video awareness-- **Single video source only.** The timeline holds **time regions** on top of one recording. `useEditorHistory.ts:28-52` shows the `EditorState` has no `assets[]`; there is one `media.screenVideoPath` in `RecordingSession`. `VideoPlayback.tsx` consumes one video at a time. The only thing multiple is the **two tracks of one capture** — the screen and a separate webcam WebM are stacked by the renderer/exporter (see §2 compositor order).-- There is **no notion of multiple clips** in the timeline. Trim regions cut the single source, not a sequence.--### Per-file notes-- `TimelineWrapper.tsx:533-544` returns `TimelineContext` with `autoScroll: { enabled: false }` (horizontal scroll is dnd-timeline-driven).-- `Row.tsx` (34 lines) — single-row lane; `Row` accepts a `background` slot for the waveform overlay and an `isEmpty` hint.-- `Subrow.tsx` (17 lines) — a generic pill-shaped row used by inspector sub-UI; not currently used by the main timeline.-- `Item.module.css` is empty (0 bytes); the timeline Item uses Tailwind + the glass styles in `ItemGlass.module.css` (`zoomEndCap`, `selected`, `glassGreen`, `glassRed`, `glassAmber`, `glassYellow`).-- `TimelineEditor.tsx:1240-1307` — global keydown listener handles all shortcut-bound region adds, Tab cycles overlapping annotations, Delete/Backspace/Ctrl+D removes selected region.-- `BackgroundWaveform.tsx` — audio peaks drawn into the trim row.-------## 5. Native bridge--### IPC architecture-Two layers:--1. **Ad-hoc `ipcMain.handle / ipcRenderer.invoke`** channels exposed via `window.electronAPI.*` in `electron/preload.ts`. There are ~50 channels (full list in §5 below).-2. **Versioned `native-bridge:invoke` channel** (`src/native/contracts.ts:1`) with `{ domain, action, payload, requestId }` envelopes handled in `electron/ipc/nativeBridge.ts` for system, project, and cursor domains. Renderer SDK at `src/native/client.ts` (`nativeBridgeClient`).--The renderer client (Zustand-free) is `nativeBridgeClient.system|project|cursor` (`src/native/client.ts:52`). Documented at `docs/architecture/native-bridge.md`.--### `electron/main.ts` (589 lines)-- `app.commandLine.appendSwitch` for macOS screen-audio + Linux Wayland (`main.ts:35-48`).-- Single instance lock (`main.ts:116-127`) using both `app.requestSingleInstanceLock()` and `acquireStableInstanceLock()` (`electron/singleInstanceLock.ts`).-- Tray + dynamic menu (`main.ts:304-360`). Tray shows "Stop recording" during a recording; "Open" / "Quit" otherwise.-- Application menu items: `New Project (Cmd/Ctrl+N)`, `Load Project… (Cmd/Ctrl+O)`, `Save Project… (Cmd/Ctrl+S)`, `Save Project As… (Cmd/Ctrl+Shift+S)`, plus Edit/View/Window. `sendEditorMenuAction(channel)` (`:133`) targets the focused editor window or creates one.-- `close` handler with unsaved-changes confirmation flow (`main.ts:395-426`):- - Editor sets `editorHasUnsavedChanges = true` via `set-has-unsaved-changes` IPC (`main.ts:366`).- - On close, main asks renderer via `request-close-confirm`; renderer answers with `close-confirm-response = "save" | "discard" | "cancel"`.- - "save" → main sends `request-save-before-close`; renderer writes then sends `save-before-close-done`.- - "discard" → main closes via `setImmediate` + `isForceClosing` flag.--### `electron/preload.ts` (293 lines)-- Reads `--asset-base-url=` from `process.argv` (`:11-13`) and exposes it via `contextBridge.exposeInMainWorld("electronAPI", { assetBaseUrl, ... })` (`:15-16`).-- Exposes `invokeNativeBridge<TData>(request)` (`:17-19`) — the single channel the versioned bridge uses.-- Surface area is enumerated below; every other helper is a thin `ipcRenderer.invoke` wrapper.--### `electron/ipc/nativeBridge.ts` (239 lines)-- Versioned (`NATIVE_BRIDGE_VERSION = 1`) request router for `system`, `project`, `cursor` domains.-- Domain services constructed with closures to main-process state:- - `ProjectService` (`electron/native-bridge/services/projectService.ts:25`).- - `CursorService` (`electron/native-bridge/services/cursorService.ts:14`).- - `SystemService` (`electron/native-bridge/services/systemService.ts`).-- Returns `{ ok: true, data, meta } | { ok: false, error: { code, message, retryable }, meta }` envelopes (`contracts.ts:124-126`).-- Error codes: `INVALID_REQUEST | UNSUPPORTED_ACTION | NOT_FOUND | UNAVAILABLE | INTERNAL_ERROR` (`contracts.ts:93-98`).--### Full IPC channel list (from `electron/ipc/handlers.ts` grep + `electron/preload.ts`)-- **HUD / window controls** (`windows.ts`, `main.ts`):- - `hud-overlay-hide`, `hud-overlay-close`, `hud-overlay-ignore-mouse-events`, `hud-overlay-drag-start`, `hud-overlay-drag-to`, `hud-overlay-drag-end`, `hud-overlay-set-size` (one-way `ipcMain.on`).- - `menu-new-project`, `menu-load-project`, `menu-save-project`, `menu-save-project-as`, `menu-import-video` (`preload.ts:202-225`, renderer listeners via `onMenu*`).- - `hud:setMicrophoneExpanded` (one-way).- - `set-has-unsaved-changes` (one-way).- - `request-save-before-close`, `request-close-confirm` (renderer listeners); `save-before-close-done`, `close-confirm-response` (one-way back).-- **Window orchestration** (`handlers.ts:1423-1488`):- - `get-sources(opts)` → `desktopCapturer.getSources`.- - `select-source(source)`, `get-selected-source`.- - `request-camera-access`, `request-screen-access`, `request-native-mac-cursor-access`.- - `open-source-selector`, `switch-to-editor`, `switch-to-hud`, `start-new-recording`.- - `countdown-overlay-show`, `countdown-overlay-set-value`, `countdown-overlay-hide`, `countdown-overlay-value` (event).-- **Native capture** (`handlers.ts:1520-2192`):- - `is-native-windows-capture-available`, `is-native-mac-capture-available`.- - `start-native-windows-recording(request)`, `pause-native-windows-recording`, `resume-native-windows-recording`, `stop-native-windows-recording(discard?)`.- - `start-native-mac-recording(request)`, `pause-native-mac-recording`, `resume-native-mac-recording`, `stop-native-mac-recording(discard?)`.- - `attach-native-mac-webcam-recording(payload)` (`:2141`).-- **Recording storage** (`handlers.ts:2207-2360`):- - `store-recorded-session(payload)`, `store-recorded-video(data, fileName)`.- - `open-recording-stream(fileName)`, `append-recording-chunk(fileName, chunk)`, `close-recording-stream(fileName)` (via `recordingStream.ts:95` `registerRecordingStreamHandlers`).- - `get-recorded-video-path` (scans `RECORDINGS_DIR` for the latest webm).- - `get-cursor-telemetry(videoPath?)`, `discard-cursor-telemetry(recordingId)`.- - `set-recording-state(recording, recordingId?, cursorCaptureMode?)`.- - `get-asset-base-path`.-- **Project / export** (`handlers.ts:2368-2862`):- - `open-external-url`.- - `pick-export-save-path(fileName, exportFolder?)`, `write-export-to-path(data, filePath)`.- - `open-video-file-picker`.- - `reveal-in-folder`.- - `read-binary-file(filePath)`, `prepare-preview-audio-track(filePath)`.- - `set-current-video-path`, `set-current-recording-session`, `get-current-video-path`, `get-current-recording-session`, `clear-current-video-path`.- - `save-project-file`, `load-project-file`, `load-project-file-from-path`, `load-current-project-file`.- - `get-platform`, `get-shortcuts`, `save-shortcuts`, `save-diagnostic`.-- **Stop-from-tray** (`handlers.ts:339-341`, `preload.ts:145-148`): main → renderer `stop-recording-from-tray` event.-- **Versioned bridge** (`nativeBridge.ts:124`): single channel `native-bridge:invoke` for system/project/cursor domains above.--### `assetBaseUrl` and file:// access-- `windows.ts:14-17` builds `ASSET_BASE_DIR` (process.resourcesPath in packaged, `public/` in dev) and passes `--asset-base-url=file:///…/` via `webPreferences.additionalArguments`.-- Preload reads it from `process.argv` (`preload.ts:11-13`) and exposes it on `electronAPI.assetBaseUrl`.-- Renderer uses `window.electronAPI.assetBaseUrl` directly:- - `src/lib/wallpaper.ts` `resolveImageWallpaperUrl(path)` (`:73` and `:204-230` tests).- - `src/lib/captioning/transcribe.ts:93-94` and `src/lib/captioning/transcribe.worker.ts:48-65` — sets `env.localModelPath = "<assetBaseUrl>/caption-assets/models/"` and `env.backends.onnx.wasm.wasmPaths = "<assetBaseUrl>/caption-assets/ort/"` so transformers.js doesn't try to fetch from the HuggingFace CDN under `file://`.-- **Security boundary:** the renderer can only read paths the main process has explicitly approved. `electron/ipc/handlers.ts:66` `approvedPaths` set; `readBinaryFile` (`handlers.ts:2523`) checks `isPathAllowed` against `RECORDINGS_DIR` and the approved set; `get-asset-base-path` (`handlers.ts:2368`) exposes the packaged resources dir (read-only).--### Screen / audio / webcam capture-- **Screen**: macOS uses `ScreenCaptureKit` via the `OpenScreenScreenCaptureKitHelper` Swift CLI (`electron/native/screencapturekit/Sources/OpenScreenScreenCaptureKitHelper/main.swift`), Windows uses the WGC CLI (`electron/native/wgc-capture/src/main.cpp`), Linux falls back to browser `getDisplayMedia`. The main process spawns the native CLI as a child process and parses NDJSON output (`:1067-1140` for WGC; `:1727-1869` for SCK). The renderer selects the path via `useScreenRecorder.ts:781` / `:912`.-- **System audio** (macOS): requested via `app.commandLine.appendSwitch("disable-features", "MacCatapLoopbackAudioForScreenShare")` (`main.ts:36`) — uses ScreenCaptureKit audio instead of CoreAudio tap (avoids `NSAudioCaptureUsageDescription`).-- **Microphone audio**: captured by the browser `MediaRecorder` via `getUserMedia({ audio: { deviceId } })` and appended to the screen WebM in `useScreenRecorder.ts:242`.-- **Webcam**: browser `getUserMedia({ video: { deviceId } })` for browser-capture path; native helper uses DirectShow (`dshow_webcam_capture.cpp`). On macOS, webcam is a separate `.mp4` file attached to the session via `attach-native-mac-webcam-recording` (`handlers.ts:2141`). On Windows it can be muxed in directly by the native CLI.-- **Cursor capture**: `useScreenRecorder.ts` offers `cursorCaptureMode = "editable-overlay" | "system"` (`recordingSession.ts:7`). `system` hides the OS cursor and overlays the recorded telemetry; `editable-overlay` keeps the OS cursor visible during recording and overlays the recorded cursor in the editor. `CursorService` (`:14`) reads back from the cursor telemetry file (v2 format, JSON) that the native CLIs write next to the WebM.--### `recordingStream.ts` (`electron/ipc/recordingStream.ts`, 139 lines)-- `RecordingStreamRegistry` (`:11`) — owns open `WriteStream`s keyed by output file name. Methods:- - `open(fileName, filePath)` (`:19`) — `createWriteStream({ flags: "w" })`, awaits `open` event for fail-fast.- - `append(fileName, chunk)` (`:45`) — serializes writes so chunks land in arrival order and `close` waits for in-flight writes.- - `finalize(fileName)` (`:59`) — `ws.end(...)` and remove; returns `true` if the stream was open (so the caller knows the file is already on disk).- - `discard(fileName, filePath)` (`:75`) — close + `unlink` partial file.-- IPC handlers at `:95` translate the throw-on-failure contract to `{ success, error? }` so renderer callers can fallback to in-memory buffering.--### `globalShortcut.ts` (77 lines)-- Maps `ShortcutBinding` (`src/lib/shortcuts.ts:15`) to Electron `globalShortcut.register(accelerator, callback)` (`:41` `registerOpenAppShortcut`).-- Default binding `Ctrl/Cmd+Shift+O` (`globalShortcut.ts:6`).-- Reads user prefs from `SHORTCUTS_FILE = userData/shortcuts.json` (`globalShortcut.ts:66`) via `loadAndRegisterGlobalShortcut`.-- Only the `openApp` binding is exposed as a global shortcut. All other editor shortcuts are renderer-side via `ShortcutsContext`.--### `windows.ts` (322 lines) — full window list-- `createHudOverlayWindow()` (`:87`) — frameless transparent 600×160 always-on-top, bottom-centred. Reads `--asset-base-url=` from main.-- `createEditorWindow()` (`:168`) — maximized, `hiddenInset` traffic lights on macOS, `webSecurity: false` (relaxed for `file://` access).-- `createSourceSelectorWindow()` (`:231`) — frameless transparent 620×420, always-on-top.-- `createCountdownOverlayWindow()` (`:275`) — fixed 420×260, focusable: false, transparent.-- Coordination: only one `mainWindow` reference exists at a time (`main.ts:83`). On launch the HUD opens; clicking "Open studio" or stopping a recording swaps the HUD for the editor window (`createEditorWindowWrapper` at `main.ts:385`).-- All four windows share the same renderer build and preload (`preload.mjs`) but pick a top-level component by `?windowType=` (see §1).-------## 6. Captioning pipeline--All under `src/lib/captioning/`. The renderer can transcribe a video's audio in-browser using Whisper via transformers.js, then convert the word/phrase timings into `AnnotationRegion`s.--### Files-- `transcribe.ts` (105 lines) — public entry point, thin IPC adapter.-- `extractMono16k.ts` (159 lines) — `extractMono16kFromVideoUrl`.-- `extractMono16kWebDemuxer.ts` (162 lines) — fallback that uses `web-demuxer` + `AudioDecoder`.-- `annotationsFromCaptions.ts` (604 lines) — turns `CaptionSegment[]` into `AnnotationRegion[]`.-- `captionConstants.ts` — `MAX_CAPTION_AUDIO_SEC`.-- `index.ts` — barrel.-- `annotationsFromCaptions.test.ts` — unit tests.--### How Whisper runs today-`transcribeMono16kToSegments(samples, options)` (`transcribe.ts:44`):-1. Spawns a module `Worker` from `transcribe.worker.ts` (`:57`).-2. Posts `{ samples, trimRegions, useLocalModels, assetBaseUrl }` (`TranscribeWorkerRequest`, `:18`).-3. Worker (`transcribe.worker.ts:76`):- - Calls `loadTranscriber({ useLocalModels, assetBaseUrl })` (`:46`).- - Uses `pipeline("automatic-speech-recognition", "Xenova/whisper-tiny")` from `@xenova/transformers`.- - With `useLocalModels=true` (file:// packaged app): `env.allowLocalModels=true`, `env.allowRemoteModels=false`, `env.localModelPath = "<assetBaseUrl>/caption-assets/models/"`, `env.backends.onnx.wasm.wasmPaths = "<assetBaseUrl>/caption-assets/ort/"`, `numThreads: 1` (no SharedArrayBuffer under file://).- - In dev (http://localhost): `env.allowLocalModels=false`, remote CDN fetch.-4. Posts `status` "model" → "transcribe" → `result` (`CaptionSegment[]`) or `error` (`:33`).-5. `withoutNodeVersion` (`transcribe.worker.ts:25`) strips `process.versions.node` before importing Transformers/ORT so Electron workers don't try `require("fs")`.--`runTranscription` in `transcribeCore.ts:184` orchestrates the actual run:-- Tries `word` timestamps first, falls back to `phrase` if empty.-- For each mode, tries `force_full_sequences: true` then `false`; for each pair, retries with `ignoreTrims: true` and post-filters overlapping segments.-- Long audio is split into 12-minute slices (`TRANSCRIBE_SLICE_SAMPLES = 12 * 60 * 16_000`, `:34`).-- Pads short tail slices to `MIN_TRANSCRIBE_SLICE_SAMPLES = 800` so Whisper doesn't return empty (`padTailSliceForTranscribe`, `:43`).-- Dedupes adjacent segments with identical normalized text (`segmentsFromTranscriberChunks`, `:57`).--### Model files-- **Model**: `Xenova/whisper-tiny` (transformers.js ASR pipeline).-- **Storage**: bundled under `caption-assets/` (the `electron-builder.json5:42-46` `extraResources` rule copies `caption-assets/` into the packaged resources dir).-- **Fetch step**: `scripts/fetch-caption-model.mjs` populates `caption-assets/` pre-build.-- **ORT WASM**: bundled in `caption-assets/ort/`.--### Output shape-- `CaptionSegment { startSec: number, endSec: number, text: string }` (`transcribe.ts:3`).-- `TranscribeMono16kResult { segments: CaptionSegment[], granularity: "word" | "phrase" }` (`transcribe.ts:12`).--### Renderer trigger-- `VideoEditor.tsx:2209-2232` `handleGenerateCaptions()`:- 1. `extractMono16kFromVideoUrl(videoPath, { signal })` (`extractMono16k.ts:110`) — tries `decodeAudioData`, falls back to `extractMonoPcmViaWebDemuxer`.- 2. `transcribeMono16kToSegments(samples, { trimRegions, signal })`.- 3. `captionSegmentsToAnnotationRegions(segments, …)` (`annotationsFromCaptions.ts:544`).--> **Leading-silence handling:** timestamps come back absolute from-> whisper.cpp; its built-in Silero VAD (started on the server with-> `--vad --vad-model ggml-silero-v6.2.0.bin`) splits audio into speech-> regions before the ASR decoder runs and offsets each region's timestamps-> to its position in the original audio. No renderer-side trim + offset-> arithmetic remains. The earlier `trimLeadingSilenceMono16k` and-> `shiftTrimRegionsMsForCaptionBuffer` lived in-> `src/lib/captioning/leadingSilence.ts` until 2026-07 — the peak detector-> had false positives on quiet music intros / room tone, and was deleted-> when VAD shipped.--### Linking to time ranges in the editor-- `annotationsFromCaptions.ts:544` `captionSegmentsToAnnotationRegions` produces `AnnotationRegion[]` with:- - `startMs`/`endMs` computed from `seg.startSec` / `seg.endSec`.- - Position / size / style hard-coded to a lower-third bar: `position: { x: 4, y: 86 }` (`:9-13`), `size: { width: 92, height: 12 }`, `style` = white 24px Inter, `annotationSource: "auto-caption"` (`annotationsFromCaptions.ts:300`, `:574-583`).-- `groupTimedCaptionWordsIntoLines` (`:325`) groups word segments into on-screen lines of `minWords=2, maxWords=7`.-- `groupPhraseCaptionSegmentsIntoLines` (`:436`) does the same for phrase granularity.-- `reconcileAutoCaptionTimelineGaps` (`:148`) enforces a min gap between consecutive auto-caption regions.-- `captionSegmentsToAnnotationRegions` is **idempotent and stateless** — the caller is responsible for `startNumericId` and `startZIndex` and merges the new regions with existing ones. `VideoEditor.tsx` uses `maxAnnotationNumericId` / `maxAnnotationZIndex` (`annotationsFromCaptions.ts:592-603`) to keep ids stable.-- **Trim awareness**: `segmentsFromTranscriberChunks` (`transcribeCore.ts:107`) drops any segment that overlaps a `TrimRegion`, so caption ranges never sit inside a cut.-------## 7. UI primitives--### Radix-based components (`src/components/ui/*`)-All shadcn-style "new-york" presets (`components.json:3`); baseColor `stone`, `tailwind.config.cjs` exposes HSL CSS-variable tokens (`tailwind.config.cjs:41-81`).--| File | Radix package | Notes |-|---|---|---|-| `accordion.tsx` | `@radix-ui/react-accordion` | Forwarded Radix parts. |-| `audio-level-meter.tsx` | (none) | Pure canvas/visual. |-| `button.tsx` | `@radix-ui/react-slot` (for `asChild`) | `class-variance-authority` variants (`:11`). |-| `card.tsx` | (none) | Headless panels. |-| `color-picker.tsx` | `@uiw/react-color-*` | 3rd-party UIW. |-| `content-clamp.tsx` | (none) | Text overflow utility. |-| `dialog.tsx` | `@radix-ui/react-dialog` | Z-index `9999` / `10000`. |-| `dropdown-menu.tsx` | `@radix-ui/react-dropdown-menu` | |-| `input.tsx` | (none) | |-| `item-content.tsx` | (none) | Shared list-item slot. |-| `label.tsx` | (none) | |-| `popover.tsx` | `@radix-ui/react-popover` | |-| `select.tsx` | `@radix-ui/react-select` | Z-index `100000` to sit above dialog (`select.tsx:86`). |-| `slider.tsx` | `@radix-ui/react-slider` | |-| `sonner.tsx` | (none) | Toaster wrapper. |-| `switch.tsx` | `@radix-ui/react-switch` | |-| `tabs.tsx` | `@radix-ui/react-tabs` | |-| `toggle.tsx` | `@radix-ui/react-toggle` | |-| `toggle-group.tsx` | `@radix-ui/react-toggle-group` | |-| `tooltip.tsx` | `@radix-ui/react-tooltip` | |--### Design system-- **Tailwind** (`tailwind.config.cjs`) with CSS-variable theme (`src/index.css:7-61`): `--background`, `--foreground`, `--card`, `--popover`, `--primary`, `--secondary`, `--muted`, `--accent`, `--destructive`, `--border`, `--input`, `--ring`, `--chart-1..5`, `--radius: 0.5rem`. Dark variant at `:35-60`. Editor-specific utilities (`.editor-workspace`, `.editor-preview-panel`, `.editor-timeline-panel`, `.editor-resize-handle`, `.editor-panel-section`, `.editor-control-surface`, `.editor-inspector-shell`) in `src/index.css:77-217`.-- **Brand color**: `#34B27B` (used throughout LaunchWindow / TimelineEditor). Accent `#6C55FF` (playhead). Destructive `#ef4444` (trim).-- **Cursor color tokens**: `glassGreen/glassRed/glassAmber/glassYellow` in `ItemGlass.module.css`.-- **Type ramp**: Inter (default), plus Google Fonts imported via `@import` in `src/index.css:1` (Bebas Neue, Caveat, DM Sans, Fira Code, IBM Plex, Lora, Manrope, Merriweather, Oswald, Permanent Marker, Playfair, Plus Jakarta Sans, Space Grotesk, Sora).-- **No theme provider**; the editor is forced-dark via `index.html` root background `#09090b`.--### Icons-- Primary icon set: **`lucide-react: ^0.545.0`** (`package.json:80`). Used by every UI primitive + the timeline editor (`TimelineEditor.tsx:3-14`, `Item.tsx:3`).-- HUD icons: **`react-icons` (BsPlay, BsPause, BsRecordCircle, FaRegStopCircle, FaFolderOpen, FiMinus, FiX, MdCancel, MdMic, MdMicOff, MdMonitor, MdMouse, MdRestartAlt, MdVideocam, MdVideocamOff, MdVideoFile, MdVolumeOff, MdVolumeUp, RxDragHandleDots2, Languages, Columns3, Rows3, Clapperboard, Check, ChevronDown, ScanEye, WandSparkles, Scissors, MessageSquare, ZoomIn, Gauge, Captions, Captions, Plus, MousePointer2)** — see `LaunchWindow.tsx:1-21` and `TimelineEditor.tsx:3-14`.-- Arrow SVGs (caption arrows): `src/components/video-editor/ArrowSvgs.tsx` (5119 bytes, 8 directions).--### i18n setup-- `src/i18n/config.ts` (30 lines) — `DEFAULT_LOCALE = "en"`, `SUPPORTED_LOCALES = [en, ar, es, fr, it, ja-JP, ko-KR, ru, tr, vi, pt-BR, zh-CN, zh-TW]` (13), `I18N_NAMESPACES = [common, dialogs, editor, launch, settings, shortcuts, timeline]` (7).-- `src/i18n/loader.ts` (125 lines) — `import.meta.glob("./locales/**/*.json", { eager: true })` builds `messages[locale][namespace]`. `translate(locale, namespace, key, vars)` interpolates `{{name}}` placeholders. Missing namespaces are logged but excluded from `availableLocales`.-- `src/contexts/I18nContext.tsx` (192 lines) — provider with `useI18n()` + `useScopedT(namespace)`. Stored in `localStorage[openscreen-locale]`. On change it calls `window.electronAPI?.setLocale?.(newLocale)` which hits the main-process `set-locale` handler (`main.ts:542`) so the application menu re-renders with translated labels.-- Main process i18n (`electron/i18n.ts`, 113 lines — abbreviated `mainT`) covers the application menu and any main-process toasts / dialog labels.--### 13 locales (full list)-`en` (default), `ar`, `es`, `fr`, `it`, `ja-JP`, `ko-KR`, `ru`, `tr`, `vi`, `pt-BR`, `zh-CN`, `zh-TW`. Each locale has 7 namespace JSON files (`common`, `dialogs`, `editor`, `launch`, `settings`, `shortcuts`, `timeline`) under `src/i18n/locales/<locale>/`. Total: 91 locale files.--### Radix collision with axcut patterns-- OpenScreen uses shadcn `new-york` preset with `stone` base color and the standard CSS-variable HSL palette. Axcut uses **the same shadcn `new-york` preset** (per the merge plan references), so primitives like `button`, `dialog`, `popover`, `select`, `dropdown-menu`, `slider`, `tooltip`, `tabs`, `accordion`, `toggle`, `toggle-group`, `switch` should be **drop-in compatible**.-- OpenScreen already uses `@radix-ui/react-popover`, `@radix-ui/react-select`, `@radix-ui/react-dialog`, `@radix-ui/react-tooltip`, `@radix-ui/react-dropdown-menu`, `@radix-ui/react-tabs`, `@radix-ui/react-slider`, `@radix-ui/react-switch`, `@radix-ui/react-accordion`, `@radix-ui/react-toggle`, `@radix-ui/react-toggle-group` — covers the full axcut surface from the plan.-- Custom OpenScreen primitives to watch: `audio-level-meter.tsx` (real-time mic level meter), `color-picker.tsx` (UIW `@uiw/react-color-colorful`), `content-clamp.tsx` (line-clamp wrapper), `item-content.tsx`. None of these are mentioned in the plan, so they are likely unique to OpenScreen.-------## 8. Settings + preferences--### `src/lib/userPreferences.ts` (145 lines)-Schema:--```ts-interface UserPreferences {- padding: number; // 0-100, default 50 (DEFAULT_EDITOR_LAYOUT_SETTINGS.padding)- aspectRatio: AspectRatio; // one of 16:9, 9:16, 1:1, 4:3, 4:5, 16:10, 10:16, native- exportQuality: ExportQuality; // "medium" | "good" | "source", default "good"- exportFormat: ExportFormat; // "mp4" | "gif", default "mp4"- exportFolder: string | null; // remembered folder from save dialog- projectFolder: string | null; // remembered folder from open-project dialog- trayLayout: "horizontal" | "vertical"; // HUD layout, default "horizontal"-}-```--- Key `openscreen_user_preferences` in `localStorage`.-- `loadUserPreferences()` (`:59`) parses + clamps + falls back to `DEFAULT_PREFS`.-- `saveUserPreferences(partial)` (`:137`) merges into current and writes.-- `parentDirectoryOf(filePath)` (`:111`) + `getExportFolder()` / `getProjectFolder()` (`:127`, `:132`) helpers used to seed file dialog defaults.-- Auto-save effect in `VideoEditor.tsx:619-623` syncs `padding, aspectRatio, exportQuality, exportFormat` whenever they change.--### Other persisted prefs-- **`shortcuts.json`** (`electron/ipc/handlers.ts:46` `SHORTCUTS_FILE`) — at `userData/shortcuts.json`, the configurable shortcuts (`SHORTCUT_ACTIONS` in `shortcuts.ts:1-12`). Read on launch by `globalShortcut.ts:66` and `ShortcutsContext.tsx:43`; written via `saveShortcuts` IPC (`handlers.ts:2852`).-- **Locale** — `localStorage[openscreen-locale]` (`I18nContext.tsx:104`).-- **System language prompt seen flag** — `localStorage[openscreen-system-language-prompt-seen]` (`I18nContext.tsx:26`).-- **Custom fonts** — `src/lib/customFonts.ts` injects `<style>` into `document.head` (`:79`); no file persistence, but each font family is cached in `document.fonts`.-- **Editor per-project state** — `*.openscreen` files (see §3).-- **Last active project / recording paths** — main-process singletons (`electron/ipc/handlers.ts:357-358`, `:364`).-------## 9. Shortcuts--`src/lib/shortcuts.ts` (176 lines). Two groups: configurable (`SHORTCUT_ACTIONS`) and fixed (`FIXED_SHORTCUTS`).--### Configurable shortcuts (`SHORTCUT_ACTIONS`, `shortcuts.ts:1-11`)-| Action | Default binding (`DEFAULT_SHORTCUTS`, `:108-118`) | Used by |-|---|---|---|-| `openApp` | `Ctrl/Cmd+Shift+O` | Global `electron.globalShortcut` (open main window). |-| `addZoom` | `Z` | Timeline (`TimelineEditor.tsx:1248`). |-| `addTrim` | `T` | Timeline (`:1251`). |-| `addSpeed` | `S` | Timeline (`:1260`). |-| `addAnnotation` | `A` | Timeline (`:1254`). |-| `addBlur` | `B` | Timeline (`:1257`, gated by `BLUR_REGIONS_ENABLED`). |-| `addKeyframe` | `F` | Timeline (`:1245`). |-| `deleteSelected` | `Ctrl/Cmd+D` | Timeline (`:1286`). |-| `playPause` | `Space` | Not currently bound to a handler in `TimelineEditor` — wired in `PlaybackControls`. |--### Fixed shortcuts (`FIXED_SHORTCUTS`, `shortcuts.ts:32-75`)-- `undo` — `Ctrl+Z`.-- `redo` — `Ctrl+Shift+Z` or `Ctrl+Y`.-- `cycleAnnotationsForward` — `Tab` (handled inline at `TimelineEditor.tsx:1265`).-- `cycleAnnotationsBackward` — `Shift+Tab`.-- `deleteSelectedAlt` — `Delete` / `Backspace`.-- `panTimeline` — `Shift+Ctrl+Scroll` (display only, not enforced).-- `zoomTimeline` — `Ctrl+Scroll` (display only).-- `frameBack` / `frameForward` — `←` / `→`.--### Collision check with axcut (Ctrl+C / Ctrl+V for clip duplicate)-- OpenScreen does **not** bind `Ctrl+C` / `Ctrl+V` to clip duplicate today. `Tab` cycles annotations; `Delete` / `Backspace` / `Ctrl+D` delete selected region.-- However, `Ctrl+C` and `Ctrl+V` are intercepted by Electron's application menu as `Edit > Copy` / `Edit > Paste` (`main.ts:231-233`). In the editor's text inputs these behave normally; in the canvas they would currently go to the system clipboard with no effect (the menu items are wired to native `role: "copy"` / `"paste"`).-- **The merge plan's Ctrl+C / Ctrl+V = duplicate clip will collide** with the existing Edit menu items. The fix is either:- - Override `role: "copy"` / `role: "paste"` on the menu to send renderer-targeted IPC and have the editor handle them, or- - Keep the global native copy/paste but bind `Ctrl+Shift+D` / `Ctrl+Shift+V` (or use `Cmd+D` which is already `deleteSelected`) for duplicate.-- `Ctrl+D` is **already bound** to `deleteSelected` (`shortcuts.ts:116`). `findConflict` (`:90`) will reject a duplicate-clip binding on `Ctrl+D` because both are `configurable`. The conflict-detection system at `:90-106` is already in place.-------## 10. Performance + concurrency--### Web Workers-Three:--| File | Purpose | Spawned by |-|---|---|---|-| `src/lib/captioning/transcribe.worker.ts` | Whisper ASR. | `transcribe.ts:57` `new Worker(new URL("./transcribe.worker.ts", import.meta.url), { type: "module" })`. |-| `src/hooks/audioPeaksWorker.ts` (43 lines) | Computes audio peaks for waveform display. | `useAudioPeaks.ts:21` `new Worker(...)`. |-| `gif.js` worker (`gif.js/dist/gif.worker.js`, external library) | GIF encoding. | `gifExporter.ts:25` via `GIF_WORKER_URL`. |--The caption worker is terminated on completion/abort (`transcribe.ts:67`).--### Pixi.js contexts-- **Preview** — `src/components/video-editor/VideoPlayback.tsx:1027` (creates a `pixi.js` `Application` and mounts the canvas inside the editor preview).-- **Export** — `FrameRenderer.ts:196` creates a separate offscreen Pixi.js app per export (`new Application({ canvas, width, height, backgroundAlpha: 0, antialias: true, resolution: 1, autoDensity: true })`).-- Tests: `vitest.browser.config.ts` runs Playwright with Chromium to render Pixi in jsdom-incompatible code paths (`src/lib/exporter/videoExporter.browser.test.ts`, `src/lib/exporter/gifExporter.browser.test.ts`).--### Main-process concurrency-- **Streams only**: `RecordingStreamRegistry` (`electron/ipc/recordingStream.ts:11`) holds a `Map<fileName, WriteStream>` per open recording. No explicit locking — writes are serialized via the Node `WriteStream` internal queue + an `enqueueWrite` promise chain in the renderer (`recorderHandle.ts:50-67`).-- **Native capture subprocesses**: `electron/ipc/handlers.ts:404-425` holds separate state per platform (`nativeWindowsCaptureProcess`, `nativeMacCaptureProcess`). Single process per platform at a time (rejects parallel start). Spawned via `node:child_process.spawn`.-- **No mutex / lock / queue primitive** in main. Operations are guarded by re-entrancy checks (`activeNativeRecording.finalizing`, `cursorRecordingSession !== null`).--### IPC pub-sub / event bus-- **Native bridge has events** (`NativeBridgeEventName`, `src/native/contracts.ts:230-238`): `project.contextChanged`, `cursor.providerChanged`, `cursor.telemetryLoaded`. The events are *typed* and *advertised* but **no transport is wired** for them today (no `webContents.send` to deliver them; renderer code does not subscribe). They are scaffolding for future use.-- **Implicit pub-sub** via `webContents.send`:- - `selected-source-changed`, `source-selector-closed`, `countdown-overlay-value`, `stop-recording-from-tray`, `request-close-confirm`, `request-save-before-close`, `main-process-message` (echoes date string back, mostly debug).- - The renderer subscribes via `on*` callbacks exposed in `preload.ts`.-- **No main-process EventEmitter shared between services** aside from `nativeMacCaptureEvents` (`handlers.ts:51`, used internally for the macOS SCK child process).-------## 11. Tests--### Inventory (32 test files)-Unit (vitest, jsdom) and browser (Playwright headless Chromium):-- `src/lib/exporter/{videoExporter,videoExporter.browser,frameRenderer,mp4ExportSettings,gradientParser,streamingDecoder,timestampedVideoFrameQueue,audioEncoder,gifExporter,gifExporter.browser}.test.{ts,tsx}` — exporter pipeline.-- `src/lib/{wallpaper,userPreferences,nativeMacRecording,compositeLayout,cursorTelemetryBuffer,blurEffects,annotationTextAnimation}.test.{ts,tsx}` — utility modules.-- `src/lib/captioning/annotationsFromCaptions.test.ts` — caption grouping & spacing.-- `src/lib/cursor/{nativeCursor,cursorPathSmoothing}.test.ts` — cursor telemetry / smoothing.-- `src/lib/__tests__/frameStepNavigation.test.ts` — frame step.-- `src/components/video-editor/{projectPersistence,editorDefaults,customPlaybackSpeed,backgroundImageUpload}.test.{ts,tsx}` — editor state.-- `src/components/launch/{LaunchWindow,SourceSelector}.test.tsx` and `openSourceSelectorFlow.test.ts` — HUD/launch flows.-- `src/hooks/{recorderHandle,useCameraDevices}.test.ts` — recorder + camera devices.-- `src/utils/aspectRatioUtils.test.ts`.-- `src/i18n/__tests__/tutorialHelpTranslations.test.ts`.-- `electron/{singleInstanceLock,ipc/recordingStream}.test.ts` — main process units.-- `src/components/video-editor/videoPlayback/zoomSpring.test.ts`.--### Vitest vs browser-vitest split-- **`vitest.config.ts`** (jsdom env) — 27 unit tests including all editor state, util, caption, cursor, recorder tests.-- **`vitest.browser.config.ts`** (Playwright headless shell, real DOM + Pixi) — only `videoExporter.browser.test.ts` and `gifExporter.browser.test.ts`.-- Split reason: jsdom can't construct `OffscreenCanvas`/`VideoFrame`/WebCodecs needed by the exporter.--### E2E (Playwright, `tests/e2e/`)-- `gif-export.spec.ts` (158 lines) — spawns Electron, loads `tests/fixtures/sample.webm` directly into the editor, exports both mp4 and gif, asserts file size > 0, optionally `ffprobe`s the MP4 if available (`tests/e2e/gif-export.spec.ts:14`).-- `windows-native-checklist.spec.ts` (322 lines) — Windows-specific checklist: launches Electron, exercises the native-bridge RPCs (`system.getCapabilities`, `cursor.getCapabilities`, etc.) to validate the helper availability and capabilities handshake (`tests/e2e/windows-native-checklist.spec.ts:8`).-- Fixtures: `tests/fixtures/sample.webm` (23 KB) and `tests/fixtures/sample-inflated-duration.webm` (1.2 KB) for duration-validation tests.--### Recorder handle tests (`src/hooks/recorderHandle.test.ts`, 264 lines)-Eight tests covering streaming to disk, fallback to in-memory when open fails, fallback when IPC rejects, no truncation when writes are in flight, error propagation from `appendRecordingChunk` (success=false and rejection), buffering without `fileName`, and `discard` semantics.-------## 12. Build + distribution--### `electron-builder.json5`-- `appId: com.etiennelescot.openscreen`, `productName: Openscreen`, `asar: true`, `asarUnpack: ["**/*.node"]`.-- `extraResources`:- - `public/wallpapers` → `wallpapers/`.- - `public/cursors` → `cursors/`.- - `caption-assets` → `caption-assets/`.-- **mac** — `hardenedRuntime: true`, entitlements `macos.entitlements`, target `dmg` for both `x64` and `arm64`, native helper from `electron/native/bin/darwin-*/*`.-- **linux** — targets `AppImage, deb, pacman`, no native helper.-- **win** — target `nsis` (oneClick: false, allowToChangeInstallationDirectory: true), native helper from `electron/native/bin/win32-*/*`.-- `beforePack: scripts/before-pack.cjs` — fetches the auto-caption model + ORT wasm into `caption-assets/` (idempotent).--### Native helper build scripts-- `scripts/build_macos.sh` (`build:mac` npm script wraps `build:native:mac + tsc + vite build + electron-builder --mac`).-- `scripts/build-macos-screencapturekit-helper.mjs` — invokes `swift build` for `electron/native/screencapturekit` (Swift Package Manager, `Package.swift`).-- `scripts/build-windows-wgc-helper.mjs` — invokes `cmake` for `electron/native/wgc-capture` (`CMakeLists.txt`).-- `scripts/test-windows-wgc-helper.mjs` — helper-level smoke test (5 mode variants).--### `scripts/i18n-check.mjs` (87 lines)-Validates every locale folder has the same key tree as `en/` for all 7 namespaces. Lists missing keys per locale; fails with non-zero exit if any locale is out of sync. Run via `npm run i18n:check` (`package.json:27`).--### Other scripts (`scripts/`)-- `before-pack.cjs` — caption-asset fetch step (above).-- `capture-openscreen-preview.mjs`, `inspect-native-cursor-click-bounce.mjs` — diagnostic / screenshot tools.-- `test-windows-native-cursor.mjs` — native cursor helper smoke test.-- `fetch-caption-model.mjs` — model pre-download.--### Build commands-- `npm run dev` — vite dev server (Electron window opens via `vite-plugin-electron`).-- `npm run build` — full `tsc && vite build && electron-builder`.-- `npm run build-vite` — Vite + tsc only (no packaging), used by Playwright e2e setup.-- `npm run lint` / `npm run format` — Biome 2.4 (`biome.json`, `package.json:24-25`).-- `npm run test` (vitest), `npm run test:browser` (Playwright), `npm run test:e2e` (Playwright e2e).-- `npm run prepare` — `husky` for pre-commit hooks (`lint-staged` runs Biome on staged `*.{ts,tsx,js,jsx,mts,cts,json}`).-------## 13. Anything else relevant to the merge--### Code that touches "schema" or "document" (potential collisions)-- `useScreenRecorder.ts:963`, `src/lib/nativeMacRecording.ts:7`, `src/lib/nativeMacRecording.ts:53` — native capture **requests** carry `schemaVersion: 1` (`NativeMacRecordingRequest`, `NativeWindowsRecordingRequest`). These are IPC payload schemas, not the project document. If axcut's plan renames or extends these, both sides must move together.-- `ProjectFileResult` (`src/native/contracts.ts:84`) carries `project?: unknown` — the on-disk project JSON is currently passed as `unknown` through the bridge and parsed only in the renderer. The merge plan's `AxcutDocument` will become the **typed** shape; bridge contract stays `unknown`, but renderer + persistence switch.-- `PROJECT_VERSION = 2` (`projectPersistence.ts:65`) — current on-disk schema is v2; the merge plan bumps to v3 with `legacyEditor` preserved.-- `electron-builder.json5:46` already lists `caption-assets` as `extraResources`. The merge plan's "resources/` folder referenced for `apps/server`/`py/axcut-core` does not exist; nothing to deprecate here.--### Plugins / extension points-- **No plugin system in OpenScreen.** All "extension" code paths are hardwired (compositor layers in `FrameRenderer`, IPC channels in `handlers.ts`, Radix UI primitives). The closest thing to extensibility is:- - `native-bridge:invoke` domain routing — a new domain (`chat`, `agent`) can be added without breaking other domains (`src/native/contracts.ts:130`).- - `NativeBridgeEventName` (`contracts.ts:230`) declares events for `project.contextChanged`, `cursor.providerChanged`, `cursor.telemetryLoaded` — typed but **not yet wired** (no transport). Adding a transport (e.g. `EventEmitter` or `webContents.send`) is the cleanest place to add the merge plan's "per-project event bus" without inventing a new channel.- - `getExportFolder` / `getProjectFolder` are the only places user prefs cross into the IPC layer; AI Edition prefs (default provider, default model, reasoning effort per the merge plan §Phase 9) can extend `UserPreferences` cleanly.--### Documentation files (`docs/`)-- `docs/architecture/ai-edition-roadmap.md` — the merge plan itself.-- `docs/architecture/native-bridge.md` (39 lines) — describes the versioned IPC pattern.-- `docs/tests/writing-tests.md`.-- `docs/testing/windows-native-cursor.md`, `docs/testing/macos-native-cursor.md` — native-helper smoke-test notes.-- `docs/engineering/windows-native-recorder-roadmap.md`, `docs/engineering/macos-native-recorder-roadmap.md`.-- Project root also has `README.md` (7976 bytes), `CONTRIBUTING.md`, `LICENSE`, `AGENTS.md` (the canonical agents guide referenced by merge plan). No other `.md` files in the repo (`grep -r '\.md$' --include=*` returns only those).--### Other notes-- `electron/electron-env.d.ts` (9690 bytes) — the full TypeScript surface of `window.electronAPI` exposed by the preload. This is the authoritative list of legacy ad-hoc IPC and should be cross-checked against the merge plan's new channels (`ai-edition:document:get`, `ai-edition:chat:run`, `ai-edition:sessions:list`, etc.) — none exist yet.-- `RecordingStreamRegistry` (`electron/ipc/recordingStream.ts:11`) is generic enough to host **appending bytes for any streamed IPC payload** — e.g. an axcut asset import that streams a file to disk.-- `assetBaseUrl` plumbing (`electron/preload.ts:11-13` + `src/lib/assetPath.ts` + `src/lib/wallpaper.ts`) is the canonical pattern for shipping bundled assets under `file://`. The merge plan explicitly calls out `transcribe.ts:93-94` as the template to copy when axcut's agent runtime needs to ship models or templates — `transcribe.worker.ts:55-61` shows the matching env-var shape.-- The recorder's `recordingId` is `Date.now()` (`useScreenRecorder.ts:808`, `:1020`), so it's millisecond timestamp + counter — collisions are theoretically possible if two recordings start in the same millisecond on different windows. Not relevant in practice; merge plan's `assets[].id` should generate via `crypto.randomUUID()` like the timeline (`TimelineEditor.tsx:17`).-- `useEditorHistory.ts` (164 lines) holds the undo/redo state machine (80-step ring buffer, `pushState`/`updateState`/`commitState`/`undo`/`redo`/`resetState`). The merge plan's `AxcutDocument.history.revisions[]` will replace this; `pushState` → record a revision, `undo` → restore.-- The `currentRecordingSession` singleton (`handlers.ts:358`) is the closest existing thing to the plan's `activeProject` — it's a single in-flight `RecordingSession`, replaced wholesale on every stop. The plan's per-project model will need an index of all open projects, not just the active one.-- `LICENSE` = MIT; `package.json:5` author/maintainers are listed; `electron-builder.json5:84` sets the linux `maintainer`.diff --git a/technical-documentation/_harvest/openscreen-ux-ui-spec.md b/technical-documentation/_harvest/openscreen-ux-ui-spec.mddeleted file mode 100644index ba32d5da6..000000000--- a/technical-documentation/_harvest/openscreen-ux-ui-spec.md+++ /dev/null@@ -1,619 +0,0 @@-# OpenScreen — Complete Front-End UX/UI Specification--This spec covers everything a user can do, see, and trigger from the **renderer (front web app)** of OpenScreen, across all four windows the app loads.--## 1. Application surface--OpenScreen is an Electron + React renderer. The URL `?windowType=...` parameter picks which component the renderer shows. The renderer never boots a multi-page SPA — it is one HTML entrypoint with four top-level React components, lazy-loaded where it matters.--| `?windowType=` | Component | Window type | Purpose |-|---|---|---|---|-| _(unset)_ | Static fallback | Main editor | Renders only an `<h1>OpenScreen</h1>` — boot is treated as broken in this branch |-| `hud-overlay` | `<LaunchWindow>` | Transparent, frameless, mouse-passthrough overlay | Floating recording HUD that lives on top of the user's desktop |-| `source-selector` | `<SourceSelector>` | Glassy modal-style picker | Pick a screen or window to record |-| `countdown-overlay` | `<CountdownOverlay>` | Transparent, frameless | Shows `3 · 2 · 1` over the whole desktop before recording starts |-| `editor` | `<VideoEditor>` + `<ShortcutsConfigDialog>` | Standard BrowserWindow with titlebar | The "Studio": preview, timeline, settings, export |--`<VideoEditor>` itself wraps the lazy `<ShortcutsConfigDialog>` so the shortcuts dialog is code-split behind it. The dialog is mounted globally so it can be opened from the inspector panel via `useShortcuts().openConfig()`.--There is also a tray icon and a global app menu (File / Edit / View / Window) defined in `electron/main.ts`. The renderer reacts to:--- Application menu File submenu → New Project (⌘N), Load Project (⌘O), Save Project (⌘S), Save Project As (⌘⇧S).-- Edit menu: standard Undo / Redo / Cut / Copy / Paste / Select All (handled by Electron's native roles).-- View menu: Reload, Force Reload, DevTools, Actual Size, Zoom In/Out, Toggle Fullscreen.-- Tray context menu: shows **Open** while idle; switches to **Stop Recording** while recording.--A single-instance lock guarantees that double-launching focuses the existing window.-------## 2. `<LaunchWindow>` — Recording HUD overlay--A draggable, mouse-passthrough glassmorphic pill that lives on top of the desktop. Layout and content are designed for a one-click "hit record" workflow.--### 2.1 Top-level layout--The HUD mounts inside a div with `min-w-0 max-w-full overflow-hidden` and a `body { background: transparent }` override. Everything sits in one bottom-anchored, upward-growing stack (`fixed bottom-5 left-1/2 -translate-x-1/2`): the bar at the bottom, then any popover, then any notice, laid out by flexbox relative to the bar rather than positioned from measured rects. Drag handle to the left, controls in the centre, window controls to the right. The window is mouse-ignored by default (`setHudOverlayIgnoreMouseEvents(true)`); it only becomes interactive when the user hovers a button or opens a popup.--The overlay window's size is driven from the renderer via `setHudOverlaySize(w, h)`, but on a **reserve, don't discover** basis — see `src/components/launch/hudGeometry.ts`. Only the bar is measured; every floating panel has a fixed width and a capped, internally-scrolling height whose space is reserved in the window from the first frame. Consequences worth knowing:--- Opening or closing any floating surface — popover, device-settings panel, notice — or a device list changing length, costs **zero** native resizes. The reserve is sized against the tallest of them, not against whichever is open.-- No measured box may be sized in `vh`/`vw`. A viewport-relative size makes the box depend on the window, and those boxes feed the sizing measurement — which closes a resize → re-layout → re-measure loop. Screen-derived caps (`screen.availHeight`) arrive as `--hud-*` custom properties instead.-- Resizes are applied in one shot, not tweened: they only ever accompany a discrete content change (orientation flip) that snaps anyway.-- Allocation is asymmetric — grow as soon as the content stops fitting, shrink only once it has fallen a whole reserve below what was granted. So the bar can grow into its reserve (recording controls, a longer source name) and back out without any resize at all.--### 2.2 Controls (left → right, horizontal mode is default)--Every control is also vertically stackable — the layout toggle is the first button in the bar (Columns3 / Rows3 icons). The choice is persisted in `localStorage` as `userPreferences.trayLayout`.--1. **Drag handle** — six-dot grip, pointer-captured. Pointerdown pins the window's origin in the main process (`beginHudOverlayDrag`); each move sends the pointer's *total* travel since then (`dragHudOverlayTo`), so nothing accumulates or drifts; release ends the gesture and re-measures the content.-2. **Layout toggle** — swaps between horizontal (`Columns3` icon, default) and vertical (`Rows3` icon, `aria-pressed=true` when vertical). Tooltip "Use vertical tray" / "Use horizontal tray".-3. **Source picker button** — screen icon + truncated source name (e.g. "Entire Screen"). Disabled during recording. Opens `<SourceSelector>` window. The label is seeded once on mount and then kept in sync by the `onSelectedSourceChanged` event (plus a refresh on window focus) — there is no polling.-4. **Capture group** — system audio, microphone and webcam, each a standalone icon button, and all three **plain on/off toggles**. One click switches the device on using whatever is currently selected (the system default until the user says otherwise); one click switches it off. Disabled during recording. Choosing *which* device is a separate concern and lives in the settings panel below — overloading one button with both jobs is what made turning a camera on take two clicks.-5. **Device settings** (gear) — opens the device panel in the stack above the bar (§2.3). Disabled during recording, when devices can't be changed anyway. It sits with the mic and camera toggles it configures inside a hairline-outlined group, tighter than the bar's normal spacing: a fill light enough to read on `#14171c` would land brighter than the buttons' own hover colour and invert the hover affordance, so the grouping is marked with an inset outline instead.-6. **Cursor mode** (only on macOS / Windows, hidden on Linux) — toggles between `editable-overlay` (default, OpenScreen draws a stylised cursor you can theme/edit) and `system` (record OS cursor as-is).-7. **Record/Stop button**:- - When idle and a source is selected: pill with the red **record** icon, plus the source name on hover.- - When idle and no source: same pill but greyed, clicking it opens the Source Selector first and then auto-starts recording once a source is picked (`recordAfterSourceSelectionRef`).- - When recording: red/amber pill with the **stop** icon plus a `mm:ss` elapsed timer (`formatTimePadded`) that ticks up live. Background turns red while running, amber when paused.-8. **Recording-state auxiliary buttons** (only while recording):- - **Pause/Resume** (`BsPauseCircle` ↔ `BsPlayCircle`) — only shown if `canPauseRecording`.- - **Restart** (`MdRestartAlt`) — throws away current take and starts fresh.- - **Cancel** (`MdCancel`) — discards the current take without saving.-9. **Open Studio** (`Clapperboard` icon, hidden during recording) — switches to the editor window via `window.electronAPI.switchToEditor()`.-10. **Language button** (right sidebar) — pill labelled with the current locale short name (e.g. "EN"), opens the language menu in the stack above the bar. Each item shows the localized language name with a check next to the current one. Click-outside and `Esc` close it. Its height is a plain CSS cap (320px, scrolls past that) rather than a value measured against the overlay window — that measurement is what used to truncate the list to a couple of entries and then let it grow whenever the window happened to grow. The list of locales is pulled from `getAvailableLocales()`.-11. **Window controls** (far right) — `−` (hide HUD, keeps app running) and `×` (close app).--### 2.3 Device settings panel--Opened from the gear button, and the only place devices are chosen. It lists the-microphone and camera inputs with the active one checked, and lets the user-*verify* each before recording:--- A live segmented **input-level meter** under the microphone list, fed by- `useAudioLevelMeter` on the selected device.-- A live mirrored **camera preview** under the camera list, fed by- `useCameraPreviewStream` on the selected device.--Both streams belong to the panel, are torn down when it closes, and are entirely-separate from the recorder's own capture streams. Neither is opened when the-corresponding hardware is absent. **Selecting a device never switches it on** —-if the device is already live the recorder re-acquires it on the id change,-otherwise the choice simply applies to the next toggle.--It is the tallest floating surface, so it is what the window's vertical reserve-is sized against (see §2.1) — permanently, open or not. Opening it therefore-costs **zero** resizes, like every other surface: sizing the reserve to whatever-happens to be open would grow the window on open, and since the stack is-bottom-anchored, growing upward shifts all the content down in window-coordinates a frame or two before the renderer repaints it — which is visible as-position judder. Click-outside, `Esc` and its own Done control all close it, and-it is mutually exclusive with the language menu.--### 2.4 Hover behaviour--- Hover/pointer-enter on the bar enables mouse events on the overlay (`setHudOverlayIgnoreMouseEvents(false)`).-- Pointer-leave disables them again, except while a popup is open (a popup reaches beyond the bar, and the gap between the two would otherwise flip the overlay back to click-through mid-travel).-- The selected source name is seeded once on mount and then follows `onSelectedSourceChanged`, with a refresh on window focus to cover anything missed while the window was gone.--### 2.5 System-language prompt--If the OS locale differs from the current UI locale and hasn't been resolved, a glassy card fades in at the top of the HUD stack, above the bar and above any open popover (a fixed 360px wide, so it can't resize the overlay horizontally):--- Title: "Use your system language?"-- Body: "We detected X as your system language. Do you want to switch OpenScreen to X?"-- Two buttons: **Keep current language** / **Switch to X**. Both resolve the prompt so it never reappears.--### 2.6 Loading and error states--The HUD itself doesn't have an explicit "loading" state — `useScreenRecorder` handles all of that internally. Errors surface via Sonner toasts triggered from the recorder hook:--- "Camera access is blocked. Enable it in system settings to use the webcam."-- "Microphone access denied. Recording will continue without audio."-- "Camera access denied. Recording will continue without webcam."-- "Webcam disconnected." / "Camera not found."-- "System audio not available. Recording without system audio."-- "Recording permission denied. Please allow screen recording."-- "Allow Accessibility access for OpenScreen, then press record again to start the countdown." (macOS)--### 2.7 Countdown integration--When the user hits Record, the recorder calls `window.electronAPI.showCountdownOverlay(value, runId)` to spawn the `<CountdownOverlay>` window. The HUD doesn't itself render numbers — it just waits for the recorder to flip into the recording state.-------## 3. `<SourceSelector>` — Pick a screen/window--A separate window (no chrome, glass container) that lists available capture sources. The whole window scrolls.--### 3.1 Layout--- Full-viewport glass container with `min-h-screen`, centred content.-- Top: two **tabs** (grid of cards beneath):- - **Screens (N)** — `id` starts with `screen:`- - **Windows (N)** — `id` starts with `window:`-- Each tab shows a 2-column, vertically-scrolling grid of thumbnail cards, fixed height `282px`, `overflow-y-auto`.-- Bottom: a sticky footer with `Cancel` and `Share` buttons (`Share` is disabled until a source is picked).--### 3.2 Source card--Each card is a small `<button>` (renders as a div with role) showing:--- 16:9 thumbnail (320×180 requested from `getSources`).-- Source name + small app icon (only when `appIcon` is non-null).-- When selected: bright green border + check badge in the top-right corner.--Selection is single — clicking another card swaps the selection. Clicking the same card again keeps it selected.--### 3.3 Loading state--While `getSources` resolves, the entire body becomes a centred spinner with the label "Loading sources…".--### 3.4 Empty / failure state--If `getSources` returns zero sources (or rejects), the body becomes a centred card:--- Heading "No screens or windows found".-- Body text either "If you just granted screen recording permission, reload this picker. On macOS you may need to reopen OpenScreen." or the load-failed variant.-- **Reload** button — re-invokes `getSources`.--### 3.5 Window lifetime--The selector is opened via `window.electronAPI.openSourceSelector()`. When it closes, the editor / HUD is notified via `onSourceSelectorClosed` so any "record after pick" intent is cancelled.-------## 4. `<CountdownOverlay>` — 3·2·1--A separate transparent, frameless, `pointer-events: none` window that overlays the desktop.--- Subscribes to `window.electronAPI.onCountdownOverlayValue((value) => …)`. Renders nothing until the first value arrives.-- The countdown number is rendered at `80px` font weight, centred in a `160×160` dark translucent circle with a heavy text shadow.-- The overlay disappears when the recorder hides it (`hideCountdownOverlay`).-------## 5. `<VideoEditor>` — Studio--This is the largest UI surface. It opens as a standard Electron BrowserWindow with the macOS-style traffic-light buttons (mac) or the platform default (Windows/Linux) and is laid out as a `flex flex-col h-screen` shell.--### 5.1 Top-level structure--```-┌──────────────────────────────────────────────────────────────────────────┐-│ Top bar (h-11, draggable) — language, new recording, load, save │ (WebkitAppRegion: drag)-├──────────────────────────────────────────────────────────────────────────┤-│ EditorEmptyState (only when no video is loaded) │-│ OR │-│ Resizable panel group (vertical, react-resizable-panels) │-│ ┌─────────────────────────────────────────────────────────────┐ │-│ │ Panel (default 67%, 46–76%) │ │-│ │ ┌─────────────────────────────┬──────────────────────────┐ │ │-│ │ │ editor-preview-zone │ editor-settings-rail │ │ │-│ │ │ • Video preview (Pixi) │ • Mode rail + accordion │ │ │-│ │ │ • Playback controls bar │ panels │ │ │-│ │ └─────────────────────────────┴──────────────────────────┘ │ │-│ └─────────────────────────────────────────────────────────────┘ │-│ ═══════════════ resize handle (h-1 hover-glow pill) ═══════════════ │-│ ┌─────────────────────────────────────────────────────────────┐ │-│ │ Panel (default 33%, 24–54%) — TimelineEditor │ │-│ └─────────────────────────────────────────────────────────────┘ │-├──────────────────────────────────────────────────────────────────────────┤-│ Overlays (z-50 / 60): ExportDialog, UnsavedChangesDialog, etc. │-└──────────────────────────────────────────────────────────────────────────┘-```--There is also a global `<Toaster>` (dark Sonner) mounted at the app root for transient notifications.--### 5.2 Top bar (always visible)--Eleven-pixel-tall bar with `WebkitAppRegion: drag` so the user can move the window; child buttons set `WebkitAppRegion: no-drag`. From left to right:--- **Language picker** (`Languages` icon + `<select>` showing 13 locales: en, ar, es, fr, it, ja-JP, ko-KR, pt-BR, ru, tr, vi, zh-CN, zh-TW). Each option uses its localized native name.-- **New Recording** (`Video` icon + label) — opens a confirmation dialog.-- **Load Project** (`FolderOpen` icon + "Load Project") — file picker via `nativeBridgeClient.project.loadProjectFile`.-- **Save Project** (`Save` icon + "Save Project") — saves in place; if not yet saved, prompts for a path.--The macOS-only traffic-light buttons appear in the top-left (handled by Electron, the language selector leaves `ml-14` on macOS to clear them).--### 5.3 Loading and error screens--While `useEditorHistory` and project IPC are still resolving, the editor shows a centred "Loading video…" label on the `#09090b` background. On a hard load error, the editor shows a destructive-tinted error message + a "Load Project" button.--### 5.4 `<EditorEmptyState>` — Studio dashboard--Renders only when no video is loaded. A drop zone occupies the entire region.--- Logo (64×64, opacity 90).-- Heading "No project open" and description.-- Two stacked buttons:- - **Import Video File…** — opens `window.electronAPI.openVideoFilePicker` and, on success, calls `setCurrentVideoPath`.- - **Load Project…** — opens `.openscreen` file picker; on success, restores the project.-- Below: list of supported video formats (MP4, MOV, WebM, MKV, AVI, M4V, WMV) and a small "or drag & drop a .openscreen project file here" hint.--**Drag and drop**: dragging a file over the empty state shows a dashed green overlay with an upload icon and the message "Drop project file to open". The drop handler:--- Accepts only `.openscreen` project files (any other file → "Unsupported Format" dialog).-- Resolves the path via `webUtils.getPathForFile` (Electron 32+).-- Calls `loadProjectFileFromPath` and applies the project on success.-- Any other failure (missing path, IPC error, invalid project) → "Could Not Open File" dialog.--Both dialogs are a small rounded modal with an icon, title, body, and a single Close button. The dialog stays on the last error type even during the close animation so the title doesn't flicker.--### 5.5 Studio workspace (video loaded)--The workspace is a `react-resizable-panels` group. The user drags the handle to rebalance preview vs timeline.--#### 5.5.1 Preview zone (left)--A flexible column with two stacked sub-sections:--1. **Preview canvas** — a Pixi.js canvas wrapped by `<VideoPlayback>`. The canvas aspect ratio follows the chosen `aspectRatio` (`16:9`, `9:16`, `1:1`, `4:3`, `4:5`, `16:10`, `10:16`, or `native`). When `isFullscreen` is true, the preview switches to a `fixed inset-0 z-[99999]` overlay; `Esc` exits fullscreen.-- The preview composite layers (back to front):-- - **Background** (`wallpaper`): image / solid colour / CSS gradient chosen in the settings panel.- - **Screen video** with crop, border radius, padding, shadow, motion blur, blur (background blur).- - **Webcam composite** — `picture-in-picture` (draggable bubble), `vertical-stack`, `dual-frame`, or `no-webcam`. PiP can be circular, square, rectangle, or pill-shaped, mirrored, sized 10–50% via slider, and optionally "shrinks on zoom" (reactive scaling).- - **Animated zoom regions** with spring easing, focus-point tweens, and optional 3D rotation (iso / left / right).- - **Trim cuts** — played back skipping the trimmed segments.- - **Speed regions** — clips play at the per-region speed (0.25×–16×).- - **Cursor** — drawn with theme art, smoothing, motion blur, click bounce; clips to canvas bounds when the toggle is on.- - **Annotations** — text/image/arrow overlays; mosaics as blur shapes.-- Selecting a region in the timeline selects it on the preview and reveals its resize handles. The selected zoom region can be moved and re-anchored by dragging its focus marker in the preview.--2. **Playback controls** — a centred, full-width `max-w-[760px]` floating pill below the preview:- - Play/Pause button (round, white when paused, glassy when playing).- - Current time / total duration labels (`m:ss`).- - Custom range slider (a transparent `<input type=range>` sits over a green progress bar inside a grey track; round white thumb appears on hover).- - Fullscreen toggle on the right (changes icon Maximize ↔ Minimize).--#### 5.5.2 Settings rail (right)--Two-column shell: a narrow icon rail on the left, an accordion panel on the right. The rail icon toggles which panel is shown. Icons (top → bottom):--- **Background** (palette) — always visible.-- **Effects** (sliders) — always visible.-- **Layout** (panel-top icon) — only enabled when a webcam video is loaded.-- **Timeline** (brackets icon) — always visible; switches the right column to a small panel for the trim waveform toggle.-- **Cursor** (mouse-pointer-click icon) — appears only when the recording has editable cursor data (editable-overlay + native cursor assets).-- **Crop** (crop icon, outside the panel group) — opens the Crop modal.-- **Export** (download icon, anchored to bottom) — opens the export panel.--When a timeline region is selected, the rail is replaced entirely with the region-specific inspector:--- **Selected zoom**: zoom-level editor.-- **Selected trim**: a single Delete button.-- **Selected speed**: speed editor.-- **Selected annotation**: full annotation editor.-- **Selected blur**: blur editor.--The panel scrolls (`overflow-y-auto custom-scrollbar`). At the bottom sits a footer with three support buttons: **Report Bug**, **Save Diagnostics**, **Star on GitHub** (the bug link opens the GitHub issues page in the OS browser).--##### Panel: Background--Three tabs (Image / Colour / Gradient).--- **Image**: a hidden file input + **Upload Custom** button. Only JPG/JPEG/PNG are accepted (`isSupportedBackgroundImageType`). On success, the image becomes a custom thumbnail in the grid (hover shows a red ✕ to remove). Default wallpapers come from `WALLPAPER_PATHS` and render as 32×32 thumbnails; the active one has a green border + ring.-- **Colour**: opens the `<ColorPicker>` component (Block / Palette / Hue wheel). Updates the `wallpaper` state in real time. A 16-swatch palette is also rendered.-- **Gradient**: a 6-column grid of 24 preset CSS gradients. Click applies.--##### Panel: Effects (Video Effects)--Two columns of rounded "control surfaces":--- **Blur BG** — toggle switch (0/1). Toggles Pixi `BlurFilter`.-- **Motion Blur** — slider 0–1, step 0.01. Live numeric display.-- **Shadow** — slider 0–1, step 0.01. `Math.round(value*100)%` numeric.-- **Roundness** — slider 0–64 px, step 0.5. Numeric in px.-- **Padding** — slider 0–100 %, step 1. Applies to every webcam layout; in `dual-frame` / `vertical-stack` it insets the welded screen+camera block as one piece.--All sliders commit their value when the user releases the thumb (`onValueCommit`). Some update live (`onValueChange`) — e.g. padding uses `updateState` for the live preview and `commitState` on commit.--##### Panel: Layout (Webcam)--Only visible if a webcam video is present.--- **Preset** dropdown — `picture-in-picture` / `vertical-stack` / `dual-frame` / `no-webcam`. Some entries are filtered based on canvas aspect (e.g. vertical-stack only in portrait, dual-frame only in landscape). Switching presets also clears the saved PiP position unless the new preset is PiP.-- **Mirror Webcam** toggle — visible when preset ≠ no-webcam.-- **Shrink on Zoom (Reactive Webcam)** toggle + info-tooltip — only when preset = PiP. `dual-frame` / `vertical-stack` force it off and hide the control: their camera box is sized off the screen capture, so shrinking it mid-zoom would tear a hole in the block (`supportsWebcamReactiveZoom`).-- **Camera Shape** — four small icon-buttons (rectangle / circle / square / rounded), each rendered as an SVG glyph.-- **Webcam Size** slider — 10–50 %.--`dual-frame` ("Side by side") and `vertical-stack` ("Top / bottom") weld the screen and the camera into a single block, governed by three constraints (`computeCompositeLayout`, `block` branch):--1. **Screen keeps its ratio** — the screen box is always the capture's own aspect ratio, untouched.-2. **The block is contained in the scene** — screen + gap + camera contain-fit the (padded) scene whatever its ratio, so at padding 0 the block sits flush against the two edges its own ratio makes it reach.-3. **The camera tends toward square** — the camera shares the screen's cross-edge (same height beside it, same width under it, so they read as one solid block); its one free dimension is chosen to make the *block* match the scene's aspect ratio (perfect fill, no bars), then held within **[0.8, 1.25]** of square (`BLOCK_CAMERA_ASPECT_TOLERANCE`). So the camera fills when it can and only goes *slightly* rectangular — never a thin slice — when the scene ratio pulls it there.--There is no fixed split anymore: it falls out of those three constraints and adapts to both the capture ratio and the scene ratio. When the geometry allows a near-square camera that also fills the scene, both happen at once (e.g. a 4:3 capture top/bottom in a 9:16 scene → square camera, 100 % fill). Camera Shape and Webcam Size do not apply to either preset. The single tunable is the square tolerance.--Both halves are framed identically: the camera is always a **rectangle** with the *same* corner radius as the screen, whatever shape the user last picked under PiP. The mask picker is hidden here, but the setting survives — so the layout resolves the shape (`webcamRect.maskShape`) and the radius (`webcamRadiusFrac`) itself and every renderer, native compositor included, consumes those rather than the raw setting. Shipping the raw one is what used to let a circle chosen in PiP follow the user into Side by side and round the camera off into a disc, with the rounding changing depending on which shape happened to be stored.--**Every length crossing the native scene contract is a fraction, never a pixel count.** The compositor rasterises the preview into a small contain-fitted frame and the export at full output size, so "a pixel" means two different things on the two sides of that boundary — an absolute value crossing it silently becomes *render-target* pixels. Each quantity names its own reference: a corner radius is a fraction of **its own box's short side** (`screenRadiusFrac`, `webcamRadiusFrac`), so the rounding stays put when the box is resized; the Roundness slider, the drop shadows and the cursor are fractions of the **frame's short side**. The sliders stay in pixels for the user — the division happens once, in `buildSceneDescription`. This is not hygiene: absolute pixels crossing the contract are what drew the PiP circle as a shrunken blob in the preview while the export was correct, and what gave a 4K export a proportionally weaker shadow and a smaller cursor than a 1080p one.--The webcam bubble can also be dragged around the canvas (mouse-drag) — the position persists as `webcamPosition`.--##### Panel: Cursor--Only rendered when the recording includes editable cursor assets. Toggles:--- **Show Cursor** — master switch.-- **Clip to Canvas** switch + tooltip.-- **Cursor Style** — a strip of icon buttons, one per bundled theme (Default, Hello Kitty & Watermelon, Among Us Sus Knife & Red Animated, etc.). The first is always the default arrow.-- Four sliders: **Size** (0.5–10), **Smoothing** (0–1), **Motion Blur** (0–1), **Click Bounce** (0–5).--##### Panel: Timeline--A single switch — "Show Audio Waveform on Trim Track". Toggling enables/disables the audio peaks waveform background on the trim row (computed in a worker via `useAudioPeaks`).--##### Panel: Crop (modal)--Launched by the Crop icon. It's a centered modal with `max-w-5xl`, backdrop blur, dark background. Shows the current frame painted to a canvas with a draggable crop rectangle. Controls below the canvas:--- Numeric X/Y/W/H inputs (in pixels).-- **Ratio** dropdown: Free / 16:9 / 9:16 / 4:3 / 3:4 / 1:1 / 21:9. Selecting a preset re-runs the crop with the chosen aspect ratio and toggles the lock state.-- Lock/Unlock aspect toggle button (`Lock` / `Unlock` icons).-- "Done" button.--##### Panel: Export--Visible only in Export mode (the bottom-anchored icon in the rail). Layout:--- **Format toggle** — `MP4` / `GIF` segmented buttons.-- **Quality** (MP4 only) — three segmented buttons: 720p / 1080p / Source. Each button can show an "Upscale" sub-label when the source resolution is below the target. The Source button shows the source short side (e.g. `1080p`) as a sub-label.-- **GIF settings** (GIF only) — two segmented selectors side by side: Frame Rate (15/20/25/30 FPS) and Size (Med/Large/Orig). Below: live dimension readout, plus a **Loop GIF** toggle.-- **Save unsaved export** button — visible only when a previous export failed to write to disk; lets the user pick a location for the cached buffer.-- **Export Video** / **Export GIF** primary button (large, green, full width).--#### 5.5.3 Region-specific inspectors (replacing the right panel when something is selected)--##### Inspector: Selected zoom--- Header chip with the current effective scale (`1.25× / 1.5× / 1.8× / 2.2× / 3.5× / 5×`, or a custom decimal).-- Six depth buttons (same scales as above). Clicking sets depth and snaps the custom slider.-- Custom scale slider (1.0×–5.0×, step 0.01). Releasing commits.-- Focus mode (visible only when cursor telemetry exists) — Manual / Auto segmented toggle. Auto makes the camera follow the cursor. Disabled when the global "Auto-Focus all" toggle is on (locked).-- "Hold to preview zoom effect" button — press-and-hold to render the zoom in the preview at the current time; release reverts.-- Focus Position (visible when focus mode ≠ auto) — two numeric inputs X (%) and Y (%). 0 = leftmost/topmost, 100 = rightmost/bottommost.-- 3D Rotation — three buttons: Iso / Left / Right. Click toggles; click again to clear.-- **Delete Zoom** (red destructive button, full width).--##### Inspector: Selected trim--A single red destructive button "Delete Trim Region".--##### Inspector: Selected speed--- Header chip with the current speed (e.g. `1.5×`).-- Five-column grid of speed presets: 0.25×, 0.5×, 0.75×, 1.25×, 1.5×, 1.75×, 2×, 3×, 4×, 5×.-- Custom speed input — decimal text field; Enter or blur commits. Out-of-range (>16×) shows a toast "Speed can't go higher than 16×".-- **Delete Speed Region** button.--##### Inspector: Selected Full Camera--- Explanatory paragraph + **Delete region** button. The timing is edited by dragging the region's edges on the timeline; there is nothing else to tune.-- Full Camera is **not** a zoom of the webcam bubble: it hands the camera the whole frame. At full strength the camera rect is exactly the output frame — no margin, no padding, no corner radius, no mask shape, no drop shadow, and nothing of the composition (wallpaper, screen capture, cursor) left showing behind it (`computeCameraFullscreenRect`).-- Getting there is one lerp from the layout rect to `[0, 0, W, H]`, eased in at the region's start and out (over a longer window) at its end. The box changes aspect ratio along the way; every renderer cover-crops the camera into whatever box it is handed, so the image is never stretched by the animation.-- The mask dissolves through its own radius rather than popping: a circle mask already *is* a rounded rect at radius = half its (square) box, so flattening the shape to a rectangle on frame one and easing the radius to 0 carries every shape out continuously, with no per-shape branch. The PiP drop shadow fades out on the same curve.-- Reactive "shrink on zoom" is ignored for any frame where Full Camera is active — "shrink for the zoom" and "grow to full" in the same frame means nothing.--##### Inspector: Selected annotation (`<AnnotationSettingsPanel>`)--Top-level tabs: **Text** / **Image** / **Arrow**.--- **Text** tab: a textarea (5 rows) for the text content, then a 2-column block for:- - Font Family (selectable from 24 built-in families grouped by category: Classic, Editor, Strong, Typewriter, Deco, Simple, Modern, Clean, plus named families like Inter, Plus Jakarta Sans, Space Grotesk, DM Sans, Sora, Manrope, IBM Plex Sans/Serif/Mono, Playfair Display, Merriweather, Lora, Bebas Neue, Oswald, Caveat, Permanent Marker, Fira Code, plus any user-added custom fonts).- - Font Size (selectable from `[12, 14, 16, 18, 20, 24, 28, 32, 36, 40, 48, 56, 64, 72, 80, 96, 128]`).- - "Add Custom Font" button → opens `<AddCustomFontDialog>`: paste a Google Fonts `@import` URL and a display name; on success the font appears in the picker and is auto-applied.- - Text Animation (selectable from: None, Fade, Rise, Pop, Slide Left, Typewriter, Pulse).- - Formatting toggle group (Bold / Italic / Underline) — single button per state.- - Alignment toggle group (Left / Centre / Right).- - Text Color (Block + palette popover).- - Background Color (Block + palette + clear-to-transparent).-- **Image** tab: a hidden file input + a tall **Upload Image** button. On success, the image is shown as a preview. Supported: JPG, PNG, GIF, WebP. The text content is replaced with the data URL.-- **Arrow** tab (figure annotations): an 8-button grid of arrow directions (Up, Down, Left, Right, Up-Right, Up-Left, Down-Right, Down-Left). Below: Stroke Width slider 1–6, and an arrow Colour block-picker.--Footer of the annotation inspector: **Duplicate** (copies the region with a slight offset) and **Delete Annotation** (red destructive).--##### Inspector: Selected blur (`<BlurSettingsPanel>`)--Only enabled when the `BLUR_REGIONS_ENABLED` flag is on.--- Shape selector (Rectangle / Oval) — two big icon-buttons.-- Colour selector (White / Black).-- **Mosaic Block Size** slider 4–48 px (display: "X px").-- **Delete Annotation** button.--#### 5.5.4 Timeline--A full-width, full-height panel with a fixed toolbar at the top and a `dnd-timeline`-powered canvas underneath.--##### Toolbar--A single rounded "pill" group containing:--- **+ Zoom** (`ZoomIn` icon, green hint) — adds a zoom region at the playhead.-- **Wand (Auto Zoom)** (`WandSparkles` icon) — toggle. When ON, fresh recordings auto-get suggested zoom regions based on cursor dwell moments. Click again to remove auto-generated zooms.-- **ScanEye (Auto-Focus All)** — toggle. When ON, every zoom follows the cursor; per-zoom focus-mode selectors lock.-- **Scissors (Trim)** — adds a trim region at the playhead. Tooltip "Press T to add trim".-- **Speech bubble (Annotation)** — adds a text annotation at the playhead. Tooltip "Press A to add annotation".-- **Blur icon** (when blur is enabled) — adds a blur region at the playhead. Tooltip "Press B to add blur region".-- **Gauge (Speed)** — adds a speed region at the playhead. Tooltip "Press S to add speed".-- **Captions (waveform-with-text icon)** — opens the Auto Captions dialog. Disabled while a transcription is in flight or when no video URL is available.--Right of the toolbar:--- **Aspect Ratio dropdown** (`ChevronDown` icon + current label) — opens a dropdown menu listing `16:9 / 9:16 / 1:1 / 4:3 / 4:5 / 16:10 / 10:16 / Original (native)`. The check shows the active one. Selecting a portrait/landscape-incompatible webcam preset swaps it back to PiP.-- **Scroll / Ctrl+Scroll hints** — small kbd-style hints for panning/zooming the timeline.--##### Timeline body--A scrollable region containing:--- **Time axis** at the top: major markers (with `m:ss` or `h:mm:ss` labels, fractional digits adapt to zoom) plus minor ticks (5 per major). The current time marker is highlighted in green.-- **Playback cursor**: a vertical purple line (`#6C55FF`) with a diamond handle at the top. Drag it to scrub; it auto-pans the timeline when dragged past either edge and snaps to keyframes within 150 ms. A floating tooltip shows the live time while dragging.-- **Five lanes (top to bottom)**:- - **Zoom** (`Press Z to add zoom` hint when empty) — glassy green blocks. Hover/select reveals the scale (`1.8×`) and a "cursor-follow" indicator when `focusMode === auto`.- - **Trim** (`Press T to add trim`) — glassy red blocks. When "Show Audio Waveform on Trim Track" is on, the row's background is a canvas-drawn waveform (computed by an audio-peaks worker).- - **Annotation** (`Press A to add annotation`) — glassy yellow blocks, labelled with the text preview (truncated to 20 chars + ellipsis), "Image" for image type, or "Annotation" fallback.- - **Blur** (`Press B to add blur region`, only if BLUR_REGIONS_ENABLED) — same yellow glass with the prefix "Blur".- - **Speed** (`Press S to add speed`) — glassy amber blocks, labelled `1.5×` etc.--Each block has invisible left/right resize caps (8 px wide, cursor `col-resize`) and a floating tooltip that shows `startMs – endMs` during drag/resize. A 2px amber snap guide appears when an edge is within the snap threshold of another region, playhead, or keyframe.--On drag/resize:--- The drag/resize preview is computed without committing until pointer-up.-- Snap targets are other zoom/trim/speed edges (hard push), annotation/blur edges (soft pull only), playhead, keyframes, 0, total duration.-- Overlap with same-kind regions is clamped to neighbours and rejected if still overlapping.-- Snap threshold scales with zoom (~1% of visible range, minimum 50 ms).--**Keyframes** can be added via the configured shortcut. They render as small yellow diamonds at the top of the timeline (rotated 45°). Click selects, drag moves (clamped to `[0, totalMs]`), `Delete`/`Backspace` removes.--**Zoom controls**:--- **Mouse wheel** — pans horizontally. Auto-pan stops when the timeline is already fully visible.-- **Ctrl/Cmd + Scroll** — zooms in/out (resize the visible range while keeping the cursor anchored).--**Click on empty timeline area** — clears any region selection and seeks to the click X.--**Tab** (when the playhead overlaps multiple annotations) — cycles through overlapping annotations, ordered by `zIndex`. **Shift+Tab** cycles backwards.--### 5.6 Auto Captions dialog--Triggered from the timeline's Captions button. Modal dialog (`max-w-md`):--- Title "Auto captions".-- Description: "Choose roughly how many words each caption shows at once. Timing is spread across the words in that phrase."-- Two labelled selects:- - **Minimum words per caption** — 1–12.- - **Maximum words per caption** — 1–12 (kept ≥ min).-- **Cancel** / **Generate** buttons.--While generating, a single Sonner toast keeps updating with phases: "Generating captions from audio…" → "Loading speech model (first use downloads ~75 MB)…" → "Transcribing speech…". On success: "Added N captions." If truncation occurred: "Only the first 240 minutes were transcribed." If nothing was heard: "No speech was detected." If the video has no audio: "This video has no usable audio to transcribe."--Captions are inserted as text annotations with `annotationSource: "auto-caption"`. Edits to one auto-caption's style/position are mirrored onto all its siblings.--### 5.7 Export flow--1. User picks **MP4** or **GIF** in the export panel and hits **Export Video** / **Export GIF**.-2. The editor calls `pickExportSavePath(fileName, getExportFolder())` to open a native save dialog. If the user cancels, the flow stops.-3. The export modal opens (`<ExportDialog>`):- - Centred rounded modal with the project icon, title (`Exporting Video`/`Exporting GIF`), subtitle "This may take a moment…".- - A progress block:- - Header row: "Rendering Frames" (or "Compiling" once frames are done) on the left, percentage on the right.- - A horizontal progress bar — green with a glow; during the indeterminate compile phase it slides left-to-right.- - Two info cards: "Format" / "Status" and "currentFrame / totalFrames".- - **Cancel Export** red destructive button.- - On success, the modal transitions to "Export Complete", showing the file basename and a **Show in Folder** button. A 2-second timer auto-closes the dialog.- - On error, the title becomes "Export Failed", a red error block appears with the diagnostic message (Reason / Source / Output dims / fps / Codec / Bitrate / `VideoEncoder` availability), and the **Show in Folder** button is gone.-4. A separate Sonner toast also fires: "Video exported successfully" / "GIF exported successfully", with the file path as description and a **Show in Folder** action. The last-used folder is persisted to `userPreferences.exportFolder`.-5. If the write-to-disk step fails but the encode succeeded, the encoded buffer is cached (`unsavedExport`) and a big purple **Choose Save Location** button appears in the export panel until the user saves or starts another export.--### 5.8 Save / Save As / Load / New--- **Save Project** writes the project (`.openscreen` JSON) via the native save dialog. If the project already has a path, it saves in place. On success, the unsaved-changes flag clears and a toast appears: "Project saved to <path>". On cancel: "Project save canceled". On error: "Failed to save project".-- **Save Project As** always prompts for a new path.-- **Load Project** opens a native file picker, then re-applies the project in the editor.-- **New Project** clears the current video path, resets all undoable and non-undoable editor state, and returns to `<EditorEmptyState>`.-- Any of New / Load initiated with unsaved changes opens `<UnsavedChangesDialog>` with three buttons: **Save & New/Load Project**, **Discard & New/Load Project**, **Cancel**.--### 5.9 Closing the window--Closing the editor window while unsaved-changes is true triggers `<UnsavedChangesDialog>` (`close` variant) with **Save & Close** / **Discard & Close** / **Cancel**. Choices route back to the main process via `sendCloseConfirmResponse("save" | "discard" | "cancel")`.--### 5.10 Keyboard shortcuts (global)--Configurable from the `?` icon next to each panel header (opens `<ShortcutsConfigDialog>`):--| Action | Default | Configurable? |-|---|---|---|-| Open App (global) | `Ctrl/Cmd + Shift + O` | ✅ |-| Add Zoom | `Z` | ✅ |-| Add Trim | `T` | ✅ |-| Add Speed | `S` | ✅ |-| Add Annotation | `A` | ✅ |-| Add Blur (when enabled) | `B` | ✅ |-| Add Keyframe | `K` | ✅ |-| Delete Selected | `Del`/`⌫` | ✅ |-| Play / Pause | `Space` | ✅ |-| Copy Selected Region attributes | configurable | ✅ |-| Paste Region attributes | configurable | ✅ |-| Undo | `Ctrl/Cmd + Z` | fixed |-| Redo | `Ctrl/Cmd + Shift + Z` / `Ctrl/Cmd + Y` | fixed |-| Cycle Annotations Forward | `Tab` | fixed |-| Cycle Annotations Backward | `Shift + Tab` | fixed |-| Delete Selected (alt) | `Del` / `⌫` | fixed |-| Frame Back / Forward | `←` / `→` (60 FPS step, ~16.67 ms) | fixed |-| Pan Timeline | `Shift + Ctrl + Scroll` | fixed |-| Zoom Timeline | `Ctrl + Scroll` | fixed |--The Customise Shortcuts dialog lets the user click a row, press a new binding; conflicts show a swap / cancel action. Reserved (fixed) shortcuts show an error toast: "This shortcut is reserved for 'X' and cannot be reassigned." A "Reset to defaults" button restores everything.--A `?` HelpCircle icon in every settings panel header reveals the shortcut cheat sheet (groups: Configurable, Fixed) on hover, with a link to the customize dialog.-------## 6. Toasts (Sonner)--Mounted once at the app root. Two main styles:--- **Success/info**: dark green icon, brief text.-- **Error**: red icon, title + optional description.--Frequently used messages:--- Recording error notifications (see §2.5).-- Auto-caption lifecycle (see §5.6).-- Project save/load outcomes.-- Export outcomes.-- Copy/Paste of region attributes ("Zoom attributes copied" / "Zoom attributes pasted").-- "No speech was detected." / "Could not generate captions."-- Speed range error "Speed can't go higher than 16×".-- Region placement errors when the cursor sits inside another region (toast with description).--Each toast supports an `action` button (e.g. "Show in Folder" on export success).-------## 7. Settings / Preferences persisted--Stored in `localStorage["openscreen_user_preferences"]`:--- `padding` (number 0–100)-- `aspectRatio` (one of the 8 valid aspect ratios)-- `exportQuality` (`medium` / `good` / `source`)-- `exportFormat` (`mp4` / `gif`)-- `exportFolder` (string path)-- `projectFolder` (string path)-- `trayLayout` (`horizontal` / `vertical`)--The renderer also calls into the main process for:--- `saveShortcuts` / `updateGlobalShortcut` (Open App key).-- `revealInFolder(path)` — used after export and on the unsaved-export button.-- `pickExportSavePath`, `writeExportToPath` (file system writes).-- `loadProjectFile` / `loadProjectFileFromPath` / `saveProjectFile` / `loadCurrentProjectFile` / `setCurrentVideoPath` / `clearCurrentVideoPath` — project persistence.-- `getSources` / `selectSource` / `getSelectedSource` / `onSelectedSourceChanged` / `onSourceSelectorClosed` — source picker.-- `showCountdownOverlay` / `hideCountdownOverlay` / `onCountdownOverlayValue` — countdown window.-- `startNativeWindowsRecording` / `pauseNativeWindowsRecording` / `resumeNativeWindowsRecording` / `stopNativeWindowsRecording` / `startNativeMacRecording` / `pauseNativeMacRecording` / `resumeNativeMacRecording` / `stopNativeMacRecording` / `isNativeWindowsCaptureAvailable` / `isNativeMacCaptureAvailable` / `requestNativeMacCursorAccess` / `attachNativeMacWebcamRecording` — native recorder pipeline.-- `getCurrentRecordingSession` / `setCurrentRecordingSession` / `setHasUnsavedChanges` / `onRequestSaveBeforeClose` / `onRequestCloseConfirm` — session handoff between recorder and editor.-- `setHudOverlaySize` / `beginHudOverlayDrag` + `dragHudOverlayTo` + `endHudOverlayDrag` / `setHudOverlayIgnoreMouseEvents` — HUD geometry.-- `requestScreenAccess`, `requestCameraAccess`, `openExternalUrl`, `openVideoFilePicker`, `readBinaryFile`, `saveDiagnostic` — utilities.-------## 8. i18n--- 13 locale JSON files under `src/i18n/locales/<locale>/` (en, ar, es, fr, it, ja-JP, ko-KR, pt-BR, ru, tr, vi, zh-CN, zh-TW) plus a top-level `common.json` shared across them.-- Each translation namespace: `common`, `launch`, `editor`, `settings`, `timeline`, `dialogs`, `shortcuts`.-- `<I18nProvider>` runs on app boot, detects a system-language suggestion (e.g. `zh-CN` on a Chinese machine) and prompts the user to switch via the system-language prompt. After resolution, the prompt never reappears for the same locale pair.-- All UI strings go through `useScopedT("namespace")`; the locale is read by both the renderer and the Electron main process (`electron/i18n.ts`), so menu items stay in sync.-------## 9. Status summary--If you want a one-paragraph mental model: OpenScreen's front-end is two cooperating surfaces — a **HUD overlay** that captures content (sources, audio, mic, webcam, cursor mode, record/stop/pause/restart/cancel, language, tray layout, minimised window) and a **Studio editor** built around a resizable preview + inspector + timeline that lets the user cut, zoom, speed-change, annotate, blur, theme the cursor, set background/wallpaper/padding/shadow/border-radius/motion-blur, aspect-ratio, crop, layout the webcam (PiP/double/side-by-side/no-webcam), draw auto-captions from audio, save/load `.openscreen` projects, and export to MP4 (720p/1080p/Source) or GIF (15–30 fps, three sizes, optional loop) — all keyboard-driven, fully undoable, with a per-region Copy/Paste clipboard, customisable shortcuts, and 13 locales.\ No newline at end of filediff --git a/technical-documentation/_harvest/poc-d3d-HANDOFF.md b/technical-documentation/_harvest/poc-d3d-HANDOFF.mddeleted file mode 100644index 76743aa67..000000000--- a/technical-documentation/_harvest/poc-d3d-HANDOFF.md+++ /dev/null@@ -1,163 +0,0 @@-# Passation de contexte — poc-d3d (compositeur natif D3D11)--Document d'onboarding pour un agent qui reprend ce travail. Complète le-[README](README.md) (orienté build/usage) et la spec-[`docs/architecture/rendering-architecture.md`](../docs/architecture/rendering-architecture.md)-(source de vérité, annexe D). Écrit le 2026-07-18.-------## 1. En une phrase--`poc-d3d/` est un **POC natif Windows écrit de zéro** qui compose deux sources vidéo-D3D11 **zéro-copie GPU** avec 9 effets HLSL, encode en H.264 matériel, et se mesure en-fps de C0 (décode+encode nu) à C8 (tous effets). Il est le **fast-path natif RETENU**-d'OpenScreen : mesuré **~126 fps** en 1080p60 tous-effets, au-dessus du web (79) et du-POC wgpu (48–68), **sans interop Vulkan bloquée** (le driver AMD la gate).--## 2. Où tout se trouve--| quoi | où |-|---|---|-| Repo | `getopenscreen/openscreen` (remote `origin`). Forks : `contributor`=SakuraiSatoru, `gede`=gede-cahya. |-| Branche | `claude/openscreen-rendering-architecture-b2a670` (suit `origin`). **Ne jamais toucher `main`.** |-| Worktree local | `repos/openscreen/.claude/worktrees/pr-11-closure-5b322b/` |-| Ce POC | `poc-d3d/` (à côté de `poc/` = web, `poc-native/` = wgpu) |-| Spec / décision | `docs/architecture/rendering-architecture.md`, **annexe D** (D.6 = ce POC, marqueur de décision ; D.7 = cross-platform) |-| Docs du POC | `poc-d3d/docs/` = parcours **S0→S6** (voir §9 ci-dessous) |-| Source POC d'origine | `C:\Users\camil\Documents\spike-native\` (repo standalone d'origine, même code + gros artefacts déjà buildés — pratique pour re-mesurer vite) |--Commits sur la branche : `64360ea4` (poc-d3d), `9be8a21d` (doc). Les deux poussés sur origin.--## 3. La décision architecturale (et pourquoi)--**Trois POC de rendu, une décision "exploration → décision" :**-- `poc/` (web, WebCodecs + WebGPU) = **hôte de lancement portable**, 79 fps partout. Reste le défaut d'expédition (§12 de la spec).-- `poc-native/` (Rust + wgpu/Vulkan) = **preuve de portabilité** (le compositeur WGSL tourne natif à l'identique) + carte des coûts. MAIS chemin CPU-transport plafonné à 48–68 fps, et zéro-copie Vulkan **bloqué** (driver AMD sans `VK_KHR_video_maintenance1`).-- `poc-d3d/` (ce POC) = **fast-path natif retenu**. La correction clé de D.6 : la GPU-résidence était toujours le bon principe ; seule la *route* était fausse. `D3D11VA` (décode) + `AMF` (encode) sont les chemins D3D-natifs d'AMD, ne demandent **aucune** extension Vulkan Video, donc atteignent la pleine résidence GPU **sur le driver actuel** où Vulkan ne peut pas.--**Stack par défaut = D3D11 nu** (pas de framework). La R&D S0 a instruit et écarté, chacun sur un critère + un fait (`docs/S0-frameworks.md`) : libavfilter Vulkan (K2 ✗, `hwmap` d3d11↔vulkan = ENOSYS), Direct2D (passe K2 mais contredit "effets écrits depuis les maths"), GStreamer (possède la boucle → §10, compositeur fixed-function), wgpu (ne paie que la portabilité, hors périmètre). D3D11 nu gagne : contrôle total, zéro couche entre la mesure et le GPU.--## 4. Le pipeline (zéro-copie de bout en bout)--```-demux → décode D3D11VA (×2 sources, NV12 GPU) → compositeur HLSL (RT RGBA)- → RGB→NV12 (2 passes RTV) → encode h264_amf (GPU→GPU) → mux MP4-```--Un seul `ID3D11Device` partagé (feature level 11_1, flag `VIDEO_SUPPORT`,-`SetMultithreadProtected(TRUE)`), injecté dans le décodeur ffmpeg via-`AVD3D11VAFramesContext`. Seul le bitstream encodé descend en RAM. Textures décodeur-rendues échantillonnables via `BindFlags |= SHADER_RESOURCE` (§5).--## 5. La stack technique--- **Rust + `windows-rs`** (D3D11, DXGI, Fxc pour compiler le HLSL au runtime).-- **ffmpeg `libav*` LGPL** (demux / décode D3D11VA / encode `h264_amf` / mux). Bindings- générés par **`bindgen`** sur les headers 8.x (choix vs `ffmpeg-next` qui ne suit que 7.x)- + **shim C** (`shim.c`) pour les structs que bindgen rend opaques (`AVFormatContext`).-- **Compositeur HLSL** maison (`src/shaders.hlsl`), effets écrits depuis les maths.-- Modules : `d3d.rs` (device), `pipeline.rs` (Decoder, run_c0/run_composited, encode+mux),- `compositor.rs` (rendu+effets+timeline anim), `cursor.rs` (parse .cursor.json),- `config.rs` (cfg cumulatives C0..C8), `ffi.rs` (bindings), `main.rs` (runner CLI).-- **Toolchain** : Rust msvc, Visual Studio (MSVC + Windows SDK), LLVM (libclang, pour- bindgen), build ffmpeg LGPL-shared BtbN dans `thirdparty/` (non versionné).--## 6. Les 9 effets (tous dans les vidéos encodées)--padding + background · **background flouté** (dual-Kawase) · masques rounded-corner (SDF)-sur les 2 sources · **ombres portées** (pénombre SDF) sur les 2 · **layout animé** A(PIP)↔B(côte-à-côte)-· **zooms** (1.0→1.8→1.0) · **flou de mouvement** par vélocité (zoom+layout) · **curseur custom**-dot+ring + flou de mouvement + **click bounce** (depuis `.cursor.json`).--## 7. Résultats mesurés (release, protocole §C.2)--Config cumulative, fps end-to-end (demux→…→mux), une lecture d'horloge avant/après tout le run :--```-C0 239 décode+encode nu C5 125 +zoom-C1 151 +composite 2 sources C6 133 +layout animé-C2 151 +coins arrondis C7 133 +curseur-C3 140 +ombres C8 126 +flou de mouvement (tous effets)-C4 131 +fond flouté-```--- **Headline : C8 (tous effets) ~126 fps** (médiane 125.9, spread 11.8 % → admissible),- confirmé au protocole (interleavé vs C0, tour de chauffe jeté, régime **soutenu** — pas- un transitoire de boost à froid, qui monte à ~240 mais ne tient pas sous export répété).-- **Direction thermiquement robuste** : les absolus dérivent (iGPU passif boost/throttle),- mais à *chaque* état mesuré, tous-effets bat web (79) et wgpu (48–68), plancher bridé inclus.--## 8. Ce que la mesure des moteurs GPU a établi (externe, non intrusif)--Via compteurs Windows `\GPU Engine\Utilization` (sans élévation, sans instrumenter le process) :--- **Le goulot glisse avec la charge** : configs légères = **encode-bound** (moteur video codec ~71 %),- configs lourdes = **composite-bound** (moteur 3d ~84 %). Le **décode ne borne jamais** (~2 ms bursty).-- **Les moteurs se recouvrent déjà** (3d 84 % + codec 61 % = 145 % > 100 % sur la même fenêtre) :- le GPU pipeline décode/composite/encode entre frames tout seul, malgré une boucle CPU sérielle.- → **Un pipeline CPU multi-thread n'apporterait ~rien** (confirmé par un cache SRV resté sans effet).- C'est le **jumeau natif de l'annexe C.3** (pipelining de l'encodeur PERD sur cet iGPU : bus mémoire- partagé → le recouvrement force la contention de bande passante).-- **Plafond dur = l'encodeur VCN (~210 fps, fixed-function)** : `-quality speed` ne gagne que +2 %.- Le composite est le **seul terrain optimisable** sur les configs lourdes.--## 9. Optimisations faites (méthode : mesure → optim ciblée → re-mesure)--1. **Cache SRV** (par texture/slice) — **aucun gain** → confirme qu'on est GPU-bound, pas CPU-bound.- Gardé (correct, utile à plus haute réso).-2. **Flou de mouvement : supersampling temporel N=6 → flou directionnel par vélocité** — 23 → 104 fps.- Le shader floute le long de `uv(f)−uv(f−1)` par pixel (translation + zoom), early-out si immobile.-3. **Fond flouté : gaussien 49-tap → dual-Kawase** (chaîne down/up 5–8 taps) — C8 104 → 126 fps.- Profite à C4–C8 (toutes ont le fond flouté). Qualité équivalente (fond isotrope doux).--## 10. Discipline de mesure — à respecter--- **Chrono §10 = UNE lecture d'horloge avant / une après**, enveloppant tout le run- (`Instant::now()`, mappe QPC). Jamais instrumenté. Les sondes par-passe/par-moteur vont dans un- **mode séparé** (les compteurs GPU externes ci-dessus jouent ce rôle — jamais dans le chrono headline).-- **Comparaison** = A/B interleavé, **1 tour de chauffe jeté**, **VOID si spread intra-bras > ~15 %**.-- **Optimiser TOUTES les configs C0→C8** (le chemin commun décode/encode lève toute la table),- pas une ligne isolée.-- Build **`--release`** (LTO, `debug_assertions` off) pour tout run mesuré. Pas de `println!`/alloc par frame.-- Piège vécu : la machine chauffe après des runs en rafale → spreads 15–25 %. Pour un chiffre absolu- fiable, viser GPU froid / secteur ; sinon s'appuyer sur la **direction** (robuste) plutôt que l'absolu.--## 11. Pièges / gotchas (déjà résolus — ne pas re-payer)--- **ffmpeg = build LGPL** (BtbN `*-lgpl-shared`), pas le gyan système (GPL → K1 ✗ pour app MIT). Garde D3D11VA + AMF.-- **bindgen rend opaques les structs atteintes seulement par pointeur** (`AVFormatContext` → `_address:u8`) → shim C pour `streams[]`/`pb`.-- **enums bindgen = modules** : `ffi::AVPixelFormat::AV_PIX_FMT_D3D11`, etc. **AVERROR non générés** → `EAGAIN=-11`, `EOF=-541478725`.-- **device donné à ffmpeg** : il le `Release` au teardown → lui donner un +1 via `std::mem::forget(gpu.device.clone())`.-- **NV12 + RENDER_TARGET refusé en texture ARRAY** (E_INVALIDARG) sur cet iGPU → rendre dans une NV12 simple puis `CopySubresourceRegion` vers le pool encodeur (bind DECODER|SHADER_RESOURCE).-- **`D3D11_BLEND_DESC::default()` a WriteMask=0** (rien écrit) → forcer `COLOR_WRITE_ENABLE_ALL`.-- **Ordre RTV/SRV** : basculer le render target AVANT de binder une ressource en SRV (sinon D3D11 rejette le SRV).-- **Webcam réelle openscreen = H.264 Baseline (cs1=0)** → refusée par D3D11VA (`No decoder device`), retombe en software SANS erreur. La fixture utilise deux flux screen (CBP cs1=1) pour éviter ça ; à la capture, exiger `constraint_set1_flag=1` ou Main/High.-- **Surface décodeur alignée macrobloc** (1080→1088, 1032→1040) : corriger dans les UV.-- **Sources BT.709 limited** (mesuré, non taggé) — une seule matrice NV12→RGB.-- **Repo openscreen : hook husky/biome pre-commit** formate les `.json`/`.ts` au style repo (tabs). Ne pas contourner (`--no-verify`) — formater le fichier (`node_modules/.bin/biome format --write`).--## 12. Build & run--```-# déposer le build ffmpeg LGPL-shared BtbN dans poc-d3d/thirdparty/ (voir README)-x.bat run --release -- --fixture fixture --cfg C0..C8 --repeat 3 --out out/-```-`x.bat` = vcvars + ffmpeg/bin sur PATH + cargo. Produit `out/C{0..8}.mp4`, PNG f60/180/300, `report.json`.-La **fixture média est non versionnée** (convention des POC) — régénération dans `docs/S1-sources.md`-(commandes `ffmpeg -ss … -t 6 -c copy`, sources dans `%APPDATA%\openscreen\recordings`).--## 13. Ce qui reste ouvert (threads pour la suite)--- **Mode `--profile detail` interne** (queries GPU timestamp par passe, anneau 4 frames, DONOTFLUSH) :- non construit. La question "décode/composite/encode share + serial/parallel" a été répondue **en- externe** (compteurs moteurs, §8) — le détail interne resterait diagnostic (RGP recommandé de toute façon).-- **Compositing en espace linéaire** : on compose en gamma (RT `UNORM`, pas `UNORM_SRGB`). Flou/blend- légèrement faux (halos). Gain **qualité**, pas vitesse. Écart au spec assumé.-- **Cross-platform** (D.7) : 1 compositeur + 1 couche codec ffmpeg + 3 bridges zéro-copie (Windows =- texture D3D11 partagée ✓ fait ; Linux = dma-buf ; macOS = IOSurface). Le bridge Windows pourra passer- à Vulkan quand les drivers AMD mûriront, sans toucher compositeur ni ffmpeg.-- **Laptops hybrides** (iGPU+dGPU) : si décode/composite/encode atterrissent sur des adaptateurs- différents, la copie cross-adaptateur casse le zéro-copie. À détecter + épingler sur un adaptateur.-- **Encodeur** : le plafond VCN est le mur. Segment-parallèle sur plusieurs GOP (plusieurs instances- d'encodeur, pas une file plus profonde) est la seule piste, marginale aux ceilings actuels.diff --git a/technical-documentation/_harvest/poc-d3d-stages/S0-frameworks.md b/technical-documentation/_harvest/poc-d3d-stages/S0-frameworks.mddeleted file mode 100644index 5c4100cec..000000000--- a/technical-documentation/_harvest/poc-d3d-stages/S0-frameworks.md+++ /dev/null@@ -1,87 +0,0 @@-# S0 — R&D frameworks / moteurs de rendu--Décision *build vs. build-on*, position par défaut à réfuter : **D3D11 nu**. Un framework n'est adopté que s'il **gagne sur un critère éliminatoire** (K1/K2/K3), jamais sur le confort.--Machine : Ryzen 5 7520U / Radeon 610M (Vulkan `0x1506`) · Windows 11 · ffmpeg 8.1.2-full · MSVC 14.51 (VS18 Insiders) + Windows SDK 10.0.26100.--Critères : **K1** licence MIT-compat · **K2** interop zéro-copie DXVA/D3D11 ↔ AMF/MF · **K3** point d'extension shader (flou/ombre/masque/coins) · P1 contrôle boucle+synchro · P2 multiplateforme ultérieur · P3 poids build/dépendances.-------## DÉCISION : `D3D11 nu` (windows-rs)--La stack par défaut du §2 est confirmée. **Aucun candidat ne fait basculer un critère éliminatoire** que D3D11 nu échoue. Rust 1.97.1 (msvc) installé, S1 a déjà prouvé la chaîne D3D11VA→AMF zéro-copie : le défaut fait tout le chemin, sans couche entre la mesure et le GPU (« le critère qui compte ici et nulle part ailleurs », §3).--Motifs d'élimination / non-adoption, chacun un critère + un fait :--- **libavfilter Vulkan — K2 ✗.** `hwmap` d3d11↔vulkan = `ENOSYS` ; seul le readback marche.-- **Direct2D — non adopté.** Passe K2 (BGRA) mais ne bat aucun critère du défaut, et son unique gain (E3/E4 natifs) contredit la prémisse §1/§2 « effets réécrits depuis les maths ». NV12 non ingéré. Gardé en échappatoire (ne possède pas la boucle, P1 intact).-- **GStreamer — non instruit, motivé.** (a) P1 : possède la boucle et la synchro → frontalement opposé au cœur méthodologique du §10 (mesurer *notre* soumission/attente). (b) K3 : `d3d11compositor` est fixed-function ; un shader custom impose un fork → défait le seul argument (« sur étagère »). Deux faits structurels, pas un README. Réversible : si P2 devenait éliminatoire, réinstruire par un pipeline `gst-launch`.-- **wgpu — non instruit, motivé.** Ne paie que P2 (portabilité), **pondéré, pas éliminatoire**, et hors périmètre d'un POC Windows-only jetable (§1). Son interop K2 (shared NT handle + fence) ajouterait précisément la couche de synchro entre la mesure et le GPU que le §3 dit de fuir. Décision produit prise (2026-07-17) : cross-platform hors scope → non instruit.--> Conformément au §3 : « Si la décision reste D3D11 nu, cette section n'a pas été inutile : elle a coûté quelques commandes et acheté le droit de ne plus se poser la question. »-------## Grille--| candidat | K1 | K2 | K3 | statut | tranché par |-|---|---|---|---|---|---|-| **D3D11 nu** (windows-rs) | ✅ | ✅ | ✅ | **référence — à battre** | position par défaut (S1 a déjà prouvé la chaîne D3D11VA→AMF zéro-copie) |-| libavfilter Vulkan | ✅ | **✗** | ✅ | **ÉLIMINÉ** | spike : `hwmap` d3d11↔vulkan = `ENOSYS` |-| Direct2D / DirectComp | ✅ | ✅ | ✅ | **non adopté** (voir motif) | spike compilé : K2 ok, mais contredit §1/§2 |-| GStreamer | ✅ | ? | ? | à instruire | non installé |-| wgpu | ✅ | ? | ✅ | à instruire | attend Rust (install en cours) |-| Skia / Vello | ✅ | ? | ✗(Vello) | reporté | pré-jugé faible ratio coût/info (§3) |-| libobs, MLT/Olive/VSE, moteurs de jeu | ✗/P1 | — | — | éliminés d'office | GPL (K1) ou boucle non maîtrisée (P1) |-------## 1. libavfilter Vulkan — ÉLIMINÉ (K2 ✗)--**Question §3 :** le `hwmap` d3d11va→vulkan sans copie existe-t-il sur cet iGPU, ou faut-il le `hwdownload,format=nv12,hwupload` qu'on fuit ?--**Spikes (ffmpeg 8.1.2, Vulkan présent : AMD Radeon 0x1506) :**--```-vulkan=vk@d3d (dériver vulkan depuis d3d11) -> Device creation failed: -40 (ENOSYS)-d3d11va=d3d@vk (dériver d3d11 depuis vulkan) -> -40 (ENOSYS)-opencl=ocl@vk (contrôle) -> -40 (ENOSYS)-hwmap d3d11->vulkan (devices indépendants) -> "Failed to configure output pad", -40-```--Le filtre lui-même **fonctionne** (chemin readback : `gblur_vulkan` fait chuter la netteté 9,75 → 1,46). Le seul maillon manquant est l'**interop zéro-copie** : ffmpeg n'implémente les maps Vulkan que pour vaapi/cuda/drm, **pas d3d11** — trou upstream, pas limite de l'iGPU.--> **Fait + critère :** alimenter les filtres Vulkan depuis le décodeur D3D11VA impose `hwdownload…hwupload`, c'est-à-dire le round-trip RAM que le POC existe pour supprimer. **K2 ✗.** Exactement ce que le §3 soupçonnait, confirmé par commande.--## 2. Direct2D / DirectComposition — NON ADOPTÉ (passe K2, mais contredit le §1/§2)--**Question §3 :** effets natifs Gaussian Blur / Shadow de qualité, interop D3D11 sans friction ?--**Spike compilé** (`spikes/d2d_probe.cpp`, MSVC + Windows SDK) :--```-d3d11_device=ok feature_level=0xB100 (= 11_1, exactement §2)-k2_d2d_shares_d3d11_device=ok (ID2D1Device sur le MÊME ID3D11Device)-sharp_source=127.25-e3_gaussian_blur=ok sharp_after=0.28 ratio=0.002 (Gaussian natif : /500 de netteté)-e4_shadow=ok (Shadow natif)-```--K2 ✅ **en BGRA** : les textures D3D11 sont emballées en `ID2D1Bitmap1` via `IDXGISurface` sur le device partagé — **zéro copie**. Et D2D **supprimerait E3+E4** (les deux effets coûteux) via `CLSID_D2D1GaussianBlur` / `CLSID_D2D1Shadow`.--**Nuance NV12 (le format réel du décodeur) :** emballer une texture `DXGI_FORMAT_NV12` en bitmap D2D échoue dans le probe — `nv12_as_d2d_bitmap=fail hr=0x88982F80` (`WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT`). D2D prend donc le BGRA sans friction mais **pas la sortie NV12 du décodeur telle quelle** : le chemin D2D-effets imposerait une conversion couleur en amont. Ça n'infirme pas K2 (le partage de device est prouvé) mais ça érode encore le « supprime du travail ».--> **Motif de non-adoption (critère + fait) :** Direct2D ne fait basculer **aucun** critère éliminatoire que D3D11 nu échoue — le défaut passe K1/K2/K3 par construction. Son seul gain est « supprimer E3/E4 », or le §1/§2 posent que **les effets sont réécrits depuis les maths** : c'est la raison d'être du POC (isolation de l'ancien paradigme). Adopter le Gaussian natif violerait cette prémisse.->-> **Conservé comme échappatoire :** contrairement à GStreamer, D2D est une **bibliothèque** appelée sur notre propre device et notre propre boucle — il **ne possède ni la boucle ni la synchro** (P1 intact, §10 non menacé). Donc utilisable ponctuellement en S4 si le Gaussian séparable maison sous-performe, et sert de référence de qualité connue. Décision reportée à S4, pas un blocage.--## 3. À instruire--- **wgpu** (P2, « paie la suite ») — attend Rust (install en cours). K2 = interop via shared NT handle D3D11→D3D12/Vulkan + fence partagée : c'est le seul candidat qui rend Metal/VAAPI quasi gratuits. Spike : créer une texture D3D11, exporter un handle partagé, l'importer côté wgpu.-- **GStreamer** — non installé. Deux réserves avant même K3 : (a) `d3d11compositor` est *fixed-function* (position/scale/blend/alpha) — l'injection d'un shader custom (flou/ombre) est l'inconnue K3 ; (b) **P1 : GStreamer possède la boucle et la synchro**, ce que le §10 désigne comme la source d'erreur de mesure n°1. Un candidat qui, même en passant K3, se heurte au cœur méthodologique du POC.--## 4. Éliminés d'office (K1 / P1)--- **libobs** (GPLv2), **MLT / Olive / Blender VSE** : GPL → contaminerait la licence MIT cible. **K1 ✗**, sans instruction.-- **Moteurs de jeu (Bevy…)** : K3 ok mais **la boucle est à eux → P1 ✗**, hors sujet pour un POC dont l'objet *est* la mesure de la boucle.diff --git a/technical-documentation/_harvest/poc-d3d-stages/S1-sources.md b/technical-documentation/_harvest/poc-d3d-stages/S1-sources.mddeleted file mode 100644index d6b06fbc4..000000000--- a/technical-documentation/_harvest/poc-d3d-stages/S1-sources.md+++ /dev/null@@ -1,140 +0,0 @@-# S1 — Sources, chaîne matérielle, fixture--Statut : **critère de sortie atteint.** Codec / range / fps consignés ci-dessous ; `out/smoke_*.mp4` produits sans `hwdownload`.--Machine : Ryzen 5 7520U / Radeon 610M · Windows 11 · ffmpeg 8.1.2-full (gyan).-------## 1. Ce que sont réellement les sources--Corpus : `C:\Users\camil\AppData\Roaming\openscreen\recordings` — 61 paires screen + `-webcam`.--Tout est déjà en **H.264**, y compris les `.webm` (conteneur WebM avec H.264 dedans, signature MediaRecorder/Chromium). L'hypothèse D3D11VA du §2 tient donc : pas de VP9/AV1 à gérer.--| | screen | webcam (réelle) |-|---|---|---|-| conteneur | `.mp4` (récents) / `.webm` (anciens) | `.webm` puis `.mp4` |-| codec | h264 | h264 |-| profil | **Constrained Baseline** (cs1=1), level 4.2 | **Baseline** (cs1=0), level 3.2 |-| résolution | 1920×1080, parfois 1920×1032 | 640×480 |-| fps | **60 CFR** | **~30 VFR** |-| `color_space` / `color_range` | **non taggés** | `bt709` / `tv` |-------## 2. E1 — la matrice, décidée par la mesure--Le §4 prévenait : « une capture d'écran est souvent en full range → image délavée si on suppose limited ». **La mesure dit le contraire.**--Le screen ne tague ni `color_space` ni `color_range` : impossible de lire, il faut mesurer. `signalstats` seul est trompeur (YMIN=13, YMAX=242 — ni limited propre ni full propre), parce que les extrêmes sont dominés par le ringing du codec. L'histogramme du plan Y brut tranche, sur 3 enregistrements × 12 frames :--```-argmax = 235 partout <- pic à 21-71% des pixels : le blanc de l'UI-Y = 255 : 0.000% partout <- aucun pixel au point blanc full range-Y > 242 : 0.0000% partout <- la queue 236..242 décroît 36929 -> 1 : du ringing-Y < 16 : ~0% <- plancher limited-```--La webcam, qui **déclare** `tv`/bt709, montre la même signature (argmax=235, rien au-dessus de 242). Le screen se comporte exactement comme un flux qui déclare limited. ffmpeg lui-même tague sa sortie `d3d11(tv, progressive)`.--> **Décision : BT.709 limited/tv pour les deux sources. Une seule matrice en dur, pas deux.**-------## 3. La chaîne matérielle — et le piège qu'elle cache--La commande du §4 passe :--```-ffmpeg -hwaccel d3d11va -hwaccel_output_format d3d11 -i <screen> -c:v h264_amf -b:v 8M smoke.mp4-→ 3864 frames, 250 fps, 4.16x temps réel-```--Le verbose confirme le chemin zéro-copie complet :--```-Selecting decoder 'h264' because of requested hwaccel method d3d11va-[h264] Reinit context to 1920x1088, pix_fmt: d3d11-[enc:h264_amf] Using input frames context (format d3d11) with h264_amf encoder.-[AMF] AMF initialisation succeeded via D3D11.-```--### 3.1 La webcam réelle ne décode PAS en matériel — et échoue silencieusement--```-[h264] Decoder GUIDs reported as supported: (20 GUIDs, dont 1b81be68-… = DXVA2_ModeH264_E)-[h264] No decoder device for codec found-[h264] Failed setup for format d3d11: hwaccel initialisation returned error.-[h264] Reinit context to 640x480, pix_fmt: yuv420p <-- SOFTWARE-```--**Et le fichier de sortie est quand même produit.** Un critère de sortie formulé « `smoke.mp4` existe » aurait validé une chaîne à moitié logicielle. C'est le mode d'échec à retenir : ffmpeg retombe en software sans code d'erreur.--Isolation des trois différences (conteneur / résolution / profil) :--| test | flux | résultat |-|---|---|---|-| remux `.webm`→`.mp4`, bitstream intact | Baseline 640×480 | `No decoder device` → **software** |-| ré-encode **Constrained Baseline**, 640×480 | CBP | `pixfmt:d3d11` ✅ |-| ré-encode **High**, 640×480 | High | `pixfmt:d3d11` ✅ |--Ni le conteneur ni la résolution. **C'est le profil, et rien d'autre.**--### 3.2 Cause racine : un bit dans le SPS--Les deux flux ont `profile_idc = 66`. Toute la différence :--| | screen (✅) | webcam (❌) |-|---|---|---|-| `profile_idc` | 66 | 66 |-| **`constraint_set1_flag`** | **1** | **0** |-| `constraint_set0_flag` | 1 | 0 |-| `constraint_set5_flag` | 0 | 1 |-| `level_idc` | 42 | 32 |-| chaîne codec | `avc1.42C02A` | `avc1.420420` |--*Constrained Baseline* est **défini** par `profile_idc==66 && constraint_set1_flag==1`. Sans ce bit, le flux déclare du Baseline nu (FMO / ASO / slices redondantes autorisées) : DXVA n'expose aucun GUID pour ça, d'où `No decoder device` malgré un décodeur H.264 bien présent.--> **Action côté capture (hors POC) :** le screen et la webcam ne sortent pas du même encodeur — même app, même run, mais CBP/4.2 en MP4 d'un côté, Baseline/3.2 en WebM de l'autre. Faire émettre `constraint_set1_flag=1` à la webcam (`avc1.42E01E`), ou passer en Main/High (`avc1.4D…` / `avc1.64…`), tous deux vérifiés ici.->-> Tant que ce n'est pas fait, **toute webcam réelle décodera en software** sans le dire.--### 3.3 Deux autres réglages de capture à corriger--- **Tagger les couleurs du screen** (`bt709` / `tv`). Elles sont justes mais implicites : aujourd'hui il faut mesurer pour les connaître.-- **Webcam VFR** : ~30 fps avec jitter (14→56 ms) et un trou mesuré à **191 ms** (frames droppées à la capture). Contre 60 CFR pour le screen.-------## 4. Fixture gelée--Le §4 demandait la vraie webcam. **Écarté sur décision produit :** on utilise **deux flux screen**, le second simulant une webcam HQ. Ce n'est pas un contournement du problème du §3.2 — c'est un meilleur banc :--- les deux sources sont **déjà CBP cs1=1** → D3D11VA des deux côtés, aucun transcode, aucun bitstream touché ;-- les deux sont **déjà 60 CFR** → 360 frames chacune, appariement 1:1, le VFR sort de l'équation ;-- **deux décodes 1080p60** au lieu d'un 1080p60 + un 480p30 → le cas le plus lourd, la mesure penche du bon côté ;-- une « webcam » à contenu net révèle bien mieux le masque, les coins et le flou (§11) qu'un visage flou en 640×480.--| | `fixture/screen.mp4` | `fixture/webcam.mp4` |-|---|---|---|-| origine | `recording-1783845220910.mp4` @ **t=100 s** | `recording-1783894784128.mp4` @ **t=428 s** |-| profil | Constrained Baseline, cs1=1, L4.2 | Constrained Baseline, cs1=1, L4.2 |-| résolution | **1920×1080** | 1920×1032 → center-crop 1032² |-| fps / frames | 60 CFR / **360** | 60 CFR / **360** |-| décode | `pixfmt:d3d11` ✅ | `pixfmt:d3d11` ✅ |-| contenu | scroll de page GitHub plein écran | fenêtre Claude Code, texte défilant |--Coupée en **`-c copy` sur IDR** (GOP = 60, keyframe à chaque seconde entière) : le bitstream est exactement celui de la capture. Ré-encoder la fixture changerait sa complexité et ferait mesurer à C0 le décodage de *notre* encodage — pas celui du produit.--Throughput indicatif, décode+encode matériel, **une seule source**, boucle ffmpeg (donc **pas** un chiffre publiable au sens du §10) : screen 209-214 fps (spread 2,7 %), webcam 224-225 fps (spread 0,4 %). C0 en aura deux à décoder.-------## 5. Réserves ouvertes pour la suite--1. **Surface décodeur 1088, pas 1080.** `Reinit context to 1920x1088` : alignement macrobloc (68×16). La source « webcam » 1032 donnera 1040. Les SRV échantillonnent une texture plus haute que l'image utile — à corriger dans les UV, sous peine d'une bande en bas. (§5)--2. **Le corpus est intrinsèquement peu animé, et ça biaise le delta C5→C6.** Le contenu se rafraîchit à ~10-15 fps effectifs sous une capture 60 CFR : ~80 % des frames sont des doublons, y compris dans la meilleure fenêtre disponible (scan exhaustif : 17 fichiers, toutes les fenêtres de 6 s — rien ne descend sous 77 % de doublons). Conséquence : de C0 à C5 la sortie est quasi statique et `h264_amf` sort des frames minuscules ; dès C6 le zoom animé fait bouger toute l'image à chaque frame et le coût d'encodage explose (~68 → 360 frames « lourdes »). **Le delta C5→C6 mélangera donc le shader de zoom et le réveil de l'encodeur.** Le breakdown `--profile detail` du §10 le désambiguïsera (le saut apparaîtra dans `encode`, pas dans `comp`) — mais la lecture « delta = coût de la couche » du §9 mérite une note à cette ligne.--3. **ffmpeg GPL.** Le build gyan installé est `--enable-gpl --enable-version3` : bon pour ces spikes en ligne de commande, **incompatible K1** pour un lien dans une app MIT. Le POC devra lier un build LGPL (sans `--enable-gpl`) en dynamique. À traiter en S0/S2, pas ici.diff --git a/technical-documentation/_harvest/poc-d3d-stages/S2-c0.md b/technical-documentation/_harvest/poc-d3d-stages/S2-c0.mddeleted file mode 100644index cd4e74391..000000000--- a/technical-documentation/_harvest/poc-d3d-stages/S2-c0.md+++ /dev/null@@ -1,27 +0,0 @@-# S2 — C0 : décode D3D11VA → encode h264_amf → mux, dans notre pipeline mesuré--Statut : **critère de sortie atteint.** `out/C0.mp4` : H.264 Main, 1920×1080, 60 fps, **360 frames**, décodage sans erreur (lisible VLC), pixels justes (page GitHub, couleurs correctes, texte net). Aucun composite.--```-C0: 360 frames, 1.604s wall, 224.4 fps (single run, non répété — le report 3× vient en S6)-```--## Ce que C0 établit--Le smoke test de S1 prouvait la chaîne matérielle *via la boucle de ffmpeg*. C0 la refait **dans notre propre pipeline Rust, sur notre device, mesuré par notre horloge la plus extérieure** (§10) — c'est la baseline sur laquelle tout le reste s'empile.--- **Un seul `ID3D11Device`** (§2), créé par nous (11_1, VIDEO_SUPPORT, multithread-protected), injecté dans le décodeur D3D11VA de ffmpeg via `AVD3D11VADeviceContext.device`. Le décodeur décode donc sur *nos* textures — condition nécessaire pour que le compositeur HLSL de S3+ échantillonne directement la sortie décodeur.-- **Zéro-copie décode→encode** : `frame->hw_frames_ctx` (D3D11) passé tel quel à `h264_amf`. Seul le bitstream final descend en RAM.-- **Mesure §10 conforme** : `Instant::now()` (mappe QPC) deux fois, autour de tout le run. Rien dans la boucle. Pas de `println!`/allocation par frame. `--release` pour les chiffres publiables (ici debug pour le jalon).--## Toolchain (les pièges, pour ne pas les re-payer)--- **ffmpeg** : build **BtbN LGPL-shared 8.x** (`thirdparty/ffmpeg-master-latest-win64-lgpl-shared`), pas le gyan système (GPL). Règle K1 *et* fournit les dev libs. D3D11VA + AMF survivent au build LGPL (vérifié : `avutil gpl=false amf=true`). DLLs à mettre sur PATH au runtime (fait par `x.bat`).-- **Bindings** : générés par `bindgen` sur les headers 8.x (immunisé contre la version, vs `ffmpeg-sys-next` qui connaît 7.x). Voir `build.rs` + `wrapper.h`.-- **Structs opaques** : bindgen émet les types atteints *seulement par pointeur* (`AVFormatContext`, …) en blob opaque (`_address: u8`). Les champs `streams[]` / `pb` sont donc inaccessibles → **shim C** (`shim.c`, compilé par `cc` contre les vrais headers) qui expose des accesseurs. Offsets corrects et versionnés par construction.-- **Device lifetime** : ffmpeg `Release` le device au teardown du hwdevice ctx. On lui donne un `+1` en fuyant un clone (`std::mem::forget(gpu.device.clone())`) — sinon double-release au Drop de notre `Gpu`.-- **Build** : `x.bat <cargo-args>` = vcvars64 (INCLUDE/LIB pour libclang + linker) + ffmpeg/bin sur PATH + cargo. `.cargo/config.toml` porte `FFMPEG_DIR` et `LIBCLANG_PATH`.--## Réserve reportée à S3--C0 ne touche pas les textures décodeur en lecture. Dès S3, le compositeur devra les échantillonner : imposer `BindFlags |= D3D11_BIND_SHADER_RESOURCE` via `AVD3D11VAFramesContext` avant `av_hwframe_ctx_init` (§5), sinon `CopySubresourceRegion` de repli. Et surface décodeur 1088 (align macrobloc) vs image 1080 : gérer dans les UV.diff --git a/technical-documentation/_harvest/poc-d3d-stages/S6-report.md b/technical-documentation/_harvest/poc-d3d-stages/S6-report.mddeleted file mode 100644index 8c0a048bc..000000000--- a/technical-documentation/_harvest/poc-d3d-stages/S6-report.md+++ /dev/null@@ -1,72 +0,0 @@-# S6 — Runner, configurations cumulatives, rapport--Statut : **cœur atteint.** CLI `--fixture --cfg --repeat --out`, configs cumulatives C0..C8, 3 répétitions + spread, `report.json` + table stdout, extraction PNG f60/f180/f300, build `--release` (LTO, debug_assertions off) pour les runs mesurés.--## Résultat (release, meilleur des N répétitions)--Deux optimisations appliquées (voir plus bas) : motion blur par **vélocité** (au lieu du-supersampling temporel) et fond flouté **dual-Kawase** (au lieu du gaussien 49-tap).--| cfg | fps | ms/f | couche ajoutée |-|---|---|---|---|-| C0 | 239.3 | 4.18 | décode + encode, aucun composite |-| C1 | 151.2 | 6.61 | composite 2 sources, fond, layout, NV12→RGB (E1) |-| C2 | 151.9 | 6.58 | coins arrondis (E2) — gratuit |-| C3 | 140.0 | 7.14 | ombres portées (E4) |-| C4 | 130.5 | 7.66 | fond flouté (E3, dual-Kawase) |-| C5 | 124.9 | 8.01 | zoom animé |-| C6 | 133.4 | 7.50 | animation de layout |-| C7 | 132.6 | 7.54 | curseur custom + click bounce |-| C8 | 124.3 | 8.04 | flou de mouvement (vélocité, 8 taps) |--Tout tient dans **124–239 fps**. L'écart entre la ligne la plus lourde (C8) et le plafond-codec (C1, ~151) n'est plus que ~27 fps (contre 49 avant l'optim du fond).--Historique C8 : supersampling N=6 **23 fps** → vélocité **104 fps** → + dual-Kawase **124 fps**.--## Où est le mur : mesuré par compteurs GPU par moteur (externe, non intrusif)--Capture via `\GPU Engine\Utilization` (pas d'élévation, n'instrumente pas le process) :--| | video codec (encode) | 3d (composite) | goulot |-|---|---|---|---|-| C1 (composite léger) | **71 %** | 46 % | encode |-| C8 (tous effets) | 61 % | **84 %** | composite |--Faits établis, et une idée écartée :-- **Le décode ne pèse rien** (bursty ~2 ms), jamais goulot. Décomposition ffmpeg : décode 1.9 ms/f, encode marginal 2.8 ms/f.-- **Les moteurs se recouvrent déjà** (84 %+61 % = 145 % sur la même fenêtre) → le GPU pipeline seul entre frames. **Un pipeline CPU multi-thread ne gagnerait ~rien** — vérifié aussi par un cache SRV (réduction overhead CPU) resté **sans effet** ⇒ GPU-bound, pas CPU-bound.-- **Le codec VCN est le plafond dur (~210 fps, fixed-function)** : `-quality speed` ne gagne que +2 %. C1–C3 y sont déjà collés.-- **Seul terrain utile : le composite (moteur 3d)** sur C4–C8. C'est ce que dual-Kawase attaque.--## Lecture (honnête, pas lissée)--- **C0→C1 (−85 fps)** est le plus gros coût : 2ᵉ décodage + tout le composite HLSL + conversion RGB→NV12 + copie. La brique la plus lourde, sans surprise.-- **C2 (coins arrondis) quasi gratuit** : delta sous le spread. Alpha SDF, aucun coût réel (§9 : « un fps qui ne baisse pas = la couche ne coûte rien »).-- **C4 (fond flouté) = 128 fps, spread 1.6 %** : stable et monotone ce run. Au run précédent C4 montrait 105 fps / spread 17.7 % et une non-monotonie C4→C5 — c'était de la **variance thermique** de l'iGPU passif (le §10 anticipe exactement ce piège ; le spread élevé s'auto-dénonçait). Re-mesuré GPU froid, l'anomalie disparaît. Les passes de flou coûtent ~18 fps, réellement.-- **C6/C7 spreads élevés (23 %, 14 %) ce run** : même variance thermique run-à-run. Le « meilleur des 3 » reste cohérent et monotone. Sur un iGPU passif, viser des runs GPU froid / secteur pour des coûts absolus fiables.-- **C8 (−13 fps seulement, 104 fps)** : le flou de mouvement n'est plus dominant. Voir l'optimisation ci-dessous.--## Optimisation du flou de mouvement (23 → 104 fps)--**Avant** — supersampling temporel N=6 : recomposer la frame entière 6 fois aux temps intermédiaires et moyenner. Coût = ×6 le composite, quel que soit le contenu. → 23 fps, structurellement incompressible.--**Après** — flou directionnel par vélocité, une seule composition :-- chaque pixel d'un calque vidéo connaît sa position source à la frame précédente (remapping par `dst_prev`/`src_prev`, passés au shader). Le vecteur `uv_now − uv_prev` **est** la vélocité par pixel — il capture translation (layout) *et* zoom.-- le shader échantillonne `taps` fois le long de ce vecteur et moyenne. **Early-out** si la vélocité est ~nulle (1 seul tap) : les frames statiques — la majorité de la fixture — tournent à pleine vitesse.-- coût = quelques taps sur les seuls calques en mouvement, au lieu de ×6 la frame entière. Le fond flouté (le plus cher) n'est calculé qu'une fois.-- curseur : flou par fantômes le long de sa vélocité (traîne qui s'estompe), coût négligeable (petits quads).--Qualité visuelle équivalente (blur directionnel, physiquement juste), pour **4,5×** le débit. C'est la technique de motion blur temps réel standard (jeux) transposée ici.--## Livrables (§11)--- `out/C0.mp4` … `out/C8.mp4` — H.264 1080p60, 360 frames, lisibles VLC.-- `out/C{n}_f{60,180,300}.png` — 3 frames/cfg pour vérifier les effets à l'œil.-- `out/report.json` + table markdown sur stdout.--## Reste à faire (le seul maillon S6 non couvert)--Le **mode `--profile detail`** du §10 : queries GPU timestamp (`DISJOINT`/`TIMESTAMP`, anneau 4 frames, `DONOTFLUSH`, drop si pas prêt), breakdown `decode`/`comp`/`encode`/`mux`, et `overhead_obs = fps(off)/fps(detail) − 1`, plus le contrôle (a) binaire-sans-mesure ≈ (b) `--profile off`.--Ce qui est fait : le **`--profile off`** — la mesure la plus extérieure (`Instant`/QPC autour de tout le run, deux lectures, rien dans la boucle), qui est **le seul chiffre publiable** selon le §10. Le détail est le diagnostic *où passe le temps* ; il ne change pas les fps du tableau et l'outil de référence recommandé reste **RGP** (capture externe, hors process). Le breakdown interne par passe est le complément diagnostic non implémenté.diff --git a/technical-documentation/_harvest/poc-d3d-stages/S7-preview-export.md b/technical-documentation/_harvest/poc-d3d-stages/S7-preview-export.mddeleted file mode 100644index 738996098..000000000--- a/technical-documentation/_harvest/poc-d3d-stages/S7-preview-export.md+++ /dev/null@@ -1,73 +0,0 @@-# S7 — Preview/playback + export (marche vers l'intégration app)--**Verdict.** Le POC n'est plus un batch qui écrit des MP4 : c'est une **app native**-qui *montre* le compositing en lecture temps réel et l'exporte sur un bouton, avec barre-de progression et bilan (**temps + fps**). Le compositeur et le pipeline mesurés (S2→S6)-sont réutilisés tels quels — la GUI est une couche autour, pas une réécriture.--## Ce que ça change (avant → après)--| | Avant (S6) | Après (S7) |-|---|---|---|-| Interface | CLI batch `--cfg C0..C8` | fenêtre native + CLI batch (conservée) |-| Voir le compositing | ouvrir les MP4/PNG produits | **preview bouclée temps réel** dans la fenêtre |-| Exporter | chaque run réencode tout | **bouton Export** → `out/export.mp4` |-| Retour d'export | table stdout | **barre de progression + bilan temps/fps** dans l'UI |-| Choix des effets | argument `--cfg` | **sélecteur C0→C8** (preview + export en direct) |--Lancement : `x.bat run --release` (défaut = GUI). Le bench headless reste `--cfg …`.--## Architecture (mono-thread, coopératif)--```-fenêtre hôte (Win32)-├─ enfant "preview" ── swapchain DXGI flip (R8G8B8A8) sur le device D3D11 PARTAGÉ-│ └─ chaque tick : compose_frame → blit_to(backbuffer) → Present(vsync)-└─ bande de contrôles natifs : combo preset · Play/Pause · Export · barre · label bilan-```--- **Un seul device D3D11**, celui de S2 : décodeurs, compositeur, encodeur ET la swapchain- de preview le partagent. Le blit preview = une passe `ps_tex` (RT RGBA → backbuffer,- letterboxé) — zéro conversion, zéro readback. Le backbuffer est en `R8G8B8A8_UNORM` pour- matcher le RT (passthrough sans swizzle).-- **Contrôles Win32 natifs** (combo, boutons, `msctls_progress32`, label) : aucun rendu de- texte maison. La swapchain vit sur un enfant dédié *sans* sous-fenêtre — condition du- modèle flip (pas de contrôle par-dessus la surface flip).-- **Cadence playback** : `WM_TIMER` ~60 Hz, avance des frames source par **horloge murale**- (accumulateur 1/60 s, garde anti-spirale). Boucle sur EOF par `av_seek_frame(0)` +- `avcodec_flush_buffers` — zéro réallocation de décodeur (la fixture démarre sur un IDR, §11).--## Export : progression sans trahir la mesure (§10)--L'export réutilise `run_composited` (le chemin C1→C8 mesuré). Le fps affiché **reste la-mesure enveloppante** de §10 : une lecture d'horloge avant/après tout le run, rien-d'instrumenté dans la boucle. La barre est alimentée par une sonde `progress(frames)`-appelée par frame mais **throttlée au pourcent** — un `SendMessage(PBM_SETPOS)` (µs)-négligeable devant ~8 ms/frame GPU. Côté bench la sonde est un no-op → **chiffres identiques**-(vérifié : C0 237, C4 136, C8 135 fps, cf. S6).--L'export tourne sur le thread UI **sans re-pomper** le message-loop (pas de réentrance-wndproc → pas d'aliasing `&mut`). La barre et le label se rafraîchissent par-`UpdateWindow` sur *leur* contrôle (repaint synchrone, hors de notre wndproc). Sur la-fixture (~2,7 s en release) la fenêtre reste sous le seuil « Not Responding ».--Bilan affiché à la fin : `Done — C8 · 360 frames · 2.67s · 134.9 fps -> out/export.mp4`.--## Ce que ça démontre pour l'intégration app--L'app OpenScreen (Electron) a besoin, d'un module natif, exactement de ces deux surfaces :-**(1)** un flux de frames composées présentable dans un viewport (preview), **(2)** un export-piloté avec progression et bilan. S7 prouve que le fast-path D3D11 les sert *depuis le même-device*, sans copie CPU — le module natif exposerait `present()` / `export(on_progress)` en-miroir de `blit_to` / `run_composited(progress)`.--## Restes ouverts (hors périmètre POC)--- **Frontière FFI** vers l'hôte (Electron/N-API ou fenêtre embarquée) — ici la fenêtre est- autonome Win32.-- **Preview redimensionnable / DPI** : fenêtre à taille fixe (letterbox déjà géré) ; un vrai- intégrant ferait `ResizeBuffers` sur `WM_SIZE`.-- **Sources dynamiques** : la timeline reste celle, figée, de la fixture (S1) ; l'intégration- brancherait les vraies pistes.-- **Export cancel/threadé** : suffisant en coopératif pour la fixture ; un export long- voudrait un worker + `PostMessage` de progression.diff --git a/technical-documentation/_harvest/poc-d3d-stages/S8-electron-integration.md b/technical-documentation/_harvest/poc-d3d-stages/S8-electron-integration.mddeleted file mode 100644index 9268731f6..000000000--- a/technical-documentation/_harvest/poc-d3d-stages/S8-electron-integration.md+++ /dev/null@@ -1,62 +0,0 @@-# S8 — Intégration Electron (Option A) + mesures d'export--**Verdict.** Le compositeur natif tourne **dans la vraie app OpenScreen** : la preview D3D est-embarquée dans l'éditeur, pilotée par des contrôles React, et l'export natif conserve le débit-du bench dès qu'on désactive la preview pendant le rendu. L'archretenue (annexe D.6) tient bout-à bout, du binaire à l'app.--## La chaîne (prouvée vivante dans l'éditeur)--```-contrôle React (case/bouton)- → IPC native-bridge (domaine "compositor")- → service (charge compositor_view.node) → addon napi-rs- → poc_d3d::live::LiveView (fenêtre D3D) / pipeline::run_composited (export)-```--- **Addon napi-rs** (`compositor-view-napi/`, membre du workspace) : `createView/setRect/- setParam/setPlaying/destroyView/export`, enveloppe `LiveView` + `run_composited`.-- **Glue TS** : domaine `compositor` du native-bridge (service + IPC + client) + hook- `useNativeCompositorView` (sync du rect DOM) + `NativeCompositorOverlay`.-- > **Périmé depuis.** À l'époque de S8, l'overlay était monté dans `Preview.tsx` derrière- > un opt-in `VITE_NATIVE_COMPOSITOR=1`. Les deux ont disparu : `NativeCompositorOverlay`- > est monté **inconditionnellement** par `PreviewCanvas` (« no more dual preview path »),- > et **plus aucun code ne lit cette variable** — la passer n'a aucun effet. Lancer l'app- > en dev, c'est `npm run dev`, rien de plus. Les `<video>` restent montés mais masqués en- > CSS : ils servent au décodage, à l'horloge de lecture et aux métadonnées, pas à- > l'affichage.--## Le point dur résolu : airspace Chromium--Une fenêtre **enfant** (`WS_CHILD`) dans la `BrowserWindow` est **occultée par le compositeur-GPU de Chromium** (créée + « visible » mais dessinée par-dessus). Solution : une fenêtre-**top-level owned** (`WS_POPUP`, `WS_EX_NOACTIVATE|TOOLWINDOW`), positionnée en coords écran par-le thread de rendu (`ClientToScreen(parent) + rect viewport`, suit le déplacement du parent). Une-fenêtre *sœur* n'est pas dans la surface Chromium → pas d'occultation. Confirmé à l'écran.--## Mesures d'export (C8, tous effets, 360 frames 1080p60)--| Contexte | fps | wall | note |-|---|---|---|---|-| Bench headless (isolé) | ~135 | 2.7 s | référence S6/S7 |-| Addon, app **fermée** (isolé) | **125** | 2.9 s | l'addon/napi/AsyncTask n'ajoute **aucun overhead** |-| Addon, app ouverte, **preview active** | **72–77** | ~4.8 s | contention GPU (moteur 3D partagé preview↔export) |-| Addon in-app, **preview auto-pausée** (mesuré UI) | **117** | ~3.1 s | ~94 % de l'isolé ; reste = compositing UI Chromium |--**Conclusion.** Le chemin d'export natif ne change rien (isolé = bench). La seule perte vient de-la **preview concurrente** (contention GPU pure, pas du code) ; on la récupère en **désactivant la-preview pendant le rendu** — `export()` met automatiquement `set_playing(false)` sur les previews-le temps du run (leur thread cesse de composer/présenter), puis les réactive. Résultat in-app :-**117 fps**, soit *les mêmes perfs que le bench* à la marge Chromium près.--Jumeau natif de l'annexe C.3 / §8 : « moteurs GPU en recouvrement, pas de gain à empiler des-charges 3D concurrentes » — ici, une preview 60 fps + un export plein régime se disputent le-moteur 3D, d'où le ×2 ; les séparer (preview off) rend le débit plein.--## Restes ouverts (vers Phase 2)--- Alignement rect / letterbox de l'overlay (preview plus haute que 16:9), transitoire au resize.-- **Paramétrage complet** : remplacer le `Cfg` C8 figé + `timeline()` figée par une **scène par- frame** fournie par l'app (inspector : coins/ombre/zoom/padding/blur/fond ; timeline :- `presentTime` pour seek/playhead ; multiclips ; position webcam ; annotations).diff --git a/technical-documentation/_harvest/poc-d3d-stages/d3d-migration.md b/technical-documentation/_harvest/poc-d3d-stages/d3d-migration.mddeleted file mode 100644index 91b8f7c55..000000000--- a/technical-documentation/_harvest/poc-d3d-stages/d3d-migration.md+++ /dev/null@@ -1,114 +0,0 @@-# Migration propre : ai-edition → compositeur D3D--But : **une seule preview (D3D), parité fonctionnelle complète, zéro fixture POC.**-On garde les primitives GPU (elles sont prouvées, C0–C8), on supprime tout ce qui est-spécifique à la fixture (animation layout codée en dur, boucle 6s, `cursor.json` fixture,-`fixture_dir` + fallbacks), on branche les vrais effets/paramètres de l'app dessus, et on-supprime l'ancienne preview web (DOM/Pixi).--Statut colonne « Primitive D3D » :-- **✅ a** = la primitive existe et rend déjà (il reste à la paramétrer depuis l'app).-- **⚙️ param** = primitive présente mais valeur codée en dur (fixture) → à exposer.-- **🆕 neuf** = à ajouter (nouvelle passe/logique GPU).-------## 1. Barre latérale (inspector) — `EditorSettingsSnapshot` (`legacyEditor`)--### Background (`BackgroundPane`)-| Param | Type / valeurs | Sémantique app | Primitive D3D |-|---|---|---|---|-| `wallpaper` (couleur) | `#rrggbb` | fond plat derrière le screen | ✅ a (`bg_color`) |-| `wallpaper` (gradient) | `linear-gradient(deg, c1, c2, …)` | fond dégradé | 🆕 neuf (shader lerp N stops + angle) |-| `wallpaper` (image) | chemin `/wallpapers/…` ou `data:` | fond image | 🆕 neuf (upload texture + draw quad) |-| `aspectRatio` | `16:9` \| `native` \| … | ratio du cadre de sortie | 🆕 neuf (OUT_W/H dérivés du ratio, aujourd'hui figé 1920×1080) |--### Visual effects (`VideoEffectsPane`)-| Param | Type | Sémantique | Primitive D3D |-|---|---|---|---|-| `showBlur` | bool | fond = screen flouté | ✅ a (dual-Kawase) |-| `motionBlurAmount` | 0..1 | flou de mouvement | ✅ a (supersample temporel) — mais aujourd'hui *motion de layout* seulement ; à étendre au mouvement de contenu |-| `shadowIntensity` | 0..1 | ombre portée écran/webcam | ✅ a (`shadow_scale`) |-| `borderRadius` | px | coins arrondis écran | ⚙️ param (px absolu, pas ×base fixture) |-| `padding` | 0..100 | marge autour du screen | ✅ a (`padding`) |-| `cropRegion` | {x,y,w,h} 0..1 | recadrage source écran | 🆕 neuf (src rect du screen) |--### Layout / webcam (`LayoutPane`)-| Param | Type | Sémantique | Primitive D3D |-|---|---|---|---|-| `webcamLayoutPreset` | `picture-in-picture` \| `dual-frame` \| `vertical-stack` \| `no-webcam` | placement écran/webcam | ⚙️ param PiP (✅) + 🆕 side-by-side / top-bottom / no-webcam (la primitive de layout animé C6 existe) |-| `webcamSizePreset` | 10..50 % | taille webcam | ✅ a |-| `webcamMirrored` | bool | miroir horizontal | ✅ a |-| `webcamMaskShape` | rect \| circle \| square \| rounded | forme webcam | ✅ a |-| `webcamPosition` | {cx,cy} 0..1 | position webcam (drag) | 🆕 neuf (placement libre au lieu du coin fixe) |-| `webcamReactiveZoom` | bool | webcam rétrécit pendant un zoom | 🆕 neuf (lie taille webcam au zoom actif) |--### Cursor (`CursorPane`)-| Param | Type | Sémantique | Primitive D3D |-|---|---|---|---|-| `cursorShow` | bool | afficher le curseur | ✅ a (`cfg.cursor`) |-| `cursor.size` | échelle | taille | ✅ a (`cursor_size_scale`) |-| `cursor.clickBounce` | échelle | rebond au clic | ✅ a (`cursor_bounce_scale`) |-| `cursor.motionBlur` | 0..1 | traînée curseur | ⚙️ param (fantômes existent, liés à `mblur_n` ; à exposer) |-| `cursor.smoothing` | 0..1 | lissage trajectoire | 🆕 neuf (filtrage de `CursorTrack.at`) |-| `cursor.clipToBounds` | bool | clip au cadre écran | 🆕 neuf |-| `cursorTheme` | id | jeu de sprites curseur | 🆕 neuf (atlas sprites + sélection ; aujourd'hui anneau générique) |-| **télémétrie** | fichier/telem | positions réelles du curseur | 🆕 neuf (mapper la télémétrie app → `CursorTrack`, pas la fixture) |--### Divers (pas de rendu compositeur)-| Param | Rôle |-|---|---|-| `showTrimWaveform` | affichage waveform sur la piste trim (UI timeline) |-| `autoFocusAll` | génération auto de zooms (édition, pas rendu) |-------## 2. Timeline — effets & régions--| Effet | Stockage | Champs | Sémantique | Primitive D3D |-|---|---|---|---|---|-| **Cut / trim** | `timeline.trimRanges[]` | assetId, startSec, endSec | retirer un segment | ✅ a (déjà reflété par les clips de l'export multiclip) |-| **Clips** | `timeline.clips[]` | assetId, source[Start/End]Sec, timeline[Start/End]Sec, cropRegion | multiclip + trims + ordre | ✅ a (export multiclip) — à étendre au **preview** |-| **Zoom** | `zoomRanges[]` | startMs, endMs, **depth 1..6**, **focus {cx,cy}**, focusMode auto/manual, **rotationPreset iso/left/right**, customScale | zoom animé sur un point | ⚙️ param (zoom+focus animés existent) + 🆕 rotation (iso/left/right) |-| **Speed** | `timeline.speedRanges[]` | startMs, endMs, **speed** | accélère/ralentit un segment | 🆕 neuf (cadence de décodage/sortie + audio) |-| **Annotation texte** | `annotations[]` type=text | content, position %, size, style, timing | overlay texte | 🆕 neuf (rendu texte) |-| **Annotation image** | `annotations[]` type=image | imageContent, position, size, timing | overlay image | 🆕 neuf (texture) |-| **Annotation figure** | `annotations[]` type=figure | figureData, … | flèche/forme | 🆕 neuf |-| **Annotation blur** | `annotations[]` type=blur | blurData, position, size, timing | flou d'une zone | 🆕 neuf (blur localisé) |-| **Caption** | `timeline.captionRanges[]` | startSec, endSec | sous-titres | 🆕 neuf (texte timé) |-| **Camera fullscreen** | régions | startMs/endMs | webcam grandit pour remplir | 🆕 neuf (layout animé webcam) |-| **Mute** | `timeline.muteRanges[]` | startSec, endSec | couper l'audio | audio (hors compositeur vidéo) |-| **Gaps** | `timeline.gaps[]` | — | trous timeline | ⚙️ (tenue de frame / noir) |-------## 3. Primitives D3D à GARDER (compose_frame / passes GPU)-composite 2 sources · coins arrondis (SDF) · ombre portée · fond flouté (dual-Kawase) ·-zoom animé + focus · **layout paramétrable** (aujourd'hui A↔B fixture — à généraliser aux-presets) · curseur (dot+ring, bounce, fantômes motion-blur — à généraliser sprites+télémétrie) ·-flou de mouvement (supersample temporel) · encode h264_amf · export mono/multiclip.--## 4. Scaffolding fixture à SUPPRIMER (n'appartient qu'au POC)-- `compositor.rs::timeline()` — planning A↔B + zoom **codés en dur** → remplacé par des params pilotés par l'app (layout preset, zoom regions).-- `FIXTURE_FRAMES` (boucle 6s) et toute la logique de bouclage fixture.-- `fixture_dir()` + fallbacks fixture dans `create_view`/`export` (napi).-- fixture `poc-d3d/fixture/*` (screen.mp4, webcam.mp4, screen.cursor.json) — hors app.-- Harnais `--live` / `--export` fixture (rester dev-only, hors chemin app).-- Fallback « fixture » de l'overlay/hook côté TS.--## 5. Ancienne preview web à SUPPRIMER (après parité)-`PreviewCanvas` / `VirtualPreview` / `WebcamOverlay` / `CursorPreviewLayer` (Pixi) /-`ZoomFocusOverlay` / `AnnotationOverlay` / `PreviewCompositor` — une fois la parité D3D atteinte,-la preview DOM disparaît (le natif devient la seule surface).-------## 6. Phases proposées-- **P0 — Nettoyage fixture** : retirer `timeline()` fixture, `FIXTURE_FRAMES`, `fixture_dir`, fallbacks. Le compositeur ne rend plus QUE ce que l'app lui décrit (layout/zoom/curseur pilotés). Rien de visible tant que les params ne sont pas branchés → à faire avec P1.-- **P1 — Contrat de scène** : un descripteur « scène » app → natif (clips + trims + layout preset + webcam pos/size/shape/mirror + bg + effets frame + zoom regions + curseur telemetry/theme), pour preview ET export, partagé.-- **P2 — Parité rendu** (par ordre de valeur) : layout presets · bg gradient/image · zoom regions (focus/depth/rotation) · curseur télémétrie+thèmes · crop · webcam position/reactive-zoom · speed · annotations/captions · camera-fullscreen.-- **P3 — Preview multiclip natif** (playhead pilote la scène) puis **suppression de la preview web**.-- **P4 — Params d'export** (fps/taille/codec + downscale/upscale) sur le moteur multiclip.--> Note perf (contrainte) : tout passe par décodage séquentiel + seek keyframe aux frontières,-> primitives GPU inchangées → l'objectif ~120fps export tient.diff --git a/technical-documentation/_harvest/specs/README.md b/technical-documentation/_harvest/specs/README.mddeleted file mode 100644index 48a788b13..000000000--- a/technical-documentation/_harvest/specs/README.md+++ /dev/null@@ -1,3 +0,0 @@-# Specs--This is a directory for test plans.diff --git a/technical-documentation/_harvest/specs/computer-use/00-launch-and-hud.md b/technical-documentation/_harvest/specs/computer-use/00-launch-and-hud.mddeleted file mode 100644index a663fa136..000000000--- a/technical-documentation/_harvest/specs/computer-use/00-launch-and-hud.md+++ /dev/null@@ -1,240 +0,0 @@-# 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/technical-documentation/_harvest/specs/computer-use/01-source-selection-and-record.md b/technical-documentation/_harvest/specs/computer-use/01-source-selection-and-record.mddeleted file mode 100644index 7d2c60c31..000000000--- a/technical-documentation/_harvest/specs/computer-use/01-source-selection-and-record.md+++ /dev/null@@ -1,258 +0,0 @@-# 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/technical-documentation/_harvest/specs/computer-use/02-editor-foundation.md b/technical-documentation/_harvest/specs/computer-use/02-editor-foundation.mddeleted file mode 100644index 24052c9da..000000000--- a/technical-documentation/_harvest/specs/computer-use/02-editor-foundation.md+++ /dev/null@@ -1,357 +0,0 @@-# 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/technical-documentation/_harvest/specs/computer-use/03-transport-and-preview.md b/technical-documentation/_harvest/specs/computer-use/03-transport-and-preview.mddeleted file mode 100644index b54dc06a4..000000000--- a/technical-documentation/_harvest/specs/computer-use/03-transport-and-preview.md+++ /dev/null@@ -1,333 +0,0 @@-# 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/technical-documentation/_harvest/specs/computer-use/04-timeline-pan-zoom-scrub.md b/technical-documentation/_harvest/specs/computer-use/04-timeline-pan-zoom-scrub.mddeleted file mode 100644index ef78ade41..000000000--- a/technical-documentation/_harvest/specs/computer-use/04-timeline-pan-zoom-scrub.md+++ /dev/null@@ -1,339 +0,0 @@-# 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/technical-documentation/_harvest/specs/computer-use/05-clip-operations.md b/technical-documentation/_harvest/specs/computer-use/05-clip-operations.mddeleted file mode 100644index d6fcc59b9..000000000--- a/technical-documentation/_harvest/specs/computer-use/05-clip-operations.md+++ /dev/null@@ -1,346 +0,0 @@-# 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/technical-documentation/_harvest/specs/computer-use/06-skip-regions.md b/technical-documentation/_harvest/specs/computer-use/06-skip-regions.mddeleted file mode 100644index a2fd740cb..000000000--- a/technical-documentation/_harvest/specs/computer-use/06-skip-regions.md+++ /dev/null@@ -1,322 +0,0 @@-# 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/technical-documentation/_harvest/specs/computer-use/07-zoom-regions.md b/technical-documentation/_harvest/specs/computer-use/07-zoom-regions.mddeleted file mode 100644index 7356707bb..000000000--- a/technical-documentation/_harvest/specs/computer-use/07-zoom-regions.md+++ /dev/null@@ -1,289 +0,0 @@-# 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/technical-documentation/_harvest/specs/computer-use/08-speed-regions.md b/technical-documentation/_harvest/specs/computer-use/08-speed-regions.mddeleted file mode 100644index 12ffebae9..000000000--- a/technical-documentation/_harvest/specs/computer-use/08-speed-regions.md+++ /dev/null@@ -1,214 +0,0 @@-# 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/technical-documentation/_harvest/specs/computer-use/09-annotation-regions.md b/technical-documentation/_harvest/specs/computer-use/09-annotation-regions.mddeleted file mode 100644index 373060673..000000000--- a/technical-documentation/_harvest/specs/computer-use/09-annotation-regions.md+++ /dev/null@@ -1,300 +0,0 @@-# 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/technical-documentation/_harvest/specs/computer-use/10-properties-right-panel.md b/technical-documentation/_harvest/specs/computer-use/10-properties-right-panel.mddeleted file mode 100644index bc510515b..000000000--- a/technical-documentation/_harvest/specs/computer-use/10-properties-right-panel.md+++ /dev/null@@ -1,472 +0,0 @@-# 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/technical-documentation/_harvest/specs/computer-use/11-transcript-editor.md b/technical-documentation/_harvest/specs/computer-use/11-transcript-editor.mddeleted file mode 100644index aa52b3353..000000000--- a/technical-documentation/_harvest/specs/computer-use/11-transcript-editor.md+++ /dev/null@@ -1,331 +0,0 @@-# 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/technical-documentation/_harvest/specs/computer-use/12-chat-panel.md b/technical-documentation/_harvest/specs/computer-use/12-chat-panel.mddeleted file mode 100644index b76fa9c6e..000000000--- a/technical-documentation/_harvest/specs/computer-use/12-chat-panel.md+++ /dev/null@@ -1,307 +0,0 @@-# 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/technical-documentation/_harvest/specs/computer-use/13-provider-settings.md b/technical-documentation/_harvest/specs/computer-use/13-provider-settings.mddeleted file mode 100644index bf77a7a6a..000000000--- a/technical-documentation/_harvest/specs/computer-use/13-provider-settings.md+++ /dev/null@@ -1,293 +0,0 @@-# 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/technical-documentation/_harvest/specs/computer-use/14-sessions-and-history.md b/technical-documentation/_harvest/specs/computer-use/14-sessions-and-history.mddeleted file mode 100644index 47d31fc77..000000000--- a/technical-documentation/_harvest/specs/computer-use/14-sessions-and-history.md+++ /dev/null@@ -1,253 +0,0 @@-# 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/technical-documentation/_harvest/specs/computer-use/15-export-dialog.md b/technical-documentation/_harvest/specs/computer-use/15-export-dialog.mddeleted file mode 100644index 5a8933214..000000000--- a/technical-documentation/_harvest/specs/computer-use/15-export-dialog.md+++ /dev/null@@ -1,322 +0,0 @@-# 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/technical-documentation/_harvest/specs/computer-use/16-modal-shortcuts-i18n.md b/technical-documentation/_harvest/specs/computer-use/16-modal-shortcuts-i18n.mddeleted file mode 100644index 511d67f83..000000000--- a/technical-documentation/_harvest/specs/computer-use/16-modal-shortcuts-i18n.md+++ /dev/null@@ -1,367 +0,0 @@-# 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/technical-documentation/_harvest/specs/computer-use/17-themes-and-settings.md b/technical-documentation/_harvest/specs/computer-use/17-themes-and-settings.mddeleted file mode 100644index 0ec1c757f..000000000--- a/technical-documentation/_harvest/specs/computer-use/17-themes-and-settings.md+++ /dev/null@@ -1,217 +0,0 @@-# 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/technical-documentation/_harvest/specs/computer-use/18-final-qa-checklist.md b/technical-documentation/_harvest/specs/computer-use/18-final-qa-checklist.mddeleted file mode 100644index c5decf0d6..000000000--- a/technical-documentation/_harvest/specs/computer-use/18-final-qa-checklist.md+++ /dev/null@@ -1,318 +0,0 @@-# 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/technical-documentation/_harvest/specs/computer-use/INDEX.md b/technical-documentation/_harvest/specs/computer-use/INDEX.mddeleted file mode 100644index 4605079f8..000000000--- a/technical-documentation/_harvest/specs/computer-use/INDEX.md+++ /dev/null@@ -1,100 +0,0 @@-# 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/technical-documentation/_harvest/specs/f2.6-region-snap-guide-and-tooltip.md b/technical-documentation/_harvest/specs/f2.6-region-snap-guide-and-tooltip.mddeleted file mode 100644index 0755eae8c..000000000--- a/technical-documentation/_harvest/specs/f2.6-region-snap-guide-and-tooltip.md+++ /dev/null@@ -1,62 +0,0 @@-# 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/technical-documentation/_harvest/specs/f2.7-multi-select-regions.md b/technical-documentation/_harvest/specs/f2.7-multi-select-regions.mddeleted file mode 100644index 8a5c98c6b..000000000--- a/technical-documentation/_harvest/specs/f2.7-multi-select-regions.md+++ /dev/null@@ -1,62 +0,0 @@-# 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/technical-documentation/_harvest/specs/p1.7-chat-tool-call-summaries.md b/technical-documentation/_harvest/specs/p1.7-chat-tool-call-summaries.mddeleted file mode 100644index 4d0da577e..000000000--- a/technical-documentation/_harvest/specs/p1.7-chat-tool-call-summaries.md+++ /dev/null@@ -1,63 +0,0 @@-# 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/technical-documentation/_harvest/specs/p3.1-asset-file-size.md b/technical-documentation/_harvest/specs/p3.1-asset-file-size.mddeleted file mode 100644index 79586b807..000000000--- a/technical-documentation/_harvest/specs/p3.1-asset-file-size.md+++ /dev/null@@ -1,59 +0,0 @@-# 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/technical-documentation/_harvest/specs/p3.3-right-panes-help.md b/technical-documentation/_harvest/specs/p3.3-right-panes-help.mddeleted file mode 100644index 55f7c8e58..000000000--- a/technical-documentation/_harvest/specs/p3.3-right-panes-help.md+++ /dev/null@@ -1,59 +0,0 @@-# 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/technical-documentation/_harvest/specs/p3.7-ruler-hover-scrub.md b/technical-documentation/_harvest/specs/p3.7-ruler-hover-scrub.mddeleted file mode 100644index 99e689329..000000000--- a/technical-documentation/_harvest/specs/p3.7-ruler-hover-scrub.md+++ /dev/null@@ -1,32 +0,0 @@-# 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/technical-documentation/_harvest/specs/t19-zoom-timeline-and-preview.md b/technical-documentation/_harvest/specs/t19-zoom-timeline-and-preview.mddeleted file mode 100644index 4e3b7364d..000000000--- a/technical-documentation/_harvest/specs/t19-zoom-timeline-and-preview.md+++ /dev/null@@ -1,95 +0,0 @@-# 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/technical-documentation/_harvest/stt-whispercpp-dtw-poc-plan.md b/technical-documentation/_harvest/stt-whispercpp-dtw-poc-plan.mddeleted file mode 100644index fae3d778a..000000000--- a/technical-documentation/_harvest/stt-whispercpp-dtw-poc-plan.md+++ /dev/null@@ -1,480 +0,0 @@-# Implementation plan — whisper.cpp DTW word-timestamp POC--**Author handoff:** this document is written to be executed by a coding agent-end-to-end, with no access to the prior conversation. Everything needed is-inline. Follow the phases in order.--This POC lives **inside the OpenScreen repo**, under-`tools/stt-eval/whispercpp-dtw-poc/` — it is not a separate checkout. The-isolation that matters is **not** "outside the repo", it's "no Electron app-build/run required": this is a standalone native harness (its own CMake-project, its own fixtures) that never touches `electron/`, `src/`, or any-app build step. It reuses the already-built CTranslate2 server binary as a-comparison baseline (§2.2) but does not rebuild or modify it.-------## 0. Why this exists (read first — it determines every technical choice)--OpenScreen's STT currently runs **CTranslate2** (the engine behind-`faster-whisper`). CTranslate2's only GPU backend is **CUDA (NVIDIA)** — it has-no Metal (Apple Silicon), no Vulkan (AMD/Intel), no ROCm. That leaves Apple-Silicon and every AMD machine stuck on CPU (~1.2× real-time), which is-unacceptable for hour-long videos.--**whisper.cpp** is the only engine that reaches *all* GPUs (CUDA, Metal, Vulkan,-ROCm, CoreML) from one C++ codebase with self-contained binaries — matching how-OpenScreen already ships natives. The blocker to adopting it has always been:-**"does whisper.cpp produce word-level timestamps as good as CTranslate2's-`.align()` DTW?"**--A previous evaluation concluded "no", but that evaluation was **not a fair-test**. It failed for identifiable, avoidable reasons:--1. It tested whisper.cpp's **heuristic** (non-DTW) timestamps — mediocre by- design, not the DTW path.-2. It tested the `--dtw` flag through the **`whisper-server` HTTP wrapper** with- a **community `ggml-small-q5_1.bin` model that has no alignment-head data**,- and saw "identical output with/without the flag". Two independent causes are- possible and **both are avoided by this POC**:- - The model lacked alignment heads → **we fix this by passing the built-in- `WHISPER_AHEADS_SMALL` preset**, which supplies OpenAI's published- alignment heads without needing them baked into the file.- - The HTTP wrapper may not surface the DTW timestamp field at all → **we fix- this by linking `libwhisper` directly and reading `t_dtw` per token- ourselves**, exactly as OpenScreen already did for CTranslate2's `.align()`.--**This POC does the fair test that was never run:** native `libwhisper` link,-DTW enabled with the correct alignment-head preset, reading `t_dtw` directly,-with a proper (non-degenerate-quant) model — then measures word-timestamp-quality **and** speed against the current CTranslate2 baseline on the same-machine, same fixtures, same model size.--### Goal / deliverable--A short **report** (`REPORT.md`) with two verdicts, backed by numbers:--- **Quality:** are whisper.cpp DTW word timestamps within ~50 ms of- CTranslate2's on the same audio? (median word-boundary delta + gross-failure- check).-- **Speed:** whisper.cpp RTF on **CPU** and on **GPU (Vulkan, and CUDA if an- NVIDIA GPU is present)** vs the CTranslate2 INT8 CPU baseline.--### Non-goals (explicitly out of scope for this POC)--- No integration into the OpenScreen Electron app. No changes to any file- outside `tools/stt-eval/whispercpp-dtw-poc/` except (a) the `.gitignore`- entries already added for this path's generated artifacts (§1.1) and (b)- reading — never modifying — the existing CT2 server binary/model for the- baseline in §2.2.-- No Metal/Apple-Silicon run (the dev machine is Windows; Metal is validated- later on a Mac — the harness must be written portably so it compiles there- unchanged, but you are not expected to run it on Mac in this POC).-- No CoreML/ANE encoder path (optional stretch goal only, § 6).-- No language selector, no VAD, no production hardening.-------## 1. Environment & working directory--**Working directory (inside the OpenScreen repo):**--```-tools/stt-eval/whispercpp-dtw-poc/-```--Everything below lives under this path (`whisper.cpp/` clone, `harness/`,-`fixtures/`, `results/`, `REPORT.md`). A placeholder `README.md` pointing back-at this plan already exists there — replace/extend it as the POC lands, don't-delete the pointer back to this doc.--### 1.1 `.gitignore` (already added — do not re-add)--The repo's root `.gitignore` already excludes this path's generated,-multi-gigabyte artifacts so they never get committed:--```-/tools/stt-eval/whispercpp-dtw-poc/whisper.cpp/-/tools/stt-eval/whispercpp-dtw-poc/build-cpu/-/tools/stt-eval/whispercpp-dtw-poc/build-vulkan/-/tools/stt-eval/whispercpp-dtw-poc/build-cuda/-/tools/stt-eval/whispercpp-dtw-poc/fixtures/*.wav-/tools/stt-eval/whispercpp-dtw-poc/results/-```--What **does** get committed: `harness/` source (the bench program, the-`.mjs` scoring scripts, any `CMakeLists.txt`), `fixtures/refs/*.txt` (the-small ground-truth text files), and the final `REPORT.md` — that's the-actual deliverable and the reproducible harness, without the heavyweight-engine clone/models/build output.--**Toolchain (Windows dev machine):**--- CMake ≥ 3.20, a C++20 compiler (MSVC 2022, already used to build the CT2- server), Git, Git Bash (for `.sh` scripts), Node.js (for the `.mjs` scoring- scripts).-- **Vulkan SDK** (LunarG) — required to build the Vulkan backend. If it cannot- be installed, record that and run CPU-only for whisper.cpp GPU numbers, but- Vulkan is the strategically important target (non-CUDA GPU) so make a real- effort to install it.-- **CUDA Toolkit** — only if `nvidia-smi` succeeds (i.e. an NVIDIA GPU is- present). If not, skip the CUDA build; it is not the point of this POC.-------## 2. Fixtures & baseline (Phase 0)--### 2.1 Test audio + ground truth--All fixtures are **16 kHz mono PCM16 WAV** with **exact** ground-truth-transcripts. Copy them into `fixtures/`. Primary source locations on this-machine (from prior work):--| File | Source path | Ground-truth transcript |-| --- | --- | --- |-| `jfk.wav` (~11 s) | `C:\Users\camil\AppData\Local\Temp\opencode\jfk.wav` | well-known JFK quote (see below) |-| `librispeech_demo_0..4.wav` (~4–10 s each) | `C:\Users\camil\AppData\Local\Temp\opencode\human\librispeech_demo_{0..4}.wav` | `refs/librispeech_demo_{0..4}.txt` in the prior scratchpad |-| `two-min-clip.wav` (130.32 s) | prior scratchpad `...\4f6f4ad1-...\scratchpad\two-min-clip.wav` | `two-min-ref.txt` alongside it |--Ground-truth `.txt` files and the scoring scripts are in the prior scratchpad:-`C:\Users\camil\AppData\Local\Temp\claude\C--Users-camil-Documents-repos-openscreen-new\4f6f4ad1-0477-45cb-84ba-43d94b6eb302\scratchpad\`-(`refs/*.txt`, `wer.mjs`, `analyze.mjs`, `extract_text.mjs`, `extract_2min.py`).--**If any temp fixture is missing** (temp dirs are volatile), regenerate:--- `jfk.wav` — download from whisper.cpp: `whisper.cpp/samples/jfk.wav` exists in- the clone (Phase 3). Ground-truth text:- `And so my fellow Americans, ask not what your country can do for you, ask what you can do for your country.`-- LibriSpeech clips + `two-min-clip.wav` — regenerate with the prior- `extract_2min.py` (it pulls the HF `hf-internal-testing/librispeech_asr_demo`- parquet, concatenates 12 consecutive rows with 0.3 s silence gaps into- `two-min-clip.wav` + writes `two-min-ref.txt`). Needs a Python venv with- `pyarrow` + `soundfile` (the prior venv at- `C:\Users\camil\AppData\Local\Temp\opencode\venv\` may still exist; else- `pip install pyarrow soundfile datasets`).--Copy `wer.mjs`, `analyze.mjs`, `extract_text.mjs` into `harness/` — you will-reuse them unchanged (they read a JSON response and compute normalized-word-level WER / timestamp sanity).--### 2.2 CTranslate2 baseline — re-measure on THIS machine--Do **not** cite the numbers in-[stt-spec.md](./stt-spec.md) §5 (items 5–7) as the comparison baseline — they-may be from a different run. Instead,-re-run the existing CT2 server on this machine, same fixtures, to get a fresh,-same-hardware baseline and fresh CT2 JSON for the timestamp head-to-head.--1. The CT2 server binary is already built in this same repo, one level up- from this POC's directory- (`electron/native/bin/win32-x64/ctranslate2-server-ctranslate2-cpu.exe`,- built via `ct2-build.cmd` at the repo root — do not rebuild it for this- POC, only read the binary and model). The model is at OpenScreen's- `whisper-ct2` cache dir (or download `Systran/faster-whisper-small`:- `model.bin`, `config.json`, `tokenizer.json`, `vocabulary.txt`).-2. Run it in **both** precision modes (see § 3.2 for why both are needed):- - **int8** (production): `ctranslate2-server-...exe --port 20199 --int8`- → save JSON as `results/ct2_int8_<name>.json`.- - **fp16** (matched-precision quality baseline): same binary **without**- `--int8` → save JSON as `results/ct2_fp16_<name>.json`.-3. For each fixture × each mode, POST to `/inference`, save the JSON, and- capture wall-clock via `curl -w "%{time_total}"`.-4. Record per-fixture per-mode: WER (`node harness/wer.mjs <ref> <extracted-hyp>`),- RTF (`time_total / audio_seconds`), and keep the JSON for § 5 timestamp- comparison. The **fp16** JSON is the one the § 5.1 timestamp head-to-head- compares against whisper.cpp fp16; the **int8** JSON is the production speed- baseline.--Read the model size from OpenScreen's `electron/stt/modelManager.ts`: it is-**`Systran/faster-whisper-small`** (Whisper **small, multilingual**, fp16-weights, INT8 at load). **whisper.cpp must use the same size** → `ggml-small.bin`-+ `WHISPER_AHEADS_SMALL`. This is the apples-to-apples constraint.-------## 3. Build whisper.cpp with DTW + GPU backends (Phase 1)--```bash-cd tools/stt-eval/whispercpp-dtw-poc-git clone https://github.com/ggml-org/whisper.cpp.git-cd whisper.cpp-git checkout <latest release tag> # e.g. the newest v1.7.x tag; RECORD the exact tag + commit SHA in REPORT.md-```--(This clone lands inside `whisper.cpp/`, which the root `.gitignore` already-excludes — it will not show up in `git status` for the OpenScreen repo.)--#### 3.1 Exact models to download — precision matching (do NOT skew the test)--There is **no fp8** in either ecosystem for Whisper small. The real precision-knobs are: CT2 = fp16 weights on disk + INT8 chosen at load; whisper.cpp = GGML-fp16 **or** block-quant (`q8_0`/`q5_1`/`q4_0`), where **`q8_0` is its int8-analog**. Both `ggml-small.bin` and `Systran/faster-whisper-small` derive from-the **same** OpenAI `whisper-small` (multilingual) fp16 checkpoint — that shared-origin is what makes the comparison valid.--**whisper.cpp — download exactly these two (multilingual `small`, never-`small.en`):**--```bash-# from whisper.cpp/ — the download script pulls from HF ggml-org/whisper.cpp-bash ./models/download-ggml-model.sh small # → models/ggml-small.bin (fp16, ~488 MB) — QUALITY runs-bash ./models/download-ggml-model.sh small-q8_0 # → models/ggml-small-q8_0.bin (8-bit, ~264 MB) — SPEED-vs-int8 runs-```--**Do NOT download / do NOT use** for any measurement:-- `ggml-small-q5_1.bin`, `-q5_0`, `-q4_0` — heavy quant blurs cross-attention;- this **is the exact model class that poisoned the 2024 test**. Not even as a- "secondary" run — it only muddies the verdict.-- `ggml-small.en.bin` (or any `.en`) — English-only weights **and** it needs a- different DTW preset (`WHISPER_AHEADS_SMALL_EN`), so it double-skews the- multilingual comparison. The preset in § 4 is `WHISPER_AHEADS_SMALL`- (multilingual) and must stay that way.--**CTranslate2 — one download, two runtime modes (no separate int8 file; the-legacy `*.int8` HF repos were taken private):**--```-Systran/faster-whisper-small (fp16 weights: model.bin + config.json + tokenizer.json + vocabulary.txt)- → run A: server WITHOUT --int8 → CT2 fp16 (matched-precision QUALITY baseline)- → run B: server WITH --int8 → CT2 int8 (production baseline + matched-precision SPEED)-```--#### 3.2 Which precision pairs with which verdict--| Verdict | whisper.cpp model | CTranslate2 mode | Why this pairing is fair |-| --- | --- | --- | --- |-| **Timestamp QUALITY** (the decisive one) | `ggml-small.bin` (fp16) | `Systran` **fp16** (no `--int8`) | both fp16 → isolates the DTW **algorithm**; zero quant noise on cross-attention |-| **Quant robustness** (does 8-bit hurt timestamps?) | `ggml-small-q8_0.bin` | `Systran` **`--int8`** | confirms each engine's production precision doesn't wreck its own alignment |-| **SPEED — production** | `ggml-small-q8_0.bin` | `Systran` **`--int8`** | matched ~8-bit precision → the only fair speed number |-| **SPEED — fp16 reference** | `ggml-small.bin` (fp16) | `Systran` **fp16** | matched fp16 → sanity cross-check on speed |--Rule of thumb the agent must not violate: **never** compare whisper.cpp **fp16**-speed against CT2 **int8** speed (int8 is faster — it would unfairly slow-label-whisper.cpp), and **never** judge timestamp quality on a `q5_1`/`q4_0` model.-WER (transcript quality) is a model property and should be near-identical across-precisions; the precision-sensitive metric is the **word-boundary timestamp-delta**, so that one gets the clean fp16-vs-fp16 pairing.--Build three variants into separate dirs (skip CUDA if no NVIDIA GPU):--```bash-# CPU (always)-cmake -B build-cpu -DCMAKE_BUILD_TYPE=Release -DWHISPER_BUILD_EXAMPLES=ON-cmake --build build-cpu --config Release -j--# Vulkan (priority GPU target — the whole point of the strategic question)-cmake -B build-vulkan -DCMAKE_BUILD_TYPE=Release -DGGML_VULKAN=1 -DWHISPER_BUILD_EXAMPLES=ON-cmake --build build-vulkan --config Release -j--# CUDA (only if nvidia-smi present)-cmake -B build-cuda -DCMAKE_BUILD_TYPE=Release -DGGML_CUDA=1 -DWHISPER_BUILD_EXAMPLES=ON-cmake --build build-cuda --config Release -j-```--Sanity check each build with the bundled sample before writing the harness:--```bash-./build-cpu/bin/whisper-cli -m models/ggml-small.bin -f samples/jfk.wav-```-------## 4. The DTW harness (Phase 2 — the crux)--Write a standalone C++ program that links `libwhisper` directly. **Do not use-`whisper-server` or the CLI's JSON output** — the whole reason the earlier test-failed is that a wrapper may not surface the DTW field. Read `t_dtw` yourself.--Create `harness/wcpp_dtw_bench.cpp`:--```cpp-// wcpp_dtw_bench.cpp-// Usage: wcpp_dtw_bench <model.bin> <audio-16k-mono.wav> [--lang en]-// Emits ONE JSON object on stdout matching OpenScreen's transcriptionContract-// shape, so harness/{wer,analyze,extract_text}.mjs work unchanged.-//-// KEY POINTS (do not deviate):-// - dtw_token_timestamps = true, dtw_aheads_preset = WHISPER_AHEADS_SMALL-// (must match the model size; SMALL multilingual here).-// - token_timestamps = true (required for per-token timing).-// - Read whisper_token_data.t_dtw (NOT t0/t1). Units are centiseconds-// (1 unit = 10 ms) → seconds = t_dtw / 100.0. t_dtw == -1 means "not-// computed" → that is a FAILURE, see the assertion in § 4.1.--#include "whisper.h"-#define DR_WAV_IMPLEMENTATION-#include "dr_wav.h" // reuse the copy in whisper.cpp/examples/-#include <cstdio>-#include <string>-#include <vector>-#include <cmath>-#include <chrono>--static std::string json_escape(const std::string& s) { /* escape " \\ and control chars */ }--int main(int argc, char** argv) {- const char* model_path = argv[1];- const char* wav_path = argv[2];- std::string lang = "en"; // force en for a deterministic test- // (parse optional --lang)-- // --- load 16 kHz mono float PCM via dr_wav (fixtures are guaranteed 16k mono PCM16)- std::vector<float> pcm; // fill from dr_wav; assert sampleRate==16000, channels==1-- // --- init context WITH DTW alignment heads- whisper_context_params cparams = whisper_context_default_params();- cparams.dtw_token_timestamps = true;- cparams.dtw_aheads_preset = WHISPER_AHEADS_SMALL; // <-- the fix vs the earlier test- // cparams.use_gpu is true by default; the GPU actually used depends on which- // build (build-cpu / build-vulkan / build-cuda) this is linked against.- whisper_context* ctx = whisper_init_from_file_with_params(model_path, cparams);-- whisper_full_params wparams = whisper_full_default_params(WHISPER_SAMPLING_GREEDY);- wparams.token_timestamps = true;- wparams.language = lang.c_str();- wparams.print_progress = false;- wparams.n_threads = /* std::thread::hardware_concurrency() */;-- auto t0 = std::chrono::steady_clock::now();- whisper_full(ctx, wparams, pcm.data(), (int) pcm.size());- auto t1 = std::chrono::steady_clock::now();- double elapsed_s = std::chrono::duration<double>(t1 - t0).count();- double audio_s = pcm.size() / 16000.0;-- // --- walk segments/tokens, group tokens into words, read t_dtw- // Word grouping rule (Whisper BPE convention):- // * skip special tokens: id >= whisper_token_eot(ctx)- // * a NEW word starts when the detokenized token text begins with a space- // (leading ' '), OR it is the first non-special token of the segment.- // * a word's start = t_dtw of its first token; end = t_dtw of its last token- // (or the next word's start if last-token t_dtw is unstable — prefer the- // next token's t_dtw as the end bound, matching whisper/faster-whisper).- // * word.probability = mean token .p over the word's tokens.- //- // Emit JSON:- // { "text": "...",- // "segments": [ { "start": S, "end": E, "text": "...",- // "words": [ {"word":"...","start":s,"end":e,"probability":p}, ... ] } ],- // "detected_language": "en",- // "backend": "whispercpp-<cpu|vulkan|cuda>",- // "timing": { "elapsed_s": <>, "audio_s": <>, "rtf": <elapsed/audio> } }-- whisper_free(ctx);- return 0;-}-```--Build it with a tiny `harness/CMakeLists.txt` that links against the whisper-target from each build dir (or just `-I whisper.cpp/include -I-whisper.cpp/examples` and link the built `whisper` lib). Produce three binaries-(or one binary run under three PATH/lib configs): `wcpp_dtw_bench_cpu`,-`_vulkan`, `_cuda`.--### 4.1 Mandatory guardrail (this is what would have caught the 2024 failure)--Before trusting any numbers, assert that **DTW actually ran**:--- For `jfk.wav`, compute `Σ |t_dtw − t0|` over all non-special tokens.-- If `t_dtw == -1` for any token, or the sum is `0` (DTW timestamps identical to- heuristic ones), **STOP**: DTW is not active. Re-check- `dtw_token_timestamps`, the `WHISPER_AHEADS_SMALL` preset, and that- `token_timestamps = true`. Do not proceed to measurement until `t_dtw`- demonstrably differs from `t0` and is monotonic non-decreasing.--Print this check to stderr and record the outcome in `REPORT.md`.-------## 5. Run the matrix & score (Phase 3)--For every fixture × every available whisper.cpp backend (cpu, vulkan, [cuda]):--1. Run `wcpp_dtw_bench_<backend> models/ggml-small.bin fixtures/<clip>.wav`,- save stdout to `results/wcpp_<backend>_<clip>.json`.-2. **WER:** `node harness/extract_text.mjs results/wcpp_<backend>_<clip>.json`- → hypothesis text; `node harness/wer.mjs fixtures/refs/<clip>.txt <hyp>`.-3. **Timestamp sanity:** `node harness/analyze.mjs- results/wcpp_<backend>_<clip>.json` (monotonicity, last-word-end ≤ duration,- zero-start count, segments-without-words).-4. **Speed:** read `timing.rtf` from the JSON.--Do the same CT2 INT8 run from § 2.2 if not already captured.--### 5.1 Word-timestamp head-to-head (the quality verdict)--This is the decisive measurement, and it must be **fp16-vs-fp16** to isolate the-DTW algorithm from quantization noise: compare **`wcpp-cpu` on `ggml-small.bin`-(fp16)** against **`ct2_fp16_*` (server without `--int8`)**. For a fixed set of-**~12 anchor words** present in both outputs (use `jfk.wav` — its words are-unambiguous, plus a few from `librispeech_demo_3` which has the 30 s-boundary-"discover"):--- Align whisper.cpp words to CT2 words by matching normalized word text in- sequence.-- For each matched word, compute `|start_wcpp − start_ct2|` and- `|end_wcpp − end_ct2|` in ms.-- Report **median** and **p90** of these deltas, plus any word where the delta- > 200 ms (gross disagreement) as an explicit list.--Optionally add the `faster-whisper` Python reference (`pip install-faster-whisper`, same `Systran/faster-whisper-small` model) as a third column —-it is the source-of-truth DTW both engines approximate.-------## 6. Report & decision gate (Phase 4)--Write `REPORT.md` with:--1. **Provenance:** whisper.cpp tag + commit SHA, model file + SHA, machine- (CPU model, GPU model, OS), Vulkan/CUDA SDK versions, thread count.-2. **DTW-active guardrail result** (§ 4.1) — must be PASS.-3. **Quality table:** per fixture, WER for `ct2-fp16`, `ct2-int8`, `wcpp-cpu`- (fp16), `wcpp-q8_0`, `wcpp-vulkan`, [`wcpp-cuda`]. WER should be- near-identical across engines **and** precisions — it is a model property;- divergence signals a decode bug, not a precision effect.-4. **Timestamp head-to-head table** (§ 5.1): median / p90 word-boundary delta- **fp16-vs-fp16** (`wcpp-cpu` fp16 vs `ct2-fp16`) in ms, plus the- gross-disagreement list. Add one row **q8_0 vs int8** to show whether 8-bit- moves the timestamps at all.-5. **Speed table:** RTF per clip, matched precision only —- **`wcpp-q8_0` vs `ct2-int8`** (production), and **`wcpp` fp16 vs `ct2-fp16`**- (reference), for CPU and each GPU backend. Report "×real-time" = 1/RTF.- Headline number from `two-min-clip.wav`, `wcpp-q8_0` vs `ct2-int8`.--### Decision criteria (state PASS/FAIL explicitly for each)--- **Timestamp quality — PASS if:** median word-boundary delta vs CT2 < ~50 ms- **and** no gross-disagreement words on the anchor set **and** analyze.mjs- reports no monotonicity breaks / no word-end-past-duration. This is the claim- the earlier evaluation said was impossible; prove or disprove it with the- numbers.-- **CPU speed — PASS if:** `wcpp-cpu` RTF is within ~1.3× of `ct2-int8` RTF (i.e.- no meaningful CPU regression from switching engines).-- **GPU speed — INFORMATIONAL:** report `wcpp-vulkan` (and `wcpp-cuda`) ×- real-time. Any GPU number materially better than the CPU ~1.2× is the win that- justifies the whole effort.--These three verdicts feed the next decision (made back in the main session, out-of scope here): **full whisper.cpp** (retire CT2) if quality + CPU speed pass,-vs **hybrid** (CT2 for CPU/CUDA, whisper.cpp for Metal/Vulkan) if CPU regresses.-------## 7. Checklist for the agent (definition of done)--- [ ] Work done under `tools/stt-eval/whispercpp-dtw-poc/`; no changes to- `electron/`, `src/`, or any Electron app build/config file.-- [ ] whisper.cpp cloned at a pinned, recorded tag/SHA; **both**- `ggml-small.bin` (fp16) **and** `ggml-small-q8_0.bin` downloaded; no- `q5_1`/`q4_0`/`.en` model used anywhere.-- [ ] CT2 baseline captured in **both** fp16 (no `--int8`) and int8 modes.-- [ ] CPU + Vulkan builds succeed (CUDA build too iff NVIDIA present).-- [ ] `wcpp_dtw_bench` links `libwhisper` directly, enables- `dtw_token_timestamps` + `WHISPER_AHEADS_SMALL`, reads `t_dtw`, emits the- contract-shaped JSON.-- [ ] Guardrail § 4.1 PASSES (t_dtw ≠ t0, monotonic) — recorded.-- [ ] All fixtures scored for CT2-int8 and every whisper.cpp backend.-- [ ] `REPORT.md` complete with the three explicit PASS/FAIL verdicts and the- headline ×real-time numbers.diff --git a/technical-documentation/_harvest/stt-whispercpp-migration-plan.md b/technical-documentation/_harvest/stt-whispercpp-migration-plan.mddeleted file mode 100644index bc2cef1b9..000000000--- a/technical-documentation/_harvest/stt-whispercpp-migration-plan.md+++ /dev/null@@ -1,478 +0,0 @@-# Implementation plan — migrate OpenScreen STT to whisper.cpp (platform- & GPU-adaptive), remove CTranslate2--**Author handoff:** this document is written to be executed by a coding agent-end-to-end. It assumes the whisper.cpp DTW POC has already landed and passed-(see [`tools/stt-eval/whispercpp-dtw-poc/REPORT.md`](../../tools/stt-eval/whispercpp-dtw-poc/REPORT.md)).-Follow the phases in order; each ends with a concrete "done when" gate.--**Branch:** `feat/native-stt-whispercpp` (continue on it).-**Supersedes on completion:** everything in-[`stt-spec.md`](./stt-spec.md) that describes CTranslate2 as the shipping-engine — rewrite that doc in Phase 7, do not leave both live.-------## 0. Goal, and what the POC already settled--**Goal:** OpenScreen transcribes on **whisper.cpp** on every platform, using-whatever GPU the host actually has (Apple Metal, AMD/Intel/NVIDIA via Vulkan,-NVIDIA via CUDA optionally), and **falls back to CPU automatically** when there-is no usable GPU — from a single binary per platform. All CTranslate2 code,-build scripts, CI, and packaging are removed.--**The POC already proved the risky parts** (numbers in `REPORT.md`, same repo):--- whisper.cpp native DTW word timestamps agree with CT2's `.align()` to- **~20 ms median** on the word-end concept (§4/§6.1 of the report). The- §4.1 "DTW-active" guardrail (assert `t_dtw ≠ t0`, monotonic) passed 28/28.-- whisper.cpp CPU (q8_0) is **1.5–2.9× faster** than CT2 int8 on every fixture.-- **Vulkan on an AMD Radenon** hit **2.0–5.3× real-time** — a GPU path CT2- cannot reach at all. This is the entire reason for the migration.-- q8_0 matches fp16 on both WER and timestamp quality, at ~264 MB vs ~465 MB- and higher speed → **q8_0 is the default shipping model.**-- The `flash_attn=1` trap (silently disables DTW in v1.9.1) is real and is- caught by the guardrail — the new helper must keep `flash_attn = false`.--Pin the **same whisper.cpp the POC used**: tag **`v1.9.1`**, commit-`f049fff95a089aa9969deb009cdd4892b3e74916`, repo-`https://github.com/ggml-org/whisper.cpp.git`.--### Non-goals (this migration)-- CoreML/ANE encoder (optional later; Metal already covers Apple GPU).-- ROCm/HIP (Vulkan is the portable AMD path; do not add HIP).-- A settings UI for language / model size (keep the current `auto` behaviour).-- Rewriting the renderer (`src/lib/captioning/transcribe.ts`) beyond a comment- refresh — the IPC wire shape is preserved on purpose.-------## 1. Architecture decisions (locked — do not re-litigate mid-build)--### 1.1 One helper, HTTP-shaped, model resident--Keep the **long-lived HTTP helper** shape the CT2 server already uses (spawn →-poll `/` for 200 → `POST /inference` with a multipart WAV → JSON back). This-preserves the entire `electron/stt` lifecycle and keeps the model resident-across the many transcriptions in one editing session (reloading a 264 MB-model per request is unacceptable).--The helper is **our own** C++ program that links `libwhisper` directly and-reads `t_dtw` itself — **not** upstream `whisper-server`, which the POC found-does not reliably surface the DTW field. Reuse the already-written, already--validated POC harness `tools/stt-eval/whispercpp-dtw-poc/harness/wcpp_dtw_bench.cpp`-as the transcription core; wrap it in an httplib `/inference` loop lifted from-the old `ctranslate2-server/src/main.cpp`.--**New helper location:** `electron/native/whisper-stt/`-**New binary name:** `whisper-stt-server` (staged as-`electron/native/bin/<os>-<arch>/whisper-stt-server[.exe]`).--whisper.cpp's `whisper_full` handles mel featurization, tokenization, **and-long-form (>30 s) chunking internally**, so the old server's vendored-`mel.cpp`, `tokenizer.h`, `wav.h` parser, `kissfft/`, and the manual-seek-advance chunking are all **deleted, not ported**. The POC's 130 s clip-got full coverage at WER 0.076 through plain `whisper_full`, so the item-4/item-7-chunking bug surface disappears entirely.--### 1.2 GPU adaptivity: one binary per platform, runtime backend selection--whisper.cpp/ggml can build each compute backend as a **dynamically loaded-module** (`-DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON`) and pick the best-available at runtime via `ggml_backend_load_all()`, cleanly falling back to CPU-when a GPU/driver/loader is absent. That is the mechanism that makes "fully-adaptive from one binary" real.--| Platform | Build flags | GPUs covered | CPU fallback |-| --- | --- | --- | --- |-| **macOS arm64** | `-DGGML_METAL=ON` (default), Metal shaders embedded | Apple Silicon GPU | automatic (ggml) |-| **macOS x64** | CPU only (`-DGGML_METAL=OFF`) | — (Intel Macs, no useful Metal target) | n/a |-| **Windows x64** | `-DGGML_VULKAN=ON -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON` | AMD + Intel + NVIDIA via Vulkan | automatic when no Vulkan device/loader |-| **Linux x64** | same as Windows | AMD + Intel + NVIDIA via Vulkan | automatic |-| **Windows/Linux + NVIDIA (optional, later)** | add `-DGGML_CUDA=ON` variant | NVIDIA (max perf) | — |--**Rationale:** Vulkan is a single build that accelerates *all three* desktop-GPU vendors and its loader (`vulkan-1.dll` / `libvulkan.so.1`) ships with-modern drivers; when it's missing, ggml's DL registry falls back to a CPU-variant. So on Windows/Linux we ship **one** `whisper-stt-server` plus its-ggml backend modules and get GPU-or-CPU with no Node-side probing. CUDA stays-**opt-in and deferred** (Vulkan already accelerates NVIDIA; a dedicated CUDA-variant is a later perf refinement, mirroring today's still-open CUDA item).--**Consequence for `gpuDetector.ts`:** it stops probing `nvidia-smi` and stops-choosing between cuda/cpu binaries. It becomes a pure **path resolver** for the-single per-platform binary. The *actual* backend that ran (metal / vulkan /-cpu) is reported **by the helper** in its `/inference` JSON `backend` field-(read from `ggml_backend_name()` of the device whisper selected), which is more-honest than an OS-side guess.--### 1.3 Precision = model file, not a runtime flag--whisper.cpp bakes precision into the GGML file. There is no `--int8`. Ship-**`ggml-small-q8_0.bin`** (multilingual small, ~264 MB) as the single default-model. Drop the `useInt8` plumbing entirely. (Keep fp16 as an optional-higher-quality download behind a constant, but default to q8_0 — the POC shows-q8_0 matches fp16 on WER and DTW while being smaller and faster.)--### 1.4 Word [start, end] construction (validated in POC §4)--`t_dtw` is a per-token **word-end/commit** timestamp (centiseconds; `-1` =-not computed → hard error). Build each word's range exactly as the POC's-`score_all.mjs` validated:--- `word.start = t_dtw of the word's first token`-- `word.end = t_dtw of the next word's first token` (or the segment's `t1`- for the last word in a segment).--This yields monotonic, gap-free per-word ranges. Keep `flash_attn = false`,-`dtw_token_timestamps = true`, `dtw_aheads_preset = WHISPER_AHEADS_SMALL`,-`token_timestamps = true`. A caption-sync sanity check is in Phase 6.-------## 2. Phase 1 — the native helper (`electron/native/whisper-stt/`)--Create the directory and these files.--### 2.1 `CMakeLists.txt`--Model it on the existing `ctranslate2-server/CMakeLists.txt` (MSVC static-CRT-handling, `NOMINMAX`/`WIN32_LEAN_AND_MEAN`, httplib + nlohmann/json via-FetchContent) but swap the engine:--```cmake-cmake_minimum_required(VERSION 3.20)-project(openscreen-whisper-stt LANGUAGES C CXX)-set(CMAKE_CXX_STANDARD 20)-set(CMAKE_CXX_STANDARD_REQUIRED ON)--# Pin whisper.cpp exactly as the POC (REPORT.md provenance).-set(WHISPER_REPO "https://github.com/ggml-org/whisper.cpp.git" CACHE STRING "")-set(WHISPER_REF "v1.9.1" CACHE STRING "")--# Adaptive backend knobs — overridden per-platform by the build script.-option(OSC_ENABLE_VULKAN "Build ggml Vulkan backend" OFF)-option(OSC_ENABLE_METAL "Build ggml Metal backend" OFF)-option(OSC_ENABLE_CUDA "Build ggml CUDA backend" OFF)--include(FetchContent)-# whisper.cpp: enable DL backend registry so CPU fallback is guaranteed-set(GGML_BACKEND_DL ON CACHE BOOL "" FORCE)-set(GGML_CPU_ALL_VARIANTS ON CACHE BOOL "" FORCE)-set(WHISPER_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)-set(WHISPER_BUILD_TESTS OFF CACHE BOOL "" FORCE)-if(OSC_ENABLE_VULKAN)- set(GGML_VULKAN ON CACHE BOOL "" FORCE)-endif()-if(OSC_ENABLE_METAL)- set(GGML_METAL ON CACHE BOOL "" FORCE)- set(GGML_METAL_EMBED_LIBRARY ON CACHE BOOL "" FORCE)-endif()-if(OSC_ENABLE_CUDA)- set(GGML_CUDA ON CACHE BOOL "" FORCE)-endif()--FetchContent_Declare(whisper GIT_REPOSITORY ${WHISPER_REPO} GIT_TAG ${WHISPER_REF} GIT_SHALLOW TRUE)-FetchContent_Declare(httplib GIT_REPOSITORY https://github.com/yhirose/cpp-httplib.git GIT_TAG v0.18.1 GIT_SHALLOW TRUE)-FetchContent_Declare(json GIT_REPOSITORY https://github.com/nlohmann/json.git GIT_TAG v3.11.3 GIT_SHALLOW TRUE)-FetchContent_MakeAvailable(whisper httplib json)--add_executable(whisper-stt-server src/main.cpp)-target_link_libraries(whisper-stt-server PRIVATE whisper httplib::httplib nlohmann_json::nlohmann_json)-if(WIN32)- target_compile_definitions(whisper-stt-server PRIVATE NOMINMAX WIN32_LEAN_AND_MEAN _WIN32_WINNT=0x0A00)- set_target_properties(whisper-stt-server PROPERTIES WIN32_EXECUTABLE OFF)-endif()-```--> Note: with `GGML_BACKEND_DL=ON`, ggml produces sidecar backend libraries-> (`ggml-cpu-*.{dll,so}`, `ggml-vulkan.*`, etc.) that must be **staged next to-> the binary** (Phase 4). Confirm the exact output filenames from the build-> tree and thread them through the staging step — do not hardcode a guess.--### 2.2 `src/main.cpp`--Merge the POC harness's transcription core with an httplib server loop:--- **Startup:** parse `--model <path> --port <n> --host 127.0.0.1- --threads <n>`. Load the context once with- `whisper_context_default_params()` mutated to- `dtw_token_timestamps = true`, `dtw_aheads_preset = WHISPER_AHEADS_SMALL`,- `flash_attn = false`, `use_gpu = true`. Log the chosen backend via- `ggml_backend_dev_name(...)` / the device whisper reports, and keep it for- the response `backend` field.-- **`GET /`** → 200 (readiness probe the TS manager polls).-- **`POST /inference`** (multipart, field `file` = WAV, field `language`,- field `response_format=verbose_json` — same contract the CT2 client sends):- 1. Parse the uploaded WAV to 16 kHz mono float PCM (use whisper.cpp's bundled- `dr_wav.h`, as the POC harness does — assert 16 kHz / mono / PCM16, the- renderer already guarantees this via `writeSamplesAsWav`).- 2. `whisper_full_default_params(WHISPER_SAMPLING_GREEDY)` with- `token_timestamps = true`, `language = <lang or "auto">`,- `n_threads = <arg>`, `print_progress = false`. Run `whisper_full`.- 3. **Guardrail (keep from POC §4.1):** if any non-special token has- `t_dtw == -1`, or `Σ|t_dtw−t0| == 0`, return HTTP 500 with a clear- "DTW inactive" body. This is the exact 2024 failure mode; never let it- ship silently.- 4. Walk segments → tokens, group into words (new word when detokenized text- starts with a space or is the segment's first non-special token), build- `word.start/end` per §1.4, `probability = mean token p`.- 5. Emit `verbose_json`: `{ segments:[{text,start,end,words:[{word,start,end,probability}]}],- detected_language, backend, timing:{elapsed_s,audio_s,rtf} }` — the exact- shape `ctranslate2Server.ts` already parses (`Ct2JsonSegment` /- `Ct2JsonWord`), so the TS parser barely moves.-- **Concurrency:** whisper contexts are not thread-safe; serialize `/inference`- behind a mutex (single-flight, matching the TS-side `inFlight` queue).-- **Units:** `t_dtw` is centiseconds → seconds = `t_dtw / 100.0`.--**Done when:** built locally on Windows (Vulkan) via Phase 3's script,-`POST /inference` with `jfk.wav` returns segments+words, the guardrail passes,-and RTF roughly matches the POC's `wcpp Vulkan q8_0` numbers.-------## 3. Phase 2 — build script & CI--### 3.1 `scripts/build-whisper-stt.sh` (replaces `build-ctranslate2-server.sh`)--Same structure as the CT2 script (host detection → `os_arch_tag` →-`build_variant` → copy into `electron/native/bin/<os>-<arch>/`), but:--- Pass the platform flags from §1.2:- - macOS arm64 → `-DOSC_ENABLE_METAL=ON`- - macOS x64 → none (CPU)- - Windows/Linux → `-DOSC_ENABLE_VULKAN=ON`- - optional `ENABLE_CUDA=ON` env → add a second `*-cuda` variant with- `-DOSC_ENABLE_CUDA=ON` (deferred; wire the flag but the default matrix does- not build it).-- After `cmake --build`, **stage the binary AND its ggml backend sidecar- libraries** into `electron/native/bin/<os>-<arch>/`. Enumerate them from the- build tree (`ggml-*.{dll,so,dylib}`, `whisper.{dll,so,dylib}` if shared) —- do not assume a fixed list.-- Rename the npm script: `package.json` →- `"build:whisper-binaries": "bash scripts/build-whisper-stt.sh"` (remove- `build:ctranslate2-binaries`).--### 3.2 CI: `.github/workflows/build-whisper-stt.yml` (replaces `build-ctranslate2-server.yml`)--Matrix:--| Runner | arch | Backend build deps to install |-| --- | --- | --- |-| `macos-latest` | arm64 | none (Metal ships with Xcode) |-| `macos-13` | x64 | none (CPU) |-| `ubuntu-latest` | x64 | Vulkan SDK (LunarG apt repo) + `glslc` (`shaderc`) |-| `windows-latest` | x64 | Vulkan SDK (`humbletim/setup-vulkan-sdk` or LunarG silent installer) |--- Install the Vulkan SDK on the Linux/Windows legs (needed to *compile* shaders;- the runtime loader is not bundled).-- Run `bash scripts/build-whisper-stt.sh`, then tar+upload- `electron/native/bin/<os>-<arch>/` (binary + ggml sidecars) as an artifact- named `whisper-stt-<os>-<arch>`.-- Keep the `push: paths:` trigger, repointed at- `scripts/build-whisper-stt.sh`, `electron/native/whisper-stt/**`, and the- new workflow file.-- Update `build.yml`'s STT comment block (lines ~47–50) from "CTranslate2- server provides word timestamps via `.align()`" to the whisper.cpp DTW story,- and make sure `build.yml` downloads/consumes the renamed artifacts if it- bundles them (today it downloads installer artifacts, not the server tarballs- directly — verify and adjust if the binaries are fetched anywhere).--**Done when:** the new workflow builds green on all four legs and each artifact-contains a runnable `whisper-stt-server` plus its backend sidecars.-------## 4. Phase 3 — Electron/TypeScript integration (`electron/stt/`)--Preserve the IPC contract shape; swap the internals.--### 4.1 `transcriptionContract.ts`-- `SttBackend` → `"whispercpp-metal" | "whispercpp-vulkan" | "whispercpp-cuda" | "whispercpp-cpu"`.- The renderer only imports the segment shapes, not the union (per the file's- own note), so this is safe.-- Refresh the `.align()` DTW comments to whisper.cpp DTW (`t_dtw` /- `WHISPER_AHEADS_SMALL`).--### 4.2 `ctranslate2Server.ts` → rename to `whisperServer.ts`-- Rename the class `CTranslate2ServerManager` → `WhisperServerManager`.-- Drop the `useInt8` option (precision is the model file now).-- Change the resolved-binary default backend from `"ctranslate2-cpu"` to- `"whispercpp-cpu"`, and set the reported backend from the JSON `backend`- field the helper returns (fall back to `whispercpp-cpu`).-- Everything else (port pick, `pollUntilReady`, stderr ring buffer, WAV temp- file, multipart POST, `verbose_json` parse, single-flight queue) stays —- the wire shape is identical.-- Rename the env override `OPENSCREEN_CT2_SERVER_EXE` → `OPENSCREEN_WHISPER_SERVER_EXE`.--### 4.3 `gpuDetector.ts`-- Delete `probeNvidia` / `detectGpuBackend`'s CUDA branch. New `detectGpuBackend`- just returns the platform's single binary backend tag (Mac→`whispercpp-metal`- on arm64 else `whispercpp-cpu`; Win/Linux→`whispercpp-vulkan`). The *real*- backend is corrected from the helper's response at runtime, so this is only- the binary-name selector.-- `binaryNameForBackend` → `whisper-stt-server[.exe]` (single name; the backend- suffix scheme goes away, since there's one binary per platform — keep the- `candidateBinaryPaths` search locations and the `.exe`/bare dual-name trick).-- Update `resolveBinaryPath` accordingly.--### 4.4 `modelManager.ts`-- Replace the CT2 4-file descriptor with a **single GGML file**:- `ggml-small-q8_0.bin` from `https://huggingface.co/ggml-org/whisper.cpp/resolve/main/ggml-small-q8_0.bin`- (cacheDir e.g. `whisper-ggml`). Keep SHA-256 verify, atomic `.partial`- rename, retry/backoff, progress — all reusable as-is.-- `modelPaths()` returns the **file path** (not a directory); update- `areModelsPresent` to check the single file's presence/size.-- Update the `start()` call in `index.ts` to pass the model **file** path and- drop `useInt8: true`.-- **Pin the SHA-256** of `ggml-small-q8_0.bin` from the POC's recorded digest- (`49C8FB02...` in `REPORT.md` §1) instead of leaving it `null`.--### 4.5 `index.ts`-- `CTranslate2ServerManager` → `WhisperServerManager`; drop `useInt8`; refresh- the class doc comment (DTW via whisper.cpp, not `.align()`).--### 4.6 Tests (`electron/stt/*.test.ts`)-- Rename `ctranslate2Server.test.ts` → `whisperServer.test.ts`; update spawned-- binary name, dropped `useInt8`, new backend tags.-- `gpuDetector.test.ts`: rewrite the backend-selection cases for the new matrix.-- `modelManager.test.ts`: single-file download/verify instead of the 4-file dir.-- `index.test.ts`: backend tag + no `useInt8`.--**Done when:** `npm test` passes and a dev run (Phase 6) transcribes end-to-end.-------## 5. Phase 4 — packaging (`electron-builder.json5`)--- **macOS** and **Windows** already glob `electron/native/bin/<platform>-*/*`,- so the renamed binary + ggml sidecars flow in automatically — just refresh- the CT2 comment block (lines ~34–42) to whisper.cpp.-- **Linux is currently missing** an `extraResources` entry for- `electron/native/bin` — add one filtered to `linux-*/*` so the helper +- sidecars actually ship in the AppImage/deb/pacman (pre-existing gap; the CT2- server never shipped on Linux).-- Confirm whether any ggml sidecar is a `.node`/dlopen'd `.so` that must be in- `asarUnpack` — the binaries live under `extraResources` (outside asar) so- they're already unpacked, but double-check the helper resolves its sidecars- from its own directory at runtime (ggml `ggml_backend_load_all()` searches- the executable dir).-- Do **not** bundle the Vulkan loader (`vulkan-1.dll`/`libvulkan.so.1`) — it is- a driver/system component; bundling risks version conflicts. ggml falls back- to CPU if it's absent.--**Done when:** `electron-builder --dir` on each OS produces an unpacked app-whose `resources/electron/native/bin/<os>-<arch>/` has the helper + sidecars,-and the app transcribes from that unpacked build.-------## 6. Phase 5 — remove all CTranslate2 code (exact list)--Delete (after Phases 1–5 are green so nothing references them):--**Native / build:**-- `electron/native/ctranslate2-server/` (entire dir: `CMakeLists.txt`,- `src/main.cpp`, `src/mel.cpp`, `include/{wav.h,mel.h,tokenizer.h}`,- `third_party/kissfft/*`, `README.md`).-- Built CT2 artifacts in `electron/native/bin/win32-x64/`:- `ctranslate2-server-cpu.exe`, `ctranslate2-server-ctranslate2-cpu.exe`,- `ctranslate2.lib`, `ctranslate2.dll`, `dnnl.dll`.-- `scripts/build-ctranslate2-server.sh`, `ct2-build.cmd`,- `scripts/configure-ct2-build.ps1`, `scripts/start-ct2-server.cmd`,- `scripts/stt-wrapper.bat`.-- `scripts/stt-dev-server.mjs` and `scripts/e2e-stt-smoke.mjs` — port to the- new helper if still useful, else delete (check contents first; if they only- spawn the CT2 server, replace with whisper-stt equivalents or drop).-- `.github/workflows/build-ctranslate2-server.yml` (replaced by- `build-whisper-stt.yml`).--**TS:**-- `electron/stt/ctranslate2Server.ts` + `.test.ts` (replaced by- `whisperServer.ts` + test).--**Config:**-- `package.json`: remove `build:ctranslate2-binaries`; remove the `tar`- dependency (already an open item — `modelManager` downloads a single file).- Run `npm install` to update `package-lock.json`.-- `.gitignore`: change the `/.cache/ctranslate2-build` entry to the whisper- build-cache path used by the new script.-- Grep-sweep remaining string references: `OPENSCREEN_CT2_MODEL_DIR`,- `ctranslate2`, `ct2`, `CTranslate2` across `scripts/`, `electron/`, `docs/`,- workflows, and `design/*.html` — repoint or remove each. (The POC dir under- `tools/stt-eval/whispercpp-dtw-poc/` legitimately references CT2 as the- *baseline it compared against* — leave it; it is the evidence base.)--**Done when:** `rg -i "ctranslate2|\bct2\b"` returns only the POC evidence dir-and this migration doc's history, `npm run build-vite` and `npm test` pass.-------## 7. Phase 6 — verification (must pass before merge)--1. **Guardrail:** every `/inference` on a speech clip passes the DTW-active- check (no `t_dtw == -1`, `Σ|t_dtw−t0| > 0`).-2. **Adaptivity, per platform:**- - Windows/Linux with a GPU: helper logs a Vulkan device, RTF ≈ POC Vulkan- numbers. Then force CPU (e.g. hide the loader / no GPU VM) and confirm it- **still transcribes** on CPU, backend field = `whispercpp-cpu`.- - macOS arm64: helper logs Metal, transcribes; RTF materially better than CPU.-3. **Quality regression:** run the 7 POC fixtures through the *integrated* app- path (renderer → IPC → helper) and confirm WER matches `REPORT.md` §3- (whisper.cpp column), and no hallucinated trailing "Thank you" coda (the CT2- artifact the migration also fixes).-4. **Caption sync (§1.4 validation):** open a real recording in the editor,- confirm word highlights track audio acceptably. If DTW word-*start* feels- consistently ~200–300 ms late (because `t_dtw` is word-end), apply the- documented fallback: shift `word.start` to the previous word's `t_dtw`- (i.e. use the DTW points as boundaries between words) or use whisper.cpp's- `token.t0` as the start bound. Record the choice in `stt-spec.md`.-5. **Long-form:** the 130 s fixture returns full coverage in one `whisper_full`- call (no manual chunking), WER ≈ report.-6. Use the `/verify` skill on the integrated change before committing.-------## 8. Phase 7 — docs--- **Rewrite [`stt-spec.md`](./stt-spec.md)**: retitle to "STT engine- specification: Whisper via whisper.cpp", replace §1 architecture (new module- table, whisper.cpp helper, GGML model, no manual chunking), rewrite §2 to- state the decision is now *settled toward whisper.cpp* with the POC as- evidence (link `REPORT.md`), move the CT2 design into §3 History, refresh the- build/run section (§4) and open items (§6: drop the ones the migration- closes — Ruy/oneDNN, CT2 CUDA packaging, tar dep, chunk-boundary dedup that- whisper.cpp handles; keep model-SHA-pin now *done*, add CUDA-variant and- CoreML as new opt-in items).-- Update the pointer in `README`/`electron/native/README.md` and any- `CLAUDE.md` STT note.-- The POC docs (`stt-whispercpp-dtw-poc-plan.md`, `REPORT.md`) stay as the- historical justification — link them from the rewritten spec.-------## 9. Suggested commit sequence--1. `feat(stt): add whisper-stt native helper (whisper.cpp + DTW HTTP server)` — Phase 1-2. `build(stt): whisper-stt build script + CI, GPU-adaptive matrix` — Phase 2-3. `feat(stt): swap Electron STT glue to whisper.cpp (contract preserved)` — Phase 3-4. `build(stt): package whisper-stt binaries incl. Linux + ggml sidecars` — Phase 4-5. `refactor(stt): remove CTranslate2 engine, scripts, CI, deps` — Phase 5-6. `test(stt): integrated whisper.cpp verification` — Phase 6-7. `docs(stt): rewrite spec around whisper.cpp; retire CT2 sections` — Phase 7--Keep 5 (the big deletion) after 1–4 so the tree always builds. Never delete the-CT2 binaries until the whisper helper resolves and runs on the same machine.-------## 10. Definition of done--- [x] `whisper-stt-server` builds on macOS (Metal), Windows (Vulkan), Linux- (Vulkan), each with automatic CPU fallback verified.-- [x] `electron/stt/` runs entirely on the helper; IPC contract unchanged;- `npm test` green.-- [x] GGML q8_0 model downloaded + SHA-pinned by `modelManager`.-- [x] Installers on all three OSes bundle the helper + ggml sidecars (Linux- gap closed).-- [x] Zero `ctranslate2`/`ct2` references outside the POC evidence dir.-- [x] `stt-spec.md` rewritten; POC report linked as the decision record.diff --git a/technical-documentation/_harvest/v4-design-parity.md b/technical-documentation/_harvest/v4-design-parity.mddeleted file mode 100644index 77be26337..000000000--- a/technical-documentation/_harvest/v4-design-parity.md+++ /dev/null@@ -1,76 +0,0 @@-# OpenScreen Editor v4 — design parity & implementation notes--Implementation of the **OpenScreen Editor v4** design-(`claude.ai/design` project `54649d16-a5bd-4352-bed6-a62d4c2dff2e`,-`OpenScreen Editor v4 - standalone.html`), started from-`feat/native-stt-whispercpp`.--## How the design was imported--The design lives in a claude.ai/design **design-system** project, read-through the design MCP (`DesignSync`, authenticated via `/design-login` to-`https://api.anthropic.com/v1/design/mcp`). Method calls used:--- `list_files` on project `54649d16…` — full file inventory.-- `get_file` on the v4 design sources.--**On `OpenScreen Editor v4 - standalone.html` specifically:** that file is a-self-extracting gzip **bundle** (an unpacker script + a `__bundler/manifest`-of base64/gzip assets + a `__bundler/template` of the page markup). Retrieved-via `get_file`, it comes back **exactly 262 144 bytes = 256 KiB** — the tool's-hard response cap — and is truncated there: the manifest (253 KB, images only —-the C2PA-signed logo PNG + SVGs) fits, but the `__bundler/template` markup and-closing tags sit past the cap and are unreachable. `get_file` has no-offset/paging parameter, so the *full* bundle cannot be pulled through the MCP.--The bundle is a build artifact **generated from** the project's editable-ground-truth source, which was retrieved **complete** and audited in full:--- `OpenScreen Editor v4.dc.html` — 134 799 bytes, ends in `</html>`. The- `<x-dc>` template + the `DCLogic` controller (`state`, `renderVals()`),- covering the `stageMode` media/preview/rec branches, the 8 inspector facets,- every slider/toggle, the timeline lanes/clips/navigator logic, and the- light+dark token maps.-- `ui_kits/editor/index.html` — the React recreation of the same editor.-- `tokens/*.css` — the color/type/spacing/radii/elevation tokens.--The standalone renders exactly this design; the truncated tail contains no-design information not present in the fully-retrieved `.dc.html`.--## Design → component map--| Design element | Implementation |-|---|---|-| App grid, rows `58px 1fr {timeline}` per mode | `NewEditorShell.tsx` + `v4/EditorShellV4.module.css` |-| Top bar + **Media / Edit / Rec** switch | `v4/EditorTopBar.tsx` |-| Agent panel (392px, Edit only) | reuses `LeftPanel` (`ChatStripPanel`) in the `.agent` column |-| Stage — Edit preview | `Preview.tsx` inside `.stage` |-| Stage — Media browser (search / grid / detail) | `v4/MediaStage.tsx` |-| Stage — Rec (webcam + glass source bar + big REC) | `v4/RecStage.tsx` |-| Floating transport | `v4/FloatingTransport.tsx` |-| Floating inspector + 8-facet rail | `v4/FloatingInspector.tsx` → reuses `RightPanes` (Background/Effects/Layout/Cursor/Transcript) + Captions/Crop/Chapters |-| Timeline footer (tools, ruler, lanes, clips, navigator) | `Bottombar.tsx` + `TimelinePane.tsx` |-| Media timeline "Arrange clips" header | `Bottombar` `timelineVariant="media"` |-| Region pills (flat wash + 1.5px frame, per-kind color) | `NewEditorShell.module.css` `.zoomPill/.speedPill/.annotationPill/.skipPill` |-| Lane watermark hides when populated | `RegionTimeline.tsx` (`Children.count`) |-| Clip card (--surface-1 / 1.5px / 11px) + floating blur label chip | `TimelinePane.module.css` `.trackBlock/.trackVisual/.trackInfo` |-| Navigator (grey track + --surface-hi window + grips) | `TimelinePane.module.css` `.timelineNavigator*` |-| Tokens (incl. added `--surface-hi`, dark `--fg-emphasis`, `--accent-border/ring/stripe`, `*-wash`) | `src/styles/design-tokens.css` |--## Verification--`tsc --noEmit`, `biome check`, and full `vite build` (renderer + Electron main-+ preload) all pass. All three modes and the populated Edit-mode timeline were-verified in a real browser render (dark hero theme) via a browser-only preview-config (`vite.v4preview.config.ts`) with a seeded document — see-[verify commands memory] / `NewEditorShell` dev store exposure.--## Deliberate engineering decision--The timeline's **visual** matches the design (verified with live data). Its-**interaction logic** — clip drag/reorder, region resize, place-skip,-zoom-pan navigator — is the existing, tested machinery, restyled rather than-rewritten. Re-deriving that logic from scratch was intentionally avoided: it-carries real regression risk to functional editing for no visual gain. If a-ground-up timeline reimplementation is desired, it should be scoped as its own-effort with that risk acknowledged.