diff --git a/.agents/skills/formencoder-harness/references/tools.md b/.agents/skills/formencoder-harness/references/tools.md
index fc0c49a..3106f21 100644
--- a/.agents/skills/formencoder-harness/references/tools.md
+++ b/.agents/skills/formencoder-harness/references/tools.md
@@ -2,7 +2,7 @@
Generated from the formencoder engine by `./formencoder agents sync`; do not edit by hand.
-The `formencoder` MCP server has 29 curated tools, listed here, plus one tool per engine command named from its id (`queue.addSource` is `queue_add_source`; commands.md gives every name). `./formencoder mcp` serves them over stdio (it starts the engine when it is not running); the engine also serves them over Streamable HTTP at `http://127.0.0.1:8270/mcp`. A profile chooses what a client lists: `--profile full` (curated plus every command tool; Claude Code and Codex), `--profile core` (the curated tools only; Cursor) or `--profile core,queue,preset` (curated plus those namespaces); over HTTP pass `?profile=`. Every tool can be called by name whatever the profile. Resources: `formencoder://status`, `queue`, `presets`, `formats`, `encoders`, `commands`, `log/encoding`, `log/error`, `guide/[topic]`, and the templates `output/[id]`, `preset/[id]`, `format/[id]`, `command/[id]`. Prompts: `workflow`, `youtube_version`, `broadcast_master`, `proxies`, `review_copy`. The shell equivalents are in the last section.
+The `formencoder` MCP server has 29 curated tools, listed here, plus one tool per engine command named from its id (`queue.addSource` is `queue_add_source`; commands.md gives every name). `./formencoder mcp` serves them over stdio (it starts the engine when it is not running); the engine also serves them over Streamable HTTP at `http://127.0.0.1:8270/mcp`. A profile chooses what a client lists: `--profile full` (curated plus every command tool; Claude Code and Codex), `--profile core` (the curated tools only; Cursor and Antigravity) or `--profile core,queue,preset` (curated plus those namespaces); over HTTP pass `?profile=`. Every tool can be called by name whatever the profile. Resources: `formencoder://status`, `queue`, `presets`, `formats`, `encoders`, `commands`, `log/encoding`, `log/error`, `guide/[topic]`, and the templates `output/[id]`, `preset/[id]`, `format/[id]`, `command/[id]`. Prompts: `workflow`, `youtube_version`, `broadcast_master`, `proxies`, `review_copy`. The shell equivalents are in the last section.
## Contents
diff --git a/.agents/skills/formencoder-harness/sub-skills/session-and-connection/SUB-SKILL.md b/.agents/skills/formencoder-harness/sub-skills/session-and-connection/SUB-SKILL.md
index df3abe2..fae9dd6 100644
--- a/.agents/skills/formencoder-harness/sub-skills/session-and-connection/SUB-SKILL.md
+++ b/.agents/skills/formencoder-harness/sub-skills/session-and-connection/SUB-SKILL.md
@@ -15,15 +15,15 @@ description: How an agent reaches formencoder. Use when the formencoder MCP serv
| Started from | Trust | Configuration |
| --- | --- | --- |
-| formencoder's Terminal panel (the Claude Code, Codex or Cursor buttons, or typed) | trusted: the shell carries the session token, nothing asks | the agent workspace: `CLAUDE.md`, `AGENTS.md`, `.mcp.json`, `.codex/config.toml`, `.cursor/mcp.json` and this skill |
+| formencoder's Terminal panel, a Claude Code, Codex, Cursor or Antigravity tab (its buttons or the ask line; the MCP server is named `formencoder_tab` there) | trusted while the tab is open: the program carries the tab's token, nothing asks; a program typed into a plain shell tab asks like any other | the agent workspace: `CLAUDE.md`, `AGENTS.md`, `.mcp.json`, `.codex/config.toml`, `.cursor/mcp.json` and this skill |
| The formencoder repository | asks once per client in the window | `.mcp.json`, `.codex/config.toml`, `.cursor/mcp.json` at the repository root |
-| Any other folder | asks once per client in the window | `./formencoder agents install` (or the Agents panel) adds the MCP server and this skill to the user's Claude Code, Codex and Cursor setup |
+| Any other folder | asks once per client in the window | `./formencoder agents install` (or the Agents panel) adds the MCP server and this skill to the user's Claude Code, Codex and Cursor setup, and the MCP server to Antigravity's |
## Permission
- Reads (`status`, `probe`, `preview_frame`, `contact_sheet`, `verify`, `wait`, `log`, `formats`, `list_commands` and every query command) never ask.
- The first change from an outside agent opens a dialog in the formencoder window: **Allow** (this session), **Allow Always** (remembered), **Don't Allow**. Tell the person a prompt is waiting in formencoder when you make the first change.
-- `FORMENCODER_AGENTS` on the engine sets the policy: `ask` (default), `allow` (never ask) or `deny` (refuse outside agents; Terminal agents still work).
+- `FORMENCODER_AGENTS=deny` on the engine refuses every change from every agent, Terminal agents included (reads still work). Any other value, `allow` included, leaves the person's stored choice in charge: the engine asks, and only the person can answer in the window.
- The Agents panel shows who is allowed and can forget them.
## FFmpeg
@@ -42,7 +42,7 @@ formencoder encodes with an LGPL FFmpeg build it pins (the same builds formcut s
| `The formencoder engine is not running and could not be started` | Ask the person to run `./formencoder boot` in the formencoder folder or open the desktop app, then retry. |
| `No formencoder window is open to ask the person for permission` | The policy is `ask` and no window is open. Ask the person to open formencoder (or start the agent from its Terminal panel), then retry. |
| `Nobody answered the permission request` | The dialog timed out. Ask the person to answer it in the formencoder window. |
-| `Outside agents are turned off (FORMENCODER_AGENTS=deny)` | Only Terminal agents may change the queue. Suggest starting the agent from the Terminal panel. |
+| `Outside agents are turned off (FORMENCODER_AGENTS=deny)` | No agent may change the queue, Terminal agents included; reads still work. Only the person can change this, by starting formencoder without that setting. |
| `The formencoder engine stopped answering` | The engine exited or is busy past the timeout. `status` again; if it fails, ask the person to restart formencoder. |
## Several windows
diff --git a/.agents/skills/formencoder-harness/sub-skills/ui-automation/SUB-SKILL.md b/.agents/skills/formencoder-harness/sub-skills/ui-automation/SUB-SKILL.md
index e492835..2723c44 100644
--- a/.agents/skills/formencoder-harness/sub-skills/ui-automation/SUB-SKILL.md
+++ b/.agents/skills/formencoder-harness/sub-skills/ui-automation/SUB-SKILL.md
@@ -34,7 +34,7 @@ These are queries: they change what the window shows, not the queue, so they nev
- **Family**: the running form family apps and their sources.
- **Log**: the Encoding and Error logs.
- **Info**: the selected source or output's details.
-- **Terminal**: the embedded terminal where Claude Code, Codex and Cursor run as trusted agents.
+- **Terminal**: the embedded terminal where Claude Code, Codex, Cursor and Antigravity run as trusted agents.
- **Agents**: which outside agents are allowed, the MCP address, and installing the clients.
## Extensions
diff --git a/.claude/skills/formencoder-harness/references/tools.md b/.claude/skills/formencoder-harness/references/tools.md
index fc0c49a..3106f21 100644
--- a/.claude/skills/formencoder-harness/references/tools.md
+++ b/.claude/skills/formencoder-harness/references/tools.md
@@ -2,7 +2,7 @@
Generated from the formencoder engine by `./formencoder agents sync`; do not edit by hand.
-The `formencoder` MCP server has 29 curated tools, listed here, plus one tool per engine command named from its id (`queue.addSource` is `queue_add_source`; commands.md gives every name). `./formencoder mcp` serves them over stdio (it starts the engine when it is not running); the engine also serves them over Streamable HTTP at `http://127.0.0.1:8270/mcp`. A profile chooses what a client lists: `--profile full` (curated plus every command tool; Claude Code and Codex), `--profile core` (the curated tools only; Cursor) or `--profile core,queue,preset` (curated plus those namespaces); over HTTP pass `?profile=`. Every tool can be called by name whatever the profile. Resources: `formencoder://status`, `queue`, `presets`, `formats`, `encoders`, `commands`, `log/encoding`, `log/error`, `guide/[topic]`, and the templates `output/[id]`, `preset/[id]`, `format/[id]`, `command/[id]`. Prompts: `workflow`, `youtube_version`, `broadcast_master`, `proxies`, `review_copy`. The shell equivalents are in the last section.
+The `formencoder` MCP server has 29 curated tools, listed here, plus one tool per engine command named from its id (`queue.addSource` is `queue_add_source`; commands.md gives every name). `./formencoder mcp` serves them over stdio (it starts the engine when it is not running); the engine also serves them over Streamable HTTP at `http://127.0.0.1:8270/mcp`. A profile chooses what a client lists: `--profile full` (curated plus every command tool; Claude Code and Codex), `--profile core` (the curated tools only; Cursor and Antigravity) or `--profile core,queue,preset` (curated plus those namespaces); over HTTP pass `?profile=`. Every tool can be called by name whatever the profile. Resources: `formencoder://status`, `queue`, `presets`, `formats`, `encoders`, `commands`, `log/encoding`, `log/error`, `guide/[topic]`, and the templates `output/[id]`, `preset/[id]`, `format/[id]`, `command/[id]`. Prompts: `workflow`, `youtube_version`, `broadcast_master`, `proxies`, `review_copy`. The shell equivalents are in the last section.
## Contents
diff --git a/.claude/skills/formencoder-harness/sub-skills/session-and-connection/SUB-SKILL.md b/.claude/skills/formencoder-harness/sub-skills/session-and-connection/SUB-SKILL.md
index df3abe2..fae9dd6 100644
--- a/.claude/skills/formencoder-harness/sub-skills/session-and-connection/SUB-SKILL.md
+++ b/.claude/skills/formencoder-harness/sub-skills/session-and-connection/SUB-SKILL.md
@@ -15,15 +15,15 @@ description: How an agent reaches formencoder. Use when the formencoder MCP serv
| Started from | Trust | Configuration |
| --- | --- | --- |
-| formencoder's Terminal panel (the Claude Code, Codex or Cursor buttons, or typed) | trusted: the shell carries the session token, nothing asks | the agent workspace: `CLAUDE.md`, `AGENTS.md`, `.mcp.json`, `.codex/config.toml`, `.cursor/mcp.json` and this skill |
+| formencoder's Terminal panel, a Claude Code, Codex, Cursor or Antigravity tab (its buttons or the ask line; the MCP server is named `formencoder_tab` there) | trusted while the tab is open: the program carries the tab's token, nothing asks; a program typed into a plain shell tab asks like any other | the agent workspace: `CLAUDE.md`, `AGENTS.md`, `.mcp.json`, `.codex/config.toml`, `.cursor/mcp.json` and this skill |
| The formencoder repository | asks once per client in the window | `.mcp.json`, `.codex/config.toml`, `.cursor/mcp.json` at the repository root |
-| Any other folder | asks once per client in the window | `./formencoder agents install` (or the Agents panel) adds the MCP server and this skill to the user's Claude Code, Codex and Cursor setup |
+| Any other folder | asks once per client in the window | `./formencoder agents install` (or the Agents panel) adds the MCP server and this skill to the user's Claude Code, Codex and Cursor setup, and the MCP server to Antigravity's |
## Permission
- Reads (`status`, `probe`, `preview_frame`, `contact_sheet`, `verify`, `wait`, `log`, `formats`, `list_commands` and every query command) never ask.
- The first change from an outside agent opens a dialog in the formencoder window: **Allow** (this session), **Allow Always** (remembered), **Don't Allow**. Tell the person a prompt is waiting in formencoder when you make the first change.
-- `FORMENCODER_AGENTS` on the engine sets the policy: `ask` (default), `allow` (never ask) or `deny` (refuse outside agents; Terminal agents still work).
+- `FORMENCODER_AGENTS=deny` on the engine refuses every change from every agent, Terminal agents included (reads still work). Any other value, `allow` included, leaves the person's stored choice in charge: the engine asks, and only the person can answer in the window.
- The Agents panel shows who is allowed and can forget them.
## FFmpeg
@@ -42,7 +42,7 @@ formencoder encodes with an LGPL FFmpeg build it pins (the same builds formcut s
| `The formencoder engine is not running and could not be started` | Ask the person to run `./formencoder boot` in the formencoder folder or open the desktop app, then retry. |
| `No formencoder window is open to ask the person for permission` | The policy is `ask` and no window is open. Ask the person to open formencoder (or start the agent from its Terminal panel), then retry. |
| `Nobody answered the permission request` | The dialog timed out. Ask the person to answer it in the formencoder window. |
-| `Outside agents are turned off (FORMENCODER_AGENTS=deny)` | Only Terminal agents may change the queue. Suggest starting the agent from the Terminal panel. |
+| `Outside agents are turned off (FORMENCODER_AGENTS=deny)` | No agent may change the queue, Terminal agents included; reads still work. Only the person can change this, by starting formencoder without that setting. |
| `The formencoder engine stopped answering` | The engine exited or is busy past the timeout. `status` again; if it fails, ask the person to restart formencoder. |
## Several windows
diff --git a/.claude/skills/formencoder-harness/sub-skills/ui-automation/SUB-SKILL.md b/.claude/skills/formencoder-harness/sub-skills/ui-automation/SUB-SKILL.md
index e492835..2723c44 100644
--- a/.claude/skills/formencoder-harness/sub-skills/ui-automation/SUB-SKILL.md
+++ b/.claude/skills/formencoder-harness/sub-skills/ui-automation/SUB-SKILL.md
@@ -34,7 +34,7 @@ These are queries: they change what the window shows, not the queue, so they nev
- **Family**: the running form family apps and their sources.
- **Log**: the Encoding and Error logs.
- **Info**: the selected source or output's details.
-- **Terminal**: the embedded terminal where Claude Code, Codex and Cursor run as trusted agents.
+- **Terminal**: the embedded terminal where Claude Code, Codex, Cursor and Antigravity run as trusted agents.
- **Agents**: which outside agents are allowed, the MCP address, and installing the clients.
## Extensions
diff --git a/.claude/skills/formencoder-skillset/sub-skills/agent-substrate/SUB-SKILL.md b/.claude/skills/formencoder-skillset/sub-skills/agent-substrate/SUB-SKILL.md
index f54cf34..10973c8 100644
--- a/.claude/skills/formencoder-skillset/sub-skills/agent-substrate/SUB-SKILL.md
+++ b/.claude/skills/formencoder-skillset/sub-skills/agent-substrate/SUB-SKILL.md
@@ -9,7 +9,7 @@ description: Changing how agents drive formencoder. Use for the MCP tools and gu
| Path | Holds |
| --- | --- |
-| `backend/app/agent/tools.py` | `INSTRUCTIONS`, `WORKFLOW`, `GUIDES`, `TOOLS` (21 curated tools) and their handlers; one tool per registry command built by `command_tools()` and served by profile (`full`, `core`, `core,[category]...`, chosen with `--profile` or `x-formencoder-mcp-profile`); `RESOURCES`, `RESOURCE_TEMPLATES` and `read_resource`; `RECIPES` and `prompt()` |
+| `backend/app/agent/tools.py` | `INSTRUCTIONS`, `WORKFLOW`, `GUIDES`, `TOOLS` (29 curated tools, the core profile; the full profile adds one per command, 125 today) and their handlers; one tool per registry command built by `command_tools()` and served by profile (`full`, `core`, `core,[category]...`, chosen with `--profile` or `x-formencoder-mcp-profile`); `RESOURCES`, `RESOURCE_TEMPLATES` and `read_resource`; `RECIPES` and `prompt()` |
| `backend/app/agent/workspace.py` `CLIENT_PROFILES` | which profile each client gets (Claude Code and Codex full, Cursor core) in every config formencoder writes |
| `backend/app/routers/mcp.py` | Streamable HTTP MCP at `/mcp` |
| `backend/app/agent/stdio.py`, `setup/mcp_stdio.py` | the stdio relay `./formencoder mcp`, which finds or starts the engine |
@@ -18,7 +18,7 @@ description: Changing how agents drive formencoder. Use for the MCP tools and gu
| `backend/app/agent/approvals.py` | which actions need the person's approval (`reasons`), the guard that waits or answers `pendingApproval`, `decide`, full faith (`approvals.json`), the agent activity record; decisions and full faith only over the live socket (`agents.decide`, `agents.fullFaith` in `engine/rpc.py`) |
| `backend/app/routers/terminal.py` | the terminal hub: sessions with ids, history, readers and restart; REST under `/api/terminal/sessions`; the websocket attaching with `?session=`; the shell started with the workspace's bash rc file or zsh ZDOTDIR so the `formencoder` shim stays on PATH |
| `backend/app/agent/workspace.py`, `templates/` | the agent workspace (`CLAUDE.md`, `AGENTS.md`, MCP configs, skills) the Terminal panel opens |
-| `backend/app/agent/connect.py` | `./formencoder agents install`: user-level MCP entries and skill copies for Claude Code, Codex and Cursor |
+| `backend/app/agent/connect.py` | `./formencoder agents install`: user-level MCP entries for Claude Code, Codex, Cursor and Antigravity, and skill copies for the first three |
| `backend/app/agent/cli.py`, `setup/fe.py` | the command line (`encode`, `queue`, `exec`, `batch`, `commands`, `describe`, `presets`, `probe`, `frame`, `wait`) |
| `setup/agents.py` | `sync` generates `references/commands.md`, `tools.md`, `presets.md` and `formats.md` from the engine and mirrors the skill to `.agents/skills` |
| `.claude/skills/formencoder-harness` | the hand-written skill: `SKILL.md`, sub-skills, `references/concepts.md` |
diff --git a/.claude/skills/formencoder-skillset/sub-skills/desktop-and-release/SUB-SKILL.md b/.claude/skills/formencoder-skillset/sub-skills/desktop-and-release/SUB-SKILL.md
index c3cbc9e..b0ad759 100644
--- a/.claude/skills/formencoder-skillset/sub-skills/desktop-and-release/SUB-SKILL.md
+++ b/.claude/skills/formencoder-skillset/sub-skills/desktop-and-release/SUB-SKILL.md
@@ -23,7 +23,7 @@ description: Building and releasing formencoder as a desktop app. Use for the Ta
| Windows | `x86_64-pc-windows-msvc` | `.msi`, NSIS `.exe` |
| Linux | `x86_64-unknown-linux-gnu` | `.deb`, `.rpm`, `.AppImage` |
-formcompiler (`nodemode-ai/formcompiler`) builds all four when a `compile_vX.Y.Z` branch is pushed here, and the repo's own `ci.yml` builds the interface, checks the engine on each host, runs the text lint and `agents sync --check`.
+formcompiler (`nodemode-dev/formcompiler`) builds all four when a `compile_vX.Y.Z` branch is pushed here, and the repo's own `ci.yml` builds the interface, checks the engine on each host, runs the text lint and `agents sync --check`.
## Releasing
diff --git a/.claude/skills/formencoder-skillset/sub-skills/verification/SUB-SKILL.md b/.claude/skills/formencoder-skillset/sub-skills/verification/SUB-SKILL.md
index 658f5a5..a500486 100644
--- a/.claude/skills/formencoder-skillset/sub-skills/verification/SUB-SKILL.md
+++ b/.claude/skills/formencoder-skillset/sub-skills/verification/SUB-SKILL.md
@@ -33,7 +33,7 @@ A change to settings, formats, presets, effects or the pipeline is verified by e
## Agent paths
-Replay tool sequences through `setup/mcp_stdio.py` against a running engine (`FORMENCODER_AGENTS=allow` for unattended runs, `ask` to test the consent dialog with a browser open). Save the images `preview_frame` and `contact_sheet` return and look at them.
+Replay tool sequences through `setup/mcp_stdio.py` against a running engine (no variable skips the consent dialog: for an unattended run call read-only tools, or answer the dialog the way CI does, from a from-source run that claims the window key at `/api/window/key` and replies to the `consent` message on the `/api/live` socket; `FORMENCODER_AGENTS=deny` tests the refusal). Save the images `preview_frame` and `contact_sheet` return and look at them.
## Report
diff --git a/.docs/BRANCHING.md b/.docs/BRANCHING.md
index 3c29b68..a14d120 100644
--- a/.docs/BRANCHING.md
+++ b/.docs/BRANCHING.md
@@ -5,6 +5,6 @@
- **Commits** follow Conventional Commits with the version in the summary, for example `fix(core): keep the source range when a preset is applied (0.1.1)`. The commit identity is `nodemode-ai `.
- **Versions** are `v*.*.*` with dots, everywhere: `frontend/package.json` and its lockfile, `frontend/src/version.ts`, `backend/app/__init__.py`, `native/Cargo.toml` (the workspace version), the seven fencoder entries in `native/Cargo.lock`, `native/fencoder-py/pyproject.toml`, `src-tauri/Cargo.toml`, its `Cargo.lock`, `src-tauri/tauri.conf.json`, the version line in `README.md` and the deliverable zip names. Bump all of them in one commit, the last of a series.
- **Engine commands.** A change to the engine's commands, formats, presets or MCP tools is followed in the same commit by `./formencoder agents sync`, so the harness references follow the engine.
-- **FFmpeg.** The pinned build is changed only by replacing `src-tauri/binaries/ffmpeg-licence.json` with a new record from the formcut-binaries release, together with its `LGPL-2.1.txt` and `THIRD-PARTY-NOTICES.txt`, in one commit. Never point the fetch or the bundle at a build that is not recorded there.
-- **Releases.** formencoder builds nothing in this repository. After the version bump lands on main, push a branch `compile_vX.Y.Z` cut from that commit. CI runs on it, and formcompiler (`nodemode-ai/formcompiler`) picks it up on its next 8-hourly watch run, or at once when its watch is run by hand. It builds macOS (Apple silicon and Intel), Linux and Windows bundles with the pinned FFmpeg and opens a draft release `formencoder-vX.Y.Z` on formcompiler's release page, which carries the FFmpeg source. Review the draft, then publish it there. Compile branches are kept as the record of what was built.
+- **FFmpeg.** The pinned build is changed only by replacing `src-tauri/binaries/ffmpeg-licence.json` with a new record from the formai-binaries release (`nodemode-dev/formai-binaries`; builds made before the rename use the older name, formcut-binaries, which keeps working), together with its `LGPL-2.1.txt` and `THIRD-PARTY-NOTICES.txt`, in one commit. Never point the fetch or the bundle at a build that is not recorded there. The fetch and `setup/bundle_ffmpeg.py` try formai-binaries first and formcut-binaries second, and install only files that match the record; `FORMENCODER_FFMPEG_RELEASE` (a release folder URL such as `https://example.org/ffmpeg-7.1.5-2`) replaces both as the only address, with the same check.
+- **Releases.** formencoder builds nothing in this repository. After the version bump lands on main, push a branch `compile_vX.Y.Z` cut from that commit. CI runs on it, and formcompiler (`nodemode-dev/formcompiler`) picks it up on its next 8-hourly watch run, or at once when its watch is run by hand. It builds macOS (Apple silicon and Intel), Linux and Windows bundles with the pinned FFmpeg and opens a draft release `formencoder-vX.Y.Z` on formcompiler's release page, which carries the FFmpeg source. Review the draft, then publish it there. Compile branches are kept as the record of what was built.
- **Wiki.** Edit pages in `.docs/wiki/`, never in the GitHub wiki interface. `.github/workflows/wiki.yml` publishes the folder when it changes on main. The wiki needs one page created by hand once before the first publish.
diff --git a/.docs/wiki/Agents.md b/.docs/wiki/Agents.md
index 535ce7b..17eb6b2 100644
--- a/.docs/wiki/Agents.md
+++ b/.docs/wiki/Agents.md
@@ -4,15 +4,15 @@ formencoder's engine exposes every command to agents through MCP, the same comma
## Three ways in
-- **In formencoder**: the Terminal panel (or the Agent workspace) opens a shell in formencoder's agent workspace. Its Claude Code, Codex and Cursor buttons start an agent that already has the `formencoder` MCP server and the `formencoder-harness` skill; it works without permission prompts.
+- **In formencoder**: the Terminal panel (or the Agent workspace) opens tabs in formencoder's agent workspace. Its Claude Code, Codex, Cursor and Antigravity buttons each start that agent in a tab of its own; it already has formencoder's MCP server (named `formencoder_tab` there) and the `formencoder-harness` skill, and works without permission prompts while its tab is open. A plain shell tab carries no agent access: a program typed there asks like any outside agent.
- **From the repository**: `.mcp.json`, `.codex/config.toml` and `.cursor/mcp.json` run `./formencoder mcp`, which starts the engine when it is not running. The first change asks once in the formencoder window: Allow, Allow Always or Don't Allow.
-- **From anywhere**: `./formencoder agents install` (or the Agents panel) adds the MCP server and the skill to your Claude Code, Codex and Cursor setup.
+- **From anywhere**: `./formencoder agents install` (or the Agents panel) adds the MCP server and the skill to your Claude Code, Codex and Cursor setup, and the MCP server to Antigravity's (`~/.gemini/config/mcp_config.json`).
-`FORMENCODER_AGENTS` sets the policy for outside agents: `ask` (default), `allow` or `deny`.
+`FORMENCODER_AGENTS=deny` refuses every change from every agent, whatever was allowed before, Terminal agents included; reads still work. Any other value, `allow` included, means the stored choice decides (ask by default). Only the person, in the formencoder window, can allow an outside agent, so an unattended outside agent with no window open is refused its changes; start it from the Terminal panel instead.
## The tools
-21 tools: `status`, `list_commands`, `describe_command`, `execute`, `batch`, `probe`, `encode`, `queue`, `export_settings`, `preview_frame`, `contact_sheet`, `wait`, `verify`, `presets`, `formats`, `watch_folder`, `family`, `log`, `history`, `ui`, `guide`. `encode` queues, encodes, waits and verifies in one call; `preview_frame` and `contact_sheet` render frames through an output's exact settings so an agent looks before it encodes; `verify` probes the file against its settings.
+29 curated tools: `status`, `list_commands`, `describe_command`, `execute`, `batch`, `probe`, `encode`, `queue`, `export_settings`, `preview_frame`, `contact_sheet`, `wait`, `verify`, `presets`, `formats`, `watch_folder`, `family`, `log`, `history`, `ui`, `guide`, `approval_status`, `terminal_list`, `terminal_open`, `terminal_send`, `terminal_read`, `terminal_close`, `extensions_list`, `extension_command`. The core profile (Cursor) lists these 29; the full profile (Claude Code and Codex) adds one tool per engine command, such as `queue_add_source`, 125 tools in all today (`.claude/skills/formencoder-harness/references/tools.md` and `commands.md` are generated from the engine and list them). `encode` queues, encodes, waits and verifies in one call; `preview_frame` and `contact_sheet` render frames through an output's exact settings so an agent looks before it encodes; `verify` probes the file against its settings.
## The skill
diff --git a/.docs/wiki/Home.md b/.docs/wiki/Home.md
index 91ea6a6..0c396b0 100644
--- a/.docs/wiki/Home.md
+++ b/.docs/wiki/Home.md
@@ -2,7 +2,7 @@
The media encoder of the form family, beside formcut (video), formvfx (motion graphics), formwav (audio) and formvis (images). A queue of sources with several outputs each, 93 encoding presets and 5 ingest presets, 40 formats from H.264, HEVC, AV1 and WebM to ProRes, DNxHR, XDCAM MXF, AS-10, AS-11, P2, Blu-ray and DCP, image sequences, GIF and audio, watch folders, card ingest with checksums, proxies, LUTs, HDR to SDR conform, overlays, Fit Tuning, loudness normalisation, captions with speech to text, metadata, Content Credentials, plug-ins and publishing to storage, YouTube, Vimeo and Facebook, on macOS, Windows and Linux.
-Every action in formencoder is a command with an id, so people and agents use the same tools: Claude Code, Codex and Cursor drive formencoder from its embedded terminal through MCP, with a skill that teaches them the workflow.
+Every action in formencoder is a command with an id, so people and agents use the same tools: Claude Code, Codex, Cursor and Antigravity drive formencoder from its embedded terminal through MCP, with a skill that teaches them the workflow.
## Pages
@@ -13,4 +13,4 @@ Every action in formencoder is a command with an id, so people and agents use th
- [Architecture](Architecture) · the Rust encoding engine, the engine service, the interface
- [Desktop](Desktop) · the Tauri app, the frozen engine, the bundled FFmpeg
- [Releasing](Releasing) · versions, tags, CI
-- [Parity](Parity) · formencoder against Media Encoder, row by row
+- [Parity](https://github.com/nodemode-dev/formencoder/blob/main/docs/PARITY.md) · formencoder against Media Encoder, row by row
diff --git a/.docs/wiki/Releasing.md b/.docs/wiki/Releasing.md
index 4b3f0c9..22fa1b6 100644
--- a/.docs/wiki/Releasing.md
+++ b/.docs/wiki/Releasing.md
@@ -3,6 +3,6 @@
1. Land the work on main with CI green (interface build, the engine on macOS, Windows and Linux, the engine selfcheck, an MCP preview and a verified encode, skill references in step, text lint, shell syntax, `cargo check` of the desktop shell).
2. Bump the version in every site in one commit (see `.docs/BRANCHING.md`).
3. Push a branch named `compile_vX.Y.Z` from that commit, for example `git push origin HEAD:compile_v0.2.8`. CI runs on it. The name must match the version in `src-tauri/tauri.conf.json`, or formcompiler refuses it and says why.
-4. formcompiler (`nodemode-ai/formcompiler`) finds the branch on its next watch run (every 8 hours), or at once when its watch is run by hand. Once CI has passed on that commit, it builds macOS arm64 and x64, Linux x64 and Windows x64 bundles with the pinned FFmpeg, attaches the FFmpeg source tarball and its notices, and opens a draft release `formencoder-vX.Y.Z` on its release page.
+4. formcompiler (`nodemode-dev/formcompiler`) finds the branch on its next watch run (every 8 hours), or at once when its watch is run by hand. Once CI has passed on that commit, it builds macOS arm64 and x64, Linux x64 and Windows x64 bundles with the pinned FFmpeg, attaches the FFmpeg source tarball and its notices, and opens a draft release `formencoder-vX.Y.Z` on its release page.
5. Signing: the Apple Developer ID, Windows code signing and Tauri updater key secrets are set in formcompiler's repository, never in this one. Updater signatures also publish `latest.json` in the `formencoder-updates` feed. Set `plugins.updater.pubkey` in `src-tauri/tauri.conf.json` to the matching public key to turn update checks on.
6. Check the draft release's assets on formcompiler's release page, then publish it there. Compile branches are kept as the record of what was built.
diff --git a/.docs/wiki/_Sidebar.md b/.docs/wiki/_Sidebar.md
index 0003f20..031a68a 100644
--- a/.docs/wiki/_Sidebar.md
+++ b/.docs/wiki/_Sidebar.md
@@ -7,4 +7,4 @@
- [Architecture](Architecture)
- [Desktop](Desktop)
- [Releasing](Releasing)
-- [Parity](Parity)
+- [Parity](https://github.com/nodemode-dev/formencoder/blob/main/docs/PARITY.md)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 6e486ee..cf69551 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -91,7 +91,6 @@ jobs:
run: ./formencoder agents sync --check
- name: Boot the engine, encode over MCP and verify
env:
- FORMENCODER_AGENTS: allow
FORMENCODER_FFMPEG_AUTO: '0'
FORMENCODER_DATA_DIR: ${{ runner.temp }}/fedata
run: |
@@ -100,6 +99,39 @@ jobs:
ffmpeg -loglevel error -y -f lavfi -i testsrc2=size=1280x720:rate=25:duration=3 -f lavfi -i sine=frequency=440:duration=3 -c:v mpeg4 -c:a aac -shortest "$clip"
(cd backend && python -m uvicorn app.main:app --host 127.0.0.1 --port 8270 &)
for i in $(seq 1 60); do curl -sf -H 'x-formencoder-local: 1' http://127.0.0.1:8270/api/health && break; sleep 1; done
+ python - <<'PY' &
+ import asyncio
+ import json
+ import urllib.request
+
+ import websockets
+
+ base = 'http://127.0.0.1:8270'
+
+
+ def post(path, headers=None):
+ req = urllib.request.Request(base + path, method='POST', data=b'', headers={'x-formencoder-local': '1', **(headers or {})})
+ return json.load(urllib.request.urlopen(req))
+
+
+ key = post('/api/window/key')['key']
+ ticket = post('/api/window/ticket', {'x-formencoder-window-key': key})['ticket']
+
+
+ async def main():
+ async with websockets.connect('ws://127.0.0.1:8270/api/live?ticket=' + ticket) as ws:
+ async for text in ws:
+ m = json.loads(text)
+ if m.get('type') == 'hello':
+ open('window.ready', 'w').close()
+ if m.get('type') == 'consent':
+ await ws.send(json.dumps({'method': 'reply', 'params': {'requestId': m['requestId'], 'value': {'allow': True}}}))
+ open('window.asked', 'w').write(m['client'])
+
+
+ asyncio.run(main())
+ PY
+ for i in $(seq 1 30); do [ -f window.ready ] && break; sleep 1; done
printf '%s\n' \
'{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"protocolVersion":"2025-06-18","clientInfo":{"name":"ci"},"capabilities":{}}}' \
'{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' \
@@ -116,7 +148,8 @@ jobs:
assert not enc.get('isError'), enc
text = enc['content'][0]['text']
assert '"done"' in text and '"passed": true' in text, text[:2000]
- print('mcp ok:', len(tools), 'tools, preview and a verified encode')
+ assert open('window.asked').read() == 'mcp:ci', 'the window was not asked'
+ print('mcp ok:', len(tools), 'tools, preview and a verified encode the window allowed')
PY
test:
diff --git a/AGENTS.md b/AGENTS.md
index 70bfa42..c071232 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -6,7 +6,7 @@ The media encoder of the form family: vanilla TypeScript and Vite interface, Pyt
When the person wants media encoded, transcoded, normalised, captioned, ingested, proxied or delivered with formencoder, use the `formencoder` MCP server's tools guided by the `formencoder-harness` skill in `.agents/skills/formencoder-harness` (its `references/tools.md` lists every tool; `references/commands.md` every command; `references/presets.md` and `references/formats.md` the presets and settings). Start with `status`, `probe` the sources, encode with `encode` or `queue.addSource` plus `export_settings`, look with `preview_frame`, and `verify` every output before reporting it.
-The MCP server is configured here in `.codex/config.toml` (Codex) and `.cursor/mcp.json` (Cursor); both run `./formencoder mcp`, which starts the engine when it is not running. Codex loads the full profile (the 21 curated tools plus one tool per engine command, such as `queue_add_source`) and Cursor the core profile (the 27 curated tools; `execute` reaches every command). From any other folder, `./formencoder agents install` sets Claude Code, Codex and Cursor up for the user account. Without MCP, the `./formencoder` command line has the same surface: any command as `./formencoder [id] --name value` (`--help` after the id lists its flags), and `encode`, `queue`, `commands`, `describe`, `exec`, `batch`, `presets`, `probe`, `frame`, `wait`.
+The MCP server is configured here in `.codex/config.toml` (Codex) and `.cursor/mcp.json` (Cursor); both run `./formencoder mcp`, which starts the engine when it is not running. Codex loads the full profile (the 29 curated tools plus one tool per engine command, such as `queue_add_source`: 125 tools today) and Cursor the core profile (the same 29 curated tools only; `execute` reaches every command). From any other folder, `./formencoder agents install` sets Claude Code, Codex and Cursor up for the user account. Without MCP, the `./formencoder` command line has the same surface: any command as `./formencoder [id] --name value` (`--help` after the id lists its flags), and `encode`, `queue`, `commands`, `describe`, `exec`, `batch`, `presets`, `probe`, `frame`, `wait`.
## Changing formencoder's code
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c2fb953..66c5499 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,45 @@
# Changelog
+## v0.10.0 · 2026-11-19
+
+The family's terminal panel, and four agent programs. The Terminal panel is now the one the other Form apps have, Google's Antigravity (`agy`) is offered beside Claude Code, Codex and Cursor, and FormEncoder finds these programs however it was started.
+
+- The Terminal panel is the family's shared panel. It keeps its place in FormEncoder (any group, floating, per workspace, opened from the Window menu). Inside it are tabs: plain shells, Claude Code, Codex, Cursor and Antigravity each in a tab of its own, and read-only tabs for terminals an outside agent opened. A line at the bottom opens Claude Code with what you type.
+- Changed on purpose: a plain shell tab carries no agent access. A program you type into a shell asks like any outside agent; the agent tabs you start from the panel's buttons do not ask.
+- The permission question is the panel's dialog in the middle of the window: Deny, Allow once, or Always allow that agent. Escape refuses. A question that is still waiting is shown again after a reload, and it closes by itself within about a second when the agent that asked goes away.
+- Antigravity is the fourth agent program. It has its own button and tab in the Terminal panel, a Start Antigravity entry in the Agent button's menu and a Set up Antigravity button in the Agents panel. `./formencoder agents install antigravity` adds FormEncoder to `~/.gemini/config/mcp_config.json`, keeps everything else in that file, and leaves alone an entry of the same name that FormEncoder did not write. Antigravity gets the MCP server only; no skill is copied for it.
+- FormEncoder finds the agent programs however it was started. An app opened from the Dock, the Start menu or a desktop launcher used to see only a short list of folders and could report a program as not installed. It now also looks in the usual install folders and reads your shell's own list once. The status says where each program was found, and tells apart a program that is missing from one that was found but does not start, with the program's own error line. `FORMENCODER_CLAUDE_BIN`, `FORMENCODER_CODEX_BIN`, `FORMENCODER_CURSOR_BIN` and `FORMENCODER_ANTIGRAVITY_BIN` name a program's file directly.
+- An agent tab is started through your login shell, with the program's own folder first on its PATH, so a program that needs the `node` installed beside it starts.
+- The reported version of an agent program is now the version itself (for example `2.1.0`), not the whole line the program prints.
+- The engine starts when it has no output streams. An engine built without a console no longer stops at its first line of output. This was seen in a Windows build of another Form app; the fix here was run on Linux only.
+- The MCP entry the agent tabs use inside FormEncoder's agent workspace is named `formencoder_tab`, apart from the `formencoder` entry that `agents install` writes for use outside the app.
+- `agents/manifest.json` lists the Terminal panel's tabs, and `./formencoder agents sync --check` fails when the shared panel's files or the shared program finder were changed in place.
+- FormEncoder's own tests can no longer start a real agent program: the whole run sees stand-ins only.
+- The README, the wiki, the command help and the agent skills name four agent programs.
+- Not run for this release: Windows, macOS, the desktop app, and the real Claude Code, Codex, Cursor and Antigravity (stand-ins were used). The Antigravity button and tab were not looked at in a browser.
+- The version string inside the three browser demo bundles (`demo/assets/demo.js`, `demos/broadcast/assets/broadcast.js`, `demos/inspect/assets/inspect.js`) is bumped to 0.10.0 by hand, without a rebuild.
+
+## v0.9.0 · 2026-11-19
+
+The family update. Only the FormEncoder window can change things or answer for the person, an agent's permission is asked for in clearer words, encodes write to local files only, and there is a true-black theme. FormEncoder keeps its own Terminal panel in this release.
+
+- Only the FormEncoder window can change things through the engine, answer a permission or approval question, or drive its terminal. Changes from outside the app's window are refused. Outside agents still come in through MCP or the command line and are asked about in the window, as before.
+- The permission question names the agent and says what it asked to do, lists the answers on offer and says when it expires. It can be answered "once", for that call only. Every open window is told when a question has ended, whether it was answered, ran out of time or was withdrawn.
+- Allow Always and Full faith are protected. A change made to the saved agent permission outside the app is ignored, the permission goes back to Ask, and the Agents panel says so. After updating, an agent that was allowed before is asked once more. The protection keeps its secret in the system keychain (new dependency: keyring, MIT); on a computer without a keychain the saved choices stand as before.
+- `FORMENCODER_AGENTS` can no longer switch the agent question off. `deny` still refuses every change from every agent, now including agents started in the Terminal panel, and reading still works. Any other value, `allow` included, leaves the person's own choice in charge, so an outside agent is asked about in the window. If a script of yours sets `FORMENCODER_AGENTS=allow`, remove it: it no longer does anything. An unattended run can still call the read-only tools.
+- Agents can no longer change the FFmpeg folder, the camera raw decoders or the media cache folder, or turn off the numbering of output names. Those stay in Preferences in the window.
+- The agent token a Terminal panel shell carries is now its own: it is replaced when the shell restarts and dropped when it closes. Terminals that agents open do not get one.
+- The engine can start Claude Code, Codex and Cursor as tabs of their own, each with its own access that ends with the tab, and one call reports which of the three are installed, their versions and how to install a missing one. The Terminal panel itself looks and works as it did.
+- Encode outputs are local files only. An output path or folder that is a network address or a stream (`tcp:`, `udp:`, `http:`, `rtmp:`, `ftp:`, `pipe:`, `file:` and the like) is refused when it is set and again when the job starts. Every other output path is made absolute before FFmpeg is called, so the queue shows the full path of an output that was given as a relative one. Inputs that are addresses are refused as well: FormEncoder reads local files.
+- FFmpeg is downloaded from the formai-binaries release, with the earlier formcut-binaries address as the fallback, and every file is still checked against the record. When both fail, the error names both addresses. `FORMENCODER_FFMPEG_RELEASE` (a release folder URL) is documented and, when set, is the only address asked.
+- New theme, AMOLED Black: a true-black window for OLED screens, with panes told apart by thin outlines. That makes sixteen themes.
+- At start the desktop app waits at most 10 seconds, once the engine has given its address, for the engine to recognise the window as the app's own. If that does not happen, the app shows "The formencoder engine failed to start" and opens no window. How long the engine may take to start is unchanged.
+- Running from source, reloading the page no longer makes the engine report a second window that never opened.
+- `agents/manifest.json` lists what FormEncoder offers agents: 125 MCP tools (54 of them read-only, 71 that ask the person first) and 2 skills with 18 sub-skills. `./formencoder agents sync` writes it and `--check` fails when it is out of date.
+- Encode as a Form function, merged after 0.8.4: `form-functions.json` lets a graph in NodeMode's hub run a FormEncoder preset on one file with no window open, and fail when the result does not verify. Its settings accept only listed values and bounded numbers, and name no file. `form-functions.json` is written again for this release and states 0.9.0.
+- Documents brought in line with the app: AGENTS.md, the Agents wiki page and the skillset state the real tool counts (29 curated tools, 125 in the full profile), the demo pages say sixteen themes, formcompiler is named under nodemode-dev, and the wiki's Parity links open `docs/PARITY.md`.
+- The version string inside the three browser demo bundles (`demo/assets/demo.js`, `demos/broadcast/assets/broadcast.js`, `demos/inspect/assets/inspect.js`) is bumped to 0.9.0 by hand, without a rebuild.
+
## v0.8.4 · 2026-11-13
A start-up fix found by running the Linux AppImage.
diff --git a/CLAUDE.md b/CLAUDE.md
index 58de8f0..0208c1e 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -20,7 +20,7 @@ The media encoder of the form family beside formcut, formvfx, formwav and formvi
## After changing the MCP tools or the engine's commands, formats or presets
-Run `./formencoder agents sync` so `.claude/skills/formencoder-harness/references/` and the `.agents/skills` mirror follow; `./formencoder agents sync --check` fails while they drift.
+Run `./formencoder agents sync` so `.claude/skills/formencoder-harness/references/` and the `.agents/skills` mirror follow; `./formencoder agents sync --check` fails while they drift. The same sync writes `agents/manifest.json` (the tools, skills and dock the app offers agents; the family spec reads it); the dock part is the `DOCK` value in `setup/agents.py`, kept by hand.
## Trademarks, copyright and licences
diff --git a/NOTICE.md b/NOTICE.md
index ee7c458..98847ee 100644
--- a/NOTICE.md
+++ b/NOTICE.md
@@ -4,7 +4,7 @@ formencoder is licensed under the Apache License 2.0 (`LICENSE`). It includes or
| Component | Use | License |
| --- | --- | --- |
-| FFmpeg 7.1.5, LGPL build from the formcut-binaries release (`ffmpeg-lgpl-7.1.5-2`), with libopus, libvpx and the hardware interfaces (libva, libdrm, nv-codec-headers, AMF) listed in `src-tauri/binaries/THIRD-PARTY-NOTICES.txt` | decoding, filtering and encoding, run as a separate program (`ffmpeg`, `ffprobe`) and never linked; bundled in the desktop app or downloaded on first run, each file checked against `src-tauri/binaries/ffmpeg-licence.json` | LGPL-2.1-or-later (`src-tauri/binaries/LGPL-2.1.txt`); the libraries' own permissive licences in `THIRD-PARTY-NOTICES.txt` |
+| FFmpeg 7.1.5, LGPL build from the formai-binaries release (`ffmpeg-lgpl-7.1.5-2`; builds made before the rename name it formcut-binaries, which keeps working), with libopus, libvpx and the hardware interfaces (libva, libdrm, nv-codec-headers, AMF) listed in `src-tauri/binaries/THIRD-PARTY-NOTICES.txt` | decoding, filtering and encoding, run as a separate program (`ffmpeg`, `ffprobe`) and never linked; bundled in the desktop app or downloaded on first run, each file checked against `src-tauri/binaries/ffmpeg-licence.json` | LGPL-2.1-or-later (`src-tauri/binaries/LGPL-2.1.txt`); the libraries' own permissive licences in `THIRD-PARTY-NOTICES.txt` |
| BBC bmx v1.6 (`bmxtranswrap`, `mxf2raw`), with its bundled libMXF, libMXF++, expat and uriparser | AS-10, AS-11 OP1a, AS-11 D10 and P2 OP-Atom wrapping and read-back, run as separate programs; built from the pinned tag by `./formencoder install-tools` and staged in `src-tauri/tools` for the desktop bundles | BSD-3-Clause (expat MIT, uriparser BSD-3-Clause); texts in `tools/licences` |
| asdcplib rel_2_13_2 (`asdcp-wrap`, `asdcp-info`), built without OpenSSL and Xerces | DCP picture and sound track files, run as separate programs | BSD-3-Clause; text in `tools/licences` |
| OpenJPEG v2.5.3 (`opj_compress`), with its bundled libpng, libtiff, lcms2 and zlib | DCI cinema-profile JPEG 2000 frames for DCP, run as a separate program | BSD-2-Clause (libpng, libtiff, lcms2 MIT, zlib licences); text in `tools/licences` |
@@ -26,6 +26,8 @@ formencoder is licensed under the Apache License 2.0 (`LICENSE`). It includes or
| anyio 4.15.1, idna 3.20, click 8.5.0, h11 0.16.0, httptools 0.9.0, uvloop 0.23.0, watchfiles 1.3.0, websockets 17.3, python-dotenv 1.2.4, PyYAML 6.0.3 (the `uvicorn[standard]` extras and FastAPI's other requirements, frozen into the engine sidecar where PyInstaller finds them imported) | HTTP and socket serving, async I/O, configuration | MIT (anyio, h11, httptools, uvloop, watchfiles, PyYAML); BSD-3-Clause (idna, click, websockets, python-dotenv); uvloop's wheel carries both MIT and Apache-2.0 texts (its License field says MIT) |
| CPython runtime (3.12 in the release toolchain), embedded by PyInstaller in the `--onefile` engine sidecar | runs the engine service | PSF-2.0 |
| pywinpty (Windows only) | the terminal on Windows | MIT |
+| keyring 25.7.0, jaraco.classes, jaraco.context, jaraco.functools, more-itertools, jeepney (Linux) | keeps the key that seals the agent access choices in the system keychain, frozen into the engine sidecar | MIT |
+| SecretStorage (Linux), pywin32-ctypes (Windows), cryptography, cffi and pycparser (Linux, through SecretStorage) | keychain access for keyring | BSD-3-Clause (SecretStorage, pywin32-ctypes, pycparser), Apache-2.0 OR BSD-3-Clause (cryptography), MIT (cffi) |
| PyInstaller (build only) | freezing the engine sidecar | GPL-2.0 with the bootloader exception, which permits distributing the frozen program under its own licence |
| pytest 9.1.1 (with iniconfig, packaging, pluggy, pygments) and httpx 0.28.1 | runs `backend/tests` in CI (`backend/requirements-test.txt`); never installed in the app | MIT (pytest, iniconfig, pluggy), Apache-2.0 OR BSD-2-Clause (packaging), BSD-2-Clause (pygments), BSD-3-Clause (httpx) |
| Playwright 1.63.0 (Python) and its Chromium | runs the window smoke in `frontend/tests/window` in CI; never installed in the app | Apache-2.0 |
diff --git a/README.md b/README.md
index 324a103..0663c0e 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@
-
+
@@ -91,7 +91,7 @@ The window, the command line and the MCP server call the same 96 commands.
./formencoder encode clip.mov --preset system/youtube-1080p # queue, encode and print results
./formencoder queue # every output and its status
./formencoder probe clip.mov # media information
-./formencoder mcp # MCP server on stdio for Claude Code, Codex and Cursor
+./formencoder mcp # MCP server on stdio for Claude Code, Codex, Cursor and Antigravity
```
`.mcp.json`, `.codex/config.toml` and `.cursor/mcp.json` are already wired in this repo. See [`AGENTS.md`](AGENTS.md).
@@ -102,7 +102,7 @@ FormEncoder loads extensions made to the Form Extension Contract (API 1): FormPo
## Under the hood
-Version 0.8.4 · Apache-2.0 · Rust encoding engine, Python service, TypeScript interface, Tauri 2 shell
+Version 0.10.0 · Apache-2.0 · Rust encoding engine, Python service, TypeScript interface, Tauri 2 shell
- **Engine:** seven `fencoder` Rust crates in `native/`, loaded by the Python service as the `fe_core` extension.
- **FFmpeg:** a pinned LGPL build, run as a separate program and never linked.
@@ -145,7 +145,7 @@ cd formencoder
`./formencoder desktop dev` opens the desktop window instead (run `./formencoder install-desktop` first). On Windows use `formencoder.bat install`, then `formencoder.bat`.
-Ports: interface 5270, engine 8270 (`FORMENCODER_PORT`). `FORMENCODER_AGENTS=allow` skips the agent permission prompt.
+Ports: interface 5270, engine 8270 (`FORMENCODER_PORT`). `FORMENCODER_AGENTS=deny` refuses every change from every agent, the Terminal panel's included; no value of it skips the agent permission prompt, which only the person can answer in the formencoder window.
> [!IMPORTANT]
> **Status:** pre-release. AVC-Intra and vendor camera raw (R3D, ARRIRAW, X-OCN, Canon RAW, BRAW) are Partial, see [`docs/PARITY.md`](docs/PARITY.md).
diff --git a/SECURITY.md b/SECURITY.md
index d6e8ddc..cfa3100 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -30,6 +30,12 @@ something outside it could get in:
- **Agents and the terminal**: getting an agent's consequential action (deleting,
overwriting, publishing, typing into a terminal) to run without the person's
approval, or getting past the first-change consent.
+- **The window key**: every change through the engine, answering a consent or
+ approval prompt, and the window's terminal need a key that only the FormEncoder
+ window holds; outside agents come in through MCP or the command line and are
+ asked. In the desktop app the shell hands the key to its own window. Run from
+ source (`./formencoder boot`), the engine gives the key once to the first page
+ that asks, which is weaker by nature: open the page before anything else does.
- **Publish credentials** (FTP, S3, YouTube, Vimeo, Facebook and webhook secrets):
anything that leaks them.
- **Webhooks**: forging or replaying a signed export notification from formcut, or a
diff --git a/agents/manifest.json b/agents/manifest.json
new file mode 100644
index 0000000..4e8c656
--- /dev/null
+++ b/agents/manifest.json
@@ -0,0 +1,316 @@
+{
+ "format": "form-agent-manifest",
+ "version": 1,
+ "app": "formencoder",
+ "mcp": {
+ "tools": [
+ "status",
+ "list_commands",
+ "describe_command",
+ "execute",
+ "batch",
+ "probe",
+ "encode",
+ "queue",
+ "export_settings",
+ "preview_frame",
+ "contact_sheet",
+ "wait",
+ "verify",
+ "presets",
+ "formats",
+ "watch_folder",
+ "family",
+ "log",
+ "history",
+ "ui",
+ "guide",
+ "approval_status",
+ "terminal_list",
+ "terminal_open",
+ "terminal_send",
+ "terminal_read",
+ "extensions_list",
+ "extension_command",
+ "terminal_close",
+ "queue_list",
+ "queue_add_source",
+ "queue_add_folder",
+ "queue_add_output",
+ "queue_duplicate",
+ "queue_remove",
+ "queue_clear_done",
+ "queue_set_preset",
+ "queue_set_format",
+ "queue_set_settings",
+ "queue_get_settings",
+ "settings_apply",
+ "queue_set_output",
+ "queue_set_range",
+ "queue_interpret",
+ "queue_reorder",
+ "queue_skip",
+ "queue_reset_status",
+ "queue_start",
+ "queue_pause",
+ "queue_stop",
+ "queue_stop_current",
+ "queue_auto_encode_watch",
+ "queue_stitch",
+ "queue_select",
+ "queue_save",
+ "queue_open",
+ "encode_status",
+ "encode_report",
+ "encode_estimate",
+ "encode_command",
+ "encode_verify",
+ "preset_list",
+ "preset_get",
+ "preset_create",
+ "preset_update",
+ "preset_delete",
+ "preset_duplicate",
+ "preset_new_group",
+ "preset_alias",
+ "preset_import",
+ "preset_export",
+ "preset_reveal",
+ "ingest_copy",
+ "proxy_create",
+ "captions_transcribe",
+ "captions_models",
+ "analyze_media",
+ "watch_list",
+ "watch_add",
+ "watch_remove",
+ "watch_set_active",
+ "watch_chain",
+ "watch_add_output",
+ "watch_set_output",
+ "watch_remove_output",
+ "watch_scan",
+ "format_list",
+ "format_describe",
+ "format_encoders",
+ "media_roots",
+ "media_browse",
+ "media_probe",
+ "captions_read",
+ "captions_convert",
+ "metadata_templates",
+ "metadata_save_template",
+ "metadata_delete_template",
+ "lut_list",
+ "lut_install",
+ "log_read",
+ "log_clear",
+ "prefs_get",
+ "prefs_set",
+ "prefs_reset",
+ "prefs_cache_info",
+ "plugin_list",
+ "plugin_run",
+ "plugin_result",
+ "shortcuts_list",
+ "shortcuts_set",
+ "shortcuts_reset",
+ "tools_list",
+ "prefs_clean_cache",
+ "family_queue",
+ "family_resolved",
+ "publish_result",
+ "edit_undo",
+ "edit_redo",
+ "history_list",
+ "ui_panel",
+ "ui_workspace",
+ "ui_export_settings",
+ "ui_toast",
+ "app_capabilities",
+ "app_status"
+ ],
+ "read_only": [
+ "status",
+ "list_commands",
+ "describe_command",
+ "probe",
+ "preview_frame",
+ "contact_sheet",
+ "wait",
+ "verify",
+ "formats",
+ "log",
+ "guide",
+ "approval_status",
+ "terminal_list",
+ "terminal_read",
+ "extensions_list",
+ "queue_list",
+ "queue_get_settings",
+ "settings_apply",
+ "queue_select",
+ "queue_save",
+ "encode_status",
+ "encode_report",
+ "encode_estimate",
+ "encode_command",
+ "encode_verify",
+ "preset_list",
+ "preset_get",
+ "preset_reveal",
+ "captions_models",
+ "watch_list",
+ "format_list",
+ "format_describe",
+ "format_encoders",
+ "media_roots",
+ "media_browse",
+ "media_probe",
+ "captions_read",
+ "metadata_templates",
+ "lut_list",
+ "log_read",
+ "prefs_get",
+ "prefs_cache_info",
+ "plugin_list",
+ "plugin_result",
+ "shortcuts_list",
+ "tools_list",
+ "family_resolved",
+ "history_list",
+ "ui_panel",
+ "ui_workspace",
+ "ui_export_settings",
+ "ui_toast",
+ "app_capabilities",
+ "app_status"
+ ],
+ "approval_gated": [
+ "execute",
+ "batch",
+ "encode",
+ "queue",
+ "export_settings",
+ "presets",
+ "watch_folder",
+ "family",
+ "history",
+ "ui",
+ "terminal_open",
+ "terminal_send",
+ "extension_command",
+ "terminal_close",
+ "queue_add_source",
+ "queue_add_folder",
+ "queue_add_output",
+ "queue_duplicate",
+ "queue_remove",
+ "queue_clear_done",
+ "queue_set_preset",
+ "queue_set_format",
+ "queue_set_settings",
+ "queue_set_output",
+ "queue_set_range",
+ "queue_interpret",
+ "queue_reorder",
+ "queue_skip",
+ "queue_reset_status",
+ "queue_start",
+ "queue_pause",
+ "queue_stop",
+ "queue_stop_current",
+ "queue_auto_encode_watch",
+ "queue_stitch",
+ "queue_open",
+ "preset_create",
+ "preset_update",
+ "preset_delete",
+ "preset_duplicate",
+ "preset_new_group",
+ "preset_alias",
+ "preset_import",
+ "preset_export",
+ "ingest_copy",
+ "proxy_create",
+ "captions_transcribe",
+ "analyze_media",
+ "watch_add",
+ "watch_remove",
+ "watch_set_active",
+ "watch_chain",
+ "watch_add_output",
+ "watch_set_output",
+ "watch_remove_output",
+ "watch_scan",
+ "captions_convert",
+ "metadata_save_template",
+ "metadata_delete_template",
+ "lut_install",
+ "log_clear",
+ "prefs_set",
+ "prefs_reset",
+ "plugin_run",
+ "shortcuts_set",
+ "shortcuts_reset",
+ "prefs_clean_cache",
+ "family_queue",
+ "publish_result",
+ "edit_undo",
+ "edit_redo"
+ ],
+ "transports": [
+ "stdio",
+ "http"
+ ]
+ },
+ "skills": [
+ {
+ "name": "formencoder-harness",
+ "sub_skills": [
+ "captions-and-metadata",
+ "effects-and-loudness",
+ "export-settings",
+ "form-family-bridge",
+ "harness-director",
+ "publish",
+ "queue-and-presets",
+ "recipes",
+ "session-and-connection",
+ "ui-automation",
+ "verification",
+ "watch-folders-and-ingest"
+ ]
+ },
+ {
+ "name": "formencoder-skillset",
+ "sub_skills": [
+ "agent-substrate",
+ "desktop-and-release",
+ "engine-core",
+ "engine-service",
+ "interface",
+ "verification"
+ ]
+ }
+ ],
+ "dock": {
+ "present": true,
+ "positions": [
+ "left",
+ "right",
+ "bottom",
+ "floating"
+ ],
+ "tabs": [
+ "shell",
+ "claude",
+ "codex",
+ "cursor",
+ "antigravity"
+ ]
+ },
+ "extensions": {
+ "host_api": "1"
+ }
+}
diff --git a/backend/.env.example b/backend/.env.example
index 202e2d5..3c42103 100644
--- a/backend/.env.example
+++ b/backend/.env.example
@@ -5,3 +5,5 @@ FORMENCODER_CORS_ORIGINS=http://localhost:5270,http://127.0.0.1:5270,http://loca
FORMENCODER_DIST=
FORMENCODER_AGENTS=ask
FORMENCODER_FFMPEG_DIR=
+FORMENCODER_FFMPEG_AUTO=1
+FORMENCODER_FFMPEG_RELEASE=
diff --git a/backend/HASHOUT_LOG.md b/backend/HASHOUT_LOG.md
index 4e570a6..c42b716 100644
--- a/backend/HASHOUT_LOG.md
+++ b/backend/HASHOUT_LOG.md
@@ -202,3 +202,161 @@ Refers to `formencoder_engine.py` `serve` · kind: fix · logged: v0.8.4 · 2026
- `sock.listen()` now follows `bind`. A connection made before uvicorn is serving waits in the socket's backlog and is answered once it is, instead of being refused. uvicorn calls `listen` again on the socket it is given, which is harmless. The line, the port and the discovery record are unchanged.
- Checked: the mechanism on its own, outside the repo: a script that binds, announces, waits 0.6 s and then runs uvicorn on the socket, with a client that connects at the announcement. Without `listen` the client is refused at once; with it the request returns 200 after 0.64 s. Not run: a rebuilt desktop app with this change.
+## The window key: only the formencoder window changes things, answers prompts or drives its terminal (unreleased, after 0.8.4)
+
+Refers to `core/window_key.py`, `core/seal.py`, `main.py`, `routers/system.py`, `routers/live.py`, `routers/terminal.py`, `agent/consent.py`, `agent/approvals.py`, `engine/rpc.py` `dispatch`, `formencoder_engine.py` `serve` · kind: fix · logged: unreleased · 2026-11-19
+
+- The engine makes a key at start (`secrets.token_urlsafe(32)`, memory only, compared with `hmac.compare_digest`). `WindowKeyGuard`, added once in `main.py` inside CORS and `LocalOnly`, refuses every request whose method is not GET, HEAD or OPTIONS with 403 `Only the formencoder window can do this` unless it carries `x-formencoder-window-key`, or its path is on `window_key.OPEN`. The `LocalOnly` Host, Origin and `x-formencoder-local` checks stay as they were; the key is an added layer.
+- The open list and its callers: `/mcp` (outside agents and the stdio bridge, through consent), `/api/window/key` (the development bootstrap), `/api/rpc` (the command line, `app/agent/client.py`, used by `./formencoder ID ...`, `setup/fe.py` and the workspace shim; it already goes through `consent.gate` and `approvals.guard`, and a caller naming itself `ui` becomes `cli`), and `/api/family/hooks/formcut` (formcut's engine, which signs each request with the link secret instead).
+- How the window gets the key. Packaged: the shell starts the sidecar with `FORMENCODER_WINDOW_KEY_STDOUT=1`; `serve` then prints `formencoder-window-key: [key]`, flushed, before the `Uvicorn running on` line, and the shell hands it to the page as `window.__FORMENCODER_WINDOW_KEY` for the engine's own origin only. From source: with the variable unset, `POST /api/window/key` answers the key once per launch, then 409, and `/api/system` reports `secondWindowClaim`; with it set, the route answers 404. The from-source mode is weaker by nature: the first page (or program) to ask gets the key.
+- Sockets. A browser cannot set headers on a WebSocket, so the window asks `POST /api/window/ticket` (key required) for a one-time ticket that lives 30 seconds and opens `/api/live?kind=ui&ticket=...` and `/api/terminal/ws?...&ticket=...` with it. A live socket without a valid ticket joins the bus as an observer: it gets the hello and broadcasts, is not counted by `bus.windows()` (so it receives no consent or approval prompt and does not make consent think a window is open), and every request it sends is answered with the refusal; `reply` is ignored. The terminal socket without a valid ticket is closed with 4403 before it opens. `GET /api/terminal/sessions/{id}/output` also needs the key, because a shell's output can hold anything.
+- `agents.approvals` (pending approval ids) is now refused to every source but `ui`, like `agents.decide` and `agents.fullFaith`; only the window called it.
+- The in-app agent token. `consent.TOKEN` was one token for the whole run, put into every terminal's environment. Now `consent.issue()` makes one per terminal the window opens (the panel's socket or `POST /api/terminal/sessions`, both key-holding), it goes only into that shell's environment (never on a command line), is replaced when the shell restarts and revoked when the terminal closes. A terminal an agent opens with `terminal_open` gets none, and an inherited `FORMENCODER_AGENT_TOKEN` is removed from every shell's environment. The panel's shell is where the person starts Claude Code, Codex and Cursor with the buttons, so that shell keeps the token by design. The agents a terminal can launch are fixed in `AGENTS`; no setting names the program.
+- The stored agent choices are sealed: the Allow Always list (`agents.json`) and full faith (`approvals.json`). `core/seal.py` keeps a random 32-byte key in the system keychain (`keyring`, service `FormEncoder`, account `settings-seal`, made on first use; imported lazily inside a try so a missing package or backend only makes the seal unavailable) and writes `seal`, an HMAC-SHA256 over the file's label and values. Only the window writes these files (a consent reply on the window's socket, full faith from the window). On read: seal right, values stand; seal missing or wrong while a value is loosened (a client allowed, full faith on), the engine acts as if nothing were allowed and full faith were off, and `/api/agents/status` and `/api/agents/consent` report `sealBroken: true`; no keychain, values stand and `seal` reads `unavailable`. The first launch after this change reads an earlier Allow Always list or full faith as unsealed and asks again. The `FORMENCODER_AGENTS` policy is an environment variable, not a stored file, and is not sealed.
+- `keyring==25.7.0` is in `requirements.txt` and `requirements_macos.txt`, `setup/freeze_backend(.bat)` collect its submodules, and `NOTICE.md` has rows for it and its dependencies.
+- Checked by running, before the tests were written: a sweep of `app.openapi()` write operations with no key went from 15 answered of 15 to 4 answered of 17 (exactly the open list; the two new routes are the bootstrap and the ticket). The sidecar entry with the variable set printed the key line first and the address second and answered the bootstrap with 404. From source: the bootstrap answered 200 then 409; the window socket with a ticket answered `ui.state` and `agents.approvals`; the same ticket again, and a socket without one, were refused for `agents.fullFaith`, `agents.decide` and `command.execute` and counted as 0 windows; the terminal socket was refused without a ticket and opened with one, its shell holding a token. MCP and the command line gave the same answers as before under `ask` (no window: refused; window allows: runs), `allow` and `deny`. The seal with an in-memory keyring backend: window writes read `ok`, a client added by hand and full faith set by hand read `broken` and are ignored, a keychain that raises reads `unavailable` and the values stand. The page against the Vite dev server in headless Chrome: see `frontend/HASHOUT_LOG.md`. Then `tests/test_window_key.py` and `tests/test_seal.py`; `conftest.py`'s `client` now sends the key, a new `bare` client does not, and `inapp_token()` issues a token.
+
+## Window-only preferences (unreleased, after 0.8.4)
+
+Refers to `engine/rpc.py` `window_only`, `WINDOW_PREFS`, `WINDOW_SOURCES`, `execute`, `batch` · kind: fix · logged: unreleased · 2026-11-19
+
+- `prefs.set` is not destructive in the registry and no approval reason covered it, so an agent past consent could change any preference. Four of them decide which program runs or whether a file is replaced or removed: `ffmpegDir` (the first place the FFmpeg locator looks), `incrementNames` (off, an output whose file exists is written over, since FFmpeg always gets `-y`), `rawDecoders` (each entry's `command` is run on camera raw sources) and `cacheFolder` (cache trimming removes the oldest files in that folder once it is over `cacheLimitGB`).
+- `rpc.execute` and `rpc.batch` are the one funnel for every caller that names a source (the live socket, `/api/rpc`, MCP tools, the formcut hook, desktop open). A `prefs.set` that touches any of the four from a source other than `ui` (the window's socket), `engine` (the engine's own refresh of `ffmpegDir` after the FFmpeg download) or `desktop` (files opened with the app) is refused with -32003 and a one-line reason, before the engine is called; other preferences in the same call are not written either. The window's Preferences dialog is unchanged. `/api/rpc` already turns a caller naming itself `ui` into `cli`.
+- Left alone: `logFolder` (logs append), `outputFolder` (outputs are still renamed while `incrementNames` is on), `openh264` (picks a library that is only installed after its pinned check), and the `overwrite` flag of `captions.transcribe`, which is a command parameter, not a preference.
+- Checked by running, before the test: with `FORMENCODER_AGENTS=allow`, MCP `execute` of `prefs.set` with each of the four was refused, `chime` was set; an MCP `batch` and the command line (`setup/fe.py exec prefs.set ...`) were refused for `incrementNames`, the command line set `chime`; the window's socket set `incrementNames` and `ffmpegDir`. Then `tests/test_window_prefs.py`.
+
+## FFmpeg comes from formai-binaries, with formcut-binaries as the fallback (unreleased, after 0.8.4)
+
+Refers to `ffmpeg_fetch.py` `SOURCES`, `sources`, `fetch`; `setup/bundle_ffmpeg.py` `main` · kind: fix · logged: unreleased · 2026-11-19
+
+- The binaries repository is being renamed from `nodemode-dev/formcut-binaries` to `nodemode-dev/formai-binaries`; until then the new address answers 404, after it the old one redirects. `SOURCES` holds both, new first. `sources(data, triple)` returns the archive URL under each, or only the one under `FORMENCODER_FFMPEG_RELEASE` when that is set (a release folder URL; previously undocumented, now in `.docs/BRANCHING.md`, `src-tauri/ffmpeg/README.md` and `backend/.env.example`). The tag, the asset names, the install folder and the variable names are unchanged.
+- `fetch` tries each address in order; a download error, an archive that does not open, a missing file or a file whose SHA-256 differs from the record moves on to the next address, and `install` copies nothing until every file has matched. When none works, `fetch` raises one error naming every address and why; its result's `source` names the address that answered. `bundle_ffmpeg.py` loops the same way and empties the stage after a refused archive; it still exits 0 with a notice when no address could be fetched (the app downloads on first run), and stops the build when an address answered with files that do not match.
+- Checked by running, before the tests: against a local server, wrong bytes from the first address and a 404 from it both installed the matching archive from the second; wrong bytes from both installed nothing; with the override set only it was asked, also when it answered 404. `bundle_ffmpeg.main` against the same server staged from the second address, stopped on two mismatches and exited 0 on two 404s. On the real network the new address answers 404 and the old one 302, and a real `fetch` into a scratch HOME installed the 12 recorded files from formcut-binaries. Then `tests/test_ffmpeg_fetch.py`. `src-tauri/binaries/ffmpeg-licence.json` names no address and is unchanged; the history lines above that name formcut-binaries stay as written.
+- Re-run on 2026-11-19 against a loopback server for the one case not run before: with both addresses answering 404, with both answering wrong bytes, and with the first wrong bytes and the second 404, `fetch` raised one `ValueError` that names both addresses and the reason for each, and nothing was installed. `test_nothing_is_installed_when_no_address_matches` now asserts both addresses are in the error.
+
+## The shell gives the engine as long to start as before; 10 seconds cover only the key (unreleased, after 0.8.4)
+
+Refers to `src-tauri/src/main.rs` `setup` (the loop that reads the engine's first lines) · kind: fix · logged: unreleased · 2026-11-19
+
+- On `origin/main` the loop waited for the address line with no limit, and it still does: a first launch of a packaged engine can take longer than 10 seconds (cold disk, a scan, unpacking) and must not end in "engine failed to start" on a healthy app. The 10 seconds start only when the address line has arrived (`Instant::now() + 10 s` taken after the first loop breaks on a port), and cover only a key that was not already read. The engine prints the key line before the address line, flushed, so the key is normally in hand by then; the wait is for a line read out of order or an engine too old to print a key. When it runs out with no key, `port` is cleared and the existing "engine failed to start" dialog and exit are taken, so no window opens. An engine that ends before printing its address leaves the first loop on `Terminated` or a closed channel and takes that path at once, as before.
+- Same shape as the FormPath shell: a second loop with `try_recv` and a 20 ms `spawn_blocking` sleep, which needs no crate beyond the ones the shell already has (tauri 2 `async_runtime`, the shell plugin's receiver, `std`).
+- Checked: the engine from source with `FORMENCODER_WINDOW_KEY_STDOUT=1` printed the key line first and the `Uvicorn running on` line second, each flushed. The shell cannot be compiled here (no system WebKit); `rustfmt --check` parses the file and reports only the differences that were there before. The two loops were copied unchanged into a scratch crate outside the repo (tokio 1.53.2 as in `Cargo.lock`, `regex`) and run against fake event streams: key and address together opened the window at once; the address and then nothing for 11 seconds gave no window after 10.0 seconds; nothing for 25 seconds and then key and address opened the window after 25.0 seconds (the case the old app also allowed); the address and the key 3 seconds later opened the window; an exit before the address gave no window at once; an address with no key at all gave no window after 10.0 seconds. Not run: the packaged app.
+
+## agents/manifest.json says what the app offers agents (unreleased, after 0.8.4)
+
+Refers to `setup/agents.py` `manifest_text`, `sync`; `agents/manifest.json`; `backend/tests/test_agents_manifest.py` · kind: feat · logged: unreleased · 2026-11-18
+
+- The family spec (formadaptor, `spec/agent-manifest.schema.json`) reads this file at each released tag, so the gateway, the skills installer and the site stop carrying hand-typed tool counts. `./formencoder agents sync` writes it with the generated references and `--check` names `agents/manifest.json` when the committed file is not what would be written. `app` is `formencoder`, the file name of the app's entry in formcompiler `apps/`.
+- Every field but the dock is read from the source. `mcp.tools` is `TOOLS` followed by one tool per registry command, built by `tools._command_tool` and skipping a name a curated tool already has, the same rule as `tools.command_tools()` (the full profile, which is what `tools/list` returns with no profile). `read_only` is the `readOnlyHint` each listed tool carries. `approval_gated` follows the consent gate (`routers/mcp.py`: `mutating = not tools.read_only(name)`): the curated tools not in `READ_ONLY` and the commands whose `query` flag is false, so it is every tool that is not read-only; `consent.gate` asks about each of them when the policy is ask and the client was not allowed. The per-call asks of `approvals.guard` (uploads, deletes, overwrites) come on top of that and are not a property of a tool, so they are not listed. `transports` is `stdio` (`setup/mcp_stdio.py`, `./formencoder mcp`) and `http` (`POST /mcp`). `skills` are the folders of `.claude/skills` with a `SKILL.md`, each with the sub-skill folders that hold a `SUB-SKILL.md`, sorted. `extensions.host_api` is `formext_host.API`.
+- `DOCK` in `setup/agents.py` is the one declared value. It is read by hand from `frontend/src/ui/dock.ts` and `frontend/src/app/app.ts`: the family's dock here is the panel dock, where the Terminal and Agents panels (`terminal`, `agents`) sit in tab groups and can be placed in the left, right or bottom area or torn out to a floating group (the Agent workspace puts both on the right; `Dock.home` defaults them to the bottom). The area `center` exists but is not a position the schema knows. Update the value when the dock changes; nothing checks it.
+- Checked by running, before the test: sync wrote 125 tools, 54 read-only (15 curated and 39 query commands), 71 approval-gated, 2 skills and 18 sub-skills; `scripts/manifest.py check agents/manifest.json --app formencoder` in formadaptor accepted it; `--check` exited 0; the engine from source on port 28900 answered `tools/list` with the same 125 names in the same order and the same read-only set. In a copy outside the tree, renaming one tool in the manifest and, separately, dropping `read=True` from `status` in the copy of `tools.py` each made `--check` exit 1 and name `agents/manifest.json`. `docs/PARITY.md` still said 21 curated and 123 tools; it now says 29 and 125 (the older HASHOUT entries keep the counts of their day).
+- Each `Engine()` in the sync creates a data folder under the system temp (existing behaviour of the script); the manifest adds one more per run.
+
+## FORMENCODER_AGENTS can block outside agents but can no longer switch the question off (unreleased, after 0.8.4)
+
+Refers to `core/config.py` `agents_policy`; `agent/consent.py` `gate`; `.github/workflows/ci.yml`; `backend/tests/test_f2_consent.py`, `test_window_prefs.py`, `conftest.py` · kind: fix · logged: unreleased · 2026-11-19
+
+- Why: the stored choice for outside agents (the sealed Allow Always list) can only be turned on by the person in the window, but the environment value `allow` made `gate` return before it looked at that list or asked anyone, so whatever started the engine could do what only the window may do. formvfx closed the same variable on its branch (commit a1cc9ea); this is the same rule.
+- Now: `agents_policy()` returns `deny` only for the value `deny` (any case, spaces trimmed) and `ask` for everything else, `allow` and an empty or unknown value included. `gate` no longer has an allow branch. `deny` still refuses every outside agent before the stored list is read; read-only tools and the in-app token are unchanged; the no-window message no longer suggests the variable. `/api/system` `agentsPolicy` and `/api/agents/consent` `policy` can now only say `ask` or `deny`.
+- The earlier entries here that describe `allow` as a policy (consent bullet near the top, the guard differences note, the sealed choices note and the window-only preferences check) describe the engine before this change.
+- People who start the engine without a window (scripts, CI) can no longer skip the question. They call read-only tools, start the agent from the Terminal panel, or answer the question as a window does: from a source run, `POST /api/window/key`, `POST /api/window/ticket` with that key, open `/api/live?ticket=...` and reply `{method: reply, params: {requestId, value: {allow: true}}}` to the `consent` message. The CI smoke step does exactly this and also asserts that the window was asked.
+- Tests: the old test that pinned `allow` letting a change through is replaced by cases that `allow` (and `ALLOW`, `1`, empty, unknown) still ask, `deny` in any spelling refuses even an agent on the stored list, `allow` neither overrides a window decline nor a stored allow, and the policy function says only `ask` or `deny`. The `allowed` fixture of `test_window_prefs.py` now puts the agent sources on the session list instead of using the variable; `set_policy` in `conftest.py` lost its `allowed` mode.
+- Checked by running, before the test: engine from source on a fresh data folder, `/mcp` `tools/call` of `history {action: list}` as an outside agent: with `allow` it ran with no question, with the variable unset it was refused for no window; after the change `allow`, unset and `garbage` are refused for no window and `deny` is refused as turned off; `status` (read-only) ran in every case. The CI sequence ran against an engine from source on a spare port: the stand-in window got the `consent` message for `mcp:ci`, the encode finished verified.
+
+## The permission question carries what a shared dialog needs, can be answered once, and is withdrawn when it ends (unreleased, after 0.8.4)
+
+Refers to `agent/consent.py` `gate`, `agent_name`, `state`, `ANSWERS`, `ALWAYS_SCOPE`, `ASK_SECONDS`, `BLOCKED`; `engine/bus.py` `ask_window`; `routers/mcp.py`, `routers/rpc.py` (the `what` argument); `backend/tests/test_f2_consent.py` · kind: feat · logged: unreleased · 2026-11-19
+
+- Why: the family is moving to one dock module with one dialog for outside agents, and it talks to each engine through a contract (a request id, who asks, what for, which answers exist, what Always covers, when the request ends, and a signal when it is gone). This engine's question had the client, the tool name and a request number only. Everything here is added beside what the present window reads, so that window behaves as before.
+- The `consent` event keeps `client`, `detail` and `requestId` and gains: `id` (the request number as text), `agent` (the announced name without its `mcp:` prefix, or `agent`), `what` (plain words: `use the history tool`, `run the command queue.clear`, `run queue.clear` for the command line, `make changes` when nothing is known), `answers` (`deny`, `once`, `session`, `always`: all four this engine honours), `alwaysScope` (`agent`: Allow Always stores that one client name, as before), `expiresIn` (seconds) and `expiresAt` (epoch seconds). `id`, `expiresIn` and `expiresAt` are put on by `ask_window`, so the extension questions carry the two times as well; a question that already has an `id` of its own (the extension run) keeps it.
+- Allow once: the answer `{allow: true, remember: "once"}` (or FormVis's shape `{allow: true, once: true}`) lets this one call run and stores nothing, so the next call asks again. `none` and a missing `allow` still decline for ten minutes, `session` and `always` mean what they meant; an allow with any other `remember` is still a session allow, which is what the present window's Allow button sends.
+- Withdrawal: when a question ends, every window gets `{type: "withdrawn", requestId, id, of, reason}` with `of` the question's type (`consent`, `extensions`) and `reason` `answered`, `expired` or `cancelled`. The present page ignores event types it does not know (`engine/client.ts` `KNOWN`), checked in the source.
+- `ASK_SECONDS` (180) is the time limit as a module value so a run can shorten it; `/api/agents/consent` and the `consent` block of `/api/agents/status` also report `answers`, `alwaysScope`, `askSeconds` and `blockedStopsTabs`.
+- Blocked now stops every agent. `FORMENCODER_AGENTS=deny` used to refuse outside agents and let a call with a terminal's token through; the family rule (DOCK_SPEC_2, A3) is that Blocked stops the app's own agent tabs too, so `gate` checks the policy before the token. Reads are never refused, for a token as for anyone. The refusal sentence no longer advises the Terminal panel. This is the one change the present window can show, and only when the engine was started with `deny`. The older entries here that say terminal agents keep working under `deny` describe the engine before this.
+- `detail` is left exactly as it was (the tool name from `/mcp`, empty from `/api/rpc`) because the present dialog prints it.
+- Checked by running, before the tests: engine from source on 34201 with a fresh data folder and a stand-in keyring, two stand-in windows on `/api/live`, an outside agent on `/mcp`. Both windows got the same question with the new fields; Don't Allow refused and both windows got `withdrawn` `answered`; `once` in both shapes ran the call and the next call asked again; `session` and `always` did not ask again and `always` was written sealed; with the limit shortened to 4 s the agent was refused after 4.0 s, both windows got `withdrawn` `expired` and a late Allow Always stored nothing. With `deny`: an outside agent, a call with an agent tab's token, one with the panel shell's token and the command line with a token were all refused for changes and allowed to read, and no window was asked.
+- Tests: `test_f2_consent.py` gained the once cases and the question's fields; `test_inapp_token_skips_a_blocked_policy` pinned the old rule and is replaced by `test_blocked_policy_stops_an_inapp_token_too_and_still_lets_it_read`. The bus cases are in `test_dock_engine.py` with the next entry.
+
+## Agent programs as tabs of their own, one status call, and a socket mode that keeps control apart from output (unreleased, after 0.8.4)
+
+Refers to `routers/terminal.py` `PROGRAMS`, `_version`, `_program`, `agent_programs`, `Session.__init__`, `Term` (`kind`, `window`, `argv`, `_ended`, `restart`, `close`, `row`), `Hub.tabs`, `Hub.listed`, `Hub.changed`, `tabs`, `open_tab`, `terminal` (the `typed` mode); `agent/tools.py` `_terminal`; `backend/tests/test_dock_engine.py` · kind: feat · logged: unreleased · 2026-11-19
+
+- Why: the shared dock opens Claude Code, Codex and Cursor as tabs the engine starts, each with a token of its own, asks one call for what is installed, and needs to tell an exit from output. Today the panel has one private shell and types a program's name into it. Nothing the present panel uses is changed: the socket without `typed`, `launch`, `/status`, `/sessions` and the token in the panel shell are as they were.
+- `GET /api/terminal/agents` (window key): `{agents: {claude, codex, cursor}}`, each `{installed, path, version, signedIn, install, title, program}`. Found with `shutil.which` on the engine's PATH, as `/status` does. `version` is the first line ` --version` prints (5 s limit, kept 60 s per path, run without the engine's `FORMENCODER_*` variables); `signedIn` is always `null`, because nothing here can tell without running the program in a way that could reach a model; `install` is a command line. The engine never calls this itself.
+- `POST /api/terminal/tabs {kind, cols, rows, cwd, title, prompt, resume}` opens a window tab. `kind` is `shell` (default), `claude`, `codex` or `cursor`. An agent kind runs the found program as the tab's own process (not typed into a shell) in the agent workspace, with a token of its own in the child's environment as `FORMENCODER_AGENT_TOKEN`; the command line holds the program's path, `--resume ` (claude only) and the prompt as one argument (after `--` when it starts with a dash), never the token. The token dies when the program exits, when the tab is restarted (the new process gets a new one) and when the tab is closed. A `shell` tab opened here carries no token, which is the family rule; the present panel's own shell keeps its token (left for the port, see the report). Refusals carry a code in `detail`: 404 `not_installed` (with `install`), 422 `unknown_kind`, `bad_prompt`, `bad_resume`, 500 `failed`.
+- `GET /api/terminal/tabs` (window key) lists window tabs oldest first. A window tab is closed, restarted, renamed and typed into through the existing `/sessions/{id}` routes and attached with `/ws?session=`. Restart runs the agent again.
+- Window tabs are the window's: they are not in `/sessions`, not in the `terminals` event and not reachable by the `terminal_*` tools (`Hub.listed` answers as for an id that does not exist). Every row gained `kind` (`shell`, `claude`, `codex`, `cursor`, or `agent` for a terminal an outside agent opened) and `alive`. A second event, `terminalTabs {tabs}`, goes to windows beside `terminals`.
+- The socket's `typed=1` mode: output stays text frames; control is JSON in binary frames, `hello {id, kind, alive}` first on every attach, then the replay, then `exit`, `restart`, `closed` (the engine then closes the socket) and `gone {id}` with close code 4404 for a tab that does not exist (without `typed` such an attach still opens a private shell, as before). The window sends `{type: input, data}` and `{type: resize, cols, rows}` as JSON text; anything else is ignored. Without `typed` every frame is what it was, the `{"exit": true}` text included.
+- `Session` leaves the forked child with status 127 when the program cannot be started, instead of letting it run on as a copy of the engine.
+- Codex and Cursor reach this engine's MCP server through the workspace's `.codex/config.toml` and `.cursor/mcp.json`, which run `formencoder mcp` (the stdio bridge), and the bridge reads the token from its environment. Whether Codex and Cursor pass `FORMENCODER_AGENT_TOKEN` on to an MCP server they start could not be checked here (neither program is on this machine); if one does not, its bridge has no token and the person is asked, which is the safe side. The config entry that names the variable for the client to forward is left for the port, to be tried with the real programs.
+- Checked by running, before the tests: engine from source on 34201 with stand-in `claude`, `codex` and `cursor-agent` scripts first on its PATH. Status gave the three with their version lines; each kind opened a tab whose process had the token in `/proc//environ` while `ps -eo args` did not show it; the three tokens differed; each let a change through with no window open and was refused after exit, after restart (old one) and after close; the prompt and resume id arrived as arguments; an outside agent's `terminal_list` and `terminal_read` did not see the tabs; the typed socket gave `hello`, text, `exit`, `restart` on the same stream, `closed`, and `gone`. With PATH `/usr/bin:/bin`: all three not installed with install lines, opening each 404 `not_installed`. The present page's calls replayed: the panel socket (raw text in, text out, NUL resize, `launch`, `{"exit": true}`), `/status`, `/sessions`, the old `POST /sessions` with `launch`, restart on an attached old stream, `/api/agents/status`, `/api/agents/forget`, and the three consent answers the page sends. Write routes without the key: 17 operations, 4 open by name, 13 refused before; 18, 4 and 14 after, none answered.
+- Tests: `backend/tests/test_dock_engine.py`, written after the runs above.
+
+## What the window's shared dock needed from the engine (unreleased, after 0.9.0)
+
+- A window that connects is sent the permission questions still waiting (`Bus.waiting()`, sent in `routers/live.py` after `hello`, type `consent` only), so a reload does not lose a question. Questions asked of one window (`first=True`, the extension run) are not kept for this.
+- `consent.gate_for(request, ...)` wraps `gate` for `/mcp` and `/api/rpc`: it looks once a second whether the caller is still connected and cancels the question when it is not, so `ask_window` ends with `withdrawn`, reason `cancelled`, and the dialog closes unanswered. Before, a caller that hung up left its question up for the full 180 seconds.
+- The agent workspace's `.mcp.json`, `.codex/config.toml`, `.cursor/mcp.json` and `.claude/settings.json` name the MCP entry `formencoder_tab` (`workspace.TAB_ENTRY`); the entry `agents install` writes for outside use stays `formencoder` (`connect.NAME`). The two can no longer be mistaken for each other in a client's list.
+- A closed tab's token: after a Claude Code tab is closed, a call with its token is treated as an unknown outside agent's and the person is asked (seen: the dialog named the caller; refused when denied). It never runs unasked.
+- Left in place and no longer used by the window: the socket without `session` that opens a private shell with a token, and `POST /api/terminal/sessions` with `launch`. The window's shells are `kind: shell` tabs with no token.
+- `setup/agents.py`: `dock_problems()` checks `frontend/src/dock` against its `MANIFEST.json` and for imports that leave the folder; `sync` and `sync --check` fail on it. The manifest's `dock.tabs` is `shell, claude, codex, cursor`; positions are the panel framework's four.
+- Checked by running against an engine from source: Allow once ran the call and the next call asked again; Always allow stored that one name and nothing else; Deny refused; two waiting, the first answered, the second still shown and pending; a caller cut off, its dialog gone after 1.0 s; a reload with a question waiting showed it again; with `FORMENCODER_AGENTS=deny` an outside call and a live Claude Code tab's token were both refused for a change while a shell tab and a Claude Code tab still opened and reads worked. Write routes without the window key: 18 operations, 14 refused, 4 open by name, as before; no route was added.
+- Tests: `backend/tests/test_dock_module.py`, written after the runs above.
+
+## The agent programs are found by the family's finder, and the status reports four (unreleased, after 0.9.0)
+
+Refers to `services/agent_lookup.py` (the family's file, version 1.0.1, never edited here), `services/agent_programs.py` (new), `routers/terminal.py` `AGENTS`, `PROGRAMS`, `TABS`, `_program`, `_typed`, `_environment`, `status`, `open_tab`, `Term.program`, `Hub.open`; `agent/connect.py` `install_claude`, `clients`; `setup/agents.py` `LOOKUP`, `LOOKUP_HASHES`, `lookup_problems`, `sync` · kind: feat · logged: unreleased · 2026-11-19
+
+- Why: the engine looked for `claude`, `codex` and `cursor-agent` with `shutil.which` on its own PATH. An app started from the Dock, the Start menu or a desktop launcher has a short PATH, so a program the person has in `~/.local/bin`, under nvm or only on their shell's PATH was reported as not installed.
+- `agent_programs.located(kind, fresh)` is the one lookup: `agent_lookup.find` (the override variable `FORMENCODER_CLAUDE_BIN`, `FORMENCODER_CODEX_BIN`, `FORMENCODER_CURSOR_BIN` or `FORMENCODER_ANTIGRAVITY_BIN`, the engine's PATH, the known install folders, then the person's shell PATH read once) and `agent_lookup.check` (`--version` in the child environment, without the engine's `FORMENCODER_*` variables as before). The app has no path setting, so `setting` is `None`. `usable` asks once more, fresh, when the first answer is not `runs`.
+- Removed from `routers/terminal.py`: `_version`, `_VERSIONS`, `VERSION_KEEP` and the two `shutil.which` calls; from `agent/connect.py` the bare `shutil.which("claude")` and the three `subprocess.run` calls, which now go through `agent_lookup.run` with the finder's child environment. `PROGRAMS` and `AGENTS` keep their names and are built from `agent_programs.PROGRAMS`; the install lines are the finder's.
+- `GET /api/terminal/agents` answers `claude`, `codex`, `cursor` and `antigravity`. Each keeps `installed`, `path`, `version`, `signedIn`, `install`, `title`, `program` and gains `finding` (`runs`, `broken`, `missing`), `how`, `looked`, `error` and `said`. `installed` is true only when `--version` ran. `version` is now the first word with a digit in what the program printed (`9.9.9`), where it was the whole first line. `/api/terminal/status` and `connect.clients()` list four.
+- An agent tab is started as `agent_lookup.start_argv([path, ...])`: through the person's login shell with `exec` on macOS and Linux, directly on Windows with the command interpreter in front of a `.cmd` or `.bat`. Its environment is `agent_lookup.child_env(path, base=, front=[workspace bin])`, so the program's own folder is first on PATH (a `#!/usr/bin/env node` script finds the node beside it) and `CLAUDE*` variables of the engine's parent are left out. A program that is found but does not start is refused with the finder's sentence, code `not_installed` as before, so the panel shows it.
+- `TABS` is `claude`, `codex`, `cursor`: the tab route does not take `antigravity` in this change.
+- The old socket's `launch` and `POST /sessions {launch}` type the found path (quoted) into the shell, or the bare name when nothing is found.
+- `setup/agents.py`: `lookup_problems()` hashes the finder and compares with `LOOKUP_HASHES` for the version the file states; `sync` and `sync --check` exit 1 naming the file when it was edited in place or is missing.
+- Tests changed, and why: `test_dock_engine.py` expected three programs, the whole version line and a bare argv; it now expects four, `9.9.9` and the argv `start_argv` gives. Added after seeing them pass against stand-ins: a broken program, a program found in a known folder and one found through the shell's PATH; three hash cases in `test_dock_module.py`.
+- Not run: Windows, macOS, a frozen engine, a real Claude Code, Codex, Cursor or Antigravity.
+
+## No test can start a real agent program (unreleased, after 0.9.0)
+
+Refers to `backend/tests/conftest.py` `AGENT_STAND_INS`, `AGENT_CALLS`, `AGENT_SHELL`, `only_stand_in_agent_programs`, `pytest_sessionfinish`, `pytest_terminal_summary` · kind: test · logged: unreleased · 2026-11-19
+
+- Why: the finder reads the person's shell PATH and the known install folders, so a test run on a machine with a real `claude` could have found and started it.
+- Before any test imports the app, the run gets stand-ins named `claude`, `codex`, `cursor-agent`, `agent` and `agy` first on PATH (they answer `--version`, log every start and otherwise exit 1), a stand-in login shell as `SHELL` that never reads the machine's profile, the made-up home it already had, and no `NPM_CONFIG_PREFIX`, `npm_config_prefix`, `PNPM_HOME`, `VOLTA_HOME`, `BUN_INSTALL` or `NVM_SYMLINK`. The autouse fixture replaces `agent_lookup.system_folders` with an empty list and drops the finder's kept answers before and after each test.
+- The run ends with one line saying how many times a stand-in was started and with what arguments.
+- Not on Windows: the stand-ins are shell scripts, and the tests that start programs are skipped there.
+
+## An Antigravity tab, and Antigravity as the fourth target of agents install (unreleased, after 0.9.0)
+
+Refers to `routers/terminal.py` `TABS`, `_tab_entry`, `Term._start`, `Term._ended`, `Term.close`, `Term._forget`, `open_tab`; `services/agent_programs.py` `TAB_ENTRY`, `TOKEN_VAR`, `write_tab_entry`, `remove_tab_entry`; `agent/workspace.py` `CLIENT_PROFILES`; `agent/connect.py` `install_antigravity`, `CLIENTS`; `setup/agents.py` `DOCK` · kind: feat · logged: unreleased · 2026-11-19
+
+- `POST /api/terminal/tabs {kind: antigravity}` starts `agy` as the other agent kinds are started: found by the finder, through its start path, with the tab's own token in the environment.
+- Antigravity reads its MCP servers from a file. Decision: every agent tab of formencoder already runs in the agent workspace (`[data folder]/agent-workspace`), where Claude Code, Codex and Cursor have their files, so the Antigravity tab runs there too and its entry goes to `.agents/mcp_config.json` in that folder. A `cwd` in the request is ignored for this kind, so the token is never written into a folder of the person's.
+- The entry is `formencoder_tab`: `{command: , args: ["mcp", "--profile", "core"], env: {FORMENCODER_URL, FORMENCODER_AGENT_TOKEN, FORMENCODER_AGENT_NAME}}`, the stdio bridge the Cursor tab uses, with the tab's token in `env` because nothing read says Antigravity hands its own environment to a server it starts. The profile is `core`, as for Cursor: nothing read says how many tools Antigravity lists. Every other entry and key in the file is kept; the file is written whole through a part file with mode 0600.
+- The entry is taken out when the program ends and when the tab closes, only while it still carries that tab's token; the token is revoked as for the other kinds. A restart writes the new token.
+- Known limit: two Antigravity tabs share the one entry. The second replaces it, and closing the second removes it while the first is still open; the first program has read the file at its start. Not tried beyond seeing the entry go.
+- `agents install antigravity` (and the default set, and the Agents panel's button) writes `mcpServers.formencoder = {command, args: ["mcp", "--profile", "core"]}` into `~/.gemini/config/mcp_config.json`: backup, part file, replace. A second run changes nothing; a `formencoder` entry that formencoder did not write is left alone and reported; a file that is not an MCP servers file is left alone; when only `~/.gemini/antigravity-cli/mcp_config.json` exists the documented path is written and the result says the older file was seen. No skill is copied for Antigravity.
+- Checked by running an engine from source on 4741 with its own home, data folder, a stand-in login shell and stand-in `claude`, `codex`, `cursor-agent` and `agy` first on PATH: the status listed four as `runs` with their versions; the Antigravity tab showed the stand-in's banner with the token present and the entry in the file; the file, seeded with another server and a top-level key, held both beside `formencoder_tab` at mode 0600; a call with the live token ran unasked; after close the file was byte for byte the seed and a call with the dead token was treated as an outside agent's; without `agy` the status and the tab route gave the finder's sentence. The install route: dry run wrote nothing, first run wrote the file, second run said already, a foreign entry was left with the same hash.
+- Tests, written after that: `test_dock_engine.py` (the Antigravity case of the tab test, the entry in the file, the install cases), `test_dock_module.py` (the manifest lists five tabs). `agents/manifest.json` was rewritten by `./formencoder agents sync`.
+- Not run: a real `agy` (whether it reads `.agents/mcp_config.json` in the workspace, wants the workspace trusted first, or passes `env` to the bridge), Windows, macOS.
+
+## The engine starts when it has no output streams (unreleased, after 0.9.0)
+
+Refers to `backend/formencoder_engine.py` (the first lines) · kind: fix · logged: unreleased · 2026-11-19
+
+- Why: an engine built for Windows without a console is started with `sys.stdout` and `sys.stderr` set to `None`, and the first `print` ends it. A tester saw this in another app of the family; this entry script printed its address the same way.
+- Before any other import, a stream that is `None` is replaced with one opened on the null device (`stdin` for reading, `stdout` and `stderr` for writing). Streams that exist are not touched.
+- Checked on Linux: started with `>&- 2>&-` on port 4743 the engine gave no answer on its health route before this change and answered `{"status":"ok",...}` after it; started normally it still printed `Uvicorn running on http://127.0.0.1:4741`.
+- Not run: Windows, a frozen engine.
+
+## A function call refuses a setting it was sent even when the engine has already corrected it (unreleased, after 0.10.0)
+
+Refers to `backend/app/functions/session.py` (`Session.run`, `Session.sent`), `backend/app/functions/guard.py` (`before`) · kind: fix · logged: unreleased · 2026-11-19
+
+- Why: three cases of `test_the_engine_side_guard_refuses_metacharacters_and_inner_paths` failed in the pull request's test job. They queue an output with a pixel aspect value that is not a ratio and expect `guard.before` to refuse it. Since 0.8.2 (584fe9b, 11 November) `settings::normalize` replaces such a value with `1:1`, so the queued output never held it, and `guard.before`, which read only the engine's merged settings, had nothing to refuse: the call would have gone on with a value the caller did not send. The test was written the day before that change (c91e8e8, 10 November) and has failed since it.
+- `Session.run` keeps every `settings` patch it carries to the engine in `Session.sent`. After its checks of the merged settings, `guard.before` runs `guard.patch` on each of them, so a pixel aspect value with anything but a ratio, and any other string the patch rule refuses, is refused whichever engine command carried it, whether the engine kept it or corrected it.
+- The new check comes last, so a path the engine did keep is still refused with its own "outside" sentence. `encode` already ran `guard.patch` before queueing, so its answers are the same.
+- Seen with a headless session before any test was run again: queued with `1:1,movie=...`, `1:1;x` and `1:1 /...` the engine held `1:1` each time and `guard.before` refused with `params.settings.video.pixelAspect ... holds a filtergraph, option or path character`; `4:3` and `source` were held as sent and allowed. Then `tests/test_functions.py`: 42 passed (39 passed, 3 failed before).
+- Not changed: the engine (no Rust change, not rebuilt) and the commands the window and agents use, where such a value is still corrected to `1:1` and not refused.
+
diff --git a/backend/app/__init__.py b/backend/app/__init__.py
index fa3ddd8..61fb31c 100644
--- a/backend/app/__init__.py
+++ b/backend/app/__init__.py
@@ -1 +1 @@
-__version__ = "0.8.4"
+__version__ = "0.10.0"
diff --git a/backend/app/agent/approvals.py b/backend/app/agent/approvals.py
index 620c2e4..6d04c4f 100644
--- a/backend/app/agent/approvals.py
+++ b/backend/app/agent/approvals.py
@@ -9,7 +9,7 @@
from pathlib import Path
from typing import Any, Awaitable, Callable
-from ..core import config
+from ..core import config, seal
from ..engine.host import host
UPLOADS = {"ftp", "s3", "webhook", "youtube", "vimeo", "facebook", "plugin"}
@@ -35,15 +35,25 @@ def _store() -> Path:
return config.data_dir() / "approvals.json"
-def full_faith() -> bool:
+def _stored() -> dict:
try:
- return bool(json.loads(_store().read_text(encoding="utf-8")).get("fullFaith"))
+ found = json.loads(_store().read_text(encoding="utf-8"))
except (OSError, ValueError):
- return False
+ return {}
+ return found if isinstance(found, dict) else {}
+
+
+def seal_state() -> str:
+ stored = _stored()
+ return seal.read("approvals", stored, bool(stored.get("fullFaith")))
+
+
+def full_faith() -> bool:
+ return bool(_stored().get("fullFaith")) and seal_state() != "broken"
def set_full_faith(on: bool) -> dict:
- _store().write_text(json.dumps({"fullFaith": bool(on)}, indent=2), encoding="utf-8")
+ _store().write_text(json.dumps(seal.sign("approvals", {"fullFaith": bool(on)}), indent=2), encoding="utf-8")
note("ui", "agents.fullFaith", {"on": bool(on)}, True, 0)
_changed()
return state()
diff --git a/backend/app/agent/connect.py b/backend/app/agent/connect.py
index ec018cb..7eec374 100644
--- a/backend/app/agent/connect.py
+++ b/backend/app/agent/connect.py
@@ -4,11 +4,11 @@
import os
import re
import shutil
-import subprocess
import time
from pathlib import Path
from ..core import config
+from ..services import agent_lookup, agent_programs
from . import workspace
SKILL = "formencoder-harness"
@@ -50,19 +50,21 @@ def install_claude(home: Path, dry: bool, said: list) -> None:
cmd = launch()
args = workspace.client_args("claude")
line = " ".join([cmd, *args])
- claude = shutil.which("claude")
+ found = agent_programs.usable("claude")
+ claude = found.path if found.state == "runs" else None
if claude:
- have = subprocess.run([claude, "mcp", "get", NAME], capture_output=True, text=True)
+ env = agent_programs.child_env(claude, base=dict(os.environ))
+ have = agent_lookup.run([claude, "mcp", "get", NAME], env, 60)
if have.returncode == 0 and cmd in have.stdout and "--profile" in have.stdout:
said.append(f" MCP server {NAME} already set (user scope)")
else:
said.append(f" claude mcp add --scope user {NAME} -- {line}")
if not dry:
if have.returncode == 0:
- subprocess.run([claude, "mcp", "remove", NAME, "--scope", "user"], capture_output=True)
- subprocess.run([claude, "mcp", "add", "--scope", "user", NAME, "--", cmd, *args], check=True, capture_output=True)
+ agent_lookup.run([claude, "mcp", "remove", NAME, "--scope", "user"], env, 60)
+ agent_lookup.run([claude, "mcp", "add", "--scope", "user", NAME, "--", cmd, *args], env, 60).check_returncode()
else:
- said.append(f" the claude command is not installed here; once it is, run: claude mcp add --scope user {NAME} -- {line}")
+ said.append(f" {agent_programs.said(found)} Once it starts, run: claude mcp add --scope user {NAME} -- {line}")
_copy_skill(home / ".claude" / "skills" / SKILL, dry, said)
@@ -103,7 +105,38 @@ def install_cursor(home: Path, dry: bool, said: list) -> None:
_copy_skill(home / ".agents" / "skills" / SKILL, dry, said)
-CLIENTS = {"claude": install_claude, "codex": install_codex, "cursor": install_cursor}
+def install_antigravity(home: Path, dry: bool, said: list) -> None:
+ said.append("Antigravity:")
+ cfg = home / ".gemini" / "config" / "mcp_config.json"
+ older = home / ".gemini" / "antigravity-cli" / "mcp_config.json"
+ if older.exists() and not cfg.exists():
+ said.append(f" an older file was seen at {older} and left alone; the documented file is {cfg}")
+ try:
+ data = json.loads(cfg.read_text(encoding="utf-8") or "{}") if cfg.exists() else {}
+ except ValueError:
+ data = None
+ if not isinstance(data, dict) or not isinstance(data.get("mcpServers", {}), dict):
+ said.append(f" {cfg} is not an MCP servers file formencoder can read; left alone")
+ return
+ entry = {"command": launch(), "args": workspace.client_args("antigravity")}
+ have = data.get("mcpServers", {}).get(NAME)
+ ours = isinstance(have, dict) and have.get("args") == entry["args"] and Path(str(have.get("command", ""))).name == Path(entry["command"]).name
+ if have == entry:
+ said.append(f" MCP server {NAME} already in {cfg}")
+ elif have is not None and not ours:
+ said.append(f" {cfg} has a server named {NAME} that formencoder did not write; left alone")
+ else:
+ said.append(f" MCP server {NAME} -> {cfg}")
+ if not dry:
+ _backup(cfg, dry)
+ data.setdefault("mcpServers", {})[NAME] = entry
+ cfg.parent.mkdir(parents=True, exist_ok=True)
+ part = cfg.with_name(cfg.name + f".part-{os.getpid()}")
+ part.write_text(json.dumps(data, indent=2) + "\n", encoding="utf-8")
+ os.replace(part, cfg)
+
+
+CLIENTS = {"claude": install_claude, "codex": install_codex, "cursor": install_cursor, "antigravity": install_antigravity}
def install(which: list[str] | None = None, dry: bool = False) -> list[str]:
@@ -114,9 +147,9 @@ def install(which: list[str] | None = None, dry: bool = False) -> list[str]:
if w in CLIENTS:
CLIENTS[w](home, dry, said)
else:
- said.append(f"unknown client {w} (claude, codex or cursor)")
+ said.append(f"unknown client {w} (claude, codex, cursor or antigravity)")
return said
def clients() -> dict:
- return {name: shutil.which(binary) is not None for name, binary in (("claude", "claude"), ("codex", "codex"), ("cursor", "cursor-agent"))}
+ return {name: agent_programs.program(name) is not None for name in agent_programs.PROGRAMS}
diff --git a/backend/app/agent/consent.py b/backend/app/agent/consent.py
index 436a445..b142ca8 100644
--- a/backend/app/agent/consent.py
+++ b/backend/app/agent/consent.py
@@ -1,32 +1,68 @@
from __future__ import annotations
+import asyncio
+import contextlib
import json
import secrets
import time
-from ..core import config
+from ..core import config, seal
from ..engine.host import host
-TOKEN = secrets.token_urlsafe(24)
+TOKENS: set[str] = set()
_session: set[str] = set()
_declined: dict[str, float] = {}
+ANSWERS = ("deny", "once", "session", "always")
+ALWAYS_SCOPE = "agent"
+ASK_SECONDS = 180.0
+BLOCKED = ("Outside agents are turned off (FORMENCODER_AGENTS=deny), and so are agents started inside formencoder. "
+ "Only the person can change this, by starting formencoder without that setting.")
_READ_RPC = {"command.list", "command.describe", "ui.state", "menu.bar", "frame.png", "encode.wait", "engine.info", "activity.list", "family.discover", "family.sources", "publish.destinations", "agents.approvals", "extensions.list"}
+def issue() -> str:
+ token = secrets.token_urlsafe(32)
+ TOKENS.add(token)
+ return token
+
+
+def revoke(token: str | None) -> None:
+ if token:
+ TOKENS.discard(token)
+
+
+def inapp(token: str | None) -> bool:
+ return bool(token) and any(secrets.compare_digest(token, t) for t in list(TOKENS))
+
+
def _store():
return config.data_dir() / "agents.json"
-def _always() -> set[str]:
+def _stored() -> dict:
try:
- return set(json.loads(_store().read_text(encoding="utf-8")).get("allowed", []))
+ found = json.loads(_store().read_text(encoding="utf-8"))
except (OSError, ValueError):
+ return {}
+ return found if isinstance(found, dict) else {}
+
+
+def seal_state() -> str:
+ stored = _stored()
+ return seal.read("agents", stored, bool(stored.get("allowed")))
+
+
+def _always() -> set[str]:
+ stored = _stored()
+ if seal.read("agents", stored, bool(stored.get("allowed"))) == "broken":
return set()
+ allowed = stored.get("allowed", [])
+ return {str(a) for a in allowed} if isinstance(allowed, list) else set()
def _remember(client: str) -> None:
allowed = _always() | {client}
- _store().write_text(json.dumps({"allowed": sorted(allowed)}, indent=2), encoding="utf-8")
+ _store().write_text(json.dumps(seal.sign("agents", {"allowed": sorted(allowed)}), indent=2), encoding="utf-8")
def forget_all() -> None:
@@ -60,18 +96,42 @@ def client_key(source: str) -> str:
return source.split(":", 1)[-1].strip().lower() or "agent"
+def agent_name(source: str) -> str:
+ return source.split(":", 1)[-1].strip()[:60] or "agent"
+
+
def state() -> dict:
- return {"policy": config.agents_policy(), "session": sorted(_session), "always": sorted(_always())}
+ from . import approvals
+
+ seals = seal.summary([seal_state(), approvals.seal_state()])
+ return {"policy": config.agents_policy(), "session": sorted(_session), "always": sorted(_always()), "seal": seals, "sealBroken": seals == "broken",
+ "answers": list(ANSWERS), "alwaysScope": ALWAYS_SCOPE, "askSeconds": ASK_SECONDS, "blockedStopsTabs": True}
+
+GONE = "The caller went away before the person answered."
-async def gate(source: str, token: str | None, mutating: bool, detail: str = "") -> str | None:
- if token and secrets.compare_digest(token, TOKEN):
+
+async def gate_for(request, source: str, token: str | None, mutating: bool, detail: str = "", what: str = "") -> str | None:
+ asking = asyncio.ensure_future(gate(source, token, mutating, detail=detail, what=what))
+ while True:
+ done, _ = await asyncio.wait({asking}, timeout=1.0)
+ if done:
+ return asking.result()
+ if await request.is_disconnected():
+ asking.cancel()
+ with contextlib.suppress(asyncio.CancelledError):
+ await asking
+ return GONE
+
+
+async def gate(source: str, token: str | None, mutating: bool, detail: str = "", what: str = "") -> str | None:
+ if not mutating:
return None
policy = config.agents_policy()
- if policy == "allow" or not mutating:
- return None
if policy == "deny":
- return "Outside agents are turned off (FORMENCODER_AGENTS=deny). Start the agent from formencoder's Terminal panel instead."
+ return BLOCKED
+ if inapp(token):
+ return None
key = client_key(source)
if key in _session or key in _always():
return None
@@ -79,14 +139,18 @@ async def gate(source: str, token: str | None, mutating: bool, detail: str = "")
return "The person declined changes from this agent a moment ago. Ask them in chat before trying again."
if not host.bus.windows():
return ("No formencoder window is open to ask the person for permission. Open formencoder (./formencoder boot, then http://localhost:5270, "
- "or the desktop app) and allow this agent, start the agent from formencoder's Terminal panel, or set FORMENCODER_AGENTS=allow.")
- reply = await host.bus.ask_window({"type": "consent", "client": source, "detail": detail}, timeout=180)
+ "or the desktop app) and allow this agent, or start the agent from formencoder's Terminal panel.")
+ asked = what or (f"use the {detail} tool" if detail else "make changes")
+ question = {"type": "consent", "client": source, "detail": detail, "agent": agent_name(source), "what": asked, "answers": list(ANSWERS), "alwaysScope": ALWAYS_SCOPE}
+ reply = await host.bus.ask_window(question, timeout=ASK_SECONDS)
if not reply:
return "Nobody answered the permission request in the formencoder window. Ask the person to allow the agent there, then retry."
if reply.get("allow"):
- if reply.get("remember") == "always":
+ remember = "once" if reply.get("once") else reply.get("remember")
+ if remember == "always":
_remember(key)
- _session.add(key)
+ if remember != "once":
+ _session.add(key)
return None
_declined[key] = time.monotonic() + 600
return "The person declined changes from this agent. Ask them in chat what they want instead."
diff --git a/backend/app/agent/templates/AGENTS.md b/backend/app/agent/templates/AGENTS.md
index 915175f..2b61084 100644
--- a/backend/app/agent/templates/AGENTS.md
+++ b/backend/app/agent/templates/AGENTS.md
@@ -2,7 +2,7 @@
This folder is formencoder {{VERSION}}'s agent workspace. formencoder (the form family's media encoder) is running on this computer and the person sees its window; your queue changes appear there live.
-- Drive formencoder with the `formencoder` MCP server (`.codex/config.toml` and `.cursor/mcp.json` here run `{{MCP}}`), or with the `formencoder` command line (`formencoder encode FILE --preset ID`, `formencoder queue`, `formencoder exec ID JSON`, `formencoder batch JSON`, `formencoder commands FILTER`, `formencoder describe ID`, `formencoder presets QUERY`, `formencoder probe FILE`, `formencoder frame OUT.png --output '#1'`).
+- Drive formencoder with the `formencoder_tab` MCP server (`.codex/config.toml` and `.cursor/mcp.json` here run `{{MCP}}`), or with the `formencoder` command line (`formencoder encode FILE --preset ID`, `formencoder queue`, `formencoder exec ID JSON`, `formencoder batch JSON`, `formencoder commands FILTER`, `formencoder describe ID`, `formencoder presets QUERY`, `formencoder probe FILE`, `formencoder frame OUT.png --output '#1'`).
- Read `.agents/skills/formencoder-harness/SKILL.md` first: it routes to the sub-skill for the job (queue and presets, export settings, effects and loudness, captions and metadata, watch folders and ingest, the form family, verifying).
- Loop: `status`, then `probe`, then `encode` or queue plus `export_settings`, then `preview_frame`, then `verify`. Never report an encode you did not verify.
diff --git a/backend/app/agent/templates/CLAUDE.md b/backend/app/agent/templates/CLAUDE.md
index fe78087..873231a 100644
--- a/backend/app/agent/templates/CLAUDE.md
+++ b/backend/app/agent/templates/CLAUDE.md
@@ -4,7 +4,7 @@ You are running inside formencoder {{VERSION}}, the form family's media encoder,
## How to drive formencoder
-- Use the `formencoder` MCP server (configured in `.mcp.json` here; it runs `{{MCP}}`). Agents started from this terminal are trusted; nothing asks for permission.
+- Use the `formencoder_tab` MCP server (configured in `.mcp.json` here; it runs `{{MCP}}`). A Claude Code, Codex, Cursor or Antigravity tab started from formencoder's Terminal panel is trusted and nothing asks for permission; a program typed into a plain shell tab asks the person like any outside agent.
- If MCP is unavailable, the same surface is on the command line: `formencoder encode FILE --preset system/youtube-1080p`, `formencoder queue`, `formencoder exec ID '{"json": "params"}'`, `formencoder batch '[...]'`, `formencoder commands FILTER`, `formencoder describe ID`, `formencoder presets QUERY`, `formencoder probe FILE`, `formencoder frame out.png --output '#1' --time 2`, `formencoder wait`.
- Read `.claude/skills/formencoder-harness/SKILL.md` before a non-trivial job. It routes to sub-skills for the queue and presets, export settings, effects and loudness, captions and metadata, watch folders and ingest, the form family bridge, and verifying.
diff --git a/backend/app/agent/tools.py b/backend/app/agent/tools.py
index 1d8ffc1..bbc3939 100644
--- a/backend/app/agent/tools.py
+++ b/backend/app/agent/tools.py
@@ -483,7 +483,7 @@ async def _terminal(name: str, args: dict, source: str) -> dict:
term = hub.open(args.get("title"), args.get("cwd"), 120, 32, f"http://127.0.0.1:{config.PORT}", run=args.get("command") or None)
term.opener = source
return text({**term.row(), "next": "terminal_send {session, text} to type, terminal_read {session} to read"})
- term = hub.get(str(args["session"]))
+ term = hub.listed(str(args["session"]))
if name == "terminal_send":
before = term.offset
term.write(str(args["text"]) + ("\r" if args.get("enter", True) else ""))
diff --git a/backend/app/agent/workspace.py b/backend/app/agent/workspace.py
index b3e97a8..7beda94 100644
--- a/backend/app/agent/workspace.py
+++ b/backend/app/agent/workspace.py
@@ -10,7 +10,7 @@
from .. import __version__
from ..core import config
-CLIENT_PROFILES = {"claude": "full", "codex": "full", "cursor": "core"}
+CLIENT_PROFILES = {"claude": "full", "codex": "full", "cursor": "core", "antigravity": "core"}
def client_args(client: str) -> list[str]:
@@ -19,6 +19,7 @@ def client_args(client: str) -> list[str]:
TEMPLATES = Path(__file__).resolve().parent / "templates"
SKILLS = ("formencoder-harness",)
MANAGED = ("CLAUDE.md", "AGENTS.md", ".mcp.json", ".claude/settings.json", ".codex/config.toml", ".cursor/mcp.json")
+TAB_ENTRY = "formencoder_tab"
def root() -> Path:
@@ -128,11 +129,11 @@ def ensure() -> Path:
_shell_rc(base)
_write(base / "CLAUDE.md", _render("CLAUDE.md", values))
_write(base / "AGENTS.md", _render("AGENTS.md", values))
- _write(base / ".mcp.json", json.dumps({"mcpServers": {"formencoder": {"type": "stdio", "command": command, "args": client_args("claude")}}}, indent=2) + "\n")
+ _write(base / ".mcp.json", json.dumps({"mcpServers": {TAB_ENTRY: {"type": "stdio", "command": command, "args": client_args("claude")}}}, indent=2) + "\n")
toml_cmd = command.replace("\\", "\\\\")
- _write(base / ".codex" / "config.toml", f'[mcp_servers.formencoder]\ncommand = "{toml_cmd}"\nargs = {json.dumps(client_args("codex"))}\nstartup_timeout_sec = 90\ntool_timeout_sec = 3600\n')
- _write(base / ".cursor" / "mcp.json", json.dumps({"mcpServers": {"formencoder": {"command": command, "args": client_args("cursor")}}}, indent=2) + "\n")
- claude_settings = {"enableAllProjectMcpServers": True, "enabledMcpjsonServers": ["formencoder"], "permissions": {"allow": ["mcp__formencoder", "Bash(formencoder:*)"]}}
+ _write(base / ".codex" / "config.toml", f'[mcp_servers.{TAB_ENTRY}]\ncommand = "{toml_cmd}"\nargs = {json.dumps(client_args("codex"))}\nstartup_timeout_sec = 90\ntool_timeout_sec = 3600\n')
+ _write(base / ".cursor" / "mcp.json", json.dumps({"mcpServers": {TAB_ENTRY: {"command": command, "args": client_args("cursor")}}}, indent=2) + "\n")
+ claude_settings = {"enableAllProjectMcpServers": True, "enabledMcpjsonServers": [TAB_ENTRY], "permissions": {"allow": [f"mcp__{TAB_ENTRY}", "Bash(formencoder:*)"]}}
_write(base / ".claude" / "settings.json", json.dumps(claude_settings, indent=2) + "\n")
if not stamp.is_file() or stamp.read_text(encoding="utf-8").strip() != __version__:
_copy_skills(base)
diff --git a/backend/app/core/config.py b/backend/app/core/config.py
index e55f04d..d8b248c 100644
--- a/backend/app/core/config.py
+++ b/backend/app/core/config.py
@@ -85,5 +85,4 @@ def cors_origins() -> list[str]:
def agents_policy() -> str:
- value = os.environ.get("FORMENCODER_AGENTS", "ask").strip().lower()
- return value if value in ("ask", "allow", "deny") else "ask"
+ return "deny" if os.environ.get("FORMENCODER_AGENTS", "").strip().lower() == "deny" else "ask"
diff --git a/backend/app/core/seal.py b/backend/app/core/seal.py
new file mode 100644
index 0000000..fb05751
--- /dev/null
+++ b/backend/app/core/seal.py
@@ -0,0 +1,67 @@
+import hashlib
+import hmac
+import json
+import secrets
+
+SERVICE = "FormEncoder"
+ACCOUNT = "settings-seal"
+FIELD = "seal"
+_CACHE: dict = {"tried": False, "available": False, "key": None}
+
+
+def reset() -> None:
+ _CACHE.update(tried=False, available=False, key=None)
+
+
+def _load(create: bool) -> bytes | None:
+ if _CACHE["tried"] and (_CACHE["key"] is not None or not _CACHE["available"] or not create):
+ return _CACHE["key"]
+ _CACHE["tried"] = True
+ try:
+ import keyring
+
+ stored = keyring.get_password(SERVICE, ACCOUNT)
+ if not stored and create:
+ keyring.set_password(SERVICE, ACCOUNT, secrets.token_hex(32))
+ stored = keyring.get_password(SERVICE, ACCOUNT)
+ key = bytes.fromhex(stored) if stored else None
+ except Exception:
+ _CACHE.update(available=False, key=None)
+ return None
+ _CACHE.update(available=True, key=key)
+ return key
+
+
+def available() -> bool:
+ _load(False)
+ return _CACHE["available"]
+
+
+def digest(label: str, values: dict, key: bytes) -> str:
+ body = json.dumps({"label": label, "values": {k: v for k, v in values.items() if k != FIELD}}, sort_keys=True, separators=(",", ":"), ensure_ascii=False)
+ return hmac.new(key, body.encode("utf-8"), hashlib.sha256).hexdigest()
+
+
+def read(label: str, stored: dict, loosened: bool) -> str:
+ key = _load(False)
+ if not _CACHE["available"]:
+ return "unavailable"
+ mark = stored.get(FIELD)
+ if key is not None and isinstance(mark, str) and hmac.compare_digest(mark, digest(label, stored, key)):
+ return "ok"
+ return "broken" if loosened else "unsealed"
+
+
+def sign(label: str, values: dict) -> dict:
+ clean = {k: v for k, v in values.items() if k != FIELD}
+ key = _load(True)
+ if key is None:
+ return clean
+ return {**clean, FIELD: digest(label, clean, key)}
+
+
+def summary(states: list[str]) -> str:
+ for state in ("broken", "unavailable", "unsealed"):
+ if state in states:
+ return state
+ return "ok"
diff --git a/backend/app/core/window_key.py b/backend/app/core/window_key.py
new file mode 100644
index 0000000..68c80e3
--- /dev/null
+++ b/backend/app/core/window_key.py
@@ -0,0 +1,72 @@
+import hmac
+import json
+import os
+import secrets
+import time
+
+from fastapi import HTTPException, Request
+
+HEADER = "x-formencoder-window-key"
+STDOUT_ENV = "FORMENCODER_WINDOW_KEY_STDOUT"
+LINE = "formencoder-window-key: "
+REFUSED = "Only the formencoder window can do this"
+TICKET_LIFE = 30.0
+READS = ("GET", "HEAD", "OPTIONS")
+OPEN = ("/mcp", "/api/window/key", "/api/rpc", "/api/family/hooks/formcut")
+KEY = secrets.token_urlsafe(32)
+STATE = {"claimed": False, "secondClaim": False}
+TICKETS: dict[str, float] = {}
+
+
+def stdout_mode() -> bool:
+ return os.environ.get(STDOUT_ENV) == "1"
+
+
+def valid(value) -> bool:
+ return isinstance(value, str) and bool(value) and hmac.compare_digest(value.encode("utf-8"), KEY.encode("utf-8"))
+
+
+def require(request: Request) -> None:
+ if not valid(request.headers.get(HEADER)):
+ raise HTTPException(403, REFUSED)
+
+
+def claim() -> str | None:
+ if STATE["claimed"]:
+ STATE["secondClaim"] = True
+ return None
+ STATE["claimed"] = True
+ return KEY
+
+
+def ticket() -> str:
+ now = time.monotonic()
+ for old in [t for t, at in TICKETS.items() if now - at > TICKET_LIFE]:
+ TICKETS.pop(old, None)
+ value = secrets.token_urlsafe(24)
+ TICKETS[value] = now
+ return value
+
+
+def spend(value) -> bool:
+ if not isinstance(value, str) or not value:
+ return False
+ at = TICKETS.pop(value, None)
+ return at is not None and time.monotonic() - at <= TICKET_LIFE
+
+
+class WindowKeyGuard:
+ def __init__(self, app) -> None:
+ self.app = app
+
+ async def __call__(self, scope, receive, send) -> None:
+ if scope["type"] != "http" or scope.get("method") in READS or str(scope.get("path", "")) in OPEN:
+ await self.app(scope, receive, send)
+ return
+ given = next((v.decode("latin-1") for k, v in scope.get("headers", []) if k.decode("latin-1").lower() == HEADER), None)
+ if valid(given):
+ await self.app(scope, receive, send)
+ return
+ body = json.dumps({"detail": REFUSED}).encode("utf-8")
+ await send({"type": "http.response.start", "status": 403, "headers": [(b"content-type", b"application/json"), (b"content-length", str(len(body)).encode())]})
+ await send({"type": "http.response.body", "body": body})
diff --git a/backend/app/engine/bus.py b/backend/app/engine/bus.py
index 58a587e..4b4110b 100644
--- a/backend/app/engine/bus.py
+++ b/backend/app/engine/bus.py
@@ -2,6 +2,7 @@
import asyncio
import itertools
+import time
from dataclasses import dataclass, field
@@ -19,6 +20,10 @@ def __init__(self) -> None:
self.clients: set[Client] = set()
self._ids = itertools.count(1)
self._replies: dict[int, asyncio.Future] = {}
+ self._asking: dict[int, dict] = {}
+
+ def waiting(self) -> list[dict]:
+ return list(self._asking.values())
def bind(self, loop: asyncio.AbstractEventLoop) -> None:
self.loop = loop
@@ -65,18 +70,26 @@ async def ask_window(self, message: dict, timeout: float, first: bool = False) -
rid = next(self._ids)
fut: asyncio.Future = asyncio.get_running_loop().create_future()
self._replies[rid] = fut
- payload = {**message, "requestId": rid}
+ payload = {"id": str(rid), **message, "requestId": rid, "expiresIn": timeout, "expiresAt": time.time() + timeout}
+ if not first:
+ self._asking[rid] = payload
for w in windows:
try:
w.queue.put_nowait(payload)
except asyncio.QueueFull:
pass
+ reason = "cancelled"
try:
- return await asyncio.wait_for(fut, timeout)
+ reply = await asyncio.wait_for(fut, timeout)
+ reason = "answered"
+ return reply
except asyncio.TimeoutError:
+ reason = "expired"
return None
finally:
self._replies.pop(rid, None)
+ self._asking.pop(rid, None)
+ self._deliver({"type": "withdrawn", "requestId": rid, "id": str(rid), "of": message.get("type"), "reason": reason}, ("ui",))
def answer(self, rid: int, value: dict) -> bool:
fut = self._replies.get(rid)
diff --git a/backend/app/engine/rpc.py b/backend/app/engine/rpc.py
index 09e2f97..e5045ba 100644
--- a/backend/app/engine/rpc.py
+++ b/backend/app/engine/rpc.py
@@ -19,6 +19,8 @@ def __init__(self, message: str, code: int = -32000, data: Any = None):
_query_ids: set[str] | None = None
_QUEUE_KEYS = ("preset", "format", "settings", "folder", "outputs", "start")
+WINDOW_PREFS = ("ffmpegDir", "incrementNames", "rawDecoders", "cacheFolder")
+WINDOW_SOURCES = ("ui", "engine", "desktop")
def _dumps(params: Any) -> str:
@@ -36,9 +38,18 @@ def query_ids() -> set[str]:
return _query_ids
+def window_only(command: Any, params: Any, source: str) -> None:
+ if source in WINDOW_SOURCES or command != "prefs.set" or not isinstance(params, dict) or not isinstance(params.get("values"), dict):
+ return
+ touched = [k for k in WINDOW_PREFS if k in params["values"]]
+ if touched:
+ raise RpcError(f"Only the person, in the formencoder window (Preferences), can change {', '.join(touched)}: it decides which program runs or whether an existing file is replaced or removed.", -32003)
+
+
async def execute(command: str, params: Any = None, source: str = "ui") -> Any:
if not isinstance(command, str) or not command:
raise RpcError("missing `command`", -32602)
+ window_only(command, params, source)
try:
raw = await host.call(lambda e: e.execute(command, _dumps(params), source))
except ValueError as exc:
@@ -49,6 +60,9 @@ async def execute(command: str, params: Any = None, source: str = "ui") -> Any:
async def batch(steps: list, label: str | None, atomic: bool, source: str) -> Any:
+ for step in steps if isinstance(steps, list) else []:
+ if isinstance(step, dict):
+ window_only(step.get("command"), step.get("params"), source)
try:
raw = await host.call(lambda e: e.batch(json.dumps(steps), label, atomic, source))
except ValueError as exc:
@@ -170,10 +184,10 @@ async def dispatch(method: str, params: Any, source: str = "ui") -> Any:
if method in ("agents.approvals", "agents.decide", "agents.fullFaith"):
from ..agent import approvals
- if method == "agents.approvals":
- return approvals.state()
if source != "ui":
raise RpcError("Only the person, in the formencoder window, can approve agents' actions or change full faith.", -32003)
+ if method == "agents.approvals":
+ return approvals.state()
if method == "agents.decide":
try:
return await approvals.decide(int(p.get("id") or 0), bool(p.get("allow")))
diff --git a/backend/app/ffmpeg_fetch.py b/backend/app/ffmpeg_fetch.py
index 4f3bfeb..99e51a1 100644
--- a/backend/app/ffmpeg_fetch.py
+++ b/backend/app/ffmpeg_fetch.py
@@ -12,7 +12,10 @@
from pathlib import Path
from typing import Callable
-RELEASE = "https://github.com/nodemode-dev/formcut-binaries/releases/download"
+SOURCES = (
+ "https://github.com/nodemode-dev/formai-binaries/releases/download",
+ "https://github.com/nodemode-dev/formcut-binaries/releases/download",
+)
DOCUMENTS = ("LGPL-2.1.txt", "THIRD-PARTY-NOTICES.txt", "README.md")
@@ -55,10 +58,11 @@ def release(data: dict) -> str:
return data.get("release") or ((data.get("source") or {}).get("ffmpeg") or {}).get("version", "")
-def source(data: dict, triple: str) -> str:
+def sources(data: dict, triple: str) -> list[str]:
name = release(data)
- base = os.environ.get("FORMENCODER_FFMPEG_RELEASE") or f"{RELEASE}/ffmpeg-{name}"
- return f"{base.rstrip('/')}/ffmpeg-lgpl-{name}-{triple}.tar.gz"
+ override = os.environ.get("FORMENCODER_FFMPEG_RELEASE")
+ bases = [override] if override else [f"{base}/ffmpeg-{name}" for base in SOURCES]
+ return [f"{base.rstrip('/')}/ffmpeg-lgpl-{name}-{triple}.tar.gz" for base in bases]
def _digest(path: Path) -> str:
@@ -111,20 +115,29 @@ def fetch(report: Callable[[float, str], None]) -> dict:
files = pins(data, triple)
if not files:
raise ValueError(f"no FFmpeg build is recorded for {triple}; install FFmpeg and set its folder in Preferences")
- url, folder = source(data, triple), user_folder()
- with tempfile.TemporaryDirectory() as scratch:
- archive = Path(scratch) / "ffmpeg.tar.gz"
- report(0.02, "downloading FFmpeg")
- with urllib.request.urlopen(url, timeout=120) as r, archive.open("wb") as out:
- total = int(r.headers.get("content-length") or 0)
- done = 0
- for chunk in iter(lambda: r.read(1 << 20), b""):
- out.write(chunk)
- done += len(chunk)
- if total:
- report(0.85 * done / total, "downloading FFmpeg")
- report(0.9, "checking every file against the record")
- count = install(archive, files, folder)
+ folder = user_folder()
+ failures: list[str] = []
+ for url in sources(data, triple):
+ try:
+ with tempfile.TemporaryDirectory() as scratch:
+ archive = Path(scratch) / "ffmpeg.tar.gz"
+ report(0.02, "downloading FFmpeg")
+ with urllib.request.urlopen(url, timeout=120) as r, archive.open("wb") as out:
+ total = int(r.headers.get("content-length") or 0)
+ done = 0
+ for chunk in iter(lambda: r.read(1 << 20), b""):
+ out.write(chunk)
+ done += len(chunk)
+ if total:
+ report(0.85 * done / total, "downloading FFmpeg")
+ report(0.9, "checking every file against the record")
+ count = install(archive, files, folder)
+ except (OSError, ValueError, tarfile.TarError) as error:
+ failures.append(f"{url}: {error}")
+ continue
+ break
+ else:
+ raise ValueError("FFmpeg could not be installed; " + "; ".join(failures))
(folder / "ffmpeg-licence.json").write_text(json.dumps(data, indent=1), encoding="utf-8")
report(1.0, "FFmpeg installed")
return {"folder": str(folder), "files": count, "source": url}
diff --git a/backend/app/functions/guard.py b/backend/app/functions/guard.py
index 23fded1..e0d77e1 100644
--- a/backend/app/functions/guard.py
+++ b/backend/app/functions/guard.py
@@ -71,6 +71,8 @@ def before(s: Session, oid: str, out: Path, planned: str) -> None:
for m in _PATH_INSIDE.finditer(value):
if not _within(value[m.start(1):], allowed):
raise FunctionError(f"{where} names {value[m.start(1):]}, outside the inputs, the install and out_dir")
+ for sent in s.sent:
+ patch(sent)
def patch(settings: object) -> None:
diff --git a/backend/app/functions/session.py b/backend/app/functions/session.py
index 0dd1aac..9b08fc9 100644
--- a/backend/app/functions/session.py
+++ b/backend/app/functions/session.py
@@ -29,8 +29,11 @@ class FunctionError(Exception):
class Session:
def __init__(self, engine: Any) -> None:
self.engine = engine
+ self.sent: list = []
def run(self, command: str, **params: Any) -> Any:
+ if params.get("settings"):
+ self.sent.append(params["settings"])
try:
return json.loads(self.engine.execute(command, json.dumps(params), "function"))
except ValueError as exc:
diff --git a/backend/app/main.py b/backend/app/main.py
index 4645ddd..bdf6e3e 100644
--- a/backend/app/main.py
+++ b/backend/app/main.py
@@ -11,6 +11,7 @@
from .agent import workspace
from .core import config, discovery
from .core.security import LocalOnly
+from .core.window_key import WindowKeyGuard
from .engine import rpc as engine_rpc
from .engine.host import host
from .routers import agents, extensions, files, hooks, live, mcp, rpc, system, terminal
@@ -64,6 +65,7 @@ async def lifespan(app: FastAPI):
app = FastAPI(title="formencoder engine", version=__version__, lifespan=lifespan)
+app.add_middleware(WindowKeyGuard)
app.add_middleware(CORSMiddleware, allow_origins=config.cors_origins(), allow_credentials=False, allow_methods=["*"], allow_headers=["*"], expose_headers=["x-formencoder-preview"])
app.add_middleware(LocalOnly)
for r in ROUTERS:
diff --git a/backend/app/routers/live.py b/backend/app/routers/live.py
index 6cecb44..3e20043 100644
--- a/backend/app/routers/live.py
+++ b/backend/app/routers/live.py
@@ -5,6 +5,7 @@
from fastapi import APIRouter, WebSocket, WebSocketDisconnect
from .. import __version__
+from ..core import window_key
from ..engine import rpc
from ..engine.host import host
@@ -15,8 +16,8 @@
@router.websocket("/api/live")
async def live(socket: WebSocket) -> None:
await socket.accept()
- kind = socket.query_params.get("kind", "ui")
- client = host.bus.join("ui" if kind == "ui" else "watch", socket.query_params.get("name", ""))
+ window = socket.query_params.get("kind", "ui") == "ui" and window_key.spend(socket.query_params.get("ticket"))
+ client = host.bus.join("ui" if window else "watch", socket.query_params.get("name", ""))
async def pump() -> None:
while True:
@@ -34,6 +35,10 @@ async def slow(message: dict) -> None:
sender = asyncio.create_task(pump())
put({"type": "hello", "version": __version__, "revision": host.revision, "running": host.running, "core": host.available, "error": host.error, "client": client.id})
+ if window:
+ for waiting in host.bus.waiting():
+ if waiting.get("type") == "consent":
+ put(waiting)
tasks: set[asyncio.Task] = set()
try:
while True:
@@ -44,6 +49,10 @@ async def slow(message: dict) -> None:
continue
if not isinstance(message, dict):
continue
+ if not window:
+ if message.get("id") is not None:
+ put({"jsonrpc": "2.0", "id": message.get("id"), "error": {"code": -32003, "message": window_key.REFUSED}})
+ continue
if message.get("method") == "reply":
params = message.get("params") or {}
host.bus.answer(int(params.get("requestId") or 0), params.get("value") or {})
diff --git a/backend/app/routers/mcp.py b/backend/app/routers/mcp.py
index 020e961..7c84d17 100644
--- a/backend/app/routers/mcp.py
+++ b/backend/app/routers/mcp.py
@@ -80,7 +80,8 @@ async def mcp(request: Request) -> Response:
out = _err(rid, -32602, f"No tool named {name}")
else:
mutating = not tools.read_only(name) and not (name == "execute" and consent.query_command(args.get("command")))
- denied = await consent.gate(client, token, mutating, detail=name)
+ what = f"run the command {args.get('command')}"[:120] if name == "execute" and isinstance(args.get("command"), str) else ""
+ denied = await consent.gate_for(request, client, token, mutating, detail=name, what=what)
out = _ok(rid, tools.fail(denied) if denied else await tools.call(name, args, client), modern)
else:
out = _err(rid, -32601, f"Method not found: {method}")
diff --git a/backend/app/routers/rpc.py b/backend/app/routers/rpc.py
index 5c777da..71ea6a7 100644
--- a/backend/app/routers/rpc.py
+++ b/backend/app/routers/rpc.py
@@ -48,7 +48,7 @@ async def call(request: Request) -> Response:
if source.strip().lower() == "ui":
source = "cli"
rid = message.get("id") if isinstance(message, dict) else None
- denied = await consent.gate(source, request.headers.get("x-formencoder-agent-token"), mutating=consent.mutating_rpc(message))
+ denied = await consent.gate_for(request, source, request.headers.get("x-formencoder-agent-token"), mutating=consent.mutating_rpc(message), what=f"run {_label(message)}"[:120])
if denied:
return Response(json.dumps({"jsonrpc": "2.0", "id": rid, "error": {"code": -32003, "message": denied}}), media_type="application/json")
why = await _reasons(message)
diff --git a/backend/app/routers/system.py b/backend/app/routers/system.py
index 0504d4f..c42cba9 100644
--- a/backend/app/routers/system.py
+++ b/backend/app/routers/system.py
@@ -1,10 +1,10 @@
import os
import platform
-from fastapi import APIRouter
+from fastapi import APIRouter, HTTPException, Request
from .. import __version__, native
-from ..core import config
+from ..core import config, window_key
from ..engine.host import host
router = APIRouter(tags=["system"])
@@ -21,6 +21,22 @@ def version() -> dict:
return {"version": __version__, "core": core if ok else None}
+@router.post("/api/window/key")
+def claim_window_key() -> dict:
+ if window_key.stdout_mode():
+ raise HTTPException(404, "Not Found")
+ key = window_key.claim()
+ if key is None:
+ raise HTTPException(409, "Another window already holds this engine's window key; use that window, or restart formencoder")
+ return {"key": key}
+
+
+@router.post("/api/window/ticket")
+def window_ticket(request: Request) -> dict:
+ window_key.require(request)
+ return {"ticket": window_key.ticket()}
+
+
@router.get("/api/system")
def system() -> dict:
return {
@@ -38,4 +54,5 @@ def system() -> dict:
"running": host.running,
"windows": len(host.bus.windows()),
"agentsPolicy": config.agents_policy(),
+ "secondWindowClaim": window_key.STATE["secondClaim"],
}
diff --git a/backend/app/routers/terminal.py b/backend/app/routers/terminal.py
index ae9a396..110a8e1 100644
--- a/backend/app/routers/terminal.py
+++ b/backend/app/routers/terminal.py
@@ -3,27 +3,54 @@
import contextlib
import json
import os
-import shutil
+import re
+import shlex
import signal
import struct
+import subprocess
import threading
import time
from fastapi import APIRouter, HTTPException, Request, WebSocket, WebSocketDisconnect
from ..agent import consent, workspace
-from ..core import config
+from ..core import config, window_key
+from ..services import agent_lookup
+from ..services import agent_programs as finder
router = APIRouter(prefix="/api/terminal", tags=["terminal"])
POSIX = os.name == "posix"
-AGENTS = {"claude": "claude", "codex": "codex", "cursor": "cursor-agent"}
+AGENTS = {kind: spec["bin"] for kind, spec in finder.PROGRAMS.items()}
+PROGRAMS = {kind: {"title": spec["title"], "install": finder.install(kind)} for kind, spec in finder.PROGRAMS.items()}
+TABS = ("claude", "codex", "cursor", "antigravity")
+RESUME = re.compile(r"[A-Za-z0-9][A-Za-z0-9_-]{7,79}")
+PROMPT_MAX = 20000
-def _environment(base_url: str) -> dict:
+def _program(kind: str) -> dict:
+ return finder.status(kind)
+
+
+def _typed(kind: str) -> str:
+ path = finder.program(kind)
+ if not path:
+ return AGENTS[kind]
+ return shlex.quote(path) if POSIX else (f'"{path}"' if " " in path else path)
+
+
+def _tab_entry(base_url: str, token: str) -> dict:
+ command, _ = workspace.mcp_command()
+ return {"command": command, "args": workspace.client_args("antigravity"),
+ "env": {"FORMENCODER_URL": base_url, finder.TOKEN_VAR: token, "FORMENCODER_AGENT_NAME": "terminal"}}
+
+
+def _environment(base_url: str, token: str | None, program: str | None = None) -> dict:
ws = workspace.ensure()
env = dict(os.environ)
env["FORMENCODER_URL"] = base_url
- env["FORMENCODER_AGENT_TOKEN"] = consent.TOKEN
+ env.pop("FORMENCODER_AGENT_TOKEN", None)
+ if token:
+ env["FORMENCODER_AGENT_TOKEN"] = token
env["FORMENCODER_AGENT_NAME"] = "terminal"
env["FORMENCODER_WORKSPACE"] = str(ws)
env["PATH"] = str(ws / "bin") + os.pathsep + env.get("PATH", "")
@@ -33,7 +60,7 @@ def _environment(base_url: str) -> dict:
env.setdefault("TERM", "xterm-256color")
env["COLORTERM"] = "truecolor"
env.pop("FORMENCODER_DESKTOP", None)
- return env
+ return agent_lookup.child_env(program, base=env, front=[str(ws / "bin")]) if program else env
def _shell_path() -> str:
@@ -47,13 +74,14 @@ def _shell() -> list[str]:
class Session:
- def __init__(self, cols: int, rows: int, env: dict, cwd: str):
+ def __init__(self, cols: int, rows: int, env: dict, cwd: str, argv: list[str] | None = None):
self.cols, self.rows = max(20, min(500, cols)), max(5, min(300, rows))
self.pid = None
self.fd = None
self.process = None
self.winpty = None
self.decoder = codecs.getincrementaldecoder("utf-8")(errors="replace")
+ command = argv or _shell()
if POSIX:
import pty
@@ -63,18 +91,19 @@ def __init__(self, cols: int, rows: int, env: dict, cwd: str):
os.chdir(cwd)
except OSError:
os.chdir(os.path.expanduser("~"))
- os.execvpe(_shell()[0], _shell(), env)
+ try:
+ os.execvpe(command[0], command, env)
+ except OSError:
+ os._exit(127)
self.pid, self.fd = pid, fd
self.resize(self.cols, self.rows)
return
try:
from winpty import PtyProcess
- self.winpty = PtyProcess.spawn(_shell(), cwd=cwd, env=env, dimensions=(self.rows, self.cols))
+ self.winpty = PtyProcess.spawn(command, cwd=cwd, env=env, dimensions=(self.rows, self.cols))
except Exception:
- import subprocess
-
- self.process = subprocess.Popen(_shell(), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=env, cwd=cwd)
+ self.process = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=env, cwd=cwd)
def resize(self, cols: int, rows: int) -> None:
self.cols, self.rows = max(20, min(500, cols)), max(5, min(300, rows))
@@ -144,17 +173,27 @@ def status() -> dict:
"pty": POSIX,
"shell": _shell()[0],
"cwd": str(ws),
- "agents": {name: shutil.which(binary) is not None for name, binary in AGENTS.items()},
+ "agents": {name: finder.program(name) is not None for name in AGENTS},
"launch": AGENTS,
}
+@router.get("/agents")
+def agent_programs(request: Request) -> dict:
+ window_key.require(request)
+ return {"agents": {kind: _program(kind) for kind in PROGRAMS}}
+
+
KEEP = 256_000
class Term:
- def __init__(self, tid: str, title: str, cwd: str, cols: int, rows: int, base: str, owned: bool) -> None:
+ def __init__(self, tid: str, title: str, cwd: str, cols: int, rows: int, base: str, owned: bool, trusted: bool = False,
+ kind: str = "shell", window: bool = False, argv: list[str] | None = None, program: str | None = None) -> None:
self.id, self.title, self.cwd, self.base, self.owned = tid, title, cwd, base, owned
+ self.trusted = trusted
+ self.kind, self.window, self.argv, self.program = kind, window, argv, program
+ self.token: str | None = None
self.opener = "ui"
self.created = time.time()
self.buffer = ""
@@ -167,7 +206,16 @@ def __init__(self, tid: str, title: str, cwd: str, cols: int, rows: int, base: s
def _start(self, cols: int, rows: int) -> None:
self.exited = False
- self.session = Session(cols, rows, _environment(self.base), self.cwd)
+ consent.revoke(self.token)
+ self.token = consent.issue() if self.trusted else None
+ if self.kind == "antigravity" and self.token:
+ try:
+ finder.write_tab_entry(self.cwd, _tab_entry(self.base, self.token))
+ except OSError:
+ consent.revoke(self.token)
+ self.token = None
+ raise
+ self.session = Session(cols, rows, _environment(self.base, self.token, self.program), self.cwd, self.argv)
session = self.session
def pump() -> None:
@@ -197,6 +245,10 @@ def _ended(self, session: "Session") -> None:
if session is not self.session:
return
self.exited = True
+ if self.window:
+ self._forget()
+ consent.revoke(self.token)
+ self.token = None
for q in list(self.listeners):
with contextlib.suppress(asyncio.QueueFull):
q.put_nowait(None)
@@ -216,6 +268,9 @@ def restart(self) -> None:
old, self.session = self.session, None
if old:
old.close()
+ for q in list(self.listeners):
+ with contextlib.suppress(asyncio.QueueFull):
+ q.put_nowait({"type": "restart"})
self._feed("\r\n[formencoder] terminal restarted\r\n")
self._start(cols, rows)
@@ -223,9 +278,20 @@ def close(self) -> None:
if self.session:
self.session.close()
self.exited = True
+ self._forget()
+ consent.revoke(self.token)
+ self.token = None
+ for q in list(self.listeners):
+ with contextlib.suppress(asyncio.QueueFull):
+ q.put_nowait({"type": "closed"})
+
+ def _forget(self) -> None:
+ if self.kind == "antigravity":
+ finder.remove_tab_entry(self.cwd, self.token)
def row(self) -> dict:
- return {"id": self.id, "title": self.title, "cwd": self.cwd, "created": self.created, "exited": self.exited, "owned": self.owned, "offset": self.offset, "opener": self.opener}
+ return {"id": self.id, "title": self.title, "cwd": self.cwd, "created": self.created, "exited": self.exited, "owned": self.owned, "offset": self.offset, "opener": self.opener,
+ "kind": self.kind if self.opener == "ui" else "agent", "alive": not self.exited}
class Hub:
@@ -237,15 +303,26 @@ def changed(self) -> None:
from ..engine.host import host as engine_host
engine_host.bus.publish({"type": "terminals", "sessions": self.listing()}, ("ui",))
+ engine_host.bus.publish({"type": "terminalTabs", "tabs": self.tabs()}, ("ui",))
def listing(self) -> list[dict]:
- return [t.row() for t in self.terms.values() if not t.owned]
+ return [t.row() for t in self.terms.values() if not t.owned and not t.window]
+
+ def tabs(self) -> list[dict]:
+ return [t.row() for t in self.terms.values() if t.window]
+
+ def listed(self, tid: str) -> Term:
+ term = self.get(tid)
+ if term.window:
+ raise KeyError(f"no terminal {tid!r}; open terminals: {', '.join(t['id'] for t in self.listing()) or 'none'}")
+ return term
- def open(self, title: str | None, cwd: str | None, cols: int, rows: int, base: str, owned: bool = False, run: str | None = None) -> Term:
+ def open(self, title: str | None, cwd: str | None, cols: int, rows: int, base: str, owned: bool = False, run: str | None = None, trusted: bool = False,
+ kind: str = "shell", window: bool = False, argv: list[str] | None = None, program: str | None = None) -> Term:
self._n += 1
tid = f"t{self._n}"
place = cwd or str(workspace.ensure())
- term = Term(tid, title or f"Terminal {self._n}", place, cols, rows, base, owned)
+ term = Term(tid, title or f"Terminal {self._n}", place, cols, rows, base, owned, trusted, kind, window, argv, program)
self.terms[tid] = term
if run:
term.write(run + "\r")
@@ -282,12 +359,51 @@ def sessions() -> dict:
return {"sessions": hub.listing()}
+@router.get("/tabs")
+def tabs(request: Request) -> dict:
+ window_key.require(request)
+ return {"tabs": hub.tabs()}
+
+
+@router.post("/tabs")
+async def open_tab(request: Request) -> dict:
+ body = await request.json() if (await request.body()) else {}
+ if not isinstance(body, dict):
+ body = {}
+ kind = body.get("kind") or "shell"
+ prompt, resume = body.get("prompt") or None, body.get("resume") or None
+ if kind != "shell" and kind not in TABS:
+ raise HTTPException(422, {"code": "unknown_kind", "message": f"No tab kind called {kind}. Kinds: shell, {', '.join(TABS)}."})
+ if prompt is not None and (kind == "shell" or not isinstance(prompt, str) or len(prompt) > PROMPT_MAX):
+ raise HTTPException(422, {"code": "bad_prompt", "message": f"A prompt is text of at most {PROMPT_MAX} characters for an agent tab."})
+ if resume is not None and (kind != "claude" or not isinstance(resume, str) or not RESUME.fullmatch(resume)):
+ raise HTTPException(422, {"code": "bad_resume", "message": "resume is a Claude Code session id, for a claude tab only."})
+ try:
+ cols, rows = int(body.get("cols") or 100), int(body.get("rows") or 30)
+ except (TypeError, ValueError):
+ cols, rows = 100, 30
+ argv = path = None
+ if kind in TABS:
+ found = finder.usable(kind)
+ if found.state != "runs":
+ raise HTTPException(404, {"code": "not_installed", "message": finder.said(found), "install": PROGRAMS[kind]["install"]})
+ path = found.path
+ argv = agent_lookup.start_argv([path, *(["--resume", resume] if resume else []), *((["--", prompt] if prompt.startswith("-") else [prompt]) if prompt else [])])
+ title = body.get("title") if isinstance(body.get("title"), str) else None
+ cwd = body.get("cwd") if isinstance(body.get("cwd"), str) and kind != "antigravity" else None
+ try:
+ term = hub.open(title or (PROGRAMS[kind]["title"] if argv else None), cwd, cols, rows, _base(request.headers.get("host")), trusted=argv is not None, kind=kind, window=True, argv=argv, program=path)
+ except OSError as exc:
+ raise HTTPException(500, {"code": "failed", "message": f"The program could not start: {exc}"}) from None
+ return term.row()
+
+
@router.post("/sessions")
async def open_session(request: Request) -> dict:
body = await request.json() if (await request.body()) else {}
launch = body.get("launch")
- run = AGENTS.get(launch) if launch in AGENTS else None
- term = hub.open(body.get("title"), body.get("cwd"), int(body.get("cols") or 100), int(body.get("rows") or 30), _base(request.headers.get("host")), run=run)
+ run = _typed(launch) if launch in AGENTS else None
+ term = hub.open(body.get("title"), body.get("cwd"), int(body.get("cols") or 100), int(body.get("rows") or 30), _base(request.headers.get("host")), run=run, trusted=True)
return term.row()
@@ -303,7 +419,8 @@ async def session_input(tid: str, request: Request) -> dict:
@router.get("/sessions/{tid}/output")
-def session_output(tid: str, since: int | None = None) -> dict:
+def session_output(tid: str, request: Request, since: int | None = None) -> dict:
+ window_key.require(request)
try:
text, offset = hub.get(tid).read(since)
except KeyError as exc:
@@ -342,6 +459,9 @@ def session_close(tid: str) -> dict:
@router.websocket("/ws")
async def terminal(socket: WebSocket) -> None:
+ if not window_key.spend(socket.query_params.get("ticket")):
+ await socket.close(code=4403)
+ return
await socket.accept()
try:
cols = int(socket.query_params.get("cols", "100"))
@@ -349,25 +469,44 @@ async def terminal(socket: WebSocket) -> None:
except ValueError:
cols, rows = 100, 30
attach = socket.query_params.get("session")
+ typed = socket.query_params.get("typed") == "1"
if attach and attach in hub.terms:
term = hub.terms[attach]
if term.session:
term.session.resize(cols, rows)
+ elif attach and typed:
+ await socket.send_bytes(json.dumps({"type": "gone", "id": attach}).encode("utf-8"))
+ await socket.close(code=4404)
+ return
else:
base = _base(socket.headers.get("host"), socket.query_params.get("engine"))
- term = hub.open(None, socket.query_params.get("cwd"), cols, rows, base, owned=True)
+ term = hub.open(None, socket.query_params.get("cwd"), cols, rows, base, owned=True, trusted=True)
queue: asyncio.Queue = asyncio.Queue(maxsize=4000)
replay, _ = term.read(None)
+ if typed:
+ await socket.send_bytes(json.dumps({"type": "hello", "id": term.id, "kind": term.kind, "alive": not term.exited}).encode("utf-8"))
if replay and attach:
await socket.send_text(replay)
+ if typed and term.exited:
+ await socket.send_bytes(json.dumps({"type": "exit"}).encode("utf-8"))
term.listeners.add(queue)
async def send() -> None:
while True:
data = await queue.get()
+ if isinstance(data, dict):
+ if typed:
+ await socket.send_bytes(json.dumps(data).encode("utf-8"))
+ if data.get("type") == "closed":
+ await socket.close()
+ break
+ continue
if data is None:
with contextlib.suppress(Exception):
- await socket.send_text(json.dumps({"exit": True}))
+ if typed:
+ await socket.send_bytes(json.dumps({"type": "exit"}).encode("utf-8"))
+ else:
+ await socket.send_text(json.dumps({"exit": True}))
if term.owned:
break
continue
@@ -376,10 +515,23 @@ async def send() -> None:
sender = asyncio.create_task(send())
launch = socket.query_params.get("launch")
if launch in AGENTS:
- term.write(AGENTS[launch] + "\r")
+ term.write(_typed(launch) + "\r")
try:
while True:
message = await socket.receive_text()
+ if typed:
+ try:
+ control = json.loads(message)
+ except ValueError:
+ control = None
+ if not isinstance(control, dict):
+ continue
+ if control.get("type") == "input" and isinstance(control.get("data"), str):
+ term.write(control["data"])
+ elif control.get("type") == "resize" and term.session:
+ with contextlib.suppress(TypeError, ValueError):
+ term.session.resize(int(control.get("cols")), int(control.get("rows")))
+ continue
if message.startswith("\x00{"):
try:
control = json.loads(message[1:])
@@ -388,7 +540,7 @@ async def send() -> None:
if isinstance(control.get("resize"), list) and len(control["resize"]) == 2 and term.session:
term.session.resize(int(control["resize"][0]), int(control["resize"][1]))
if control.get("launch") in AGENTS:
- term.write(AGENTS[control["launch"]] + "\r")
+ term.write(_typed(control["launch"]) + "\r")
continue
term.write(message)
except WebSocketDisconnect:
diff --git a/backend/app/services/agent_lookup.py b/backend/app/services/agent_lookup.py
new file mode 100644
index 0000000..ea34eba
--- /dev/null
+++ b/backend/app/services/agent_lookup.py
@@ -0,0 +1,443 @@
+"""One finder and one starter for the agent programs a Form engine runs for the person: Claude Code, Codex, Cursor's agent
+and Antigravity, held as a table (PROGRAMS) so another program is one more entry.
+
+A program started from the Dock, the Finder, the Start menu or a desktop launcher gets the system's short PATH, not the one a
+terminal has, so a bare PATH search reports programs installed by Homebrew, npm, a version manager or into the home folder as
+missing. This file looks in order: the person's setting, the app's development override variable, the engine's PATH, the known
+install folders for the system, then the person's own shell PATH (read once and kept). It builds the one environment every
+start uses (the program's own folder first on PATH, so a node script finds the node beside it), starts tabs, Chat and checks
+the same way, answers "installed" three ways (runs, found but does not start, not found) and keeps the record of where it
+looked so the message can say so.
+
+Shared by the Form family: standard library only, nothing imported from the app, copied unchanged between engines and held
+to the hash recorded for VERSION. The app passes in what is its own: the setting's value, the names of its override
+variables, its base environment and how long to wait."""
+
+from __future__ import annotations
+
+import os
+import re
+import shutil
+import signal
+import subprocess
+import sys
+import threading
+import time
+from dataclasses import dataclass, field
+from pathlib import Path
+
+VERSION = "1.0.1"
+PROGRAMS: dict = {
+ "claude": {"title": "Claude Code", "names": ("claude",), "setting": "claudeBin",
+ "install": "curl -fsSL https://claude.ai/install.sh | bash", "install_windows": "irm https://claude.ai/install.ps1 | iex",
+ "home": (".claude/local", ".claude/bin"), "windows": ("home:.claude/local", "home:.claude/bin", "local:Programs/claude", "roaming:Programs/claude")},
+ "codex": {"title": "Codex", "names": ("codex",), "setting": "codexBin", "install": "npm install -g @openai/codex",
+ "windows": ("local:Programs/OpenAI/Codex/bin",), "mac_files": ("Codex.app/Contents/Resources/codex", "Codex.app/Contents/Resources/bin/codex")},
+ "cursor": {"title": "Cursor", "names": ("cursor-agent", "agent"), "setting": "cursorBin", "install": "curl https://cursor.com/install -fsS | bash",
+ "home": (".local/share/cursor-agent/versions/*",), "windows": ("local:cursor-agent",), "real": {"agent": "cursor"}},
+ "antigravity": {"title": "Antigravity", "names": ("agy",), "setting": "antigravityBin",
+ "install": "curl -fsSL https://antigravity.google/cli/install.sh | bash", "install_windows": "irm https://antigravity.google/cli/install.ps1 | iex",
+ "windows_search": ("antigravity", "agy")},
+}
+KEEP_ENV = frozenset({"CLAUDE_CODE_OAUTH_TOKEN", "CLAUDE_CODE_USE_BEDROCK", "CLAUDE_CODE_USE_VERTEX", "CLAUDE_CONFIG_DIR"})
+LIBRARY_VARS = ("LD_LIBRARY_PATH", "DYLD_LIBRARY_PATH")
+WINDOWS_ENDINGS = (".exe", ".cmd", ".bat")
+MARK = "__FORM_AGENT_LOOKUP__"
+HOW = {"setting": "your setting", "override": "the development override", "path": "the engine's PATH", "folder": "a known install folder", "shell": "your shell's PATH"}
+RETRY_SECONDS = 60.0
+
+_lock = threading.RLock()
+_shell: dict = {}
+_checked: dict = {}
+
+
+@dataclass
+class Found:
+ program: str
+ title: str
+ path: str | None = None
+ how: str = ""
+ state: str = "missing"
+ version: str | None = None
+ error: str = ""
+ looked: list[str] = field(default_factory=list)
+
+
+def register(key: str, title: str, names: tuple | list, **more) -> None:
+ """Adds a program to the table, or replaces one, without changing this file. The keys of an entry: title (the name
+ shown to people), names (the program's file names, first wins), setting (the family's name for its path setting),
+ install and install_windows (the install command), home (folders under the home folder on macOS and Linux; a * stands
+ for version folders, newest first), windows (folders as local:, roaming: or home: and a path), mac_files (files inside
+ an application bundle), windows_search (name fragments of folders one and two levels under %LOCALAPPDATA%) and real
+ (for a name other programs also use: the word its real path must contain)."""
+ PROGRAMS[key] = {"title": title, "names": tuple(names), **more}
+
+
+def install(program: str, platform: str | None = None) -> str:
+ spec = PROGRAMS[program]
+ return (spec.get("install_windows") if windows(platform) else "") or spec.get("install", "")
+
+
+def forget() -> None:
+ with _lock:
+ _shell.clear()
+ _checked.clear()
+
+
+def windows(platform: str | None = None) -> bool:
+ return (platform or sys.platform).startswith("win")
+
+
+def runnable(path: str | os.PathLike, platform: str | None = None) -> bool:
+ p = Path(path).expanduser()
+ return p.is_file() and (windows(platform) or os.access(p, os.X_OK))
+
+
+def short(path: str | os.PathLike, home: str | os.PathLike | None = None) -> str:
+ text, base = str(path), str(home or Path.home())
+ return "~" + text[len(base):] if base not in ("", os.sep) and (text == base or text.startswith(base + os.sep)) else text
+
+
+def _version_key(p: Path) -> tuple:
+ return tuple(int(x) for x in re.findall(r"\d+", p.name)) or (0,)
+
+
+def _versions(base: Path, tail: str = "") -> list[Path]:
+ try:
+ kept = [d for d in base.iterdir() if d.is_dir()]
+ except OSError:
+ return []
+ return [d / tail if tail else d for d in sorted(kept, key=_version_key, reverse=True)]
+
+
+def system_folders(platform: str | None = None) -> list[Path]:
+ platform = platform or sys.platform
+ if windows(platform):
+ return []
+ if platform == "darwin":
+ return [Path("/opt/homebrew/bin"), Path("/usr/local/bin"), Path("/opt/local/bin")]
+ return [Path("/usr/local/bin"), Path("/usr/bin"), Path("/snap/bin"), Path("/home/linuxbrew/.linuxbrew/bin")]
+
+
+def folders(program: str, home: str | os.PathLike | None = None, env: dict | None = None, platform: str | None = None) -> list[Path]:
+ platform = platform or sys.platform
+ home = Path(home) if home else Path.home()
+ env = os.environ if env is None else env
+ win = windows(platform)
+ spec = PROGRAMS[program]
+ out: list[Path] = []
+ for key in ("NPM_CONFIG_PREFIX", "npm_config_prefix"):
+ if env.get(key):
+ out.append(Path(env[key]) if win else Path(env[key]) / "bin")
+ for key, tail in (("PNPM_HOME", ""), ("VOLTA_HOME", "bin"), ("BUN_INSTALL", "bin"), ("NVM_SYMLINK", "")):
+ if env.get(key):
+ out.append(Path(env[key]) / tail if tail else Path(env[key]))
+ if win:
+ roots = {"home": home, "roaming": Path(env.get("APPDATA") or home / "AppData" / "Roaming"), "local": Path(env.get("LOCALAPPDATA") or home / "AppData" / "Local")}
+ out += [home / ".local" / "bin", roots["roaming"] / "npm", roots["local"] / "npm", roots["local"] / "pnpm", roots["local"] / "Volta" / "bin",
+ home / ".bun" / "bin", home / ".volta" / "bin"]
+ for place in spec.get("windows", ()):
+ root, _, rest = place.partition(":")
+ out.append(roots[root].joinpath(*rest.split("/")))
+ return list(dict.fromkeys(out))
+ out += [home / ".local" / "bin", home / ".npm-global" / "bin", home / ".bun" / "bin", home / ".volta" / "bin", home / ".local" / "share" / "pnpm"]
+ if platform == "darwin":
+ out.append(home / "Library" / "pnpm")
+ out += _versions(home / ".nvm" / "versions" / "node", "bin")
+ out += _versions(home / ".local" / "share" / "fnm" / "node-versions", "installation/bin")
+ out += _versions(home / "Library" / "Application Support" / "fnm" / "node-versions", "installation/bin")
+ out += _versions(home / ".asdf" / "installs" / "nodejs", "bin")
+ out += _versions(home / ".local" / "share" / "mise" / "installs" / "node", "bin")
+ out += [home / ".asdf" / "shims", home / ".local" / "share" / "mise" / "shims"]
+ for place in spec.get("home", ()):
+ base, star, tail = place.partition("*")
+ out += _versions(home.joinpath(*base.strip("/").split("/")), tail.strip("/")) if star else [home.joinpath(*place.split("/"))]
+ out += system_folders(platform)
+ return list(dict.fromkeys(out))
+
+
+def _searched(root: Path, fragments: tuple) -> list[Path]:
+ out: list[Path] = []
+ named = lambda d: any(f in d.name.lower() for f in fragments)
+ try:
+ first = sorted(d for d in root.iterdir() if d.is_dir())
+ except OSError:
+ return out
+ for one in first:
+ if named(one):
+ out.append(one)
+ try:
+ out += [two for two in sorted(one.iterdir()) if two.is_dir() and (named(one) or named(two))]
+ except OSError:
+ continue
+ return out
+
+
+def candidates(program: str, home: str | os.PathLike | None = None, env: dict | None = None, platform: str | None = None) -> list[Path]:
+ platform = platform or sys.platform
+ home = Path(home) if home else Path.home()
+ env = os.environ if env is None else env
+ spec = PROGRAMS[program]
+ endings = WINDOWS_ENDINGS if windows(platform) else ("",)
+ places = folders(program, home, env, platform)
+ if windows(platform) and spec.get("windows_search"):
+ places += _searched(Path(env.get("LOCALAPPDATA") or home / "AppData" / "Local"), tuple(spec["windows_search"]))
+ out = [folder / (name + ending) for folder in dict.fromkeys(places) for name in spec["names"] for ending in endings]
+ if platform == "darwin":
+ out += [apps.joinpath(*inside.split("/")) for apps in (Path("/Applications"), home / "Applications") for inside in spec.get("mac_files", ())]
+ return out
+
+
+def _trusted(program: str, path: str | os.PathLike) -> bool:
+ name = Path(path).name.lower()
+ stem = name.rsplit(".", 1)[0] if name.endswith(WINDOWS_ENDINGS) else name
+ word = PROGRAMS[program].get("real", {}).get(stem)
+ return not word or word in os.path.realpath(path).lower()
+
+
+def _on_path(program: str, path: str) -> str | None:
+ if not path:
+ return None
+ for name in PROGRAMS[program]["names"]:
+ hit = shutil.which(name, path=path)
+ if hit and _trusted(program, hit):
+ return os.path.abspath(hit)
+ return None
+
+
+def login_shell(env: dict | None = None, platform: str | None = None) -> str:
+ env = os.environ if env is None else env
+ chosen = env.get("SHELL")
+ if chosen:
+ return chosen
+ if (platform or sys.platform) == "darwin" and os.path.exists("/bin/zsh"):
+ return "/bin/zsh"
+ return shutil.which("bash") or "/bin/sh"
+
+
+def _stop(proc: subprocess.Popen) -> None:
+ try:
+ os.killpg(proc.pid, signal.SIGKILL)
+ except (OSError, AttributeError):
+ pass
+ try:
+ proc.kill()
+ except OSError:
+ pass
+ try:
+ proc.communicate(timeout=2)
+ except (OSError, ValueError, subprocess.SubprocessError):
+ pass
+
+
+def _ask_shell(shell: str, flags: list[str], env: dict, timeout: float) -> list[str] | None:
+ script = f"printf '%s%s%s' {MARK} (string join : $PATH) {MARK}" if Path(shell).name == "fish" else f'printf "%s%s%s" {MARK} "$PATH" {MARK}'
+ try:
+ proc = subprocess.Popen([shell, *flags, "-c", script], stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL,
+ env=env, text=True, errors="replace", start_new_session=True)
+ except OSError:
+ return None
+ try:
+ out, _ = proc.communicate(timeout=timeout)
+ except subprocess.TimeoutExpired:
+ _stop(proc)
+ return None
+ hit = re.search(re.escape(MARK) + "(.*?)" + re.escape(MARK), out or "", re.S)
+ parts = [p for p in hit.group(1).split(os.pathsep) if p] if hit else []
+ return parts or None
+
+
+def _registry_path() -> list[str]:
+ try:
+ import winreg
+ except ImportError:
+ return []
+ out: list[str] = []
+ for root, key in ((winreg.HKEY_CURRENT_USER, "Environment"), (winreg.HKEY_LOCAL_MACHINE, r"SYSTEM\CurrentControlSet\Control\Session Manager\Environment")):
+ try:
+ with winreg.OpenKey(root, key) as opened:
+ value, _kind = winreg.QueryValueEx(opened, "Path")
+ except OSError:
+ continue
+ out += [p.strip() for p in winreg.ExpandEnvironmentStrings(str(value)).split(";") if p.strip()]
+ return list(dict.fromkeys(out))
+
+
+def shell_path(env: dict | None = None, timeout: float = 10.0, fresh: bool = False, platform: str | None = None) -> tuple[list[str], str]:
+ """The person's own PATH: on macOS and Linux what their login, interactive shell ends up with (login only when the
+ interactive start gives nothing), on Windows the user and system Path values in the registry. Asked once and kept; an
+ empty answer is asked again after a minute, or at once with fresh."""
+ env = dict(os.environ if env is None else env)
+ with _lock:
+ if _shell and not fresh and (_shell["path"] or time.monotonic() - _shell["at"] < RETRY_SECONDS):
+ return list(_shell["path"]), _shell["note"]
+ if windows(platform):
+ path = _registry_path()
+ note = "the Path values in the registry" if path else "the Path values in the registry (none could be read)"
+ else:
+ shell = login_shell(env, platform)
+ name = Path(shell).name
+ path = _ask_shell(shell, ["-l", "-i"], env, timeout)
+ note = f"your shell ({name}, login and interactive)"
+ if path is None:
+ path = _ask_shell(shell, ["-l"], env, timeout)
+ note = f"your shell ({name}, login only: the interactive start gave no PATH within {timeout:g} s)"
+ if path is None:
+ path, note = [], f"your shell ({name} gave no PATH within {timeout:g} s)"
+ _shell.update(path=list(path), note=note, at=time.monotonic())
+ return list(path), note
+
+
+def find(program: str, setting: str | None = None, override_vars: tuple = (), env: dict | None = None, home: str | os.PathLike | None = None,
+ platform: str | None = None, shell_timeout: float = 10.0, fresh: bool = False) -> Found:
+ """Where the program is, in the family's order. setting is the person's path for it ("" when empty, None when the app
+ has no such setting); override_vars are the names of the app's development override variables, read from env."""
+ env = os.environ if env is None else env
+ platform = platform or sys.platform
+ spec = PROGRAMS[program]
+ found = Found(program, spec["title"])
+
+ def at(path: str | os.PathLike, how: str) -> Found:
+ found.path, found.how, found.state = str(path), how, "found"
+ return found
+
+ if setting is not None:
+ chosen = setting.strip()
+ if chosen and runnable(chosen, platform):
+ return at(Path(chosen).expanduser(), "setting")
+ found.looked.append(f"your setting ({chosen}, which is not a program that can run)" if chosen else "your setting (empty)")
+ for var in override_vars:
+ value = (env.get(var) or "").strip()
+ if value and runnable(value, platform):
+ return at(Path(value).expanduser(), "override")
+ if value:
+ found.looked.append(f"{var} ({value}, which is not a program that can run)")
+ engine_path = env.get("PATH", "")
+ hit = _on_path(program, engine_path)
+ if hit:
+ return at(hit, "path")
+ found.looked.append(f"PATH ({engine_path or 'empty'})")
+ places = candidates(program, home, env, platform)
+ for place in places:
+ if runnable(place, platform) and _trusted(program, place):
+ return at(place, "folder")
+ found.looked.append(", ".join(dict.fromkeys(short(place.parent, home) for place in places)))
+ dirs, note = shell_path(env, shell_timeout, fresh, platform)
+ hit = _on_path(program, os.pathsep.join(dirs))
+ if hit:
+ return at(hit, "shell")
+ found.looked.append(note)
+ return found
+
+
+def child_env(path: str | os.PathLike | None = None, base: dict | None = None, extra: dict | None = None, front: tuple | list = (),
+ home: str | os.PathLike | None = None, platform: str | None = None, shell_timeout: float = 10.0, keep: frozenset | set = KEEP_ENV) -> dict:
+ """The environment every start of an agent program gets. PATH is the program's own folder, the app's own folders
+ (front), the person's shell PATH, the known install folders that exist, then the engine's PATH. CLAUDE* variables other
+ than keep are left out, and a frozen engine's library path is put back as it was. extra is applied last."""
+ base = dict(os.environ if base is None else base)
+ env = {k: v for k, v in base.items() if not k.startswith("CLAUDE") or k in keep}
+ for name in LIBRARY_VARS:
+ original = base.get(name + "_ORIG")
+ if original is not None:
+ env[name] = original
+ elif getattr(sys, "frozen", False) or base.get("_MEIPASS2"):
+ env.pop(name, None)
+ dirs, _note = shell_path(base, shell_timeout, False, platform)
+ known = [str(f) for program in PROGRAMS for f in folders(program, home, base, platform) if f.is_dir()]
+ parts = ([str(Path(path).parent)] if path else []) + [str(f) for f in front] + dirs + known + base.get("PATH", "").split(os.pathsep)
+ env["PATH"] = os.pathsep.join(dict.fromkeys(p for p in parts if p))
+ env.update(extra or {})
+ return env
+
+
+def _quote(word: str, fish: bool) -> str:
+ if word and re.fullmatch(r"[A-Za-z0-9_@%+=:,./-]+", word):
+ return word
+ if fish:
+ return "'" + word.replace("\\", "\\\\").replace("'", "\\'") + "'"
+ return "'" + word.replace("'", "'\"'\"'") + "'"
+
+
+def start_argv(cmd: list, env: dict | None = None, platform: str | None = None) -> list[str]:
+ """How a program is started, the same for a tab, Chat and a check: through the person's login shell on macOS and Linux
+ (exec, so the process is the program), directly on Windows with the command interpreter in front of a .cmd or .bat."""
+ words = [str(c) for c in cmd]
+ env = os.environ if env is None else env
+ if windows(platform):
+ return [env.get("COMSPEC") or "cmd.exe", "/c", *words] if words[0].lower().endswith((".cmd", ".bat")) else words
+ shell = login_shell(env, platform)
+ fish = Path(shell).name == "fish"
+ return [shell, "-l", "-c", "exec " + " ".join(_quote(w, fish) for w in words)]
+
+
+def run(cmd: list, env: dict, timeout: float = 15.0, platform: str | None = None) -> subprocess.CompletedProcess:
+ return subprocess.run(start_argv(cmd, env, platform), capture_output=True, text=True, errors="replace", timeout=timeout, env=env, stdin=subprocess.DEVNULL)
+
+
+def _last_line(text: str) -> str:
+ lines = [line.strip() for line in (text or "").splitlines() if line.strip() and "use -[v]S to pass options" not in line]
+ return lines[-1][:300] if lines else ""
+
+
+def _version(text: str) -> str | None:
+ words = (text or "").split()
+ return next((w for w in words if any(ch.isdigit() for ch in w)), words[0] if words else None)
+
+
+def _stamp(path: str) -> tuple:
+ try:
+ st = os.stat(path)
+ return (path, st.st_mtime_ns, st.st_size)
+ except OSError:
+ return (path, 0, 0)
+
+
+def check(found: Found, env: dict | None = None, timeout: float = 15.0, fresh: bool = False, platform: str | None = None) -> Found:
+ """Whether a found program starts: `--version` in the child environment, started as a tab would start it. The state
+ becomes runs (with the version) or broken (with the error line). An answer is kept for that file until it changes or
+ fresh asks again; a broken answer is asked again after a minute."""
+ if not found.path:
+ return found
+ key = _stamp(found.path)
+ with _lock:
+ kept = None if fresh else _checked.get(key)
+ if kept is not None and kept[0] != "runs" and time.monotonic() - kept[3] >= RETRY_SECONDS:
+ kept = None
+ if kept is None:
+ env = child_env(found.path, platform=platform) if env is None else env
+ try:
+ out = run([found.path, "--version"], env, timeout, platform)
+ if out.returncode == 0:
+ kept = ("runs", _version(out.stdout), "", time.monotonic())
+ else:
+ kept = ("broken", None, _last_line(out.stderr) or _last_line(out.stdout) or f"it ended with code {out.returncode}", time.monotonic())
+ except subprocess.TimeoutExpired:
+ kept = ("broken", None, f"it gave no answer to --version in {timeout:g} seconds", time.monotonic())
+ except OSError as exc:
+ kept = ("broken", None, exc.strerror or str(exc), time.monotonic())
+ with _lock:
+ _checked[key] = kept
+ found.state, found.version, found.error = kept[0], kept[1], kept[2]
+ return found
+
+
+def sentence(found: Found, install: str = "", otherwise: str = "") -> str:
+ """The truthful message, built from the record. install is the app's install command for the program; otherwise is
+ what else the person can do in this app, as a clause ("give its path in Preferences")."""
+ if found.state == "missing":
+ ways = ([f"install it with: {install}"] if install else []) + ([otherwise] if otherwise else [])
+ tail = " " + ", or ".join(ways) + "." if ways else ""
+ return f"{found.title} was not found. Looked in: {'; '.join(found.looked)}." + (tail[:1] + tail[1:2].upper() + tail[2:] if tail else "")
+ where = f"{found.path} ({HOW.get(found.how, found.how)})"
+ if found.state == "broken":
+ tail = f" To use another copy, {otherwise}." if otherwise else ""
+ return f"{found.title} was found at {where} but does not start: {found.error}.{tail}"
+ return f"{found.title} is at {where}."
+
+
+def answer(found: Found, install: str = "", otherwise: str = "") -> dict:
+ """The fields a status route adds for one program: installed is true only when the program runs, and finding is
+ the three-way answer (runs, broken, missing)."""
+ return {"installed": found.state == "runs", "path": found.path, "version": found.version, "finding": found.state, "how": found.how,
+ "looked": list(found.looked), "error": found.error, "said": sentence(found, install, otherwise)}
diff --git a/backend/app/services/agent_programs.py b/backend/app/services/agent_programs.py
new file mode 100644
index 0000000..b93ba90
--- /dev/null
+++ b/backend/app/services/agent_programs.py
@@ -0,0 +1,100 @@
+from __future__ import annotations
+
+import json
+import os
+from pathlib import Path
+
+from . import agent_lookup
+
+PROGRAMS = {
+ "claude": {"bin": "claude", "title": "Claude Code"},
+ "codex": {"bin": "codex", "title": "Codex"},
+ "cursor": {"bin": "cursor-agent", "title": "Cursor"},
+ "antigravity": {"bin": "agy", "title": "Antigravity"},
+}
+OVERRIDES = {
+ "claude": ("FORMENCODER_CLAUDE_BIN",),
+ "codex": ("FORMENCODER_CODEX_BIN",),
+ "cursor": ("FORMENCODER_CURSOR_BIN",),
+ "antigravity": ("FORMENCODER_ANTIGRAVITY_BIN",),
+}
+OTHERWISE = ""
+TAB_ENTRY = "formencoder_tab"
+TOKEN_VAR = "FORMENCODER_AGENT_TOKEN"
+
+
+def install(kind: str) -> str:
+ return agent_lookup.install(kind)
+
+
+def base_env() -> dict:
+ return {k: v for k, v in os.environ.items() if not k.startswith("FORMENCODER_")}
+
+
+def child_env(path: str | None = None, base: dict | None = None, front: tuple | list = (), extra: dict | None = None) -> dict:
+ return agent_lookup.child_env(path, base=base_env() if base is None else base, front=front, extra=extra, shell_timeout=10.0)
+
+
+def located(kind: str, fresh: bool = False) -> agent_lookup.Found:
+ found = agent_lookup.find(kind, setting=None, override_vars=OVERRIDES.get(kind, ()), shell_timeout=10.0, fresh=fresh)
+ return agent_lookup.check(found, child_env(found.path), 15.0, fresh)
+
+
+def usable(kind: str) -> agent_lookup.Found:
+ found = located(kind)
+ return found if found.state == "runs" else located(kind, True)
+
+
+def said(found: agent_lookup.Found) -> str:
+ return agent_lookup.sentence(found, install(found.program), OTHERWISE)
+
+
+def program(kind: str) -> str | None:
+ found = located(kind)
+ return found.path if found.state == "runs" else None
+
+
+def _mcp_file(folder: str | os.PathLike) -> Path:
+ return Path(folder) / ".agents" / "mcp_config.json"
+
+
+def _servers(path: Path) -> dict:
+ data = json.loads(path.read_text(encoding="utf-8") or "{}") if path.exists() else {}
+ if not isinstance(data, dict) or not isinstance(data.get("mcpServers", {}), dict):
+ raise OSError(f"{path} is not an MCP servers file formencoder can read, so it was left alone")
+ return data
+
+
+def _replace(path: Path, data: dict) -> None:
+ path.parent.mkdir(parents=True, exist_ok=True)
+ part = path.with_name(path.name + f".part-{os.getpid()}")
+ with os.fdopen(os.open(part, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0o600), "w", encoding="utf-8") as f:
+ f.write(json.dumps(data, indent=2) + "\n")
+ os.replace(part, path)
+
+
+def write_tab_entry(folder: str | os.PathLike, entry: dict) -> None:
+ path = _mcp_file(folder)
+ data = _servers(path)
+ data.setdefault("mcpServers", {})[TAB_ENTRY] = entry
+ _replace(path, data)
+
+
+def remove_tab_entry(folder: str | os.PathLike, token: str | None) -> None:
+ if not token:
+ return
+ path = _mcp_file(folder)
+ try:
+ data = _servers(path)
+ entry = data.get("mcpServers", {}).get(TAB_ENTRY)
+ if not isinstance(entry, dict) or (entry.get("env") or {}).get(TOKEN_VAR) != token:
+ return
+ del data["mcpServers"][TAB_ENTRY]
+ _replace(path, data)
+ except (OSError, ValueError):
+ return
+
+
+def status(kind: str, fresh: bool = False) -> dict:
+ found = located(kind, fresh)
+ return agent_lookup.answer(found, install(kind), OTHERWISE) | {"signedIn": None, "install": install(kind), "title": PROGRAMS[kind]["title"], "program": PROGRAMS[kind]["bin"]}
diff --git a/backend/formencoder_engine.py b/backend/formencoder_engine.py
index 372595f..5aa8841 100644
--- a/backend/formencoder_engine.py
+++ b/backend/formencoder_engine.py
@@ -1,7 +1,15 @@
-import json
import os
-import socket
import sys
+
+if sys.stdin is None:
+ sys.stdin = open(os.devnull, encoding="utf-8")
+if sys.stdout is None:
+ sys.stdout = open(os.devnull, "w", encoding="utf-8")
+if sys.stderr is None:
+ sys.stderr = open(os.devnull, "w", encoding="utf-8")
+
+import json
+import socket
import threading
import time
from pathlib import Path
@@ -87,7 +95,10 @@ def serve(headless: bool) -> None:
from app import __version__
from app.core import discovery
from app.main import app
+ from app.core import window_key
+ if window_key.stdout_mode():
+ print(window_key.LINE + window_key.KEY, flush=True)
print(f"Uvicorn running on http://127.0.0.1:{port}", flush=True)
discovery.publish(f"http://127.0.0.1:{port}", __version__)
server = uvicorn.Server(uvicorn.Config(app, log_level="warning"))
diff --git a/backend/requirements.txt b/backend/requirements.txt
index dafdd0c..bd170dd 100644
--- a/backend/requirements.txt
+++ b/backend/requirements.txt
@@ -1,5 +1,6 @@
fastapi==0.142.3
uvicorn[standard]==0.54.0
python-multipart==0.0.32
+keyring==25.7.0
maturin==1.15.0
pywinpty==3.0.5; sys_platform == "win32"
diff --git a/backend/requirements_macos.txt b/backend/requirements_macos.txt
index 177859b..d259226 100644
--- a/backend/requirements_macos.txt
+++ b/backend/requirements_macos.txt
@@ -1,4 +1,5 @@
fastapi==0.142.3
uvicorn[standard]==0.54.0
python-multipart==0.0.32
+keyring==25.7.0
maturin==1.15.0
diff --git a/backend/tests/conftest.py b/backend/tests/conftest.py
index 173fb39..0f624ad 100644
--- a/backend/tests/conftest.py
+++ b/backend/tests/conftest.py
@@ -62,11 +62,20 @@ def consent_refusals():
def set_policy(mode):
- os.environ["FORMENCODER_AGENTS"] = {"ask": "ask", "blocked": "deny", "allowed": "allow"}[mode]
+ os.environ["FORMENCODER_AGENTS"] = {"ask": "ask", "blocked": "deny"}[mode]
def inapp_token():
- return importlib.import_module("app.agent.consent").TOKEN
+ return importlib.import_module("app.agent.consent").issue()
+
+
+def window_headers():
+ key = importlib.import_module("app.core.window_key")
+ return {key.HEADER: key.KEY}
+
+
+def window_ticket():
+ return importlib.import_module("app.core.window_key").ticket()
_SANDBOX = Path(tempfile.mkdtemp(prefix=f"{APP_ID}-tests-"))
@@ -82,13 +91,57 @@ def inapp_token():
os.environ["USERPROFILE"] = str(_SANDBOX / "home")
for _key in ("XDG_DATA_HOME", "XDG_CONFIG_HOME", "XDG_CACHE_HOME"):
os.environ[_key] = str(_SANDBOX / "home" / _key.lower())
+AGENT_STAND_INS = ("claude", "codex", "cursor-agent", "agent", "agy")
+AGENT_CALLS = _SANDBOX / "agent-calls.log"
+AGENT_SHELL = """#!/bin/sh
+login=0; inter=0; script=""
+while [ $# -gt 0 ]; do
+ case "$1" in -l) login=1 ;; -i) inter=1 ;; -c) shift; script="$1" ;; esac
+ shift
+done
+if [ "$login" = 1 ] && [ -f "$HOME/.zprofile-path" ]; then PATH="$(cat "$HOME/.zprofile-path"):$PATH"; fi
+if [ "$inter" = 1 ] && [ -f "$HOME/.zshrc-path" ]; then PATH="$(cat "$HOME/.zshrc-path"):$PATH"; fi
+export PATH
+if [ -n "$script" ]; then exec /bin/sh -c "$script"; fi
+exec /bin/sh
+"""
+_agent_calls: list[str] = []
+if os.name != "nt":
+ for _name in ("bin", "shell"):
+ (_SANDBOX / _name).mkdir()
+ for _name in AGENT_STAND_INS:
+ (_SANDBOX / "bin" / _name).write_text(f'#!/bin/sh\necho "{_name} $*" >> "{AGENT_CALLS}"\nif [ "$1" = "--version" ]; then echo "0.0.0 (stand-in)"; exit 0; fi\nexit 1\n')
+ (_SANDBOX / "bin" / _name).chmod(0o755)
+ (_SANDBOX / "shell" / "zsh").write_text(AGENT_SHELL)
+ (_SANDBOX / "shell" / "zsh").chmod(0o755)
+ os.environ["SHELL"] = str(_SANDBOX / "shell" / "zsh")
+ os.environ["PATH"] = os.pathsep.join([str(_SANDBOX / "bin"), os.environ.get("PATH", "")])
+ for _key in ("NPM_CONFIG_PREFIX", "npm_config_prefix", "PNPM_HOME", "VOLTA_HOME", "BUN_INSTALL", "NVM_SYMLINK"):
+ os.environ.pop(_key, None)
sys.path.insert(0, str(BACKEND))
+@pytest.fixture(autouse=True)
+def only_stand_in_agent_programs(monkeypatch):
+ agent_lookup = importlib.import_module("app.services.agent_lookup")
+ monkeypatch.setattr(agent_lookup, "system_folders", lambda platform=None: [])
+ agent_lookup.forget()
+ yield
+ agent_lookup.forget()
+
+
def pytest_sessionfinish(session, exitstatus):
+ try:
+ _agent_calls.extend(AGENT_CALLS.read_text(encoding="utf-8").splitlines())
+ except OSError:
+ pass
shutil.rmtree(_SANDBOX, ignore_errors=True)
+def pytest_terminal_summary(terminalreporter):
+ terminalreporter.write_line(f"agent program stand-ins started {len(_agent_calls)} time(s): " + (", ".join(sorted(set(_agent_calls))) or "none"))
+
+
def own_origin():
return f"http://127.0.0.1:{ENGINE_PORT}"
@@ -103,10 +156,17 @@ def app():
def client(app):
from fastapi.testclient import TestClient
- with TestClient(app, base_url=own_origin()) as c:
+ with TestClient(app, base_url=own_origin(), headers=window_headers()) as c:
yield c
+@pytest.fixture(scope="session")
+def bare(client, app):
+ from fastapi.testclient import TestClient
+
+ return TestClient(app, base_url=own_origin())
+
+
@pytest.fixture(scope="session")
def repo_versions():
found = {}
diff --git a/backend/tests/test_agents_manifest.py b/backend/tests/test_agents_manifest.py
new file mode 100644
index 0000000..39ef198
--- /dev/null
+++ b/backend/tests/test_agents_manifest.py
@@ -0,0 +1,23 @@
+import json
+import subprocess
+import sys
+
+from conftest import REPO, tool_catalogue
+
+MANIFEST = REPO / "agents" / "manifest.json"
+
+
+def test_the_committed_manifest_is_current():
+ done = subprocess.run([sys.executable, "-I", str(REPO / "setup" / "agents.py"), "sync", "--check"], capture_output=True, text=True, timeout=180)
+ assert done.returncode == 0, done.stdout + done.stderr
+ assert "agents/manifest.json" not in done.stdout
+
+
+def test_the_manifest_lists_the_tools_the_server_lists():
+ doc = json.loads(MANIFEST.read_text(encoding="utf-8"))
+ mcp = doc["mcp"]
+ assert doc["app"] == "formencoder"
+ assert mcp["tools"] == [t["name"] for t in tool_catalogue()]
+ assert set(mcp["read_only"]) <= set(mcp["tools"])
+ assert set(mcp["approval_gated"]) == set(mcp["tools"]) - set(mcp["read_only"])
+ assert mcp["transports"] == ["stdio", "http"]
diff --git a/backend/tests/test_dock_engine.py b/backend/tests/test_dock_engine.py
new file mode 100644
index 0000000..d671f35
--- /dev/null
+++ b/backend/tests/test_dock_engine.py
@@ -0,0 +1,272 @@
+import asyncio
+import json
+import os
+import time
+
+import pytest
+
+from conftest import CHANGING_TOOL, INAPP_HEADER, LOCAL_HEADER, MCP_PATH, window_ticket
+
+LOCAL = {LOCAL_HEADER: "1"}
+POSIX_ONLY = pytest.mark.skipif(os.name == "nt", reason="the stand-ins are shell scripts")
+REFUSED = {"detail": "Only the formencoder window can do this"}
+
+
+@pytest.fixture
+def stand_ins(tmp_path, monkeypatch):
+ folder = tmp_path / "bin"
+ folder.mkdir()
+ for name in ("claude", "codex", "cursor-agent", "agy"):
+ script = folder / name
+ script.write_text(f'#!/bin/sh\nif [ "$1" = "--version" ]; then echo "{name} 9.9.9"; exit 0; fi\n'
+ 'echo "stand-in args=$*"\necho "token-present=${FORMENCODER_AGENT_TOKEN:+yes}"\nread line\n')
+ script.chmod(0o755)
+ monkeypatch.setenv("PATH", f"{folder}{os.pathsep}{os.environ.get('PATH', '')}")
+ return folder
+
+
+@pytest.fixture
+def no_programs(tmp_path, monkeypatch):
+ monkeypatch.setenv("PATH", str(tmp_path))
+
+
+def changing_call(client, token):
+ name, args = CHANGING_TOOL
+ r = client.post(MCP_PATH, json={"jsonrpc": "2.0", "id": 2, "method": "tools/call", "params": {"name": name, "arguments": args, "clientInfo": {"name": "tab-test"}}}, headers={INAPP_HEADER: token})
+ return r.json()["result"]
+
+
+def printed(client, tid, needle, seconds=5.0):
+ end = time.monotonic() + seconds
+ text = ""
+ while time.monotonic() < end and needle not in text:
+ text = client.get(f"/api/terminal/sessions/{tid}/output").json()["text"]
+ time.sleep(0.05)
+ return text
+
+
+def test_a_question_says_when_it_expires_and_every_window_hears_when_it_ends():
+ from app.engine.bus import Bus
+
+ async def run():
+ bus = Bus()
+ one, two = bus.join("ui"), bus.join("ui")
+ before = time.time()
+ expired = await bus.ask_window({"type": "consent", "client": "mcp:x"}, timeout=0.05)
+ asked, same = one.queue.get_nowait(), two.queue.get_nowait()
+ ended = [one.queue.get_nowait(), two.queue.get_nowait()]
+ task = asyncio.create_task(bus.ask_window({"type": "consent", "client": "mcp:x"}, timeout=5))
+ await asyncio.sleep(0.01)
+ again = one.queue.get_nowait()
+ two.queue.get_nowait()
+ assert bus.answer(again["requestId"], {"allow": True})
+ reply = await task
+ return expired, asked, same, before, ended, again, reply, one.queue.get_nowait(), two.queue.get_nowait()
+
+ expired, asked, same, before, ended, again, reply, told_one, told_two = asyncio.run(run())
+ assert expired is None and same == asked
+ assert asked["id"] == str(asked["requestId"]) and asked["expiresIn"] == 0.05 and before <= asked["expiresAt"] <= time.time() + 0.05
+ gone = {"type": "withdrawn", "requestId": asked["requestId"], "id": asked["id"], "of": "consent", "reason": "expired"}
+ assert ended == [gone, gone]
+ assert reply == {"allow": True}
+ answered = {"type": "withdrawn", "requestId": again["requestId"], "id": again["id"], "of": "consent", "reason": "answered"}
+ assert told_one == answered and told_two == answered
+
+
+def test_a_question_that_has_its_own_id_keeps_it():
+ from app.engine.bus import Bus
+
+ async def run():
+ bus = Bus()
+ window = bus.join("ui")
+ await bus.ask_window({"type": "extensions", "id": "some.extension"}, timeout=0.01)
+ return window.queue.get_nowait()
+
+ assert asyncio.run(run())["id"] == "some.extension"
+
+
+def test_the_agent_status_names_each_program_its_version_and_its_install_line(client, bare, stand_ins):
+ assert bare.get("/api/terminal/agents").status_code == 403
+ agents = client.get("/api/terminal/agents").json()["agents"]
+ assert list(agents) == ["claude", "codex", "cursor", "antigravity"]
+ assert agents["codex"] == agents["codex"] | {"installed": True, "path": str(stand_ins / "codex"), "version": "9.9.9", "finding": "runs", "how": "path", "signedIn": None, "title": "Codex", "program": "codex"}
+ assert agents["cursor"]["version"] == "9.9.9" and agents["claude"]["version"] == "9.9.9"
+ assert agents["codex"]["said"] == f"Codex is at {stand_ins / 'codex'} (the engine's PATH)."
+ assert all(a["install"] for a in agents.values())
+
+
+def test_the_agent_status_says_what_is_missing(client, no_programs):
+ agents = client.get("/api/terminal/agents").json()["agents"]
+ for kind in ("claude", "codex", "cursor", "antigravity"):
+ assert agents[kind]["installed"] is False and agents[kind]["path"] is None and agents[kind]["version"] is None and agents[kind]["install"]
+ assert agents[kind]["finding"] == "missing" and agents[kind]["looked"] and "was not found. Looked in:" in agents[kind]["said"]
+ assert client.get("/api/terminal/status").json()["agents"] == {"claude": False, "codex": False, "cursor": False, "antigravity": False}
+
+
+@POSIX_ONLY
+def test_a_program_that_does_not_start_is_found_and_reported_as_broken(client, tmp_path, monkeypatch):
+ folder = tmp_path / "bin"
+ folder.mkdir()
+ script = folder / "codex"
+ script.write_text("#!/bin/sh\necho 'node: not found' >&2\nexit 127\n")
+ script.chmod(0o755)
+ monkeypatch.setenv("PATH", str(folder))
+ codex = client.get("/api/terminal/agents").json()["agents"]["codex"]
+ assert codex == codex | {"installed": False, "path": str(script), "finding": "broken", "error": "node: not found", "version": None}
+ refused = client.post("/api/terminal/tabs", headers=LOCAL, json={"kind": "codex"})
+ assert refused.status_code == 404 and "but does not start: node: not found" in refused.json()["detail"]["message"]
+
+
+@POSIX_ONLY
+def test_a_program_outside_the_engine_path_is_found_in_a_known_folder_and_through_the_shell(client, tmp_path, monkeypatch):
+ home = tmp_path / "home"
+ known, named = home / ".local" / "bin", tmp_path / "elsewhere"
+ for folder, name in ((known, "claude"), (named, "codex")):
+ folder.mkdir(parents=True)
+ script = folder / name
+ script.write_text('#!/bin/sh\nif [ "$1" = "--version" ]; then echo "7.7.7"; exit 0; fi\nread line\n')
+ script.chmod(0o755)
+ (home / ".zshrc-path").write_text(str(named))
+ monkeypatch.setenv("HOME", str(home))
+ monkeypatch.setenv("PATH", "/usr/bin:/bin")
+ agents = client.get("/api/terminal/agents").json()["agents"]
+ assert agents["claude"] == agents["claude"] | {"installed": True, "path": str(known / "claude"), "how": "folder", "version": "7.7.7"}
+ assert agents["codex"] == agents["codex"] | {"installed": True, "path": str(named / "codex"), "how": "shell", "version": "7.7.7"}
+ assert agents["cursor"]["finding"] == "missing"
+
+
+@POSIX_ONLY
+@pytest.mark.parametrize("kind,title", [("claude", "Claude Code"), ("codex", "Codex"), ("cursor", "Cursor"), ("antigravity", "Antigravity")])
+def test_an_agent_tab_runs_the_program_with_its_own_token_which_dies_with_the_tab(client, stand_ins, kind, title):
+ from app.agent import consent
+ from app.routers.terminal import hub
+
+ row = client.post("/api/terminal/tabs", headers=LOCAL, json={"kind": kind, "cols": 80, "rows": 24}).json()
+ assert row == row | {"kind": kind, "title": title, "alive": True, "owned": False}
+ term = hub.terms[row["id"]]
+ token = term.token
+ assert consent.inapp(token) and all(token not in part for part in term.argv)
+ assert "token-present=yes" in printed(client, row["id"], "token-present")
+ assert not changing_call(client, token).get("isError")
+ assert [t["id"] for t in client.get("/api/terminal/tabs").json()["tabs"]] == [row["id"]]
+ assert row["id"] not in [t["id"] for t in hub.listing()]
+ with pytest.raises(KeyError):
+ hub.listed(row["id"])
+ assert client.delete(f"/api/terminal/sessions/{row['id']}", headers=LOCAL).json() == {"closed": row["id"]}
+ assert not consent.inapp(token)
+ assert client.get("/api/terminal/tabs").json()["tabs"] == []
+
+
+@POSIX_ONLY
+def test_an_antigravity_tab_has_its_entry_in_the_workspace_file_until_it_closes(client, stand_ins):
+ from app.agent import consent, workspace
+ from app.routers.terminal import hub
+
+ path = workspace.ensure() / ".agents" / "mcp_config.json"
+ seed = json.dumps({"mcpServers": {"other": {"command": "/bin/true", "args": []}}, "theme": "kept"}, indent=2) + "\n"
+ path.parent.mkdir(parents=True, exist_ok=True)
+ path.write_text(seed, encoding="utf-8")
+ row = client.post("/api/terminal/tabs", headers=LOCAL, json={"kind": "antigravity", "cwd": "/tmp"}).json()
+ term = hub.terms[row["id"]]
+ assert row["kind"] == "antigravity" and term.cwd == str(workspace.root())
+ held = json.loads(path.read_text(encoding="utf-8"))
+ assert list(held["mcpServers"]) == ["other", "formencoder_tab"] and held["theme"] == "kept" and held["mcpServers"]["other"] == {"command": "/bin/true", "args": []}
+ entry = held["mcpServers"]["formencoder_tab"]
+ assert entry["command"] == workspace.mcp_command()[0] and entry["args"] == ["mcp", "--profile", "core"]
+ assert entry["env"]["FORMENCODER_AGENT_TOKEN"] == term.token and consent.inapp(term.token)
+ assert path.stat().st_mode & 0o777 == 0o600
+ token = term.token
+ client.delete(f"/api/terminal/sessions/{row['id']}", headers=LOCAL)
+ assert path.read_text(encoding="utf-8") == seed and not consent.inapp(token)
+
+
+def test_agents_install_adds_formencoder_to_antigravity_and_leaves_a_foreign_entry_alone(tmp_path):
+ from app.agent import connect
+
+ cfg = tmp_path / ".gemini" / "config" / "mcp_config.json"
+ older = tmp_path / ".gemini" / "antigravity-cli" / "mcp_config.json"
+ older.parent.mkdir(parents=True)
+ older.write_text("{}", encoding="utf-8")
+ said: list = []
+ connect.install_antigravity(tmp_path, True, said)
+ assert not cfg.exists() and "an older file was seen" in said[1]
+ connect.install_antigravity(tmp_path, False, said)
+ entry = {"command": connect.launch(), "args": ["mcp", "--profile", "core"]}
+ assert json.loads(cfg.read_text(encoding="utf-8")) == {"mcpServers": {"formencoder": entry}} and older.read_text(encoding="utf-8") == "{}"
+ again: list = []
+ connect.install_antigravity(tmp_path, False, again)
+ assert again == ["Antigravity:", f" MCP server formencoder already in {cfg}"] and sorted(p.name for p in cfg.parent.iterdir()) == ["mcp_config.json"]
+ foreign = json.dumps({"mcpServers": {"formencoder": {"command": "/somewhere/else", "args": ["x"]}, "kept": {"command": "k"}}, "top": 1})
+ cfg.write_text(foreign, encoding="utf-8")
+ left: list = []
+ connect.install_antigravity(tmp_path, False, left)
+ assert cfg.read_text(encoding="utf-8") == foreign and "did not write; left alone" in left[1]
+ cfg.write_text("[1]", encoding="utf-8")
+ unread: list = []
+ connect.install_antigravity(tmp_path, False, unread)
+ assert cfg.read_text(encoding="utf-8") == "[1]" and "is not an MCP servers file" in unread[1]
+ assert list(connect.CLIENTS) == ["claude", "codex", "cursor", "antigravity"] and connect.install(["vim"], True) == ["unknown client vim (claude, codex, cursor or antigravity)"]
+
+
+@POSIX_ONLY
+def test_a_prompt_and_a_resume_id_reach_the_program_as_arguments(client, stand_ins):
+ from app.routers.terminal import hub
+ from app.services import agent_lookup
+
+ row = client.post("/api/terminal/tabs", headers=LOCAL, json={"kind": "claude", "prompt": "make a small file", "resume": "0123abcd-4567"}).json()
+ assert hub.terms[row["id"]].argv == agent_lookup.start_argv([str(stand_ins / "claude"), "--resume", "0123abcd-4567", "make a small file"])
+ assert hub.terms[row["id"]].argv[:3] == [os.environ["SHELL"], "-l", "-c"]
+ assert "args=--resume 0123abcd-4567 make a small file" in printed(client, row["id"], "args=")
+ dashed = client.post("/api/terminal/tabs", headers=LOCAL, json={"kind": "codex", "prompt": "-v"}).json()
+ assert hub.terms[dashed["id"]].argv == agent_lookup.start_argv([str(stand_ins / "codex"), "--", "-v"])
+ assert "args=-- -v" in printed(client, dashed["id"], "args=")
+ for tid in (row["id"], dashed["id"]):
+ client.delete(f"/api/terminal/sessions/{tid}", headers=LOCAL)
+
+
+@POSIX_ONLY
+def test_a_plain_shell_tab_carries_no_token_and_stays_out_of_the_agent_list(client):
+ from app.routers.terminal import hub
+
+ row = client.post("/api/terminal/tabs", headers=LOCAL, json={"kind": "shell"}).json()
+ term = hub.terms[row["id"]]
+ assert row["kind"] == "shell" and term.token is None and term.window
+ assert row["id"] not in [t["id"] for t in client.get("/api/terminal/sessions").json()["sessions"]]
+ client.delete(f"/api/terminal/sessions/{row['id']}", headers=LOCAL)
+
+
+def test_opening_a_tab_refuses_what_it_cannot_start(client, bare, no_programs):
+ assert bare.post("/api/terminal/tabs", headers=LOCAL, json={"kind": "codex"}).json() == REFUSED
+ missing = client.post("/api/terminal/tabs", headers=LOCAL, json={"kind": "codex"})
+ assert missing.status_code == 404 and missing.json()["detail"] == missing.json()["detail"] | {"code": "not_installed", "install": "npm install -g @openai/codex"}
+ assert client.post("/api/terminal/tabs", headers=LOCAL, json={"kind": "vim"}).json()["detail"]["code"] == "unknown_kind"
+ assert client.post("/api/terminal/tabs", headers=LOCAL, json={"kind": "shell", "prompt": "x"}).status_code == 422
+ assert client.post("/api/terminal/tabs", headers=LOCAL, json={"kind": "codex", "resume": "0123abcd-4567"}).status_code == 422
+
+
+@POSIX_ONLY
+def test_the_typed_socket_keeps_control_apart_from_output(client, stand_ins):
+ from app.agent import consent
+ from app.routers.terminal import hub
+
+ row = client.post("/api/terminal/tabs", headers=LOCAL, json={"kind": "codex"}).json()
+ token = hub.terms[row["id"]].token
+ with client.websocket_connect(f"/api/terminal/ws?session={row['id']}&typed=1&cols=80&rows=24&ticket={window_ticket()}") as ws:
+ assert json.loads(ws.receive_bytes()) == {"type": "hello", "id": row["id"], "kind": "codex", "alive": True}
+ ws.send_text("not json")
+ ws.send_text(json.dumps({"type": "resize", "cols": 90, "rows": 30}))
+ ws.send_text(json.dumps({"type": "input", "data": "done\r"}))
+ text, control = "", None
+ while control is None:
+ frame = ws.receive()
+ if frame.get("bytes") is not None:
+ control = json.loads(frame["bytes"])
+ else:
+ text += frame.get("text") or ""
+ assert control == {"type": "exit"} and '{"exit": true}' not in text
+ assert not consent.inapp(token)
+ assert client.get("/api/terminal/tabs").json()["tabs"][0]["alive"] is False
+ client.delete(f"/api/terminal/sessions/{row['id']}", headers=LOCAL)
+ assert json.loads(ws.receive_bytes()) == {"type": "closed"}
+ with client.websocket_connect(f"/api/terminal/ws?session=t0&typed=1&ticket={window_ticket()}") as ws:
+ assert json.loads(ws.receive_bytes()) == {"type": "gone", "id": "t0"}
diff --git a/backend/tests/test_dock_module.py b/backend/tests/test_dock_module.py
new file mode 100644
index 0000000..43d6721
--- /dev/null
+++ b/backend/tests/test_dock_module.py
@@ -0,0 +1,118 @@
+import hashlib
+import importlib.util
+import json
+import re
+import shutil
+
+from conftest import REPO
+
+LOOKUP = "backend/app/services/agent_lookup.py"
+DOCK = REPO / "frontend" / "src" / "dock"
+FRONTEND = REPO / "frontend"
+
+
+def agents():
+ spec = importlib.util.spec_from_file_location("formencoder_agents_sync", REPO / "setup" / "agents.py")
+ module = importlib.util.module_from_spec(spec)
+ spec.loader.exec_module(module)
+ return module
+
+
+def test_the_dock_folder_matches_its_manifest():
+ assert agents().dock_problems() == []
+
+
+def test_a_changed_missing_or_extra_dock_file_is_named(tmp_path):
+ copy = tmp_path / "dock"
+ shutil.copytree(DOCK, copy)
+ (copy / "keys.ts").write_text((copy / "keys.ts").read_text(encoding="utf-8") + "\n", encoding="utf-8")
+ (copy / "dom.ts").unlink()
+ (copy / "mine.ts").write_text("import { api } from '../engine/client';\n", encoding="utf-8")
+ problems = agents().dock_problems(copy)
+ assert "keys.ts differs from MANIFEST.json" in problems
+ assert "dom.ts is missing" in problems
+ assert "mine.ts is extra" in problems
+ assert "mine.ts imports ../engine/client from outside the dock folder" in problems
+
+
+def test_the_agent_manifest_describes_the_dock():
+ dock = json.loads((REPO / "agents" / "manifest.json").read_text(encoding="utf-8"))["dock"]
+ assert dock == {"present": True, "positions": ["left", "right", "bottom", "floating"], "tabs": ["shell", "claude", "codex", "cursor", "antigravity"]}
+ adapter = (FRONTEND / "src" / "dock-adapter.ts").read_text(encoding="utf-8")
+ assert "builtin: ['shell', 'claude', 'codex', 'cursor', 'antigravity']" in adapter and "DockAdapter" in adapter
+
+
+def test_the_dialog_offers_only_what_the_engine_sends():
+ adapter = (FRONTEND / "src" / "dock-adapter.ts").read_text(encoding="utf-8")
+ assert "(['deny', 'once', 'always'] as ConsentChoice[]).filter((choice) => answers.includes(choice))" in adapter
+ assert "remember: choice === 'deny' ? 'none' : choice" in adapter
+ assert "mode: 'hosted'" in adapter
+
+
+def test_the_old_terminal_panel_is_gone():
+ assert not (FRONTEND / "src" / "panels" / "terminal.ts").exists()
+ for path in (FRONTEND / "src").rglob("*"):
+ if path.is_file() and path.suffix in (".ts", ".css") and DOCK not in path.parents:
+ text = path.read_text(encoding="utf-8")
+ assert "fx-term" not in text and "askConsent" not in text, path.name
+
+
+def test_a_waiting_question_is_sent_again_to_a_window_that_connects():
+ import asyncio
+
+ from app.engine.bus import Bus
+
+ async def run():
+ bus = Bus()
+ bus.join("ui")
+ asked = asyncio.create_task(bus.ask_window({"type": "consent", "agent": "probe"}, timeout=5))
+ await asyncio.sleep(0)
+ waiting = bus.waiting()
+ assert len(waiting) == 1 and waiting[0]["type"] == "consent" and waiting[0]["id"] == str(waiting[0]["requestId"])
+ assert bus.answer(waiting[0]["requestId"], {"allow": False})
+ assert await asked == {"allow": False}
+ assert bus.waiting() == []
+
+ asyncio.run(run())
+
+
+def test_the_workspace_names_its_entry_for_tabs(tmp_path, monkeypatch):
+ from app.agent import workspace
+
+ assert workspace.TAB_ENTRY == "formencoder_tab"
+ monkeypatch.setenv("FORMENCODER_DATA_DIR", str(tmp_path))
+ workspace.ensure()
+ base = workspace.root()
+ assert list(json.loads((base / ".mcp.json").read_text(encoding="utf-8"))["mcpServers"]) == ["formencoder_tab"]
+ assert list(json.loads((base / ".cursor" / "mcp.json").read_text(encoding="utf-8"))["mcpServers"]) == ["formencoder_tab"]
+ assert "[mcp_servers.formencoder_tab]" in (base / ".codex" / "config.toml").read_text(encoding="utf-8")
+
+
+def finder_version():
+ return re.search(r'^VERSION = "([^"]+)"$', (REPO / LOOKUP).read_text(encoding="utf-8"), re.M).group(1)
+
+
+def test_the_shared_finder_matches_the_hash_recorded_for_its_version():
+ module = agents()
+ assert module.LOOKUP_HASHES[finder_version()] == hashlib.sha256((REPO / LOOKUP).read_bytes()).hexdigest()
+ assert module.lookup_problems() == []
+
+
+def test_the_check_names_the_shared_finder_edited_in_place_or_missing(tmp_path, monkeypatch):
+ module = agents()
+ copy = tmp_path / "repo"
+ (copy / "backend" / "app" / "services").mkdir(parents=True)
+ shutil.copy(REPO / LOOKUP, copy / LOOKUP)
+ monkeypatch.setattr(module, "ROOT", copy)
+ monkeypatch.setattr(module, "LOOKUP", copy / LOOKUP)
+ assert module.lookup_problems() == []
+ with open(copy / LOOKUP, "a", encoding="utf-8") as f:
+ f.write("\n")
+ assert module.lookup_problems() == [f"{LOOKUP}: does not match the hash recorded for version {finder_version()} (the shared finder changes only as a whole new version)"]
+ (copy / LOOKUP).unlink()
+ assert module.lookup_problems() == [f"{LOOKUP}: missing (the shared finder for the agent programs)"]
+
+
+def test_the_shared_finder_imports_nothing_from_the_app():
+ imports = set(re.findall(r"^\s*(?:from|import)\s+([\w.]+)", (REPO / LOOKUP).read_text(encoding="utf-8"), re.M))
+ assert imports == {"__future__", "dataclasses", "os", "pathlib", "re", "shutil", "signal", "subprocess", "sys", "threading", "time", "winreg"}
diff --git a/backend/tests/test_f2_consent.py b/backend/tests/test_f2_consent.py
index 62c21ba..bdeac87 100644
--- a/backend/tests/test_f2_consent.py
+++ b/backend/tests/test_f2_consent.py
@@ -75,12 +75,57 @@ def test_blocked_policy_still_refuses_with_a_wrong_token(client):
assert call(client, CHANGING_TOOL, {INAPP_HEADER: "wrong-token"})["result"].get("isError")
-def test_allowed_policy_lets_a_changing_tool_through(client):
- set_policy("allowed")
+@pytest.mark.parametrize("value", ["allow", "ALLOW", " allow ", "1", "true", "yes", "", "ask", "nonsense"])
+def test_only_deny_changes_the_policy_and_everything_else_asks(client, monkeypatch, value):
+ monkeypatch.setenv("FORMENCODER_AGENTS", value)
reply = call(client, CHANGING_TOOL)
- assert not refused(reply, "no_window")
- assert not refused(reply, "blocked")
- assert not reply["result"].get("isError")
+ assert refused(reply, "no_window")
+ assert reply["result"].get("isError")
+
+
+def test_unset_variable_asks(client, monkeypatch):
+ monkeypatch.delenv("FORMENCODER_AGENTS", raising=False)
+ assert refused(call(client, CHANGING_TOOL), "no_window")
+
+
+@pytest.mark.parametrize("value", ["deny", "DENY", " deny "])
+def test_deny_in_any_spelling_blocks(client, monkeypatch, value):
+ monkeypatch.setenv("FORMENCODER_AGENTS", value)
+ assert refused(call(client, CHANGING_TOOL), "blocked")
+
+
+def test_deny_blocks_an_agent_the_person_allowed_always(client, monkeypatch):
+ from app.agent import consent
+
+ monkeypatch.setattr(consent, "_session", {"family-test-agent"})
+ monkeypatch.setattr(consent, "_always", lambda: {"family-test-agent"})
+ assert not call(client, CHANGING_TOOL)["result"].get("isError")
+ set_policy("blocked")
+ reply = call(client, CHANGING_TOOL)
+ assert refused(reply, "blocked") and reply["result"].get("isError")
+
+
+def test_allow_value_does_not_override_the_stored_choice_or_the_window(client, monkeypatch):
+ monkeypatch.setenv("FORMENCODER_AGENTS", "allow")
+ asked = with_window(monkeypatch, {"allow": False})
+ reply = call(client, CHANGING_TOOL)
+ assert len(asked) == 1 and "declined" in text_of(reply)
+
+
+def test_allow_value_still_honours_a_stored_allow(client, monkeypatch):
+ from app.agent import consent
+
+ monkeypatch.setenv("FORMENCODER_AGENTS", "allow")
+ monkeypatch.setattr(consent, "_always", lambda: {"family-test-agent"})
+ assert not call(client, CHANGING_TOOL)["result"].get("isError")
+
+
+def test_policy_function_reports_only_ask_or_deny(monkeypatch):
+ from app.core import config
+
+ for value, expected in [("allow", "ask"), ("deny", "deny"), ("", "ask"), ("Deny", "deny"), ("x", "ask")]:
+ monkeypatch.setenv("FORMENCODER_AGENTS", value)
+ assert config.agents_policy() == expected
def test_inapp_token_skips_the_ask(client):
@@ -89,9 +134,11 @@ def test_inapp_token_skips_the_ask(client):
assert not reply["result"].get("isError")
-def test_inapp_token_skips_a_blocked_policy(client):
+def test_blocked_policy_stops_an_inapp_token_too_and_still_lets_it_read(client):
set_policy("blocked")
- assert not refused(call(client, CHANGING_TOOL, {INAPP_HEADER: inapp_token()}), "blocked")
+ token = inapp_token()
+ assert refused(call(client, CHANGING_TOOL, {INAPP_HEADER: token}), "blocked")
+ assert not call(client, READ_TOOL, {INAPP_HEADER: token})["result"].get("isError")
@pytest.mark.parametrize("token", ["", "wrong-token", "x" * 64])
@@ -122,3 +169,23 @@ def test_decline_of_one_agent_does_not_block_another(client, monkeypatch):
assert call(client, CHANGING_TOOL, agent="agent-one")["result"].get("isError")
with_window(monkeypatch, {"allow": True})
assert not call(client, CHANGING_TOOL, agent="agent-two")["result"].get("isError")
+
+
+@pytest.mark.parametrize("answer", [{"allow": True, "remember": "once"}, {"allow": True, "once": True}])
+def test_allow_once_runs_this_call_and_the_next_one_asks_again(client, monkeypatch, answer):
+ from app.agent import consent
+
+ asked = with_window(monkeypatch, answer)
+ first = call(client, CHANGING_TOOL)
+ second = call(client, CHANGING_TOOL)
+ assert not first["result"].get("isError") and not second["result"].get("isError")
+ assert len(asked) == 2
+ assert consent.state()["session"] == [] and consent.state()["always"] == []
+
+
+def test_the_question_says_who_asks_for_what_and_which_answers_there_are(client, monkeypatch):
+ asked = with_window(monkeypatch, {"allow": False})
+ call(client, CHANGING_TOOL, agent="Some-Agent")
+ name, _ = CHANGING_TOOL
+ assert asked[0] == asked[0] | {"type": "consent", "client": "mcp:Some-Agent", "detail": name, "agent": "Some-Agent", "what": f"use the {name} tool",
+ "answers": ["deny", "once", "session", "always"], "alwaysScope": "agent"}
diff --git a/backend/tests/test_ffmpeg_fetch.py b/backend/tests/test_ffmpeg_fetch.py
new file mode 100644
index 0000000..a8837f8
--- /dev/null
+++ b/backend/tests/test_ffmpeg_fetch.py
@@ -0,0 +1,106 @@
+import hashlib
+import http.server
+import io
+import tarfile
+import threading
+
+import pytest
+
+GOOD = b"#!/bin/sh\necho pinned\n"
+
+
+def archive(content):
+ buf = io.BytesIO()
+ with tarfile.open(fileobj=buf, mode="w:gz") as t:
+ info = tarfile.TarInfo("build/ffmpeg")
+ info.size = len(content)
+ t.addfile(info, io.BytesIO(content))
+ return buf.getvalue()
+
+
+@pytest.fixture
+def served(tmp_path, monkeypatch):
+ from app import ffmpeg_fetch
+
+ routes, hits = {}, []
+
+ class Handler(http.server.BaseHTTPRequestHandler):
+ def do_GET(self):
+ hits.append(self.path.split("/")[1])
+ body = routes.get(self.path)
+ self.send_response(200 if body is not None else 404)
+ self.end_headers()
+ if body is not None:
+ self.wfile.write(body)
+
+ def log_message(self, *args):
+ pass
+
+ server = http.server.ThreadingHTTPServer(("127.0.0.1", 0), Handler)
+ threading.Thread(target=server.serve_forever, daemon=True).start()
+ base = f"http://127.0.0.1:{server.server_address[1]}"
+ triple = ffmpeg_fetch.host_triple()
+ record = {"release": "7.1.5-2", "targets": {triple: {"files": [{"path": "ffmpeg", "sha256": hashlib.sha256(GOOD).hexdigest()}]}}}
+ monkeypatch.setattr(ffmpeg_fetch, "record", lambda: record)
+ monkeypatch.setattr(ffmpeg_fetch, "SOURCES", (base + "/formai", base + "/formcut"))
+ monkeypatch.setattr(ffmpeg_fetch, "user_folder", lambda: tmp_path / "ffmpeg")
+ monkeypatch.delenv("FORMENCODER_FFMPEG_RELEASE", raising=False)
+ name = f"/ffmpeg-7.1.5-2/ffmpeg-lgpl-7.1.5-2-{triple}.tar.gz"
+ yield {"routes": routes, "hits": hits, "base": base, "name": name, "folder": tmp_path / "ffmpeg"}
+ server.shutdown()
+
+
+def test_the_new_address_comes_first_and_the_old_one_second(monkeypatch):
+ from app import ffmpeg_fetch
+
+ monkeypatch.delenv("FORMENCODER_FFMPEG_RELEASE", raising=False)
+ urls = ffmpeg_fetch.sources({"release": "7.1.5-2"}, "x86_64-unknown-linux-gnu")
+ assert urls == [
+ "https://github.com/nodemode-dev/formai-binaries/releases/download/ffmpeg-7.1.5-2/ffmpeg-lgpl-7.1.5-2-x86_64-unknown-linux-gnu.tar.gz",
+ "https://github.com/nodemode-dev/formcut-binaries/releases/download/ffmpeg-7.1.5-2/ffmpeg-lgpl-7.1.5-2-x86_64-unknown-linux-gnu.tar.gz",
+ ]
+
+
+def test_the_override_is_the_only_address(monkeypatch):
+ from app import ffmpeg_fetch
+
+ monkeypatch.setenv("FORMENCODER_FFMPEG_RELEASE", "https://mirror.example/ffmpeg-7.1.5-2/")
+ assert ffmpeg_fetch.sources({"release": "7.1.5-2"}, "t") == ["https://mirror.example/ffmpeg-7.1.5-2/ffmpeg-lgpl-7.1.5-2-t.tar.gz"]
+
+
+def test_wrong_bytes_from_the_first_address_fall_back_to_the_second(served):
+ from app import ffmpeg_fetch
+
+ served["routes"]["/formai" + served["name"]] = archive(b"other bytes\n")
+ served["routes"]["/formcut" + served["name"]] = archive(GOOD)
+ out = ffmpeg_fetch.fetch(lambda p, m: None)
+ assert served["hits"] == ["formai", "formcut"] and "/formcut/" in out["source"]
+ assert (served["folder"] / "ffmpeg").read_bytes() == GOOD
+
+
+def test_a_missing_first_address_falls_back_to_the_second(served):
+ from app import ffmpeg_fetch
+
+ served["routes"]["/formcut" + served["name"]] = archive(GOOD)
+ assert "/formcut/" in ffmpeg_fetch.fetch(lambda p, m: None)["source"]
+
+
+def test_nothing_is_installed_when_no_address_matches(served):
+ from app import ffmpeg_fetch
+
+ served["routes"]["/formai" + served["name"]] = archive(b"x\n")
+ served["routes"]["/formcut" + served["name"]] = archive(b"y\n")
+ with pytest.raises(ValueError) as caught:
+ ffmpeg_fetch.fetch(lambda p, m: None)
+ assert (served["base"] + "/formai") in str(caught.value) and (served["base"] + "/formcut") in str(caught.value)
+ assert not (served["folder"] / "ffmpeg").exists()
+
+
+def test_with_the_override_set_the_built_in_addresses_are_not_tried(served, monkeypatch):
+ from app import ffmpeg_fetch
+
+ served["routes"]["/formcut" + served["name"]] = archive(GOOD)
+ monkeypatch.setenv("FORMENCODER_FFMPEG_RELEASE", served["base"] + "/mirror/ffmpeg-7.1.5-2")
+ with pytest.raises(ValueError):
+ ffmpeg_fetch.fetch(lambda p, m: None)
+ assert served["hits"] == ["mirror"]
diff --git a/backend/tests/test_local_paths.py b/backend/tests/test_local_paths.py
new file mode 100644
index 0000000..649a269
--- /dev/null
+++ b/backend/tests/test_local_paths.py
@@ -0,0 +1,119 @@
+import json
+import shutil
+import socket
+import threading
+
+import pytest
+
+pytestmark = pytest.mark.skipif(shutil.which("ffmpeg") is None, reason="ffmpeg is not installed")
+
+ADDRESSES = [
+ "tcp://127.0.0.1:{port}/out.mkv",
+ "udp://127.0.0.1:{port}/out.mkv",
+ "http://127.0.0.1:{port}/out.mp4",
+ "rtmp://127.0.0.1:{port}/live/out",
+ "ftp://127.0.0.1:{port}/out.mp4",
+ "pipe:1",
+ "file:{tmp}/via-file-scheme.mp4",
+]
+
+
+class Listener:
+ def __init__(self):
+ self.sock = socket.socket()
+ self.sock.bind(("127.0.0.1", 0))
+ self.sock.listen(8)
+ self.sock.settimeout(0.1)
+ self.port = self.sock.getsockname()[1]
+ self.connections = 0
+ self.stop = threading.Event()
+ self.thread = threading.Thread(target=self.loop, daemon=True)
+ self.thread.start()
+
+ def loop(self):
+ while not self.stop.is_set():
+ try:
+ conn, _ = self.sock.accept()
+ except OSError:
+ continue
+ self.connections += 1
+ conn.close()
+
+ def close(self):
+ self.stop.set()
+ self.thread.join(2)
+ self.sock.close()
+
+
+@pytest.fixture
+def listener():
+ held = Listener()
+ yield held
+ held.close()
+
+
+def add(d, clip, **output):
+ return d.run("queue.addSource", paths=[str(clip)], outputs=[{"preset": "system/match-source-high", **output}])["output"]
+
+
+@pytest.mark.parametrize("template", ADDRESSES)
+def test_an_output_that_is_an_address_is_refused_when_it_is_set(driver, clip2, tmp_path, listener, template):
+ d = driver()
+ path = template.format(port=listener.port, tmp=tmp_path)
+ message = d.refuses("queue.addSource", paths=[str(clip2)], outputs=[{"preset": "system/match-source-high", "path": path}])
+ assert "not a file path on this computer" in message
+ assert listener.connections == 0
+ assert d.run("queue.list")["items"] == []
+
+
+def test_an_output_folder_that_is_an_address_is_refused_and_no_folder_is_made(driver, clip2, tmp_path, listener, monkeypatch):
+ monkeypatch.chdir(tmp_path)
+ d = driver()
+ assert "not a file path on this computer" in d.refuses("queue.addSource", paths=[str(clip2)], preset="system/match-source-high", folder=f"http://127.0.0.1:{listener.port}/dir")
+ oid = add(d, clip2, folder=str(tmp_path / "out"))
+ assert "not a file path on this computer" in d.refuses("queue.setOutput", refs=[oid], folder=f"tcp://127.0.0.1:{listener.port}/dir")
+ assert "not a file path on this computer" in d.refuses("queue.setOutput", refs=[oid], path="pipe:1")
+ assert listener.connections == 0
+ assert sorted(p.name for p in tmp_path.iterdir() if p.name != "data") == []
+
+
+def test_a_stored_output_folder_that_is_an_address_fails_the_job_and_connects_nowhere(driver, clip2, tmp_path, listener, monkeypatch):
+ monkeypatch.chdir(tmp_path)
+ d = driver()
+ d.run("prefs.set", values={"outputFolder": f"tcp://127.0.0.1:{listener.port}/dir"})
+ oid = d.run("queue.addSource", paths=[str(clip2)], preset="system/match-source-high")["output"]
+ d.run("queue.start")
+ row = d.finish(oid)
+ assert row["status"] == "failed"
+ assert "not a file path on this computer" in row["error"]
+ assert listener.connections == 0
+ assert not (tmp_path / "tcp:").exists()
+
+
+def test_plain_paths_still_encode_and_are_written_at_an_absolute_path(driver, clip2, tmp_path, monkeypatch):
+ monkeypatch.chdir(tmp_path)
+ d = driver()
+ wanted = {
+ "absolute": (str(tmp_path / "plain.mp4"), tmp_path / "plain.mp4"),
+ "relative": ("rel/out.mp4", tmp_path / "rel" / "out.mp4"),
+ "dash": ("-an.mp4", tmp_path / "-an.mp4"),
+ }
+ ids = {name: add(d, clip2, path=given) for name, (given, _) in wanted.items()}
+ d.run("queue.start")
+ for name, (_, expect) in wanted.items():
+ row = d.finish(ids[name])
+ assert row["status"] == "done", (name, row)
+ assert row["path"] == str(expect)
+ assert expect.is_file()
+
+
+def test_an_input_that_is_an_address_is_refused_and_nothing_is_fetched(driver, tmp_path, listener):
+ import fe_core
+
+ d = driver()
+ for pattern in ("http://127.0.0.1:{port}/x.mp4", "http://127.0.0.1:{port}/f_%06d.png", "tcp://127.0.0.1:{port}/f_%06d.png"):
+ given = pattern.format(port=listener.port)
+ assert "not a file on this computer" in d.refuses("queue.addSource", paths=[given], preset="system/match-source-high")
+ info = json.loads(fe_core.probe(given))
+ assert "not a file on this computer" in info["error"]
+ assert listener.connections == 0
diff --git a/backend/tests/test_seal.py b/backend/tests/test_seal.py
new file mode 100644
index 0000000..e38a3d0
--- /dev/null
+++ b/backend/tests/test_seal.py
@@ -0,0 +1,102 @@
+import json
+
+import pytest
+
+keyring = pytest.importorskip("keyring")
+from keyring.backend import KeyringBackend
+
+
+class Memory(KeyringBackend):
+ priority = 1
+
+ def __init__(self):
+ super().__init__()
+ self.store = {}
+
+ def get_password(self, service, username):
+ return self.store.get((service, username))
+
+ def set_password(self, service, username, password):
+ self.store[(service, username)] = password
+
+ def delete_password(self, service, username):
+ self.store.pop((service, username), None)
+
+
+class Missing(KeyringBackend):
+ priority = 1
+
+ def get_password(self, service, username):
+ raise RuntimeError("no keychain")
+
+ def set_password(self, service, username, password):
+ raise RuntimeError("no keychain")
+
+ def delete_password(self, service, username):
+ raise RuntimeError("no keychain")
+
+
+@pytest.fixture
+def sealed(tmp_path, monkeypatch):
+ from app.core import seal
+
+ monkeypatch.setenv("FORMENCODER_DATA_DIR", str(tmp_path))
+ before = keyring.get_keyring()
+ keyring.set_keyring(Memory())
+ seal.reset()
+ yield tmp_path
+ keyring.set_keyring(before)
+ seal.reset()
+
+
+def test_choices_the_window_makes_are_sealed_and_stand(sealed):
+ from app.agent import approvals, consent
+
+ consent._remember("claude")
+ approvals.set_full_faith(True)
+ assert consent.state()["seal"] == "ok" and consent.state()["always"] == ["claude"]
+ assert approvals.full_faith() is True
+
+
+def test_a_client_added_by_hand_is_caught_and_treated_as_ask(sealed):
+ from app.agent import consent
+
+ consent._remember("claude")
+ stored = json.loads((sealed / "agents.json").read_text())
+ stored["allowed"].append("intruder")
+ (sealed / "agents.json").write_text(json.dumps(stored))
+ state = consent.state()
+ assert state["sealBroken"] is True and state["always"] == []
+
+
+def test_full_faith_written_by_hand_is_ignored(sealed):
+ from app.agent import approvals
+
+ (sealed / "approvals.json").write_text(json.dumps({"fullFaith": True}))
+ assert approvals.seal_state() == "broken" and approvals.full_faith() is False
+
+
+def test_safe_values_without_a_seal_are_not_reported_broken(sealed):
+ from app.agent import consent
+
+ (sealed / "agents.json").write_text(json.dumps({"allowed": []}))
+ assert consent.state()["sealBroken"] is False
+
+
+def test_without_a_keychain_the_stored_values_stand(tmp_path, monkeypatch):
+ from app.agent import approvals, consent
+ from app.core import seal
+
+ monkeypatch.setenv("FORMENCODER_DATA_DIR", str(tmp_path))
+ before = keyring.get_keyring()
+ keyring.set_keyring(Missing())
+ seal.reset()
+ try:
+ (tmp_path / "agents.json").write_text(json.dumps({"allowed": ["claude"]}))
+ state = consent.state()
+ assert state["seal"] == "unavailable" and state["always"] == ["claude"]
+ approvals.set_full_faith(False)
+ assert json.loads((tmp_path / "approvals.json").read_text()) == {"fullFaith": False}
+ finally:
+ keyring.set_keyring(before)
+ seal.reset()
diff --git a/backend/tests/test_window_key.py b/backend/tests/test_window_key.py
new file mode 100644
index 0000000..878f4f7
--- /dev/null
+++ b/backend/tests/test_window_key.py
@@ -0,0 +1,138 @@
+import json
+import re
+
+import pytest
+from starlette.websockets import WebSocketDisconnect
+
+from conftest import ENGINE_PORT, LOCAL_HEADER, inapp_token, window_ticket
+
+READS = {"GET", "HEAD", "OPTIONS"}
+OPEN = {("POST", "/mcp"), ("POST", "/api/window/key"), ("POST", "/api/rpc"), ("POST", "/api/family/hooks/formcut")}
+LOOPBACK = {"host": f"127.0.0.1:{ENGINE_PORT}"}
+REFUSED = {"detail": "Only the formencoder window can do this"}
+
+
+def write_operations(app):
+ return [(m.upper(), path) for path, item in app.openapi()["paths"].items() for m in item if m.upper() not in READS]
+
+
+def test_the_open_list_is_short_and_named():
+ from app.core import window_key
+
+ assert set(window_key.OPEN) == {path for _, path in OPEN}
+
+
+def test_every_write_route_needs_the_window_key(app, bare):
+ ops = write_operations(app)
+ assert len(ops) >= 15
+ answered = []
+ for method, path in ops:
+ if (method, path) in OPEN:
+ continue
+ url = re.sub(r"\{[^}]+\}", "x", path)
+ for headers in ({LOCAL_HEADER: "1"}, {LOCAL_HEADER: "1", "x-formencoder-window-key": "x" * 43}):
+ r = bare.request(method, url, json={}, headers=headers)
+ if r.status_code != 403 or r.json() != REFUSED:
+ answered.append(f"{method} {path} {r.status_code}")
+ assert not answered, "write routes that answer without the window key (add the key, or name the route in window_key.OPEN with its caller): " + ", ".join(answered)
+
+
+def test_the_window_key_lets_the_window_write(client, tmp_path):
+ r = client.post("/api/fs/mkdir", json={"path": str(tmp_path / "made")}, headers={LOCAL_HEADER: "1"})
+ assert r.status_code == 200 and (tmp_path / "made").is_dir()
+
+
+def test_the_bootstrap_answers_once_then_refuses(bare, monkeypatch):
+ from app.core import window_key
+
+ monkeypatch.setitem(window_key.STATE, "claimed", False)
+ monkeypatch.setitem(window_key.STATE, "secondClaim", False)
+ first = bare.post("/api/window/key", headers={LOCAL_HEADER: "1"})
+ assert first.status_code == 200 and first.json()["key"] == window_key.KEY
+ again = bare.post("/api/window/key", headers={LOCAL_HEADER: "1"})
+ assert again.status_code == 409 and window_key.KEY not in again.text
+ assert bare.get("/api/system").json()["secondWindowClaim"] is True
+
+
+def test_the_bootstrap_does_not_exist_when_the_shell_holds_the_key(bare, monkeypatch):
+ monkeypatch.setenv("FORMENCODER_WINDOW_KEY_STDOUT", "1")
+ assert bare.post("/api/window/key", headers={LOCAL_HEADER: "1"}).status_code == 404
+
+
+def test_a_ticket_needs_the_key_and_works_once(client, bare):
+ assert bare.post("/api/window/ticket", headers={LOCAL_HEADER: "1"}).status_code == 403
+ from app.core import window_key
+
+ ticket = client.post("/api/window/ticket", headers={LOCAL_HEADER: "1"}).json()["ticket"]
+ assert window_key.spend(ticket) is True
+ assert window_key.spend(ticket) is False
+
+
+def _ask(ws, method, params=None):
+ ws.send_text(json.dumps({"jsonrpc": "2.0", "id": 7, "method": method, "params": params or {}}))
+ while True:
+ got = ws.receive_json()
+ if got.get("id") == 7:
+ return got
+
+
+@pytest.mark.parametrize("method,params", [("agents.fullFaith", {"on": True}), ("agents.decide", {"id": 1, "allow": True}), ("agents.approvals", {}), ("command.execute", {"command": "app.capabilities", "params": {}})])
+def test_a_socket_without_a_ticket_has_no_rights(bare, method, params):
+ from app.agent import approvals
+ from app.engine.host import host
+
+ with bare.websocket_connect("/api/live?kind=ui", headers=LOOPBACK) as ws:
+ assert ws.receive_json()["type"] == "hello"
+ assert not host.bus.windows()
+ assert _ask(ws, method, params)["error"]["message"] == REFUSED["detail"]
+ assert approvals.full_faith() is False
+
+
+def test_a_socket_with_a_ticket_is_the_window(bare):
+ from app.engine.host import host
+
+ with bare.websocket_connect(f"/api/live?kind=ui&ticket={window_ticket()}", headers=LOOPBACK) as ws:
+ assert ws.receive_json()["type"] == "hello"
+ assert len(host.bus.windows()) == 1
+ assert "result" in _ask(ws, "agents.approvals")
+
+
+def test_the_terminal_socket_needs_a_ticket(bare):
+ with pytest.raises(WebSocketDisconnect):
+ with bare.websocket_connect("/api/terminal/ws?cols=80&rows=24", headers=LOOPBACK) as ws:
+ ws.receive_text()
+
+
+def test_each_window_terminal_has_its_own_token_and_it_dies_with_the_terminal():
+ from app.agent import consent
+ from app.routers.terminal import _environment
+
+ env = _environment("http://127.0.0.1:1", None)
+ assert "FORMENCODER_AGENT_TOKEN" not in env
+ token = consent.issue()
+ assert consent.inapp(token)
+ consent.revoke(token)
+ assert not consent.inapp(token)
+ assert not consent.inapp(inapp_token() + "x")
+
+
+def test_a_terminal_an_agent_opens_carries_no_token(client):
+ import asyncio
+
+ from app.agent import consent
+ from app.routers.terminal import hub
+
+ async def run():
+ before = set(consent.TOKENS)
+ term = hub.open("probe", None, 80, 24, "http://127.0.0.1:1")
+ try:
+ assert term.token is None and set(consent.TOKENS) == before
+ finally:
+ hub.close(term.id)
+ window = hub.open("window", None, 80, 24, "http://127.0.0.1:1", trusted=True)
+ token = window.token
+ assert consent.inapp(token)
+ hub.close(window.id)
+ assert not consent.inapp(token)
+
+ asyncio.run(run())
diff --git a/backend/tests/test_window_prefs.py b/backend/tests/test_window_prefs.py
new file mode 100644
index 0000000..8b31a54
--- /dev/null
+++ b/backend/tests/test_window_prefs.py
@@ -0,0 +1,45 @@
+import pytest
+
+from conftest import LOCAL_HEADER, set_policy
+
+MESSAGE = "Only the person, in the formencoder window (Preferences), can change"
+
+
+@pytest.fixture
+def allowed(monkeypatch):
+ from app.agent import consent
+
+ set_policy("ask")
+ monkeypatch.setattr(consent, "_session", {"cli", "ui"})
+ yield
+ set_policy("ask")
+
+
+def rpc(client, method, params, source="cli"):
+ return client.post("/api/rpc", json={"jsonrpc": "2.0", "id": 1, "method": method, "params": params}, headers={LOCAL_HEADER: "1", "x-formencoder-source": source}).json()
+
+
+@pytest.mark.parametrize("values", [{"ffmpegDir": "/tmp/formencoder-elsewhere"}, {"incrementNames": False}, {"rawDecoders": [{"extensions": ["r3d"], "command": "/bin/true"}]}, {"cacheFolder": "/tmp"}])
+def test_agents_cannot_change_window_only_preferences(client, allowed, values):
+ out = rpc(client, "command.execute", {"command": "prefs.set", "params": {"values": values}})
+ assert MESSAGE in out["error"]["message"]
+ batch = rpc(client, "command.batch", {"steps": [{"command": "prefs.set", "params": {"values": values}}]})
+ assert MESSAGE in batch["error"]["message"]
+
+
+def test_a_source_naming_itself_ui_is_still_an_agent(client, allowed):
+ out = rpc(client, "command.execute", {"command": "prefs.set", "params": {"values": {"incrementNames": False}}}, source="ui")
+ assert MESSAGE in out["error"]["message"]
+
+
+def test_agents_can_still_change_other_preferences(client, allowed):
+ out = rpc(client, "command.execute", {"command": "prefs.set", "params": {"values": {"chime": True}}})
+ assert out["result"]["prefs"]["chime"] is True
+
+
+def test_the_window_can_change_them():
+ from app.engine import rpc as engine_rpc
+
+ engine_rpc.window_only("prefs.set", {"values": {"incrementNames": False, "ffmpegDir": ""}}, "ui")
+ with pytest.raises(engine_rpc.RpcError):
+ engine_rpc.window_only("prefs.set", {"values": {"ffmpegDir": ""}}, "mcp:agent")
diff --git a/demo/README.md b/demo/README.md
index 6494fb2..5f3bdb0 100644
--- a/demo/README.md
+++ b/demo/README.md
@@ -11,7 +11,7 @@ Everything it needs (scripts, styles, fonts, the icon) is inside this folder. No
## What it shows
-The interface is the real one: the Studio Dark tokens, the fifteen theme profiles, the dock, the Queue, Preset Browser, Media Info, Encoding and Log panels, the inline icon set and the Export Settings idiom, all imported from `frontend/src/`. The engine behind it is a small TypeScript one written for the browser.
+The interface is the real one: the Studio Dark tokens, the sixteen theme profiles, the dock, the Queue, Preset Browser, Media Info, Encoding and Log panels, the inline icon set and the Export Settings idiom, all imported from `frontend/src/`. The engine behind it is a small TypeScript one written for the browser.
It opens on four real sources with ten outputs ready to run: three Pexels sea clips with different frame rates and sizes (1280x720 at 29.97 fps, 1280x720 at 25 fps, a vertical 404x720 at 59.94 fps) and a 21 s public-domain LibriVox reading. The outputs include WebM, a GIF of each clip, a still, and the reading normalised to -16 LUFS as Ogg Opus beside a broadcast WAV. The files are in `media/` as JavaScript data packs (a page opened from `file://` cannot fetch local files), loaded when the page starts into rows that are already in the Queue; authors, source pages and licences are in `CREDITS.md`. If a pack fails to load, the built-in generated sample takes its place. Drop your own video or audio file on the window, press the plus in the Queue, or use Open File; the film icon adds the generated sample.
diff --git a/demo/assets/demo.js b/demo/assets/demo.js
index d7351ef..5af73cc 100644
--- a/demo/assets/demo.js
+++ b/demo/assets/demo.js
@@ -10,7 +10,7 @@
- `),this.areas=Object.fromEntries(ne.map(e=>[e,this.el.querySelector(`[data-area="${e}"]`)]));for(let e of Array.from(this.el.querySelectorAll(`.fx-split`)))this.bindSplit(e);window.addEventListener(`resize`,()=>this.resized())}register(e,t,n){this.factories.set(e,n),this.titles.set(e,t)}titleOf(e){return this.titles.get(e)??e}panelIds(){return[...this.factories.keys()]}peek(e){return this.made.get(e)}panel(e){let t=this.made.get(e);if(!t){let n=this.factories.get(e);if(!n)return;t=n(),t.el.classList.add(`fx-panel`),t.el.dataset.panel=e,t.el.dataset.automationId=`panel.${e}`,this.made.set(e,t)}return t}bindSplit(e){let t=e.dataset.split;e.addEventListener(`pointerdown`,r=>{r.preventDefault(),e.setPointerCapture(r.pointerId),n(e,`is-dragging`,!0);let i={x:r.clientX,y:r.clientY,l:this.layout.leftW,r:this.layout.rightW,b:this.layout.bottomH},a=e=>{t===`left`&&(this.layout.leftW=Math.max(160,Math.min(900,i.l+e.clientX-i.x))),t===`right`&&(this.layout.rightW=Math.max(160,Math.min(1100,i.r-(e.clientX-i.x)))),t===`bottom`&&(this.layout.bottomH=Math.max(120,Math.min(window.innerHeight-220,i.b-(e.clientY-i.y)))),this.applySizes()},o=()=>{n(e,`is-dragging`,!1),e.removeEventListener(`pointermove`,a),e.removeEventListener(`pointerup`,o),this.save()};e.addEventListener(`pointermove`,a),e.addEventListener(`pointerup`,o)})}applySizes(){let e=this.groups.left.length?this.layout.leftW:0,t=this.groups.right.length?this.layout.rightW:0,r=this.groups.bottom.length?this.layout.bottomH:0;this.el.style.setProperty(`--fx-left`,`${e}px`),this.el.style.setProperty(`--fx-right`,`${t}px`),this.el.style.setProperty(`--fx-bottom`,`${r}px`),n(this.el,`no-left`,!e),n(this.el,`no-right`,!t),n(this.el,`no-bottom`,!r);for(let e of te){let t=this.groups[e],n=t.reduce((e,t)=>e+t.size,0)||1;for(let e of t)e.el.style.flex=`${e.size/n} 1 0`}this.resized()}resized(){for(let e of this.made.values())e.el.hidden||e.resized?.()}applyLayout(e,t){this.workspace=t,this.layout=structuredClone(e);for(let t of ne){for(let e of this.groups[t]){for(let t of e.panels){let e=this.made.get(t);e&&(e.el.hidden=!0,e.hidden?.())}e.el.remove()}this.groups[t]=[];let n=(t===`float`?e.float:e[t])??[];for(let e of n){let n=new re(this,t);n.size=e.size??1,e.w!==void 0&&(n.rect={x:e.x??120,y:e.y??90,w:e.w,h:e.h??340}),this.areas[t].appendChild(n.el),this.groups[t].push(n);for(let t of e.panels)this.factories.has(t)&&n.add(t,!1);t===`float`&&!n.panels.length?(n.el.remove(),this.groups[t].pop()):(n.activate(e.active&&e.panels.includes(e.active)?e.active:n.panels[0]),t===`float`&&n.place())}}this.applySizes(),this.onWorkspace?.(t)}load(){let e=`Default`,t=null;try{let n=localStorage.getItem(T);if(n){let r=JSON.parse(n);e=r.workspace||`Default`,t=r.layouts?.[e]??null}}catch{t=null}this.applyLayout(t??w[e]??w.Default,e)}snapshot(){let e={left:[],center:[],right:[],bottom:[],leftW:this.layout.leftW,rightW:this.layout.rightW,bottomH:this.layout.bottomH};for(let t of[`left`,`center`,`right`,`bottom`])e[t]=this.groups[t].map(e=>({panels:[...e.panels],active:e.active,size:e.size}));return e.float=this.groups.float.map(e=>({panels:[...e.panels],active:e.active,...e.rect})),e}save(){try{let e=localStorage.getItem(T),t=e?JSON.parse(e):{};t.workspace=this.workspace,t.layouts={...t.layouts||{},[this.workspace]:this.snapshot()},localStorage.setItem(T,JSON.stringify(t))}catch{return}}savedNames(){try{let e=JSON.parse(localStorage.getItem(T)||`{}`);return Object.keys(e.custom||{})}catch{return[]}}switchTo(e){let t=null;try{let n=JSON.parse(localStorage.getItem(T)||`{}`);t=n.layouts?.[e]??n.custom?.[e]??null}catch{t=null}this.applyLayout(t??w[e]??w.Default,e),this.save()}resetWorkspace(){this.applyLayout(w[this.workspace]??w.Default,this.workspace),this.save()}saveAs(e){try{let t=JSON.parse(localStorage.getItem(T)||`{}`);t.custom={...t.custom||{},[e]:this.snapshot()},localStorage.setItem(T,JSON.stringify(t))}catch{return}this.workspace=e,this.save(),this.onWorkspace?.(e)}find(e){for(let t of ne)for(let n of this.groups[t])if(n.panels.includes(e))return n}home(e){let t=e===`essential`?this.find(`effectsPresets`):void 0;if(t&&t.area!==`float`)return t;let n=e===`composition`?`center`:[`timeline`,`renderQueue`,`terminal`,`agents`,`graph`,`flowchart`].includes(e)?`bottom`:`right`;return this.groups[n][0]??this.groups.right[0]??this.groups.bottom[0]??this.groups.center[0]}show(e){if(!this.factories.has(e))return;let t=this.find(e);if(!t){if(t=this.home(e),!t)return;t.add(e,!0),this.applySizes()}t.activate(e),this.focus(e)}undock(e){let t=this.find(e);if(!t||t.area===`float`)return;let n=this.el.getBoundingClientRect(),r=new re(this,`float`),i=this.groups.float.length;r.rect={x:Math.max(0,n.width/2-260+i*28),y:Math.max(0,n.height/2-200+i*28),w:520,h:400},this.areas.float.appendChild(r.el),this.groups.float.push(r),r.place(),this.move(e,r),this.focus(e)}redock(e){let t=this.find(e);if(!t||t.area!==`float`)return;let n=this.home(e);n?this.move(e,n):this.close(e)}isVisible(e){let t=this.made.get(e);return!!t&&!t.el.hidden}close(e){let t=this.find(e);t&&(t.remove(e),t.panels.length||(t.el.remove(),this.groups[t.area]=this.groups[t.area].filter(e=>e!==t),this.applySizes()),this.save())}move(e,t){let n=this.find(e);n!==t&&(n?.remove(e),n&&!n.panels.length&&(n.el.remove(),this.groups[n.area]=this.groups[n.area].filter(e=>e!==n)),t.add(e,!0),this.applySizes(),this.save())}raise(e){let t=this.groups.float;e.area===`float`&&t[t.length-1]!==e&&(this.groups.float=[...t.filter(t=>t!==e),e],this.groups.float.forEach((e,t)=>e.el.style.zIndex=String(t+1)))}maximize(e){e.area!==`float`&&(this.maximized===e?(this.maximized=null,n(this.el,`is-maximized`,!1),n(e.el,`is-max`,!1)):(this.maximized&&n(this.maximized.el,`is-max`,!1),this.maximized=e,n(this.el,`is-maximized`,!0),n(e.el,`is-max`,!0)),this.resized())}toggleMaximizeFocused(){let e=this.find(this.focused);e&&this.maximize(e)}focused=`queue`;focus(e){if(!e||this.focused===e)return;let t=this.find(this.focused);t&&n(t.el,`is-focused`,!1),this.focused=e;let r=this.find(e);r&&n(r.el,`is-focused`,!0),this.onFocus?.(e)}},E={studio:{label:`Studio Dark`,vars:{"--bg-primary":`#111111`,"--bg-secondary":`#17151b`,"--bg-tertiary":`#222127`,"--border-color":`#2a2a2a`,"--border-light":`#34333a`,"--text-primary":`#f7f7f7`,"--text-secondary":`#a4a4a4`,"--text-muted":`#717072`,"--canvas-bg":`#1c1b1d`,"--grid-color":`#5e5e60`,"--bg-node":`#191919`}},"nodemode-dark":{label:`NodeMode Dark`,vars:{"--bg-primary":`#0a0a0a`,"--bg-secondary":`#121218`,"--bg-tertiary":`#1a1a24`,"--border-color":`#2a2a35`,"--border-light":`#3a3a48`,"--text-primary":`#e8e8ee`,"--text-secondary":`#a8a8b8`,"--text-muted":`#6a6a7a`,"--canvas-bg":`#0a0a0a`,"--grid-color":`rgba(255,255,255,0.04)`,"--node-shadow":`0 6px 18px rgba(0,0,0,0.45)`}},light:{label:`Light`,light:!0,vars:{"--bg-primary":`#ecebe6`,"--bg-secondary":`#f7f6f1`,"--bg-tertiary":`#e2e0d8`,"--bg-node":`#f4f3ed`,"--border-color":`#d1cdc1`,"--border-light":`#beb9aa`,"--text-primary":`#26241d`,"--text-secondary":`#4c4a40`,"--text-muted":`#8b887a`,"--canvas-bg":`#e7e5dd`,"--grid-color":`rgba(70,60,30,0.10)`,"--node-shadow":`0 5px 14px rgba(96,90,70,0.15)`}},"github-dark":{label:`GitHub Dark`,vars:{"--bg-primary":`#0d1117`,"--bg-secondary":`#161b22`,"--bg-tertiary":`#21262d`,"--border-color":`#30363d`,"--border-light":`#3d444d`,"--text-primary":`#e6edf3`,"--text-secondary":`#9198a1`,"--text-muted":`#656c76`,"--canvas-bg":`#0d1117`,"--grid-color":`rgba(230,237,243,0.05)`,"--node-shadow":`0 6px 18px rgba(0,0,0,0.5)`}},midnight:{label:`Midnight Blue`,vars:{"--bg-primary":`#0b1020`,"--bg-secondary":`#101830`,"--bg-tertiary":`#182242`,"--border-color":`#25325c`,"--border-light":`#324274`,"--text-primary":`#e4e9f7`,"--text-secondary":`#9fabd0`,"--text-muted":`#63709a`,"--canvas-bg":`#0b1020`,"--grid-color":`rgba(160,180,255,0.06)`,"--node-shadow":`0 8px 22px rgba(0,0,20,0.55)`}},forest:{label:`Forest`,vars:{"--bg-primary":`#0c130e`,"--bg-secondary":`#121c15`,"--bg-tertiary":`#1a281e`,"--border-color":`#2a4030`,"--border-light":`#375441`,"--text-primary":`#e4efe7`,"--text-secondary":`#a4bdac`,"--text-muted":`#6a8674`,"--canvas-bg":`#0c130e`,"--grid-color":`rgba(180,230,190,0.05)`,"--node-shadow":`0 6px 18px rgba(0,10,0,0.5)`}},ember:{label:`Ember`,vars:{"--bg-primary":`#140d0a`,"--bg-secondary":`#1d1310`,"--bg-tertiary":`#2a1c16`,"--border-color":`#452e22`,"--border-light":`#5a3d2e`,"--text-primary":`#f2e8e2`,"--text-secondary":`#c7ab9c`,"--text-muted":`#8f7263`,"--canvas-bg":`#140d0a`,"--grid-color":`rgba(255,200,160,0.05)`,"--node-shadow":`0 6px 18px rgba(20,5,0,0.55)`}},violet:{label:`Violet Haze`,vars:{"--bg-primary":`#100b1c`,"--bg-secondary":`#171129`,"--bg-tertiary":`#221a3c`,"--border-color":`#382c5e`,"--border-light":`#493b78`,"--text-primary":`#ece6f9`,"--text-secondary":`#b3a6d8`,"--text-muted":`#7a6da3`,"--canvas-bg":`#100b1c`,"--grid-color":`rgba(210,190,255,0.06)`,"--node-shadow":`0 8px 22px rgba(10,0,30,0.55)`}},slate:{label:`Slate`,vars:{"--bg-primary":`#101418`,"--bg-secondary":`#171d23`,"--bg-tertiary":`#212a32`,"--border-color":`#32404c`,"--border-light":`#415260`,"--text-primary":`#e7edf2`,"--text-secondary":`#a3b2bf`,"--text-muted":`#6b7a87`,"--canvas-bg":`#101418`,"--grid-color":`rgba(200,220,240,0.05)`,"--node-shadow":`0 6px 18px rgba(0,5,10,0.5)`}},mono:{label:`Mono Ink`,vars:{"--bg-primary":`#0e0e0e`,"--bg-secondary":`#161616`,"--bg-tertiary":`#202020`,"--border-color":`#333333`,"--border-light":`#454545`,"--text-primary":`#f0f0f0`,"--text-secondary":`#ababab`,"--text-muted":`#6e6e6e`,"--canvas-bg":`#0e0e0e`,"--grid-color":`rgba(255,255,255,0.05)`,"--node-shadow":`0 6px 18px rgba(0,0,0,0.5)`}},sand:{label:`Sand (light)`,light:!0,vars:{"--bg-primary":`#efe8da`,"--bg-secondary":`#f8f3e9`,"--bg-tertiary":`#e6dcc8`,"--bg-node":`#f5efe2`,"--border-color":`#d4c7ab`,"--border-light":`#c2b28e`,"--text-primary":`#2a2418`,"--text-secondary":`#59503c`,"--text-muted":`#8d8168`,"--canvas-bg":`#eae2d1`,"--grid-color":`rgba(80,60,10,0.10)`,"--node-shadow":`0 5px 14px rgba(100,80,30,0.16)`}},ocean:{label:`Deep Ocean`,vars:{"--bg-primary":`#06131c`,"--bg-secondary":`#0a1c29`,"--bg-tertiary":`#10293c`,"--border-color":`#1d425e`,"--border-light":`#285578`,"--text-primary":`#e2eef7`,"--text-secondary":`#96b6cc`,"--text-muted":`#5b7d94`,"--canvas-bg":`#06131c`,"--grid-color":`rgba(150,210,255,0.06)`,"--node-shadow":`0 8px 22px rgba(0,10,20,0.6)`}},rose:{label:`Rose Noir`,vars:{"--bg-primary":`#170b10`,"--bg-secondary":`#211117`,"--bg-tertiary":`#301a22`,"--border-color":`#4d2b38`,"--border-light":`#653a49`,"--text-primary":`#f5e7ec`,"--text-secondary":`#cfa5b3`,"--text-muted":`#966b7b`,"--canvas-bg":`#170b10`,"--grid-color":`rgba(255,190,215,0.05)`,"--node-shadow":`0 6px 18px rgba(25,0,10,0.55)`}},terminal:{label:`Terminal Green`,vars:{"--bg-primary":`#050d05`,"--bg-secondary":`#0a140a`,"--bg-tertiary":`#102010`,"--border-color":`#1f3d1f`,"--border-light":`#2b522b`,"--text-primary":`#d8f5d8`,"--text-secondary":`#8fce8f`,"--text-muted":`#568a56`,"--canvas-bg":`#050d05`,"--grid-color":`rgba(120,255,120,0.06)`,"--node-shadow":`0 6px 18px rgba(0,10,0,0.6)`}},contrast:{label:`High Contrast`,vars:{"--bg-primary":`#000000`,"--bg-secondary":`#0a0a0a`,"--bg-tertiary":`#161616`,"--border-color":`#555555`,"--border-light":`#777777`,"--text-primary":`#ffffff`,"--text-secondary":`#d8d8d8`,"--text-muted":`#9a9a9a`,"--canvas-bg":`#000000`,"--grid-color":`rgba(255,255,255,0.10)`,"--node-shadow":`0 0 0 1px #666`}}},ae=`studio`,oe=`#f2545b`,se=`formencoder_ui_settings`,ce=e=>typeof e==`number`&&Number.isFinite(e)?Math.min(1.5,Math.max(0,e)):1;function le(){try{let e=localStorage.getItem(se);if(e){let t=JSON.parse(e);return{theme:t.theme&&E[t.theme]?t.theme:ae,accentColor:t.accentColor||`#f2545b`,intensity:ce(t.intensity)}}}catch(e){console.error(`[theme] read failed:`,e)}return{theme:ae,accentColor:oe,intensity:1}}function ue(e){try{let t=localStorage.getItem(se),n={...t?JSON.parse(t):{},...e,appearance:1};localStorage.setItem(se,JSON.stringify(n))}catch(e){console.error(`[theme] save failed:`,e)}}function de(e=le()){let t=document.documentElement,n=E[e.theme]||E.studio;for(let[e,r]of Object.entries(n.vars))t.style.setProperty(e,r);document.body.classList.toggle(`theme-light`,!!n.light),t.style.setProperty(`--bg-node`,n.vars[`--bg-node`]||n.vars[`--bg-secondary`]),t.style.setProperty(`--shadow-lg`,n.light?`0 4px 14px rgba(96, 90, 70, 0.16)`:`0 8px 32px rgba(0, 0, 0, 0.5)`),t.style.setProperty(`--accent-color`,e.accentColor),t.style.setProperty(`--accent-color-dim`,e.accentColor+`33`),t.style.setProperty(`--accent-color-hover`,`color-mix(in srgb, ${e.accentColor} 82%, #ffffff)`),t.style.setProperty(`--accent-intensity`,String(ce(e.intensity))),t.style.setProperty(`--accent-tint`,pe(e.accentColor,.06)),t.style.setProperty(`--accent-tint-strong`,pe(e.accentColor,.1))}function fe(e){let t={...le(),theme:e};ue(t),de(t),document.dispatchEvent(new CustomEvent(`nm:ui-settings-changed`,{detail:{key:`theme`}}))}function pe(e,t){let n=e.replace(`#`,``),r=n.length===3?n.split(``).map(e=>e+e).join(``):n,i=parseInt(r.slice(0,6),16);return Number.isNaN(i)?`rgba(171,160,211,${t})`:`rgba(${i>>16&255},${i>>8&255},${i&255},${t})`}var me=`0.8.4`;function he(e,t){let n=(e,t)=>e>>16-t*8&255,r=Array.from(e.keys()),i=[{lo:0,hi:r.length}],a=r,o=t=>{let r=0,i=-1;for(let o=0;o<3;o++){let s=255,c=0;for(let r=t.lo;rc&&(c=t)}c-s>i&&(i=c-s,r=o)}return{c:r,span:i}};for(;i.length{if(e.hi-e.lo<2)return;let i=o(e),a=i.span*Math.sqrt(e.hi-e.lo);a>r&&(r=a,t=n,s=i.c)}),t<0)break;let c=i[t],l=a.slice(c.lo,c.hi).sort((t,r)=>n(e[t],s)-n(e[r],s));for(let e=0;e>1);i.splice(t,1,{lo:c.lo,hi:u},{lo:u,hi:c.hi})}let s=new Uint8Array(768);return i.forEach((t,r)=>{let i=0,o=0,c=0,l=Math.max(1,t.hi-t.lo);for(let r=t.lo;r{for(a|=e<=8;)t.push(a&255),a>>>=8,o-=8};s(256);let c=e[0];for(let t=1;t1<0&&t.push(a&255),Uint8Array.from(t)}var ve=class{width;height;parts=[];constructor(e,t){this.width=e,this.height=t;let n=new Uint8Array(13),r=new DataView(n.buffer);n.set(new TextEncoder().encode(`GIF89a`),0),r.setUint16(6,e,!0),r.setUint16(8,t,!0),n[10]=0,n[11]=0,n[12]=0,this.parts.push(n),this.parts.push(Uint8Array.from([33,255,11,...new TextEncoder().encode(`NETSCAPE2.0`),3,1,0,0,0]))}addFrame(e,t){let n=this.width*this.height,r=Math.max(1,Math.floor(n/12e3)),i=[];for(let t=0;t{let r=e>>3<<10|t>>3<<5|n>>3,i=o.get(r);if(i!==void 0)return i;let s=e>>3<<3|4,c=t>>3<<3|4,l=n>>3<<3|4,u=0,d=1/0;for(let e=0;e<256;e++){let t=a[e*3]-s,n=a[e*3+1]-c,r=a[e*3+2]-l,i=t*t*2+n*n*4+r*r*3;i>8&255,0,0]));let l=new Uint8Array(10),u=new DataView(l.buffer);l[0]=44,u.setUint16(5,this.width,!0),u.setUint16(7,this.height,!0),l[9]=135,this.parts.push(l),this.parts.push(a),this.parts.push(Uint8Array.from([8]));let d=_e(c);for(let e=0;ee>0?-.691+10*Math.log10(e):-1/0;function Ce(e,t){if(!e.length)return-1/0;let n=(e.length-1)*t,r=Math.floor(n),i=Math.min(e.length-1,r+1);return e[r]+(e[i]-e[r])*(n-r)}function we(e,t){let n=[];for(let r=0;r+t<=e.length;r++){let i=0;for(let n=0;n=e.length)continue;let o=i-n,s=Math.abs(o)<1e-9?1:Math.sin(Math.PI*o)/(Math.PI*o),c=.5+.5*Math.cos(Math.PI*o/9);r+=e[a]*s*c}return r}function Ee(e){let t=0;for(let n of e)for(let e=0;et&&(t=r)}let n=t,r=t*.55;for(let t of e)for(let e=0;en&&(n=i)}return{sample:t,truePeak:n}}function De(e,t){let n=e=>e>0?20*Math.log10(e):-1/0,r=e[0]?.length??0,i=Ee(e),a=Math.round(t*.1),o=Math.floor(r/a),s=Se(e.length),c=new Float64Array(o);e.forEach((e,n)=>{if(!s[n])return;let r=xe(e,t);for(let e=0;eD(e)>-70),d=-1/0;if(u.length){let e=D(u.reduce((e,t)=>e+t,0)/u.length)-10,t=l.filter(t=>D(t)>-70&&D(t)>e);t.length&&(d=D(t.reduce((e,t)=>e+t,0)/t.length))}let f=we(c,30).filter(e=>D(e)>-70),p=0,m=-1/0;if(f.length){let e=D(f.reduce((e,t)=>e+t,0)/f.length)-20,t=f.map(D).filter(t=>t>e).sort((e,t)=>e-t);t.length&&(p=Ce(t,.95)-Ce(t,.1),m=t[t.length-1])}return{integrated:d,lra:p,samplePeak:n(i.sample),truePeak:n(i.truePeak),shortTermMax:m}}function Oe(e){return Number.isFinite(e)?e.toFixed(1):`-inf`}function O(e){return`${Oe(e.integrated)} LUFS, LRA ${e.lra.toFixed(1)} LU, peak ${Oe(e.truePeak)} dBTP`}function ke(e,t,n=-1){if(!Number.isFinite(e.integrated))return{gainDb:0,limited:!1};let r=t-e.integrated,i=n-e.truePeak;return Number.isFinite(i)&&r>i?{gainDb:i,limited:!0}:{gainDb:r,limited:!1}}function k(e){let t=0;for(let n of e)t+=n.length;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function Ae(e){let t=[],n=e;for(;n>0;)t.unshift(n&255),n=Math.floor(n/256);return Uint8Array.from(t)}function je(e){let t=1;for(;t<8&&e>=2**(7*t)-1;)t++;let n=new Uint8Array(t),r=e;for(let e=t-1;e>=0;e--)n[e]=r%256,r=Math.floor(r/256);return n[0]|=1<<8-t,n}function A(e,t){return k([Ae(e),je(t.length),t])}function j(e,t){let n=[],r=t;do n.unshift(r%256),r=Math.floor(r/256);while(r>0);return A(e,Uint8Array.from(n))}function Me(e,t){let n=new Uint8Array(8);return new DataView(n.buffer).setFloat64(0,t,!1),A(e,n)}function M(e,t){return A(e,new TextEncoder().encode(t))}function Ne(e){let t=new Uint8Array(19),n=new DataView(t.buffer);return t.set(new TextEncoder().encode(`OpusHead`),0),t[8]=1,t[9]=e.channels,n.setUint16(10,e.preSkip,!0),n.setUint32(12,e.sampleRate,!0),n.setInt16(16,0,!0),t[18]=0,t}function Pe(e){return Ne(e)}function Fe(e,t,n,r){let i=A(440786851,k([j(17030,1),j(17143,1),j(17138,4),j(17139,8),M(17026,`webm`),j(17031,4),j(17029,2)])),a=A(357149030,k([j(2807729,1e6),Me(17545,r),M(19840,`formencoder demo`),M(22337,`formencoder demo`)])),o=[];e&&o.push(A(174,k([j(215,1),j(29637,1),j(131,1),j(156,0),M(134,e.codec),A(224,k([j(176,e.width),j(186,e.height)]))]))),t&&o.push(A(174,k([j(215,2),j(29637,2),j(131,2),j(156,0),M(134,`A_OPUS`),j(22186,Math.round(t.preSkip/48e3*1e9)),j(22203,8e7),A(25506,Ne(t)),A(225,k([Me(181,t.sampleRate),j(159,t.channels)]))])));let s=A(374648427,k(o)),c=[...n].sort((e,t)=>e.timeMs-t.timeMs||e.track-t.track),l=[],u=[],d=a.length+s.length,f=[],p=0,m=!1,h=()=>{if(!m)return;let e=A(524531317,k([j(231,Math.round(p)),...f]));l.push(e),d+=e.length,f=[],m=!1};for(let e of c){let t=Math.round(e.timeMs),n=t-Math.round(p);(!m||e.track===1&&e.key&&n>0||n>3e4)&&(h(),p=t,m=!0,e.track===1&&e.key&&u.push({timeMs:t,offset:d}));let r=new Uint8Array(4);r[0]=128|e.track,new DataView(r.buffer).setInt16(1,t-Math.round(p),!1),r[3]=e.key?128:0,f.push(A(163,k([r,e.data])))}h();let g=u.length?A(475249515,k(u.map(e=>A(187,k([j(179,e.timeMs),A(183,k([j(247,1),j(241,e.offset)]))]))))):new Uint8Array,_=A(408125543,k([a,s,...l,g]));return new Blob([i,_],{type:`video/webm`})}var Ie=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t<<24;for(let e=0;e<8;e++)n=n&2147483648?n<<1^79764919:n<<1;e[t]=n>>>0}return e})();function Le(e){let t=0;for(let n=0;n>>24^e[n])&255])>>>0;return t>>>0}function Re(e,t,n,r,i,a=!1){let o=[];for(let t of e){let e=t.length;for(;e>=255;)o.push(255),e-=255;o.push(e)}let s=e.reduce((e,t)=>e+t.length,0),c=new Uint8Array(27+o.length+s),l=new DataView(c.buffer);c.set(new TextEncoder().encode(`OggS`),0),c[4]=0,c[5]=t|+!!a,l.setBigUint64(6,BigInt(n),!0),l.setUint32(14,r,!0),l.setUint32(18,i,!0),c[26]=o.length,c.set(o,27);let u=27+o.length;for(let t of e)c.set(t,u),u+=t.length;return l.setUint32(22,Le(c),!0),c}function ze(e,t,n,r){let i=1178947139,a=[],o=Pe({sampleRate:r,channels:t,preSkip:n}),s=new TextEncoder().encode(`formencoder demo`),c=new Uint8Array(12+s.length+4),l=new DataView(c.buffer);c.set(new TextEncoder().encode(`OpusTags`),0),l.setUint32(8,s.length,!0),c.set(s,12),l.setUint32(12+s.length,0,!0),a.push(Re([o],2,0,i,0)),a.push(Re([c],0,0,i,1));let u=2,d=n,f=[],p=e.length;return e.forEach((e,t)=>{f.push(e),d+=e.samples;let n=t===p-1;(f.length>=40||n)&&(a.push(Re(f.map(e=>e.data),n?4:0,d,i,u++)),f=[])}),new Blob(a,{type:`audio/ogg`})}function Be(e,t){let n=t===16?32767:8388607,r=Math.max(-1,Math.min(1,e));return Math.round(r<0?r*(n+1):r*n)}function Ve(e,t,n){let r=e[0]?.length??0,i=e.length,a=n/8,o=r*i*a,s=new ArrayBuffer(44+o),c=new DataView(s),l=(e,t)=>{for(let n=0;n>8&255),c.setUint8(u+2,i>>16&255)),u+=a}return new Blob([s],{type:`audio/wav`})}function He(e,t,n){let r=e[0]?.length??0,i=e.length,a=n/8,o=r*i*a,s=new ArrayBuffer(54+o),c=new DataView(s),l=(e,t)=>{for(let n=0;n>16&255),c.setUint8(d+1,i>>8&255),c.setUint8(d+2,i&255)),d+=a}return new Blob([s],{type:`audio/aiff`})}var Ue=[[`match-source-high`,`Match Source - High bitrate`,`Web Video`,`h264`,null,null,null,20],[`match-source-medium`,`Match Source - Medium bitrate`,`Web Video`,`h264`,null,null,null,10],[`match-source-adaptive-high`,`Match Source - Adaptive High Bitrate`,`Web Video`,`h264`,null,null,null,null],[`hevc-match-source-high`,`HEVC Match Source - High bitrate`,`Web Video`,`hevc`,null,null,null,14],[`hevc-4k-hdr10`,`HEVC 4K HDR10 (Rec. 2100 PQ)`,`Web Video`,`hevc`,3840,2160,null,40],[`av1-match-source`,`AV1 Match Source`,`Web Video`,`av1`,null,null,null,null],[`webm-vp9-1080p`,`WebM VP9 1080p`,`Web Video`,`webm`,1920,1080,null,null],[`webm-vp9-alpha`,`WebM VP9 with Alpha`,`Web Video`,`webm`,null,null,null,null],[`youtube-1080p`,`YouTube 1080p Full HD`,`Social Media`,`h264`,1920,1080,null,16],[`youtube-1440p`,`YouTube 1440p 2K QHD`,`Social Media`,`h264`,2560,1440,null,24],[`youtube-2160p`,`YouTube 2160p 4K UHD`,`Social Media`,`h264`,3840,2160,null,45],[`youtube-shorts`,`YouTube Shorts 1080x1920`,`Social Media`,`h264`,1080,1920,null,16],[`vimeo-1080p`,`Vimeo 1080p Full HD`,`Social Media`,`h264`,1920,1080,null,20],[`vimeo-2160p`,`Vimeo 2160p 4K UHD`,`Social Media`,`h264`,3840,2160,null,50],[`x-1080p`,`X (Twitter) 1080p`,`Social Media`,`h264`,1920,1080,null,8],[`instagram-reels`,`Instagram Reels and Stories 1080x1920`,`Social Media`,`h264`,1080,1920,30,10],[`instagram-feed-square`,`Instagram Feed 1080x1080`,`Social Media`,`h264`,1080,1080,30,8],[`tiktok`,`TikTok 1080x1920`,`Social Media`,`h264`,1080,1920,null,10],[`facebook-1080p`,`Facebook 1080p`,`Social Media`,`h264`,1920,1080,null,10],[`linkedin-1080p`,`LinkedIn 1080p`,`Social Media`,`h264`,1920,1080,30,8],[`apple-tv-4k`,`Apple TV 4K (HEVC)`,`Devices`,`hevc`,3840,2160,null,25],[`iphone-1080p`,`Apple iPhone and iPad 1080p`,`Devices`,`h264`,1920,1080,null,10],[`android-1080p`,`Android Phone and Tablet 1080p`,`Devices`,`h264`,1920,1080,null,10],[`android-720p`,`Android Phone 720p`,`Devices`,`h264`,1280,720,null,5],[`prores-proxy`,`Apple ProRes 422 Proxy`,`Mezzanine`,`prores`,null,null,null,null],[`prores-lt`,`Apple ProRes 422 LT`,`Mezzanine`,`prores`,null,null,null,null],[`prores-422`,`Apple ProRes 422`,`Mezzanine`,`prores`,null,null,null,null],[`prores-hq`,`Apple ProRes 422 HQ`,`Mezzanine`,`prores`,null,null,null,null],[`prores-4444`,`Apple ProRes 4444`,`Mezzanine`,`prores`,null,null,null,null],[`prores-4444-alpha`,`Apple ProRes 4444 with Alpha`,`Mezzanine`,`prores`,null,null,null,null],[`prores-4444xq`,`Apple ProRes 4444 XQ`,`Mezzanine`,`prores`,null,null,null,null],[`dnxhr-lb`,`DNxHR LB`,`Mezzanine`,`quicktime`,null,null,null,null],[`dnxhr-sq`,`DNxHR SQ`,`Mezzanine`,`quicktime`,null,null,null,null],[`dnxhr-hq`,`DNxHR HQ`,`Mezzanine`,`quicktime`,null,null,null,null],[`dnxhr-hqx`,`DNxHR HQX 10-bit`,`Mezzanine`,`quicktime`,null,null,null,null],[`dnxhr-444`,`DNxHR 444 10-bit`,`Mezzanine`,`quicktime`,null,null,null,null],[`cineform-high`,`GoPro CineForm YUV 10-bit`,`Mezzanine`,`cineform`,null,null,null,null],[`cineform-alpha`,`GoPro CineForm RGBA 12-bit with Alpha`,`Mezzanine`,`cineform`,null,null,null,null],[`animation-alpha`,`QuickTime Animation with Alpha`,`Mezzanine`,`quicktime`,null,null,null,null],[`uncompressed-10bit`,`Uncompressed 10-bit 4:2:2 (v210)`,`Mezzanine`,`quicktime`,null,null,null,null],[`xdcam-hd422-1080i50`,`XDCAM HD 422 1080i 25 (50 Mb/s)`,`Broadcast`,`mxf_op1a`,1920,1080,25,null],[`xdcam-hd422-1080i5994`,`XDCAM HD 422 1080i 29.97 (50 Mb/s)`,`Broadcast`,`mxf_op1a`,1920,1080,29.97,null],[`xdcam-hd422-720p50`,`XDCAM HD 422 720p 50 (50 Mb/s)`,`Broadcast`,`mxf_op1a`,1280,720,50,null],[`dnxhr-hq-mxf`,`DNxHR HQ MXF OP1a`,`Broadcast`,`dnxhr_mxf`,null,null,null,null],[`dnxhd-145-mxf`,`DNxHD 145 MXF OP1a 1080`,`Broadcast`,`dnxhr_mxf`,1920,1080,null,null],[`prores-hq-mxf`,`Apple ProRes 422 HQ MXF OP1a`,`Broadcast`,`prores_mxf`,null,null,null,null],[`jpeg2000-mxf`,`JPEG 2000 MXF OP1a`,`Broadcast`,`jpeg2000_mxf`,null,null,null,null],[`mpeg2-1080i`,`MPEG-2 1080i 29.97 Broadcast`,`Broadcast`,`mpeg2`,1920,1080,29.97,25],[`h264-broadcast-ebu`,`H.264 Broadcast, EBU R128 loudness`,`Broadcast`,`h264`,1920,1080,null,30],[`h264-broadcast-atsc`,`H.264 Broadcast, ATSC A/85 loudness`,`Broadcast`,`h264`,1920,1080,null,30],[`mpeg2-dvd-ntsc`,`NTSC DV Widescreen DVD`,`DVD`,`mpeg2_dvd`,720,480,29.97,6],[`bluray-mpeg2-1080i`,`Blu-ray MPEG-2 1080i 29.97`,`DVD`,`mpeg2_bluray`,1920,1080,29.97,25],[`bluray-h264-1080p24`,`Blu-ray H.264 1080p 23.976`,`DVD`,`h264_bluray`,1920,1080,23.976,25],[`as10-high-hd-1080i50`,`AS-10 HIGH_HD_2014 1080i 25`,`Broadcast`,`as10`,null,null,25,null],[`as10-high-hd-1080i5994`,`AS-10 HIGH_HD_2014 1080i 29.97`,`Broadcast`,`as10`,null,null,29.97,null],[`as11-mpeg2-1080i50`,`AS-11 OP1a MPEG-2 HD422 1080i 25`,`Broadcast`,`as11`,null,null,25,null],[`as11-d10-imx50-625`,`AS-11 D10 IMX 50 625 (UK DPP SD)`,`Broadcast`,`as11_d10`,null,null,null,null],[`p2-dvcprohd-1080i50`,`P2 DVCPRO HD 1080i 25`,`Broadcast`,`p2`,null,null,null,null],[`p2-dvcprohd-720p50`,`P2 DVCPRO HD 720p 50`,`Broadcast`,`p2`,null,null,null,null],[`dcp-2k-flat-24`,`DCP 2K Flat 24 (SMPTE)`,`Cinema`,`dcp`,null,null,24,null],[`dcp-2k-scope-24`,`DCP 2K Scope 24 (SMPTE)`,`Cinema`,`dcp`,null,null,24,null],[`dcp-2k-flat-24-interop`,`DCP 2K Flat 24 (Interop)`,`Cinema`,`dcp`,null,null,24,null],[`dcp-4k-flat-24`,`DCP 4K Flat 24 (SMPTE)`,`Cinema`,`dcp`,null,null,24,null],[`mpeg2-dvd-pal`,`PAL DV Widescreen DVD`,`DVD`,`mpeg2_dvd`,720,576,25,6],[`png-sequence`,`PNG Sequence`,`Image Sequence`,`png`,null,null,null,null],[`png-sequence-alpha`,`PNG Sequence with Alpha`,`Image Sequence`,`png`,null,null,null,null],[`tiff-sequence-16`,`TIFF Sequence 16-bit`,`Image Sequence`,`tiff`,null,null,null,null],[`dpx-sequence-10`,`DPX Sequence 10-bit`,`Image Sequence`,`dpx`,null,null,null,null],[`exr-sequence-half`,`OpenEXR Sequence (half float)`,`Image Sequence`,`exr`,null,null,null,null],[`jpeg-sequence`,`JPEG Sequence`,`Image Sequence`,`jpeg`,null,null,null,null],[`targa-sequence`,`Targa Sequence`,`Image Sequence`,`targa`,null,null,null,null],[`png-still`,`PNG Still (first frame of the range)`,`Image`,`png`,null,null,null,null],[`jpeg-still`,`JPEG Still`,`Image`,`jpeg`,null,null,null,null],[`gif-480`,`Animated GIF 480 px`,`Animated GIF`,`gif`,null,null,15,null],[`gif-720`,`Animated GIF 720 px`,`Animated GIF`,`gif`,null,null,20,null],[`wav-48-24`,`Waveform Audio 48 kHz 24-bit`,`Audio Only`,`wav`,null,null,null,null],[`wav-48-16`,`Waveform Audio 48 kHz 16-bit`,`Audio Only`,`wav`,null,null,null,null],[`bwf-ebu`,`Broadcast WAV, EBU R128 loudness`,`Audio Only`,`bwf`,null,null,null,null],[`aiff-48-24`,`AIFF 48 kHz 24-bit`,`Audio Only`,`aiff`,null,null,null,null],[`mp3-320`,`MP3 320 kb/s`,`Audio Only`,`mp3`,null,null,null,null],[`mp3-podcast`,`MP3 Podcast, -16 LUFS`,`Audio Only`,`mp3`,null,null,null,null],[`aac-256`,`AAC Audio 256 kb/s`,`Audio Only`,`aac`,null,null,null,null],[`aac-streaming`,`AAC Streaming, -14 LUFS`,`Audio Only`,`aac`,null,null,null,null],[`flac-48-24`,`FLAC 48 kHz 24-bit`,`Audio Only`,`flac`,null,null,null,null],[`ogg-opus`,`Ogg Opus 160 kb/s`,`Audio Only`,`ogg`,null,null,null,null],[`ffv1-archive`,`FFV1 Lossless Archive (Matroska)`,`Archive`,`matroska`,null,null,null,null],[`proxy-prores`,`ProRes Proxy, quarter size (proxy)`,`Proxy`,`prores`,960,540,null,null],[`proxy-h264-540`,`H.264 Proxy 960x540`,`Proxy`,`h264`,960,540,null,3],[`proxy-h264-720`,`H.264 Proxy 1280x720 (formcut)`,`Proxy`,`h264`,1280,720,null,5],[`proxy-cineform`,`CineForm Proxy 1280x720`,`Proxy`,`cineform`,1280,720,null,null],[`family-formcut-mezzanine`,`formcut mezzanine (ProRes 422 HQ)`,`Form Family`,`prores`,null,null,null,null],[`family-formwav-audio`,`formwav session audio (WAV 48 kHz 24-bit)`,`Form Family`,`wav`,null,null,null,null],[`family-formvis-stills`,`formvis stills (PNG Sequence)`,`Form Family`,`png`,null,null,null,null]],We=new Set([`h264`,`hevc`,`av1`,`webm`,`mpeg2`,`mpeg2_dvd`,`mpeg2_bluray`,`h264_bluray`,`matroska`]);function Ge(e,t){return e===`webm-vp9-alpha`||e===`ffv1-archive`?null:We.has(t)?`webm`:t===`gif`?`gif`:t===`wav`||t===`bwf`?`wav`:t===`aiff`?`aiff`:t===`ogg`?`ogg`:e===`png-still`?`png`:e===`jpeg-still`?`jpeg`:null}function Ke(e){if(/EBU R128/.test(e))return-23;if(/ATSC A\/85/.test(e))return-24;let t=/(-\d+) LUFS/.exec(e);return t?Number(t[1]):null}var N=Ue.map(([e,t,n,r,i,a,o,s])=>({id:e,name:t,category:n,format:r,width:i,height:a,fps:o,mbps:s,target:Ge(e,r),lufs:Ke(t),bits:/-16\b|16-bit/.test(t)?16:24})),P=new Map(N.map(e=>[e.id,e])),F={webm:`WebM`,gif:`GIF`,wav:`WAV`,aiff:`AIFF`,ogg:`Ogg Opus`,png:`PNG`,jpeg:`JPEG`},I={webm:`webm`,gif:`gif`,wav:`wav`,aiff:`aiff`,ogg:`opus`,png:`png`,jpeg:`jpg`},L={webm:`video/webm`,gif:`image/gif`,wav:`audio/wav`,aiff:`audio/aiff`,ogg:`audio/ogg`,png:`image/png`,jpeg:`image/jpeg`},qe={h264:`H.264`,hevc:`HEVC`,av1:`AV1`,webm:`WebM`,prores:`ProRes`,quicktime:`QuickTime`,cineform:`CineForm`,mxf_op1a:`MXF OP1a`,dnxhr_mxf:`DNx MXF`,prores_mxf:`ProRes MXF`,jpeg2000_mxf:`J2K MXF`,mpeg2:`MPEG-2`,mpeg2_dvd:`DVD`,mpeg2_bluray:`Blu-ray`,h264_bluray:`Blu-ray`,as10:`AS-10`,as11:`AS-11`,as11_d10:`AS-11 D10`,p2:`P2`,dcp:`DCP`,png:`PNG`,tiff:`TIFF`,dpx:`DPX`,exr:`EXR`,jpeg:`JPEG`,targa:`Targa`,gif:`GIF`,wav:`WAV`,bwf:`BWF`,aiff:`AIFF`,mp3:`MP3`,aac:`AAC`,flac:`FLAC`,ogg:`Ogg`,matroska:`Matroska`},Je=new Set([`wav`,`aiff`,`ogg`]);function Ye(e){return e.width&&e.height?`${e.width}x${e.height}`:``}function Xe(e){return e.fps?`${Number(e.fps.toFixed(3))}`:``}function Ze(e){return e.mbps?`${e.mbps} Mb/s`:``}var Qe=0,$e=()=>`src${++Qe}`,R=48e3;function et(e,t,n,r=8e3){return new Promise((i,a)=>{let o=window.setTimeout(()=>{l(),a(Error(`timed out waiting for ${t}`))},r),s=()=>{l(),i()},c=()=>{l(),a(Error(`the browser cannot decode this file`))},l=()=>{window.clearTimeout(o),e.removeEventListener(t,s),e.removeEventListener(n,c)};e.addEventListener(t,s),e.addEventListener(n,c)})}async function tt(e){if(Number.isFinite(e.duration))return e.duration;e.currentTime=1e101,await et(e,`durationchange`,`error`,4e3).catch(()=>void 0);let t=Number.isFinite(e.duration)?e.duration:0;return e.currentTime=0,t}async function nt(e){let t=e.requestVideoFrameCallback?.bind(e);if(!t)return 30;let n=[];return new Promise(r=>{let i=()=>{e.pause(),e.currentTime=0;let t=[];for(let e=1;en[e-1]&&t.push(n[e]-n[e-1]);t.sort((e,t)=>e-t);let i=1/(t.length?t[t.length>>1]:1/30),a=[12,15,23.976,24,25,29.97,30,50,59.94,60].reduce((e,t)=>Math.abs(t-i){n.push(r.mediaTime),n.length>=14?i():t(a)};t(a),e.muted=!0,e.play().catch(()=>i()),window.setTimeout(()=>{n.length<14&&i()},1500)})}async function rt(e,t){let n=URL.createObjectURL(e),r=document.createElement(`video`);r.muted=!0,r.preload=`auto`,r.playsInline=!0,r.src=n;try{await et(r,`loadedmetadata`,`error`)}catch(e){throw URL.revokeObjectURL(n),e}let i=await tt(r),a=r.videoWidth>0&&r.videoHeight>0,o=a?t??await nt(r):0;a&&await it(r,0);let s=null;return{id:$e(),name:e.name,kind:a?`video`:`audio`,sample:!1,size:e.size,width:r.videoWidth,height:r.videoHeight,fps:o,duration:i,async frame(e){return await it(r,Math.max(0,Math.min(e,Math.max(0,i-.001)))),r},audio(){return s||=(async()=>{if(e.size>629145600)return null;try{return await new OfflineAudioContext(2,1,R).decodeAudioData(await e.arrayBuffer())}catch{return null}})(),s},dispose(){r.removeAttribute(`src`),r.load(),URL.revokeObjectURL(n)}}}async function it(e,t){if(Math.abs(e.currentTime-t)<1e-4&&e.readyState>=2)return;let n=et(e,`seeked`,`error`,6e3);e.currentTime=t,await n}var at=640,ot=360,z=24,B=8;function st(){let e=R*B,t=new AudioBuffer({length:e,numberOfChannels:2,sampleRate:R}),n=t.getChannelData(0),r=t.getChannelData(1),i=[261.63,329.63,392,523.25,392,329.63,293.66,349.23],a=12345,o=()=>(a=a*1664525+1013904223>>>0,a/4294967296-.5);for(let t=0;t{e.fillStyle=t,e.fillRect(n/o.length*r,0,n/o.length+1,34)}),e.strokeStyle=`rgba(255,255,255,0.12)`,e.lineWidth=1;for(let i=-(t*40)%40;i=0;r--){let i=t-r*.035,a=n/2+Math.sin(i*1.7)*190,o=190+Math.cos(i*2.3)*70;e.fillStyle=`rgba(242, 84, 91, ${.9-r*.09})`,e.beginPath(),e.arc(a,o,26-r*1.6,0,Math.PI*2),e.fill()}e.strokeStyle=`rgba(255,255,255,0.8)`,e.lineWidth=3,e.beginPath(),e.arc(s,c,48,t*3,t*3+Math.PI*1.3),e.stroke();let l=.5+.5*Math.sin(t*6);e.fillStyle=`rgba(0,0,0,0.45)`,e.fillRect(18,300,604,14),e.fillStyle=`#f2545b`,e.fillRect(18,300,t/B*604,14),e.fillStyle=`rgba(255,255,255,${.5+l*.4})`,e.fillRect(18+t/B*604-2,296,4,22);let u=Math.floor(t*z),d=Math.floor(u/z),f=u%z;e.fillStyle=`#fff`,e.font=`600 44px ui-monospace, Menlo, monospace`,e.textBaseline=`alphabetic`,e.fillText(`00:00:${String(d).padStart(2,`0`)}:${String(f).padStart(2,`0`)}`,20,96),e.font=`500 15px system-ui, sans-serif`,e.fillStyle=`rgba(255,255,255,0.8)`,e.fillText(`formencoder sample · generated in this page · 640x360 · 24 fps`,20,344)}function lt(){let e=document.createElement(`canvas`);e.width=at,e.height=ot;let t=e.getContext(`2d`,{willReadFrequently:!1}),n=null;return{id:$e(),name:`formencoder-sample`,kind:`video`,sample:!0,size:0,width:at,height:ot,fps:z,duration:B,async frame(n){return ct(t,Math.max(0,Math.min(n,B))),e},async audio(){return n||=st(),n},dispose(){n=null}}}var ut=1280;function dt(e){return{size:`preset`,fps:null,mbps:null,codec:`auto`,audio:!0,lufs:e.lufs,start:0,end:null}}var V=e=>Math.max(2,Math.round(e/2)*2);function H(e,t,n){let r=Math.max(0,Math.min(n.start,e.duration)),i=Math.max(r+.05,Math.min(n.end??e.duration,e.duration)),a=e.width||640,o=e.height||360,s=!1,c=t.target===`gif`?Number(/(\d+) px/.exec(t.name)?.[1]??0):0;typeof n.size==`number`?(a=n.size,o=e.height/e.width*n.size):n.size===`preset`&&t.width&&t.height?(a=t.width,o=t.height,s=!0):n.size===`preset`&&c&&(a=c,o=e.height/e.width*c);let l=!1,u=Math.max(a,o);if(u>1280){let e=ut/u;a*=e,o*=e,l=!0}let d=V(a),f=V(o),p=d,m=f;if(s&&e.width&&e.height){let t=Math.min(d/e.width,f/e.height);p=V(e.width*t),m=V(e.height*t)}let h=n.fps??t.fps??(e.fps||30),g=Math.max(1,Math.min(60,t.target===`gif`?Math.min(h,25):h)),_=n.mbps??0;_||=t.mbps&&t.width&&t.height?t.mbps*(d*f/(t.width*t.height))*(g/(t.fps||30)):t.mbps?t.mbps*.25:.09*d*f*g/1e6,_=Math.max(.15,Math.min(14,_));let v=Math.max(1,Math.floor((i-r)*g));return{width:d,height:f,innerWidth:p,innerHeight:m,fps:g,mbps:_,start:r,end:i,frames:v,capped:l}}function ft(){let e=[];return e.push(typeof VideoEncoder>`u`?`VideoEncoder missing`:`VideoEncoder ready`),e.push(typeof AudioEncoder>`u`?`AudioEncoder missing`:`AudioEncoder ready`),e.join(`, `)}function U(e){if(e.aborted)throw new DOMException(`stopped`,`AbortError`)}function pt(){return new Promise(e=>window.setTimeout(e,0))}function mt(e,t,n,r,i){e.fillStyle=`#000`,e.fillRect(0,0,t.width,t.height);let a=(t.width-t.innerWidth)/2,o=(t.height-t.innerHeight)/2;e.drawImage(n,0,0,r,i,a,o,t.innerWidth,t.innerHeight)}function ht(e,t){return e instanceof HTMLVideoElement?{w:e.videoWidth,h:e.videoHeight}:e instanceof HTMLCanvasElement?{w:e.width,h:e.height}:{w:t.width,h:t.height}}async function gt(e,t){let n=await e.source.audio();if(!n)return null;let r=Math.floor(t.start*n.sampleRate),i=Math.min(n.length,Math.ceil(t.end*n.sampleRate)),a=[];for(let e=0;e=0?`+`:``}${t.gainDb.toFixed(1)} dB${t.limited?`, held at -1 dBTP`:``})`}else r=`Loudness ${O(i)}`;return{channels:n.channels,rate:n.rate,note:r}}async function yt(e,t,n,r){if(typeof AudioEncoder>`u`)throw Error(`this browser has no AudioEncoder`);if(t!==48e3)throw Error(`audio at ${t} Hz needs resampling; the demo expects ${R} Hz`);let i={codec:`opus`,sampleRate:R,numberOfChannels:e.length,bitrate:n};if(!(await AudioEncoder.isConfigSupported(i)).supported)throw Error(`Opus encoding is not available in this browser`);let a=[],o=null,s=new AudioEncoder({output:e=>{let t=new Uint8Array(e.byteLength);e.copyTo(t),a.push({data:t,timeUs:e.timestamp,samples:Math.round((e.duration??2e4)/1e6*R)})},error:e=>{o=e}});s.configure(i);let c=e[0].length;for(let t=0;ti.set(e.subarray(t,t+n),r*960));let a=new AudioData({format:`f32-planar`,sampleRate:R,numberOfFrames:960,numberOfChannels:e.length,timestamp:Math.round(t/R*1e6),data:i});s.encode(a),a.close(),s.encodeQueueSize>12&&await pt()}if(await s.flush(),s.close(),o)throw o;return a}async function bt(e){if(typeof VideoEncoder>`u`)throw Error(`this browser has no WebCodecs VideoEncoder`);let{source:t,preset:n,settings:r}=e;if(t.kind!==`video`)throw Error(`this source has no picture`);let i=H(t,n,r),a=document.createElement(`canvas`);a.width=i.width,a.height=i.height;let o=a.getContext(`2d`),s=r.codec===`vp8`?[`vp8`]:r.codec===`vp9`?[`vp09.00.10.08`]:[`vp09.00.10.08`,`vp8`],c=``,l=null;for(let e of s){let t={codec:e,width:i.width,height:i.height,bitrate:Math.round(i.mbps*1e6),framerate:i.fps,latencyMode:`quality`,bitrateMode:`variable`};if((await VideoEncoder.isConfigSupported(t)).supported){c=e,l=t;break}}if(!l)throw Error(`neither VP9 nor VP8 encoding is available in this browser`);let u=[],d=null,f=new VideoEncoder({output:e=>{let t=new Uint8Array(e.byteLength);e.copyTo(t),u.push({track:1,timeMs:e.timestamp/1e3,key:e.type===`key`,data:t})},error:e=>{d=e}});f.configure(l);let p=performance.now(),m=Math.max(1,Math.round(i.fps*2)),h=0;for(let n=0;n6;)await pt();let u=performance.now();u-h>160&&(h=u,e.onPreview(a));let g=(u-p)/1e3;e.onProgress({fraction:(n+1)/i.frames*.92,frame:n+1,frames:i.frames,message:`${((n+1)/Math.max(g,.001)).toFixed(1)} fps`})}if(await f.flush(),f.close(),e.onPreview(a),d)throw d;let g=i.capped?`Frame size capped at ${ut} px in the browser demo`:``,_=null;if(r.audio){e.onProgress({fraction:.93,frame:i.frames,frames:i.frames,message:`Encoding audio`});let t=await vt(e,i);if(t)try{let n=await yt(t.channels,t.rate,128e3,e.signal);for(let e of n)u.push({track:2,timeMs:e.timeUs/1e3,key:!0,data:e.data});_={sampleRate:R,channels:t.channels.length,preSkip:312},g=[g,t.note].filter(Boolean).join(`. `)}catch(e){g=[g,`Audio left out: ${e.message}`].filter(Boolean).join(`. `)}}return e.onProgress({fraction:.98,frame:i.frames,frames:i.frames,message:`Writing WebM`}),{blob:Fe({codec:c===`vp8`?`V_VP8`:`V_VP9`,width:i.width,height:i.height},_,u,(i.end-i.start)*1e3),ext:I.webm,mime:L.webm,encoder:`WebCodecs ${c===`vp8`?`VP8`:`VP9`}${_?` + Opus`:``} · ${i.width}x${i.height} · ${i.fps} fps · ${i.mbps.toFixed(1)} Mb/s`,note:g}}async function xt(e){let{source:t,preset:n,settings:r}=e;if(t.kind!==`video`)throw Error(`this source has no picture`);let i=H(t,n,r),a=document.createElement(`canvas`);a.width=i.width,a.height=i.height;let o=a.getContext(`2d`,{willReadFrequently:!0}),s=new ve(i.width,i.height),c=Math.max(2,Math.round(100/i.fps));for(let n=0;n({data:e.data,samples:e.samples})),a.channels.length,312,a.rate),ext:I.ogg,mime:L.ogg,encoder:`WebCodecs Opus · ${a.channels.length} ch · 160 kb/s`,note:a.note}:{blob:t===`aiff`?He(a.channels,a.rate,r.bits):Ve(a.channels,a.rate,r.bits),ext:I[t],mime:L[t],encoder:`PCM ${r.bits}-bit · ${a.rate} Hz · ${a.channels.length} ch`,note:a.note}}async function Ct(e,t){let{source:n,preset:r,settings:i}=e;if(n.kind!==`video`)throw Error(`this source has no picture`);let a=H(n,r,i),o=document.createElement(`canvas`);o.width=a.width,o.height=a.height;let s=o.getContext(`2d`),c=await n.frame(a.start),l=ht(c,n);return mt(s,a,c,l.w,l.h),e.onPreview(o),{blob:await new Promise((e,n)=>o.toBlob(t=>t?e(t):n(Error(`the canvas could not be saved`)),L[t],.92)),ext:I[t],mime:L[t],encoder:`${t.toUpperCase()} still · ${a.width}x${a.height}`,note:``}}async function wt(e){let t=e.preset.target;if(!t)throw Error(`needs the desktop engine`);return t===`webm`?bt(e):t===`gif`?xt(e):Je.has(t)?St(e,t):Ct(e,t)}function Tt(e){return e==null||!Number.isFinite(e)?``:e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(0)} KB`:e<1073741824?`${(e/1024/1024).toFixed(1)} MB`:`${(e/1024/1024/1024).toFixed(2)} GB`}function Et(e){if(e==null||!Number.isFinite(e)||e<0)return`--:--`;let t=Math.round(e),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60;return n?`${n}:${String(r).padStart(2,`0`)}:${String(i).padStart(2,`0`)}`:`${String(r).padStart(2,`0`)}:${String(i).padStart(2,`0`)}`}function Dt(e){return!e||!Number.isFinite(e)?``:e<60?`${e.toFixed(e<10?2:1)} s`:Et(e)}var Ot={ready:`Ready`,preparing:`Preparing`,encoding:`Encoding`,paused:`Paused`,done:`Done`,failed:`Failed`,stopped:`Stopped`,skipped:`Skipped`},W=new TextDecoder(`latin1`);async function G(e,t,n){let r=await e.slice(t,t+n).arrayBuffer();return new DataView(r)}var K=(e,t)=>W.decode(new Uint8Array(e.buffer,e.byteOffset+t,4)),kt={66:`Baseline`,77:`Main`,88:`Extended`,100:`High`,110:`High 10`,122:`High 4:2:2`,244:`High 4:4:4`},At={apco:`ProRes 422 Proxy`,apcs:`ProRes 422 LT`,apcn:`ProRes 422`,apch:`ProRes 422 HQ`,ap4h:`ProRes 4444`,ap4x:`ProRes 4444 XQ`},jt={sowt:`PCM s16le`,twos:`PCM s16be`,in24:`PCM s24`,in32:`PCM s32`,lpcm:`PCM`,fl32:`PCM f32`,fl64:`PCM f64`,raw:`PCM u8`};function Mt(e,t,n){let r={type:``,timescale:0,duration:0,width:0,height:0,format:``,profile:``,samples:0,stts:0,bytes:0,channels:0,bits:0,rate:0,esObject:0},i=(t,n)=>{let a=t;for(;a+8<=n;){let t=e.getUint32(a),o=K(e,a+4),s=8;if(t===1&&(t=Number(e.getBigUint64(a+8)),s=16),t===0&&(t=n-a),tn)break;let c=a+s,l=a+t;if(o===`mdia`||o===`minf`||o===`stbl`)i(c,l);else if(o===`tkhd`){let t=c+(e.getUint8(c)===1?88:76);r.width=e.getUint32(t)/65536,r.height=e.getUint32(t+4)/65536}else if(o===`mdhd`){let t=e.getUint8(c);r.timescale=e.getUint32(c+(t===1?20:12)),r.duration=t===1?Number(e.getBigUint64(c+24)):e.getUint32(c+16)}else if(o===`hdlr`)r.type=K(e,c+8);else if(o===`stsd`){let t=c+8;if(r.format=K(e,t+4),r.type===`vide`){let n=e.getUint16(t+32),i=e.getUint16(t+34);n&&(r.width=n),i&&(r.height=i);let a=t+86,o=e.getUint32(t);for(;a+8<=t+o;){let t=e.getUint32(a),n=K(e,a+4);if(t<8)break;n===`avcC`&&(r.profile=`${kt[e.getUint8(a+9)]??`profile `+e.getUint8(a+9)} L${(e.getUint8(a+11)/10).toFixed(1)}`),n===`hvcC`&&(r.profile={1:`Main`,2:`Main 10`}[e.getUint8(a+9)&31]??``),a+=t}}else if(r.type===`soun`){r.channels=e.getUint16(t+24),r.bits=e.getUint16(t+26),r.rate=e.getUint16(t+32);let n=e.getUint32(t),i=t+36;for(;i+8<=t+n;){let t=e.getUint32(i),n=K(e,i+4);if(t<8)break;if(n===`esds`){for(let n=i+12;nr.byteLength)break;if(t===`mvhd`){let e=r.getUint8(s+8);a=r.getUint32(s+8+(e===1?20:12)),o=e===1?Number(r.getBigUint64(s+8+24)):r.getUint32(s+8+16)}else if(t===`trak`){let t=Mt(r,s+8,s+e),n=t.timescale?t.duration/t.timescale:0;if(t.type===`vide`&&!i.video){let e=t.stts&&t.samples?t.samples*t.timescale/t.stts:null;i.video={codec:Nt(t.format),profile:t.profile,width:Math.round(t.width),height:Math.round(t.height),fps:e,frames:t.samples||null,bitrate:n&&t.bytes?t.bytes*8/n:null,pixels:``}}else t.type===`soun`&&i.audio.push({codec:Pt(t),sampleRate:t.rate||null,channels:t.channels||null,bitDepth:jt[t.format]?t.bits:null,bitrate:n&&t.bytes?t.bytes*8/n:null})}s+=e}return i.duration=a?o/a:null,i.duration&&(i.bitrate=e.size*8/i.duration),i}function It(e,t,n){let r=e[t];if(r===void 0||r===0)return null;let i=1;for(;!(r&128>>i-1);)i++;if(t+i>e.length)return null;let a=n?r:r&255>>i,o=(r&255>>i)==255>>i;for(let n=1;n{if(!o)return;let e=o.codec===`V_VP9`?`VP9`:o.codec===`V_VP8`?`VP8`:o.codec===`V_AV1`?`AV1`:o.codec===`V_MPEG4/ISO/AVC`?`H.264`:o.codec===`V_MPEGH/ISO/HEVC`?`HEVC`:o.codec;o.type===1&&!r.video&&(r.video={codec:e,profile:``,width:o.w,height:o.h,fps:o.dur?1e9/o.dur:null,frames:null,bitrate:null,pixels:``}),o.type===2&&r.audio.push({codec:o.codec===`A_OPUS`?`Opus`:o.codec===`A_VORBIS`?`Vorbis`:o.codec===`A_AAC`?`AAC`:o.codec===`A_FLAC`?`FLAC`:o.codec,sampleRate:o.rate||null,channels:o.ch||null,bitDepth:o.bits||null,bitrate:null}),o=null},c=(e,t)=>{let r=0;for(let i=0;in===4?t.getFloat32(e):n===8?t.getFloat64(e):0,u=(e,t,d)=>{let f=e;for(;f=0?i={codec:`Opus`,sampleRate:48e3,channels:n[a+9],bitDepth:null,bitrate:null}:o>=0&&(i={codec:`Vorbis`,sampleRate:t.getUint32(o+12,!0),channels:n[o+11],bitDepth:null,bitrate:null});let s=await G(e,Math.max(0,e.size-65536),Math.min(e.size,65536)),c=new Uint8Array(s.buffer),l=null;for(let e=c.length-27;e>=0;e--)if(c[e]===79&&c[e+1]===103&&c[e+2]===103&&c[e+3]===83){l=Number(s.getBigUint64(e+6,!0));break}let u=i.sampleRate??48e3,d=l!==null&&l>0?l/(i.codec===`Opus`?48e3:u):null;return{container:`Ogg`,duration:d,size:e.size,bitrate:d?e.size*8/d:null,video:null,audio:[i],notes:[]}}async function Vt(e){let t=await G(e,0,Math.min(e.size,64));if(t.byteLength<26||K(t,0)!==`fLaC`)return null;let n=t.getUint8(18)<<12|t.getUint8(19)<<4|t.getUint8(20)>>4,r=(t.getUint8(20)>>1&7)+1,i=((t.getUint8(20)&1)<<4|t.getUint8(21)>>4)+1,a=(t.getUint8(21)&15)*2**32+t.getUint32(22),o=n&&a?a/n:null;return{container:`FLAC`,duration:o,size:e.size,bitrate:o?e.size*8/o:null,video:null,audio:[{codec:`FLAC`,sampleRate:n,channels:r,bitDepth:i,bitrate:null}],notes:[]}}var Ht=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320],Ut=[44100,48e3,32e3];async function Wt(e){let t=await G(e,0,Math.min(e.size,65536)),n=0;if(K(t,0).startsWith(`ID3`)&&(n=10+(t.getUint8(6)<<21|t.getUint8(7)<<14|t.getUint8(8)<<7|t.getUint8(9))),n+4>t.byteLength)return null;for(let r=n;r+4>3&3,i=t.getUint8(r+1)>>1&3,a=Ht[t.getUint8(r+2)>>4],o=Ut[t.getUint8(r+2)>>2&3];if(n!==3||i!==1||!a||!o)continue;let s=t.getUint8(r+3)>>6==3?1:2;return{container:`MPEG audio`,duration:(e.size-r)*8/(a*1e3),size:e.size,bitrate:a*1e3,video:null,audio:[{codec:`MP3`,sampleRate:o,channels:s,bitDepth:null,bitrate:a*1e3}],notes:[`duration assumes constant bitrate`]}}return null}async function Gt(e){let t=[Ft,Rt,zt,Bt,Vt,Wt];for(let n of t)try{let t=await n(e);if(t)return t}catch{continue}return{container:e.type||`unknown`,duration:null,size:e.size,bitrate:null,video:null,audio:[],notes:[`container not recognised, showing what the browser reports`]}}var Kt=[{pack:`open-water`,file:`open-water-1280x720-30fps.mp4`,mime:`video/mp4`,kind:`video`,width:1280,height:720,fps:29.97,duration:8.008,bytes:6819433,outputs:[{preset:`match-source-medium`},{preset:`gif-480`},{preset:`png-still`}]},{pack:`coast-aerial`,file:`coast-aerial-1280x720-25fps.mp4`,mime:`video/mp4`,kind:`video`,width:1280,height:720,fps:25,duration:7,bytes:6637734,outputs:[{preset:`match-source-medium`},{preset:`gif-480`}]},{pack:`shoreline-vertical`,file:`shoreline-vertical-404x720-60fps.mp4`,mime:`video/mp4`,kind:`video`,width:404,height:720,fps:59.94,duration:7.858,bytes:4235966,outputs:[{preset:`match-source-medium`},{preset:`gif-480`,size:`source`}]},{pack:`on-the-sea-reading`,file:`on-the-sea-reading.mp3`,mime:`audio/mpeg`,kind:`audio`,width:0,height:0,fps:0,duration:21.133,bytes:211755,outputs:[{preset:`ogg-opus`,lufs:-16},{preset:`bwf-ebu`},{preset:`wav-48-24`}]}];function qt(){let e=window;return e.FE_MEDIA||={},e.FE_MEDIA}function Jt(e){return new Promise((t,n)=>{let r=document.createElement(`script`);r.async=!0,r.src=`media/${e}.js`,r.onload=()=>{r.remove(),t()},r.onerror=()=>{r.remove(),n(Error(`the media pack ${e} did not load`))},document.head.appendChild(r)})}async function Yt(e){await Jt(e.pack);let t=qt(),n=t[e.file];if(delete t[e.file],!n)throw Error(`the media pack ${e.pack} holds no ${e.file}`);let r=atob(n),i=new Uint8Array(r.length);for(let e=0;ePromise.reject(Error(`the source is still loading`)),audio:()=>Promise.resolve(null),dispose:()=>void 0}}var Qt=0,q=new class{items=[];selectedItem=``;selectedOutput=``;running=!1;logs=[];listeners=new Map;abort=null;previews=new Map;on(e,t){this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e)?.add(t)}emit(e,t){for(let n of this.listeners.get(e)??[])n(t)}log(e,t=!1){let n=new Date,r=[n.getHours(),n.getMinutes(),n.getSeconds()].map(e=>String(e).padStart(2,`0`)).join(`:`);this.logs.push({time:r,text:e,error:t}),this.logs.length>400&&this.logs.shift(),this.emit(`log`)}previewFor(e){return this.previews.get(e)}item(e){return this.items.find(t=>t.id===e)}outputOf(e){for(let t of this.items){let n=t.outputs.find(t=>t.id===e);if(n)return{item:t,output:n}}}select(e,t=``){(this.selectedItem!==e||this.selectedOutput!==t)&&(this.selectedItem=e,this.selectedOutput=t,this.emit(`select`))}makeOutput(e){let t=P.get(e);if(!t)throw Error(`unknown preset ${e}`);return{id:`out${++Qt}`,presetId:e,settings:dt(t),status:`ready`,progress:0,message:``,encoder:``,note:``,blob:null,mime:``,fileName:``,elapsed:0,fps:0,frame:0,frames:0,eta:0,speed:0}}stem(e){return e.source.name.replace(/\.[^.]+$/,``).replace(/[^A-Za-z0-9._-]+/g,`_`)||`source`}nameFor(e,t){let n=P.get(t.presetId),r=n?.target?I[n.target]:`out`;return`${this.stem(e)}_${t.presetId}.${r}`}addOutput(e,t){let n=this.item(e);if(!n)return;let r=this.makeOutput(t);return r.fileName=this.nameFor(n,r),n.outputs.push(r),n.collapsed=!1,this.log(`Added output ${P.get(t)?.name??t} to ${n.source.name}`),this.emit(`items`),r}async addSource(e,t){let n={id:e.id,source:e,probe:{container:``,duration:null,size:e.size,bitrate:null,video:null,audio:[],notes:[]},loudness:null,loudnessState:`pending`,poster:null,outputs:[],collapsed:!1,loading:!1};this.items.push(n);for(let e of t){let t=this.makeOutput(e);t.fileName=this.nameFor(n,t),n.outputs.push(t)}return this.selectedItem=n.id,this.selectedOutput=``,this.log(`Added source ${e.name}`),this.emit(`items`),this.emit(`select`),n}async analyse(e,t){if(e.probe=t?await Gt(t):{container:`generated in this page (no file)`,duration:e.source.duration,size:0,bitrate:null,video:{codec:`canvas RGB`,profile:``,width:e.source.width,height:e.source.height,fps:e.source.fps,frames:Math.round(e.source.duration*e.source.fps),bitrate:null,pixels:`rgb24`},audio:[{codec:`PCM f32 (synthesised)`,sampleRate:48e3,channels:2,bitDepth:32,bitrate:null}],notes:[]},e.source.kind===`video`)try{let t=await e.source.frame(Math.min(1,e.source.duration/2)),n=document.createElement(`canvas`);n.width=640,n.height=Math.max(2,Math.round(640*e.source.height/e.source.width)),n.getContext(`2d`)?.drawImage(t,0,0,n.width,n.height),e.poster=n}catch(e){this.log(`No preview frame: ${e.message}`,!0)}this.emit(`items`),this.emit(`select`);try{let t=await e.source.audio();if(!t)e.loudnessState=`none`;else{e.probe.audio.length||e.probe.audio.push({codec:`decoded by the browser`,sampleRate:t.sampleRate,channels:t.numberOfChannels,bitDepth:null,bitrate:null}),await new Promise(e=>window.setTimeout(e,0));let n=[];for(let e=0;e{let r=this.addCuratedRow(t);e.push({item:r,index:n})}),this.selectedItem=e[0].item.id,this.emit(`select`);let t=0;for(let{item:n,index:r}of e){let e=Kt[r];try{let r=await Yt(e),i=await rt(r,e.fps||null);i.id=n.id,n.source.dispose(),n.source=i,n.loading=!1,this.emit(`items`),await this.analyse(n,r),t++}catch(t){this.log(`Could not load ${e.file}: ${t.message}`,!0),this.items=this.items.filter(e=>e.id!==n.id),this.selectedItem===n.id&&(this.selectedItem=this.items[0]?.id??``),this.emit(`items`),this.emit(`select`)}}t||(this.log(`The curated media did not load; adding the built-in sample instead`,!0),await this.addSample())}addCuratedRow(e){let t=Zt(e),n={id:t.id,source:t,probe:{container:``,duration:e.duration,size:e.bytes,bitrate:null,video:null,audio:[],notes:[]},loudness:null,loudnessState:`pending`,poster:null,outputs:[],collapsed:!1,loading:!0};this.items.push(n);for(let t of e.outputs){let e=this.makeOutput(t.preset);t.lufs!==void 0&&(e.settings.lufs=t.lufs),t.size&&(e.settings.size=t.size),e.fileName=this.nameFor(n,e),n.outputs.push(e)}return this.log(`Added source ${e.file}`),this.emit(`items`),n}async addSample(){let e=lt(),t=await this.addSource(e,[`match-source-medium`,`gif-480`,`bwf-ebu`]);await this.analyse(t,null)}removeSelected(){if(!this.running){if(this.selectedOutput){let e=this.outputOf(this.selectedOutput);e&&(e.item.outputs=e.item.outputs.filter(e=>e.id!==this.selectedOutput),this.selectedOutput=``)}else this.selectedItem&&=(this.item(this.selectedItem)?.source.dispose(),this.items=this.items.filter(e=>e.id!==this.selectedItem),this.items[0]?.id??``);this.emit(`items`),this.emit(`select`)}}resetOutput(e){e.status=`ready`,e.progress=0,e.message=``,e.blob=null,e.note=``,e.encoder=``,this.emit(`items`)}async start(){if(this.running)return;let e=[];for(let t of this.items)for(let n of t.outputs)(!t.loading&&n.status===`ready`||n.status===`failed`||n.status===`stopped`)&&e.push({item:t,out:n});if(!e.length)this.log(`Nothing to encode: every output is done`);else{this.running=!0,this.abort=new AbortController,this.emit(`run`),this.log(`Queue started: ${e.length} output${e.length===1?``:`s`}`);for(let{item:t,out:n}of e){if(this.abort.signal.aborted)break;await this.runOne(t,n,this.abort.signal)}this.running=!1,this.abort=null,this.log(`Queue finished`),this.emit(`run`)}}stop(){this.abort?.abort()}async runOne(e,t,n){let r=P.get(t.presetId);if(!r)return;if(!r.target){t.status=`skipped`,t.message=`Needs the desktop engine`,this.log(`Skipped ${t.fileName}: ${r.name} needs the desktop engine`),this.emit(`progress`,t);return}t.status=`preparing`,t.progress=0,t.message=`Preparing`,t.blob=null,t.note=``,this.emit(`progress`,t);let i=performance.now();this.log(`Encoding ${t.fileName} with ${r.name}`);try{let a=()=>{let e=this.previews.get(t.id);return e||(e=document.createElement(`canvas`),this.previews.set(t.id,e)),e},o=await wt({source:e.source,preset:r,settings:t.settings,signal:n,onProgress:n=>{let r=(performance.now()-i)/1e3;t.status=`encoding`,t.progress=n.fraction,t.frame=n.frame,t.frames=n.frames,t.elapsed=r,t.eta=n.fraction>.02?r/n.fraction*(1-n.fraction):0,t.fps=r>0?n.frame/r:0,t.speed=r>0&&e.source.fps?n.frame/e.source.fps/r:0,t.message=n.message,this.emit(`progress`,t)},onPreview:e=>{let n=a();(n.width!==e.width||n.height!==e.height)&&(n.width=e.width,n.height=e.height),n.getContext(`2d`)?.drawImage(e,0,0),this.emit(`progress`,t)}});t.blob=o.blob,t.mime=o.mime,t.fileName=t.fileName.replace(/\.[^.]+$/,`.${o.ext}`),t.encoder=o.encoder,t.note=o.note,t.status=`done`,t.progress=1,t.elapsed=(performance.now()-i)/1e3,t.eta=0,t.message=Tt(o.blob.size),this.log(`Done ${t.fileName}: ${o.encoder}${o.note?`. `+o.note:``}`)}catch(e){let n=e;n.name===`AbortError`?(t.status=`stopped`,t.message=`Stopped`,this.log(`Stopped ${t.fileName}`)):(t.status=`failed`,t.message=n.message,this.log(`Failed ${t.fileName}: ${n.message}`,!0))}this.emit(`progress`,t),this.emit(`items`)}},$t=new WeakMap;function J(e,t=`info`){let n=document.getElementById(`toast-root`);if(!n)return;let r=t===`error`?6e3:3600,i=`cv-toast${t===`error`?` is-error`:t===`ok`?` is-ok`:``}`,a=Array.from(n.children).find(t=>t.textContent===e&&t.className===i);if(a){window.clearTimeout($t.get(a)),$t.set(a,window.setTimeout(()=>a.remove(),r));return}let o=s(``);for(o.textContent=e,n.appendChild(o);n.children.length>4;)n.firstElementChild?.remove();$t.set(o,window.setTimeout(()=>o.remove(),r))}var en=null,tn,nn,rn=``;function an(){let e=new _(`Preview`,760);return tn=s(``),nn=s(``),e.body.appendChild(tn),e.body.appendChild(nn),e.button(`Save`,`ghost`,()=>{rn&&on(rn)}),e.button(`Close`,`primary`,()=>e.close()),e.onClose=()=>{tn.replaceChildren(),rn=``},e}function on(e){let t=q.outputOf(e);if(!t?.output.blob){J(`This output has not been encoded yet`);return}let n=URL.createObjectURL(t.output.blob),r=document.createElement(`a`);r.href=n,r.download=t.output.fileName,document.body.appendChild(r),r.click(),r.remove(),window.setTimeout(()=>URL.revokeObjectURL(n),4e3)}function sn(e){let n=q.outputOf(e);if(!n?.output.blob){J(`This output has not been encoded yet`);return}en??=an();let{output:r}=n,i=URL.createObjectURL(n.output.blob),a;r.mime.startsWith(`video/`)?(a=s(``),a.src=i):r.mime.startsWith(`audio/`)?(a=s(``),a.src=i):(a=s(``),a.src=i),tn.replaceChildren(a),rn=e,en.setTitle(r.fileName),t(nn,[r.encoder,r.note].filter(Boolean).join(`. `)),en.open(c(en.scrim,`.cv-btn-primary`))}var cn=class{id=`encoding`;title=`Encoding`;el;list;constructor(){this.el=s(`
+
`),this.areas=Object.fromEntries(ne.map(e=>[e,this.el.querySelector(`[data-area="${e}"]`)]));for(let e of Array.from(this.el.querySelectorAll(`.fx-split`)))this.bindSplit(e);window.addEventListener(`resize`,()=>this.resized())}register(e,t,n){this.factories.set(e,n),this.titles.set(e,t)}titleOf(e){return this.titles.get(e)??e}panelIds(){return[...this.factories.keys()]}peek(e){return this.made.get(e)}panel(e){let t=this.made.get(e);if(!t){let n=this.factories.get(e);if(!n)return;t=n(),t.el.classList.add(`fx-panel`),t.el.dataset.panel=e,t.el.dataset.automationId=`panel.${e}`,this.made.set(e,t)}return t}bindSplit(e){let t=e.dataset.split;e.addEventListener(`pointerdown`,r=>{r.preventDefault(),e.setPointerCapture(r.pointerId),n(e,`is-dragging`,!0);let i={x:r.clientX,y:r.clientY,l:this.layout.leftW,r:this.layout.rightW,b:this.layout.bottomH},a=e=>{t===`left`&&(this.layout.leftW=Math.max(160,Math.min(900,i.l+e.clientX-i.x))),t===`right`&&(this.layout.rightW=Math.max(160,Math.min(1100,i.r-(e.clientX-i.x)))),t===`bottom`&&(this.layout.bottomH=Math.max(120,Math.min(window.innerHeight-220,i.b-(e.clientY-i.y)))),this.applySizes()},o=()=>{n(e,`is-dragging`,!1),e.removeEventListener(`pointermove`,a),e.removeEventListener(`pointerup`,o),this.save()};e.addEventListener(`pointermove`,a),e.addEventListener(`pointerup`,o)})}applySizes(){let e=this.groups.left.length?this.layout.leftW:0,t=this.groups.right.length?this.layout.rightW:0,r=this.groups.bottom.length?this.layout.bottomH:0;this.el.style.setProperty(`--fx-left`,`${e}px`),this.el.style.setProperty(`--fx-right`,`${t}px`),this.el.style.setProperty(`--fx-bottom`,`${r}px`),n(this.el,`no-left`,!e),n(this.el,`no-right`,!t),n(this.el,`no-bottom`,!r);for(let e of te){let t=this.groups[e],n=t.reduce((e,t)=>e+t.size,0)||1;for(let e of t)e.el.style.flex=`${e.size/n} 1 0`}this.resized()}resized(){for(let e of this.made.values())e.el.hidden||e.resized?.()}applyLayout(e,t){this.workspace=t,this.layout=structuredClone(e);for(let t of ne){for(let e of this.groups[t]){for(let t of e.panels){let e=this.made.get(t);e&&(e.el.hidden=!0,e.hidden?.())}e.el.remove()}this.groups[t]=[];let n=(t===`float`?e.float:e[t])??[];for(let e of n){let n=new re(this,t);n.size=e.size??1,e.w!==void 0&&(n.rect={x:e.x??120,y:e.y??90,w:e.w,h:e.h??340}),this.areas[t].appendChild(n.el),this.groups[t].push(n);for(let t of e.panels)this.factories.has(t)&&n.add(t,!1);t===`float`&&!n.panels.length?(n.el.remove(),this.groups[t].pop()):(n.activate(e.active&&e.panels.includes(e.active)?e.active:n.panels[0]),t===`float`&&n.place())}}this.applySizes(),this.onWorkspace?.(t)}load(){let e=`Default`,t=null;try{let n=localStorage.getItem(T);if(n){let r=JSON.parse(n);e=r.workspace||`Default`,t=r.layouts?.[e]??null}}catch{t=null}this.applyLayout(t??w[e]??w.Default,e)}snapshot(){let e={left:[],center:[],right:[],bottom:[],leftW:this.layout.leftW,rightW:this.layout.rightW,bottomH:this.layout.bottomH};for(let t of[`left`,`center`,`right`,`bottom`])e[t]=this.groups[t].map(e=>({panels:[...e.panels],active:e.active,size:e.size}));return e.float=this.groups.float.map(e=>({panels:[...e.panels],active:e.active,...e.rect})),e}save(){try{let e=localStorage.getItem(T),t=e?JSON.parse(e):{};t.workspace=this.workspace,t.layouts={...t.layouts||{},[this.workspace]:this.snapshot()},localStorage.setItem(T,JSON.stringify(t))}catch{return}}savedNames(){try{let e=JSON.parse(localStorage.getItem(T)||`{}`);return Object.keys(e.custom||{})}catch{return[]}}switchTo(e){let t=null;try{let n=JSON.parse(localStorage.getItem(T)||`{}`);t=n.layouts?.[e]??n.custom?.[e]??null}catch{t=null}this.applyLayout(t??w[e]??w.Default,e),this.save()}resetWorkspace(){this.applyLayout(w[this.workspace]??w.Default,this.workspace),this.save()}saveAs(e){try{let t=JSON.parse(localStorage.getItem(T)||`{}`);t.custom={...t.custom||{},[e]:this.snapshot()},localStorage.setItem(T,JSON.stringify(t))}catch{return}this.workspace=e,this.save(),this.onWorkspace?.(e)}find(e){for(let t of ne)for(let n of this.groups[t])if(n.panels.includes(e))return n}home(e){let t=e===`essential`?this.find(`effectsPresets`):void 0;if(t&&t.area!==`float`)return t;let n=e===`composition`?`center`:[`timeline`,`renderQueue`,`terminal`,`agents`,`graph`,`flowchart`].includes(e)?`bottom`:`right`;return this.groups[n][0]??this.groups.right[0]??this.groups.bottom[0]??this.groups.center[0]}show(e){if(!this.factories.has(e))return;let t=this.find(e);if(!t){if(t=this.home(e),!t)return;t.add(e,!0),this.applySizes()}t.activate(e),this.focus(e)}undock(e){let t=this.find(e);if(!t||t.area===`float`)return;let n=this.el.getBoundingClientRect(),r=new re(this,`float`),i=this.groups.float.length;r.rect={x:Math.max(0,n.width/2-260+i*28),y:Math.max(0,n.height/2-200+i*28),w:520,h:400},this.areas.float.appendChild(r.el),this.groups.float.push(r),r.place(),this.move(e,r),this.focus(e)}redock(e){let t=this.find(e);if(!t||t.area!==`float`)return;let n=this.home(e);n?this.move(e,n):this.close(e)}isVisible(e){let t=this.made.get(e);return!!t&&!t.el.hidden}close(e){let t=this.find(e);t&&(t.remove(e),t.panels.length||(t.el.remove(),this.groups[t.area]=this.groups[t.area].filter(e=>e!==t),this.applySizes()),this.save())}move(e,t){let n=this.find(e);n!==t&&(n?.remove(e),n&&!n.panels.length&&(n.el.remove(),this.groups[n.area]=this.groups[n.area].filter(e=>e!==n)),t.add(e,!0),this.applySizes(),this.save())}raise(e){let t=this.groups.float;e.area===`float`&&t[t.length-1]!==e&&(this.groups.float=[...t.filter(t=>t!==e),e],this.groups.float.forEach((e,t)=>e.el.style.zIndex=String(t+1)))}maximize(e){e.area!==`float`&&(this.maximized===e?(this.maximized=null,n(this.el,`is-maximized`,!1),n(e.el,`is-max`,!1)):(this.maximized&&n(this.maximized.el,`is-max`,!1),this.maximized=e,n(this.el,`is-maximized`,!0),n(e.el,`is-max`,!0)),this.resized())}toggleMaximizeFocused(){let e=this.find(this.focused);e&&this.maximize(e)}focused=`queue`;focus(e){if(!e||this.focused===e)return;let t=this.find(this.focused);t&&n(t.el,`is-focused`,!1),this.focused=e;let r=this.find(e);r&&n(r.el,`is-focused`,!0),this.onFocus?.(e)}},E={studio:{label:`Studio Dark`,vars:{"--bg-primary":`#111111`,"--bg-secondary":`#17151b`,"--bg-tertiary":`#222127`,"--border-color":`#2a2a2a`,"--border-light":`#34333a`,"--text-primary":`#f7f7f7`,"--text-secondary":`#a4a4a4`,"--text-muted":`#717072`,"--canvas-bg":`#1c1b1d`,"--grid-color":`#5e5e60`,"--bg-node":`#191919`}},"nodemode-dark":{label:`NodeMode Dark`,vars:{"--bg-primary":`#0a0a0a`,"--bg-secondary":`#121218`,"--bg-tertiary":`#1a1a24`,"--border-color":`#2a2a35`,"--border-light":`#3a3a48`,"--text-primary":`#e8e8ee`,"--text-secondary":`#a8a8b8`,"--text-muted":`#6a6a7a`,"--canvas-bg":`#0a0a0a`,"--grid-color":`rgba(255,255,255,0.04)`,"--node-shadow":`0 6px 18px rgba(0,0,0,0.45)`}},light:{label:`Light`,light:!0,vars:{"--bg-primary":`#ecebe6`,"--bg-secondary":`#f7f6f1`,"--bg-tertiary":`#e2e0d8`,"--bg-node":`#f4f3ed`,"--border-color":`#d1cdc1`,"--border-light":`#beb9aa`,"--text-primary":`#26241d`,"--text-secondary":`#4c4a40`,"--text-muted":`#8b887a`,"--canvas-bg":`#e7e5dd`,"--grid-color":`rgba(70,60,30,0.10)`,"--node-shadow":`0 5px 14px rgba(96,90,70,0.15)`}},"github-dark":{label:`GitHub Dark`,vars:{"--bg-primary":`#0d1117`,"--bg-secondary":`#161b22`,"--bg-tertiary":`#21262d`,"--border-color":`#30363d`,"--border-light":`#3d444d`,"--text-primary":`#e6edf3`,"--text-secondary":`#9198a1`,"--text-muted":`#656c76`,"--canvas-bg":`#0d1117`,"--grid-color":`rgba(230,237,243,0.05)`,"--node-shadow":`0 6px 18px rgba(0,0,0,0.5)`}},midnight:{label:`Midnight Blue`,vars:{"--bg-primary":`#0b1020`,"--bg-secondary":`#101830`,"--bg-tertiary":`#182242`,"--border-color":`#25325c`,"--border-light":`#324274`,"--text-primary":`#e4e9f7`,"--text-secondary":`#9fabd0`,"--text-muted":`#63709a`,"--canvas-bg":`#0b1020`,"--grid-color":`rgba(160,180,255,0.06)`,"--node-shadow":`0 8px 22px rgba(0,0,20,0.55)`}},forest:{label:`Forest`,vars:{"--bg-primary":`#0c130e`,"--bg-secondary":`#121c15`,"--bg-tertiary":`#1a281e`,"--border-color":`#2a4030`,"--border-light":`#375441`,"--text-primary":`#e4efe7`,"--text-secondary":`#a4bdac`,"--text-muted":`#6a8674`,"--canvas-bg":`#0c130e`,"--grid-color":`rgba(180,230,190,0.05)`,"--node-shadow":`0 6px 18px rgba(0,10,0,0.5)`}},ember:{label:`Ember`,vars:{"--bg-primary":`#140d0a`,"--bg-secondary":`#1d1310`,"--bg-tertiary":`#2a1c16`,"--border-color":`#452e22`,"--border-light":`#5a3d2e`,"--text-primary":`#f2e8e2`,"--text-secondary":`#c7ab9c`,"--text-muted":`#8f7263`,"--canvas-bg":`#140d0a`,"--grid-color":`rgba(255,200,160,0.05)`,"--node-shadow":`0 6px 18px rgba(20,5,0,0.55)`}},violet:{label:`Violet Haze`,vars:{"--bg-primary":`#100b1c`,"--bg-secondary":`#171129`,"--bg-tertiary":`#221a3c`,"--border-color":`#382c5e`,"--border-light":`#493b78`,"--text-primary":`#ece6f9`,"--text-secondary":`#b3a6d8`,"--text-muted":`#7a6da3`,"--canvas-bg":`#100b1c`,"--grid-color":`rgba(210,190,255,0.06)`,"--node-shadow":`0 8px 22px rgba(10,0,30,0.55)`}},slate:{label:`Slate`,vars:{"--bg-primary":`#101418`,"--bg-secondary":`#171d23`,"--bg-tertiary":`#212a32`,"--border-color":`#32404c`,"--border-light":`#415260`,"--text-primary":`#e7edf2`,"--text-secondary":`#a3b2bf`,"--text-muted":`#6b7a87`,"--canvas-bg":`#101418`,"--grid-color":`rgba(200,220,240,0.05)`,"--node-shadow":`0 6px 18px rgba(0,5,10,0.5)`}},mono:{label:`Mono Ink`,vars:{"--bg-primary":`#0e0e0e`,"--bg-secondary":`#161616`,"--bg-tertiary":`#202020`,"--border-color":`#333333`,"--border-light":`#454545`,"--text-primary":`#f0f0f0`,"--text-secondary":`#ababab`,"--text-muted":`#6e6e6e`,"--canvas-bg":`#0e0e0e`,"--grid-color":`rgba(255,255,255,0.05)`,"--node-shadow":`0 6px 18px rgba(0,0,0,0.5)`}},sand:{label:`Sand (light)`,light:!0,vars:{"--bg-primary":`#efe8da`,"--bg-secondary":`#f8f3e9`,"--bg-tertiary":`#e6dcc8`,"--bg-node":`#f5efe2`,"--border-color":`#d4c7ab`,"--border-light":`#c2b28e`,"--text-primary":`#2a2418`,"--text-secondary":`#59503c`,"--text-muted":`#8d8168`,"--canvas-bg":`#eae2d1`,"--grid-color":`rgba(80,60,10,0.10)`,"--node-shadow":`0 5px 14px rgba(100,80,30,0.16)`}},ocean:{label:`Deep Ocean`,vars:{"--bg-primary":`#06131c`,"--bg-secondary":`#0a1c29`,"--bg-tertiary":`#10293c`,"--border-color":`#1d425e`,"--border-light":`#285578`,"--text-primary":`#e2eef7`,"--text-secondary":`#96b6cc`,"--text-muted":`#5b7d94`,"--canvas-bg":`#06131c`,"--grid-color":`rgba(150,210,255,0.06)`,"--node-shadow":`0 8px 22px rgba(0,10,20,0.6)`}},rose:{label:`Rose Noir`,vars:{"--bg-primary":`#170b10`,"--bg-secondary":`#211117`,"--bg-tertiary":`#301a22`,"--border-color":`#4d2b38`,"--border-light":`#653a49`,"--text-primary":`#f5e7ec`,"--text-secondary":`#cfa5b3`,"--text-muted":`#966b7b`,"--canvas-bg":`#170b10`,"--grid-color":`rgba(255,190,215,0.05)`,"--node-shadow":`0 6px 18px rgba(25,0,10,0.55)`}},terminal:{label:`Terminal Green`,vars:{"--bg-primary":`#050d05`,"--bg-secondary":`#0a140a`,"--bg-tertiary":`#102010`,"--border-color":`#1f3d1f`,"--border-light":`#2b522b`,"--text-primary":`#d8f5d8`,"--text-secondary":`#8fce8f`,"--text-muted":`#568a56`,"--canvas-bg":`#050d05`,"--grid-color":`rgba(120,255,120,0.06)`,"--node-shadow":`0 6px 18px rgba(0,10,0,0.6)`}},contrast:{label:`High Contrast`,vars:{"--bg-primary":`#000000`,"--bg-secondary":`#0a0a0a`,"--bg-tertiary":`#161616`,"--border-color":`#555555`,"--border-light":`#777777`,"--text-primary":`#ffffff`,"--text-secondary":`#d8d8d8`,"--text-muted":`#9a9a9a`,"--canvas-bg":`#000000`,"--grid-color":`rgba(255,255,255,0.10)`,"--node-shadow":`0 0 0 1px #666`}}},ae=`studio`,oe=`#f2545b`,se=`formencoder_ui_settings`,ce=e=>typeof e==`number`&&Number.isFinite(e)?Math.min(1.5,Math.max(0,e)):1;function le(){try{let e=localStorage.getItem(se);if(e){let t=JSON.parse(e);return{theme:t.theme&&E[t.theme]?t.theme:ae,accentColor:t.accentColor||`#f2545b`,intensity:ce(t.intensity)}}}catch(e){console.error(`[theme] read failed:`,e)}return{theme:ae,accentColor:oe,intensity:1}}function ue(e){try{let t=localStorage.getItem(se),n={...t?JSON.parse(t):{},...e,appearance:1};localStorage.setItem(se,JSON.stringify(n))}catch(e){console.error(`[theme] save failed:`,e)}}function de(e=le()){let t=document.documentElement,n=E[e.theme]||E.studio;for(let[e,r]of Object.entries(n.vars))t.style.setProperty(e,r);document.body.classList.toggle(`theme-light`,!!n.light),t.style.setProperty(`--bg-node`,n.vars[`--bg-node`]||n.vars[`--bg-secondary`]),t.style.setProperty(`--shadow-lg`,n.light?`0 4px 14px rgba(96, 90, 70, 0.16)`:`0 8px 32px rgba(0, 0, 0, 0.5)`),t.style.setProperty(`--accent-color`,e.accentColor),t.style.setProperty(`--accent-color-dim`,e.accentColor+`33`),t.style.setProperty(`--accent-color-hover`,`color-mix(in srgb, ${e.accentColor} 82%, #ffffff)`),t.style.setProperty(`--accent-intensity`,String(ce(e.intensity))),t.style.setProperty(`--accent-tint`,pe(e.accentColor,.06)),t.style.setProperty(`--accent-tint-strong`,pe(e.accentColor,.1))}function fe(e){let t={...le(),theme:e};ue(t),de(t),document.dispatchEvent(new CustomEvent(`nm:ui-settings-changed`,{detail:{key:`theme`}}))}function pe(e,t){let n=e.replace(`#`,``),r=n.length===3?n.split(``).map(e=>e+e).join(``):n,i=parseInt(r.slice(0,6),16);return Number.isNaN(i)?`rgba(171,160,211,${t})`:`rgba(${i>>16&255},${i>>8&255},${i&255},${t})`}var me=`0.10.0`;function he(e,t){let n=(e,t)=>e>>16-t*8&255,r=Array.from(e.keys()),i=[{lo:0,hi:r.length}],a=r,o=t=>{let r=0,i=-1;for(let o=0;o<3;o++){let s=255,c=0;for(let r=t.lo;rc&&(c=t)}c-s>i&&(i=c-s,r=o)}return{c:r,span:i}};for(;i.length{if(e.hi-e.lo<2)return;let i=o(e),a=i.span*Math.sqrt(e.hi-e.lo);a>r&&(r=a,t=n,s=i.c)}),t<0)break;let c=i[t],l=a.slice(c.lo,c.hi).sort((t,r)=>n(e[t],s)-n(e[r],s));for(let e=0;e>1);i.splice(t,1,{lo:c.lo,hi:u},{lo:u,hi:c.hi})}let s=new Uint8Array(768);return i.forEach((t,r)=>{let i=0,o=0,c=0,l=Math.max(1,t.hi-t.lo);for(let r=t.lo;r{for(a|=e<=8;)t.push(a&255),a>>>=8,o-=8};s(256);let c=e[0];for(let t=1;t1<0&&t.push(a&255),Uint8Array.from(t)}var ve=class{width;height;parts=[];constructor(e,t){this.width=e,this.height=t;let n=new Uint8Array(13),r=new DataView(n.buffer);n.set(new TextEncoder().encode(`GIF89a`),0),r.setUint16(6,e,!0),r.setUint16(8,t,!0),n[10]=0,n[11]=0,n[12]=0,this.parts.push(n),this.parts.push(Uint8Array.from([33,255,11,...new TextEncoder().encode(`NETSCAPE2.0`),3,1,0,0,0]))}addFrame(e,t){let n=this.width*this.height,r=Math.max(1,Math.floor(n/12e3)),i=[];for(let t=0;t{let r=e>>3<<10|t>>3<<5|n>>3,i=o.get(r);if(i!==void 0)return i;let s=e>>3<<3|4,c=t>>3<<3|4,l=n>>3<<3|4,u=0,d=1/0;for(let e=0;e<256;e++){let t=a[e*3]-s,n=a[e*3+1]-c,r=a[e*3+2]-l,i=t*t*2+n*n*4+r*r*3;i>8&255,0,0]));let l=new Uint8Array(10),u=new DataView(l.buffer);l[0]=44,u.setUint16(5,this.width,!0),u.setUint16(7,this.height,!0),l[9]=135,this.parts.push(l),this.parts.push(a),this.parts.push(Uint8Array.from([8]));let d=_e(c);for(let e=0;ee>0?-.691+10*Math.log10(e):-1/0;function Ce(e,t){if(!e.length)return-1/0;let n=(e.length-1)*t,r=Math.floor(n),i=Math.min(e.length-1,r+1);return e[r]+(e[i]-e[r])*(n-r)}function we(e,t){let n=[];for(let r=0;r+t<=e.length;r++){let i=0;for(let n=0;n=e.length)continue;let o=i-n,s=Math.abs(o)<1e-9?1:Math.sin(Math.PI*o)/(Math.PI*o),c=.5+.5*Math.cos(Math.PI*o/9);r+=e[a]*s*c}return r}function Ee(e){let t=0;for(let n of e)for(let e=0;et&&(t=r)}let n=t,r=t*.55;for(let t of e)for(let e=0;en&&(n=i)}return{sample:t,truePeak:n}}function De(e,t){let n=e=>e>0?20*Math.log10(e):-1/0,r=e[0]?.length??0,i=Ee(e),a=Math.round(t*.1),o=Math.floor(r/a),s=Se(e.length),c=new Float64Array(o);e.forEach((e,n)=>{if(!s[n])return;let r=xe(e,t);for(let e=0;eD(e)>-70),d=-1/0;if(u.length){let e=D(u.reduce((e,t)=>e+t,0)/u.length)-10,t=l.filter(t=>D(t)>-70&&D(t)>e);t.length&&(d=D(t.reduce((e,t)=>e+t,0)/t.length))}let f=we(c,30).filter(e=>D(e)>-70),p=0,m=-1/0;if(f.length){let e=D(f.reduce((e,t)=>e+t,0)/f.length)-20,t=f.map(D).filter(t=>t>e).sort((e,t)=>e-t);t.length&&(p=Ce(t,.95)-Ce(t,.1),m=t[t.length-1])}return{integrated:d,lra:p,samplePeak:n(i.sample),truePeak:n(i.truePeak),shortTermMax:m}}function Oe(e){return Number.isFinite(e)?e.toFixed(1):`-inf`}function O(e){return`${Oe(e.integrated)} LUFS, LRA ${e.lra.toFixed(1)} LU, peak ${Oe(e.truePeak)} dBTP`}function ke(e,t,n=-1){if(!Number.isFinite(e.integrated))return{gainDb:0,limited:!1};let r=t-e.integrated,i=n-e.truePeak;return Number.isFinite(i)&&r>i?{gainDb:i,limited:!0}:{gainDb:r,limited:!1}}function k(e){let t=0;for(let n of e)t+=n.length;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function Ae(e){let t=[],n=e;for(;n>0;)t.unshift(n&255),n=Math.floor(n/256);return Uint8Array.from(t)}function je(e){let t=1;for(;t<8&&e>=2**(7*t)-1;)t++;let n=new Uint8Array(t),r=e;for(let e=t-1;e>=0;e--)n[e]=r%256,r=Math.floor(r/256);return n[0]|=1<<8-t,n}function A(e,t){return k([Ae(e),je(t.length),t])}function j(e,t){let n=[],r=t;do n.unshift(r%256),r=Math.floor(r/256);while(r>0);return A(e,Uint8Array.from(n))}function Me(e,t){let n=new Uint8Array(8);return new DataView(n.buffer).setFloat64(0,t,!1),A(e,n)}function M(e,t){return A(e,new TextEncoder().encode(t))}function Ne(e){let t=new Uint8Array(19),n=new DataView(t.buffer);return t.set(new TextEncoder().encode(`OpusHead`),0),t[8]=1,t[9]=e.channels,n.setUint16(10,e.preSkip,!0),n.setUint32(12,e.sampleRate,!0),n.setInt16(16,0,!0),t[18]=0,t}function Pe(e){return Ne(e)}function Fe(e,t,n,r){let i=A(440786851,k([j(17030,1),j(17143,1),j(17138,4),j(17139,8),M(17026,`webm`),j(17031,4),j(17029,2)])),a=A(357149030,k([j(2807729,1e6),Me(17545,r),M(19840,`formencoder demo`),M(22337,`formencoder demo`)])),o=[];e&&o.push(A(174,k([j(215,1),j(29637,1),j(131,1),j(156,0),M(134,e.codec),A(224,k([j(176,e.width),j(186,e.height)]))]))),t&&o.push(A(174,k([j(215,2),j(29637,2),j(131,2),j(156,0),M(134,`A_OPUS`),j(22186,Math.round(t.preSkip/48e3*1e9)),j(22203,8e7),A(25506,Ne(t)),A(225,k([Me(181,t.sampleRate),j(159,t.channels)]))])));let s=A(374648427,k(o)),c=[...n].sort((e,t)=>e.timeMs-t.timeMs||e.track-t.track),l=[],u=[],d=a.length+s.length,f=[],p=0,m=!1,h=()=>{if(!m)return;let e=A(524531317,k([j(231,Math.round(p)),...f]));l.push(e),d+=e.length,f=[],m=!1};for(let e of c){let t=Math.round(e.timeMs),n=t-Math.round(p);(!m||e.track===1&&e.key&&n>0||n>3e4)&&(h(),p=t,m=!0,e.track===1&&e.key&&u.push({timeMs:t,offset:d}));let r=new Uint8Array(4);r[0]=128|e.track,new DataView(r.buffer).setInt16(1,t-Math.round(p),!1),r[3]=e.key?128:0,f.push(A(163,k([r,e.data])))}h();let g=u.length?A(475249515,k(u.map(e=>A(187,k([j(179,e.timeMs),A(183,k([j(247,1),j(241,e.offset)]))]))))):new Uint8Array,_=A(408125543,k([a,s,...l,g]));return new Blob([i,_],{type:`video/webm`})}var Ie=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t<<24;for(let e=0;e<8;e++)n=n&2147483648?n<<1^79764919:n<<1;e[t]=n>>>0}return e})();function Le(e){let t=0;for(let n=0;n>>24^e[n])&255])>>>0;return t>>>0}function Re(e,t,n,r,i,a=!1){let o=[];for(let t of e){let e=t.length;for(;e>=255;)o.push(255),e-=255;o.push(e)}let s=e.reduce((e,t)=>e+t.length,0),c=new Uint8Array(27+o.length+s),l=new DataView(c.buffer);c.set(new TextEncoder().encode(`OggS`),0),c[4]=0,c[5]=t|+!!a,l.setBigUint64(6,BigInt(n),!0),l.setUint32(14,r,!0),l.setUint32(18,i,!0),c[26]=o.length,c.set(o,27);let u=27+o.length;for(let t of e)c.set(t,u),u+=t.length;return l.setUint32(22,Le(c),!0),c}function ze(e,t,n,r){let i=1178947139,a=[],o=Pe({sampleRate:r,channels:t,preSkip:n}),s=new TextEncoder().encode(`formencoder demo`),c=new Uint8Array(12+s.length+4),l=new DataView(c.buffer);c.set(new TextEncoder().encode(`OpusTags`),0),l.setUint32(8,s.length,!0),c.set(s,12),l.setUint32(12+s.length,0,!0),a.push(Re([o],2,0,i,0)),a.push(Re([c],0,0,i,1));let u=2,d=n,f=[],p=e.length;return e.forEach((e,t)=>{f.push(e),d+=e.samples;let n=t===p-1;(f.length>=40||n)&&(a.push(Re(f.map(e=>e.data),n?4:0,d,i,u++)),f=[])}),new Blob(a,{type:`audio/ogg`})}function Be(e,t){let n=t===16?32767:8388607,r=Math.max(-1,Math.min(1,e));return Math.round(r<0?r*(n+1):r*n)}function Ve(e,t,n){let r=e[0]?.length??0,i=e.length,a=n/8,o=r*i*a,s=new ArrayBuffer(44+o),c=new DataView(s),l=(e,t)=>{for(let n=0;n>8&255),c.setUint8(u+2,i>>16&255)),u+=a}return new Blob([s],{type:`audio/wav`})}function He(e,t,n){let r=e[0]?.length??0,i=e.length,a=n/8,o=r*i*a,s=new ArrayBuffer(54+o),c=new DataView(s),l=(e,t)=>{for(let n=0;n>16&255),c.setUint8(d+1,i>>8&255),c.setUint8(d+2,i&255)),d+=a}return new Blob([s],{type:`audio/aiff`})}var Ue=[[`match-source-high`,`Match Source - High bitrate`,`Web Video`,`h264`,null,null,null,20],[`match-source-medium`,`Match Source - Medium bitrate`,`Web Video`,`h264`,null,null,null,10],[`match-source-adaptive-high`,`Match Source - Adaptive High Bitrate`,`Web Video`,`h264`,null,null,null,null],[`hevc-match-source-high`,`HEVC Match Source - High bitrate`,`Web Video`,`hevc`,null,null,null,14],[`hevc-4k-hdr10`,`HEVC 4K HDR10 (Rec. 2100 PQ)`,`Web Video`,`hevc`,3840,2160,null,40],[`av1-match-source`,`AV1 Match Source`,`Web Video`,`av1`,null,null,null,null],[`webm-vp9-1080p`,`WebM VP9 1080p`,`Web Video`,`webm`,1920,1080,null,null],[`webm-vp9-alpha`,`WebM VP9 with Alpha`,`Web Video`,`webm`,null,null,null,null],[`youtube-1080p`,`YouTube 1080p Full HD`,`Social Media`,`h264`,1920,1080,null,16],[`youtube-1440p`,`YouTube 1440p 2K QHD`,`Social Media`,`h264`,2560,1440,null,24],[`youtube-2160p`,`YouTube 2160p 4K UHD`,`Social Media`,`h264`,3840,2160,null,45],[`youtube-shorts`,`YouTube Shorts 1080x1920`,`Social Media`,`h264`,1080,1920,null,16],[`vimeo-1080p`,`Vimeo 1080p Full HD`,`Social Media`,`h264`,1920,1080,null,20],[`vimeo-2160p`,`Vimeo 2160p 4K UHD`,`Social Media`,`h264`,3840,2160,null,50],[`x-1080p`,`X (Twitter) 1080p`,`Social Media`,`h264`,1920,1080,null,8],[`instagram-reels`,`Instagram Reels and Stories 1080x1920`,`Social Media`,`h264`,1080,1920,30,10],[`instagram-feed-square`,`Instagram Feed 1080x1080`,`Social Media`,`h264`,1080,1080,30,8],[`tiktok`,`TikTok 1080x1920`,`Social Media`,`h264`,1080,1920,null,10],[`facebook-1080p`,`Facebook 1080p`,`Social Media`,`h264`,1920,1080,null,10],[`linkedin-1080p`,`LinkedIn 1080p`,`Social Media`,`h264`,1920,1080,30,8],[`apple-tv-4k`,`Apple TV 4K (HEVC)`,`Devices`,`hevc`,3840,2160,null,25],[`iphone-1080p`,`Apple iPhone and iPad 1080p`,`Devices`,`h264`,1920,1080,null,10],[`android-1080p`,`Android Phone and Tablet 1080p`,`Devices`,`h264`,1920,1080,null,10],[`android-720p`,`Android Phone 720p`,`Devices`,`h264`,1280,720,null,5],[`prores-proxy`,`Apple ProRes 422 Proxy`,`Mezzanine`,`prores`,null,null,null,null],[`prores-lt`,`Apple ProRes 422 LT`,`Mezzanine`,`prores`,null,null,null,null],[`prores-422`,`Apple ProRes 422`,`Mezzanine`,`prores`,null,null,null,null],[`prores-hq`,`Apple ProRes 422 HQ`,`Mezzanine`,`prores`,null,null,null,null],[`prores-4444`,`Apple ProRes 4444`,`Mezzanine`,`prores`,null,null,null,null],[`prores-4444-alpha`,`Apple ProRes 4444 with Alpha`,`Mezzanine`,`prores`,null,null,null,null],[`prores-4444xq`,`Apple ProRes 4444 XQ`,`Mezzanine`,`prores`,null,null,null,null],[`dnxhr-lb`,`DNxHR LB`,`Mezzanine`,`quicktime`,null,null,null,null],[`dnxhr-sq`,`DNxHR SQ`,`Mezzanine`,`quicktime`,null,null,null,null],[`dnxhr-hq`,`DNxHR HQ`,`Mezzanine`,`quicktime`,null,null,null,null],[`dnxhr-hqx`,`DNxHR HQX 10-bit`,`Mezzanine`,`quicktime`,null,null,null,null],[`dnxhr-444`,`DNxHR 444 10-bit`,`Mezzanine`,`quicktime`,null,null,null,null],[`cineform-high`,`GoPro CineForm YUV 10-bit`,`Mezzanine`,`cineform`,null,null,null,null],[`cineform-alpha`,`GoPro CineForm RGBA 12-bit with Alpha`,`Mezzanine`,`cineform`,null,null,null,null],[`animation-alpha`,`QuickTime Animation with Alpha`,`Mezzanine`,`quicktime`,null,null,null,null],[`uncompressed-10bit`,`Uncompressed 10-bit 4:2:2 (v210)`,`Mezzanine`,`quicktime`,null,null,null,null],[`xdcam-hd422-1080i50`,`XDCAM HD 422 1080i 25 (50 Mb/s)`,`Broadcast`,`mxf_op1a`,1920,1080,25,null],[`xdcam-hd422-1080i5994`,`XDCAM HD 422 1080i 29.97 (50 Mb/s)`,`Broadcast`,`mxf_op1a`,1920,1080,29.97,null],[`xdcam-hd422-720p50`,`XDCAM HD 422 720p 50 (50 Mb/s)`,`Broadcast`,`mxf_op1a`,1280,720,50,null],[`dnxhr-hq-mxf`,`DNxHR HQ MXF OP1a`,`Broadcast`,`dnxhr_mxf`,null,null,null,null],[`dnxhd-145-mxf`,`DNxHD 145 MXF OP1a 1080`,`Broadcast`,`dnxhr_mxf`,1920,1080,null,null],[`prores-hq-mxf`,`Apple ProRes 422 HQ MXF OP1a`,`Broadcast`,`prores_mxf`,null,null,null,null],[`jpeg2000-mxf`,`JPEG 2000 MXF OP1a`,`Broadcast`,`jpeg2000_mxf`,null,null,null,null],[`mpeg2-1080i`,`MPEG-2 1080i 29.97 Broadcast`,`Broadcast`,`mpeg2`,1920,1080,29.97,25],[`h264-broadcast-ebu`,`H.264 Broadcast, EBU R128 loudness`,`Broadcast`,`h264`,1920,1080,null,30],[`h264-broadcast-atsc`,`H.264 Broadcast, ATSC A/85 loudness`,`Broadcast`,`h264`,1920,1080,null,30],[`mpeg2-dvd-ntsc`,`NTSC DV Widescreen DVD`,`DVD`,`mpeg2_dvd`,720,480,29.97,6],[`bluray-mpeg2-1080i`,`Blu-ray MPEG-2 1080i 29.97`,`DVD`,`mpeg2_bluray`,1920,1080,29.97,25],[`bluray-h264-1080p24`,`Blu-ray H.264 1080p 23.976`,`DVD`,`h264_bluray`,1920,1080,23.976,25],[`as10-high-hd-1080i50`,`AS-10 HIGH_HD_2014 1080i 25`,`Broadcast`,`as10`,null,null,25,null],[`as10-high-hd-1080i5994`,`AS-10 HIGH_HD_2014 1080i 29.97`,`Broadcast`,`as10`,null,null,29.97,null],[`as11-mpeg2-1080i50`,`AS-11 OP1a MPEG-2 HD422 1080i 25`,`Broadcast`,`as11`,null,null,25,null],[`as11-d10-imx50-625`,`AS-11 D10 IMX 50 625 (UK DPP SD)`,`Broadcast`,`as11_d10`,null,null,null,null],[`p2-dvcprohd-1080i50`,`P2 DVCPRO HD 1080i 25`,`Broadcast`,`p2`,null,null,null,null],[`p2-dvcprohd-720p50`,`P2 DVCPRO HD 720p 50`,`Broadcast`,`p2`,null,null,null,null],[`dcp-2k-flat-24`,`DCP 2K Flat 24 (SMPTE)`,`Cinema`,`dcp`,null,null,24,null],[`dcp-2k-scope-24`,`DCP 2K Scope 24 (SMPTE)`,`Cinema`,`dcp`,null,null,24,null],[`dcp-2k-flat-24-interop`,`DCP 2K Flat 24 (Interop)`,`Cinema`,`dcp`,null,null,24,null],[`dcp-4k-flat-24`,`DCP 4K Flat 24 (SMPTE)`,`Cinema`,`dcp`,null,null,24,null],[`mpeg2-dvd-pal`,`PAL DV Widescreen DVD`,`DVD`,`mpeg2_dvd`,720,576,25,6],[`png-sequence`,`PNG Sequence`,`Image Sequence`,`png`,null,null,null,null],[`png-sequence-alpha`,`PNG Sequence with Alpha`,`Image Sequence`,`png`,null,null,null,null],[`tiff-sequence-16`,`TIFF Sequence 16-bit`,`Image Sequence`,`tiff`,null,null,null,null],[`dpx-sequence-10`,`DPX Sequence 10-bit`,`Image Sequence`,`dpx`,null,null,null,null],[`exr-sequence-half`,`OpenEXR Sequence (half float)`,`Image Sequence`,`exr`,null,null,null,null],[`jpeg-sequence`,`JPEG Sequence`,`Image Sequence`,`jpeg`,null,null,null,null],[`targa-sequence`,`Targa Sequence`,`Image Sequence`,`targa`,null,null,null,null],[`png-still`,`PNG Still (first frame of the range)`,`Image`,`png`,null,null,null,null],[`jpeg-still`,`JPEG Still`,`Image`,`jpeg`,null,null,null,null],[`gif-480`,`Animated GIF 480 px`,`Animated GIF`,`gif`,null,null,15,null],[`gif-720`,`Animated GIF 720 px`,`Animated GIF`,`gif`,null,null,20,null],[`wav-48-24`,`Waveform Audio 48 kHz 24-bit`,`Audio Only`,`wav`,null,null,null,null],[`wav-48-16`,`Waveform Audio 48 kHz 16-bit`,`Audio Only`,`wav`,null,null,null,null],[`bwf-ebu`,`Broadcast WAV, EBU R128 loudness`,`Audio Only`,`bwf`,null,null,null,null],[`aiff-48-24`,`AIFF 48 kHz 24-bit`,`Audio Only`,`aiff`,null,null,null,null],[`mp3-320`,`MP3 320 kb/s`,`Audio Only`,`mp3`,null,null,null,null],[`mp3-podcast`,`MP3 Podcast, -16 LUFS`,`Audio Only`,`mp3`,null,null,null,null],[`aac-256`,`AAC Audio 256 kb/s`,`Audio Only`,`aac`,null,null,null,null],[`aac-streaming`,`AAC Streaming, -14 LUFS`,`Audio Only`,`aac`,null,null,null,null],[`flac-48-24`,`FLAC 48 kHz 24-bit`,`Audio Only`,`flac`,null,null,null,null],[`ogg-opus`,`Ogg Opus 160 kb/s`,`Audio Only`,`ogg`,null,null,null,null],[`ffv1-archive`,`FFV1 Lossless Archive (Matroska)`,`Archive`,`matroska`,null,null,null,null],[`proxy-prores`,`ProRes Proxy, quarter size (proxy)`,`Proxy`,`prores`,960,540,null,null],[`proxy-h264-540`,`H.264 Proxy 960x540`,`Proxy`,`h264`,960,540,null,3],[`proxy-h264-720`,`H.264 Proxy 1280x720 (formcut)`,`Proxy`,`h264`,1280,720,null,5],[`proxy-cineform`,`CineForm Proxy 1280x720`,`Proxy`,`cineform`,1280,720,null,null],[`family-formcut-mezzanine`,`formcut mezzanine (ProRes 422 HQ)`,`Form Family`,`prores`,null,null,null,null],[`family-formwav-audio`,`formwav session audio (WAV 48 kHz 24-bit)`,`Form Family`,`wav`,null,null,null,null],[`family-formvis-stills`,`formvis stills (PNG Sequence)`,`Form Family`,`png`,null,null,null,null]],We=new Set([`h264`,`hevc`,`av1`,`webm`,`mpeg2`,`mpeg2_dvd`,`mpeg2_bluray`,`h264_bluray`,`matroska`]);function Ge(e,t){return e===`webm-vp9-alpha`||e===`ffv1-archive`?null:We.has(t)?`webm`:t===`gif`?`gif`:t===`wav`||t===`bwf`?`wav`:t===`aiff`?`aiff`:t===`ogg`?`ogg`:e===`png-still`?`png`:e===`jpeg-still`?`jpeg`:null}function Ke(e){if(/EBU R128/.test(e))return-23;if(/ATSC A\/85/.test(e))return-24;let t=/(-\d+) LUFS/.exec(e);return t?Number(t[1]):null}var N=Ue.map(([e,t,n,r,i,a,o,s])=>({id:e,name:t,category:n,format:r,width:i,height:a,fps:o,mbps:s,target:Ge(e,r),lufs:Ke(t),bits:/-16\b|16-bit/.test(t)?16:24})),P=new Map(N.map(e=>[e.id,e])),F={webm:`WebM`,gif:`GIF`,wav:`WAV`,aiff:`AIFF`,ogg:`Ogg Opus`,png:`PNG`,jpeg:`JPEG`},I={webm:`webm`,gif:`gif`,wav:`wav`,aiff:`aiff`,ogg:`opus`,png:`png`,jpeg:`jpg`},L={webm:`video/webm`,gif:`image/gif`,wav:`audio/wav`,aiff:`audio/aiff`,ogg:`audio/ogg`,png:`image/png`,jpeg:`image/jpeg`},qe={h264:`H.264`,hevc:`HEVC`,av1:`AV1`,webm:`WebM`,prores:`ProRes`,quicktime:`QuickTime`,cineform:`CineForm`,mxf_op1a:`MXF OP1a`,dnxhr_mxf:`DNx MXF`,prores_mxf:`ProRes MXF`,jpeg2000_mxf:`J2K MXF`,mpeg2:`MPEG-2`,mpeg2_dvd:`DVD`,mpeg2_bluray:`Blu-ray`,h264_bluray:`Blu-ray`,as10:`AS-10`,as11:`AS-11`,as11_d10:`AS-11 D10`,p2:`P2`,dcp:`DCP`,png:`PNG`,tiff:`TIFF`,dpx:`DPX`,exr:`EXR`,jpeg:`JPEG`,targa:`Targa`,gif:`GIF`,wav:`WAV`,bwf:`BWF`,aiff:`AIFF`,mp3:`MP3`,aac:`AAC`,flac:`FLAC`,ogg:`Ogg`,matroska:`Matroska`},Je=new Set([`wav`,`aiff`,`ogg`]);function Ye(e){return e.width&&e.height?`${e.width}x${e.height}`:``}function Xe(e){return e.fps?`${Number(e.fps.toFixed(3))}`:``}function Ze(e){return e.mbps?`${e.mbps} Mb/s`:``}var Qe=0,$e=()=>`src${++Qe}`,R=48e3;function et(e,t,n,r=8e3){return new Promise((i,a)=>{let o=window.setTimeout(()=>{l(),a(Error(`timed out waiting for ${t}`))},r),s=()=>{l(),i()},c=()=>{l(),a(Error(`the browser cannot decode this file`))},l=()=>{window.clearTimeout(o),e.removeEventListener(t,s),e.removeEventListener(n,c)};e.addEventListener(t,s),e.addEventListener(n,c)})}async function tt(e){if(Number.isFinite(e.duration))return e.duration;e.currentTime=1e101,await et(e,`durationchange`,`error`,4e3).catch(()=>void 0);let t=Number.isFinite(e.duration)?e.duration:0;return e.currentTime=0,t}async function nt(e){let t=e.requestVideoFrameCallback?.bind(e);if(!t)return 30;let n=[];return new Promise(r=>{let i=()=>{e.pause(),e.currentTime=0;let t=[];for(let e=1;en[e-1]&&t.push(n[e]-n[e-1]);t.sort((e,t)=>e-t);let i=1/(t.length?t[t.length>>1]:1/30),a=[12,15,23.976,24,25,29.97,30,50,59.94,60].reduce((e,t)=>Math.abs(t-i){n.push(r.mediaTime),n.length>=14?i():t(a)};t(a),e.muted=!0,e.play().catch(()=>i()),window.setTimeout(()=>{n.length<14&&i()},1500)})}async function rt(e,t){let n=URL.createObjectURL(e),r=document.createElement(`video`);r.muted=!0,r.preload=`auto`,r.playsInline=!0,r.src=n;try{await et(r,`loadedmetadata`,`error`)}catch(e){throw URL.revokeObjectURL(n),e}let i=await tt(r),a=r.videoWidth>0&&r.videoHeight>0,o=a?t??await nt(r):0;a&&await it(r,0);let s=null;return{id:$e(),name:e.name,kind:a?`video`:`audio`,sample:!1,size:e.size,width:r.videoWidth,height:r.videoHeight,fps:o,duration:i,async frame(e){return await it(r,Math.max(0,Math.min(e,Math.max(0,i-.001)))),r},audio(){return s||=(async()=>{if(e.size>629145600)return null;try{return await new OfflineAudioContext(2,1,R).decodeAudioData(await e.arrayBuffer())}catch{return null}})(),s},dispose(){r.removeAttribute(`src`),r.load(),URL.revokeObjectURL(n)}}}async function it(e,t){if(Math.abs(e.currentTime-t)<1e-4&&e.readyState>=2)return;let n=et(e,`seeked`,`error`,6e3);e.currentTime=t,await n}var at=640,ot=360,z=24,B=8;function st(){let e=R*B,t=new AudioBuffer({length:e,numberOfChannels:2,sampleRate:R}),n=t.getChannelData(0),r=t.getChannelData(1),i=[261.63,329.63,392,523.25,392,329.63,293.66,349.23],a=12345,o=()=>(a=a*1664525+1013904223>>>0,a/4294967296-.5);for(let t=0;t{e.fillStyle=t,e.fillRect(n/o.length*r,0,n/o.length+1,34)}),e.strokeStyle=`rgba(255,255,255,0.12)`,e.lineWidth=1;for(let i=-(t*40)%40;i=0;r--){let i=t-r*.035,a=n/2+Math.sin(i*1.7)*190,o=190+Math.cos(i*2.3)*70;e.fillStyle=`rgba(242, 84, 91, ${.9-r*.09})`,e.beginPath(),e.arc(a,o,26-r*1.6,0,Math.PI*2),e.fill()}e.strokeStyle=`rgba(255,255,255,0.8)`,e.lineWidth=3,e.beginPath(),e.arc(s,c,48,t*3,t*3+Math.PI*1.3),e.stroke();let l=.5+.5*Math.sin(t*6);e.fillStyle=`rgba(0,0,0,0.45)`,e.fillRect(18,300,604,14),e.fillStyle=`#f2545b`,e.fillRect(18,300,t/B*604,14),e.fillStyle=`rgba(255,255,255,${.5+l*.4})`,e.fillRect(18+t/B*604-2,296,4,22);let u=Math.floor(t*z),d=Math.floor(u/z),f=u%z;e.fillStyle=`#fff`,e.font=`600 44px ui-monospace, Menlo, monospace`,e.textBaseline=`alphabetic`,e.fillText(`00:00:${String(d).padStart(2,`0`)}:${String(f).padStart(2,`0`)}`,20,96),e.font=`500 15px system-ui, sans-serif`,e.fillStyle=`rgba(255,255,255,0.8)`,e.fillText(`formencoder sample · generated in this page · 640x360 · 24 fps`,20,344)}function lt(){let e=document.createElement(`canvas`);e.width=at,e.height=ot;let t=e.getContext(`2d`,{willReadFrequently:!1}),n=null;return{id:$e(),name:`formencoder-sample`,kind:`video`,sample:!0,size:0,width:at,height:ot,fps:z,duration:B,async frame(n){return ct(t,Math.max(0,Math.min(n,B))),e},async audio(){return n||=st(),n},dispose(){n=null}}}var ut=1280;function dt(e){return{size:`preset`,fps:null,mbps:null,codec:`auto`,audio:!0,lufs:e.lufs,start:0,end:null}}var V=e=>Math.max(2,Math.round(e/2)*2);function H(e,t,n){let r=Math.max(0,Math.min(n.start,e.duration)),i=Math.max(r+.05,Math.min(n.end??e.duration,e.duration)),a=e.width||640,o=e.height||360,s=!1,c=t.target===`gif`?Number(/(\d+) px/.exec(t.name)?.[1]??0):0;typeof n.size==`number`?(a=n.size,o=e.height/e.width*n.size):n.size===`preset`&&t.width&&t.height?(a=t.width,o=t.height,s=!0):n.size===`preset`&&c&&(a=c,o=e.height/e.width*c);let l=!1,u=Math.max(a,o);if(u>1280){let e=ut/u;a*=e,o*=e,l=!0}let d=V(a),f=V(o),p=d,m=f;if(s&&e.width&&e.height){let t=Math.min(d/e.width,f/e.height);p=V(e.width*t),m=V(e.height*t)}let h=n.fps??t.fps??(e.fps||30),g=Math.max(1,Math.min(60,t.target===`gif`?Math.min(h,25):h)),_=n.mbps??0;_||=t.mbps&&t.width&&t.height?t.mbps*(d*f/(t.width*t.height))*(g/(t.fps||30)):t.mbps?t.mbps*.25:.09*d*f*g/1e6,_=Math.max(.15,Math.min(14,_));let v=Math.max(1,Math.floor((i-r)*g));return{width:d,height:f,innerWidth:p,innerHeight:m,fps:g,mbps:_,start:r,end:i,frames:v,capped:l}}function ft(){let e=[];return e.push(typeof VideoEncoder>`u`?`VideoEncoder missing`:`VideoEncoder ready`),e.push(typeof AudioEncoder>`u`?`AudioEncoder missing`:`AudioEncoder ready`),e.join(`, `)}function U(e){if(e.aborted)throw new DOMException(`stopped`,`AbortError`)}function pt(){return new Promise(e=>window.setTimeout(e,0))}function mt(e,t,n,r,i){e.fillStyle=`#000`,e.fillRect(0,0,t.width,t.height);let a=(t.width-t.innerWidth)/2,o=(t.height-t.innerHeight)/2;e.drawImage(n,0,0,r,i,a,o,t.innerWidth,t.innerHeight)}function ht(e,t){return e instanceof HTMLVideoElement?{w:e.videoWidth,h:e.videoHeight}:e instanceof HTMLCanvasElement?{w:e.width,h:e.height}:{w:t.width,h:t.height}}async function gt(e,t){let n=await e.source.audio();if(!n)return null;let r=Math.floor(t.start*n.sampleRate),i=Math.min(n.length,Math.ceil(t.end*n.sampleRate)),a=[];for(let e=0;e=0?`+`:``}${t.gainDb.toFixed(1)} dB${t.limited?`, held at -1 dBTP`:``})`}else r=`Loudness ${O(i)}`;return{channels:n.channels,rate:n.rate,note:r}}async function yt(e,t,n,r){if(typeof AudioEncoder>`u`)throw Error(`this browser has no AudioEncoder`);if(t!==48e3)throw Error(`audio at ${t} Hz needs resampling; the demo expects ${R} Hz`);let i={codec:`opus`,sampleRate:R,numberOfChannels:e.length,bitrate:n};if(!(await AudioEncoder.isConfigSupported(i)).supported)throw Error(`Opus encoding is not available in this browser`);let a=[],o=null,s=new AudioEncoder({output:e=>{let t=new Uint8Array(e.byteLength);e.copyTo(t),a.push({data:t,timeUs:e.timestamp,samples:Math.round((e.duration??2e4)/1e6*R)})},error:e=>{o=e}});s.configure(i);let c=e[0].length;for(let t=0;ti.set(e.subarray(t,t+n),r*960));let a=new AudioData({format:`f32-planar`,sampleRate:R,numberOfFrames:960,numberOfChannels:e.length,timestamp:Math.round(t/R*1e6),data:i});s.encode(a),a.close(),s.encodeQueueSize>12&&await pt()}if(await s.flush(),s.close(),o)throw o;return a}async function bt(e){if(typeof VideoEncoder>`u`)throw Error(`this browser has no WebCodecs VideoEncoder`);let{source:t,preset:n,settings:r}=e;if(t.kind!==`video`)throw Error(`this source has no picture`);let i=H(t,n,r),a=document.createElement(`canvas`);a.width=i.width,a.height=i.height;let o=a.getContext(`2d`),s=r.codec===`vp8`?[`vp8`]:r.codec===`vp9`?[`vp09.00.10.08`]:[`vp09.00.10.08`,`vp8`],c=``,l=null;for(let e of s){let t={codec:e,width:i.width,height:i.height,bitrate:Math.round(i.mbps*1e6),framerate:i.fps,latencyMode:`quality`,bitrateMode:`variable`};if((await VideoEncoder.isConfigSupported(t)).supported){c=e,l=t;break}}if(!l)throw Error(`neither VP9 nor VP8 encoding is available in this browser`);let u=[],d=null,f=new VideoEncoder({output:e=>{let t=new Uint8Array(e.byteLength);e.copyTo(t),u.push({track:1,timeMs:e.timestamp/1e3,key:e.type===`key`,data:t})},error:e=>{d=e}});f.configure(l);let p=performance.now(),m=Math.max(1,Math.round(i.fps*2)),h=0;for(let n=0;n6;)await pt();let u=performance.now();u-h>160&&(h=u,e.onPreview(a));let g=(u-p)/1e3;e.onProgress({fraction:(n+1)/i.frames*.92,frame:n+1,frames:i.frames,message:`${((n+1)/Math.max(g,.001)).toFixed(1)} fps`})}if(await f.flush(),f.close(),e.onPreview(a),d)throw d;let g=i.capped?`Frame size capped at ${ut} px in the browser demo`:``,_=null;if(r.audio){e.onProgress({fraction:.93,frame:i.frames,frames:i.frames,message:`Encoding audio`});let t=await vt(e,i);if(t)try{let n=await yt(t.channels,t.rate,128e3,e.signal);for(let e of n)u.push({track:2,timeMs:e.timeUs/1e3,key:!0,data:e.data});_={sampleRate:R,channels:t.channels.length,preSkip:312},g=[g,t.note].filter(Boolean).join(`. `)}catch(e){g=[g,`Audio left out: ${e.message}`].filter(Boolean).join(`. `)}}return e.onProgress({fraction:.98,frame:i.frames,frames:i.frames,message:`Writing WebM`}),{blob:Fe({codec:c===`vp8`?`V_VP8`:`V_VP9`,width:i.width,height:i.height},_,u,(i.end-i.start)*1e3),ext:I.webm,mime:L.webm,encoder:`WebCodecs ${c===`vp8`?`VP8`:`VP9`}${_?` + Opus`:``} · ${i.width}x${i.height} · ${i.fps} fps · ${i.mbps.toFixed(1)} Mb/s`,note:g}}async function xt(e){let{source:t,preset:n,settings:r}=e;if(t.kind!==`video`)throw Error(`this source has no picture`);let i=H(t,n,r),a=document.createElement(`canvas`);a.width=i.width,a.height=i.height;let o=a.getContext(`2d`,{willReadFrequently:!0}),s=new ve(i.width,i.height),c=Math.max(2,Math.round(100/i.fps));for(let n=0;n({data:e.data,samples:e.samples})),a.channels.length,312,a.rate),ext:I.ogg,mime:L.ogg,encoder:`WebCodecs Opus · ${a.channels.length} ch · 160 kb/s`,note:a.note}:{blob:t===`aiff`?He(a.channels,a.rate,r.bits):Ve(a.channels,a.rate,r.bits),ext:I[t],mime:L[t],encoder:`PCM ${r.bits}-bit · ${a.rate} Hz · ${a.channels.length} ch`,note:a.note}}async function Ct(e,t){let{source:n,preset:r,settings:i}=e;if(n.kind!==`video`)throw Error(`this source has no picture`);let a=H(n,r,i),o=document.createElement(`canvas`);o.width=a.width,o.height=a.height;let s=o.getContext(`2d`),c=await n.frame(a.start),l=ht(c,n);return mt(s,a,c,l.w,l.h),e.onPreview(o),{blob:await new Promise((e,n)=>o.toBlob(t=>t?e(t):n(Error(`the canvas could not be saved`)),L[t],.92)),ext:I[t],mime:L[t],encoder:`${t.toUpperCase()} still · ${a.width}x${a.height}`,note:``}}async function wt(e){let t=e.preset.target;if(!t)throw Error(`needs the desktop engine`);return t===`webm`?bt(e):t===`gif`?xt(e):Je.has(t)?St(e,t):Ct(e,t)}function Tt(e){return e==null||!Number.isFinite(e)?``:e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(0)} KB`:e<1073741824?`${(e/1024/1024).toFixed(1)} MB`:`${(e/1024/1024/1024).toFixed(2)} GB`}function Et(e){if(e==null||!Number.isFinite(e)||e<0)return`--:--`;let t=Math.round(e),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60;return n?`${n}:${String(r).padStart(2,`0`)}:${String(i).padStart(2,`0`)}`:`${String(r).padStart(2,`0`)}:${String(i).padStart(2,`0`)}`}function Dt(e){return!e||!Number.isFinite(e)?``:e<60?`${e.toFixed(e<10?2:1)} s`:Et(e)}var Ot={ready:`Ready`,preparing:`Preparing`,encoding:`Encoding`,paused:`Paused`,done:`Done`,failed:`Failed`,stopped:`Stopped`,skipped:`Skipped`},W=new TextDecoder(`latin1`);async function G(e,t,n){let r=await e.slice(t,t+n).arrayBuffer();return new DataView(r)}var K=(e,t)=>W.decode(new Uint8Array(e.buffer,e.byteOffset+t,4)),kt={66:`Baseline`,77:`Main`,88:`Extended`,100:`High`,110:`High 10`,122:`High 4:2:2`,244:`High 4:4:4`},At={apco:`ProRes 422 Proxy`,apcs:`ProRes 422 LT`,apcn:`ProRes 422`,apch:`ProRes 422 HQ`,ap4h:`ProRes 4444`,ap4x:`ProRes 4444 XQ`},jt={sowt:`PCM s16le`,twos:`PCM s16be`,in24:`PCM s24`,in32:`PCM s32`,lpcm:`PCM`,fl32:`PCM f32`,fl64:`PCM f64`,raw:`PCM u8`};function Mt(e,t,n){let r={type:``,timescale:0,duration:0,width:0,height:0,format:``,profile:``,samples:0,stts:0,bytes:0,channels:0,bits:0,rate:0,esObject:0},i=(t,n)=>{let a=t;for(;a+8<=n;){let t=e.getUint32(a),o=K(e,a+4),s=8;if(t===1&&(t=Number(e.getBigUint64(a+8)),s=16),t===0&&(t=n-a),tn)break;let c=a+s,l=a+t;if(o===`mdia`||o===`minf`||o===`stbl`)i(c,l);else if(o===`tkhd`){let t=c+(e.getUint8(c)===1?88:76);r.width=e.getUint32(t)/65536,r.height=e.getUint32(t+4)/65536}else if(o===`mdhd`){let t=e.getUint8(c);r.timescale=e.getUint32(c+(t===1?20:12)),r.duration=t===1?Number(e.getBigUint64(c+24)):e.getUint32(c+16)}else if(o===`hdlr`)r.type=K(e,c+8);else if(o===`stsd`){let t=c+8;if(r.format=K(e,t+4),r.type===`vide`){let n=e.getUint16(t+32),i=e.getUint16(t+34);n&&(r.width=n),i&&(r.height=i);let a=t+86,o=e.getUint32(t);for(;a+8<=t+o;){let t=e.getUint32(a),n=K(e,a+4);if(t<8)break;n===`avcC`&&(r.profile=`${kt[e.getUint8(a+9)]??`profile `+e.getUint8(a+9)} L${(e.getUint8(a+11)/10).toFixed(1)}`),n===`hvcC`&&(r.profile={1:`Main`,2:`Main 10`}[e.getUint8(a+9)&31]??``),a+=t}}else if(r.type===`soun`){r.channels=e.getUint16(t+24),r.bits=e.getUint16(t+26),r.rate=e.getUint16(t+32);let n=e.getUint32(t),i=t+36;for(;i+8<=t+n;){let t=e.getUint32(i),n=K(e,i+4);if(t<8)break;if(n===`esds`){for(let n=i+12;nr.byteLength)break;if(t===`mvhd`){let e=r.getUint8(s+8);a=r.getUint32(s+8+(e===1?20:12)),o=e===1?Number(r.getBigUint64(s+8+24)):r.getUint32(s+8+16)}else if(t===`trak`){let t=Mt(r,s+8,s+e),n=t.timescale?t.duration/t.timescale:0;if(t.type===`vide`&&!i.video){let e=t.stts&&t.samples?t.samples*t.timescale/t.stts:null;i.video={codec:Nt(t.format),profile:t.profile,width:Math.round(t.width),height:Math.round(t.height),fps:e,frames:t.samples||null,bitrate:n&&t.bytes?t.bytes*8/n:null,pixels:``}}else t.type===`soun`&&i.audio.push({codec:Pt(t),sampleRate:t.rate||null,channels:t.channels||null,bitDepth:jt[t.format]?t.bits:null,bitrate:n&&t.bytes?t.bytes*8/n:null})}s+=e}return i.duration=a?o/a:null,i.duration&&(i.bitrate=e.size*8/i.duration),i}function It(e,t,n){let r=e[t];if(r===void 0||r===0)return null;let i=1;for(;!(r&128>>i-1);)i++;if(t+i>e.length)return null;let a=n?r:r&255>>i,o=(r&255>>i)==255>>i;for(let n=1;n{if(!o)return;let e=o.codec===`V_VP9`?`VP9`:o.codec===`V_VP8`?`VP8`:o.codec===`V_AV1`?`AV1`:o.codec===`V_MPEG4/ISO/AVC`?`H.264`:o.codec===`V_MPEGH/ISO/HEVC`?`HEVC`:o.codec;o.type===1&&!r.video&&(r.video={codec:e,profile:``,width:o.w,height:o.h,fps:o.dur?1e9/o.dur:null,frames:null,bitrate:null,pixels:``}),o.type===2&&r.audio.push({codec:o.codec===`A_OPUS`?`Opus`:o.codec===`A_VORBIS`?`Vorbis`:o.codec===`A_AAC`?`AAC`:o.codec===`A_FLAC`?`FLAC`:o.codec,sampleRate:o.rate||null,channels:o.ch||null,bitDepth:o.bits||null,bitrate:null}),o=null},c=(e,t)=>{let r=0;for(let i=0;in===4?t.getFloat32(e):n===8?t.getFloat64(e):0,u=(e,t,d)=>{let f=e;for(;f=0?i={codec:`Opus`,sampleRate:48e3,channels:n[a+9],bitDepth:null,bitrate:null}:o>=0&&(i={codec:`Vorbis`,sampleRate:t.getUint32(o+12,!0),channels:n[o+11],bitDepth:null,bitrate:null});let s=await G(e,Math.max(0,e.size-65536),Math.min(e.size,65536)),c=new Uint8Array(s.buffer),l=null;for(let e=c.length-27;e>=0;e--)if(c[e]===79&&c[e+1]===103&&c[e+2]===103&&c[e+3]===83){l=Number(s.getBigUint64(e+6,!0));break}let u=i.sampleRate??48e3,d=l!==null&&l>0?l/(i.codec===`Opus`?48e3:u):null;return{container:`Ogg`,duration:d,size:e.size,bitrate:d?e.size*8/d:null,video:null,audio:[i],notes:[]}}async function Vt(e){let t=await G(e,0,Math.min(e.size,64));if(t.byteLength<26||K(t,0)!==`fLaC`)return null;let n=t.getUint8(18)<<12|t.getUint8(19)<<4|t.getUint8(20)>>4,r=(t.getUint8(20)>>1&7)+1,i=((t.getUint8(20)&1)<<4|t.getUint8(21)>>4)+1,a=(t.getUint8(21)&15)*2**32+t.getUint32(22),o=n&&a?a/n:null;return{container:`FLAC`,duration:o,size:e.size,bitrate:o?e.size*8/o:null,video:null,audio:[{codec:`FLAC`,sampleRate:n,channels:r,bitDepth:i,bitrate:null}],notes:[]}}var Ht=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320],Ut=[44100,48e3,32e3];async function Wt(e){let t=await G(e,0,Math.min(e.size,65536)),n=0;if(K(t,0).startsWith(`ID3`)&&(n=10+(t.getUint8(6)<<21|t.getUint8(7)<<14|t.getUint8(8)<<7|t.getUint8(9))),n+4>t.byteLength)return null;for(let r=n;r+4>3&3,i=t.getUint8(r+1)>>1&3,a=Ht[t.getUint8(r+2)>>4],o=Ut[t.getUint8(r+2)>>2&3];if(n!==3||i!==1||!a||!o)continue;let s=t.getUint8(r+3)>>6==3?1:2;return{container:`MPEG audio`,duration:(e.size-r)*8/(a*1e3),size:e.size,bitrate:a*1e3,video:null,audio:[{codec:`MP3`,sampleRate:o,channels:s,bitDepth:null,bitrate:a*1e3}],notes:[`duration assumes constant bitrate`]}}return null}async function Gt(e){let t=[Ft,Rt,zt,Bt,Vt,Wt];for(let n of t)try{let t=await n(e);if(t)return t}catch{continue}return{container:e.type||`unknown`,duration:null,size:e.size,bitrate:null,video:null,audio:[],notes:[`container not recognised, showing what the browser reports`]}}var Kt=[{pack:`open-water`,file:`open-water-1280x720-30fps.mp4`,mime:`video/mp4`,kind:`video`,width:1280,height:720,fps:29.97,duration:8.008,bytes:6819433,outputs:[{preset:`match-source-medium`},{preset:`gif-480`},{preset:`png-still`}]},{pack:`coast-aerial`,file:`coast-aerial-1280x720-25fps.mp4`,mime:`video/mp4`,kind:`video`,width:1280,height:720,fps:25,duration:7,bytes:6637734,outputs:[{preset:`match-source-medium`},{preset:`gif-480`}]},{pack:`shoreline-vertical`,file:`shoreline-vertical-404x720-60fps.mp4`,mime:`video/mp4`,kind:`video`,width:404,height:720,fps:59.94,duration:7.858,bytes:4235966,outputs:[{preset:`match-source-medium`},{preset:`gif-480`,size:`source`}]},{pack:`on-the-sea-reading`,file:`on-the-sea-reading.mp3`,mime:`audio/mpeg`,kind:`audio`,width:0,height:0,fps:0,duration:21.133,bytes:211755,outputs:[{preset:`ogg-opus`,lufs:-16},{preset:`bwf-ebu`},{preset:`wav-48-24`}]}];function qt(){let e=window;return e.FE_MEDIA||={},e.FE_MEDIA}function Jt(e){return new Promise((t,n)=>{let r=document.createElement(`script`);r.async=!0,r.src=`media/${e}.js`,r.onload=()=>{r.remove(),t()},r.onerror=()=>{r.remove(),n(Error(`the media pack ${e} did not load`))},document.head.appendChild(r)})}async function Yt(e){await Jt(e.pack);let t=qt(),n=t[e.file];if(delete t[e.file],!n)throw Error(`the media pack ${e.pack} holds no ${e.file}`);let r=atob(n),i=new Uint8Array(r.length);for(let e=0;ePromise.reject(Error(`the source is still loading`)),audio:()=>Promise.resolve(null),dispose:()=>void 0}}var Qt=0,q=new class{items=[];selectedItem=``;selectedOutput=``;running=!1;logs=[];listeners=new Map;abort=null;previews=new Map;on(e,t){this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e)?.add(t)}emit(e,t){for(let n of this.listeners.get(e)??[])n(t)}log(e,t=!1){let n=new Date,r=[n.getHours(),n.getMinutes(),n.getSeconds()].map(e=>String(e).padStart(2,`0`)).join(`:`);this.logs.push({time:r,text:e,error:t}),this.logs.length>400&&this.logs.shift(),this.emit(`log`)}previewFor(e){return this.previews.get(e)}item(e){return this.items.find(t=>t.id===e)}outputOf(e){for(let t of this.items){let n=t.outputs.find(t=>t.id===e);if(n)return{item:t,output:n}}}select(e,t=``){(this.selectedItem!==e||this.selectedOutput!==t)&&(this.selectedItem=e,this.selectedOutput=t,this.emit(`select`))}makeOutput(e){let t=P.get(e);if(!t)throw Error(`unknown preset ${e}`);return{id:`out${++Qt}`,presetId:e,settings:dt(t),status:`ready`,progress:0,message:``,encoder:``,note:``,blob:null,mime:``,fileName:``,elapsed:0,fps:0,frame:0,frames:0,eta:0,speed:0}}stem(e){return e.source.name.replace(/\.[^.]+$/,``).replace(/[^A-Za-z0-9._-]+/g,`_`)||`source`}nameFor(e,t){let n=P.get(t.presetId),r=n?.target?I[n.target]:`out`;return`${this.stem(e)}_${t.presetId}.${r}`}addOutput(e,t){let n=this.item(e);if(!n)return;let r=this.makeOutput(t);return r.fileName=this.nameFor(n,r),n.outputs.push(r),n.collapsed=!1,this.log(`Added output ${P.get(t)?.name??t} to ${n.source.name}`),this.emit(`items`),r}async addSource(e,t){let n={id:e.id,source:e,probe:{container:``,duration:null,size:e.size,bitrate:null,video:null,audio:[],notes:[]},loudness:null,loudnessState:`pending`,poster:null,outputs:[],collapsed:!1,loading:!1};this.items.push(n);for(let e of t){let t=this.makeOutput(e);t.fileName=this.nameFor(n,t),n.outputs.push(t)}return this.selectedItem=n.id,this.selectedOutput=``,this.log(`Added source ${e.name}`),this.emit(`items`),this.emit(`select`),n}async analyse(e,t){if(e.probe=t?await Gt(t):{container:`generated in this page (no file)`,duration:e.source.duration,size:0,bitrate:null,video:{codec:`canvas RGB`,profile:``,width:e.source.width,height:e.source.height,fps:e.source.fps,frames:Math.round(e.source.duration*e.source.fps),bitrate:null,pixels:`rgb24`},audio:[{codec:`PCM f32 (synthesised)`,sampleRate:48e3,channels:2,bitDepth:32,bitrate:null}],notes:[]},e.source.kind===`video`)try{let t=await e.source.frame(Math.min(1,e.source.duration/2)),n=document.createElement(`canvas`);n.width=640,n.height=Math.max(2,Math.round(640*e.source.height/e.source.width)),n.getContext(`2d`)?.drawImage(t,0,0,n.width,n.height),e.poster=n}catch(e){this.log(`No preview frame: ${e.message}`,!0)}this.emit(`items`),this.emit(`select`);try{let t=await e.source.audio();if(!t)e.loudnessState=`none`;else{e.probe.audio.length||e.probe.audio.push({codec:`decoded by the browser`,sampleRate:t.sampleRate,channels:t.numberOfChannels,bitDepth:null,bitrate:null}),await new Promise(e=>window.setTimeout(e,0));let n=[];for(let e=0;e{let r=this.addCuratedRow(t);e.push({item:r,index:n})}),this.selectedItem=e[0].item.id,this.emit(`select`);let t=0;for(let{item:n,index:r}of e){let e=Kt[r];try{let r=await Yt(e),i=await rt(r,e.fps||null);i.id=n.id,n.source.dispose(),n.source=i,n.loading=!1,this.emit(`items`),await this.analyse(n,r),t++}catch(t){this.log(`Could not load ${e.file}: ${t.message}`,!0),this.items=this.items.filter(e=>e.id!==n.id),this.selectedItem===n.id&&(this.selectedItem=this.items[0]?.id??``),this.emit(`items`),this.emit(`select`)}}t||(this.log(`The curated media did not load; adding the built-in sample instead`,!0),await this.addSample())}addCuratedRow(e){let t=Zt(e),n={id:t.id,source:t,probe:{container:``,duration:e.duration,size:e.bytes,bitrate:null,video:null,audio:[],notes:[]},loudness:null,loudnessState:`pending`,poster:null,outputs:[],collapsed:!1,loading:!0};this.items.push(n);for(let t of e.outputs){let e=this.makeOutput(t.preset);t.lufs!==void 0&&(e.settings.lufs=t.lufs),t.size&&(e.settings.size=t.size),e.fileName=this.nameFor(n,e),n.outputs.push(e)}return this.log(`Added source ${e.file}`),this.emit(`items`),n}async addSample(){let e=lt(),t=await this.addSource(e,[`match-source-medium`,`gif-480`,`bwf-ebu`]);await this.analyse(t,null)}removeSelected(){if(!this.running){if(this.selectedOutput){let e=this.outputOf(this.selectedOutput);e&&(e.item.outputs=e.item.outputs.filter(e=>e.id!==this.selectedOutput),this.selectedOutput=``)}else this.selectedItem&&=(this.item(this.selectedItem)?.source.dispose(),this.items=this.items.filter(e=>e.id!==this.selectedItem),this.items[0]?.id??``);this.emit(`items`),this.emit(`select`)}}resetOutput(e){e.status=`ready`,e.progress=0,e.message=``,e.blob=null,e.note=``,e.encoder=``,this.emit(`items`)}async start(){if(this.running)return;let e=[];for(let t of this.items)for(let n of t.outputs)(!t.loading&&n.status===`ready`||n.status===`failed`||n.status===`stopped`)&&e.push({item:t,out:n});if(!e.length)this.log(`Nothing to encode: every output is done`);else{this.running=!0,this.abort=new AbortController,this.emit(`run`),this.log(`Queue started: ${e.length} output${e.length===1?``:`s`}`);for(let{item:t,out:n}of e){if(this.abort.signal.aborted)break;await this.runOne(t,n,this.abort.signal)}this.running=!1,this.abort=null,this.log(`Queue finished`),this.emit(`run`)}}stop(){this.abort?.abort()}async runOne(e,t,n){let r=P.get(t.presetId);if(!r)return;if(!r.target){t.status=`skipped`,t.message=`Needs the desktop engine`,this.log(`Skipped ${t.fileName}: ${r.name} needs the desktop engine`),this.emit(`progress`,t);return}t.status=`preparing`,t.progress=0,t.message=`Preparing`,t.blob=null,t.note=``,this.emit(`progress`,t);let i=performance.now();this.log(`Encoding ${t.fileName} with ${r.name}`);try{let a=()=>{let e=this.previews.get(t.id);return e||(e=document.createElement(`canvas`),this.previews.set(t.id,e)),e},o=await wt({source:e.source,preset:r,settings:t.settings,signal:n,onProgress:n=>{let r=(performance.now()-i)/1e3;t.status=`encoding`,t.progress=n.fraction,t.frame=n.frame,t.frames=n.frames,t.elapsed=r,t.eta=n.fraction>.02?r/n.fraction*(1-n.fraction):0,t.fps=r>0?n.frame/r:0,t.speed=r>0&&e.source.fps?n.frame/e.source.fps/r:0,t.message=n.message,this.emit(`progress`,t)},onPreview:e=>{let n=a();(n.width!==e.width||n.height!==e.height)&&(n.width=e.width,n.height=e.height),n.getContext(`2d`)?.drawImage(e,0,0),this.emit(`progress`,t)}});t.blob=o.blob,t.mime=o.mime,t.fileName=t.fileName.replace(/\.[^.]+$/,`.${o.ext}`),t.encoder=o.encoder,t.note=o.note,t.status=`done`,t.progress=1,t.elapsed=(performance.now()-i)/1e3,t.eta=0,t.message=Tt(o.blob.size),this.log(`Done ${t.fileName}: ${o.encoder}${o.note?`. `+o.note:``}`)}catch(e){let n=e;n.name===`AbortError`?(t.status=`stopped`,t.message=`Stopped`,this.log(`Stopped ${t.fileName}`)):(t.status=`failed`,t.message=n.message,this.log(`Failed ${t.fileName}: ${n.message}`,!0))}this.emit(`progress`,t),this.emit(`items`)}},$t=new WeakMap;function J(e,t=`info`){let n=document.getElementById(`toast-root`);if(!n)return;let r=t===`error`?6e3:3600,i=`cv-toast${t===`error`?` is-error`:t===`ok`?` is-ok`:``}`,a=Array.from(n.children).find(t=>t.textContent===e&&t.className===i);if(a){window.clearTimeout($t.get(a)),$t.set(a,window.setTimeout(()=>a.remove(),r));return}let o=s(``);for(o.textContent=e,n.appendChild(o);n.children.length>4;)n.firstElementChild?.remove();$t.set(o,window.setTimeout(()=>o.remove(),r))}var en=null,tn,nn,rn=``;function an(){let e=new _(`Preview`,760);return tn=s(``),nn=s(``),e.body.appendChild(tn),e.body.appendChild(nn),e.button(`Save`,`ghost`,()=>{rn&&on(rn)}),e.button(`Close`,`primary`,()=>e.close()),e.onClose=()=>{tn.replaceChildren(),rn=``},e}function on(e){let t=q.outputOf(e);if(!t?.output.blob){J(`This output has not been encoded yet`);return}let n=URL.createObjectURL(t.output.blob),r=document.createElement(`a`);r.href=n,r.download=t.output.fileName,document.body.appendChild(r),r.click(),r.remove(),window.setTimeout(()=>URL.revokeObjectURL(n),4e3)}function sn(e){let n=q.outputOf(e);if(!n?.output.blob){J(`This output has not been encoded yet`);return}en??=an();let{output:r}=n,i=URL.createObjectURL(n.output.blob),a;r.mime.startsWith(`video/`)?(a=s(``),a.src=i):r.mime.startsWith(`audio/`)?(a=s(``),a.src=i):(a=s(``),a.src=i),tn.replaceChildren(a),rn=e,en.setTitle(r.fileName),t(nn,[r.encoder,r.note].filter(Boolean).join(`. `)),en.open(c(en.scrim,`.cv-btn-primary`))}var cn=class{id=`encoding`;title=`Encoding`;el;list;constructor(){this.el=s(`
${h(`film`,26)}Nothing has run yet. Press Start in the Queue.
diff --git a/demos/broadcast/README.md b/demos/broadcast/README.md
index bdaf2e1..9bb4694 100644
--- a/demos/broadcast/README.md
+++ b/demos/broadcast/README.md
@@ -11,7 +11,7 @@ Everything it needs (script, styles, fonts, icon, the programme) is inside this
## What it shows
-The interface is the real one: the Studio Dark tokens, the fifteen theme profiles, the dock and its panels, the inline icons and the Export Settings idiom, all imported from `frontend/src/`. It opens on a 17.4 s programme (aerial waves over a public-domain LibriVox reading, with six caption cues) already measured: the picture carries a timecode, the name and a "FOR REVIEW ONLY" text burned in live, with the captions on top. Sources, authors and licences are in `CREDITS.md`.
+The interface is the real one: the Studio Dark tokens, the sixteen theme profiles, the dock and its panels, the inline icons and the Export Settings idiom, all imported from `frontend/src/`. It opens on a 17.4 s programme (aerial waves over a public-domain LibriVox reading, with six caption cues) already measured: the picture carries a timecode, the name and a "FOR REVIEW ONLY" text burned in live, with the captions on top. Sources, authors and licences are in `CREDITS.md`.
- **Delivery Profiles.** Broadcast (H.264 EBU R128, H.264 ATSC A/85, broadcast WAV, an XDCAM MXF master marked as desktop only), streaming, social and audio profiles. A profile sets the loudness standard, caption mode, overlays and the output preset together.
- **Loudness.** ITU-R BS.1770-4 integrated loudness, loudness range, true peak and the short-term graph for the source and for the delivery, with the target and tolerance band; a matrix of the programme against EBU R128, ATSC A/85, OP-59, ARIB TR-B32, streaming (-14 LUFS) and podcast (-16 LUFS) with the gain each needs; Normalise (linear gain, with a look-ahead limiter when asked).
diff --git a/demos/broadcast/assets/broadcast.js b/demos/broadcast/assets/broadcast.js
index 0cb88f4..44fe969 100644
--- a/demos/broadcast/assets/broadcast.js
+++ b/demos/broadcast/assets/broadcast.js
@@ -10,7 +10,7 @@
-
`),this.areas=Object.fromEntries(ot.map(e=>[e,this.el.querySelector(`[data-area="${e}"]`)]));for(let e of Array.from(this.el.querySelectorAll(`.fx-split`)))this.bindSplit(e);window.addEventListener(`resize`,()=>this.resized())}register(e,t,n){this.factories.set(e,n),this.titles.set(e,t)}titleOf(e){return this.titles.get(e)??e}panelIds(){return[...this.factories.keys()]}peek(e){return this.made.get(e)}panel(e){let t=this.made.get(e);if(!t){let n=this.factories.get(e);if(!n)return;t=n(),t.el.classList.add(`fx-panel`),t.el.dataset.panel=e,t.el.dataset.automationId=`panel.${e}`,this.made.set(e,t)}return t}bindSplit(e){let t=e.dataset.split;e.addEventListener(`pointerdown`,n=>{n.preventDefault(),e.setPointerCapture(n.pointerId),k(e,`is-dragging`,!0);let r={x:n.clientX,y:n.clientY,l:this.layout.leftW,r:this.layout.rightW,b:this.layout.bottomH},i=e=>{t===`left`&&(this.layout.leftW=Math.max(160,Math.min(900,r.l+e.clientX-r.x))),t===`right`&&(this.layout.rightW=Math.max(160,Math.min(1100,r.r-(e.clientX-r.x)))),t===`bottom`&&(this.layout.bottomH=Math.max(120,Math.min(window.innerHeight-220,r.b-(e.clientY-r.y)))),this.applySizes()},a=()=>{k(e,`is-dragging`,!1),e.removeEventListener(`pointermove`,i),e.removeEventListener(`pointerup`,a),this.save()};e.addEventListener(`pointermove`,i),e.addEventListener(`pointerup`,a)})}applySizes(){let e=this.groups.left.length?this.layout.leftW:0,t=this.groups.right.length?this.layout.rightW:0,n=this.groups.bottom.length?this.layout.bottomH:0;this.el.style.setProperty(`--fx-left`,`${e}px`),this.el.style.setProperty(`--fx-right`,`${t}px`),this.el.style.setProperty(`--fx-bottom`,`${n}px`),k(this.el,`no-left`,!e),k(this.el,`no-right`,!t),k(this.el,`no-bottom`,!n);for(let e of at){let t=this.groups[e],n=t.reduce((e,t)=>e+t.size,0)||1;for(let e of t)e.el.style.flex=`${e.size/n} 1 0`}this.resized()}resized(){for(let e of this.made.values())e.el.hidden||e.resized?.()}applyLayout(e,t){this.workspace=t,this.layout=structuredClone(e);for(let t of ot){for(let e of this.groups[t]){for(let t of e.panels){let e=this.made.get(t);e&&(e.el.hidden=!0,e.hidden?.())}e.el.remove()}this.groups[t]=[];let n=(t===`float`?e.float:e[t])??[];for(let e of n){let n=new st(this,t);n.size=e.size??1,e.w!==void 0&&(n.rect={x:e.x??120,y:e.y??90,w:e.w,h:e.h??340}),this.areas[t].appendChild(n.el),this.groups[t].push(n);for(let t of e.panels)this.factories.has(t)&&n.add(t,!1);t===`float`&&!n.panels.length?(n.el.remove(),this.groups[t].pop()):(n.activate(e.active&&e.panels.includes(e.active)?e.active:n.panels[0]),t===`float`&&n.place())}}this.applySizes(),this.onWorkspace?.(t)}load(){let e=`Default`,t=null;try{let n=localStorage.getItem(R);if(n){let r=JSON.parse(n);e=r.workspace||`Default`,t=r.layouts?.[e]??null}}catch{t=null}this.applyLayout(t??L[e]??L.Default,e)}snapshot(){let e={left:[],center:[],right:[],bottom:[],leftW:this.layout.leftW,rightW:this.layout.rightW,bottomH:this.layout.bottomH};for(let t of[`left`,`center`,`right`,`bottom`])e[t]=this.groups[t].map(e=>({panels:[...e.panels],active:e.active,size:e.size}));return e.float=this.groups.float.map(e=>({panels:[...e.panels],active:e.active,...e.rect})),e}save(){try{let e=localStorage.getItem(R),t=e?JSON.parse(e):{};t.workspace=this.workspace,t.layouts={...t.layouts||{},[this.workspace]:this.snapshot()},localStorage.setItem(R,JSON.stringify(t))}catch{return}}savedNames(){try{let e=JSON.parse(localStorage.getItem(R)||`{}`);return Object.keys(e.custom||{})}catch{return[]}}switchTo(e){let t=null;try{let n=JSON.parse(localStorage.getItem(R)||`{}`);t=n.layouts?.[e]??n.custom?.[e]??null}catch{t=null}this.applyLayout(t??L[e]??L.Default,e),this.save()}resetWorkspace(){this.applyLayout(L[this.workspace]??L.Default,this.workspace),this.save()}saveAs(e){try{let t=JSON.parse(localStorage.getItem(R)||`{}`);t.custom={...t.custom||{},[e]:this.snapshot()},localStorage.setItem(R,JSON.stringify(t))}catch{return}this.workspace=e,this.save(),this.onWorkspace?.(e)}find(e){for(let t of ot)for(let n of this.groups[t])if(n.panels.includes(e))return n}home(e){let t=e===`essential`?this.find(`effectsPresets`):void 0;if(t&&t.area!==`float`)return t;let n=e===`composition`?`center`:[`timeline`,`renderQueue`,`terminal`,`agents`,`graph`,`flowchart`].includes(e)?`bottom`:`right`;return this.groups[n][0]??this.groups.right[0]??this.groups.bottom[0]??this.groups.center[0]}show(e){if(!this.factories.has(e))return;let t=this.find(e);if(!t){if(t=this.home(e),!t)return;t.add(e,!0),this.applySizes()}t.activate(e),this.focus(e)}undock(e){let t=this.find(e);if(!t||t.area===`float`)return;let n=this.el.getBoundingClientRect(),r=new st(this,`float`),i=this.groups.float.length;r.rect={x:Math.max(0,n.width/2-260+i*28),y:Math.max(0,n.height/2-200+i*28),w:520,h:400},this.areas.float.appendChild(r.el),this.groups.float.push(r),r.place(),this.move(e,r),this.focus(e)}redock(e){let t=this.find(e);if(!t||t.area!==`float`)return;let n=this.home(e);n?this.move(e,n):this.close(e)}isVisible(e){let t=this.made.get(e);return!!t&&!t.el.hidden}close(e){let t=this.find(e);t&&(t.remove(e),t.panels.length||(t.el.remove(),this.groups[t.area]=this.groups[t.area].filter(e=>e!==t),this.applySizes()),this.save())}move(e,t){let n=this.find(e);n!==t&&(n?.remove(e),n&&!n.panels.length&&(n.el.remove(),this.groups[n.area]=this.groups[n.area].filter(e=>e!==n)),t.add(e,!0),this.applySizes(),this.save())}raise(e){let t=this.groups.float;e.area===`float`&&t[t.length-1]!==e&&(this.groups.float=[...t.filter(t=>t!==e),e],this.groups.float.forEach((e,t)=>e.el.style.zIndex=String(t+1)))}maximize(e){e.area!==`float`&&(this.maximized===e?(this.maximized=null,k(this.el,`is-maximized`,!1),k(e.el,`is-max`,!1)):(this.maximized&&k(this.maximized.el,`is-max`,!1),this.maximized=e,k(this.el,`is-maximized`,!0),k(e.el,`is-max`,!0)),this.resized())}toggleMaximizeFocused(){let e=this.find(this.focused);e&&this.maximize(e)}focused=`queue`;focus(e){if(!e||this.focused===e)return;let t=this.find(this.focused);t&&k(t.el,`is-focused`,!1),this.focused=e;let n=this.find(e);n&&k(n.el,`is-focused`,!0),this.onFocus?.(e)}},lt={studio:{label:`Studio Dark`,vars:{"--bg-primary":`#111111`,"--bg-secondary":`#17151b`,"--bg-tertiary":`#222127`,"--border-color":`#2a2a2a`,"--border-light":`#34333a`,"--text-primary":`#f7f7f7`,"--text-secondary":`#a4a4a4`,"--text-muted":`#717072`,"--canvas-bg":`#1c1b1d`,"--grid-color":`#5e5e60`,"--bg-node":`#191919`}},"nodemode-dark":{label:`NodeMode Dark`,vars:{"--bg-primary":`#0a0a0a`,"--bg-secondary":`#121218`,"--bg-tertiary":`#1a1a24`,"--border-color":`#2a2a35`,"--border-light":`#3a3a48`,"--text-primary":`#e8e8ee`,"--text-secondary":`#a8a8b8`,"--text-muted":`#6a6a7a`,"--canvas-bg":`#0a0a0a`,"--grid-color":`rgba(255,255,255,0.04)`,"--node-shadow":`0 6px 18px rgba(0,0,0,0.45)`}},light:{label:`Light`,light:!0,vars:{"--bg-primary":`#ecebe6`,"--bg-secondary":`#f7f6f1`,"--bg-tertiary":`#e2e0d8`,"--bg-node":`#f4f3ed`,"--border-color":`#d1cdc1`,"--border-light":`#beb9aa`,"--text-primary":`#26241d`,"--text-secondary":`#4c4a40`,"--text-muted":`#8b887a`,"--canvas-bg":`#e7e5dd`,"--grid-color":`rgba(70,60,30,0.10)`,"--node-shadow":`0 5px 14px rgba(96,90,70,0.15)`}},"github-dark":{label:`GitHub Dark`,vars:{"--bg-primary":`#0d1117`,"--bg-secondary":`#161b22`,"--bg-tertiary":`#21262d`,"--border-color":`#30363d`,"--border-light":`#3d444d`,"--text-primary":`#e6edf3`,"--text-secondary":`#9198a1`,"--text-muted":`#656c76`,"--canvas-bg":`#0d1117`,"--grid-color":`rgba(230,237,243,0.05)`,"--node-shadow":`0 6px 18px rgba(0,0,0,0.5)`}},midnight:{label:`Midnight Blue`,vars:{"--bg-primary":`#0b1020`,"--bg-secondary":`#101830`,"--bg-tertiary":`#182242`,"--border-color":`#25325c`,"--border-light":`#324274`,"--text-primary":`#e4e9f7`,"--text-secondary":`#9fabd0`,"--text-muted":`#63709a`,"--canvas-bg":`#0b1020`,"--grid-color":`rgba(160,180,255,0.06)`,"--node-shadow":`0 8px 22px rgba(0,0,20,0.55)`}},forest:{label:`Forest`,vars:{"--bg-primary":`#0c130e`,"--bg-secondary":`#121c15`,"--bg-tertiary":`#1a281e`,"--border-color":`#2a4030`,"--border-light":`#375441`,"--text-primary":`#e4efe7`,"--text-secondary":`#a4bdac`,"--text-muted":`#6a8674`,"--canvas-bg":`#0c130e`,"--grid-color":`rgba(180,230,190,0.05)`,"--node-shadow":`0 6px 18px rgba(0,10,0,0.5)`}},ember:{label:`Ember`,vars:{"--bg-primary":`#140d0a`,"--bg-secondary":`#1d1310`,"--bg-tertiary":`#2a1c16`,"--border-color":`#452e22`,"--border-light":`#5a3d2e`,"--text-primary":`#f2e8e2`,"--text-secondary":`#c7ab9c`,"--text-muted":`#8f7263`,"--canvas-bg":`#140d0a`,"--grid-color":`rgba(255,200,160,0.05)`,"--node-shadow":`0 6px 18px rgba(20,5,0,0.55)`}},violet:{label:`Violet Haze`,vars:{"--bg-primary":`#100b1c`,"--bg-secondary":`#171129`,"--bg-tertiary":`#221a3c`,"--border-color":`#382c5e`,"--border-light":`#493b78`,"--text-primary":`#ece6f9`,"--text-secondary":`#b3a6d8`,"--text-muted":`#7a6da3`,"--canvas-bg":`#100b1c`,"--grid-color":`rgba(210,190,255,0.06)`,"--node-shadow":`0 8px 22px rgba(10,0,30,0.55)`}},slate:{label:`Slate`,vars:{"--bg-primary":`#101418`,"--bg-secondary":`#171d23`,"--bg-tertiary":`#212a32`,"--border-color":`#32404c`,"--border-light":`#415260`,"--text-primary":`#e7edf2`,"--text-secondary":`#a3b2bf`,"--text-muted":`#6b7a87`,"--canvas-bg":`#101418`,"--grid-color":`rgba(200,220,240,0.05)`,"--node-shadow":`0 6px 18px rgba(0,5,10,0.5)`}},mono:{label:`Mono Ink`,vars:{"--bg-primary":`#0e0e0e`,"--bg-secondary":`#161616`,"--bg-tertiary":`#202020`,"--border-color":`#333333`,"--border-light":`#454545`,"--text-primary":`#f0f0f0`,"--text-secondary":`#ababab`,"--text-muted":`#6e6e6e`,"--canvas-bg":`#0e0e0e`,"--grid-color":`rgba(255,255,255,0.05)`,"--node-shadow":`0 6px 18px rgba(0,0,0,0.5)`}},sand:{label:`Sand (light)`,light:!0,vars:{"--bg-primary":`#efe8da`,"--bg-secondary":`#f8f3e9`,"--bg-tertiary":`#e6dcc8`,"--bg-node":`#f5efe2`,"--border-color":`#d4c7ab`,"--border-light":`#c2b28e`,"--text-primary":`#2a2418`,"--text-secondary":`#59503c`,"--text-muted":`#8d8168`,"--canvas-bg":`#eae2d1`,"--grid-color":`rgba(80,60,10,0.10)`,"--node-shadow":`0 5px 14px rgba(100,80,30,0.16)`}},ocean:{label:`Deep Ocean`,vars:{"--bg-primary":`#06131c`,"--bg-secondary":`#0a1c29`,"--bg-tertiary":`#10293c`,"--border-color":`#1d425e`,"--border-light":`#285578`,"--text-primary":`#e2eef7`,"--text-secondary":`#96b6cc`,"--text-muted":`#5b7d94`,"--canvas-bg":`#06131c`,"--grid-color":`rgba(150,210,255,0.06)`,"--node-shadow":`0 8px 22px rgba(0,10,20,0.6)`}},rose:{label:`Rose Noir`,vars:{"--bg-primary":`#170b10`,"--bg-secondary":`#211117`,"--bg-tertiary":`#301a22`,"--border-color":`#4d2b38`,"--border-light":`#653a49`,"--text-primary":`#f5e7ec`,"--text-secondary":`#cfa5b3`,"--text-muted":`#966b7b`,"--canvas-bg":`#170b10`,"--grid-color":`rgba(255,190,215,0.05)`,"--node-shadow":`0 6px 18px rgba(25,0,10,0.55)`}},terminal:{label:`Terminal Green`,vars:{"--bg-primary":`#050d05`,"--bg-secondary":`#0a140a`,"--bg-tertiary":`#102010`,"--border-color":`#1f3d1f`,"--border-light":`#2b522b`,"--text-primary":`#d8f5d8`,"--text-secondary":`#8fce8f`,"--text-muted":`#568a56`,"--canvas-bg":`#050d05`,"--grid-color":`rgba(120,255,120,0.06)`,"--node-shadow":`0 6px 18px rgba(0,10,0,0.6)`}},contrast:{label:`High Contrast`,vars:{"--bg-primary":`#000000`,"--bg-secondary":`#0a0a0a`,"--bg-tertiary":`#161616`,"--border-color":`#555555`,"--border-light":`#777777`,"--text-primary":`#ffffff`,"--text-secondary":`#d8d8d8`,"--text-muted":`#9a9a9a`,"--canvas-bg":`#000000`,"--grid-color":`rgba(255,255,255,0.10)`,"--node-shadow":`0 0 0 1px #666`}}},ut=`studio`,dt=`#f2545b`,ft=`formencoder_ui_settings`,pt=e=>typeof e==`number`&&Number.isFinite(e)?Math.min(1.5,Math.max(0,e)):1;function mt(){try{let e=localStorage.getItem(ft);if(e){let t=JSON.parse(e);return{theme:t.theme&<[t.theme]?t.theme:ut,accentColor:t.accentColor||`#f2545b`,intensity:pt(t.intensity)}}}catch(e){console.error(`[theme] read failed:`,e)}return{theme:ut,accentColor:dt,intensity:1}}function ht(e){try{let t=localStorage.getItem(ft),n={...t?JSON.parse(t):{},...e,appearance:1};localStorage.setItem(ft,JSON.stringify(n))}catch(e){console.error(`[theme] save failed:`,e)}}function gt(e=mt()){let t=document.documentElement,n=lt[e.theme]||lt.studio;for(let[e,r]of Object.entries(n.vars))t.style.setProperty(e,r);document.body.classList.toggle(`theme-light`,!!n.light),t.style.setProperty(`--bg-node`,n.vars[`--bg-node`]||n.vars[`--bg-secondary`]),t.style.setProperty(`--shadow-lg`,n.light?`0 4px 14px rgba(96, 90, 70, 0.16)`:`0 8px 32px rgba(0, 0, 0, 0.5)`),t.style.setProperty(`--accent-color`,e.accentColor),t.style.setProperty(`--accent-color-dim`,e.accentColor+`33`),t.style.setProperty(`--accent-color-hover`,`color-mix(in srgb, ${e.accentColor} 82%, #ffffff)`),t.style.setProperty(`--accent-intensity`,String(pt(e.intensity))),t.style.setProperty(`--accent-tint`,vt(e.accentColor,.06)),t.style.setProperty(`--accent-tint-strong`,vt(e.accentColor,.1))}function _t(e){let t={...mt(),theme:e};ht(t),gt(t),document.dispatchEvent(new CustomEvent(`nm:ui-settings-changed`,{detail:{key:`theme`}}))}function vt(e,t){let n=e.replace(`#`,``),r=n.length===3?n.split(``).map(e=>e+e).join(``):n,i=parseInt(r.slice(0,6),16);return Number.isNaN(i)?`rgba(171,160,211,${t})`:`rgba(${i>>16&255},${i>>8&255},${i&255},${t})`}var yt=new WeakMap;function bt(e,t=`info`){let n=document.getElementById(`toast-root`);if(!n)return;let r=t===`error`?6e3:3600,i=`cv-toast${t===`error`?` is-error`:t===`ok`?` is-ok`:``}`,a=Array.from(n.children).find(t=>t.textContent===e&&t.className===i);if(a){window.clearTimeout(yt.get(a)),yt.set(a,window.setTimeout(()=>a.remove(),r));return}let o=A(``);for(o.textContent=e,n.appendChild(o);n.children.length>4;)n.firstElementChild?.remove();yt.set(o,window.setTimeout(()=>o.remove(),r))}var xt=`0.8.4`;function St(e){let t=.7071752369554196,n=Math.tan(Math.PI*1681.974450955533/e),r=10**(3.999843853973347/20),i=r**.4996667741545416,a=1+n/t+n*n;return{b0:(r+i*n/t+n*n)/a,b1:2*(n*n-r)/a,b2:(r-i*n/t+n*n)/a,a1:2*(n*n-1)/a,a2:(1-n/t+n*n)/a}}function Ct(e){let t=.5003270373238773,n=Math.tan(Math.PI*38.13547087602444/e),r=1+n/t+n*n;return{b0:1,b1:-2,b2:1,a1:2*(n*n-1)/r,a2:(1-n/t+n*n)/r}}function wt(e,t){let n=St(t),r=Ct(t),i=new Float64Array(e.length),a=0,o=0,s=0,c=0;for(let t=0;te>0?-.691+10*Math.log10(e):-1/0,Et=e=>e>0?20*Math.log10(e):-1/0;function Dt(e,t,n){let r=0;for(let i=-7;i<=8;i++){let a=t+i;if(a<0||a>=e.length)continue;let o=i-n,s=Math.abs(o)<1e-9?1:Math.sin(Math.PI*o)/(Math.PI*o);r+=e[a]*s*(.5+.5*Math.cos(Math.PI*o/9))}return r}function Ot(e){let t=0;for(let n of e)for(let e=0;et&&(t=r)}let n=t,r=t*.5;for(let t of e)for(let e=0;en&&(n=i)}return{sample:t,truePeak:n}}function kt(e,t){let n=(e.length-1)*t,r=Math.floor(n),i=Math.min(e.length-1,r+1);return e[r]+(e[i]-e[r])*(n-r)}function At(e,t){let n=new Float32Array(e.length).fill(NaN),r=0;for(let i=0;i=t&&(r-=e[i-t]),i>=t-1&&(n[i]=Tt(r/t));return n}function z(e,t){let n=e[0]?.length??0,r=Math.round(t*.1),i=Math.floor(n/r),a=new Float64Array(i);for(let n of e){let e=wt(n,t);for(let t=0;t10**((e+.691)/10),l=Array.from(o).filter(e=>Number.isFinite(e)&&e>-70),u=-1/0;if(l.length){let e=Tt(l.reduce((e,t)=>e+c(t),0)/l.length)-10,t=l.filter(t=>t>e);t.length&&(u=Tt(t.reduce((e,t)=>e+c(t),0)/t.length))}let d=Array.from(s).filter(e=>Number.isFinite(e)&&e>-70),f=0;if(d.length){let e=Tt(d.reduce((e,t)=>e+c(t),0)/d.length)-20,t=d.filter(t=>t>e).sort((e,t)=>e-t);t.length&&(f=kt(t,.95)-kt(t,.1))}let p=Ot(e),m=e=>e.reduce((e,t)=>Number.isFinite(t)&&t>e?t:e,-1/0);return{integrated:u,lra:f,samplePeak:Et(p.sample),truePeak:Et(p.truePeak),momentary:o,short:s,momentaryMax:m(o),shortMax:m(s),step:.1,duration:n/t}}function B(e,t=1){let n=Number(e.toFixed(t));return`${n>0?`+`:``}${n.toFixed(t)}`}function V(e,t=1){return Number.isFinite(e)?e.toFixed(t):`-inf`}function jt(){let e=window;return e.FE_MEDIA||={},e.FE_MEDIA}function Mt(e){return new Promise((t,n)=>{let r=document.createElement(`script`);r.async=!0,r.src=`media/${e}.js`,r.onload=()=>{r.remove(),t()},r.onerror=()=>{r.remove(),n(Error(`the media pack ${e} did not load`))},document.head.appendChild(r)})}async function Nt(e){await Mt(e.pack);let t=jt(),n=t[e.file];if(delete t[e.file],!n)throw Error(`the media pack ${e.pack} holds no ${e.file}`);let r=atob(n),i=new Uint8Array(r.length);for(let e=0;ePt.decode(new Uint8Array(e.buffer,e.byteOffset+t,4)),Ft={66:`Baseline`,77:`Main`,88:`Extended`,100:`High`,110:`High 10`,122:`High 4:2:2`,244:`High 4:4:4`},It={apco:`ProRes 422 Proxy`,apcs:`ProRes 422 LT`,apcn:`ProRes 422`,apch:`ProRes 422 HQ`,ap4h:`ProRes 4444`,ap4x:`ProRes 4444 XQ`},Lt={sowt:`PCM s16le`,twos:`PCM s16be`,in24:`PCM s24`,in32:`PCM s32`,lpcm:`PCM`,fl32:`PCM f32`,fl64:`PCM f64`,raw:`PCM u8`};function Rt(e,t,n){let r={type:``,timescale:0,duration:0,width:0,height:0,format:``,profile:``,samples:0,stts:0,bytes:0,channels:0,bits:0,rate:0,esObject:0},i=(t,n)=>{let a=t;for(;a+8<=n;){let t=e.getUint32(a),o=U(e,a+4),s=8;if(t===1&&(t=Number(e.getBigUint64(a+8)),s=16),t===0&&(t=n-a),tn)break;let c=a+s,l=a+t;if(o===`mdia`||o===`minf`||o===`stbl`)i(c,l);else if(o===`tkhd`){let t=c+(e.getUint8(c)===1?88:76);r.width=e.getUint32(t)/65536,r.height=e.getUint32(t+4)/65536}else if(o===`mdhd`){let t=e.getUint8(c);r.timescale=e.getUint32(c+(t===1?20:12)),r.duration=t===1?Number(e.getBigUint64(c+24)):e.getUint32(c+16)}else if(o===`hdlr`)r.type=U(e,c+8);else if(o===`stsd`){let t=c+8;if(r.format=U(e,t+4),r.type===`vide`){let n=e.getUint16(t+32),i=e.getUint16(t+34);n&&(r.width=n),i&&(r.height=i);let a=t+86,o=e.getUint32(t);for(;a+8<=t+o;){let t=e.getUint32(a),n=U(e,a+4);if(t<8)break;n===`avcC`&&(r.profile=`${Ft[e.getUint8(a+9)]??`profile `+e.getUint8(a+9)} L${(e.getUint8(a+11)/10).toFixed(1)}`),n===`hvcC`&&(r.profile={1:`Main`,2:`Main 10`}[e.getUint8(a+9)&31]??``),a+=t}}else if(r.type===`soun`){r.channels=e.getUint16(t+24),r.bits=e.getUint16(t+26),r.rate=e.getUint16(t+32);let n=e.getUint32(t),i=t+36;for(;i+8<=t+n;){let t=e.getUint32(i),n=U(e,i+4);if(t<8)break;if(n===`esds`){for(let n=i+12;nr.byteLength)break;if(t===`mvhd`){let e=r.getUint8(s+8);a=r.getUint32(s+8+(e===1?20:12)),o=e===1?Number(r.getBigUint64(s+8+24)):r.getUint32(s+8+16)}else if(t===`trak`){let t=Rt(r,s+8,s+e),n=t.timescale?t.duration/t.timescale:0;if(t.type===`vide`&&!i.video){let e=t.stts&&t.samples?t.samples*t.timescale/t.stts:null;i.video={codec:zt(t.format),profile:t.profile,width:Math.round(t.width),height:Math.round(t.height),fps:e,frames:t.samples||null,bitrate:n&&t.bytes?t.bytes*8/n:null,pixels:``}}else t.type===`soun`&&i.audio.push({codec:Bt(t),sampleRate:t.rate||null,channels:t.channels||null,bitDepth:Lt[t.format]?t.bits:null,bitrate:n&&t.bytes?t.bytes*8/n:null})}s+=e}return i.duration=a?o/a:null,i.duration&&(i.bitrate=e.size*8/i.duration),i}function Ht(e,t,n){let r=e[t];if(r===void 0||r===0)return null;let i=1;for(;!(r&128>>i-1);)i++;if(t+i>e.length)return null;let a=n?r:r&255>>i,o=(r&255>>i)==255>>i;for(let n=1;n{if(!o)return;let e=o.codec===`V_VP9`?`VP9`:o.codec===`V_VP8`?`VP8`:o.codec===`V_AV1`?`AV1`:o.codec===`V_MPEG4/ISO/AVC`?`H.264`:o.codec===`V_MPEGH/ISO/HEVC`?`HEVC`:o.codec;o.type===1&&!r.video&&(r.video={codec:e,profile:``,width:o.w,height:o.h,fps:o.dur?1e9/o.dur:null,frames:null,bitrate:null,pixels:``}),o.type===2&&r.audio.push({codec:o.codec===`A_OPUS`?`Opus`:o.codec===`A_VORBIS`?`Vorbis`:o.codec===`A_AAC`?`AAC`:o.codec===`A_FLAC`?`FLAC`:o.codec,sampleRate:o.rate||null,channels:o.ch||null,bitDepth:o.bits||null,bitrate:null}),o=null},c=(e,t)=>{let r=0;for(let i=0;in===4?t.getFloat32(e):n===8?t.getFloat64(e):0,u=(e,t,d)=>{let f=e;for(;f=0?i={codec:`Opus`,sampleRate:48e3,channels:n[a+9],bitDepth:null,bitrate:null}:o>=0&&(i={codec:`Vorbis`,sampleRate:t.getUint32(o+12,!0),channels:n[o+11],bitDepth:null,bitrate:null});let s=await H(e,Math.max(0,e.size-65536),Math.min(e.size,65536)),c=new Uint8Array(s.buffer),l=null;for(let e=c.length-27;e>=0;e--)if(c[e]===79&&c[e+1]===103&&c[e+2]===103&&c[e+3]===83){l=Number(s.getBigUint64(e+6,!0));break}let u=i.sampleRate??48e3,d=l!==null&&l>0?l/(i.codec===`Opus`?48e3:u):null;return{container:`Ogg`,duration:d,size:e.size,bitrate:d?e.size*8/d:null,video:null,audio:[i],notes:[]}}async function qt(e){let t=await H(e,0,Math.min(e.size,64));if(t.byteLength<26||U(t,0)!==`fLaC`)return null;let n=t.getUint8(18)<<12|t.getUint8(19)<<4|t.getUint8(20)>>4,r=(t.getUint8(20)>>1&7)+1,i=((t.getUint8(20)&1)<<4|t.getUint8(21)>>4)+1,a=(t.getUint8(21)&15)*2**32+t.getUint32(22),o=n&&a?a/n:null;return{container:`FLAC`,duration:o,size:e.size,bitrate:o?e.size*8/o:null,video:null,audio:[{codec:`FLAC`,sampleRate:n,channels:r,bitDepth:i,bitrate:null}],notes:[]}}var Jt=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320],Yt=[44100,48e3,32e3];async function Xt(e){let t=await H(e,0,Math.min(e.size,65536)),n=0;if(U(t,0).startsWith(`ID3`)&&(n=10+(t.getUint8(6)<<21|t.getUint8(7)<<14|t.getUint8(8)<<7|t.getUint8(9))),n+4>t.byteLength)return null;for(let r=n;r+4>3&3,i=t.getUint8(r+1)>>1&3,a=Jt[t.getUint8(r+2)>>4],o=Yt[t.getUint8(r+2)>>2&3];if(n!==3||i!==1||!a||!o)continue;let s=t.getUint8(r+3)>>6==3?1:2;return{container:`MPEG audio`,duration:(e.size-r)*8/(a*1e3),size:e.size,bitrate:a*1e3,video:null,audio:[{codec:`MP3`,sampleRate:o,channels:s,bitDepth:null,bitrate:a*1e3}],notes:[`duration assumes constant bitrate`]}}return null}async function Zt(e){let t=[Vt,Wt,Gt,Kt,qt,Xt];for(let n of t)try{let t=await n(e);if(t)return t}catch{continue}return{container:e.type||`unknown`,duration:null,size:e.size,bitrate:null,video:null,audio:[],notes:[`container not recognised, showing what the browser reports`]}}var Qt=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAA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`1
+ `),this.areas=Object.fromEntries(ot.map(e=>[e,this.el.querySelector(`[data-area="${e}"]`)]));for(let e of Array.from(this.el.querySelectorAll(`.fx-split`)))this.bindSplit(e);window.addEventListener(`resize`,()=>this.resized())}register(e,t,n){this.factories.set(e,n),this.titles.set(e,t)}titleOf(e){return this.titles.get(e)??e}panelIds(){return[...this.factories.keys()]}peek(e){return this.made.get(e)}panel(e){let t=this.made.get(e);if(!t){let n=this.factories.get(e);if(!n)return;t=n(),t.el.classList.add(`fx-panel`),t.el.dataset.panel=e,t.el.dataset.automationId=`panel.${e}`,this.made.set(e,t)}return t}bindSplit(e){let t=e.dataset.split;e.addEventListener(`pointerdown`,n=>{n.preventDefault(),e.setPointerCapture(n.pointerId),k(e,`is-dragging`,!0);let r={x:n.clientX,y:n.clientY,l:this.layout.leftW,r:this.layout.rightW,b:this.layout.bottomH},i=e=>{t===`left`&&(this.layout.leftW=Math.max(160,Math.min(900,r.l+e.clientX-r.x))),t===`right`&&(this.layout.rightW=Math.max(160,Math.min(1100,r.r-(e.clientX-r.x)))),t===`bottom`&&(this.layout.bottomH=Math.max(120,Math.min(window.innerHeight-220,r.b-(e.clientY-r.y)))),this.applySizes()},a=()=>{k(e,`is-dragging`,!1),e.removeEventListener(`pointermove`,i),e.removeEventListener(`pointerup`,a),this.save()};e.addEventListener(`pointermove`,i),e.addEventListener(`pointerup`,a)})}applySizes(){let e=this.groups.left.length?this.layout.leftW:0,t=this.groups.right.length?this.layout.rightW:0,n=this.groups.bottom.length?this.layout.bottomH:0;this.el.style.setProperty(`--fx-left`,`${e}px`),this.el.style.setProperty(`--fx-right`,`${t}px`),this.el.style.setProperty(`--fx-bottom`,`${n}px`),k(this.el,`no-left`,!e),k(this.el,`no-right`,!t),k(this.el,`no-bottom`,!n);for(let e of at){let t=this.groups[e],n=t.reduce((e,t)=>e+t.size,0)||1;for(let e of t)e.el.style.flex=`${e.size/n} 1 0`}this.resized()}resized(){for(let e of this.made.values())e.el.hidden||e.resized?.()}applyLayout(e,t){this.workspace=t,this.layout=structuredClone(e);for(let t of ot){for(let e of this.groups[t]){for(let t of e.panels){let e=this.made.get(t);e&&(e.el.hidden=!0,e.hidden?.())}e.el.remove()}this.groups[t]=[];let n=(t===`float`?e.float:e[t])??[];for(let e of n){let n=new st(this,t);n.size=e.size??1,e.w!==void 0&&(n.rect={x:e.x??120,y:e.y??90,w:e.w,h:e.h??340}),this.areas[t].appendChild(n.el),this.groups[t].push(n);for(let t of e.panels)this.factories.has(t)&&n.add(t,!1);t===`float`&&!n.panels.length?(n.el.remove(),this.groups[t].pop()):(n.activate(e.active&&e.panels.includes(e.active)?e.active:n.panels[0]),t===`float`&&n.place())}}this.applySizes(),this.onWorkspace?.(t)}load(){let e=`Default`,t=null;try{let n=localStorage.getItem(R);if(n){let r=JSON.parse(n);e=r.workspace||`Default`,t=r.layouts?.[e]??null}}catch{t=null}this.applyLayout(t??L[e]??L.Default,e)}snapshot(){let e={left:[],center:[],right:[],bottom:[],leftW:this.layout.leftW,rightW:this.layout.rightW,bottomH:this.layout.bottomH};for(let t of[`left`,`center`,`right`,`bottom`])e[t]=this.groups[t].map(e=>({panels:[...e.panels],active:e.active,size:e.size}));return e.float=this.groups.float.map(e=>({panels:[...e.panels],active:e.active,...e.rect})),e}save(){try{let e=localStorage.getItem(R),t=e?JSON.parse(e):{};t.workspace=this.workspace,t.layouts={...t.layouts||{},[this.workspace]:this.snapshot()},localStorage.setItem(R,JSON.stringify(t))}catch{return}}savedNames(){try{let e=JSON.parse(localStorage.getItem(R)||`{}`);return Object.keys(e.custom||{})}catch{return[]}}switchTo(e){let t=null;try{let n=JSON.parse(localStorage.getItem(R)||`{}`);t=n.layouts?.[e]??n.custom?.[e]??null}catch{t=null}this.applyLayout(t??L[e]??L.Default,e),this.save()}resetWorkspace(){this.applyLayout(L[this.workspace]??L.Default,this.workspace),this.save()}saveAs(e){try{let t=JSON.parse(localStorage.getItem(R)||`{}`);t.custom={...t.custom||{},[e]:this.snapshot()},localStorage.setItem(R,JSON.stringify(t))}catch{return}this.workspace=e,this.save(),this.onWorkspace?.(e)}find(e){for(let t of ot)for(let n of this.groups[t])if(n.panels.includes(e))return n}home(e){let t=e===`essential`?this.find(`effectsPresets`):void 0;if(t&&t.area!==`float`)return t;let n=e===`composition`?`center`:[`timeline`,`renderQueue`,`terminal`,`agents`,`graph`,`flowchart`].includes(e)?`bottom`:`right`;return this.groups[n][0]??this.groups.right[0]??this.groups.bottom[0]??this.groups.center[0]}show(e){if(!this.factories.has(e))return;let t=this.find(e);if(!t){if(t=this.home(e),!t)return;t.add(e,!0),this.applySizes()}t.activate(e),this.focus(e)}undock(e){let t=this.find(e);if(!t||t.area===`float`)return;let n=this.el.getBoundingClientRect(),r=new st(this,`float`),i=this.groups.float.length;r.rect={x:Math.max(0,n.width/2-260+i*28),y:Math.max(0,n.height/2-200+i*28),w:520,h:400},this.areas.float.appendChild(r.el),this.groups.float.push(r),r.place(),this.move(e,r),this.focus(e)}redock(e){let t=this.find(e);if(!t||t.area!==`float`)return;let n=this.home(e);n?this.move(e,n):this.close(e)}isVisible(e){let t=this.made.get(e);return!!t&&!t.el.hidden}close(e){let t=this.find(e);t&&(t.remove(e),t.panels.length||(t.el.remove(),this.groups[t.area]=this.groups[t.area].filter(e=>e!==t),this.applySizes()),this.save())}move(e,t){let n=this.find(e);n!==t&&(n?.remove(e),n&&!n.panels.length&&(n.el.remove(),this.groups[n.area]=this.groups[n.area].filter(e=>e!==n)),t.add(e,!0),this.applySizes(),this.save())}raise(e){let t=this.groups.float;e.area===`float`&&t[t.length-1]!==e&&(this.groups.float=[...t.filter(t=>t!==e),e],this.groups.float.forEach((e,t)=>e.el.style.zIndex=String(t+1)))}maximize(e){e.area!==`float`&&(this.maximized===e?(this.maximized=null,k(this.el,`is-maximized`,!1),k(e.el,`is-max`,!1)):(this.maximized&&k(this.maximized.el,`is-max`,!1),this.maximized=e,k(this.el,`is-maximized`,!0),k(e.el,`is-max`,!0)),this.resized())}toggleMaximizeFocused(){let e=this.find(this.focused);e&&this.maximize(e)}focused=`queue`;focus(e){if(!e||this.focused===e)return;let t=this.find(this.focused);t&&k(t.el,`is-focused`,!1),this.focused=e;let n=this.find(e);n&&k(n.el,`is-focused`,!0),this.onFocus?.(e)}},lt={studio:{label:`Studio Dark`,vars:{"--bg-primary":`#111111`,"--bg-secondary":`#17151b`,"--bg-tertiary":`#222127`,"--border-color":`#2a2a2a`,"--border-light":`#34333a`,"--text-primary":`#f7f7f7`,"--text-secondary":`#a4a4a4`,"--text-muted":`#717072`,"--canvas-bg":`#1c1b1d`,"--grid-color":`#5e5e60`,"--bg-node":`#191919`}},"nodemode-dark":{label:`NodeMode Dark`,vars:{"--bg-primary":`#0a0a0a`,"--bg-secondary":`#121218`,"--bg-tertiary":`#1a1a24`,"--border-color":`#2a2a35`,"--border-light":`#3a3a48`,"--text-primary":`#e8e8ee`,"--text-secondary":`#a8a8b8`,"--text-muted":`#6a6a7a`,"--canvas-bg":`#0a0a0a`,"--grid-color":`rgba(255,255,255,0.04)`,"--node-shadow":`0 6px 18px rgba(0,0,0,0.45)`}},light:{label:`Light`,light:!0,vars:{"--bg-primary":`#ecebe6`,"--bg-secondary":`#f7f6f1`,"--bg-tertiary":`#e2e0d8`,"--bg-node":`#f4f3ed`,"--border-color":`#d1cdc1`,"--border-light":`#beb9aa`,"--text-primary":`#26241d`,"--text-secondary":`#4c4a40`,"--text-muted":`#8b887a`,"--canvas-bg":`#e7e5dd`,"--grid-color":`rgba(70,60,30,0.10)`,"--node-shadow":`0 5px 14px rgba(96,90,70,0.15)`}},"github-dark":{label:`GitHub Dark`,vars:{"--bg-primary":`#0d1117`,"--bg-secondary":`#161b22`,"--bg-tertiary":`#21262d`,"--border-color":`#30363d`,"--border-light":`#3d444d`,"--text-primary":`#e6edf3`,"--text-secondary":`#9198a1`,"--text-muted":`#656c76`,"--canvas-bg":`#0d1117`,"--grid-color":`rgba(230,237,243,0.05)`,"--node-shadow":`0 6px 18px rgba(0,0,0,0.5)`}},midnight:{label:`Midnight Blue`,vars:{"--bg-primary":`#0b1020`,"--bg-secondary":`#101830`,"--bg-tertiary":`#182242`,"--border-color":`#25325c`,"--border-light":`#324274`,"--text-primary":`#e4e9f7`,"--text-secondary":`#9fabd0`,"--text-muted":`#63709a`,"--canvas-bg":`#0b1020`,"--grid-color":`rgba(160,180,255,0.06)`,"--node-shadow":`0 8px 22px rgba(0,0,20,0.55)`}},forest:{label:`Forest`,vars:{"--bg-primary":`#0c130e`,"--bg-secondary":`#121c15`,"--bg-tertiary":`#1a281e`,"--border-color":`#2a4030`,"--border-light":`#375441`,"--text-primary":`#e4efe7`,"--text-secondary":`#a4bdac`,"--text-muted":`#6a8674`,"--canvas-bg":`#0c130e`,"--grid-color":`rgba(180,230,190,0.05)`,"--node-shadow":`0 6px 18px rgba(0,10,0,0.5)`}},ember:{label:`Ember`,vars:{"--bg-primary":`#140d0a`,"--bg-secondary":`#1d1310`,"--bg-tertiary":`#2a1c16`,"--border-color":`#452e22`,"--border-light":`#5a3d2e`,"--text-primary":`#f2e8e2`,"--text-secondary":`#c7ab9c`,"--text-muted":`#8f7263`,"--canvas-bg":`#140d0a`,"--grid-color":`rgba(255,200,160,0.05)`,"--node-shadow":`0 6px 18px rgba(20,5,0,0.55)`}},violet:{label:`Violet Haze`,vars:{"--bg-primary":`#100b1c`,"--bg-secondary":`#171129`,"--bg-tertiary":`#221a3c`,"--border-color":`#382c5e`,"--border-light":`#493b78`,"--text-primary":`#ece6f9`,"--text-secondary":`#b3a6d8`,"--text-muted":`#7a6da3`,"--canvas-bg":`#100b1c`,"--grid-color":`rgba(210,190,255,0.06)`,"--node-shadow":`0 8px 22px rgba(10,0,30,0.55)`}},slate:{label:`Slate`,vars:{"--bg-primary":`#101418`,"--bg-secondary":`#171d23`,"--bg-tertiary":`#212a32`,"--border-color":`#32404c`,"--border-light":`#415260`,"--text-primary":`#e7edf2`,"--text-secondary":`#a3b2bf`,"--text-muted":`#6b7a87`,"--canvas-bg":`#101418`,"--grid-color":`rgba(200,220,240,0.05)`,"--node-shadow":`0 6px 18px rgba(0,5,10,0.5)`}},mono:{label:`Mono Ink`,vars:{"--bg-primary":`#0e0e0e`,"--bg-secondary":`#161616`,"--bg-tertiary":`#202020`,"--border-color":`#333333`,"--border-light":`#454545`,"--text-primary":`#f0f0f0`,"--text-secondary":`#ababab`,"--text-muted":`#6e6e6e`,"--canvas-bg":`#0e0e0e`,"--grid-color":`rgba(255,255,255,0.05)`,"--node-shadow":`0 6px 18px rgba(0,0,0,0.5)`}},sand:{label:`Sand (light)`,light:!0,vars:{"--bg-primary":`#efe8da`,"--bg-secondary":`#f8f3e9`,"--bg-tertiary":`#e6dcc8`,"--bg-node":`#f5efe2`,"--border-color":`#d4c7ab`,"--border-light":`#c2b28e`,"--text-primary":`#2a2418`,"--text-secondary":`#59503c`,"--text-muted":`#8d8168`,"--canvas-bg":`#eae2d1`,"--grid-color":`rgba(80,60,10,0.10)`,"--node-shadow":`0 5px 14px rgba(100,80,30,0.16)`}},ocean:{label:`Deep Ocean`,vars:{"--bg-primary":`#06131c`,"--bg-secondary":`#0a1c29`,"--bg-tertiary":`#10293c`,"--border-color":`#1d425e`,"--border-light":`#285578`,"--text-primary":`#e2eef7`,"--text-secondary":`#96b6cc`,"--text-muted":`#5b7d94`,"--canvas-bg":`#06131c`,"--grid-color":`rgba(150,210,255,0.06)`,"--node-shadow":`0 8px 22px rgba(0,10,20,0.6)`}},rose:{label:`Rose Noir`,vars:{"--bg-primary":`#170b10`,"--bg-secondary":`#211117`,"--bg-tertiary":`#301a22`,"--border-color":`#4d2b38`,"--border-light":`#653a49`,"--text-primary":`#f5e7ec`,"--text-secondary":`#cfa5b3`,"--text-muted":`#966b7b`,"--canvas-bg":`#170b10`,"--grid-color":`rgba(255,190,215,0.05)`,"--node-shadow":`0 6px 18px rgba(25,0,10,0.55)`}},terminal:{label:`Terminal Green`,vars:{"--bg-primary":`#050d05`,"--bg-secondary":`#0a140a`,"--bg-tertiary":`#102010`,"--border-color":`#1f3d1f`,"--border-light":`#2b522b`,"--text-primary":`#d8f5d8`,"--text-secondary":`#8fce8f`,"--text-muted":`#568a56`,"--canvas-bg":`#050d05`,"--grid-color":`rgba(120,255,120,0.06)`,"--node-shadow":`0 6px 18px rgba(0,10,0,0.6)`}},contrast:{label:`High Contrast`,vars:{"--bg-primary":`#000000`,"--bg-secondary":`#0a0a0a`,"--bg-tertiary":`#161616`,"--border-color":`#555555`,"--border-light":`#777777`,"--text-primary":`#ffffff`,"--text-secondary":`#d8d8d8`,"--text-muted":`#9a9a9a`,"--canvas-bg":`#000000`,"--grid-color":`rgba(255,255,255,0.10)`,"--node-shadow":`0 0 0 1px #666`}}},ut=`studio`,dt=`#f2545b`,ft=`formencoder_ui_settings`,pt=e=>typeof e==`number`&&Number.isFinite(e)?Math.min(1.5,Math.max(0,e)):1;function mt(){try{let e=localStorage.getItem(ft);if(e){let t=JSON.parse(e);return{theme:t.theme&<[t.theme]?t.theme:ut,accentColor:t.accentColor||`#f2545b`,intensity:pt(t.intensity)}}}catch(e){console.error(`[theme] read failed:`,e)}return{theme:ut,accentColor:dt,intensity:1}}function ht(e){try{let t=localStorage.getItem(ft),n={...t?JSON.parse(t):{},...e,appearance:1};localStorage.setItem(ft,JSON.stringify(n))}catch(e){console.error(`[theme] save failed:`,e)}}function gt(e=mt()){let t=document.documentElement,n=lt[e.theme]||lt.studio;for(let[e,r]of Object.entries(n.vars))t.style.setProperty(e,r);document.body.classList.toggle(`theme-light`,!!n.light),t.style.setProperty(`--bg-node`,n.vars[`--bg-node`]||n.vars[`--bg-secondary`]),t.style.setProperty(`--shadow-lg`,n.light?`0 4px 14px rgba(96, 90, 70, 0.16)`:`0 8px 32px rgba(0, 0, 0, 0.5)`),t.style.setProperty(`--accent-color`,e.accentColor),t.style.setProperty(`--accent-color-dim`,e.accentColor+`33`),t.style.setProperty(`--accent-color-hover`,`color-mix(in srgb, ${e.accentColor} 82%, #ffffff)`),t.style.setProperty(`--accent-intensity`,String(pt(e.intensity))),t.style.setProperty(`--accent-tint`,vt(e.accentColor,.06)),t.style.setProperty(`--accent-tint-strong`,vt(e.accentColor,.1))}function _t(e){let t={...mt(),theme:e};ht(t),gt(t),document.dispatchEvent(new CustomEvent(`nm:ui-settings-changed`,{detail:{key:`theme`}}))}function vt(e,t){let n=e.replace(`#`,``),r=n.length===3?n.split(``).map(e=>e+e).join(``):n,i=parseInt(r.slice(0,6),16);return Number.isNaN(i)?`rgba(171,160,211,${t})`:`rgba(${i>>16&255},${i>>8&255},${i&255},${t})`}var yt=new WeakMap;function bt(e,t=`info`){let n=document.getElementById(`toast-root`);if(!n)return;let r=t===`error`?6e3:3600,i=`cv-toast${t===`error`?` is-error`:t===`ok`?` is-ok`:``}`,a=Array.from(n.children).find(t=>t.textContent===e&&t.className===i);if(a){window.clearTimeout(yt.get(a)),yt.set(a,window.setTimeout(()=>a.remove(),r));return}let o=A(``);for(o.textContent=e,n.appendChild(o);n.children.length>4;)n.firstElementChild?.remove();yt.set(o,window.setTimeout(()=>o.remove(),r))}var xt=`0.10.0`;function St(e){let t=.7071752369554196,n=Math.tan(Math.PI*1681.974450955533/e),r=10**(3.999843853973347/20),i=r**.4996667741545416,a=1+n/t+n*n;return{b0:(r+i*n/t+n*n)/a,b1:2*(n*n-r)/a,b2:(r-i*n/t+n*n)/a,a1:2*(n*n-1)/a,a2:(1-n/t+n*n)/a}}function Ct(e){let t=.5003270373238773,n=Math.tan(Math.PI*38.13547087602444/e),r=1+n/t+n*n;return{b0:1,b1:-2,b2:1,a1:2*(n*n-1)/r,a2:(1-n/t+n*n)/r}}function wt(e,t){let n=St(t),r=Ct(t),i=new Float64Array(e.length),a=0,o=0,s=0,c=0;for(let t=0;te>0?-.691+10*Math.log10(e):-1/0,Et=e=>e>0?20*Math.log10(e):-1/0;function Dt(e,t,n){let r=0;for(let i=-7;i<=8;i++){let a=t+i;if(a<0||a>=e.length)continue;let o=i-n,s=Math.abs(o)<1e-9?1:Math.sin(Math.PI*o)/(Math.PI*o);r+=e[a]*s*(.5+.5*Math.cos(Math.PI*o/9))}return r}function Ot(e){let t=0;for(let n of e)for(let e=0;et&&(t=r)}let n=t,r=t*.5;for(let t of e)for(let e=0;en&&(n=i)}return{sample:t,truePeak:n}}function kt(e,t){let n=(e.length-1)*t,r=Math.floor(n),i=Math.min(e.length-1,r+1);return e[r]+(e[i]-e[r])*(n-r)}function At(e,t){let n=new Float32Array(e.length).fill(NaN),r=0;for(let i=0;i=t&&(r-=e[i-t]),i>=t-1&&(n[i]=Tt(r/t));return n}function z(e,t){let n=e[0]?.length??0,r=Math.round(t*.1),i=Math.floor(n/r),a=new Float64Array(i);for(let n of e){let e=wt(n,t);for(let t=0;t10**((e+.691)/10),l=Array.from(o).filter(e=>Number.isFinite(e)&&e>-70),u=-1/0;if(l.length){let e=Tt(l.reduce((e,t)=>e+c(t),0)/l.length)-10,t=l.filter(t=>t>e);t.length&&(u=Tt(t.reduce((e,t)=>e+c(t),0)/t.length))}let d=Array.from(s).filter(e=>Number.isFinite(e)&&e>-70),f=0;if(d.length){let e=Tt(d.reduce((e,t)=>e+c(t),0)/d.length)-20,t=d.filter(t=>t>e).sort((e,t)=>e-t);t.length&&(f=kt(t,.95)-kt(t,.1))}let p=Ot(e),m=e=>e.reduce((e,t)=>Number.isFinite(t)&&t>e?t:e,-1/0);return{integrated:u,lra:f,samplePeak:Et(p.sample),truePeak:Et(p.truePeak),momentary:o,short:s,momentaryMax:m(o),shortMax:m(s),step:.1,duration:n/t}}function B(e,t=1){let n=Number(e.toFixed(t));return`${n>0?`+`:``}${n.toFixed(t)}`}function V(e,t=1){return Number.isFinite(e)?e.toFixed(t):`-inf`}function jt(){let e=window;return e.FE_MEDIA||={},e.FE_MEDIA}function Mt(e){return new Promise((t,n)=>{let r=document.createElement(`script`);r.async=!0,r.src=`media/${e}.js`,r.onload=()=>{r.remove(),t()},r.onerror=()=>{r.remove(),n(Error(`the media pack ${e} did not load`))},document.head.appendChild(r)})}async function Nt(e){await Mt(e.pack);let t=jt(),n=t[e.file];if(delete t[e.file],!n)throw Error(`the media pack ${e.pack} holds no ${e.file}`);let r=atob(n),i=new Uint8Array(r.length);for(let e=0;ePt.decode(new Uint8Array(e.buffer,e.byteOffset+t,4)),Ft={66:`Baseline`,77:`Main`,88:`Extended`,100:`High`,110:`High 10`,122:`High 4:2:2`,244:`High 4:4:4`},It={apco:`ProRes 422 Proxy`,apcs:`ProRes 422 LT`,apcn:`ProRes 422`,apch:`ProRes 422 HQ`,ap4h:`ProRes 4444`,ap4x:`ProRes 4444 XQ`},Lt={sowt:`PCM s16le`,twos:`PCM s16be`,in24:`PCM s24`,in32:`PCM s32`,lpcm:`PCM`,fl32:`PCM f32`,fl64:`PCM f64`,raw:`PCM u8`};function Rt(e,t,n){let r={type:``,timescale:0,duration:0,width:0,height:0,format:``,profile:``,samples:0,stts:0,bytes:0,channels:0,bits:0,rate:0,esObject:0},i=(t,n)=>{let a=t;for(;a+8<=n;){let t=e.getUint32(a),o=U(e,a+4),s=8;if(t===1&&(t=Number(e.getBigUint64(a+8)),s=16),t===0&&(t=n-a),tn)break;let c=a+s,l=a+t;if(o===`mdia`||o===`minf`||o===`stbl`)i(c,l);else if(o===`tkhd`){let t=c+(e.getUint8(c)===1?88:76);r.width=e.getUint32(t)/65536,r.height=e.getUint32(t+4)/65536}else if(o===`mdhd`){let t=e.getUint8(c);r.timescale=e.getUint32(c+(t===1?20:12)),r.duration=t===1?Number(e.getBigUint64(c+24)):e.getUint32(c+16)}else if(o===`hdlr`)r.type=U(e,c+8);else if(o===`stsd`){let t=c+8;if(r.format=U(e,t+4),r.type===`vide`){let n=e.getUint16(t+32),i=e.getUint16(t+34);n&&(r.width=n),i&&(r.height=i);let a=t+86,o=e.getUint32(t);for(;a+8<=t+o;){let t=e.getUint32(a),n=U(e,a+4);if(t<8)break;n===`avcC`&&(r.profile=`${Ft[e.getUint8(a+9)]??`profile `+e.getUint8(a+9)} L${(e.getUint8(a+11)/10).toFixed(1)}`),n===`hvcC`&&(r.profile={1:`Main`,2:`Main 10`}[e.getUint8(a+9)&31]??``),a+=t}}else if(r.type===`soun`){r.channels=e.getUint16(t+24),r.bits=e.getUint16(t+26),r.rate=e.getUint16(t+32);let n=e.getUint32(t),i=t+36;for(;i+8<=t+n;){let t=e.getUint32(i),n=U(e,i+4);if(t<8)break;if(n===`esds`){for(let n=i+12;nr.byteLength)break;if(t===`mvhd`){let e=r.getUint8(s+8);a=r.getUint32(s+8+(e===1?20:12)),o=e===1?Number(r.getBigUint64(s+8+24)):r.getUint32(s+8+16)}else if(t===`trak`){let t=Rt(r,s+8,s+e),n=t.timescale?t.duration/t.timescale:0;if(t.type===`vide`&&!i.video){let e=t.stts&&t.samples?t.samples*t.timescale/t.stts:null;i.video={codec:zt(t.format),profile:t.profile,width:Math.round(t.width),height:Math.round(t.height),fps:e,frames:t.samples||null,bitrate:n&&t.bytes?t.bytes*8/n:null,pixels:``}}else t.type===`soun`&&i.audio.push({codec:Bt(t),sampleRate:t.rate||null,channels:t.channels||null,bitDepth:Lt[t.format]?t.bits:null,bitrate:n&&t.bytes?t.bytes*8/n:null})}s+=e}return i.duration=a?o/a:null,i.duration&&(i.bitrate=e.size*8/i.duration),i}function Ht(e,t,n){let r=e[t];if(r===void 0||r===0)return null;let i=1;for(;!(r&128>>i-1);)i++;if(t+i>e.length)return null;let a=n?r:r&255>>i,o=(r&255>>i)==255>>i;for(let n=1;n{if(!o)return;let e=o.codec===`V_VP9`?`VP9`:o.codec===`V_VP8`?`VP8`:o.codec===`V_AV1`?`AV1`:o.codec===`V_MPEG4/ISO/AVC`?`H.264`:o.codec===`V_MPEGH/ISO/HEVC`?`HEVC`:o.codec;o.type===1&&!r.video&&(r.video={codec:e,profile:``,width:o.w,height:o.h,fps:o.dur?1e9/o.dur:null,frames:null,bitrate:null,pixels:``}),o.type===2&&r.audio.push({codec:o.codec===`A_OPUS`?`Opus`:o.codec===`A_VORBIS`?`Vorbis`:o.codec===`A_AAC`?`AAC`:o.codec===`A_FLAC`?`FLAC`:o.codec,sampleRate:o.rate||null,channels:o.ch||null,bitDepth:o.bits||null,bitrate:null}),o=null},c=(e,t)=>{let r=0;for(let i=0;in===4?t.getFloat32(e):n===8?t.getFloat64(e):0,u=(e,t,d)=>{let f=e;for(;f=0?i={codec:`Opus`,sampleRate:48e3,channels:n[a+9],bitDepth:null,bitrate:null}:o>=0&&(i={codec:`Vorbis`,sampleRate:t.getUint32(o+12,!0),channels:n[o+11],bitDepth:null,bitrate:null});let s=await H(e,Math.max(0,e.size-65536),Math.min(e.size,65536)),c=new Uint8Array(s.buffer),l=null;for(let e=c.length-27;e>=0;e--)if(c[e]===79&&c[e+1]===103&&c[e+2]===103&&c[e+3]===83){l=Number(s.getBigUint64(e+6,!0));break}let u=i.sampleRate??48e3,d=l!==null&&l>0?l/(i.codec===`Opus`?48e3:u):null;return{container:`Ogg`,duration:d,size:e.size,bitrate:d?e.size*8/d:null,video:null,audio:[i],notes:[]}}async function qt(e){let t=await H(e,0,Math.min(e.size,64));if(t.byteLength<26||U(t,0)!==`fLaC`)return null;let n=t.getUint8(18)<<12|t.getUint8(19)<<4|t.getUint8(20)>>4,r=(t.getUint8(20)>>1&7)+1,i=((t.getUint8(20)&1)<<4|t.getUint8(21)>>4)+1,a=(t.getUint8(21)&15)*2**32+t.getUint32(22),o=n&&a?a/n:null;return{container:`FLAC`,duration:o,size:e.size,bitrate:o?e.size*8/o:null,video:null,audio:[{codec:`FLAC`,sampleRate:n,channels:r,bitDepth:i,bitrate:null}],notes:[]}}var Jt=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320],Yt=[44100,48e3,32e3];async function Xt(e){let t=await H(e,0,Math.min(e.size,65536)),n=0;if(U(t,0).startsWith(`ID3`)&&(n=10+(t.getUint8(6)<<21|t.getUint8(7)<<14|t.getUint8(8)<<7|t.getUint8(9))),n+4>t.byteLength)return null;for(let r=n;r+4>3&3,i=t.getUint8(r+1)>>1&3,a=Jt[t.getUint8(r+2)>>4],o=Yt[t.getUint8(r+2)>>2&3];if(n!==3||i!==1||!a||!o)continue;let s=t.getUint8(r+3)>>6==3?1:2;return{container:`MPEG audio`,duration:(e.size-r)*8/(a*1e3),size:e.size,bitrate:a*1e3,video:null,audio:[{codec:`MP3`,sampleRate:o,channels:s,bitDepth:null,bitrate:a*1e3}],notes:[`duration assumes constant bitrate`]}}return null}async function Zt(e){let t=[Vt,Wt,Gt,Kt,qt,Xt];for(let n of t)try{let t=await n(e);if(t)return t}catch{continue}return{container:e.type||`unknown`,duration:null,size:e.size,bitrate:null,video:null,audio:[],notes:[`container not recognised, showing what the browser reports`]}}var Qt=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAACa7klEQVR42u39aZgt2XUdBq59Iu6Uw5vrvRoeUKhCASBATCIBkBRFgDMJUpIhCqJEUaREkZJMWa22P8ndn9WDZXf7k9vdbbcttU1qFkXZ1mdJptykKFIkAYKYUShUFQo1z1Wv6s053ykizu4fMe1zzj5xb76qfPWymIEvka8yb94bN26cffZee+21gKPj6Dg6jo6j4+g4Oo6Oo+PoODqOjqPj6Dg6jo6j4+g4Oo6Oo+PoODqOjqPj6Dg6jo6j4+g4Oo6Oo+PoODqOjqPj6Dg6jo6j4+g4Oo6Oo+PoODqOjqPj6Dg6jo6j4+g4Oo6Oo+PoODqOjqPj6Dg6jo6j4+g4Oo6Oo+PoODqOjqPj6Dg6jo6j4+g4Oo6Oo+PoODpu6kFHl2Dp63F0rQ7XwTf4u6Mb/vfJ+yblGtBRQDjUC54ii5s7/pvFdz4KAG/O90fKvwm4j+6+O6OiKJrrIP9trSVrLRljGAAuXQKAS0eL/5YOAudw7lz7+RljuP78ACBJEuffL7zQY+BpFgFACwh8FAAO3+4uF725G3cb3A30ej1++umnCwCF98Ea8TfGey4DIKm+G++5l7mmLH7Ob/AO6e+W9BquM0f+m16n19hP+l4vWFt9FdV3uZCt9zh57sl9992XZFlGeAF4AS9Y8RgtQBwFgFt40RM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PVxp/M4IOd5QEVskO/GAgvxdK8HjTLHq8yetW6qjRu75MpL6PPc9BX78bpdq8GVP/ZYPaMkbmsVKBOxb3m2rR4/cRcEUdi5YWPA4duzwdgX63ZBDgJX4eyxa6ggm/2RfI77eja8G/GbolfAQmdp7zogX/+24hHB2vbxDoSt9vtH5fxKtdBKS9lvOmJbRIDkor8qADwNFxdBwdR8fRcXQcHUfH0XF0HB1Hx9FxdBwdR8fRcXQcHUfH0XF0HB1Hx9FxdBwdR8fRcXQcHUfH0XF0HB1Hx9FxdBwdR8fRcXQcHUfH0XF0HB1Hx9FxdBwdR8fRcXQcHUfH0XF0HB1Hx614/P8BURHlBMXY6sIAAAAASUVORK5CYII=`,$t=`1
00:00:00,340 --> 00:00:03,850
She was fastened by a light chain
to one of the seats on deck,
diff --git a/demos/inspect/README.md b/demos/inspect/README.md
index 92e2732..7daa8fe 100644
--- a/demos/inspect/README.md
+++ b/demos/inspect/README.md
@@ -11,7 +11,7 @@ Everything it needs is inside this folder (about 24 MB, mostly the footage). Not
## What it shows
-The interface is the real one: Studio Dark tokens, the fifteen themes, the dock, the Media Browser card, Media Info rows and the Outputs list, imported from `frontend/src/`. It opens on a small hike shoot: three Pexels clips of different shapes (1280x720 at 29.97 fps, 1280x640 at 23.976 fps, a vertical 404x720 at 60 fps), a numbered JPEG sequence of clouds at 24 fps, and the outputs made from the first clip: a high and a low bitrate encode, a 960x540 proxy and an animated GIF. A and B are set to the stream clip and its low bitrate encode in Compare view. Sources, authors and licences are in `CREDITS.md`.
+The interface is the real one: Studio Dark tokens, the sixteen themes, the dock, the Media Browser card, Media Info rows and the Outputs list, imported from `frontend/src/`. It opens on a small hike shoot: three Pexels clips of different shapes (1280x720 at 29.97 fps, 1280x640 at 23.976 fps, a vertical 404x720 at 60 fps), a numbered JPEG sequence of clouds at 24 fps, and the outputs made from the first clip: a high and a low bitrate encode, a 960x540 proxy and an animated GIF. A and B are set to the stream clip and its low bitrate encode in Compare view. Sources, authors and licences are in `CREDITS.md`.
- **Media Browser.** The shoot as cards with thumbnails, frame counts and frame rates; Show in A or B, Create Proxy, Contact Sheet from the context menu.
- **Viewer.** Slots A and B take any source or output; A, B and Compare views; frame-accurate stepping with the arrow keys, Home and End, drop-frame timecode at 29.97 and 59.94 fps, frame numbers, In and Out marks, Fit and 1:1 with a synchronised pan, Save Frame (A, B or A and B side by side) and Contact Sheet.
diff --git a/demos/inspect/assets/inspect.js b/demos/inspect/assets/inspect.js
index 6f6916a..4bd0a15 100644
--- a/demos/inspect/assets/inspect.js
+++ b/demos/inspect/assets/inspect.js
@@ -10,7 +10,7 @@
- `),this.areas=Object.fromEntries(ae.map(e=>[e,this.el.querySelector(`[data-area="${e}"]`)]));for(let e of Array.from(this.el.querySelectorAll(`.fx-split`)))this.bindSplit(e);window.addEventListener(`resize`,()=>this.resized())}register(e,t,n){this.factories.set(e,n),this.titles.set(e,t)}titleOf(e){return this.titles.get(e)??e}panelIds(){return[...this.factories.keys()]}peek(e){return this.made.get(e)}panel(e){let t=this.made.get(e);if(!t){let n=this.factories.get(e);if(!n)return;t=n(),t.el.classList.add(`fx-panel`),t.el.dataset.panel=e,t.el.dataset.automationId=`panel.${e}`,this.made.set(e,t)}return t}bindSplit(e){let t=e.dataset.split;e.addEventListener(`pointerdown`,r=>{r.preventDefault(),e.setPointerCapture(r.pointerId),n(e,`is-dragging`,!0);let i={x:r.clientX,y:r.clientY,l:this.layout.leftW,r:this.layout.rightW,b:this.layout.bottomH},a=e=>{t===`left`&&(this.layout.leftW=Math.max(160,Math.min(900,i.l+e.clientX-i.x))),t===`right`&&(this.layout.rightW=Math.max(160,Math.min(1100,i.r-(e.clientX-i.x)))),t===`bottom`&&(this.layout.bottomH=Math.max(120,Math.min(window.innerHeight-220,i.b-(e.clientY-i.y)))),this.applySizes()},o=()=>{n(e,`is-dragging`,!1),e.removeEventListener(`pointermove`,a),e.removeEventListener(`pointerup`,o),this.save()};e.addEventListener(`pointermove`,a),e.addEventListener(`pointerup`,o)})}applySizes(){let e=this.groups.left.length?this.layout.leftW:0,t=this.groups.right.length?this.layout.rightW:0,r=this.groups.bottom.length?this.layout.bottomH:0;this.el.style.setProperty(`--fx-left`,`${e}px`),this.el.style.setProperty(`--fx-right`,`${t}px`),this.el.style.setProperty(`--fx-bottom`,`${r}px`),n(this.el,`no-left`,!e),n(this.el,`no-right`,!t),n(this.el,`no-bottom`,!r);for(let e of ie){let t=this.groups[e],n=t.reduce((e,t)=>e+t.size,0)||1;for(let e of t)e.el.style.flex=`${e.size/n} 1 0`}this.resized()}resized(){for(let e of this.made.values())e.el.hidden||e.resized?.()}applyLayout(e,t){this.workspace=t,this.layout=structuredClone(e);for(let t of ae){for(let e of this.groups[t]){for(let t of e.panels){let e=this.made.get(t);e&&(e.el.hidden=!0,e.hidden?.())}e.el.remove()}this.groups[t]=[];let n=(t===`float`?e.float:e[t])??[];for(let e of n){let n=new oe(this,t);n.size=e.size??1,e.w!==void 0&&(n.rect={x:e.x??120,y:e.y??90,w:e.w,h:e.h??340}),this.areas[t].appendChild(n.el),this.groups[t].push(n);for(let t of e.panels)this.factories.has(t)&&n.add(t,!1);t===`float`&&!n.panels.length?(n.el.remove(),this.groups[t].pop()):(n.activate(e.active&&e.panels.includes(e.active)?e.active:n.panels[0]),t===`float`&&n.place())}}this.applySizes(),this.onWorkspace?.(t)}load(){let e=`Default`,t=null;try{let n=localStorage.getItem(C);if(n){let r=JSON.parse(n);e=r.workspace||`Default`,t=r.layouts?.[e]??null}}catch{t=null}this.applyLayout(t??S[e]??S.Default,e)}snapshot(){let e={left:[],center:[],right:[],bottom:[],leftW:this.layout.leftW,rightW:this.layout.rightW,bottomH:this.layout.bottomH};for(let t of[`left`,`center`,`right`,`bottom`])e[t]=this.groups[t].map(e=>({panels:[...e.panels],active:e.active,size:e.size}));return e.float=this.groups.float.map(e=>({panels:[...e.panels],active:e.active,...e.rect})),e}save(){try{let e=localStorage.getItem(C),t=e?JSON.parse(e):{};t.workspace=this.workspace,t.layouts={...t.layouts||{},[this.workspace]:this.snapshot()},localStorage.setItem(C,JSON.stringify(t))}catch{return}}savedNames(){try{let e=JSON.parse(localStorage.getItem(C)||`{}`);return Object.keys(e.custom||{})}catch{return[]}}switchTo(e){let t=null;try{let n=JSON.parse(localStorage.getItem(C)||`{}`);t=n.layouts?.[e]??n.custom?.[e]??null}catch{t=null}this.applyLayout(t??S[e]??S.Default,e),this.save()}resetWorkspace(){this.applyLayout(S[this.workspace]??S.Default,this.workspace),this.save()}saveAs(e){try{let t=JSON.parse(localStorage.getItem(C)||`{}`);t.custom={...t.custom||{},[e]:this.snapshot()},localStorage.setItem(C,JSON.stringify(t))}catch{return}this.workspace=e,this.save(),this.onWorkspace?.(e)}find(e){for(let t of ae)for(let n of this.groups[t])if(n.panels.includes(e))return n}home(e){let t=e===`essential`?this.find(`effectsPresets`):void 0;if(t&&t.area!==`float`)return t;let n=e===`composition`?`center`:[`timeline`,`renderQueue`,`terminal`,`agents`,`graph`,`flowchart`].includes(e)?`bottom`:`right`;return this.groups[n][0]??this.groups.right[0]??this.groups.bottom[0]??this.groups.center[0]}show(e){if(!this.factories.has(e))return;let t=this.find(e);if(!t){if(t=this.home(e),!t)return;t.add(e,!0),this.applySizes()}t.activate(e),this.focus(e)}undock(e){let t=this.find(e);if(!t||t.area===`float`)return;let n=this.el.getBoundingClientRect(),r=new oe(this,`float`),i=this.groups.float.length;r.rect={x:Math.max(0,n.width/2-260+i*28),y:Math.max(0,n.height/2-200+i*28),w:520,h:400},this.areas.float.appendChild(r.el),this.groups.float.push(r),r.place(),this.move(e,r),this.focus(e)}redock(e){let t=this.find(e);if(!t||t.area!==`float`)return;let n=this.home(e);n?this.move(e,n):this.close(e)}isVisible(e){let t=this.made.get(e);return!!t&&!t.el.hidden}close(e){let t=this.find(e);t&&(t.remove(e),t.panels.length||(t.el.remove(),this.groups[t.area]=this.groups[t.area].filter(e=>e!==t),this.applySizes()),this.save())}move(e,t){let n=this.find(e);n!==t&&(n?.remove(e),n&&!n.panels.length&&(n.el.remove(),this.groups[n.area]=this.groups[n.area].filter(e=>e!==n)),t.add(e,!0),this.applySizes(),this.save())}raise(e){let t=this.groups.float;e.area===`float`&&t[t.length-1]!==e&&(this.groups.float=[...t.filter(t=>t!==e),e],this.groups.float.forEach((e,t)=>e.el.style.zIndex=String(t+1)))}maximize(e){e.area!==`float`&&(this.maximized===e?(this.maximized=null,n(this.el,`is-maximized`,!1),n(e.el,`is-max`,!1)):(this.maximized&&n(this.maximized.el,`is-max`,!1),this.maximized=e,n(this.el,`is-maximized`,!0),n(e.el,`is-max`,!0)),this.resized())}toggleMaximizeFocused(){let e=this.find(this.focused);e&&this.maximize(e)}focused=`queue`;focus(e){if(!e||this.focused===e)return;let t=this.find(this.focused);t&&n(t.el,`is-focused`,!1),this.focused=e;let r=this.find(e);r&&n(r.el,`is-focused`,!0),this.onFocus?.(e)}},ce={studio:{label:`Studio Dark`,vars:{"--bg-primary":`#111111`,"--bg-secondary":`#17151b`,"--bg-tertiary":`#222127`,"--border-color":`#2a2a2a`,"--border-light":`#34333a`,"--text-primary":`#f7f7f7`,"--text-secondary":`#a4a4a4`,"--text-muted":`#717072`,"--canvas-bg":`#1c1b1d`,"--grid-color":`#5e5e60`,"--bg-node":`#191919`}},"nodemode-dark":{label:`NodeMode Dark`,vars:{"--bg-primary":`#0a0a0a`,"--bg-secondary":`#121218`,"--bg-tertiary":`#1a1a24`,"--border-color":`#2a2a35`,"--border-light":`#3a3a48`,"--text-primary":`#e8e8ee`,"--text-secondary":`#a8a8b8`,"--text-muted":`#6a6a7a`,"--canvas-bg":`#0a0a0a`,"--grid-color":`rgba(255,255,255,0.04)`,"--node-shadow":`0 6px 18px rgba(0,0,0,0.45)`}},light:{label:`Light`,light:!0,vars:{"--bg-primary":`#ecebe6`,"--bg-secondary":`#f7f6f1`,"--bg-tertiary":`#e2e0d8`,"--bg-node":`#f4f3ed`,"--border-color":`#d1cdc1`,"--border-light":`#beb9aa`,"--text-primary":`#26241d`,"--text-secondary":`#4c4a40`,"--text-muted":`#8b887a`,"--canvas-bg":`#e7e5dd`,"--grid-color":`rgba(70,60,30,0.10)`,"--node-shadow":`0 5px 14px rgba(96,90,70,0.15)`}},"github-dark":{label:`GitHub Dark`,vars:{"--bg-primary":`#0d1117`,"--bg-secondary":`#161b22`,"--bg-tertiary":`#21262d`,"--border-color":`#30363d`,"--border-light":`#3d444d`,"--text-primary":`#e6edf3`,"--text-secondary":`#9198a1`,"--text-muted":`#656c76`,"--canvas-bg":`#0d1117`,"--grid-color":`rgba(230,237,243,0.05)`,"--node-shadow":`0 6px 18px rgba(0,0,0,0.5)`}},midnight:{label:`Midnight Blue`,vars:{"--bg-primary":`#0b1020`,"--bg-secondary":`#101830`,"--bg-tertiary":`#182242`,"--border-color":`#25325c`,"--border-light":`#324274`,"--text-primary":`#e4e9f7`,"--text-secondary":`#9fabd0`,"--text-muted":`#63709a`,"--canvas-bg":`#0b1020`,"--grid-color":`rgba(160,180,255,0.06)`,"--node-shadow":`0 8px 22px rgba(0,0,20,0.55)`}},forest:{label:`Forest`,vars:{"--bg-primary":`#0c130e`,"--bg-secondary":`#121c15`,"--bg-tertiary":`#1a281e`,"--border-color":`#2a4030`,"--border-light":`#375441`,"--text-primary":`#e4efe7`,"--text-secondary":`#a4bdac`,"--text-muted":`#6a8674`,"--canvas-bg":`#0c130e`,"--grid-color":`rgba(180,230,190,0.05)`,"--node-shadow":`0 6px 18px rgba(0,10,0,0.5)`}},ember:{label:`Ember`,vars:{"--bg-primary":`#140d0a`,"--bg-secondary":`#1d1310`,"--bg-tertiary":`#2a1c16`,"--border-color":`#452e22`,"--border-light":`#5a3d2e`,"--text-primary":`#f2e8e2`,"--text-secondary":`#c7ab9c`,"--text-muted":`#8f7263`,"--canvas-bg":`#140d0a`,"--grid-color":`rgba(255,200,160,0.05)`,"--node-shadow":`0 6px 18px rgba(20,5,0,0.55)`}},violet:{label:`Violet Haze`,vars:{"--bg-primary":`#100b1c`,"--bg-secondary":`#171129`,"--bg-tertiary":`#221a3c`,"--border-color":`#382c5e`,"--border-light":`#493b78`,"--text-primary":`#ece6f9`,"--text-secondary":`#b3a6d8`,"--text-muted":`#7a6da3`,"--canvas-bg":`#100b1c`,"--grid-color":`rgba(210,190,255,0.06)`,"--node-shadow":`0 8px 22px rgba(10,0,30,0.55)`}},slate:{label:`Slate`,vars:{"--bg-primary":`#101418`,"--bg-secondary":`#171d23`,"--bg-tertiary":`#212a32`,"--border-color":`#32404c`,"--border-light":`#415260`,"--text-primary":`#e7edf2`,"--text-secondary":`#a3b2bf`,"--text-muted":`#6b7a87`,"--canvas-bg":`#101418`,"--grid-color":`rgba(200,220,240,0.05)`,"--node-shadow":`0 6px 18px rgba(0,5,10,0.5)`}},mono:{label:`Mono Ink`,vars:{"--bg-primary":`#0e0e0e`,"--bg-secondary":`#161616`,"--bg-tertiary":`#202020`,"--border-color":`#333333`,"--border-light":`#454545`,"--text-primary":`#f0f0f0`,"--text-secondary":`#ababab`,"--text-muted":`#6e6e6e`,"--canvas-bg":`#0e0e0e`,"--grid-color":`rgba(255,255,255,0.05)`,"--node-shadow":`0 6px 18px rgba(0,0,0,0.5)`}},sand:{label:`Sand (light)`,light:!0,vars:{"--bg-primary":`#efe8da`,"--bg-secondary":`#f8f3e9`,"--bg-tertiary":`#e6dcc8`,"--bg-node":`#f5efe2`,"--border-color":`#d4c7ab`,"--border-light":`#c2b28e`,"--text-primary":`#2a2418`,"--text-secondary":`#59503c`,"--text-muted":`#8d8168`,"--canvas-bg":`#eae2d1`,"--grid-color":`rgba(80,60,10,0.10)`,"--node-shadow":`0 5px 14px rgba(100,80,30,0.16)`}},ocean:{label:`Deep Ocean`,vars:{"--bg-primary":`#06131c`,"--bg-secondary":`#0a1c29`,"--bg-tertiary":`#10293c`,"--border-color":`#1d425e`,"--border-light":`#285578`,"--text-primary":`#e2eef7`,"--text-secondary":`#96b6cc`,"--text-muted":`#5b7d94`,"--canvas-bg":`#06131c`,"--grid-color":`rgba(150,210,255,0.06)`,"--node-shadow":`0 8px 22px rgba(0,10,20,0.6)`}},rose:{label:`Rose Noir`,vars:{"--bg-primary":`#170b10`,"--bg-secondary":`#211117`,"--bg-tertiary":`#301a22`,"--border-color":`#4d2b38`,"--border-light":`#653a49`,"--text-primary":`#f5e7ec`,"--text-secondary":`#cfa5b3`,"--text-muted":`#966b7b`,"--canvas-bg":`#170b10`,"--grid-color":`rgba(255,190,215,0.05)`,"--node-shadow":`0 6px 18px rgba(25,0,10,0.55)`}},terminal:{label:`Terminal Green`,vars:{"--bg-primary":`#050d05`,"--bg-secondary":`#0a140a`,"--bg-tertiary":`#102010`,"--border-color":`#1f3d1f`,"--border-light":`#2b522b`,"--text-primary":`#d8f5d8`,"--text-secondary":`#8fce8f`,"--text-muted":`#568a56`,"--canvas-bg":`#050d05`,"--grid-color":`rgba(120,255,120,0.06)`,"--node-shadow":`0 6px 18px rgba(0,10,0,0.6)`}},contrast:{label:`High Contrast`,vars:{"--bg-primary":`#000000`,"--bg-secondary":`#0a0a0a`,"--bg-tertiary":`#161616`,"--border-color":`#555555`,"--border-light":`#777777`,"--text-primary":`#ffffff`,"--text-secondary":`#d8d8d8`,"--text-muted":`#9a9a9a`,"--canvas-bg":`#000000`,"--grid-color":`rgba(255,255,255,0.10)`,"--node-shadow":`0 0 0 1px #666`}}},le=`studio`,ue=`#f2545b`,de=`formencoder_ui_settings`,fe=e=>typeof e==`number`&&Number.isFinite(e)?Math.min(1.5,Math.max(0,e)):1;function pe(){try{let e=localStorage.getItem(de);if(e){let t=JSON.parse(e);return{theme:t.theme&&ce[t.theme]?t.theme:le,accentColor:t.accentColor||`#f2545b`,intensity:fe(t.intensity)}}}catch(e){console.error(`[theme] read failed:`,e)}return{theme:le,accentColor:ue,intensity:1}}function me(e){try{let t=localStorage.getItem(de),n={...t?JSON.parse(t):{},...e,appearance:1};localStorage.setItem(de,JSON.stringify(n))}catch(e){console.error(`[theme] save failed:`,e)}}function he(e=pe()){let t=document.documentElement,n=ce[e.theme]||ce.studio;for(let[e,r]of Object.entries(n.vars))t.style.setProperty(e,r);document.body.classList.toggle(`theme-light`,!!n.light),t.style.setProperty(`--bg-node`,n.vars[`--bg-node`]||n.vars[`--bg-secondary`]),t.style.setProperty(`--shadow-lg`,n.light?`0 4px 14px rgba(96, 90, 70, 0.16)`:`0 8px 32px rgba(0, 0, 0, 0.5)`),t.style.setProperty(`--accent-color`,e.accentColor),t.style.setProperty(`--accent-color-dim`,e.accentColor+`33`),t.style.setProperty(`--accent-color-hover`,`color-mix(in srgb, ${e.accentColor} 82%, #ffffff)`),t.style.setProperty(`--accent-intensity`,String(fe(e.intensity))),t.style.setProperty(`--accent-tint`,_e(e.accentColor,.06)),t.style.setProperty(`--accent-tint-strong`,_e(e.accentColor,.1))}function ge(e){let t={...pe(),theme:e};me(t),he(t),document.dispatchEvent(new CustomEvent(`nm:ui-settings-changed`,{detail:{key:`theme`}}))}function _e(e,t){let n=e.replace(`#`,``),r=n.length===3?n.split(``).map(e=>e+e).join(``):n,i=parseInt(r.slice(0,6),16);return Number.isNaN(i)?`rgba(171,160,211,${t})`:`rgba(${i>>16&255},${i>>8&255},${i&255},${t})`}var ve=`0.8.4`,ye=new WeakMap;function w(e,t=`info`){let n=document.getElementById(`toast-root`);if(!n)return;let r=t===`error`?6e3:3600,i=`cv-toast${t===`error`?` is-error`:t===`ok`?` is-ok`:``}`,a=Array.from(n.children).find(t=>t.textContent===e&&t.className===i);if(a){window.clearTimeout(ye.get(a)),ye.set(a,window.setTimeout(()=>a.remove(),r));return}let o=s(``);for(o.textContent=e,n.appendChild(o);n.children.length>4;)n.firstElementChild?.remove();ye.set(o,window.setTimeout(()=>o.remove(),r))}var be=new TextDecoder(`latin1`);async function T(e,t,n){let r=await e.slice(t,t+n).arrayBuffer();return new DataView(r)}var E=(e,t)=>be.decode(new Uint8Array(e.buffer,e.byteOffset+t,4)),xe={66:`Baseline`,77:`Main`,88:`Extended`,100:`High`,110:`High 10`,122:`High 4:2:2`,244:`High 4:4:4`},Se={apco:`ProRes 422 Proxy`,apcs:`ProRes 422 LT`,apcn:`ProRes 422`,apch:`ProRes 422 HQ`,ap4h:`ProRes 4444`,ap4x:`ProRes 4444 XQ`},Ce={sowt:`PCM s16le`,twos:`PCM s16be`,in24:`PCM s24`,in32:`PCM s32`,lpcm:`PCM`,fl32:`PCM f32`,fl64:`PCM f64`,raw:`PCM u8`};function we(e,t,n){let r={type:``,timescale:0,duration:0,width:0,height:0,format:``,profile:``,samples:0,stts:0,bytes:0,channels:0,bits:0,rate:0,esObject:0},i=(t,n)=>{let a=t;for(;a+8<=n;){let t=e.getUint32(a),o=E(e,a+4),s=8;if(t===1&&(t=Number(e.getBigUint64(a+8)),s=16),t===0&&(t=n-a),tn)break;let c=a+s,l=a+t;if(o===`mdia`||o===`minf`||o===`stbl`)i(c,l);else if(o===`tkhd`){let t=c+(e.getUint8(c)===1?88:76);r.width=e.getUint32(t)/65536,r.height=e.getUint32(t+4)/65536}else if(o===`mdhd`){let t=e.getUint8(c);r.timescale=e.getUint32(c+(t===1?20:12)),r.duration=t===1?Number(e.getBigUint64(c+24)):e.getUint32(c+16)}else if(o===`hdlr`)r.type=E(e,c+8);else if(o===`stsd`){let t=c+8;if(r.format=E(e,t+4),r.type===`vide`){let n=e.getUint16(t+32),i=e.getUint16(t+34);n&&(r.width=n),i&&(r.height=i);let a=t+86,o=e.getUint32(t);for(;a+8<=t+o;){let t=e.getUint32(a),n=E(e,a+4);if(t<8)break;n===`avcC`&&(r.profile=`${xe[e.getUint8(a+9)]??`profile `+e.getUint8(a+9)} L${(e.getUint8(a+11)/10).toFixed(1)}`),n===`hvcC`&&(r.profile={1:`Main`,2:`Main 10`}[e.getUint8(a+9)&31]??``),a+=t}}else if(r.type===`soun`){r.channels=e.getUint16(t+24),r.bits=e.getUint16(t+26),r.rate=e.getUint16(t+32);let n=e.getUint32(t),i=t+36;for(;i+8<=t+n;){let t=e.getUint32(i),n=E(e,i+4);if(t<8)break;if(n===`esds`){for(let n=i+12;nr.byteLength)break;if(t===`mvhd`){let e=r.getUint8(s+8);a=r.getUint32(s+8+(e===1?20:12)),o=e===1?Number(r.getBigUint64(s+8+24)):r.getUint32(s+8+16)}else if(t===`trak`){let t=we(r,s+8,s+e),n=t.timescale?t.duration/t.timescale:0;if(t.type===`vide`&&!i.video){let e=t.stts&&t.samples?t.samples*t.timescale/t.stts:null;i.video={codec:Te(t.format),profile:t.profile,width:Math.round(t.width),height:Math.round(t.height),fps:e,frames:t.samples||null,bitrate:n&&t.bytes?t.bytes*8/n:null,pixels:``}}else t.type===`soun`&&i.audio.push({codec:Ee(t),sampleRate:t.rate||null,channels:t.channels||null,bitDepth:Ce[t.format]?t.bits:null,bitrate:n&&t.bytes?t.bytes*8/n:null})}s+=e}return i.duration=a?o/a:null,i.duration&&(i.bitrate=e.size*8/i.duration),i}function Oe(e,t,n){let r=e[t];if(r===void 0||r===0)return null;let i=1;for(;!(r&128>>i-1);)i++;if(t+i>e.length)return null;let a=n?r:r&255>>i,o=(r&255>>i)==255>>i;for(let n=1;n{if(!o)return;let e=o.codec===`V_VP9`?`VP9`:o.codec===`V_VP8`?`VP8`:o.codec===`V_AV1`?`AV1`:o.codec===`V_MPEG4/ISO/AVC`?`H.264`:o.codec===`V_MPEGH/ISO/HEVC`?`HEVC`:o.codec;o.type===1&&!r.video&&(r.video={codec:e,profile:``,width:o.w,height:o.h,fps:o.dur?1e9/o.dur:null,frames:null,bitrate:null,pixels:``}),o.type===2&&r.audio.push({codec:o.codec===`A_OPUS`?`Opus`:o.codec===`A_VORBIS`?`Vorbis`:o.codec===`A_AAC`?`AAC`:o.codec===`A_FLAC`?`FLAC`:o.codec,sampleRate:o.rate||null,channels:o.ch||null,bitDepth:o.bits||null,bitrate:null}),o=null},c=(e,t)=>{let r=0;for(let i=0;in===4?t.getFloat32(e):n===8?t.getFloat64(e):0,u=(e,t,d)=>{let f=e;for(;f=0?i={codec:`Opus`,sampleRate:48e3,channels:n[a+9],bitDepth:null,bitrate:null}:o>=0&&(i={codec:`Vorbis`,sampleRate:t.getUint32(o+12,!0),channels:n[o+11],bitDepth:null,bitrate:null});let s=await T(e,Math.max(0,e.size-65536),Math.min(e.size,65536)),c=new Uint8Array(s.buffer),l=null;for(let e=c.length-27;e>=0;e--)if(c[e]===79&&c[e+1]===103&&c[e+2]===103&&c[e+3]===83){l=Number(s.getBigUint64(e+6,!0));break}let u=i.sampleRate??48e3,d=l!==null&&l>0?l/(i.codec===`Opus`?48e3:u):null;return{container:`Ogg`,duration:d,size:e.size,bitrate:d?e.size*8/d:null,video:null,audio:[i],notes:[]}}async function Ne(e){let t=await T(e,0,Math.min(e.size,64));if(t.byteLength<26||E(t,0)!==`fLaC`)return null;let n=t.getUint8(18)<<12|t.getUint8(19)<<4|t.getUint8(20)>>4,r=(t.getUint8(20)>>1&7)+1,i=((t.getUint8(20)&1)<<4|t.getUint8(21)>>4)+1,a=(t.getUint8(21)&15)*2**32+t.getUint32(22),o=n&&a?a/n:null;return{container:`FLAC`,duration:o,size:e.size,bitrate:o?e.size*8/o:null,video:null,audio:[{codec:`FLAC`,sampleRate:n,channels:r,bitDepth:i,bitrate:null}],notes:[]}}var Pe=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320],Fe=[44100,48e3,32e3];async function Ie(e){let t=await T(e,0,Math.min(e.size,65536)),n=0;if(E(t,0).startsWith(`ID3`)&&(n=10+(t.getUint8(6)<<21|t.getUint8(7)<<14|t.getUint8(8)<<7|t.getUint8(9))),n+4>t.byteLength)return null;for(let r=n;r+4>3&3,i=t.getUint8(r+1)>>1&3,a=Pe[t.getUint8(r+2)>>4],o=Fe[t.getUint8(r+2)>>2&3];if(n!==3||i!==1||!a||!o)continue;let s=t.getUint8(r+3)>>6==3?1:2;return{container:`MPEG audio`,duration:(e.size-r)*8/(a*1e3),size:e.size,bitrate:a*1e3,video:null,audio:[{codec:`MP3`,sampleRate:o,channels:s,bitDepth:null,bitrate:a*1e3}],notes:[`duration assumes constant bitrate`]}}return null}async function Le(e){let t=[De,Ae,je,Me,Ne,Ie];for(let n of t)try{let t=await n(e);if(t)return t}catch{continue}return{container:e.type||`unknown`,duration:null,size:e.size,bitrate:null,video:null,audio:[],notes:[`container not recognised, showing what the browser reports`]}}var Re=0,ze=()=>`src${++Re}`,D=48e3;function Be(e,t,n,r=8e3){return new Promise((i,a)=>{let o=window.setTimeout(()=>{l(),a(Error(`timed out waiting for ${t}`))},r),s=()=>{l(),i()},c=()=>{l(),a(Error(`the browser cannot decode this file`))},l=()=>{window.clearTimeout(o),e.removeEventListener(t,s),e.removeEventListener(n,c)};e.addEventListener(t,s),e.addEventListener(n,c)})}async function Ve(e){if(Number.isFinite(e.duration))return e.duration;e.currentTime=1e101,await Be(e,`durationchange`,`error`,4e3).catch(()=>void 0);let t=Number.isFinite(e.duration)?e.duration:0;return e.currentTime=0,t}async function He(e){let t=e.requestVideoFrameCallback?.bind(e);if(!t)return 30;let n=[];return new Promise(r=>{let i=()=>{e.pause(),e.currentTime=0;let t=[];for(let e=1;en[e-1]&&t.push(n[e]-n[e-1]);t.sort((e,t)=>e-t);let i=1/(t.length?t[t.length>>1]:1/30),a=[12,15,23.976,24,25,29.97,30,50,59.94,60].reduce((e,t)=>Math.abs(t-i){n.push(r.mediaTime),n.length>=14?i():t(a)};t(a),e.muted=!0,e.play().catch(()=>i()),window.setTimeout(()=>{n.length<14&&i()},1500)})}async function Ue(e,t){let n=URL.createObjectURL(e),r=document.createElement(`video`);r.muted=!0,r.preload=`auto`,r.playsInline=!0,r.src=n;try{await Be(r,`loadedmetadata`,`error`)}catch(e){throw URL.revokeObjectURL(n),e}let i=await Ve(r),a=r.videoWidth>0&&r.videoHeight>0,o=a?t??await He(r):0;a&&await We(r,0);let s=null;return{id:ze(),name:e.name,kind:a?`video`:`audio`,sample:!1,size:e.size,width:r.videoWidth,height:r.videoHeight,fps:o,duration:i,async frame(e){return await We(r,Math.max(0,Math.min(e,Math.max(0,i-.001)))),r},audio(){return s||=(async()=>{if(e.size>629145600)return null;try{return await new OfflineAudioContext(2,1,D).decodeAudioData(await e.arrayBuffer())}catch{return null}})(),s},dispose(){r.removeAttribute(`src`),r.load(),URL.revokeObjectURL(n)}}}async function We(e,t){if(Math.abs(e.currentTime-t)<1e-4&&e.readyState>=2)return;let n=Be(e,`seeked`,`error`,6e3);e.currentTime=t,await n}function O(e){return e==null||!Number.isFinite(e)?``:e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(0)} KB`:e<1073741824?`${(e/1024/1024).toFixed(1)} MB`:`${(e/1024/1024/1024).toFixed(2)} GB`}function Ge(e){if(e==null||!Number.isFinite(e)||e<0)return`--:--`;let t=Math.round(e),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60;return n?`${n}:${String(r).padStart(2,`0`)}:${String(i).padStart(2,`0`)}`:`${String(r).padStart(2,`0`)}:${String(i).padStart(2,`0`)}`}function k(e){return!e||!Number.isFinite(e)?``:e<60?`${e.toFixed(e<10?2:1)} s`:Ge(e)}function Ke(e){return Math.abs(e-29.97)<.02||Math.abs(e-59.94)<.03}function qe(e,t){let n=Math.max(1,Math.round(t)),r=Ke(t)?Math.round(n/15):0,i=Math.max(0,Math.floor(e));if(r){let e=Math.round(t*600),a=n*60-r,o=Math.floor(i/e),s=i%e;i+=r*9*o+(s>r?r*Math.floor((s-r)/a):0)}let a=i%n,o=Math.floor(i/n),s=e=>String(e).padStart(2,`0`);return`${s(Math.floor(o/3600))}:${s(Math.floor(o/60)%60)}:${s(o%60)}${r?`;`:`:`}${s(a)}`}function A(e){let t=[[23.976,`23.976`],[24,`24`],[25,`25`],[29.97,`29.97`],[30,`30`],[50,`50`],[59.94,`59.94`],[60,`60`]].find(([t])=>Math.abs(t-e)<.02);return t?t[1]:String(Number(e.toFixed(3)))}function j(e,t){if(!e||!t)return``;let n=e/t,r=[[16/9,`16:9`],[2,`2:1`],[9/16,`9:16`],[4/3,`4:3`],[1,`1:1`],[3/4,`3:4`],[21/9,`21:9`]].find(([e])=>Math.abs(e-n)/e<.01);return r?r[1]:n.toFixed(2)}function Je(e,t,n,r){return{id:e,name:t,role:n,form:r,parent:``,origin:`included`,label:``,state:`loading`,progress:0,message:``,blob:null,size:0,source:null,probe:null,gif:null,seq:null,frameBlobs:null,names:[],thumb:``,md5:``,md5State:`idle`,width:0,height:0,fps:0,frames:0,duration:0,offset:0,expect:null,checks:null,url:``}}var M=e=>e.replace(/\.[^.]+$/,``).replace(/_%0\dd$/,``),N=e=>(e.form===`video`||e.form===`sequence`)&&!!e.source&&e.state!==`loading`,P=new class{items=[];slotA=``;slotB=``;view=`compare`;zoom=`fit`;frame=0;markIn=null;markOut=null;working=``;logs=[];listeners=new Map;seq=0;on(e,t){this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e)?.add(t)}emit(e){for(let t of this.listeners.get(e)??[])t()}log(e,t=!1){let n=new Date,r=[n.getHours(),n.getMinutes(),n.getSeconds()].map(e=>String(e).padStart(2,`0`)).join(`:`);this.logs.push({time:r,text:e,error:t}),this.logs.length>400&&this.logs.shift(),this.emit(`log`)}nextId(){return this.seq+=1,`m${this.seq}`}get(e){return this.items.find(t=>t.id===e)}a(){return this.get(this.slotA)}b(){return this.get(this.slotB)}master(){let e=this.a();return e&&e.fps>0?e:this.b()}sources(){return this.items.filter(e=>e.role===`source`)}outputs(){return this.items.filter(e=>e.role!==`source`)}add(e){return this.items.push(e),this.emit(`items`),e}make(e,t,n){return Je(this.nextId(),e,t,n)}setSlots(e,t){(e!==this.slotA||t!==this.slotB)&&(this.slotA=e,this.slotB=t,this.emit(`slots`))}setView(e){e!==this.view&&(this.view=e,this.emit(`view`))}setZoom(e){e!==this.zoom&&(this.zoom=e,this.emit(`view`))}setFrame(e){let t=this.master(),n=t?Math.max(0,t.frames-1):0,r=Math.max(0,Math.min(n,Math.round(e)));r!==this.frame&&(this.frame=r,this.emit(`frame`))}setMarks(e,t){this.markIn=e,this.markOut=t,this.emit(`marks`)}},Ye=e=>e?`${(e/1e6).toFixed(2)} Mb/s`:``;function Xe(e){return e.form===`sequence`?`Image sequence`:e.form===`animation`?`Animated GIF`:e.form===`archive`?`Numbered frames (ZIP)`:e.role===`proxy`?`Video, proxy`:`Video`}function Ze(e,t){let n=[],r=(e,t,r)=>{r&&n.push({key:e,label:t,value:r})};r(`kind`,`Kind`,Xe(e));let i=e.probe;if(e.form===`sequence`&&e.seq)r(`container`,`Container`,`Numbered ${e.seq.ext.slice(1).toUpperCase()} files`),r(`size`,`Size`,O(e.size)),r(`duration`,`Duration`,k(e.duration)),r(`vcodec`,`Video`,e.seq.ext.slice(1).toUpperCase()===`JPG`?`JPEG, intra only`:e.seq.ext.slice(1).toUpperCase()),r(`frame`,`Frame`,`${e.width}x${e.height}`),r(`shape`,`Shape`,j(e.width,e.height)),r(`rate`,`Rate`,`${A(e.fps)} fps (set when added)`),r(`frames`,`Frames`,`${e.seq.count}, ${String(e.seq.first).padStart(e.seq.digits,`0`)} to ${String(e.seq.last).padStart(e.seq.digits,`0`)}${e.seq.gaps.length?`, ${e.seq.gaps.length} missing`:`, no gaps`}`),r(`audio`,`Audio`,`None`);else if(e.form===`animation`&&e.gif)r(`container`,`Container`,`GIF89a`),r(`size`,`Size`,O(e.size)),r(`duration`,`Duration`,k(e.gif.duration)),r(`vcodec`,`Video`,`GIF, 256 colours`),r(`frame`,`Frame`,`${e.gif.width}x${e.gif.height}`),r(`shape`,`Shape`,j(e.gif.width,e.gif.height)),r(`rate`,`Rate`,e.gif.duration?`${A(e.gif.frames/e.gif.duration)} fps`:``),r(`frames`,`Frames`,String(e.gif.frames)),r(`audio`,`Audio`,`None`),r(`loop`,`Loop`,e.gif.loops?`Forever`:`Once`);else if(e.form===`archive`)r(`container`,`Container`,`ZIP, stored`),r(`size`,`Size`,O(e.size)),r(`duration`,`Duration`,k(e.duration)),r(`vcodec`,`Video`,e.seq?.ext.slice(1).toUpperCase()??``),r(`frame`,`Frame`,e.width?`${e.width}x${e.height}`:``),r(`shape`,`Shape`,j(e.width,e.height)),r(`rate`,`Rate`,e.fps?`${A(e.fps)} fps`:``),e.seq&&r(`frames`,`Frames`,`${e.seq.count}, ${String(e.seq.first).padStart(e.seq.digits,`0`)} to ${String(e.seq.last).padStart(e.seq.digits,`0`)}${e.seq.gaps.length?`, ${e.seq.gaps.length} missing`:`, no gaps`}`),r(`audio`,`Audio`,`None`);else if(i){r(`container`,`Container`,i.container),r(`size`,`Size`,O(i.size)),r(`duration`,`Duration`,k(i.duration??e.duration)),r(`bitrate`,`Bit rate`,Ye(i.bitrate)),i.video&&(r(`vcodec`,`Video`,[i.video.codec,i.video.profile].filter(Boolean).join(` `)),r(`frame`,`Frame`,`${i.video.width}x${i.video.height}`),r(`shape`,`Shape`,j(i.video.width,i.video.height)),r(`rate`,`Rate`,i.video.fps?`${A(i.video.fps)} fps`:``),r(`frames`,`Frames`,i.video.frames?String(i.video.frames):``),r(`vbit`,`Video rate`,Ye(i.video.bitrate)));let n=i.audio[0];r(`audio`,`Audio`,n?[n.codec,n.sampleRate?`${n.sampleRate} Hz`:``,n.channels?`${n.channels} ch`:``].filter(Boolean).join(`, `):`None`),r(`loud`,`Loudness`,t)}return r(`md5`,`MD5`,e.md5?`${e.md5.slice(0,12)}...`:e.md5State===`running`?`Reading`:``),n}var F=(e,t,n)=>Math.abs(e-t)<=n;function Qe(e){let t=e.expect,n=[];if(!t)return n;if(e.form===`archive`&&e.seq){let r=e.width===t.width&&e.height===t.height;return n.push({label:`Frame count`,want:String(t.frames),got:String(e.seq.count),ok:e.seq.count===t.frames}),n.push({label:`Numbers`,want:`1 to ${t.frames}`,got:`${e.seq.first} to ${e.seq.last}`,ok:e.seq.first===1&&e.seq.last===t.frames&&e.seq.gaps.length===0}),n.push({label:`Frame size`,want:`${t.width}x${t.height}`,got:`${e.width}x${e.height}`,ok:r}),n}if(e.form===`animation`&&e.gif)return n.push({label:`Frame size`,want:`${t.width}x${t.height}`,got:`${e.gif.width}x${e.gif.height}`,ok:e.gif.width===t.width&&e.gif.height===t.height}),n.push({label:`Frame rate`,want:`${A(t.fps)}`,got:e.gif.duration?`${A(e.gif.frames/e.gif.duration)}`:``,ok:e.gif.duration>0&&F(e.gif.frames/e.gif.duration,t.fps,1.6)}),n.push({label:`Duration`,want:`${t.duration.toFixed(2)} s`,got:`${e.gif.duration.toFixed(2)} s`,ok:F(e.gif.duration,t.duration,Math.max(.1,1/t.fps))}),n;let r=e.probe?.video;if(!r)return n;n.push({label:`Frame size`,want:`${t.width}x${t.height}`,got:`${r.width}x${r.height}`,ok:r.width===t.width&&r.height===t.height}),n.push({label:`Frame rate`,want:A(t.fps),got:r.fps?A(r.fps):``,ok:!!r.fps&&F(r.fps,t.fps,.05)});let i=e.probe?.duration??e.duration;n.push({label:`Duration`,want:`${t.duration.toFixed(2)} s`,got:`${i.toFixed(2)} s`,ok:F(i,t.duration,Math.max(.06,1.5/t.fps))}),n.push({label:`Video codec`,want:t.codec,got:r.codec,ok:r.codec.toLowerCase().replace(/\W/g,``).includes(t.codec.toLowerCase().replace(/\W/g,``))});let a=(e.probe?.audio.length??0)>0;return n.push({label:`Audio`,want:t.audio?`present`:`none`,got:a?`present`:`none`,ok:a===t.audio}),r.frames&&t.frames&&n.push({label:`Frames`,want:String(t.frames),got:String(r.frames),ok:Math.abs(r.frames-t.frames)<=1}),n}function $e(e,t){let n=e.probe?.video,r=t.probe?.video;if(!n||!r)return[];let i=(e.probe?.audio.length??0)>0,a=(t.probe?.audio.length??0)>0,o=n.frames??Math.round((e.probe?.duration??e.duration)*(n.fps??e.fps)),s=r.frames??Math.round((t.probe?.duration??t.duration)*(r.fps??t.fps));return[{label:`Same frame rate`,want:r.fps?A(r.fps):``,got:n.fps?A(n.fps):``,ok:!!n.fps&&!!r.fps&&F(n.fps,r.fps,.05)},{label:`Same frame count`,want:String(s),got:String(o),ok:!!o&&Math.abs(o-s)<=1},{label:`Same duration`,want:`${(t.probe?.duration??t.duration).toFixed(2)} s`,got:`${(e.probe?.duration??e.duration).toFixed(2)} s`,ok:F(e.probe?.duration??e.duration,t.probe?.duration??t.duration,.08)},{label:`Same shape`,want:j(r.width,r.height),got:j(n.width,n.height),ok:j(r.width,r.height)===j(n.width,n.height)},{label:`Same audio`,want:a?`present`:`none`,got:i?`present`:`none`,ok:i===a}]}function et(){let e=P.sources().filter(e=>e.state!==`loading`&&e.fps>0);if(e.length<2)return[];let t=[...new Set(e.map(e=>A(e.fps)))],n=[...new Set(e.map(e=>j(e.width,e.height)))],r=[];return r.push(`${e.length} sources, ${t.length} frame rate${t.length===1?``:`s`} (${t.join(`, `)})`),r.push(`${n.length} frame shape${n.length===1?``:`s`} (${n.join(`, `)})`),r}async function tt(e){let t=new Uint8Array(await e.arrayBuffer()),n=String.fromCharCode(...t.subarray(0,6));if(n!==`GIF89a`&&n!==`GIF87a`)return null;let r=new DataView(t.buffer),i=r.getUint16(6,!0),a=r.getUint16(8,!0),o=13+(t[10]&128?3*2**((t[10]&7)+1):0),s=0,c=0,l=!1,u=()=>{for(;o>>0;var it=class{a=1732584193;b=-271733879;c=-1732584194;d=271733878;tail=new Uint8Array(64);fill=0;total=0;w=new Int32Array(16);update(e){this.total+=e.length;let t=0;if(this.fill){let n=Math.min(64-this.fill,e.length);this.tail.set(e.subarray(0,n),this.fill),this.fill+=n,t=n,this.fill===64&&(this.block(this.tail,0),this.fill=0)}for(;t+64<=e.length;t+=64)this.block(e,t);t>4)*4+(e&3)],l=r+t+rt[e]+n[s]|0,u=i+(l<>>32-c)|0;r=o,o=a,a=i,i=u}this.a=this.a+r|0,this.b=this.b+i|0,this.c=this.c+a|0,this.d=this.d+o|0}hex(){let e=this.total*8,t=new Uint8Array((this.fill<56?56:120)-this.fill+8);t[0]=128;let n=new DataView(t.buffer);n.setUint32(t.length-8,e>>>0,!0),n.setUint32(t.length-4,Math.floor(e/4294967296),!0),this.update(t);let r=new Uint8Array(16),i=new DataView(r.buffer);return i.setInt32(0,this.a,!0),i.setInt32(4,this.b,!0),i.setInt32(8,this.c,!0),i.setInt32(12,this.d,!0),Array.from(r,e=>e.toString(16).padStart(2,`0`)).join(``)}},I=2097152;function at(){return new Promise(e=>window.setTimeout(e,0))}async function L(e,t){let n=new it;for(let r=0;rvoid 0).then(async()=>{let e=await r.frame(t);return n(e,e instanceof HTMLVideoElement?e.videoWidth:e.width,e instanceof HTMLVideoElement?e.videoHeight:e.height)});return ot.set(e.id,i),i}async function st(e,t){return(await fetch(`data:${t};base64,${e}`)).blob()}function ct(){let e=window;return e.INSPECT_MEDIA||={},e.INSPECT_MEDIA}function lt(e){return new Promise((t,n)=>{let r=document.createElement(`script`);r.async=!0,r.src=`media/${e}.js`,r.onload=()=>{r.remove(),t()},r.onerror=()=>{r.remove(),n(Error(`the media pack ${e} did not load`))},document.head.appendChild(r)})}var ut=/^(.*?)(\d+)(\.[A-Za-z0-9]+)$/;function dt(e){let t=new Map;for(let n of e){let e=ut.exec(n.name);if(!e)continue;let r=`${e[1]}|${e[2].length}|${e[3].toLowerCase()}`;t.has(r)||t.set(r,[]),t.get(r)?.push({...n,n:Number(e[2])})}let n=null,r=``;for(let[e,i]of t)(!n||i.length>n.length)&&(n=i,r=e);if(!n||n.length<2)return null;n.sort((e,t)=>e.n-t.n);let[i,a,o]=r.split(`|`),s=new Set(n.map(e=>e.n)),c=n[0].n,l=n[n.length-1].n,u=[];for(let e=c;e<=l;e++)s.has(e)||u.push(e);return{files:n,info:{pattern:`${i}%0${a}d${o}`,first:c,last:l,count:n.length,gaps:u,digits:Number(a),ext:o}}}var ft=0;async function pt(e,t){let n=dt(e);if(!n)throw Error(`these files are not a numbered image sequence`);let r=await Promise.all(n.files.map(e=>createImageBitmap(e.blob))),i=r[0].width,a=r[0].height,o=document.createElement(`canvas`);o.width=i,o.height=a;let s=o.getContext(`2d`),c=r.length/t;return{source:{id:`seq${++ft}`,name:n.info.pattern,kind:`video`,sample:!1,size:n.files.reduce((e,t)=>e+t.blob.size,0),width:i,height:a,fps:t,duration:c,async frame(e){let n=Math.max(0,Math.min(r.length-1,Math.floor(e*t+1e-6)));return s.clearRect(0,0,i,a),s.drawImage(r[n],0,0,i,a),o},audio:()=>Promise.resolve(null),dispose:()=>void 0},info:n.info,names:n.files.map(e=>e.name),width:i,height:a}}var mt=3e4/1001,ht=[{pack:`autumn-stream`,file:`autumn-stream.mp4`,role:`source`,form:`video`,parent:``,label:`Camera original, trimmed`,width:1280,height:720,fps:mt,duration:8.008,frames:240,size:6525912,codec:`H.264`,audio:!0,offset:0,type:`video/mp4`},{pack:`waterfall`,file:`waterfall.mp4`,role:`source`,form:`video`,parent:``,label:`Camera original, trimmed`,width:1280,height:640,fps:24e3/1001,duration:6.006,frames:144,size:2898071,codec:`H.264`,audio:!0,offset:0,type:`video/mp4`},{pack:`river-vertical`,file:`river-vertical.mp4`,role:`source`,form:`video`,parent:``,label:`Phone original, vertical`,width:404,height:720,fps:60,duration:6.15,frames:369,size:1501308,codec:`H.264`,audio:!0,offset:0,type:`video/mp4`},{pack:`clouds-sequence`,file:`clouds_%04d.jpg`,role:`source`,form:`sequence`,parent:``,label:`Numbered stills, 24 fps`,width:960,height:540,fps:24,duration:1.5,frames:36,size:17e5,codec:`JPEG`,audio:!1,offset:0,type:`image/jpeg`},{pack:`autumn-stream_high`,file:`autumn-stream_high.mp4`,role:`output`,form:`video`,parent:`autumn-stream.mp4`,label:`Match Source, high: H.264 3.5 Mb/s`,width:1280,height:720,fps:mt,duration:3.003,frames:90,size:1514869,codec:`H.264`,audio:!0,offset:2.002,type:`video/mp4`},{pack:`autumn-stream_low`,file:`autumn-stream_low.mp4`,role:`output`,form:`video`,parent:`autumn-stream.mp4`,label:`Match Source, low: H.264 0.45 Mb/s`,width:1280,height:720,fps:mt,duration:3.003,frames:90,size:220648,codec:`H.264`,audio:!0,offset:2.002,type:`video/mp4`},{pack:`autumn-stream_Proxy`,file:`autumn-stream_Proxy.mp4`,role:`proxy`,form:`video`,parent:`autumn-stream.mp4`,label:`H.264 Proxy 960x540`,width:960,height:540,fps:mt,duration:8.008,frames:240,size:2922345,codec:`H.264`,audio:!0,offset:0,type:`video/mp4`},{pack:`autumn-stream_480`,file:`autumn-stream_480.gif`,role:`output`,form:`animation`,parent:`autumn-stream.mp4`,label:`Animated GIF 480 px`,width:480,height:270,fps:15,duration:3,frames:45,size:892598,codec:`GIF`,audio:!1,offset:2.002,type:`image/gif`}],gt={markIn:60,markOut:149};function _t(){let e=new Map;for(let t of ht){let n=P.make(t.file,t.role,t.form);n.label=t.label,n.width=t.width,n.height=t.height,n.fps=t.fps,n.duration=t.duration,n.frames=t.frames,n.size=t.size,n.offset=t.offset,n.origin=`included`,t.role!==`source`&&(n.expect={width:t.width,height:t.height,fps:t.fps,duration:t.duration,frames:t.frames,codec:t.codec,audio:t.audio},n.parent=e.get(t.parent)?.id??``),e.set(t.file,n),P.items.push(n)}return e}async function vt(e){return R(e,e.form===`sequence`?e.duration/2:Math.min(e.duration/2,2.5),(e,t,n)=>{let r=document.createElement(`canvas`);return r.width=240,r.height=Math.max(2,Math.round(240*n/t)),r.getContext(`2d`)?.drawImage(e,0,0,r.width,r.height),r.toDataURL(`image/jpeg`,.72)})}async function yt(e,t){await lt(e.pack);let n=ct(),r=e.form===`sequence`?e.pack:e.file,i=n[r];if(delete n[r],!i)throw Error(`the pack ${e.pack} holds no ${e.file}`);if(e.form===`sequence`){let n=await Promise.all(Object.entries(i).map(async([e,t])=>({name:e,blob:await st(t,`image/jpeg`)}))),r=await pt(n,e.fps);t.source=r.source,t.seq=r.info,t.names=r.names,t.size=r.source.size,t.width=r.width,t.height=r.height,t.frames=r.info.count,t.duration=r.info.count/e.fps,t.frameBlobs=n.sort((e,t)=>e.name.localeCompare(t.name)).map(e=>e.blob)}else{let n=await st(i,e.type);if(t.blob=n,t.size=n.size,e.form===`animation`)t.gif=await tt(n),t.url=URL.createObjectURL(n);else{let r=new File([n],e.file,{type:e.type}),i=await Le(r);t.probe=i;let a=i.video?.fps&&Number.isFinite(i.video.fps)?i.video.fps:e.fps;t.source=await Ue(r,a),t.fps=a,t.width=i.video?.width??e.width,t.height=i.video?.height??e.height,t.duration=i.duration??t.source.duration,t.frames=i.video?.frames??Math.round(t.duration*a)}}t.state=`ready`}async function bt(e){if(e.source)try{e.thumb=await vt(e)}catch(t){P.log(`No thumbnail for ${e.name}: ${t.message}`,!0)}}function z(e){if(!e.expect)return;let t=Qe(e),n=P.get(e.parent);e.checks=e.role===`proxy`&&n?.probe?[...t,...$e(e,n)]:t}async function xt(){for(let e of P.items){if(!e.blob&&!e.frameBlobs||e.md5State===`done`)continue;e.md5State=`running`,P.emit(`items`);let t=performance.now();try{e.md5=e.blob?await L(e.blob):await L(new Blob(e.frameBlobs)),e.md5State=`done`,P.log(`MD5 ${e.md5} ${e.name} (${((performance.now()-t)/1e3).toFixed(1)} s)`)}catch(t){e.md5State=`idle`,P.log(`MD5 failed for ${e.name}: ${t.message}`,!0)}P.emit(`items`)}}async function St(){let e=_t();P.emit(`items`);let t=e.get(`autumn-stream.mp4`),n=e.get(`autumn-stream_low.mp4`);P.setSlots(t.id,n.id);let r=[`autumn-stream.mp4`,`autumn-stream_low.mp4`,`autumn-stream_high.mp4`,`waterfall.mp4`,`river-vertical.mp4`,`clouds_%04d.jpg`,`autumn-stream_Proxy.mp4`,`autumn-stream_480.gif`],i=0;for(let n of r){let r=ht.find(e=>e.file===n),a=e.get(n);try{await yt(r,a),i+=1,z(a),P.emit(`items`),a===t&&P.setFrame(gt.markIn+24),bt(a).then(()=>P.emit(`items`)),P.log(`Loaded ${a.name}`)}catch(e){a.state=`failed`,a.message=e.message,P.log(`Could not load ${n}: ${a.message}`,!0),P.emit(`items`)}}for(let e of P.items)e.role===`proxy`&&z(e);P.emit(`items`),i||P.log(`No curated media loaded`,!0),xt()}function B(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,document.body.appendChild(r),r.click(),r.remove(),window.setTimeout(()=>URL.revokeObjectURL(n),4e3)}function Ct(e,t=`image/png`,n){return new Promise((r,i)=>e.toBlob(e=>e?r(e):i(Error(`the canvas could not be saved`)),t,n))}var wt=new Map,Tt=`md5`,Et=!1,Dt=!1,Ot={size:`Size`,md5:`MD5`,bit:`Bit for bit`};function kt(e){return e.blob?e.blob:e.frameBlobs?new Blob(e.frameBlobs):null}async function At(e,t,n){let r=kt(e);if(!r)return;let i={mode:t,srcMd5:``,copyMd5:``,ok:!1,detail:``,progress:0,running:!0,flipped:n};wt.set(e.id,i),P.emit(`items`);let a=new it,o=[],s=Math.floor(r.size*.37);for(let e=0;e=e&&s{i.progress=.5+e*.5,P.emit(`items`)}),i.ok=i.copyMd5===i.srcMd5,i.detail=i.ok?`Copy read back from storage matches`:`${i.srcMd5.slice(0,8)} against ${i.copyMd5.slice(0,8)}`;else{let e=-1;for(let t=0;te.md5).map(e=>`${e.md5} ${e.name}`).join(`
+ `),this.areas=Object.fromEntries(ae.map(e=>[e,this.el.querySelector(`[data-area="${e}"]`)]));for(let e of Array.from(this.el.querySelectorAll(`.fx-split`)))this.bindSplit(e);window.addEventListener(`resize`,()=>this.resized())}register(e,t,n){this.factories.set(e,n),this.titles.set(e,t)}titleOf(e){return this.titles.get(e)??e}panelIds(){return[...this.factories.keys()]}peek(e){return this.made.get(e)}panel(e){let t=this.made.get(e);if(!t){let n=this.factories.get(e);if(!n)return;t=n(),t.el.classList.add(`fx-panel`),t.el.dataset.panel=e,t.el.dataset.automationId=`panel.${e}`,this.made.set(e,t)}return t}bindSplit(e){let t=e.dataset.split;e.addEventListener(`pointerdown`,r=>{r.preventDefault(),e.setPointerCapture(r.pointerId),n(e,`is-dragging`,!0);let i={x:r.clientX,y:r.clientY,l:this.layout.leftW,r:this.layout.rightW,b:this.layout.bottomH},a=e=>{t===`left`&&(this.layout.leftW=Math.max(160,Math.min(900,i.l+e.clientX-i.x))),t===`right`&&(this.layout.rightW=Math.max(160,Math.min(1100,i.r-(e.clientX-i.x)))),t===`bottom`&&(this.layout.bottomH=Math.max(120,Math.min(window.innerHeight-220,i.b-(e.clientY-i.y)))),this.applySizes()},o=()=>{n(e,`is-dragging`,!1),e.removeEventListener(`pointermove`,a),e.removeEventListener(`pointerup`,o),this.save()};e.addEventListener(`pointermove`,a),e.addEventListener(`pointerup`,o)})}applySizes(){let e=this.groups.left.length?this.layout.leftW:0,t=this.groups.right.length?this.layout.rightW:0,r=this.groups.bottom.length?this.layout.bottomH:0;this.el.style.setProperty(`--fx-left`,`${e}px`),this.el.style.setProperty(`--fx-right`,`${t}px`),this.el.style.setProperty(`--fx-bottom`,`${r}px`),n(this.el,`no-left`,!e),n(this.el,`no-right`,!t),n(this.el,`no-bottom`,!r);for(let e of ie){let t=this.groups[e],n=t.reduce((e,t)=>e+t.size,0)||1;for(let e of t)e.el.style.flex=`${e.size/n} 1 0`}this.resized()}resized(){for(let e of this.made.values())e.el.hidden||e.resized?.()}applyLayout(e,t){this.workspace=t,this.layout=structuredClone(e);for(let t of ae){for(let e of this.groups[t]){for(let t of e.panels){let e=this.made.get(t);e&&(e.el.hidden=!0,e.hidden?.())}e.el.remove()}this.groups[t]=[];let n=(t===`float`?e.float:e[t])??[];for(let e of n){let n=new oe(this,t);n.size=e.size??1,e.w!==void 0&&(n.rect={x:e.x??120,y:e.y??90,w:e.w,h:e.h??340}),this.areas[t].appendChild(n.el),this.groups[t].push(n);for(let t of e.panels)this.factories.has(t)&&n.add(t,!1);t===`float`&&!n.panels.length?(n.el.remove(),this.groups[t].pop()):(n.activate(e.active&&e.panels.includes(e.active)?e.active:n.panels[0]),t===`float`&&n.place())}}this.applySizes(),this.onWorkspace?.(t)}load(){let e=`Default`,t=null;try{let n=localStorage.getItem(C);if(n){let r=JSON.parse(n);e=r.workspace||`Default`,t=r.layouts?.[e]??null}}catch{t=null}this.applyLayout(t??S[e]??S.Default,e)}snapshot(){let e={left:[],center:[],right:[],bottom:[],leftW:this.layout.leftW,rightW:this.layout.rightW,bottomH:this.layout.bottomH};for(let t of[`left`,`center`,`right`,`bottom`])e[t]=this.groups[t].map(e=>({panels:[...e.panels],active:e.active,size:e.size}));return e.float=this.groups.float.map(e=>({panels:[...e.panels],active:e.active,...e.rect})),e}save(){try{let e=localStorage.getItem(C),t=e?JSON.parse(e):{};t.workspace=this.workspace,t.layouts={...t.layouts||{},[this.workspace]:this.snapshot()},localStorage.setItem(C,JSON.stringify(t))}catch{return}}savedNames(){try{let e=JSON.parse(localStorage.getItem(C)||`{}`);return Object.keys(e.custom||{})}catch{return[]}}switchTo(e){let t=null;try{let n=JSON.parse(localStorage.getItem(C)||`{}`);t=n.layouts?.[e]??n.custom?.[e]??null}catch{t=null}this.applyLayout(t??S[e]??S.Default,e),this.save()}resetWorkspace(){this.applyLayout(S[this.workspace]??S.Default,this.workspace),this.save()}saveAs(e){try{let t=JSON.parse(localStorage.getItem(C)||`{}`);t.custom={...t.custom||{},[e]:this.snapshot()},localStorage.setItem(C,JSON.stringify(t))}catch{return}this.workspace=e,this.save(),this.onWorkspace?.(e)}find(e){for(let t of ae)for(let n of this.groups[t])if(n.panels.includes(e))return n}home(e){let t=e===`essential`?this.find(`effectsPresets`):void 0;if(t&&t.area!==`float`)return t;let n=e===`composition`?`center`:[`timeline`,`renderQueue`,`terminal`,`agents`,`graph`,`flowchart`].includes(e)?`bottom`:`right`;return this.groups[n][0]??this.groups.right[0]??this.groups.bottom[0]??this.groups.center[0]}show(e){if(!this.factories.has(e))return;let t=this.find(e);if(!t){if(t=this.home(e),!t)return;t.add(e,!0),this.applySizes()}t.activate(e),this.focus(e)}undock(e){let t=this.find(e);if(!t||t.area===`float`)return;let n=this.el.getBoundingClientRect(),r=new oe(this,`float`),i=this.groups.float.length;r.rect={x:Math.max(0,n.width/2-260+i*28),y:Math.max(0,n.height/2-200+i*28),w:520,h:400},this.areas.float.appendChild(r.el),this.groups.float.push(r),r.place(),this.move(e,r),this.focus(e)}redock(e){let t=this.find(e);if(!t||t.area!==`float`)return;let n=this.home(e);n?this.move(e,n):this.close(e)}isVisible(e){let t=this.made.get(e);return!!t&&!t.el.hidden}close(e){let t=this.find(e);t&&(t.remove(e),t.panels.length||(t.el.remove(),this.groups[t.area]=this.groups[t.area].filter(e=>e!==t),this.applySizes()),this.save())}move(e,t){let n=this.find(e);n!==t&&(n?.remove(e),n&&!n.panels.length&&(n.el.remove(),this.groups[n.area]=this.groups[n.area].filter(e=>e!==n)),t.add(e,!0),this.applySizes(),this.save())}raise(e){let t=this.groups.float;e.area===`float`&&t[t.length-1]!==e&&(this.groups.float=[...t.filter(t=>t!==e),e],this.groups.float.forEach((e,t)=>e.el.style.zIndex=String(t+1)))}maximize(e){e.area!==`float`&&(this.maximized===e?(this.maximized=null,n(this.el,`is-maximized`,!1),n(e.el,`is-max`,!1)):(this.maximized&&n(this.maximized.el,`is-max`,!1),this.maximized=e,n(this.el,`is-maximized`,!0),n(e.el,`is-max`,!0)),this.resized())}toggleMaximizeFocused(){let e=this.find(this.focused);e&&this.maximize(e)}focused=`queue`;focus(e){if(!e||this.focused===e)return;let t=this.find(this.focused);t&&n(t.el,`is-focused`,!1),this.focused=e;let r=this.find(e);r&&n(r.el,`is-focused`,!0),this.onFocus?.(e)}},ce={studio:{label:`Studio Dark`,vars:{"--bg-primary":`#111111`,"--bg-secondary":`#17151b`,"--bg-tertiary":`#222127`,"--border-color":`#2a2a2a`,"--border-light":`#34333a`,"--text-primary":`#f7f7f7`,"--text-secondary":`#a4a4a4`,"--text-muted":`#717072`,"--canvas-bg":`#1c1b1d`,"--grid-color":`#5e5e60`,"--bg-node":`#191919`}},"nodemode-dark":{label:`NodeMode Dark`,vars:{"--bg-primary":`#0a0a0a`,"--bg-secondary":`#121218`,"--bg-tertiary":`#1a1a24`,"--border-color":`#2a2a35`,"--border-light":`#3a3a48`,"--text-primary":`#e8e8ee`,"--text-secondary":`#a8a8b8`,"--text-muted":`#6a6a7a`,"--canvas-bg":`#0a0a0a`,"--grid-color":`rgba(255,255,255,0.04)`,"--node-shadow":`0 6px 18px rgba(0,0,0,0.45)`}},light:{label:`Light`,light:!0,vars:{"--bg-primary":`#ecebe6`,"--bg-secondary":`#f7f6f1`,"--bg-tertiary":`#e2e0d8`,"--bg-node":`#f4f3ed`,"--border-color":`#d1cdc1`,"--border-light":`#beb9aa`,"--text-primary":`#26241d`,"--text-secondary":`#4c4a40`,"--text-muted":`#8b887a`,"--canvas-bg":`#e7e5dd`,"--grid-color":`rgba(70,60,30,0.10)`,"--node-shadow":`0 5px 14px rgba(96,90,70,0.15)`}},"github-dark":{label:`GitHub Dark`,vars:{"--bg-primary":`#0d1117`,"--bg-secondary":`#161b22`,"--bg-tertiary":`#21262d`,"--border-color":`#30363d`,"--border-light":`#3d444d`,"--text-primary":`#e6edf3`,"--text-secondary":`#9198a1`,"--text-muted":`#656c76`,"--canvas-bg":`#0d1117`,"--grid-color":`rgba(230,237,243,0.05)`,"--node-shadow":`0 6px 18px rgba(0,0,0,0.5)`}},midnight:{label:`Midnight Blue`,vars:{"--bg-primary":`#0b1020`,"--bg-secondary":`#101830`,"--bg-tertiary":`#182242`,"--border-color":`#25325c`,"--border-light":`#324274`,"--text-primary":`#e4e9f7`,"--text-secondary":`#9fabd0`,"--text-muted":`#63709a`,"--canvas-bg":`#0b1020`,"--grid-color":`rgba(160,180,255,0.06)`,"--node-shadow":`0 8px 22px rgba(0,0,20,0.55)`}},forest:{label:`Forest`,vars:{"--bg-primary":`#0c130e`,"--bg-secondary":`#121c15`,"--bg-tertiary":`#1a281e`,"--border-color":`#2a4030`,"--border-light":`#375441`,"--text-primary":`#e4efe7`,"--text-secondary":`#a4bdac`,"--text-muted":`#6a8674`,"--canvas-bg":`#0c130e`,"--grid-color":`rgba(180,230,190,0.05)`,"--node-shadow":`0 6px 18px rgba(0,10,0,0.5)`}},ember:{label:`Ember`,vars:{"--bg-primary":`#140d0a`,"--bg-secondary":`#1d1310`,"--bg-tertiary":`#2a1c16`,"--border-color":`#452e22`,"--border-light":`#5a3d2e`,"--text-primary":`#f2e8e2`,"--text-secondary":`#c7ab9c`,"--text-muted":`#8f7263`,"--canvas-bg":`#140d0a`,"--grid-color":`rgba(255,200,160,0.05)`,"--node-shadow":`0 6px 18px rgba(20,5,0,0.55)`}},violet:{label:`Violet Haze`,vars:{"--bg-primary":`#100b1c`,"--bg-secondary":`#171129`,"--bg-tertiary":`#221a3c`,"--border-color":`#382c5e`,"--border-light":`#493b78`,"--text-primary":`#ece6f9`,"--text-secondary":`#b3a6d8`,"--text-muted":`#7a6da3`,"--canvas-bg":`#100b1c`,"--grid-color":`rgba(210,190,255,0.06)`,"--node-shadow":`0 8px 22px rgba(10,0,30,0.55)`}},slate:{label:`Slate`,vars:{"--bg-primary":`#101418`,"--bg-secondary":`#171d23`,"--bg-tertiary":`#212a32`,"--border-color":`#32404c`,"--border-light":`#415260`,"--text-primary":`#e7edf2`,"--text-secondary":`#a3b2bf`,"--text-muted":`#6b7a87`,"--canvas-bg":`#101418`,"--grid-color":`rgba(200,220,240,0.05)`,"--node-shadow":`0 6px 18px rgba(0,5,10,0.5)`}},mono:{label:`Mono Ink`,vars:{"--bg-primary":`#0e0e0e`,"--bg-secondary":`#161616`,"--bg-tertiary":`#202020`,"--border-color":`#333333`,"--border-light":`#454545`,"--text-primary":`#f0f0f0`,"--text-secondary":`#ababab`,"--text-muted":`#6e6e6e`,"--canvas-bg":`#0e0e0e`,"--grid-color":`rgba(255,255,255,0.05)`,"--node-shadow":`0 6px 18px rgba(0,0,0,0.5)`}},sand:{label:`Sand (light)`,light:!0,vars:{"--bg-primary":`#efe8da`,"--bg-secondary":`#f8f3e9`,"--bg-tertiary":`#e6dcc8`,"--bg-node":`#f5efe2`,"--border-color":`#d4c7ab`,"--border-light":`#c2b28e`,"--text-primary":`#2a2418`,"--text-secondary":`#59503c`,"--text-muted":`#8d8168`,"--canvas-bg":`#eae2d1`,"--grid-color":`rgba(80,60,10,0.10)`,"--node-shadow":`0 5px 14px rgba(100,80,30,0.16)`}},ocean:{label:`Deep Ocean`,vars:{"--bg-primary":`#06131c`,"--bg-secondary":`#0a1c29`,"--bg-tertiary":`#10293c`,"--border-color":`#1d425e`,"--border-light":`#285578`,"--text-primary":`#e2eef7`,"--text-secondary":`#96b6cc`,"--text-muted":`#5b7d94`,"--canvas-bg":`#06131c`,"--grid-color":`rgba(150,210,255,0.06)`,"--node-shadow":`0 8px 22px rgba(0,10,20,0.6)`}},rose:{label:`Rose Noir`,vars:{"--bg-primary":`#170b10`,"--bg-secondary":`#211117`,"--bg-tertiary":`#301a22`,"--border-color":`#4d2b38`,"--border-light":`#653a49`,"--text-primary":`#f5e7ec`,"--text-secondary":`#cfa5b3`,"--text-muted":`#966b7b`,"--canvas-bg":`#170b10`,"--grid-color":`rgba(255,190,215,0.05)`,"--node-shadow":`0 6px 18px rgba(25,0,10,0.55)`}},terminal:{label:`Terminal Green`,vars:{"--bg-primary":`#050d05`,"--bg-secondary":`#0a140a`,"--bg-tertiary":`#102010`,"--border-color":`#1f3d1f`,"--border-light":`#2b522b`,"--text-primary":`#d8f5d8`,"--text-secondary":`#8fce8f`,"--text-muted":`#568a56`,"--canvas-bg":`#050d05`,"--grid-color":`rgba(120,255,120,0.06)`,"--node-shadow":`0 6px 18px rgba(0,10,0,0.6)`}},contrast:{label:`High Contrast`,vars:{"--bg-primary":`#000000`,"--bg-secondary":`#0a0a0a`,"--bg-tertiary":`#161616`,"--border-color":`#555555`,"--border-light":`#777777`,"--text-primary":`#ffffff`,"--text-secondary":`#d8d8d8`,"--text-muted":`#9a9a9a`,"--canvas-bg":`#000000`,"--grid-color":`rgba(255,255,255,0.10)`,"--node-shadow":`0 0 0 1px #666`}}},le=`studio`,ue=`#f2545b`,de=`formencoder_ui_settings`,fe=e=>typeof e==`number`&&Number.isFinite(e)?Math.min(1.5,Math.max(0,e)):1;function pe(){try{let e=localStorage.getItem(de);if(e){let t=JSON.parse(e);return{theme:t.theme&&ce[t.theme]?t.theme:le,accentColor:t.accentColor||`#f2545b`,intensity:fe(t.intensity)}}}catch(e){console.error(`[theme] read failed:`,e)}return{theme:le,accentColor:ue,intensity:1}}function me(e){try{let t=localStorage.getItem(de),n={...t?JSON.parse(t):{},...e,appearance:1};localStorage.setItem(de,JSON.stringify(n))}catch(e){console.error(`[theme] save failed:`,e)}}function he(e=pe()){let t=document.documentElement,n=ce[e.theme]||ce.studio;for(let[e,r]of Object.entries(n.vars))t.style.setProperty(e,r);document.body.classList.toggle(`theme-light`,!!n.light),t.style.setProperty(`--bg-node`,n.vars[`--bg-node`]||n.vars[`--bg-secondary`]),t.style.setProperty(`--shadow-lg`,n.light?`0 4px 14px rgba(96, 90, 70, 0.16)`:`0 8px 32px rgba(0, 0, 0, 0.5)`),t.style.setProperty(`--accent-color`,e.accentColor),t.style.setProperty(`--accent-color-dim`,e.accentColor+`33`),t.style.setProperty(`--accent-color-hover`,`color-mix(in srgb, ${e.accentColor} 82%, #ffffff)`),t.style.setProperty(`--accent-intensity`,String(fe(e.intensity))),t.style.setProperty(`--accent-tint`,_e(e.accentColor,.06)),t.style.setProperty(`--accent-tint-strong`,_e(e.accentColor,.1))}function ge(e){let t={...pe(),theme:e};me(t),he(t),document.dispatchEvent(new CustomEvent(`nm:ui-settings-changed`,{detail:{key:`theme`}}))}function _e(e,t){let n=e.replace(`#`,``),r=n.length===3?n.split(``).map(e=>e+e).join(``):n,i=parseInt(r.slice(0,6),16);return Number.isNaN(i)?`rgba(171,160,211,${t})`:`rgba(${i>>16&255},${i>>8&255},${i&255},${t})`}var ve=`0.10.0`,ye=new WeakMap;function w(e,t=`info`){let n=document.getElementById(`toast-root`);if(!n)return;let r=t===`error`?6e3:3600,i=`cv-toast${t===`error`?` is-error`:t===`ok`?` is-ok`:``}`,a=Array.from(n.children).find(t=>t.textContent===e&&t.className===i);if(a){window.clearTimeout(ye.get(a)),ye.set(a,window.setTimeout(()=>a.remove(),r));return}let o=s(``);for(o.textContent=e,n.appendChild(o);n.children.length>4;)n.firstElementChild?.remove();ye.set(o,window.setTimeout(()=>o.remove(),r))}var be=new TextDecoder(`latin1`);async function T(e,t,n){let r=await e.slice(t,t+n).arrayBuffer();return new DataView(r)}var E=(e,t)=>be.decode(new Uint8Array(e.buffer,e.byteOffset+t,4)),xe={66:`Baseline`,77:`Main`,88:`Extended`,100:`High`,110:`High 10`,122:`High 4:2:2`,244:`High 4:4:4`},Se={apco:`ProRes 422 Proxy`,apcs:`ProRes 422 LT`,apcn:`ProRes 422`,apch:`ProRes 422 HQ`,ap4h:`ProRes 4444`,ap4x:`ProRes 4444 XQ`},Ce={sowt:`PCM s16le`,twos:`PCM s16be`,in24:`PCM s24`,in32:`PCM s32`,lpcm:`PCM`,fl32:`PCM f32`,fl64:`PCM f64`,raw:`PCM u8`};function we(e,t,n){let r={type:``,timescale:0,duration:0,width:0,height:0,format:``,profile:``,samples:0,stts:0,bytes:0,channels:0,bits:0,rate:0,esObject:0},i=(t,n)=>{let a=t;for(;a+8<=n;){let t=e.getUint32(a),o=E(e,a+4),s=8;if(t===1&&(t=Number(e.getBigUint64(a+8)),s=16),t===0&&(t=n-a),tn)break;let c=a+s,l=a+t;if(o===`mdia`||o===`minf`||o===`stbl`)i(c,l);else if(o===`tkhd`){let t=c+(e.getUint8(c)===1?88:76);r.width=e.getUint32(t)/65536,r.height=e.getUint32(t+4)/65536}else if(o===`mdhd`){let t=e.getUint8(c);r.timescale=e.getUint32(c+(t===1?20:12)),r.duration=t===1?Number(e.getBigUint64(c+24)):e.getUint32(c+16)}else if(o===`hdlr`)r.type=E(e,c+8);else if(o===`stsd`){let t=c+8;if(r.format=E(e,t+4),r.type===`vide`){let n=e.getUint16(t+32),i=e.getUint16(t+34);n&&(r.width=n),i&&(r.height=i);let a=t+86,o=e.getUint32(t);for(;a+8<=t+o;){let t=e.getUint32(a),n=E(e,a+4);if(t<8)break;n===`avcC`&&(r.profile=`${xe[e.getUint8(a+9)]??`profile `+e.getUint8(a+9)} L${(e.getUint8(a+11)/10).toFixed(1)}`),n===`hvcC`&&(r.profile={1:`Main`,2:`Main 10`}[e.getUint8(a+9)&31]??``),a+=t}}else if(r.type===`soun`){r.channels=e.getUint16(t+24),r.bits=e.getUint16(t+26),r.rate=e.getUint16(t+32);let n=e.getUint32(t),i=t+36;for(;i+8<=t+n;){let t=e.getUint32(i),n=E(e,i+4);if(t<8)break;if(n===`esds`){for(let n=i+12;nr.byteLength)break;if(t===`mvhd`){let e=r.getUint8(s+8);a=r.getUint32(s+8+(e===1?20:12)),o=e===1?Number(r.getBigUint64(s+8+24)):r.getUint32(s+8+16)}else if(t===`trak`){let t=we(r,s+8,s+e),n=t.timescale?t.duration/t.timescale:0;if(t.type===`vide`&&!i.video){let e=t.stts&&t.samples?t.samples*t.timescale/t.stts:null;i.video={codec:Te(t.format),profile:t.profile,width:Math.round(t.width),height:Math.round(t.height),fps:e,frames:t.samples||null,bitrate:n&&t.bytes?t.bytes*8/n:null,pixels:``}}else t.type===`soun`&&i.audio.push({codec:Ee(t),sampleRate:t.rate||null,channels:t.channels||null,bitDepth:Ce[t.format]?t.bits:null,bitrate:n&&t.bytes?t.bytes*8/n:null})}s+=e}return i.duration=a?o/a:null,i.duration&&(i.bitrate=e.size*8/i.duration),i}function Oe(e,t,n){let r=e[t];if(r===void 0||r===0)return null;let i=1;for(;!(r&128>>i-1);)i++;if(t+i>e.length)return null;let a=n?r:r&255>>i,o=(r&255>>i)==255>>i;for(let n=1;n{if(!o)return;let e=o.codec===`V_VP9`?`VP9`:o.codec===`V_VP8`?`VP8`:o.codec===`V_AV1`?`AV1`:o.codec===`V_MPEG4/ISO/AVC`?`H.264`:o.codec===`V_MPEGH/ISO/HEVC`?`HEVC`:o.codec;o.type===1&&!r.video&&(r.video={codec:e,profile:``,width:o.w,height:o.h,fps:o.dur?1e9/o.dur:null,frames:null,bitrate:null,pixels:``}),o.type===2&&r.audio.push({codec:o.codec===`A_OPUS`?`Opus`:o.codec===`A_VORBIS`?`Vorbis`:o.codec===`A_AAC`?`AAC`:o.codec===`A_FLAC`?`FLAC`:o.codec,sampleRate:o.rate||null,channels:o.ch||null,bitDepth:o.bits||null,bitrate:null}),o=null},c=(e,t)=>{let r=0;for(let i=0;in===4?t.getFloat32(e):n===8?t.getFloat64(e):0,u=(e,t,d)=>{let f=e;for(;f=0?i={codec:`Opus`,sampleRate:48e3,channels:n[a+9],bitDepth:null,bitrate:null}:o>=0&&(i={codec:`Vorbis`,sampleRate:t.getUint32(o+12,!0),channels:n[o+11],bitDepth:null,bitrate:null});let s=await T(e,Math.max(0,e.size-65536),Math.min(e.size,65536)),c=new Uint8Array(s.buffer),l=null;for(let e=c.length-27;e>=0;e--)if(c[e]===79&&c[e+1]===103&&c[e+2]===103&&c[e+3]===83){l=Number(s.getBigUint64(e+6,!0));break}let u=i.sampleRate??48e3,d=l!==null&&l>0?l/(i.codec===`Opus`?48e3:u):null;return{container:`Ogg`,duration:d,size:e.size,bitrate:d?e.size*8/d:null,video:null,audio:[i],notes:[]}}async function Ne(e){let t=await T(e,0,Math.min(e.size,64));if(t.byteLength<26||E(t,0)!==`fLaC`)return null;let n=t.getUint8(18)<<12|t.getUint8(19)<<4|t.getUint8(20)>>4,r=(t.getUint8(20)>>1&7)+1,i=((t.getUint8(20)&1)<<4|t.getUint8(21)>>4)+1,a=(t.getUint8(21)&15)*2**32+t.getUint32(22),o=n&&a?a/n:null;return{container:`FLAC`,duration:o,size:e.size,bitrate:o?e.size*8/o:null,video:null,audio:[{codec:`FLAC`,sampleRate:n,channels:r,bitDepth:i,bitrate:null}],notes:[]}}var Pe=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320],Fe=[44100,48e3,32e3];async function Ie(e){let t=await T(e,0,Math.min(e.size,65536)),n=0;if(E(t,0).startsWith(`ID3`)&&(n=10+(t.getUint8(6)<<21|t.getUint8(7)<<14|t.getUint8(8)<<7|t.getUint8(9))),n+4>t.byteLength)return null;for(let r=n;r+4>3&3,i=t.getUint8(r+1)>>1&3,a=Pe[t.getUint8(r+2)>>4],o=Fe[t.getUint8(r+2)>>2&3];if(n!==3||i!==1||!a||!o)continue;let s=t.getUint8(r+3)>>6==3?1:2;return{container:`MPEG audio`,duration:(e.size-r)*8/(a*1e3),size:e.size,bitrate:a*1e3,video:null,audio:[{codec:`MP3`,sampleRate:o,channels:s,bitDepth:null,bitrate:a*1e3}],notes:[`duration assumes constant bitrate`]}}return null}async function Le(e){let t=[De,Ae,je,Me,Ne,Ie];for(let n of t)try{let t=await n(e);if(t)return t}catch{continue}return{container:e.type||`unknown`,duration:null,size:e.size,bitrate:null,video:null,audio:[],notes:[`container not recognised, showing what the browser reports`]}}var Re=0,ze=()=>`src${++Re}`,D=48e3;function Be(e,t,n,r=8e3){return new Promise((i,a)=>{let o=window.setTimeout(()=>{l(),a(Error(`timed out waiting for ${t}`))},r),s=()=>{l(),i()},c=()=>{l(),a(Error(`the browser cannot decode this file`))},l=()=>{window.clearTimeout(o),e.removeEventListener(t,s),e.removeEventListener(n,c)};e.addEventListener(t,s),e.addEventListener(n,c)})}async function Ve(e){if(Number.isFinite(e.duration))return e.duration;e.currentTime=1e101,await Be(e,`durationchange`,`error`,4e3).catch(()=>void 0);let t=Number.isFinite(e.duration)?e.duration:0;return e.currentTime=0,t}async function He(e){let t=e.requestVideoFrameCallback?.bind(e);if(!t)return 30;let n=[];return new Promise(r=>{let i=()=>{e.pause(),e.currentTime=0;let t=[];for(let e=1;en[e-1]&&t.push(n[e]-n[e-1]);t.sort((e,t)=>e-t);let i=1/(t.length?t[t.length>>1]:1/30),a=[12,15,23.976,24,25,29.97,30,50,59.94,60].reduce((e,t)=>Math.abs(t-i){n.push(r.mediaTime),n.length>=14?i():t(a)};t(a),e.muted=!0,e.play().catch(()=>i()),window.setTimeout(()=>{n.length<14&&i()},1500)})}async function Ue(e,t){let n=URL.createObjectURL(e),r=document.createElement(`video`);r.muted=!0,r.preload=`auto`,r.playsInline=!0,r.src=n;try{await Be(r,`loadedmetadata`,`error`)}catch(e){throw URL.revokeObjectURL(n),e}let i=await Ve(r),a=r.videoWidth>0&&r.videoHeight>0,o=a?t??await He(r):0;a&&await We(r,0);let s=null;return{id:ze(),name:e.name,kind:a?`video`:`audio`,sample:!1,size:e.size,width:r.videoWidth,height:r.videoHeight,fps:o,duration:i,async frame(e){return await We(r,Math.max(0,Math.min(e,Math.max(0,i-.001)))),r},audio(){return s||=(async()=>{if(e.size>629145600)return null;try{return await new OfflineAudioContext(2,1,D).decodeAudioData(await e.arrayBuffer())}catch{return null}})(),s},dispose(){r.removeAttribute(`src`),r.load(),URL.revokeObjectURL(n)}}}async function We(e,t){if(Math.abs(e.currentTime-t)<1e-4&&e.readyState>=2)return;let n=Be(e,`seeked`,`error`,6e3);e.currentTime=t,await n}function O(e){return e==null||!Number.isFinite(e)?``:e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(0)} KB`:e<1073741824?`${(e/1024/1024).toFixed(1)} MB`:`${(e/1024/1024/1024).toFixed(2)} GB`}function Ge(e){if(e==null||!Number.isFinite(e)||e<0)return`--:--`;let t=Math.round(e),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60;return n?`${n}:${String(r).padStart(2,`0`)}:${String(i).padStart(2,`0`)}`:`${String(r).padStart(2,`0`)}:${String(i).padStart(2,`0`)}`}function k(e){return!e||!Number.isFinite(e)?``:e<60?`${e.toFixed(e<10?2:1)} s`:Ge(e)}function Ke(e){return Math.abs(e-29.97)<.02||Math.abs(e-59.94)<.03}function qe(e,t){let n=Math.max(1,Math.round(t)),r=Ke(t)?Math.round(n/15):0,i=Math.max(0,Math.floor(e));if(r){let e=Math.round(t*600),a=n*60-r,o=Math.floor(i/e),s=i%e;i+=r*9*o+(s>r?r*Math.floor((s-r)/a):0)}let a=i%n,o=Math.floor(i/n),s=e=>String(e).padStart(2,`0`);return`${s(Math.floor(o/3600))}:${s(Math.floor(o/60)%60)}:${s(o%60)}${r?`;`:`:`}${s(a)}`}function A(e){let t=[[23.976,`23.976`],[24,`24`],[25,`25`],[29.97,`29.97`],[30,`30`],[50,`50`],[59.94,`59.94`],[60,`60`]].find(([t])=>Math.abs(t-e)<.02);return t?t[1]:String(Number(e.toFixed(3)))}function j(e,t){if(!e||!t)return``;let n=e/t,r=[[16/9,`16:9`],[2,`2:1`],[9/16,`9:16`],[4/3,`4:3`],[1,`1:1`],[3/4,`3:4`],[21/9,`21:9`]].find(([e])=>Math.abs(e-n)/e<.01);return r?r[1]:n.toFixed(2)}function Je(e,t,n,r){return{id:e,name:t,role:n,form:r,parent:``,origin:`included`,label:``,state:`loading`,progress:0,message:``,blob:null,size:0,source:null,probe:null,gif:null,seq:null,frameBlobs:null,names:[],thumb:``,md5:``,md5State:`idle`,width:0,height:0,fps:0,frames:0,duration:0,offset:0,expect:null,checks:null,url:``}}var M=e=>e.replace(/\.[^.]+$/,``).replace(/_%0\dd$/,``),N=e=>(e.form===`video`||e.form===`sequence`)&&!!e.source&&e.state!==`loading`,P=new class{items=[];slotA=``;slotB=``;view=`compare`;zoom=`fit`;frame=0;markIn=null;markOut=null;working=``;logs=[];listeners=new Map;seq=0;on(e,t){this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e)?.add(t)}emit(e){for(let t of this.listeners.get(e)??[])t()}log(e,t=!1){let n=new Date,r=[n.getHours(),n.getMinutes(),n.getSeconds()].map(e=>String(e).padStart(2,`0`)).join(`:`);this.logs.push({time:r,text:e,error:t}),this.logs.length>400&&this.logs.shift(),this.emit(`log`)}nextId(){return this.seq+=1,`m${this.seq}`}get(e){return this.items.find(t=>t.id===e)}a(){return this.get(this.slotA)}b(){return this.get(this.slotB)}master(){let e=this.a();return e&&e.fps>0?e:this.b()}sources(){return this.items.filter(e=>e.role===`source`)}outputs(){return this.items.filter(e=>e.role!==`source`)}add(e){return this.items.push(e),this.emit(`items`),e}make(e,t,n){return Je(this.nextId(),e,t,n)}setSlots(e,t){(e!==this.slotA||t!==this.slotB)&&(this.slotA=e,this.slotB=t,this.emit(`slots`))}setView(e){e!==this.view&&(this.view=e,this.emit(`view`))}setZoom(e){e!==this.zoom&&(this.zoom=e,this.emit(`view`))}setFrame(e){let t=this.master(),n=t?Math.max(0,t.frames-1):0,r=Math.max(0,Math.min(n,Math.round(e)));r!==this.frame&&(this.frame=r,this.emit(`frame`))}setMarks(e,t){this.markIn=e,this.markOut=t,this.emit(`marks`)}},Ye=e=>e?`${(e/1e6).toFixed(2)} Mb/s`:``;function Xe(e){return e.form===`sequence`?`Image sequence`:e.form===`animation`?`Animated GIF`:e.form===`archive`?`Numbered frames (ZIP)`:e.role===`proxy`?`Video, proxy`:`Video`}function Ze(e,t){let n=[],r=(e,t,r)=>{r&&n.push({key:e,label:t,value:r})};r(`kind`,`Kind`,Xe(e));let i=e.probe;if(e.form===`sequence`&&e.seq)r(`container`,`Container`,`Numbered ${e.seq.ext.slice(1).toUpperCase()} files`),r(`size`,`Size`,O(e.size)),r(`duration`,`Duration`,k(e.duration)),r(`vcodec`,`Video`,e.seq.ext.slice(1).toUpperCase()===`JPG`?`JPEG, intra only`:e.seq.ext.slice(1).toUpperCase()),r(`frame`,`Frame`,`${e.width}x${e.height}`),r(`shape`,`Shape`,j(e.width,e.height)),r(`rate`,`Rate`,`${A(e.fps)} fps (set when added)`),r(`frames`,`Frames`,`${e.seq.count}, ${String(e.seq.first).padStart(e.seq.digits,`0`)} to ${String(e.seq.last).padStart(e.seq.digits,`0`)}${e.seq.gaps.length?`, ${e.seq.gaps.length} missing`:`, no gaps`}`),r(`audio`,`Audio`,`None`);else if(e.form===`animation`&&e.gif)r(`container`,`Container`,`GIF89a`),r(`size`,`Size`,O(e.size)),r(`duration`,`Duration`,k(e.gif.duration)),r(`vcodec`,`Video`,`GIF, 256 colours`),r(`frame`,`Frame`,`${e.gif.width}x${e.gif.height}`),r(`shape`,`Shape`,j(e.gif.width,e.gif.height)),r(`rate`,`Rate`,e.gif.duration?`${A(e.gif.frames/e.gif.duration)} fps`:``),r(`frames`,`Frames`,String(e.gif.frames)),r(`audio`,`Audio`,`None`),r(`loop`,`Loop`,e.gif.loops?`Forever`:`Once`);else if(e.form===`archive`)r(`container`,`Container`,`ZIP, stored`),r(`size`,`Size`,O(e.size)),r(`duration`,`Duration`,k(e.duration)),r(`vcodec`,`Video`,e.seq?.ext.slice(1).toUpperCase()??``),r(`frame`,`Frame`,e.width?`${e.width}x${e.height}`:``),r(`shape`,`Shape`,j(e.width,e.height)),r(`rate`,`Rate`,e.fps?`${A(e.fps)} fps`:``),e.seq&&r(`frames`,`Frames`,`${e.seq.count}, ${String(e.seq.first).padStart(e.seq.digits,`0`)} to ${String(e.seq.last).padStart(e.seq.digits,`0`)}${e.seq.gaps.length?`, ${e.seq.gaps.length} missing`:`, no gaps`}`),r(`audio`,`Audio`,`None`);else if(i){r(`container`,`Container`,i.container),r(`size`,`Size`,O(i.size)),r(`duration`,`Duration`,k(i.duration??e.duration)),r(`bitrate`,`Bit rate`,Ye(i.bitrate)),i.video&&(r(`vcodec`,`Video`,[i.video.codec,i.video.profile].filter(Boolean).join(` `)),r(`frame`,`Frame`,`${i.video.width}x${i.video.height}`),r(`shape`,`Shape`,j(i.video.width,i.video.height)),r(`rate`,`Rate`,i.video.fps?`${A(i.video.fps)} fps`:``),r(`frames`,`Frames`,i.video.frames?String(i.video.frames):``),r(`vbit`,`Video rate`,Ye(i.video.bitrate)));let n=i.audio[0];r(`audio`,`Audio`,n?[n.codec,n.sampleRate?`${n.sampleRate} Hz`:``,n.channels?`${n.channels} ch`:``].filter(Boolean).join(`, `):`None`),r(`loud`,`Loudness`,t)}return r(`md5`,`MD5`,e.md5?`${e.md5.slice(0,12)}...`:e.md5State===`running`?`Reading`:``),n}var F=(e,t,n)=>Math.abs(e-t)<=n;function Qe(e){let t=e.expect,n=[];if(!t)return n;if(e.form===`archive`&&e.seq){let r=e.width===t.width&&e.height===t.height;return n.push({label:`Frame count`,want:String(t.frames),got:String(e.seq.count),ok:e.seq.count===t.frames}),n.push({label:`Numbers`,want:`1 to ${t.frames}`,got:`${e.seq.first} to ${e.seq.last}`,ok:e.seq.first===1&&e.seq.last===t.frames&&e.seq.gaps.length===0}),n.push({label:`Frame size`,want:`${t.width}x${t.height}`,got:`${e.width}x${e.height}`,ok:r}),n}if(e.form===`animation`&&e.gif)return n.push({label:`Frame size`,want:`${t.width}x${t.height}`,got:`${e.gif.width}x${e.gif.height}`,ok:e.gif.width===t.width&&e.gif.height===t.height}),n.push({label:`Frame rate`,want:`${A(t.fps)}`,got:e.gif.duration?`${A(e.gif.frames/e.gif.duration)}`:``,ok:e.gif.duration>0&&F(e.gif.frames/e.gif.duration,t.fps,1.6)}),n.push({label:`Duration`,want:`${t.duration.toFixed(2)} s`,got:`${e.gif.duration.toFixed(2)} s`,ok:F(e.gif.duration,t.duration,Math.max(.1,1/t.fps))}),n;let r=e.probe?.video;if(!r)return n;n.push({label:`Frame size`,want:`${t.width}x${t.height}`,got:`${r.width}x${r.height}`,ok:r.width===t.width&&r.height===t.height}),n.push({label:`Frame rate`,want:A(t.fps),got:r.fps?A(r.fps):``,ok:!!r.fps&&F(r.fps,t.fps,.05)});let i=e.probe?.duration??e.duration;n.push({label:`Duration`,want:`${t.duration.toFixed(2)} s`,got:`${i.toFixed(2)} s`,ok:F(i,t.duration,Math.max(.06,1.5/t.fps))}),n.push({label:`Video codec`,want:t.codec,got:r.codec,ok:r.codec.toLowerCase().replace(/\W/g,``).includes(t.codec.toLowerCase().replace(/\W/g,``))});let a=(e.probe?.audio.length??0)>0;return n.push({label:`Audio`,want:t.audio?`present`:`none`,got:a?`present`:`none`,ok:a===t.audio}),r.frames&&t.frames&&n.push({label:`Frames`,want:String(t.frames),got:String(r.frames),ok:Math.abs(r.frames-t.frames)<=1}),n}function $e(e,t){let n=e.probe?.video,r=t.probe?.video;if(!n||!r)return[];let i=(e.probe?.audio.length??0)>0,a=(t.probe?.audio.length??0)>0,o=n.frames??Math.round((e.probe?.duration??e.duration)*(n.fps??e.fps)),s=r.frames??Math.round((t.probe?.duration??t.duration)*(r.fps??t.fps));return[{label:`Same frame rate`,want:r.fps?A(r.fps):``,got:n.fps?A(n.fps):``,ok:!!n.fps&&!!r.fps&&F(n.fps,r.fps,.05)},{label:`Same frame count`,want:String(s),got:String(o),ok:!!o&&Math.abs(o-s)<=1},{label:`Same duration`,want:`${(t.probe?.duration??t.duration).toFixed(2)} s`,got:`${(e.probe?.duration??e.duration).toFixed(2)} s`,ok:F(e.probe?.duration??e.duration,t.probe?.duration??t.duration,.08)},{label:`Same shape`,want:j(r.width,r.height),got:j(n.width,n.height),ok:j(r.width,r.height)===j(n.width,n.height)},{label:`Same audio`,want:a?`present`:`none`,got:i?`present`:`none`,ok:i===a}]}function et(){let e=P.sources().filter(e=>e.state!==`loading`&&e.fps>0);if(e.length<2)return[];let t=[...new Set(e.map(e=>A(e.fps)))],n=[...new Set(e.map(e=>j(e.width,e.height)))],r=[];return r.push(`${e.length} sources, ${t.length} frame rate${t.length===1?``:`s`} (${t.join(`, `)})`),r.push(`${n.length} frame shape${n.length===1?``:`s`} (${n.join(`, `)})`),r}async function tt(e){let t=new Uint8Array(await e.arrayBuffer()),n=String.fromCharCode(...t.subarray(0,6));if(n!==`GIF89a`&&n!==`GIF87a`)return null;let r=new DataView(t.buffer),i=r.getUint16(6,!0),a=r.getUint16(8,!0),o=13+(t[10]&128?3*2**((t[10]&7)+1):0),s=0,c=0,l=!1,u=()=>{for(;o>>0;var it=class{a=1732584193;b=-271733879;c=-1732584194;d=271733878;tail=new Uint8Array(64);fill=0;total=0;w=new Int32Array(16);update(e){this.total+=e.length;let t=0;if(this.fill){let n=Math.min(64-this.fill,e.length);this.tail.set(e.subarray(0,n),this.fill),this.fill+=n,t=n,this.fill===64&&(this.block(this.tail,0),this.fill=0)}for(;t+64<=e.length;t+=64)this.block(e,t);t>4)*4+(e&3)],l=r+t+rt[e]+n[s]|0,u=i+(l<>>32-c)|0;r=o,o=a,a=i,i=u}this.a=this.a+r|0,this.b=this.b+i|0,this.c=this.c+a|0,this.d=this.d+o|0}hex(){let e=this.total*8,t=new Uint8Array((this.fill<56?56:120)-this.fill+8);t[0]=128;let n=new DataView(t.buffer);n.setUint32(t.length-8,e>>>0,!0),n.setUint32(t.length-4,Math.floor(e/4294967296),!0),this.update(t);let r=new Uint8Array(16),i=new DataView(r.buffer);return i.setInt32(0,this.a,!0),i.setInt32(4,this.b,!0),i.setInt32(8,this.c,!0),i.setInt32(12,this.d,!0),Array.from(r,e=>e.toString(16).padStart(2,`0`)).join(``)}},I=2097152;function at(){return new Promise(e=>window.setTimeout(e,0))}async function L(e,t){let n=new it;for(let r=0;rvoid 0).then(async()=>{let e=await r.frame(t);return n(e,e instanceof HTMLVideoElement?e.videoWidth:e.width,e instanceof HTMLVideoElement?e.videoHeight:e.height)});return ot.set(e.id,i),i}async function st(e,t){return(await fetch(`data:${t};base64,${e}`)).blob()}function ct(){let e=window;return e.INSPECT_MEDIA||={},e.INSPECT_MEDIA}function lt(e){return new Promise((t,n)=>{let r=document.createElement(`script`);r.async=!0,r.src=`media/${e}.js`,r.onload=()=>{r.remove(),t()},r.onerror=()=>{r.remove(),n(Error(`the media pack ${e} did not load`))},document.head.appendChild(r)})}var ut=/^(.*?)(\d+)(\.[A-Za-z0-9]+)$/;function dt(e){let t=new Map;for(let n of e){let e=ut.exec(n.name);if(!e)continue;let r=`${e[1]}|${e[2].length}|${e[3].toLowerCase()}`;t.has(r)||t.set(r,[]),t.get(r)?.push({...n,n:Number(e[2])})}let n=null,r=``;for(let[e,i]of t)(!n||i.length>n.length)&&(n=i,r=e);if(!n||n.length<2)return null;n.sort((e,t)=>e.n-t.n);let[i,a,o]=r.split(`|`),s=new Set(n.map(e=>e.n)),c=n[0].n,l=n[n.length-1].n,u=[];for(let e=c;e<=l;e++)s.has(e)||u.push(e);return{files:n,info:{pattern:`${i}%0${a}d${o}`,first:c,last:l,count:n.length,gaps:u,digits:Number(a),ext:o}}}var ft=0;async function pt(e,t){let n=dt(e);if(!n)throw Error(`these files are not a numbered image sequence`);let r=await Promise.all(n.files.map(e=>createImageBitmap(e.blob))),i=r[0].width,a=r[0].height,o=document.createElement(`canvas`);o.width=i,o.height=a;let s=o.getContext(`2d`),c=r.length/t;return{source:{id:`seq${++ft}`,name:n.info.pattern,kind:`video`,sample:!1,size:n.files.reduce((e,t)=>e+t.blob.size,0),width:i,height:a,fps:t,duration:c,async frame(e){let n=Math.max(0,Math.min(r.length-1,Math.floor(e*t+1e-6)));return s.clearRect(0,0,i,a),s.drawImage(r[n],0,0,i,a),o},audio:()=>Promise.resolve(null),dispose:()=>void 0},info:n.info,names:n.files.map(e=>e.name),width:i,height:a}}var mt=3e4/1001,ht=[{pack:`autumn-stream`,file:`autumn-stream.mp4`,role:`source`,form:`video`,parent:``,label:`Camera original, trimmed`,width:1280,height:720,fps:mt,duration:8.008,frames:240,size:6525912,codec:`H.264`,audio:!0,offset:0,type:`video/mp4`},{pack:`waterfall`,file:`waterfall.mp4`,role:`source`,form:`video`,parent:``,label:`Camera original, trimmed`,width:1280,height:640,fps:24e3/1001,duration:6.006,frames:144,size:2898071,codec:`H.264`,audio:!0,offset:0,type:`video/mp4`},{pack:`river-vertical`,file:`river-vertical.mp4`,role:`source`,form:`video`,parent:``,label:`Phone original, vertical`,width:404,height:720,fps:60,duration:6.15,frames:369,size:1501308,codec:`H.264`,audio:!0,offset:0,type:`video/mp4`},{pack:`clouds-sequence`,file:`clouds_%04d.jpg`,role:`source`,form:`sequence`,parent:``,label:`Numbered stills, 24 fps`,width:960,height:540,fps:24,duration:1.5,frames:36,size:17e5,codec:`JPEG`,audio:!1,offset:0,type:`image/jpeg`},{pack:`autumn-stream_high`,file:`autumn-stream_high.mp4`,role:`output`,form:`video`,parent:`autumn-stream.mp4`,label:`Match Source, high: H.264 3.5 Mb/s`,width:1280,height:720,fps:mt,duration:3.003,frames:90,size:1514869,codec:`H.264`,audio:!0,offset:2.002,type:`video/mp4`},{pack:`autumn-stream_low`,file:`autumn-stream_low.mp4`,role:`output`,form:`video`,parent:`autumn-stream.mp4`,label:`Match Source, low: H.264 0.45 Mb/s`,width:1280,height:720,fps:mt,duration:3.003,frames:90,size:220648,codec:`H.264`,audio:!0,offset:2.002,type:`video/mp4`},{pack:`autumn-stream_Proxy`,file:`autumn-stream_Proxy.mp4`,role:`proxy`,form:`video`,parent:`autumn-stream.mp4`,label:`H.264 Proxy 960x540`,width:960,height:540,fps:mt,duration:8.008,frames:240,size:2922345,codec:`H.264`,audio:!0,offset:0,type:`video/mp4`},{pack:`autumn-stream_480`,file:`autumn-stream_480.gif`,role:`output`,form:`animation`,parent:`autumn-stream.mp4`,label:`Animated GIF 480 px`,width:480,height:270,fps:15,duration:3,frames:45,size:892598,codec:`GIF`,audio:!1,offset:2.002,type:`image/gif`}],gt={markIn:60,markOut:149};function _t(){let e=new Map;for(let t of ht){let n=P.make(t.file,t.role,t.form);n.label=t.label,n.width=t.width,n.height=t.height,n.fps=t.fps,n.duration=t.duration,n.frames=t.frames,n.size=t.size,n.offset=t.offset,n.origin=`included`,t.role!==`source`&&(n.expect={width:t.width,height:t.height,fps:t.fps,duration:t.duration,frames:t.frames,codec:t.codec,audio:t.audio},n.parent=e.get(t.parent)?.id??``),e.set(t.file,n),P.items.push(n)}return e}async function vt(e){return R(e,e.form===`sequence`?e.duration/2:Math.min(e.duration/2,2.5),(e,t,n)=>{let r=document.createElement(`canvas`);return r.width=240,r.height=Math.max(2,Math.round(240*n/t)),r.getContext(`2d`)?.drawImage(e,0,0,r.width,r.height),r.toDataURL(`image/jpeg`,.72)})}async function yt(e,t){await lt(e.pack);let n=ct(),r=e.form===`sequence`?e.pack:e.file,i=n[r];if(delete n[r],!i)throw Error(`the pack ${e.pack} holds no ${e.file}`);if(e.form===`sequence`){let n=await Promise.all(Object.entries(i).map(async([e,t])=>({name:e,blob:await st(t,`image/jpeg`)}))),r=await pt(n,e.fps);t.source=r.source,t.seq=r.info,t.names=r.names,t.size=r.source.size,t.width=r.width,t.height=r.height,t.frames=r.info.count,t.duration=r.info.count/e.fps,t.frameBlobs=n.sort((e,t)=>e.name.localeCompare(t.name)).map(e=>e.blob)}else{let n=await st(i,e.type);if(t.blob=n,t.size=n.size,e.form===`animation`)t.gif=await tt(n),t.url=URL.createObjectURL(n);else{let r=new File([n],e.file,{type:e.type}),i=await Le(r);t.probe=i;let a=i.video?.fps&&Number.isFinite(i.video.fps)?i.video.fps:e.fps;t.source=await Ue(r,a),t.fps=a,t.width=i.video?.width??e.width,t.height=i.video?.height??e.height,t.duration=i.duration??t.source.duration,t.frames=i.video?.frames??Math.round(t.duration*a)}}t.state=`ready`}async function bt(e){if(e.source)try{e.thumb=await vt(e)}catch(t){P.log(`No thumbnail for ${e.name}: ${t.message}`,!0)}}function z(e){if(!e.expect)return;let t=Qe(e),n=P.get(e.parent);e.checks=e.role===`proxy`&&n?.probe?[...t,...$e(e,n)]:t}async function xt(){for(let e of P.items){if(!e.blob&&!e.frameBlobs||e.md5State===`done`)continue;e.md5State=`running`,P.emit(`items`);let t=performance.now();try{e.md5=e.blob?await L(e.blob):await L(new Blob(e.frameBlobs)),e.md5State=`done`,P.log(`MD5 ${e.md5} ${e.name} (${((performance.now()-t)/1e3).toFixed(1)} s)`)}catch(t){e.md5State=`idle`,P.log(`MD5 failed for ${e.name}: ${t.message}`,!0)}P.emit(`items`)}}async function St(){let e=_t();P.emit(`items`);let t=e.get(`autumn-stream.mp4`),n=e.get(`autumn-stream_low.mp4`);P.setSlots(t.id,n.id);let r=[`autumn-stream.mp4`,`autumn-stream_low.mp4`,`autumn-stream_high.mp4`,`waterfall.mp4`,`river-vertical.mp4`,`clouds_%04d.jpg`,`autumn-stream_Proxy.mp4`,`autumn-stream_480.gif`],i=0;for(let n of r){let r=ht.find(e=>e.file===n),a=e.get(n);try{await yt(r,a),i+=1,z(a),P.emit(`items`),a===t&&P.setFrame(gt.markIn+24),bt(a).then(()=>P.emit(`items`)),P.log(`Loaded ${a.name}`)}catch(e){a.state=`failed`,a.message=e.message,P.log(`Could not load ${n}: ${a.message}`,!0),P.emit(`items`)}}for(let e of P.items)e.role===`proxy`&&z(e);P.emit(`items`),i||P.log(`No curated media loaded`,!0),xt()}function B(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,document.body.appendChild(r),r.click(),r.remove(),window.setTimeout(()=>URL.revokeObjectURL(n),4e3)}function Ct(e,t=`image/png`,n){return new Promise((r,i)=>e.toBlob(e=>e?r(e):i(Error(`the canvas could not be saved`)),t,n))}var wt=new Map,Tt=`md5`,Et=!1,Dt=!1,Ot={size:`Size`,md5:`MD5`,bit:`Bit for bit`};function kt(e){return e.blob?e.blob:e.frameBlobs?new Blob(e.frameBlobs):null}async function At(e,t,n){let r=kt(e);if(!r)return;let i={mode:t,srcMd5:``,copyMd5:``,ok:!1,detail:``,progress:0,running:!0,flipped:n};wt.set(e.id,i),P.emit(`items`);let a=new it,o=[],s=Math.floor(r.size*.37);for(let e=0;e=e&&s{i.progress=.5+e*.5,P.emit(`items`)}),i.ok=i.copyMd5===i.srcMd5,i.detail=i.ok?`Copy read back from storage matches`:`${i.srcMd5.slice(0,8)} against ${i.copyMd5.slice(0,8)}`;else{let e=-1;for(let t=0;te.md5).map(e=>`${e.md5} ${e.name}`).join(`
`)+`
`}async function Nt(e){let n=await e.text(),r=[];for(let e of n.split(/\r?\n/)){let t=/^([a-fA-F0-9]{32})\s+\*?(.+?)\s*$/.exec(e);if(!t)continue;let n=P.items.find(e=>e.name===t[2]);n?n.md5?n.md5===t[1].toLowerCase()?r.push([`ok`,t[2],`OK`]):r.push([`bad`,t[2],`FAILED, listed ${t[1].slice(0,8)}, file ${n.md5.slice(0,8)}`]):r.push([`missing`,t[2],`not read yet`]):r.push([`missing`,t[2],`no file of that name is loaded`])}let i=new v(`Check ${e.name}`,560),a=s(``);r.length||a.appendChild(s(`
No MD5 lines were found. Each line is a 32 character hash, two spaces and a file name.
`));for(let[e,n,i]of r){let r=s(`
`);t(c(r,`.ins-report-name`),n),t(c(r,`.ins-report-text`),i),a.appendChild(r)}i.body.appendChild(a);let o=r.filter(e=>e[0]!==`ok`).length;P.log(`Checked ${e.name}: ${r.length-o} of ${r.length} match`,o>0),i.button(`Close`,`primary`,()=>i.close()),i.open()}var Pt=class{id=`checksums`;title=`Ingest and Checksums`;el;list;constructor(){this.el=s(`
diff --git a/docs/PARITY.md b/docs/PARITY.md
index 44c9145..44f57a5 100644
--- a/docs/PARITY.md
+++ b/docs/PARITY.md
@@ -125,7 +125,7 @@ Media Encoder's own documentation backs every row; 33 rows also carry an indepen
## Beyond Media Encoder (not scored)
-- 85. AI agent control (MCP server, agent terminal): formencoder Full (The formencoder MCP server over Streamable HTTP and stdio (21 curated tools plus one tool per engine command, 123 in the full profile, with resources and recipe prompts), every command also runnable as ./formencoder ID --name value, terminals agents open, type into and read in front of the person, consequential actions held for the person's approval unless they turn on full faith, consent per client, the formencoder-harness skill, and an embedded terminal that starts Claude Code, Codex and Cursor already connected. Verified: MCP encode, preview and verify.)
+- 85. AI agent control (MCP server, agent terminal): formencoder Full (The formencoder MCP server over Streamable HTTP and stdio (29 curated tools plus one tool per engine command, 125 in the full profile, with resources and recipe prompts), every command also runnable as ./formencoder ID --name value, terminals agents open, type into and read in front of the person, consequential actions held for the person's approval unless they turn on full faith, consent per client, the formencoder-harness skill, and an embedded terminal that starts Claude Code, Codex and Cursor already connected. Verified: MCP encode, preview and verify.)
## Method
diff --git a/form-functions.json b/form-functions.json
index 3bf084c..23d52b6 100644
--- a/form-functions.json
+++ b/form-functions.json
@@ -2,7 +2,7 @@
"format": "form-functions",
"format_version": 1,
"app": "formencoder",
- "app_version": "0.8.0",
+ "app_version": "0.10.0",
"functions": [
{
"id": "encode",
diff --git a/formencoder b/formencoder
index bea9fa0..ec1edf2 100755
--- a/formencoder
+++ b/formencoder
@@ -36,7 +36,7 @@ usage: ./formencoder [command] [options]
extension ID COMMAND [--args JSON] run a command an extension contributes, in the open window
mcp formencoder over MCP's stdio transport (starts the engine when needed)
- agents install|sync|status set Claude Code, Codex and Cursor up (install), refresh the skill references (sync)
+ agents install|sync|status set Claude Code, Codex, Cursor and Antigravity up (install), refresh the skill references (sync)
counts [--write|--check] lines of code by area (the README's Code size table)
clean [--all] remove build output (--all also venv and node_modules)
help this text
diff --git a/frontend/HASHOUT_LOG.md b/frontend/HASHOUT_LOG.md
index fa36979..90089ad 100644
--- a/frontend/HASHOUT_LOG.md
+++ b/frontend/HASHOUT_LOG.md
@@ -212,3 +212,81 @@ Refers to `ui/demos.ts` `stage`, `backend/app/routers/files.py` `upload` · kind
Refers to `ui/file-dialog.ts` the Save button · kind: fix · logged: v0.8.2 · 2026-11-10
- Save joined the folder and name and then collapsed every run of slashes to one separator, which turned `\\server\share\out` into `\server\share\out`, a folder on the current drive. The name is now joined to the folder with one separator, added only when the folder does not already end with it, and nothing else is rewritten. Checked with `tsc --noEmit`; not run on Windows.
+
+## The page holds the window key (unreleased, after 0.8.4)
+
+Refers to `engine/window-key.ts`, `engine/client.ts` `LOCAL_HEADERS`, `api`, `windowTicket`, `Client.connect`, `panels/terminal.ts` `connect` · kind: fix · logged: unreleased · 2026-11-19
+
+- The engine now refuses changes that do not carry `x-formencoder-window-key` (see `backend/HASHOUT_LOG.md`, "The window key"). `loadWindowKey` takes the key once when `engine/client.ts` loads: the global `__FORMENCODER_WINDOW_KEY` that the desktop shell sets (read, then deleted), else `POST /api/window/key` (development; kept in `sessionStorage` so a reload of the same tab keeps working when the engine answers 409 the second time). The key is written into `LOCAL_HEADERS`, so `api()` and the three raw `fetch` calls in `ext/extensions.ts` that spread `LOCAL_HEADERS` all send it; `api()` waits for it first.
+- Sockets take a one-time ticket: `windowTicket()` asks `POST /api/window/ticket` before each live socket (re)connect and each terminal socket. `Client.connect` and the terminal panel's `connect` became async for that one await; nothing in the DOM changes.
+- Other network calls in `src`: the demo file reads in `ui/demos.ts` are GETs of static files and need nothing.
+- Checked against the Vite dev server (on a spare port, with the engine's CORS origins set to it) in headless Chrome: the page booted to "Engine ready", took the key (in `sessionStorage`, no global left), the engine counted 1 window, the live and terminal sockets opened with tickets (the terminal showed a prompt), `POST /api/fs/mkdir` from the page and `api('/api/agents/workspace')` answered 200, a command and `agents.approvals` over the live socket answered, and every non-GET request but the bootstrap carried the key. After a reload the bootstrap answered 409, the page reused the stored key and the engine again counted 1 window. Not run: the desktop shell (it cannot be built here).
+
+## A reload tries the kept key before it asks again (unreleased, after 0.8.4)
+
+Refers to `engine/window-key.ts` `loadWindowKey`, `keyWorks` · kind: fix · logged: unreleased · 2026-11-19
+
+- In development `loadWindowKey` asked `POST /api/window/key` first and used `sessionStorage` only when that failed. The bootstrap answers once, so every reload after the first got 409 and the engine logged a second claim (`secondWindowClaim`) that no second window had made. It now tries the kept key first, checking it with `POST /api/window/ticket` (the cheapest route that needs the key), and asks the bootstrap only when the kept key is missing or no longer works, as after the engine restarted. The packaged global still comes first.
+- Checked in headless Chrome against the engine from source and the Vite dev server on spare ports: a load and two reloads, each followed by a write from the page (`api('/api/fs/mkdir')`). Before: 3 bootstrap requests (200, 409, 409), `secondWindowClaim` true. After: 1 request (200), `secondWindowClaim` false, all three writes 200.
+
+## A broken seal is told in the Agents panel (unreleased, after 0.8.4)
+
+Refers to `panels/agents.ts` `AgentsPanel` `load`, `styles/base.css` `.fx-agents-seal` · kind: feat · logged: unreleased · 2026-11-19
+
+- When the stored agent choice (the Allow Always list or full faith) was changed outside the app, the engine ignores the edit and reports `consent.sealBroken` in `/api/agents/status`; until now the page showed nothing. The Permissions section of the Agents panel, where the person sees and changes that choice, now has one sentence under the allowed line: "The saved agent permission was changed outside FormEncoder, so it is back to Ask."
+- The sentence is always in the markup with `visibility: hidden`, so its space is reserved from the first paint and showing it moves nothing; `load` toggles only the class `is-shown` on that one node (`setClass`, which writes only on a change). It is read each time the panel is shown, and stays while the engine reports a broken seal: it goes when the person presses Forget all or makes a choice that is sealed again. The cost is one blank line in the section when nothing is wrong.
+- The panel has no i18n table: every string in `src` is English literal, so there is nothing to add per language.
+- Checked in headless Chrome against the engine from source with a stand-in keyring (a file-backed backend in a launcher script outside the repo) and the Vite dev server on spare ports: with the choice intact the node was hidden; after a hand edit of `agents.json` (an entry added, seal left as it was) the status reported `sealBroken` true, and with the Agents tab shown again the node was visible, in the warning colour, with the same box as when hidden and the three section boxes unchanged between shown and hidden. Between the intact and broken states the allowed line itself changes (the list is empty, so its default sentence shows), which moved the sections below it by 16 px; that is the existing behaviour of that line, not of the new node. Forget all hid the node again and the status went back to `sealBroken` false.
+
+## AMOLED Black: the theme profile (unreleased, after 0.8.4)
+
+Refers to `ui/themes.ts` `ThemeProfile`, `THEMES`, `applyTheme` · kind: feat · logged: unreleased · 2026-11-19
+
+- A true-black theme for OLED screens, id `amoled`, label "AMOLED Black", ported from the family reference (FormTxt): `--bg-primary`, `--bg-secondary`, `--bg-node` and `--canvas-bg` are `#000000`, `--bg-tertiary` is `#141414` (inputs, menus and selected rows use it as their only fill), `--border-color` `#262626`, `--border-light` `#3a3a3a`, text `#ededed`, `#a6a6a6`, `#858585` (17.9, 8.6 and 5.7 to 1 on black), `--grid-color` `#262626`. The accent is formencoder's own. This app's token names match the formvis system, so no mapping was needed. That makes sixteen profiles; the older "fifteen" in this log and in the demo READMEs counted before it.
+- `ThemeProfile` gains `oled?: boolean`; `applyTheme` sets `data-oled` on `html` for an oled profile and removes it for every other, touching the attribute only when it changes. CSS hangs its exceptions on `data-oled`, not on the id. The theme picker (`ui/prefs.ts`) builds its chips from `THEMES`, so it lists the profile with no new control.
+- Not changed: `applyTheme` has never updated the inline `html` background the pre-paint script sets, so after a live switch `html` keeps the first theme's colour behind `body`; `body` covers the whole window, so nothing shows, and it is the same for every theme.
+
+## AMOLED Black: the pre-paint script (unreleased, after 0.8.4)
+
+Refers to `index.html` inline script `OLED`, `PROFILES` · kind: feat · logged: unreleased · 2026-11-19
+
+- The inline script is a second copy of the profile table, so the `amoled` row is there too, with an `OLED = { 'amoled': 1 }` table that sets `data-oled` beside the variables before the first paint. A theme in one table and not the other would paint Studio Dark first and then switch. The script already sets the `html` background to the profile's `--bg-primary`, so no extra critical style was needed: the first frame of a cold load with `amoled` saved is black.
+
+## AMOLED Black: the tokens and the surfaces that were not black (unreleased, after 0.8.4)
+
+Refers to `styles/tokens.css` `:root[data-oled]`, `styles/base.css` `.cv-titlebar`, `.cv-scrim`, `styles/fe.css` `.fe-w-item`, `.fe-enc-row`, `.fe-f-app`, `.fe-fx`, `.fe-pub`, `.fe-demo-card`, `.fe-es-summary` · kind: feat · logged: unreleased · 2026-11-19
+
+- `:root[data-oled]` sets `--bg-hover` to 10% white and `--border-soft` to 12% white (the usual 6% and 8% are too close to black to read) and `--line-0` to `--border-color`: `--line-0` is the colour of every pane outline and divider and is a mix of the background with black, which is black on a black theme, so the panes lost their edges. `--line-0` is used only for borders. `--surface-1` is not remapped globally: it is also the hover fill of rows and tabs, which would vanish.
+- Found by measuring, in headless Chrome on the Default workspace with a source in the queue (every element over 12,000 px2 with a non-black fill or a background image) and with Export Settings open: the title bar (a gradient from `--surface-2` to `--surface-1`, `#090909` at the bottom), the Form Family app cards, the cards that the Queue (Watch rows), Encoding rows, Effects and Publish use (`--surface-1`), the Export Settings summary box (`#090909`, no border, so it keeps a 1px inset line in `--border-color`), and the modal scrim (a purple-black at 45%, which made the dimmed frame `#040306`). Each now has a `data-oled` rule using `--bg-primary` or black. The queue list, the Preset Browser, the Log, Media Info, the Export Settings preview and its dialog were already `#000000`.
+- Left as they are by design: the `#141414` fields and menus, tab pills (`--surface-raised`), the selected row tint (accent at 10%), small thumbnails (`.fe-m-thumb`, `#090909`, 34 by 24 px) and the accent.
+- Checked: headless Chrome 1440 by 900, 4x CPU throttle (`Emulation.setCPUThrottlingRate`), 150 ms and 1.6 Mbit/s network, cache off, engine from source and Vite dev server on spare ports. Cold load and hard reload with `amoled` saved, about 150 screenshots each, 5 sample points (inset 14 px from the corners, and the centre) on each of the window, title bar, status bar, the four dock areas, queue, preset browser and log or encoding pane: every sample is `#000000` until the app is revealed at about 9.5 s (8.5 s for one sample); after that the only non-black samples are content (logo, tab pill, text, an icon, one error toast that appeared at 8.5 s in the bottom right corner; its cause was not looked into). Live switch Studio Dark to AMOLED Black and back: 717 elements before and after, none added or removed (MutationObserver), none moved (bounding boxes), `data-oled` set and removed.
+- Not checked: hover and press contrast in a screenshot, the Settings picker in a screenshot, a running encode's live preview, the desktop app, a real OLED screen.
+
+## The Terminal panel is the family's shared dock, module 2.1.0 (unreleased, after 0.9.0)
+
+- `src/dock/` is the family's module, 15 files copied byte for byte from FormVis at 8bbdf61b. Nothing in it is edited here, ever; `./formencoder agents sync` fails, naming the file, when a file differs from `MANIFEST.json`, is missing, is extra, or imports from outside the folder. This app never writes that manifest.
+- `src/dock-adapter.ts` is the one place that knows both sides. It exports `TerminalPanel`, still the framework panel with id `terminal`, so the Window menu, the palette, the Agent button's menu, the `ui` tool's `panel: terminal` and saved workspaces keep working. The panel's element is a plain host (`.fe-dock-host`) with the module's root mounted in it once.
+- Placement is the module's `hosted` mode: where the panel is, how big it is and whether it is shown stay the framework's (`ui/dock.ts`), per workspace, as before. The module keeps no layout of its own, writes nothing to `localStorage` and puts no `data-ft-dock*` attribute on ``; its grip, side button and hide button are not shown. So there is no storage key to pick and none to move, and the pre-paint script reserves nothing for it: the whole app stays hidden until the layout is applied, which is the reservation here. The panel's `shown()` and `hidden()` call `dock.shown()` and `dock.hidden()`.
+- No chord. The app had none for the terminal, and closing a panel makes the framework forget its group, so a chord that hides and shows would move the panel on every second press. `isDockChord` returns false; Ctrl+J in a shell is a line feed as before and Cmd+J does nothing. `passKey` is absent: the app received no key while the person typed in the old terminal, and receives none now.
+- Tabs: shells (plain, no agent access), Claude Code, Codex and Cursor each as a tab of its own started by the engine (`POST /api/terminal/tabs`), and read-only tabs for terminals an outside agent opened (kind `agent` from `/api/terminal/sessions`; the live `terminals` event calls `dock.sync()`). No Chat: the engine has none, so `chat` is left out and the module shows no Chat button. The ask line stays and opens Claude Code with what was typed.
+- The channel buys a ticket, then opens `WS /api/terminal/ws?session=..&typed=1`: text frames are output, binary frames are control. `hello` is passed on as an empty write so the module knows the engine answered; `restart` clears the screen; `exit` strikes the tab through.
+- The permission question is the module's dialog (`