Files
effectcraft/docs/control-protocol.md
T
Valentin Klein 7e7118f1a5 Overwriting a render no longer freezes the app on projects with many footage files (#3330)
* #3328: output guard checks file identity only where an alias is possible

The output guard opened every footage file of the project, for every check
of an output that existed, on the UI thread: minutes for long sequences on
a network share. It now compares only the files that can be the output
(folders on the output's volume, folders holding symbolic links), keeps the
identities it learnt in the session (folders that changed are looked at
again; Reload Footage forgets them), and does no file system call while its
lock is held.

render.frame checks and writes with one guard. A control request whose
sender stopped waiting is not run, and one tick runs control requests for at
most a tenth of a second; the rest follow in order on the next ticks.

* #3328: output guard compares paths only, no file is opened

Comparing file identities still cost a file open per footage frame when
folders were on the output's volume, and caching them invited races (#3330
review). The guard now compares paths by name once resolved: absolute, dot
segments resolved, one separator, Windows verbatim prefixes as the plain
path, without case on Windows and macOS. A link or hard link to footage
under another name is no longer recognised; the reported data loss (#1743)
is the same-path case. Render queue duplicate outputs compare by name too.

* #3328: drop the link identity tests of the render queue; test and doc review fixes

* #3328: a mapped network drive and its UNC path are one place

On Windows the output guard resolves each drive letter's root once per guard
(std::fs::canonicalize of `X:\`) and compares a path on that letter as the
place it resolves to: a mapped network drive as its \server\share path, a
subst drive as its folder. A root that can't be resolved keeps its letter.

* #3328: drive roots are looked up only where they can matter, and kept a minute

A drive letter's root is resolved only when the output and the protected
files are not all on one letter, or not all UNC paths: footage and output on
one mapped drive never wait for a disconnected drive or an empty removable
one. Resolved roots, failures too, are kept process-wide for 60 s.

* #3328: the 13,000-frame guard test counts file system lookups instead of timing them

* #3328: note why only Windows counts lookups in the 13,000-frame guard test

* #3328: queued outputs collide under drive and UNC spellings

* #3328: queued sequences and subst drives compare by the place they name

* #3328: queued outputs keep their resolved places instead of resolving per comparison

* #3328: cache_bench's play request carries the abandoned flag (main's example met the new ControlRequest field)

* Refuse an output in a folder linked to a source's folder

An output whose name matches no protected file now has its folder resolved on disk, once per folder per guard, and is compared again by name. An output in render-alias/, a symbolic link or junction to plates/, no longer replaces plates/source.exr. No protected file is looked at.

* Resolve both folders, and only for a source with the output's file name

The footage path as imported may itself run through a link (macOS /var is /private/var, Windows 8.3 names), so resolving only the output's folder missed it. Now an output whose path matches nothing is compared again only with sources of the same file name, both folders resolved once per guard. An output named like no source asks the file system nothing.
2026-11-28 08:25:14 +01:00

295 lines
24 KiB
Markdown

# Control protocol
The desktop app exposes a control channel for agents, tests and the MCP bridge:
```sh
effectcraft --control 9877 # or EFFECTCRAFT_CONTROL_PORT=9877
```
The port must be a number from 1 to 65535, and `--control` overrides the variable. A bad port or an
unknown option prints an error and the app exits with status 1 before it opens a window.
An app started with a control port is meant to be driven by an agent, so a normal launch does not
wait for a person: the window opens without taking keyboard focus, and the app skips crash recovery,
the Home screen (unless `--home` is given) and the startup update check. Help ▸ Check for Updates
still works. One exception: when the window cannot start at all, the app writes the error to
standard error and the session log and then shows it in a message box, and it exits only after
someone closes that box.
- **Transport:** TCP on `127.0.0.1` only, one JSON object per line in each direction. Connections are
persistent; requests on one connection are answered in order.
- **Request:** `{"id": 1, "method": "engine.execute", "params": {...}}` (`id` is echoed back, `params`
defaults to `{}`).
- **Reply:** `{"id": 1, "ok": true, "result": ...}` or `{"id": 1, "ok": false, "error": "message"}`.
- Requests run on the UI thread between frames. Input methods (`ui.click`, `ui.key` and similar)
reply after the synthetic input has been processed. Methods that need an element that isn't drawn
yet are retried for a few frames. A request times out after 60 s; one that hasn't begun by then
is not run. Requests run until a tenth of a second has passed in one frame, and the rest wait
for the next frames in their order, so the window keeps drawing.
- **Only requests are read:** every line must be a JSON object with a string `method` (blank lines are
skipped). Anything else (text that isn't JSON, a JSON array or number, an object without `method`,
invalid UTF-8, a line longer than 4 MiB) gets one error reply ending in "closing the connection", and
the server closes the connection, so nothing sent after it runs. An HTTP request (for example a web
page's cross-origin `fetch` to `127.0.0.1:<port>`) therefore can't smuggle a command in its body: its
request line is rejected first. At most 16 connections are served at once; further ones get an error
line and are closed. The port has no authentication, so only enable it while you use it.
Quick test:
```sh
printf '{"id":1,"method":"engine.execute","params":{"command":"comp.new","params":{"name":"A"}}}\n' | nc 127.0.0.1 9877
```
## Engine
| Method | Params | Result |
|---|---|---|
| `engine.execute` | `{command, params?}` | The command's result. Every engine command (`effectcraft-cli commands`) runs exactly as it does headless, so it never opens a dialog: `comp.new {}` creates a default comp. UI-only ids (`tool.*`, `view.*`, `window.*`, `playback.*`, `timeline.*`, `app.*`) fall through to the menu dispatcher. Unknown top-level params are rejected, and the error lists the accepted keys. |
| `ui.menu.invoke` | `{id, params?}` | Like a menu click: commands with empty params may open their dialog (New Composition, Solid Settings, file pickers). |
| Copy a Media Browser source path | `ui.menu.invoke {id: "mediaBrowser.copySourcePath", params: {path}}` | Copies the exact non-empty path string to the clipboard and returns `{path}`. Supports file/folder paths and virtual source identifiers. Missing, empty or non-string paths return an error. |
| UI commands (via either) | | `timeline.column {column, visible?}` (av, keys, label, num, comment, switches, modes, parent, in, out, duration, stretch), `timeline.sourceName {value?}`, `timeline.search {query}`, `timeline.reveal.<kind>` / `timeline.revealAdd.<kind>` (the property shortcuts and Shift+shortcut: position, scale, rotation, opacity, anchor, effects, masks, feather, levels, animated, and the double-press sets maskPath, maskOpacity, timeRemap, expressions, material, paint, selected, missingEffects, waveform), `timeline.keyAt.<anchor\|position\|scale\|rotation\|opacity>` (Alt+Shift+A/P/S/R/T), `timeline.twirlSelected` ``(Ctrl/Cmd+`)``, `timeline.collapseAll`, `flowchart.options {layers?, effects?, solids?, direction?: lr\|tb, comp?}`, `flowchart.graph {comp?}` → `{nodes, edges}`, `window.workspace {name}` (all After Effects workspaces). |
| `engine.commands` | `{filter?, enabledOnly?}` | `[{id, label, menu, shortcut, params, enabled, why}]` |
| `ui.menu.list` | `{}` | The menu tree with enablement. |
| `render.frame` | `{comp?, time?, max_side?, path?, base64?, write?}` | Renders a comp frame through the session, independent of the viewer zoom or resolution. `comp` is an id or name (default: the active comp), `time` is in comp seconds (default: the CTI), `max_side` caps the longest side (0 = full size). Writes a PNG to `path` (default: a temp file) and returns `{comp, time, width, height, path}`. With `base64: true` it returns `{…, png: "<base64>"}` and writes no file unless `write: true` also requests a guarded write in the same app operation. |
Useful query commands for `engine.execute` (they aren't journaled or undoable): `project.summary`,
`comp.info {comp?}`, `layer.tree {layer, comp?, depth?, time?}` (every node has a `path`),
`prop.get {layer, path, comp?, time?}` (a popup (enum) property also lists its `options`, `[{value, label}]`, as `layer.tree` does), `editor.state`, `command.list {filter?, enabledOnly?, schemas?}`,
`command.describe {command}` (params doc and JSON Schema), `app.capabilities` (version, counts,
export formats, parity summary), `jobs.list` (Progress panel jobs, e.g. the background
`footage.check` after File ▸ Open).
Every engine command is reachable through `engine.execute`, and every interactive widget of every
panel registers an element id; both are enforced by `crates/ui-egui/tests/it/ui_agent_audit.rs`.
### Waiting for a render
On native desktop builds, `engine.execute` with `renderQueue.render` and `wait: true`
(the default) keeps the window responsive while its reply waits for the render worker.
`script.run` invoked through the control channel also yields the window while
`app.project.renderQueue.render()` waits. JavaScript resumes after completion or cancellation;
the original request receives its result and accumulated output only after the continuation
finishes or shows a modal dialog. Several renders in one script keep the same request pending.
Headless scripts retain their synchronous behavior.
While a script waits for rendering, the window shows progress and a **Stop Render** button
(`scriptRender.stop`). Other editing and script callbacks pause so they cannot enter the
suspended script's undo group. `ui.inspect`, `ui.elements`, command/menu listings, resize,
focus, and the engine commands `renderQueue.list`, `renderQueue.stop`, `editor.state`,
`app.capabilities`, `command.list`, `scriptui.list` and `scriptui.get` remain available.
Other control requests return an error. Use another connection for inspection or Stop,
since requests on one connection are answered in order. A window-close request is canceled
during this wait; stop the render and then close normally to use the unsaved-changes prompt.
The control transport's 60-second request timeout still applies to long renders.
## UI state
| Method | Params | Result |
|---|---|---|
| `ui.inspect` | `{}` | Window size, pixels per point, fps, serialized `UiState`, playback, time, active comp, selection, open dialog, last render ms, `keyboardFocus`, `windowFocused`, `workspaceStorageError`. |
| `ui.elements` | `{prefix?}` | `[{id, label, rect: [x, y, w, h]}]`: the widgets drawn in the last frame, in points. |
| `ui.set` | `{tool?, workspace?, theme?, focused?, viewer?, effectControlsLocked?, timeline?, menuBar?, home?}` | `viewer: {zoom (null = fit), res: Full\|Half\|Third\|Quarter\|Auto, pan: [x,y], grid, rulers, safeMargins, transparencyGrid}`; `effectControlsLocked: true` locks Effect Controls on the layer it shows (an error when it shows none, or while it is locked to a layer of another composition), `false` unlocks it (the tab's lock icon, `panel.tab.EffectControls.lock`; `ui.inspect` reports it as `effect_controls_lock: {comp, layer}`); `timeline: {pps (null = fit), start, graphEditor, showModes, openLayers: [ids], openGroups: [uids]}`. |
| `ui.panel.show` / `ui.panel.close` | `{panel}` | Panels: `Project`, `Composition`, `Timeline`, `EffectControls`, `EffectsPresets`, `Info`, `Preview`, `Character`, `Paragraph`, `Align` and others. |
| `ui.playback` | `{action: play\|stop\|toggle\|status}` | `{playing, time, audio, levelsDb, peaksDb}` (audio: an audio preview is running; L/R meter levels and held peaks in dBFS) |
| `ui.resize` | `{width, height}` | Resizes the window (points). |
| `ui.focus` | `{}` | Activates the window and takes keyboard focus. Agents normally avoid this, because the app is started without stealing focus. |
| `app.quit` | `{force?}` | Closes the app. A modified project shows the Save / Don't Save / Cancel prompt first (automation ids `dialog.unsaved.save`, `dialog.unsaved.dontSave`, `dialog.unsaved.cancel`) unless `force: true`. |
`keyboardFocus` is `null` when no egui widget has keyboard focus. Otherwise it contains the
actual widget `id` (hexadecimal), its `rect: [x, y, w, h]` when available, an `automationId`
when the widget registered its response identity, and `registryCandidates` containing exact
rectangle matches. Candidates alone do not establish widget identity. Header, toolbar and
dock-tab controls register their response identity. `ui.focused` continues to identify the
focused panel; it is separate from keyboard widget focus. `windowFocused` reports the native
window focus received by egui, which can differ from the retained widget focus.
When a configuration store is available, current dock and floating geometry, focused and
maximized panels, and named workspace snapshots persist in `workspaces.json`. The current
layout and named snapshots are independent: changing a divider does not overwrite the named
snapshot until `window.saveWorkspace` runs. Changes save after pointer release, at most once
per second, with a final save on normal exit. Version 1 files are limited to 1 MiB and bounded
workspace trees; extra viewer IDs must be between 1 and 65,535. Native reads enforce the size
limit while reading and report I/O and UTF-8
errors. Unreadable, invalid or newer files leave the default workspace available and are
preserved for the entire session, including after later layout changes. Load and save errors
appear in the status message and the nullable
`workspaceStorageError` field; a failed write remains eligible for retry.
`window.saveWorkspace`, `window.saveWorkspaceAs` and `window.editWorkspaces` (rename, delete)
write the file immediately. Through `ui.menu.invoke` they return an error when it isn't written
(a failed write, a file preserved after a failed load, or no configuration store);
`engine.execute` hands them to the UI and returns `{frontend}` first, so check
`workspaceStorageError` there. The changed workspaces still apply for the session, and a later
save retries them.
## Input
Points are logical window coordinates. A target is `{id}` (the element's centre; add `fx`/`fy` between
0 and 1 to pick a spot inside it) or `{x, y}`. `modifiers` is `{shift, alt, command, ctrl}`, where
`command` is ⌘ on macOS and Ctrl elsewhere.
| Method | Params |
|---|---|
| `ui.click` | `{id \| x,y, button?: left\|right\|middle, count?, modifiers?}` |
| `ui.move` | `{id \| x,y}` |
| `ui.drag` | `{from: target, to: target, steps? (12), modifiers?}`: press, move, release |
| `ui.scroll` | `{id \| x,y, dx?, dy?, unit?: point\|line, source?: wheel\|trackpad, pinch?, modifiers?}`: `line` is a mouse wheel (zooms the viewers); `point` (default) is a pixel-precise scroll; `source: trackpad` pans the viewers (as on macOS); with no `source` the viewers take a scroll in points as a wheel until one moves on both axes (a trackpad: from then on it pans); `pinch` is a trackpad pinch's zoom factor |
| `ui.key` | `{key}`, for example `Space`, `F9`, `Cmd+Z`, `Cmd+Shift+Z`, `PageDown`, `Escape` |
| `ui.type` | `{text}`: text input into the focused field |
Shortcut presets also accept `Physical+<shortcut>` for a keyboard position, using egui's
US-position names (for example `Physical+6` and `Physical+Minus` distinguish AZERTY's
`-` and `)` keys). Physical bindings take precedence over logical bindings for that key
press. `ui.key` accepts the same notation to test them. Ordinary shortcuts remain layout-aware.
`time.workAreaStart` and `time.workAreaEnd` navigate to the first and last included work-area
frames and can be assigned through `shortcuts.set`.
## Locating things
| Method | Params | Result |
|---|---|---|
| `ui.viewer.locate` | `{x, y}` (comp pixels) | `{x, y}` window point |
| `ui.viewer.hit` | `{id \| x,y}` (window point) | `{x, y}` comp pixel |
| `ui.timeline.locate` | `{layer (id), time?}` | `{x, y}` window point on the layer bar |
## Screenshots
| Method | Params | Result |
|---|---|---|
| `ui.screenshot` | `{path?, panel?, id?}` | `{path, width, height}`: a PNG of the window, or cropped to one panel or element. The panel or element rectangle is resolved when the capture is issued (after the UI settles), so it follows a panel that moved; a panel or id that is not on screen is retried and then reported, never replaced by a whole-window shot. |
Element ids are stable, for example `tools.Selection`, `panel.Timeline`, `panel.tab.EffectControls`,
`panel.tab.Viewer(<n>)` and `viewers.<n>` (View ▸ New Viewer's other Composition viewers;
`viewers.0` is the Composition panel while another viewer is active), `header.workspace.Animation`, `project.item.<id>` (a double-click opens the item, Enter
renames it), `viewer.comp`, `viewer.handle.<layer>.<i>`,
`timeline.layer.<id>.bar`, `timeline.layer.<id>.nestedMarker.<i>` (a precomp's comp markers), `timeline.layer.<id>.twirl`, `timeline.layer.<id>.row` (click selects,
Enter or a double-click renames, drag reorders), `timeline.prop.<uid>.stopwatch`,
`timeline.key.<uid>.<frame>` (and `timeline.keyAt.<uid>.<ticks>`, exact in layer-time ticks, for
keys on subframes), `timeline.cti`, `effectControls.prop.<uid>.value` (an angle's
revolutions are `timeline.prop.<uid>.revolutions`, `effectControls.prop.<uid>.revolutions` and
`properties.prop.<uid>.revolutions`) and `effects.item.<name>`. The Composition viewer adds `viewer.magnification`, `viewer.resolution`,
`viewer.roi`, `viewer.grid`, `viewer.channel`, `viewer.exposure`, `viewer.snapshot`,
`viewer.showSnapshot`, `viewer.fastPreviews` (their popup entries are `viewer.<menu>Item.<n>`),
`viewer.ruler.top|left|origin`, `viewer.mask.<uid>.vertex.<i>`, `viewer.shapePath.<uid>.vertex.<i>`,
`viewer.motionPath.<layer>.<key>[.in|.out]`, `viewer.puppetPin.<uid>[.rotate|.scale]`,
`viewer.freeTransform.handle.<i>`, `viewer.cryptoPick` (the Cryptomatte eyedropper's hover chip; its
label is the chip's text), `viewer.cryptoPick.error` (the chip when it shows an error; label `whole`, or
`cut` when the message is cut off), `viewer.cryptoPick.highlight` (the hovered ID's highlighted area),
`viewer.cryptoSelect` (the Selection tool picking Cryptomatte IDs over the layer while its Cryptomatte
effect is selected in Effect Controls, no eyedropper armed; label: the Selection's name) and
`viewer.regionOfInterest`; the Graph Editor adds `timeline.graph.transformBox[.<i>]`,
`timeline.graph.snap` and `timeline.graph.reference`. Use `ui.elements` to see what is on screen.
Viewer state that agents drive headless too: `view.snapping`, `view.snappingOptions
{edgesExtended?, collapsedFeatures?, toggle?}` (the Tools bar's Snapping options,
`header.snappingOptions`: After Effects' Snap Edges Extended and Snap to Features in Collapsed
Compositions and Text Layers), `view.channel {channel, colorized?}`,
`view.exposure {stops | delta}`, `view.resetExposure`, `view.takeSnapshot`, `view.showSnapshot`,
`view.fastPreviewMode {mode}` (one mode each, for shortcuts:
`view.fastPreviews.off|adaptive|draft|fastDraft|wireframe`, and for the channels
`view.channel.red|green|blue|alpha|redColorized|greenColorized|blueColorized|rgbStraight`), `view.res.full|half|third|quarter|auto {comp?}` and
`view.res.custom {factor, comp?}` (the comp's Resolution, saved with the project but no undo
step; `ui.set {viewer: {res}}` sets the active comp's, and `ui.inspect` reports it as
`ui.viewer.res`), `view.setRegionOfInterest {rect}`, `view.addGuide {percent?}`,
`view.addPercentGuide`, `view.convertGuides {to: percent|pixels, index?}`,
`view.moveGuide` (comp pixels, whatever the guide's unit), `view.removeGuide`, `effect.setLabel {layer?, effect, label}`; editing: `shape.newPath` (Pen on shape layers),
`shape.newShape` (the shape tools: a new group in the selected shape layer, else a new shape layer),
`shape.toolOptions` (the Tools bar's Tool Creates Shape / Mask and Fill and Stroke Options),
`mask.insertVertex`, `mask.convertVertex`, `mask.deleteVertices`, `path.freeTransform` (masks and
shape paths by uid), `keys.setSpatialTangents` (motion-path handles) and `keys.transform` (Graph
Editor transform box, timeline Alt-drag scaling).
Camera tools: the Tools bar's Orbit, Pan and Dolly slots hold After Effects' variants
(`tools.Orbit|OrbitScene|OrbitTarget`, `tools.PanCamera|PanTarget`,
`tools.Dolly|DollyToCursor|DollyTarget`; flyout rows `tools.select.<tool>`). `tool.orbit`,
`tool.panCamera` and `tool.dolly` (1, 2, 3) select the variant the slot last showed, `tool.camera`
(C) cycles the three slots, and `tool.<tool>` (e.g. `tool.OrbitScene`) selects one directly. A drag
runs `camera.orbit` / `camera.pan` / `camera.dolly` with the tool's `mode` and the press point as
`cursor`; the result's `pivot` is the world point used, sent back as `point` for the rest of the drag
(null when the tool works about the camera's point of interest: the POI variants, and `camera.dolly`
without `mode`).
The MCP server's bridge mode (`effectcraft-cli mcp --bridge 9877`) is a thin client of this protocol;
see [agents.md](agents.md).
Keyframe command times (`prop.set`, `prop.addKey`, `keys.set`, `keys.select`) default to layer
seconds. Set `timeBase: "comp"` for comp seconds; `keys.set.newTime` and every
`keys.select.keys[].time` use the same input base. Omitted `prop.set` or `prop.addKey` times use
the target comp's CTI. Supplied write times snap to its nearest comp frame before conversion
to stored layer time, including on stretched or reversed layers. Existing `keys.set` neighbor
constraints and roving adjustment can change the final stored time.
Explicit bases add `layerTime` and `compTime` to unsplit `prop.set` and `prop.addKey` replies,
alongside `value` or `count`. Separated Position `prop.set` keeps an array of per-axis replies.
Explicit `keys.select` replies contain `count` and `keys[]`, with timing on each key in the
resulting selection. Key metadata's `time` remains layer seconds regardless of the input base.
Without `timeBase`, these three commands retain their existing JSON value/count replies,
including outside the layer's `[in, out)` range. Timing metadata carries outside-range warnings;
`keys.set` and `prop.get.keys[]` report both bases and warnings without an explicit base too.
`prop.get.time` is comp seconds. For these commands, `path` or `prop` identifies a property, not a group.
Set a layer's offset with `layer.timing {layer, start}` (comp seconds).
Panels dock in craft-ui's shared docking (`craft_ui::docking`): split frames, tab groups,
stacked panels and floating windows. Every change, by pointer, menu or command, is one
transaction that checks the whole result; an invalid one returns an error and leaves the layout
unchanged. No move or float may leave the docked area empty; closing its last panel is allowed.
Panels name themselves by id (`"EffectControls"`), by title (`"Effect Controls"`) where a command
takes a name, or as `{"Viewer":42}` and `{"ScriptPanel":77}` for viewers and ScriptUI panels.
- `window.dockAction {action}` applies one craft-ui `Action` in its JSON form. For example,
`{"action":{"ResizeSplit":{"path":[],"size":{"FixedFirst":360}}}}` resizes the root split
(path entries are `false` for the first child and `true` for the second), and
`{"action":{"MoveFloating":{"panel":"Info","rect":[45,65,420,320]}}}` moves and resizes the
floating window holding Info. `Open` and `OpenAt` are refused: panels open through the panel
commands (`window.panel`, `ui.panel.show`), which run the viewer and ScriptUI lifecycles.
Closing runs them too. Pointer gestures dispatch through this command.
- The panel commands `window.panel.move {panel, anchor, zone?, before?, group?}`,
`.float {panel, x?, y?, width?, height?, group?, column?}`,
`.dock {panel, anchor?, zone?, before?, group?, column?, side?}`, `.activate`, `.close`,
`.closeGroup`, `.closeOthers`, `.minimize {minimized?}`, `.iconic {iconic?}`,
`.window {native?}` (as `window.panelWindow`) and `.layout {action}`. `window.panel.<Panel>`
(`window.panel.Align`) opens and shows that panel. `window.panel.activate` on a closed panel
reopens it where it was.
- `ui.dock {operation, panel, …}` or `ui.dock {action}`: the operations
(`open`, `close`, `activate`, `float {rect}`, `moveFloating {rect}`,
`move {target, zone?, before?}`, `setStackOpen {open}`, `resizeStack {height}`,
`resizeSplit {path, size}`; `rect` is `[x, y, width, height]`). It returns
`{"docking": workspace}`. `ui.dock.reset` returns the current workspace to its saved or
built-in layout and returns the same. Raw `Open` and `OpenAt` actions are refused in both
`ui.dock {action}` and `window.panel.layout {action}`, as in `window.dockAction`; use the
panel open commands instead.
- `window.dockPanel {panel, anchor?, zone?, before?}` docks as `window.panel.dock`: `zone` is
`center`, `tab`, `left`, `right`, `top`, `bottom`, `above` or `below`; without an anchor a
side zone docks along that edge of the whole workspace. `window.floatPanel {panel, rect?}`
requires exactly four finite numbers when `rect` is given and otherwise floats a 420x320
window in the middle of the app window. `window.closePanel {panel}` closes it.
- `window.panelWindow {panel, window?}` puts a panel in a floating window of its own with a
desktop place over the panel's place in the main window, and returns `{"window": bool}`. A
docked panel floats first. `window` false docks it again, as a tab of the first docked group;
without `window` it toggles.
On desktop every floating window is an OS window of its own (craft-ui's `native-windows`), which
can go on another monitor; on Wayland, on the web and where egui embeds viewports, floating
windows stay in the main window. Keys pressed in a floating window that none of its widgets uses
run the main window's shortcuts, and files dropped on one import as on the main window. While a
modal dialog is open, floating windows take no input.
The automation ids of the docking chrome are `panel.tab.<Panel>`, `panel.tab.Timeline.<comp>`
(the Timeline's comp tabs), `panel.drag.<Panel>` (a group's drag bar), `panel.menu.<Panel>` (≡),
`panel.tab.<Panel>.lock` (viewer lock), `panel.float.<n>.move`, `.resize` and `.resize.<Edge>`
for floating window `n`, `dock.gutter.<path>` for split dividers (`a`/`b` per split level),
`dock.gutter.group.<Panel>` below a dock column's group and `dock.column.<Panel>` at a dock
column's inner edge. The other parts (a tab's close button, "Close <tab>", and the tab
overflow button, "More tabs") are found by their accessible names.
Saved workspaces (`workspaces.json`, version 2) hold craft-ui `Workspace`s: the layout, the
closed panels with where each goes back, the lock, and each floating window's desktop place. A
version 1 file (EffectCraft 0.10 and earlier) and the older unversioned record of
named workspaces load with every panel in place: the current layout, the named workspaces,
floating windows and their native window places. A column of stacked frames becomes tab groups
split top to bottom: each open frame keeps all its tabs and its height (as a fixed size), and a
closed frame's tabs join the open frame above it. A native window's place moves from the OS
window's outer position to its content's, by the main window's title bar, before the first save.
Panels that were closed stay closed and reopen at their default place. The first save writes version 2 and keeps
the earlier file as `workspaces.old.json`. A damaged, unknown or newer file loads as the default
layout and is left unchanged.