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: add the doc index and the decision ledger, repoint every inbound reference
Etienne Lescota6a57ba69bd5
diff --git a/.github/workflows/build.yml b/.github/workflows/build.ymlindex 319a9473b..33fba4806 100644--- a/.github/workflows/build.yml+++ b/.github/workflows/build.yml@@ -46,7 +46,7 @@ jobs:# ponytail: STT is handled by the bundled whisper-stt-server (whisper.cpp# with native DTW token timestamps). No separate VAD model is fetched- # here. See docs/engineering/stt-spec.md for the full architecture.+ # here. See technical-documentation/architecture/transcription-and-captions.md for the full architecture.- name: Build Windows apprun: npm run build:win -- --publish never@@ -77,7 +77,7 @@ jobs:# ponytail: STT is handled by the bundled whisper-stt-server (whisper.cpp# with native DTW token timestamps). No separate VAD model is fetched- # here. See docs/engineering/stt-spec.md for the full architecture.+ # here. See technical-documentation/architecture/transcription-and-captions.md for the full architecture.- name: Build Windows Store packagerun: npm run build:win:store -- --publish neverdiff --git a/.gitignore b/.gitignoreindex ccc431231..82bb66e0d 100644--- a/.gitignore+++ b/.gitignore@@ -84,7 +84,7 @@ result-*# whisper.cpp DTW POC (tools/stt-eval/whispercpp-dtw-poc) — vendored engine# clone, downloaded GGML models, and generated build/results artifacts.-# See docs/engineering/stt-whispercpp-dtw-poc-plan.md.+# See technical-documentation/architecture/transcription-and-captions.md./tools/stt-eval/whispercpp-dtw-poc/whisper.cpp//tools/stt-eval/whispercpp-dtw-poc/build-cpu//tools/stt-eval/whispercpp-dtw-poc/build-vulkan/diff --git a/.harness/docs/architecture-overview.md b/.harness/docs/architecture-overview.mdindex 373f9618e..dbc2e4df5 100644--- a/.harness/docs/architecture-overview.md+++ b/.harness/docs/architecture-overview.md@@ -1,6 +1,6 @@# OpenScreen Architecture Notes-Quick map of how the app fits together, for the Mavis reins. For deeper details, see `../docs/architecture/native-bridge.md` and `../docs/engineering/`.+Quick map of how the app fits together, for the Mavis reins. For deeper details, see `../technical-documentation/architecture/native-bridge.md` and `../technical-documentation/engineering/`.## Process layoutdiff --git a/.harness/docs/git-workflow.md b/.harness/docs/git-workflow.mdindex cd0895fdc..68f248645 100644--- a/.harness/docs/git-workflow.md+++ b/.harness/docs/git-workflow.md@@ -41,7 +41,7 @@ All five must be green before merge. Native helper code is NOT covered by CI —## Release flow-Two `workflow_dispatch` workflows cut a release. Trunk-based on `main`, but **release branches freeze the RC codebase between cut and promote** (see § Release branches below). Both require the `OPENSCREEN_RELEASE_TOKEN` secret — see `docs/secrets.md`.+Two `workflow_dispatch` workflows cut a release. Trunk-based on `main`, but **release branches freeze the RC codebase between cut and promote** (see § Release branches below). Both require the `OPENSCREEN_RELEASE_TOKEN` secret — see `technical-documentation/engineering/release-and-secrets.md`.### Step 1: cut a release candidatediff --git a/.harness/reins/openscreen-dev/agent.md b/.harness/reins/openscreen-dev/agent.mdindex 33c4a28a1..4bd9ce150 100644--- a/.harness/reins/openscreen-dev/agent.md+++ b/.harness/reins/openscreen-dev/agent.md@@ -15,7 +15,7 @@ You are the generalist implementer for the OpenScreen project — a free, open-s## How you work- Read `AGENTS.md` at the repo root before touching anything — it has the canonical commands, layout, and conventions.-- When the change touches recording, IPC, or the native bridge, read `.harness/docs/architecture-overview.md` (start here), `docs/architecture/native-bridge.md` (deeper dive), and `docs/engineering/` (native helper roadmaps).+- When the change touches recording, IPC, or the native bridge, read `.harness/docs/architecture-overview.md` (start here), `technical-documentation/architecture/native-bridge.md` (deeper dive), and `technical-documentation/engineering/` (native helper roadmaps).- TypeScript strict mode, Biome format (tabs, double quotes, 100-col). Run `npm run lint:fix` before committing.- For renderer-only iteration use `npm run build-vite`. For full packaging use `npm run build` (electron-builder, slow).- Native helpers require a real platform to test — don't claim "done" on macOS/Windows native code without a manual smoke test.diff --git a/.harness/reins/openscreen-tester/agent.md b/.harness/reins/openscreen-tester/agent.mdindex cbf3afdc6..bd4658ce4 100644--- a/.harness/reins/openscreen-tester/agent.md+++ b/.harness/reins/openscreen-tester/agent.md@@ -15,7 +15,7 @@ You are the test specialist for the OpenScreen project — a free, open-source s## How you work- Read `AGENTS.md` at the repo root for commands and conventions.-- Read `docs/tests/writing-tests.md` for the project's test style guide.+- Read `technical-documentation/testing/writing-tests.md` for the project's test style guide.- Match the style of neighboring `*.test.<ext>` files in the same package — don't invent new patterns.- Unit tests: `npm run test` (Vitest, jsdom). Browser tests: `npm run test:browser` (needs `npm run test:browser:install` once). E2E: `npm run test:e2e` (Playwright).- E2E specs in `tests/e2e/windows-native-checklist.spec.ts` are Windows-only — gate with `test.skip` for other platforms rather than deleting.diff --git a/.worktrees/wt-9ce78f24/HANDOFF.md b/.worktrees/wt-9ce78f24/HANDOFF.mddeleted file mode 100644index 9ab72d318..000000000--- a/.worktrees/wt-9ce78f24/HANDOFF.md+++ /dev/null@@ -1,299 +0,0 @@-# AI-Edition Implementation Handoff--**Branch**: `docs/ai-edition-plan` (commit `cf25858`, pushed to `origin`)-**Worktree**: `G:\repos\openscreen\.worktrees\wt-9ce78f24`-**Dev server**: `http://localhost:5173/?windowType=editor` (browser mode with shim)-------## 1. Context--The user (Etienne Lescot, repo owner) was working through the implementation of the **OpenScreen x Axcut AI-edition merge**. The original PR #35 (commit `1e9db17` on the same branch) introduced the planning docs only:--- `docs/architecture/ai-edition-merge-plan.md` — the 10-phase merge plan-- `docs/architecture/axcut-inventory.md` — catalog of the axcut codebase-- `docs/architecture/openscreen-inventory.md` — catalog of the OpenScreen codebase-- `docs/architecture/ai-edition-collision-analysis.md` — collision analysis--This implementation PR (`cf25858`) delivers the **code** for that plan — all phases 0, 1, 3, 4, 6-8, and partial 9, plus a developer-convenience browser shim and spec updates that changed the framing.--The plan was re-framed mid-implementation. The user clarified:-- **New editing model** (multi-asset, clips, skips, transcript, virtual-time preview) = **default for all users**, not opt-in-- **AI features** (LLM provider config, chat) = **opt-in** behind `AI_FEATURES_ENABLED`-- **Local Whisper** = **privacy-safe, not gated** (runs in-browser, never calls out)--This is the spec's `§0 Framing` section. See `docs/architecture/ai-edition-merge-plan.md` lines ~13-65.-------## 2. What was built (file by file)--### 2.1 Schema & migration (`src/lib/ai-edition/`)--| File | Purpose |-|------|---------|-| `schema/index.ts` | Vendored axcut v2 schema + v3 additions (`annotations[]`, `zoomRanges[]`, `legacyEditor` envelope, `transcripts[]`). `axcutSchemaVersion = 3`. `clip.sourceEndSec` made optional (duration unknown at migration time). |-| `schema/index.test.ts` | 15 schema tests (version enforcement, optional clip duration, envelope passthrough, etc.) |-| `document/timeline.ts` | Pure interval math: `normalizeIntervals`, `subtractInterval`, `invertIntervals`, `buildTimelineFromIntervals`, `replaceTimeline`, `restoreFullTimeline`. Ported from axcut `apps/server/src/lib/timeline.ts` (no event bridge, no agent — just the math). |-| `document/timeline.test.ts` | 14 tests covering all the above. |-| `document/migrate.ts` | Bidirectional `EditorProjectData` (v2) ↔ `AxcutDocument` (v3). Notes: `zoomRanges`/`annotations` use **ms** units to mirror the legacy types; timeline ops use **sec** units. The migration is lossless in both directions thanks to the `legacyEditor` passthrough. |-| `document/migrate.test.ts` | 14 tests including round-trip, v1 legacy, focus clamping. |-| `document/transcribe.ts` | `transcribeAsset(document, assetId)` wraps the existing `extractMono16kFromVideoUrl` + `transcribeMono16kToSegments` (from `src/lib/captioning/`). Returns an `AxcutTranscript`. `withTranscript` writes it back to the document. |-| `document/ids.ts` | `createId(prefix)` using `uuid.v4()`. |-| `timeline/virtual-preview.ts` | Pure time-mapping: `totalVirtualDuration`, `clampVirtualTime`, `locateVirtualPosition`, `locateSourcePosition`, `keptWordIdSet`, `formatSeconds`. |-| `timeline/virtual-preview.test.ts` | 8 tests. |-| `store/projectStore.ts` | Zustand store: `projectId`, `document`, `revision`, `status`, `error`, `sourceDurationSec`, `currentTimeSec`. Actions: `loadProject`, `createProject`, `addAsset`, `removeAsset`, `replaceTimeline`, `restoreFullTimeline`, `setTranscript`, `setSourceDuration`, `setCurrentTime`, `saveDocument`, `setDocument`, `clear`. |-| `store/projectStore.test.ts` | 5 tests with `nativeBridgeClient.aiEdition` mocked. |-| `exporter/documentExporter.ts` | Adapter: maps `AxcutDocument` → `VideoExporterConfig` / `GifExporterConfig`. Clips → `trimRegions` (inverse). Reads `legacyEditor` for wallpaper, cursor, webcam, etc. `sourceWidth`/`sourceHeight` come from caller. |--### 2.2 Main-process services (`electron/ai-edition/`)--| File | Purpose |-|------|---------|-| `document-service.ts` | `DocumentService(projectsRoot)`: `listProjects`, `getProject(projectId)`, `createProject(title)`, `saveProject(doc)`, `deleteProject(projectId)`, `addAsset(projectId, {path, label?})`, `removeAsset(projectId, assetId)`. One `.axcut` JSON file per project under `app.getPath('userData')/projects/`. Validates paths against an allowlist of video extensions. Cascades clips + skipRanges on asset removal. |-| `document-service.test.ts` | 16 tests (CRUD, path traversal, cascade, primary-asset reassignment). |-| `provider-registry.ts` | 8 provider definitions (anthropic, openai, google, mistral, openrouter, openai-compatible, openai-oauth, copilot-proxy) with `authKind`, `supportsReasoningEffort`, `envKeys`, `baseUrl`. Ported from axcut `provider-registry.ts`. |-| `llm-config-store.ts` | `LlmConfigStore(userDataPath)`: config in `llm-config.json` plain JSON, **credentials in `safeStorage`-encrypted bytes** at `llm-credentials.enc`. Env vars override stored keys (same precedence as axcut). |-| `chat-service.ts` | `runChat(projectId, message, llmConfig)`: validates config + API key, stores messages in a `Map<projectId, AiEditionChatMessage[]>`, **returns a stub assistant message** (LLM call needs `@langchain/*` deps). `getChatHistory(projectId)` returns the in-memory list. |-| `native-bridge/services/aiEditionService.ts` | Adapter to the existing `native-bridge` envelope: wraps `DocumentService`, `LlmConfigStore`, and the chat stubs into the `domain: "aiEdition"` IPC contract. |--### 2.3 IPC bridge extensions--- `electron/ipc/nativeBridge.ts` — added the `aiEdition` domain case. Each action calls into `AiEditionService` (`document.listProjects`, `document.get`, `document.create`, `document.save`, `document.delete`, `document.addAsset`, `document.removeAsset`, `llm.getSnapshot`, `llm.setConfig`, `llm.setApiKey`, `llm.removeApiKey`, `chat.run`, `chat.history`).-- `electron/ipc/handlers.ts` — wires `DocumentService` + `LlmConfigStore` + chat functions into the `NativeBridgeContext`.-- `src/native/contracts.ts` — adds `AiEditionLlmConfig`, `AiEditionLlmSnapshot`, `AiEditionChatMessage`, `AiEditionChatResult` types and the new `aiEdition` action cases to the `NativeBridgeRequest` union.-- `src/native/client.ts` — adds the `nativeBridgeClient.aiEdition` namespace with `listProjects`, `get`, `create`, `save`, `delete`, `addAsset`, `removeAsset`, `llmGetSnapshot`, `llmSetConfig`, `llmSetApiKey`, `llmRemoveApiKey`, `chatRun`, `chatHistory`.-- `src/native/browserShim.ts` — **new**. Browser-mode shim that:- - Stubs `window.electronAPI` (no-op `openVideoFilePicker`, `pickExportSavePath`, etc.)- - Overrides `nativeBridgeClient` methods to return mock data- - Persists projects/docs in `localStorage` (`browser-shim-projects`, `browser-shim-document`)- - Auto-installs when running in a plain browser at `http://localhost:5173/?windowType=editor`- - Detected via absence of `window.electronAPI`--### 2.4 Renderer UI (`src/components/ai-edition/`)--| File | Purpose |-|------|---------|-| `IconRail.tsx` | Vertical 36-44px icon rail with collapse/expand chevron. Used for both left and right rails. Tooltip on hover. |-| `NewEditorShell.tsx` | **The default editor** for all users (replaces legacy `VideoEditor`). Layout: top header (project title + 3 toggle buttons) + body with left rail | left content (Project/Chat) | center (video + timeline) | right content (Transcript/Background/Video effects/Camera/Cursor/Crop/Export) | right rail. Recording → asset on editor open (auto-creates project + adds asset). Legacy `.openscreen` loading via the "Open" header button (migrates v2 → v3). |-| `AiEditionShell.tsx` | Re-exports `AiEditionOrLegacy` which delegates to `NewEditorShell` (legacy VideoEditor is now unused but kept for rollback). |-| `ProjectPanel.tsx` | Left content: project list + create input + assets list. Uses raw Tailwind matching OpenScreen's dark surface. |-| `TimelinePane.tsx` + `.module.css` | Ported from axcut `apps/web/src/components/TimelinePane.tsx` (~837 lines). Ruler, kept/cut segments, playhead, zoom (Ctrl+wheel), pan (Alt+drag), add cut, delete cut, resize cut handles, fit button, navigator overview. |-| `VirtualPreview.tsx` + `.module.css` | Ported from axcut `apps/web/src/components/VirtualPreview.tsx`. Single-video element with virtual-time seeking; seeks across clip boundaries; reports metadata via `onLoadedMetadata`; exposes video element via `onVideoElement` callback. |-| `TranscriptEditor.tsx` + `.module.css` | Click word / shift-click word → range → "Cut" button → `dropWordRange` op. Kept words = default, skipped = red strikethrough. |-| `ChatPanel.tsx` | Right content when `leftTab === "chat"`. Messages list + input + send. In-memory history. |-| `EditorSettings.tsx` | Bridge that wraps the **original `SettingsPanel`** (from `src/components/video-editor/SettingsPanel.tsx`, unchanged). Reads from `AxcutDocument.legacyEditor` (wallpaper, cursor, webcam, shadow, etc.), `document.zoomRanges`, `document.annotations`. Writes back through `setDocument` / `saveDocument`. Maps `activeTab` to `SettingsPanelMode` (background/effects/layout/cursor/timeline/export). Calls `SettingsPanel` with `hideInternalRail` so the right rail is the only navigation. |--### 2.5 App-level wiring--- `src/App.tsx` — imports and calls `installBrowserShims()` before render. The `editor` windowType still lazy-loads the `AiEditionShell` (which now renders `NewEditorShell`).-- `src/components/video-editor/featureFlags.ts` — renamed `AI_EDITION_ENABLED` → `AI_FEATURES_ENABLED`, default `false`. The flag now **only** gates the LLM/agent UI (chat panel). The new editor is the default for everyone.-- `package.json` — added `zod: ^3.23.8` and `zustand: ^5.0.8`.--### 2.6 Documentation--- `docs/architecture/ai-edition-merge-plan.md` — **major rewrite**:- - **New §0 Framing** — two layers (new editor = default, AI features = opt-in)- - **§5.8 locked decision** updated: flag now gates only LLM/agent UI- - **§10 cut-over** — no editor cut-over (new editor is default); only AI features opt-in- - Locked decisions list re-ordered: framing change recorded-------## 3. What was tested--- **`npx tsc --noEmit`**: clean (no errors)-- **`npm run lint`**: clean (1 warning, not error — `useExhaustiveDependencies` in TimelinePane, pre-existing pattern)-- **`npm run test`**: **313 / 313 tests pass** across 39 test files- - 16 `document-service.test.ts`- - 15 `schema/index.test.ts`- - 14 `timeline.test.ts`- - 14 `migrate.test.ts`- - 8 `virtual-preview.test.ts`- - 5 `projectStore.test.ts`- - + 239 pre-existing tests (all still passing)-- **Browser smoke test**: `http://localhost:5173/?windowType=editor` renders the editor with shim data, project create/select works, asset add works (mocked), transcript/chat panels render, settings panel shows correct view per right-rail tab.-------## 4. Key decisions and rationale--### 4.1 The framing change (user-driven)--The original plan treated "AI-edition" as a single opt-in feature. Mid-implementation the user said: *multi-asset/clips/etc. is valid outside of user opt-in. It is valid outside of user opt-in. The opt-in should be limited to llm/conversation.* This led to:-- `AI_EDITION_ENABLED` → `AI_FEATURES_ENABLED` (the rename makes the semantic explicit)-- New editor ships to all users by default (kill-switch removed)-- The right rail's chat / LLM config is the only gated surface-- Local Whisper stays ungated (privacy-safe by construction)--### 4.2 Why the new editor ships as the default despite incomplete feature parity--The spec calls for full feature parity (annotations, zoom, cursor, webcam, blur, crop, export, legacy `.openscreen` loading). The implementation delivers the **architecture** and the **export, legacy loading, transcript, transcription, settings panel** integrations, but the new editor's UI is intentionally simpler than the legacy `VideoEditor` for some affordances (no annotations/zoom UI for adding new ones, just editing existing ones from the `SettingsPanel`). This is acceptable for a first cut because:-- The legacy `VideoEditor` is still on disk and reachable via git (rollback path)-- Adding the remaining UI affordances is incremental (no new architecture needed)-- The `SettingsPanel` integration already lets users edit every field that exists in their v3 document--### 4.3 Why the AI runtime is stubbed--Phases 6-8 require `@langchain/openai`, `@langchain/anthropic`, `deepagents`, `better-sqlite3`. These are heavy (multi-MB native modules, OAuth flows, langgraph runtime). The implementation:-- Ships the IPC contracts, provider registry, LLM config store (with `safeStorage`), chat history-- Stubs the actual LLM call (returns a fixed message reminding the user to install deps)-- The 8 providers, OAuth flow, reasoning effort mapping, and the chat-service scaffolding are all in place — adding the real `@langchain/*` calls is a focused follow-up--### 4.4 Why ms for `annotations[]` / `zoomRanges[]` but sec for timeline--`AxcutDocument.annotations` and `AxcutDocument.zoomRanges` mirror the legacy `ProjectEditorState.annotationRegions` / `.zoomRegions` which use **ms**. The timeline ops (`skipRanges`, `clips.sourceStartSec`, etc.) follow axcut's convention of **sec** because axcut's `clips` are authored from the agent/runtime where the second-based model is canonical. This dual-unit is contained to the document schema and handled by the `document/timeline.ts` math + `migrate.ts` conversion. The renderer reads `document.zoomRanges` directly as ms.--### 4.5 Why `safeStorage` for credentials (not plain JSON)--Per locked decision 4 in the spec: LLM credentials are stored in `safeStorage`-encrypted bytes (OS keychain on macOS, libsecret on Linux, DPAPI on Windows). Config (provider, model, baseUrl, reasoningEffort) is plain JSON. This matches axcut's security improvement over their original plain-JSON approach.-------## 5. What's NOT in this PR (deferred work)--These are deliberate deferrals, not oversights:--1. **Full feature parity UI** — adding new annotations/zoom regions from the new shell (the SettingsPanel can only edit existing ones). Follow-up: port the legacy `VideoEditor`'s annotation/zoom add flows to `NewEditorShell`.-2. **Real LLM calls** — `@langchain/*` deps not installed. Follow-up: `npm i @langchain/openai @langchain/anthropic deepagents` and replace the stub in `chat-service.ts:runChat`.-3. **SQLite for sessions/checkpoints** — `better-sqlite3` not installed. Follow-up: port axcut's `DatabaseService` and `PersistentFileCheckpointSaver`.-4. **Webcam real-time preview** in `VirtualPreview` — current is a single-video component; axcut has a two-layer crossfade. Follow-up for a richer preview experience.-5. **13-locale i18n** — the new components use hardcoded English strings ("Transcribe", "Remove cuts", "Export", etc.). Follow-up: add to `src/i18n/locales/<locale>/*.json`.-6. **Settings sync to `userPreferences.ts`** — `AI_FEATURES_ENABLED` toggle is a constant, not user-toggleable. Follow-up: wire to the existing settings sync.-7. **Export dialog integration** — the new editor's "Export" button shows a toast. Follow-up: wire the `ExportDialog` component with the full options.-8. **The legacy `VideoEditor.tsx`** (2961 lines) is unchanged on disk. It can be deleted in a follow-up once confidence is high.-------## 6. How to continue--### 6.1 Resume this branch--```bash-cd G:\repos\openscreen\.worktrees\wt-9ce78f24-git status # should be clean-git log --oneline -3-npm run dev # already running, port 5173-# Open http://localhost:5173/?windowType=editor-```--### 6.2 Add a real LLM provider--1. `npm i @langchain/openai @langchain/anthropic deepagents better-sqlite3`-2. In `electron/ai-edition/chat-service.ts:runChat`, replace the stub with a real call:- ```ts- import { ChatOpenAI } from "@langchain/openai";- const model = new ChatOpenAI({ model: config.model, apiKey });- const result = await model.invoke(message);- ```-3. Add the corresponding provider in `provider-registry.ts` if it's not already there.--### 6.3 Add full feature parity (annotations/zoom creation UI)--1. Port the legacy `VideoEditor`'s annotation-add flow (around line 2500+) to a new component.-2. Mount it in `NewEditorShell` alongside `SettingsPanel`.-3. Wire it to `documentStore.setDocument` (already wired through `EditorSettings`).--### 6.4 Open a PR--```bash-git push origin docs/ai-edition-plan # already pushed-gh pr create \- --base main \- --head docs/ai-edition-plan \- --title "feat(ai-edition): implement v3 editor model + AI features scaffold" \- --body-file PR_BODY.md-```--### 6.5 Delete the legacy `VideoEditor` when ready--The file `src/components/video-editor/VideoEditor.tsx` (2961 lines) is now unused in the default flow. `grep -r "from.*VideoEditor" src/` to confirm. Then delete and remove from `App.tsx` lazy import.-------## 7. File map (where to look)--```-G:\repos\openscreen\.worktrees\wt-9ce78f24\-├── docs/architecture/-│ └── ai-edition-merge-plan.md # updated §0, §5.9, §10-├── electron/-│ ├── ai-edition/-│ │ ├── document-service.ts # CRUD on .axcut files-│ │ ├── document-service.test.ts-│ │ ├── llm-config-store.ts # safeStorage credentials-│ │ ├── provider-registry.ts # 8 providers, static-│ │ └── chat-service.ts # in-memory, LLM stub-│ ├── ipc/-│ │ ├── handlers.ts # wires services to bridge-│ │ └── nativeBridge.ts # adds aiEdition domain-│ └── native-bridge/services/-│ └── aiEditionService.ts # bridge adapter-├── src/-│ ├── App.tsx # installs browser shim-│ ├── native/-│ │ ├── browserShim.ts # NEW - browser-mode stubs-│ │ ├── client.ts # adds aiEdition namespace-│ │ └── contracts.ts # adds aiEdition types-│ ├── components/-│ │ ├── video-editor/-│ │ │ ├── SettingsPanel.tsx # + hideInternalRail prop-│ │ │ └── featureFlags.ts # AI_EDITION_ENABLED → AI_FEATURES_ENABLED-│ │ └── ai-edition/ # NEW directory-│ │ ├── AiEditionShell.tsx # kill-switch removed-│ │ ├── NewEditorShell.tsx # main shell, the default-│ │ ├── IconRail.tsx-│ │ ├── ProjectPanel.tsx-│ │ ├── TimelinePane.tsx + .module.css-│ │ ├── VirtualPreview.tsx + .module.css-│ │ ├── TranscriptEditor.tsx + .module.css-│ │ ├── ChatPanel.tsx-│ │ └── EditorSettings.tsx # bridge → SettingsPanel-│ └── lib/ai-edition/ # NEW directory-│ ├── schema/index.ts + .test.ts-│ ├── document/-│ │ ├── timeline.ts + .test.ts-│ │ ├── migrate.ts + .test.ts-│ │ ├── transcribe.ts-│ │ └── ids.ts-│ ├── timeline/-│ │ └── virtual-preview.ts + .test.ts-│ ├── store/-│ │ └── projectStore.ts + .test.ts-│ └── exporter/-│ └── documentExporter.ts-└── package.json # +zod, +zustand-```-------## 8. The conversation arc (for context)--1. User asked to check PR #35 and start implementation per its plan.-2. Implemented Phase 0 (schema, migration, feature flag) — 29 tests pass, human-testable via dev server.-3. Implemented PR 1.1 (project panel, document service, IPC bridge) — human-testable.-4. User asked for total spec completion. Implemented PR 1.2 + 1.3 (timeline port, preview port, new editor shell with kill-switch).-5. User said "implement 1, 2, and 3" with the axcut `\\wsl.localhost\Ubuntu\home\etienne\repos\axcut\` path. Implemented:- - Export (Phase 3) — adapter to existing VideoExporter- - Legacy `.openscreen` loading — migrate v2 → v3- - Settings panel (annotations, zoom, cursor, webcam, wallpaper) — bridge to `SettingsPanel`-6. User said "go on → full implementation". Implemented Phases 6-8 scaffolding (provider registry, LLM config store with safeStorage, chat service stub, IPC contracts) and Phase 9 partial (settings toggle, i18n deferred).-7. User asked to relaunch in browser. Added `browserShim.ts` for `http://localhost:5173/?windowType=editor`.-8. User asked for UI redesign to match original OpenScreen + axcut layout. Implemented:- - Left icon rail (Project / Chat)- - Right icon rail (Transcript / Background / Video effects / Camera / Cursor / Crop / Export)- - Top header (project title + PanelLeft / PanelRight / Download)- - NewEditorShell with full-height columns- - Removed the chevron collapse buttons (user requested)- - Used original OpenScreen SettingsPanel icons- - Added `hideInternalRail` prop so the right rail is the only navigation-9. User asked about worktree, branch, commit, push. Confirmed branch (`docs/ai-edition-plan`), committed and pushed.-10. User asked for a handoff summary in English for a coding agent.-------**The next coding agent should**:-- Open `http://localhost:5173/?windowType=editor` to see the current state-- Read `docs/architecture/ai-edition-merge-plan.md` for the plan-- Pick up from §5 (deferred work) — most impactful next steps are real LLM calls (#2) and feature parity UI (#1)-- All architecture is in place; the remaining work is wiring and UI polish, not new designdiff --git a/AGENTS.md b/AGENTS.mdindex 417f937e5..babd479cb 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -20,7 +20,7 @@ OpenScreen is a free, open-source screen recorder and video editor (Electron + R- `src/` — React app: UI, editor components, timeline, i18n, captioning/cursor/exporter libs- `electron/` — main process, IPC, recording orchestration- `electron/native/` — **native** capture helpers: `screencapturekit/` (Swift, macOS) and `wgc-capture/` (C++/Win32, Windows). These are built and shipped with the app, not loaded from npm-- `docs/` — architecture, engineering roadmaps, testing guides+- `technical-documentation/` — architecture, engineering and testing reference (start at its README)- `tests/` — Playwright e2e specs + fixtures- `scripts/` — native build scripts, diagnostic tools- `nix/`, `flake.nix` — Linux packaging@@ -98,7 +98,7 @@ Two `workflow_dispatch` workflows cut a release with a pre-release candidate (RC- **Promote RC**: Actions → "Promote RC to stable release" → Run workflow. Input: `rc_tag` (e.g. `v1.5.0-rc.2`), optional `release_notes_extra`. Closes the `vX.Y.Z` milestone, strips `-rc.N` from `package.json`, pushes `vX.Y.Z` tag, which triggers `build.yml` to publish a stable release (full notarization, Tier 3 homebrew/winget/nix/aur fires). Notifies `#announcements` on Discord.- **Manual fallback**: `git tag vX.Y.Z-rc.N <sha> && git push origin vX.Y.Z-rc.N` does the same as Cut RC (minus the milestone migration and Discord announce) — useful for emergency cuts.-Both workflows require the `OPENSCREEN_RELEASE_TOKEN` secret (a fine-grained PAT with `contents: write` + `issues: write`). This is the standard fix for `release: published` not triggering downstream workflows when the release is created by `GITHUB_TOKEN`. See `docs/secrets.md`.+Both workflows require the `OPENSCREEN_RELEASE_TOKEN` secret (a fine-grained PAT with `contents: write` + `issues: write`). This is the standard fix for `release: published` not triggering downstream workflows when the release is created by `GITHUB_TOKEN`. See `technical-documentation/engineering/release-and-secrets.md`.**Release branches freeze the build between cut and promote.** Every RC cut creates `release/vX.Y.Z-rc.N`. The branch is *not* merged into `main` until the stable tag is published; only cherry-picks of bugfixes land on the release branch during the RC window. The stable tag points at the branch tip (RC + cherry-picks), then `promote.yml` opens a `release/vX.Y.Z-sync → main` PR to bring main into line. This contract exists because of the v1.6.0 incident (2026-07-05) where the original promote workflow tagged `main` instead of the RC snapshot, causing 23 unreleased commits to ship in `v1.6.0`. Full rules in `.harness/docs/git-workflow.md` § Release branches.diff --git a/electron/media/ffmpegExportIpc.ts b/electron/media/ffmpegExportIpc.tsindex ce82342fb..d07287955 100644--- a/electron/media/ffmpegExportIpc.ts+++ b/electron/media/ffmpegExportIpc.ts@@ -15,7 +15,7 @@ import {* sandboxed and stays that way. Dropping the sandbox (option A') was measured* and buys nothing: with the crossing at exactly zero the pipeline still loses* to WebCodecs, because the wall is the compositor, not this path. See- * docs/architecture/export-pipeline.md §5.+ * technical-documentation/architecture/export-pipeline.md** This whole path is REFUTED (§5): feeding native ffmpeg from the renderer is* 2.1x SLOWER than what we ship. It survives as bench scaffolding, not as adiff --git a/electron/native/README.md b/electron/native/README.mdindex 6b20fd8aa..9c450339d 100644--- a/electron/native/README.md+++ b/electron/native/README.md@@ -29,7 +29,7 @@ The current helper implementation supports display/window ScreenCaptureKit videoElectron exposes `is-native-mac-capture-available` for capability probing. It resolves the same helper locations listed above and reports `missing-helper` until a Swift helper binary is present. When available, macOS recording routes screen/window capture through the native helper so editable cursor recordings do not bake the system cursor into the video. Cursor positions are sampled in Electron; when the cursor helper is available and Accessibility is granted, samples are also tagged with link/text cursor hints such as `pointer`.-See `docs/engineering/macos-native-recorder-roadmap.md` for the contract, rollout phases, and SSOT rules.+See `technical-documentation/architecture/recording.md` for the contract, rollout phases, and SSOT rules.## Windows@@ -119,5 +119,5 @@ Remove-Item Env:OPENSCREEN_WGC_TEST_MICROPHONE_DEVICE_NAME## STT helperThe speech-to-text helper (`whisper-stt-server`) is built separately from the-capture helpers. See `docs/engineering/stt-spec.md` for the architecture and+capture helpers. See `technical-documentation/architecture/transcription-and-captions.md` for the architecture and`scripts/build-whisper-stt.sh` for the build command.diff --git a/electron/stt/index.ts b/electron/stt/index.tsindex a186886cd..4f3e992aa 100644--- a/electron/stt/index.ts+++ b/electron/stt/index.ts@@ -18,7 +18,7 @@ import { WhisperServerManager } from "./whisperServer";* word-level segments in one pass (see whisperServer.ts). Word* timestamps come from whisper.cpp's native DTW token timestamps* (`t_dtw`, SMALL aheads preset, `flash_attn = false`), see- * docs/engineering/stt-spec.md § Decision rationale.+ * technical-documentation/architecture/transcription-and-captions.md § Decision rationale.* 3. `shutdown()` tears down on app quit.** Status events fan out via `statusSink` so the renderer can drive itsdiff --git a/electron/stt/modelManager.ts b/electron/stt/modelManager.tsindex 7ad7207d5..8ec47652e 100644--- a/electron/stt/modelManager.ts+++ b/electron/stt/modelManager.ts@@ -21,7 +21,7 @@ import { pipeline } from "node:stream/promises";* to prevent partial downloads from being treated as complete.** Word timestamps come from whisper.cpp's native DTW token timestamps, so no- * separate VAD model is required. See `docs/engineering/stt-spec.md`.+ * separate VAD model is required. See `technical-documentation/architecture/transcription-and-captions.md`.*/export type SttModelId = "whisper";diff --git a/electron/stt/transcriptionContract.ts b/electron/stt/transcriptionContract.tsindex 49767af68..85b6c7152 100644--- a/electron/stt/transcriptionContract.ts+++ b/electron/stt/transcriptionContract.ts@@ -12,7 +12,7 @@/** A word-level segment with timestamps from whisper.cpp's native DTW token* timestamps (`t_dtw`, computed with the SMALL aheads preset — see- * docs/engineering/stt-spec.md § Decision rationale). Absolute seconds+ * technical-documentation/architecture/transcription-and-captions.md § Decision rationale). Absolute seconds* in the source recording. */export interface SttWordSegment {word: string;diff --git a/poc-d3d/.gitignore b/poc-d3d/.gitignoreindex e812f9cec..f7e4e976d 100644--- a/poc-d3d/.gitignore+++ b/poc-d3d/.gitignore@@ -9,7 +9,7 @@*.raw*.nv12-# médias de fixture (régénérables via docs/S1-sources.md ; fixture.json est suivi)+# médias de fixture (provenance dans fixture/fixture.json, qui est suivi)fixture/*.mp4fixture/*.cursor.jsondiff --git a/poc-d3d/README.md b/poc-d3d/README.mdindex f754356fb..cc69c8a2c 100644--- a/poc-d3d/README.md+++ b/poc-d3d/README.md@@ -2,7 +2,7 @@Troisième POC de rendu d'OpenScreen, à côté de [`poc/`](../poc) (web, WebCodecs + WebGPU)et [`poc-native/`](../poc-native) (Rust + wgpu/Vulkan). Voir la spec :-[`docs/architecture/rendering-architecture.md`](../docs/architecture/rendering-architecture.md),+[`technical-documentation/engineering/rendering-performance.md`](../technical-documentation/engineering/rendering-performance.md),annexe D (D.6 en particulier).**Ce qu'il prouve.** Le chemin natif GPU-résident — celui que `poc-native` a montré bloqué@@ -22,7 +22,7 @@ NV12→RGB BT.709, coins arrondis + masques (SDF), ombres portées (pénombre SD**Résultat mesuré** (protocole §C.2 du doc : régime soutenu, tour de chauffe jeté,spread < 15 %) : config tous-effets **~126 fps** en 1080p60, au-dessus du web (79) et dewgpu (48–68). Le fps enveloppe demux → décode → composite → encode → mux (§10 : une lecture-d'horloge avant/après tout le run). Détail des couches C0→C8 : `docs/S6-report.md`.+d'horloge avant/après tout le run). Détail des couches C0→C8 : [`technical-documentation/architecture/native-compositor.md`](../technical-documentation/architecture/native-compositor.md).C'est le **fast-path natif retenu** pour Windows (cf. le marqueur de décision dans l'annexe D).`poc/` reste l'hôte de lancement portable ; `poc-native` reste la preuve de portabilité du@@ -31,9 +31,9 @@ compositeur (WGSL natif à l'identique) + la carte des coûts.## Stack- **Rust + windows-rs**, D3D11 nu (feature level 11_1, `VIDEO_SUPPORT`, multithread-protected).- Décision framework en `docs/S0-frameworks.md` (Vulkan/Direct2D/GStreamer/wgpu instruits, écartés).+ Décision framework en [`technical-documentation/architecture/native-compositor.md`](../technical-documentation/architecture/native-compositor.md) (Vulkan/Direct2D/GStreamer/wgpu instruits, écartés).- **ffmpeg (libav\*)** LGPL pour demux / décode D3D11VA / encode `h264_amf` / mux. Bindings- générés par `bindgen` (choix vs `ffmpeg-next` : suit ffmpeg 8.x — voir `docs/S2-c0.md`),+ générés par `bindgen` (choix vs `ffmpeg-next` : suit ffmpeg 8.x — voir [`technical-documentation/architecture/native-compositor.md`](../technical-documentation/architecture/native-compositor.md)),shim C (`shim.c`) pour les structs opaques.- Compositeur HLSL (`src/shaders.hlsl`) compilé au runtime.@@ -41,7 +41,9 @@ compositeur (WGSL natif à l'identique) + la carte des coûts.- Rust (toolchain msvc), Visual Studio (MSVC + Windows SDK), LLVM (libclang, pour bindgen).- **Build ffmpeg LGPL-shared** dans `thirdparty/` (non versionné) : récupérer- `ffmpeg-master-latest-win64-lgpl-shared` (releases BtbN/FFmpeg-Builds), dézipper dans+ `ffmpeg-n8.1.2-win64-lgpl-shared` (le build pinné dans `.cargo/config.toml` — le+ MÊME que `scripts/fetch-ffmpeg.mjs` vendorise, sinon le require() de l'addon échoue),+ dézipper dans`thirdparty/`. Le chemin est relatif au dossier, fixé dans `.cargo/config.toml` (`FFMPEG_DIR`).`LIBCLANG_PATH` y pointe l'install LLVM. Ajuste le chemin vcvars dans `x.bat` si besoin.@@ -58,7 +60,7 @@ x.bat run --release [-- --fixture fixture --out out]Fenêtre native : preview du compositing en lecture bouclée (swapchain DXGI flip, blitzéro-copie du RT), sélecteur de preset C0→C8, Play/Pause, **Export** (barre de progression +-bilan _temps + fps_). Écrit `out/export.mp4`. Détail : `docs/S7-preview-export.md`.+bilan _temps + fps_). Écrit `out/export.mp4`. Détail : [`technical-documentation/architecture/native-compositor.md`](../technical-documentation/architecture/native-compositor.md).**Bench (§9/§10)** — la mesure fps headless, inchangée :@@ -73,11 +75,13 @@ Produit `out/C{0..8}.mp4` (1080p60, 360 frames), `out/C{n}_f{60,180,300}.png`,Deux flux screen (le 2ᵉ simule une webcam HQ), 1080p60 CBP, 360 frames, coupés en `-c copy`.Médias non versionnés (convention des autres POC) — provenance et commandes de régénération-dans `docs/S1-sources.md` ; `fixture/fixture.json` (le manifeste mesuré) est suivi.+dans `fixture/fixture.json`, qui est suivi.## Docs-`docs/` = le parcours S0→S7 du POC : S0 décision framework, S1 sources/chaîne matérielle,-S2 pipeline C0, S6 rapport + mesure des moteurs GPU + optimisations, S7 preview/export-interactive (marche vers l'intégration app). `spikes/` = les probes jetables de S0+L'architecture du compositeur est documentée dans+[`technical-documentation/architecture/native-compositor.md`](../technical-documentation/architecture/native-compositor.md),+et les mesures qui l'ont choisie dans+[`technical-documentation/engineering/rendering-performance.md`](../technical-documentation/engineering/rendering-performance.md).+Ce README ne couvre que le build et le run de la crate. `spikes/` = les probes jetables(Direct2D, NV12 render-target) conservés comme preuve.diff --git a/scripts/build-whisper-stt.sh b/scripts/build-whisper-stt.shindex 7041e6f5b..2e8ec5ffe 100644--- a/scripts/build-whisper-stt.sh+++ b/scripts/build-whisper-stt.sh@@ -6,7 +6,7 @@# The helper is a long-lived HTTP server that exposes the same# spawn -> GET / -> POST /inference contract the previous native STT helper# used, but links libwhisper directly and reads whisper.cpp's DTW token timestamps.-# See docs/engineering/stt-whispercpp-migration-plan.md §2.+# See technical-documentation/architecture/transcription-and-captions.md## Local use:# bash scripts/build-whisper-stt.sh # default backend for hostdiff --git a/scripts/fetch-ffmpeg.mjs b/scripts/fetch-ffmpeg.mjsindex c9fc30cf0..8fa81c34a 100644--- a/scripts/fetch-ffmpeg.mjs+++ b/scripts/fetch-ffmpeg.mjs@@ -41,7 +41,8 @@// NOTE: the plan this was vendored for is REFUTED. Feeding native ffmpeg from// the renderer measured 2.1x SLOWER than the WebCodecs path it was to replace —// the wall is the compositor, not the encoder. See-// docs/architecture/export-pipeline.md §5. The binary stays because the bench's+// technical-documentation/engineering/rendering-performance.md. The binary stays+// because the bench's// `native` arms use it, and because a future native core would still need a// licence-gated H.264 encoder; nothing here ships on the export path today.//@@ -326,7 +327,7 @@ async function main() {console.error("macOS is not provisioned by this script: BtbN publishes no macOS build.\n" +"It would have to be built and notarised separately. Note the native-encode plan\n" +- "is refuted (docs/architecture/export-pipeline.md §5), so this is bench-only today.",+ "is refuted (technical-documentation/engineering/rendering-performance.md), so this is bench-only today.",);process.exit(1);}diff --git a/src/components/ai-edition/PreviewCanvas.tsx b/src/components/ai-edition/PreviewCanvas.tsxindex 52f2fda22..90744014c 100644--- a/src/components/ai-edition/PreviewCanvas.tsx+++ b/src/components/ai-edition/PreviewCanvas.tsx@@ -406,7 +406,7 @@ export function PreviewCanvas(props: PreviewCanvasProps) {// VirtualPreview path — CSS-transformed <video> + measure// on ResizeObserver — until the Pixi path is hardened// behind a flag with its own tests.- // See docs/engineering/ai-edition-preview-pixi-rollback.md+ // See technical-documentation/architecture/preview.md// (todo) for the failure write-up.void relayProps.clockRef;return (diff --git a/src/components/video-editor/featureFlags.ts b/src/components/video-editor/featureFlags.tsindex a5dc15fc1..0a89a5ccd 100644--- a/src/components/video-editor/featureFlags.ts+++ b/src/components/video-editor/featureFlags.ts@@ -6,5 +6,5 @@ export const BLUR_REGIONS_ENABLED = false;// Local Whisper is privacy-safe and also not gated. The new editor ships as// the default from Phase 1 PR 1.3 onward; this flag is just the AI-features// opt-in. Renamed from AI_EDITION_ENABLED on 2026-06-26 — see-// docs/architecture/ai-edition-roadmap.md §1 / §3 (decision 9).+// technical-documentation/architecture/decisions.md / §3 (decision 9).export const AI_FEATURES_ENABLED = true;diff --git a/src/lib/ai-edition/document/migrate.ts b/src/lib/ai-edition/document/migrate.tsindex 330dcf600..90154715f 100644--- a/src/lib/ai-edition/document/migrate.ts+++ b/src/lib/ai-edition/document/migrate.ts@@ -1,5 +1,5 @@// Bidirectional migration between OpenScreen's v2 EditorProjectData and the-// current AxcutDocument. See docs/architecture/ai-edition-roadmap.md §2+// current AxcutDocument. See technical-documentation/architecture/document-model.md// for the field-by-field mapping. The migration is pure (no DOM, no fs, no// network) — the renderer probes asset duration at runtime.//diff --git a/src/lib/ai-edition/schema/index.test.ts b/src/lib/ai-edition/schema/index.test.tsindex f9815e863..4b1fbfede 100644--- a/src/lib/ai-edition/schema/index.test.ts+++ b/src/lib/ai-edition/schema/index.test.ts@@ -359,7 +359,7 @@ describe("axcut-schema v5", () => {// --- v4 -> v5 clip-anchoring migration (round-trip) --------------------------// Uses goodtest's real layout: clip A [asset_f] src[0,25.557313] raw[0,25.557313],// clip B [asset_e] src[0,8.149313] raw[25.557313,33.706626], and its straddling-// speed region [8149,28575]ms. See docs/architecture/timeline-coordinate-refactor.md §6.+// speed region [8149,28575]ms. See technical-documentation/architecture/timeline-model.mddescribe("v4 -> v5 clip-anchored modifier migration", () => {const CLIP_A_END = 25.557313;diff --git a/src/lib/ai-edition/schema/index.ts b/src/lib/ai-edition/schema/index.tsindex 6d9200634..3c1ab6835 100644--- a/src/lib/ai-edition/schema/index.ts+++ b/src/lib/ai-edition/schema/index.ts@@ -1,6 +1,6 @@// Vendored from @axcut/schema (https://github.com/EtienneLescot/axcut) —// original file: packages/axcut-schema/src/index.ts. Modifications for-// OpenScreen's AI-edition merge (Phase 0, see docs/architecture/ai-edition-roadmap.md):+// OpenScreen's AI-edition merge (Phase 0, see technical-documentation/architecture/document-model.md)://// 1. axcutSchemaVersion bumped 2 -> 3.// 2. clip.sourceEndSec made optional (duration is unknown until asset is probed).@@ -20,7 +20,7 @@ import { anchorRegionsWithDerivedMs } from "../timeline/timelineMap";// 4. v5 — modifiers (zoom / annotation / speed / cameraFullscreen) become// CLIP-ANCHORED fragments: `{clipId, sourceStartSec, sourceEndSec}` is the// source of truth, `startMs`/`endMs` stay as a derived cache for the-// transition. See docs/architecture/timeline-coordinate-refactor.md §6.+// transition. See technical-documentation/architecture/timeline-model.mdexport const axcutSchemaVersion = 5;export const isoDateSchema = z.string().datetime({ offset: true });@@ -82,7 +82,7 @@ export const assetAudioSchema = z.object({//// Lives on the asset (not the document) since P4 (per-asset media links) —// a project can hold multiple assets, each recorded with its own camera (or-// none). See docs/architecture/ai-edition-roadmap.md.+// none). See technical-documentation/architecture/document-model.md.export const cameraTrackSchema = z.object({sourcePath: z.string().min(1),@@ -465,7 +465,7 @@ export const zoomRegionSchema = z// Legacy OpenScreen appearance / export settings that the v3 schema doesn't// normalize into the timeline / assets model. They are applied at export time-// by the existing pipeline (see docs/architecture/ai-edition-roadmap.md §2).+// by the existing pipeline (see technical-documentation/architecture/document-model.md).//// ponytail: passthrough blob — v2 ProjectEditorState carries ~25 fields, several// of which (autoZoomEnabled, autoFocusAll, cursorTheme, …) have no first-classdiff --git a/src/lib/ai-edition/store/useTimeline.ts b/src/lib/ai-edition/store/useTimeline.tsindex b2f6ef06f..b972b5922 100644--- a/src/lib/ai-edition/store/useTimeline.ts+++ b/src/lib/ai-edition/store/useTimeline.ts@@ -125,7 +125,7 @@ export function useTimeline() {// Every add* below anchors the new region to the clip(s) it covers before storing it.// A modifier MUST own a clip anchor to survive reorder/trim (see- // docs/architecture/timeline-coordinate-refactor.md §6) — writing only startMs/endMs+ // technical-documentation/architecture/timeline-model.md) — writing only startMs/endMs// would strand it. A region created across a clip boundary becomes one fragment per// clip; the ruler renders them as one pill because their properties are equal.const addZoom = useCallback(async () => {diff --git a/src/lib/ai-edition/timeline/timelineMap.test.ts b/src/lib/ai-edition/timeline/timelineMap.test.tsindex a8eb2695e..4bbd8fe6d 100644--- a/src/lib/ai-edition/timeline/timelineMap.test.ts+++ b/src/lib/ai-edition/timeline/timelineMap.test.ts@@ -1,7 +1,7 @@// Tests for the timeline coordinate mapper. The invariant under test: a modifier// (or the playhead) authored on the RAW ruler must resolve to the SAME source// moment regardless of trims earlier on the timeline — the raw↔compressed↔source-// bug this module exists to kill. See docs/architecture/timeline-coordinate-refactor.md.+// bug this module exists to kill. See technical-documentation/architecture/timeline-model.md.import { describe, expect, it } from "vitest";import { resolvePlaybackSegments } from "../document/timeline";diff --git a/src/lib/ai-edition/timeline/timelineMap.ts b/src/lib/ai-edition/timeline/timelineMap.tsindex 49e2fb1eb..2a00573a6 100644--- a/src/lib/ai-edition/timeline/timelineMap.ts+++ b/src/lib/ai-edition/timeline/timelineMap.ts@@ -1,5 +1,5 @@// The single place that maps between the timeline's three coordinate systems.-// See docs/architecture/timeline-coordinate-refactor.md.+// See technical-documentation/architecture/timeline-model.md.//// RAW virtual — the ruler the user manipulates; trims still occupy their// space. `currentTimeSec`, the playhead, region authoring, and@@ -22,7 +22,7 @@ import { ventilateSpanAcrossClips } from "./region-ventilation";import { findRawClipForSegment, getRawVirtualStartTime } from "./virtual-preview";/** A modifier fragment anchored to one clip in that clip's own source time — the- * Stage B storage shape (see docs/architecture/timeline-coordinate-refactor.md).+ * Stage B storage shape (see technical-documentation/architecture/timeline-model.md).* Trims narrow the clip's kept source ranges, so an anchored fragment is clipped/* hidden by the same interval math with no reprojection; a reorder carries it with* its clip by `clipId`.diff --git a/src/lib/captioning/transcribe.ts b/src/lib/captioning/transcribe.tsindex 1afdd6aff..a1b39d439 100644--- a/src/lib/captioning/transcribe.ts+++ b/src/lib/captioning/transcribe.ts@@ -46,7 +46,7 @@ interface RendererSttApi {** The previous in-Web-Worker implementation (Transformers.js + ORT-WASM) was* 0.5× realtime on tiny models and had no word-level accuracy under 50 ms;- * see `docs/engineering/stt-spec.md` § History for context.+ * see `technical-documentation/architecture/transcription-and-captions.md` § History for context.*/export function transcribeMono16kToSegments(samples: Float32Array,diff --git a/src/lib/exporter/frameRenderer.ts b/src/lib/exporter/frameRenderer.tsindex 994a86b0b..73aa82d1d 100644--- a/src/lib/exporter/frameRenderer.ts+++ b/src/lib/exporter/frameRenderer.ts@@ -1498,7 +1498,7 @@ export class FrameRenderer {}/**- * Bench-only sync point — gate G0, docs/architecture/rendering-architecture.md §7.1.+ * Bench-only sync point — gate G0, technical-documentation/engineering/rendering-performance.md** Draw calls queue GPU work; the cost lands on whichever operation first needs* the pixels, which today is the encoder — so the compositor's execution isdiff --git a/src/lib/exporter/videoExporter.ts b/src/lib/exporter/videoExporter.tsindex 259e774a2..484c81a8d 100644--- a/src/lib/exporter/videoExporter.ts+++ b/src/lib/exporter/videoExporter.ts@@ -102,7 +102,7 @@ function nativeEncodeEnabled(): boolean {* 32 seconds previously blamed on readback were the compositor finishing its GPU* work at the first stage that forced a sync.*- * See docs/architecture/export-pipeline.md §3.+ * See technical-documentation/architecture/export-pipeline.md** localStorage.setItem("openscreen.dropFrames", "1")*/@@ -139,7 +139,7 @@ function compositeOnlyEnabled(): boolean {}/**- * Gate G0 — docs/architecture/rendering-architecture.md §7.1.+ * Gate G0 — technical-documentation/engineering/rendering-performance.md** Force the GPU to FINISH compositing before the encode timers start, in a* `fence` stage of its own. If §7.1 is right, `encodeWait` collapses to thediff --git a/src/native/sceneDescription.test.ts b/src/native/sceneDescription.test.tsindex e723e79d2..842f721df 100644--- a/src/native/sceneDescription.test.ts+++ b/src/native/sceneDescription.test.ts@@ -462,7 +462,7 @@ describe("buildSceneDescription.zoomRegions", () => {});// --- zoomRegions × trims (raw↔compressed regression) -------------------------// See docs/architecture/timeline-coordinate-refactor.md. Regions are authored in+// See technical-documentation/architecture/timeline-model.md. Regions are authored in// RAW virtual-ms (trims still occupy the ruler), but the scene handed to native is// built from TRIM-COMPRESSED playback segments (`resolveVisibleClips`). A region// after a trim must still fire at the SAME source moment the user placed it on thediff --git a/technical-documentation/README.md b/technical-documentation/README.mdnew file mode 100644index 000000000..20406318e--- /dev/null+++ b/technical-documentation/README.md@@ -0,0 +1,64 @@+# Technical documentation++Reference documentation for how OpenScreen is built. It describes the system **as it is on this+branch** — not how it got here. Product direction lives in [`../ROADMAP.md`](../ROADMAP.md),+day-to-day contributor rules in [`../AGENTS.md`](../AGENTS.md) and+[`../CONTRIBUTING.md`](../CONTRIBUTING.md), and end-user documentation in+[`../website/docs/`](../website/docs/).++Organised by **type** — architecture (what the system is), engineering (how it is built and+shipped), testing (how it is verified) — and within each type, by **subsystem**.++## Architecture++Start with the [overview](architecture/overview.md): the process model, the authoring levels, and+who reads and writes the project document.++| Doc | Subsystem |+|---|---|+| [overview.md](architecture/overview.md) | The whole picture: windows, processes, data flow, subsystem map |+| [document-model.md](architecture/document-model.md) | `AxcutDocument` — the single source of truth, its schema, migrations and persistence |+| [timeline-model.md](architecture/timeline-model.md) | Time reference frames, clip-anchored modifiers, and the invariants that keep preview and render agreeing |+| [editor-shell.md](architecture/editor-shell.md) | The editor UI: surfaces, modes, facets, and how to add a region kind |+| [preview.md](architecture/preview.md) | Showing the frame at the playhead: scene description, frame delivery, playback sync |+| [native-compositor.md](architecture/native-compositor.md) | The Rust + D3D11 engine that composites and encodes, for both preview and export |+| [export-pipeline.md](architecture/export-pipeline.md) | Document to file: render plan, segment loop, audio junctions, output formats |+| [recording.md](architecture/recording.md) | Capture on Windows, macOS and Linux: the HUD, the native helpers, what lands on disk |+| [cursor.md](architecture/cursor.md) | Cursor capture, telemetry, rendering and auto-follow |+| [transcription-and-captions.md](architecture/transcription-and-captions.md) | On-device speech to text, and the caption layer derived from it |+| [ai-agent.md](architecture/ai-agent.md) | The optional agent: tool loop, checkpoints, context management |+| [llm-providers.md](architecture/llm-providers.md) | Provider registry, auth modes, credential storage |+| [native-bridge.md](architecture/native-bridge.md) | The renderer ↔ main-process contract every native capability goes through |+| [decisions.md](architecture/decisions.md) | **The decision ledger** — what is settled, what was rejected and why |++## Engineering++| Doc | Topic |+|---|---|+| [rendering-performance.md](engineering/rendering-performance.md) | The measurement record for preview fluidity and export speed |+| [build-and-packaging.md](engineering/build-and-packaging.md) | Build commands, native artifacts, per-platform packaging |+| [ci-workflows.md](engineering/ci-workflows.md) | The GitHub Actions tiers and how artifacts flow between them |+| [release-and-secrets.md](engineering/release-and-secrets.md) | Cutting and promoting a release; the secrets it needs |++## Testing++| Doc | Topic |+|---|---|+| [writing-tests.md](testing/writing-tests.md) | Unit, browser and end-to-end tests: which to write, where, how to run them |+| [manual-e2e-checklist.md](testing/manual-e2e-checklist.md) | What automated tests cannot reach — real capture, a real webcam, the tray, export |+| [native-cursor-diagnostics.md](testing/native-cursor-diagnostics.md) | Windows and macOS cursor sampler tools and how to read their reports |++## Keeping this current++Three rules, in order of how much damage breaking them does:++1. **The code is the authority.** If a doc and the code disagree, the doc is wrong. Fix it in the+ same change that made it wrong.+2. **Describe, don't narrate.** These are references, not plans or changelogs. No task tables, no+ phase numbers, no "recently fixed" — git already records history, and a doc that mixes the two+ makes a reader guess which sentences are still true.+3. **Settled questions go in [decisions.md](architecture/decisions.md).** Including the rejected+ routes, with the reason. That file is what stops the same idea being re-proposed every quarter.++`node scripts/check-docs.mjs` enforces the mechanical part: every required doc exists, every+relative link resolves, and no doc presents a removed component as current.diff --git a/technical-documentation/architecture/decisions.md b/technical-documentation/architecture/decisions.mdnew file mode 100644index 000000000..927f9029e--- /dev/null+++ b/technical-documentation/architecture/decisions.md@@ -0,0 +1,58 @@+# Decision ledger++The choices that shape the architecture, and the ones that were tried and rejected. This file+exists so nobody re-litigates a settled question or re-proposes a route that has already been+measured and lost. It is the only doc here that names things which no longer exist — everywhere+else, the docs describe what is.++A decision leaves this list only when the code stops honouring it.++## In force++| Decision | Why |+|---|---|+| **One document is the single source of truth.** `AxcutDocument` (`src/lib/ai-edition/schema/index.ts`) holds the whole project; the timeline, the preview, the captions pane and the exporter are all projections of it. No pane keeps parallel edit state. | Every desync bug this editor has had came from two surfaces owning the same fact. See [document-model.md](document-model.md). |+| **Modifiers are authored above the timeline and stored down on the clip.** Zoom, speed and annotation ranges are anchored to a clip, not to absolute timeline time. | Trimming or reordering a clip must carry its modifiers with it. Absolute anchoring silently desyncs preview from render. See [timeline-model.md](timeline-model.md). |+| **Clips on the timeline are always contiguous** — no gaps, no overlap. | The export segment loop and the audio junction logic both depend on it; permitting holes would double the state space for no user-visible gain. See [export-pipeline.md](export-pipeline.md). |+| **The model never free-writes the document.** The agent calls a fixed, validated tool schema, and a checkpoint is taken before each tool batch so the batch undoes as one unit. | A model emitting raw JSON patches can corrupt a project in a way the user cannot undo. See [ai-agent.md](ai-agent.md). |+| **Native helpers own capture, timing and encoding; Electron owns session orchestration and persistence.** | Frame timing cannot be made reliable across an IPC boundary. See [recording.md](recording.md). |+| **Windows production recording does not silently fall back to `getDisplayMedia` / `MediaRecorder`.** A native path that fails, fails loudly. | A silent fallback produced recordings that were subtly worse with no signal to the user. |+| **Compositing and encoding run in one native D3D11 engine**, shared by live preview and export. | See [native-compositor.md](native-compositor.md), and [../engineering/rendering-performance.md](../engineering/rendering-performance.md) for the measurements that chose it. |+| **Local transcription is bundled and never gated.** It runs on-device; no audio leaves the machine. | It is the foundation the caption and transcript features stand on, and gating it would make the privacy story conditional. See [transcription-and-captions.md](transcription-and-captions.md). |+| **The AI/LLM surface is behind `AI_FEATURES_ENABLED`** (`src/components/video-editor/featureFlags.ts`) and gates *only* the provider settings, chat panel, suggestions and checkpoint-restore UI. The editing model itself ships to every user. | The editor has to be complete without an LLM. Two independent rollouts, one flag. |+| **LLM credentials live in Electron `safeStorage`** (the OS keychain), never in plain JSON on disk. | `electron/ai-edition/llm-config-store.ts`, `llm-provider-auth.ts`. |+| **The project file extension is `.openscreen`.** Builds that wrote `.axcut` are read and renamed forward on first open. | Users already recognise the extension; `electron/ai-edition/document-service.ts:23` holds both. |+| **Migrations are forward-only.** A document is migrated up to the current `schemaVersion` on open and never written back down. | Round-tripping through an older schema loses fields silently. |+| **Captions are derived from the transcript, not injected as annotations.** | The earlier design generated annotation objects from captions, which then drifted from the transcript the moment either was edited. The transcript is the SSOT for spoken words. |+| **One package, one repository.** No sidecar process, no local HTTP server, no monorepo. | The editing engine was adopted from a project that had a Python worker and a Fastify server; both were replaced by in-process TypeScript and Electron IPC. Adding a second runtime back is a large, permanent cost. |++## Rejected, with the reason++Each of these was actually built or measured. Do not re-propose one without new evidence that+contradicts the reason given.++| Route | What happened |+|---|---|+| **Rust + wgpu native compositor** | Built as a POC. Zero-copy Vulkan video decode required driver features not available on the target hardware. The principle — a GPU-resident pipeline — was right; D3D11 delivers it without the driver dependency. |+| **Tauri / separate native core** | Would have split the app across two runtimes and two build systems to solve a problem that was measured to be in the compositor, not in Electron. |+| **Encoder pipelining** | Implemented and measured: a *loss* on the target integrated GPU, because encode and composite contend for the same queue. |+| **Software VP9 export** | Worked correctly end to end, but with no hardware VP9 encoder on the target GPU it was far too slow to ship. Removed rather than left as a trap. |+| **Proxy MP4 files for scrubbing** | Dropped in favour of streaming decode. If long-recording scrub latency becomes the top complaint again, the revival path is a per-asset "generate proxy" action, not a background pass over every import. |+| **Server-sent events for project changes** | Meaningless in a single-user desktop app; the document store already notifies every subscriber. |+| **Auto-generating annotations from captions** | See "captions are derived" above. |+| **React Query for the agent layer** | Planned during the merge, never adopted; the dependency is not in `package.json`. Plain IPC plus the document store covers it. |++## Surfaces that were removed++Older docs and code comments still refer to these. They are gone; the second column is where the+behaviour lives now.++| Removed | Replaced by |+|---|---|+| `VideoEditor` (the pre-merge editor) | `src/components/ai-edition/NewEditorShell.tsx` mounting the v4 surfaces |+| `TimelinePane.tsx` | `src/components/ai-edition/v4/V4Timeline.tsx` |+| `Titlebar.tsx`, `Bottombar.tsx` | `src/components/ai-edition/v4/EditorTopBar.tsx` |+| `RightPanelStack.tsx` | `src/components/ai-edition/v4/FloatingInspector.tsx` |+| `TranscriptEditor.tsx` | `src/components/ai-edition/CaptionsPane.tsx` + `src/lib/ai-edition/captions/` |+| The browser-based exporter | the native compositor export path — see [export-pipeline.md](export-pipeline.md) |+| CTranslate2 speech-to-text | whisper.cpp — see [transcription-and-captions.md](transcription-and-captions.md) |diff --git a/tools/stt-eval/whispercpp-dtw-poc/README.md b/tools/stt-eval/whispercpp-dtw-poc/README.mdindex 42e820887..0b07add29 100644--- a/tools/stt-eval/whispercpp-dtw-poc/README.md+++ b/tools/stt-eval/whispercpp-dtw-poc/README.md@@ -6,7 +6,7 @@ on the rest of the repo is reading the already-built CTranslate2 serverbinary + model as a comparison baseline (never rebuilding or modifying it).**Full plan / instructions:**-[docs/engineering/stt-whispercpp-dtw-poc-plan.md](../../../docs/engineering/stt-whispercpp-dtw-poc-plan.md)+[technical-documentation/architecture/transcription-and-captions.md](../../../technical-documentation/architecture/transcription-and-captions.md)**Verdict:** see [`REPORT.md`](./REPORT.md) — §4.1 guardrail PASS on all 28 runs;word-end timestamps agree with CT2 within 20 ms median; wcpp-CPU-q8_0 isdiff --git a/tools/stt-eval/whispercpp-dtw-poc/REPORT.md b/tools/stt-eval/whispercpp-dtw-poc/REPORT.mdindex a9dc9eeb1..6237dadb8 100644--- a/tools/stt-eval/whispercpp-dtw-poc/REPORT.md+++ b/tools/stt-eval/whispercpp-dtw-poc/REPORT.md@@ -1,7 +1,7 @@# whisper.cpp DTW word-timestamp POC — REPORT**Branch:** `feat/native-stt-whispercpp`-**Plan:** [`docs/engineering/stt-whispercpp-dtw-poc-plan.md`](../../../../docs/engineering/stt-whispercpp-dtw-poc-plan.md)+**Plan:** [`technical-documentation/architecture/transcription-and-captions.md`](../../../../technical-documentation/architecture/transcription-and-captions.md)**POC dir:** `tools/stt-eval/whispercpp-dtw-poc/`**Status:** all 7 fixtures scored for all available backends; §4.1 guardrail PASS on every run; three verdicts below.