mirror of
https://github.com/storytold/AniCraft.git
synced 2026-11-25 20:10:47 +01:00
Merge outside PR #216: feat(control): live control port and MCP bridge (ADR 0104) (M8)
# Conflicts: # CHANGELOG.md # docs/roadmap.md # src/main.rs
This commit is contained in:
commit
6f1adc4ea2
17 files changed
+1303
-20
No files matched your search
@@ -0,0 +1,99 @@
|
||||
# ADR 0104: A live control port, so assistants edit the open window
|
||||
|
||||
* Status: accepted (2026-11-12)
|
||||
* Relates to: ADR 0004 (destructive actions), ADR 0005 (typography), ADR 0006 (platforms),
|
||||
ADR 0040 (interface languages), `docs/mcp.md`, `docs/control-protocol.md`
|
||||
|
||||
## Context
|
||||
|
||||
`anicraft-cli mcp` gives AI assistants the engine's commands as five MCP tools, but it edits a
|
||||
document inside its own process, with no window. To see the result the person saves, then opens
|
||||
the file in the app. Every edit is invisible until then, and the assistant and the person can
|
||||
never work on the same document at once.
|
||||
|
||||
The sister apps (VectorCraft, CadCraft, FilmCraft, EffectCraft) already let an assistant drive the
|
||||
open window through a TCP port on `127.0.0.1`, with a line-per-message JSON protocol and an MCP
|
||||
"bridge" that forwards to it. AniCraft should behave the same way.
|
||||
|
||||
One lesson from FilmCraft: its token was an environment variable, which a desktop shortcut's
|
||||
process received and an MCP server started by the assistant's desktop app did not. Authentication
|
||||
must not depend on an environment variable reaching two unrelated processes.
|
||||
|
||||
## Decision
|
||||
|
||||
1. **`anicraft --control <port>`** (also `ANICRAFT_CONTROL_PORT`; the flag wins) opens a control
|
||||
port on `127.0.0.1` only. 9878 is the convention (after EffectCraft's 9877). A bad port is an
|
||||
error before any window opens. If the port can't be opened (in use), the window opens anyway
|
||||
and the status bar says why.
|
||||
2. **The protocol is small** (`docs/control-protocol.md`): one JSON object per line each way,
|
||||
persistent connections, answered in order. Methods: `hello`, `tools.list`, `tools.call`.
|
||||
Replies are `{"id", "ok": true, "result"}` or `{"id", "ok": false, "error"}`.
|
||||
3. **One dispatcher for live and headless.** The app depends on the `anicraft-cli` library and
|
||||
runs its `mcp::call_tool` and `mcp::tools` on the window's session. `call_tool` is generic over
|
||||
a small `Host` trait (the session, and how a command runs), so the app runs commands through
|
||||
its own follow-up (`App::announce`: the status line, the view a new document resets, Open
|
||||
Recent), as for the person's own edits.
|
||||
|
||||
*Considered:* a new crate for the dispatcher, used by both. It would have to be L4 (it needs
|
||||
the engine and the renderer), and the CLI (L4) may not depend on a crate in its own layer, so
|
||||
the CLI would have to move up beside the shell. The shell (L5) depending on the CLI library
|
||||
(L4) fits the layering as it is, adds no crate, and the CLI library has no dependency the shell
|
||||
doesn't already have (except `getrandom`, below). The CLI's library already was the MCP server;
|
||||
it now also holds the control port's protocol, its listener threads and the bridge client
|
||||
(`crates/cli/src/control.rs`), none of which touches the UI toolkit, so they are tested there.
|
||||
4. **Threads, and the frame.** One listener thread and one thread per connection (at most 16). A
|
||||
tool call goes to the UI thread through a channel with a reply sender; the connection thread
|
||||
wakes the window (`request_repaint`). The frame loop runs waiting calls at the start of the
|
||||
frame, before anything draws, so their edits show in the same frame (AGENTS.md "edits are
|
||||
live"). The window never takes focus. An edit made behind the start screen (ADR 0059)
|
||||
closes it, so the person sees the document change.
|
||||
5. **The person's own gestures.** An edit from a tool must not join the person's undo step. While
|
||||
the person is dragging (pointer held, a stage drag, or a plug-in dialog previewing), calls that
|
||||
can change the document wait (calls that only read don't). A call that waited 60 s is refused
|
||||
without running, and the client is told so. An open gesture that is only typing (a property
|
||||
field still focused) is committed first, as its own undo step, as clicking elsewhere would do;
|
||||
waiting for that could block an assistant indefinitely.
|
||||
|
||||
*Considered:* committing the gesture mid-drag. The rest of the drag would then record one undo
|
||||
step per frame, so we wait instead.
|
||||
6. **Authentication: a token file, no setup.** Each run with `--control` makes a fresh 32-byte
|
||||
token from the operating system's random numbers (`getrandom`, MIT OR Apache-2.0, already in
|
||||
the tree) and writes `control.json` (`port`, `token`, `pid`, `version`) to the AniCraft settings
|
||||
folder, owner-only on macOS and Linux (`%APPDATA%` is already private on Windows). It is
|
||||
replaced at start and removed on exit if it still holds this run's token. Every request carries
|
||||
the token; a missing or wrong token is refused and the connection closed before anything runs.
|
||||
`ANICRAFT_CONTROL_TOKEN`, when set, is the token on both sides (CI, power users).
|
||||
|
||||
The CLI can't use the shell's `platform::config_dir`, so it has its own copy of the folder rule
|
||||
(`control::settings_dir`) and a shell test keeps the two equal.
|
||||
|
||||
*Considered:* no authentication (VectorCraft, CadCraft, EffectCraft). Any local process, and a
|
||||
web page able to reach localhost, could then edit and save files as the person. *Considered:*
|
||||
an environment-variable token only (FilmCraft): see Context.
|
||||
7. **Hardening, as in the sister apps.** Every line must be a JSON object with a string `method`;
|
||||
anything else gets one error line and the connection closes. That also refuses a web page's
|
||||
`fetch` to localhost, which starts with an HTTP request line. Lines are capped at 4 MiB. Writes
|
||||
time out after 10 s so a client that stops reading can't hold a thread.
|
||||
8. **Safety rules unchanged.** Calls run through `Session::execute`, so `"confirm": true` (ADR 0004)
|
||||
is needed exactly as headless, unsaved-work guards and crash recovery see the edits as the
|
||||
person's, and every edit undoes with Ctrl+Z.
|
||||
9. **`anicraft-cli mcp --bridge <port | 127.0.0.1:port>`** is the MCP server with a backend that
|
||||
forwards `tools/call` to the app; `initialize` and `tools/list` are answered locally (the same
|
||||
tool list), so the server starts and lists its tools before AniCraft is open. It connects on
|
||||
the first call and returns an error that says how to start the app when it can't. It reconnects
|
||||
after a break (an app that quit is noticed before the next request is sent). An edit whose reply
|
||||
was lost is never sent again (the app may have made it); a call that only reads is tried once
|
||||
more. Hosts other than this computer are refused.
|
||||
10. **Visible.** While the port is open the status bar says "Remote control on (port N)" (through
|
||||
`tr!` and `theme::Type`), with a tooltip saying what that means.
|
||||
|
||||
## Consequences
|
||||
|
||||
* The shell now builds the CLI library (small; nothing new for the web build, which leaves the
|
||||
control port out).
|
||||
* The tool behaviour can't drift between live and headless: one function serves both, and a test
|
||||
checks that a call through the port answers as `call_tool` does.
|
||||
* Remote edits arrive at most once per frame batch; a long `anicraft_run_script` blocks the window
|
||||
while it runs, as a long menu command would.
|
||||
* Not yet: a screenshot tool that returns the window itself (the app already captures itself for
|
||||
`--screenshot`).
|
||||
@@ -0,0 +1,103 @@
|
||||
# The live control port
|
||||
|
||||
`anicraft --control <port>` opens the AniCraft window as usual and also listens on a port on this
|
||||
computer, so an assistant (or a script) can edit the open document while you watch. Every edit
|
||||
appears in the window at once and undoes with Ctrl+Z, like your own. The status bar says
|
||||
"Remote control on (port N)" while it is open. ADR 0104 records the design.
|
||||
|
||||
Most people never speak this protocol themselves: AI assistants reach it through
|
||||
`anicraft-cli mcp --bridge <port>` (see `docs/mcp.md`).
|
||||
|
||||
```sh
|
||||
anicraft --control 9878 # 9878 by convention
|
||||
ANICRAFT_CONTROL_PORT=9878 anicraft # the same; --control wins over the variable
|
||||
```
|
||||
|
||||
## Transport
|
||||
|
||||
* TCP on `127.0.0.1` only.
|
||||
* One JSON object per line (UTF-8, `\n`; a `\r` before it is ignored), each way.
|
||||
* Connections stay open; requests on one connection are answered in order.
|
||||
|
||||
## Authentication
|
||||
|
||||
Each run makes a fresh token: 64 hex digits from the operating system's random numbers. The app
|
||||
writes it to `control.json` in AniCraft's settings folder:
|
||||
|
||||
| System | File |
|
||||
|---|---|
|
||||
| Windows | `%APPDATA%\AniCraft\control.json` |
|
||||
| macOS | `~/Library/Application Support/AniCraft/control.json` |
|
||||
| Linux | `$XDG_CONFIG_HOME/anicraft/control.json` (default `~/.config/anicraft/`) |
|
||||
|
||||
```json
|
||||
{"port": 9878, "token": "3f1c…", "pid": 12345, "version": "0.2.1"}
|
||||
```
|
||||
|
||||
On macOS and Linux the file is readable only by you; on Windows the settings folder already is.
|
||||
It is replaced when AniCraft starts with `--control` and removed when it closes. A program running
|
||||
as you finds the token there, with nothing to copy into its settings.
|
||||
|
||||
If `ANICRAFT_CONTROL_TOKEN` is set, it is the token instead (set it for both the app and the
|
||||
client: CI, power users).
|
||||
|
||||
Every request carries `"token"`. A missing or wrong token gets an error and the connection
|
||||
closes before anything runs.
|
||||
|
||||
## Requests and replies
|
||||
|
||||
```json
|
||||
{"id": 1, "token": "…", "method": "hello"}
|
||||
{"id": 1, "ok": true, "result": {"app": "AniCraft", "version": "0.2.1", "protocol": 1}}
|
||||
```
|
||||
|
||||
`id` is any JSON value and comes back as it was. A reply is `{"id", "ok": true, "result"}` or
|
||||
`{"id", "ok": false, "error": "message"}`.
|
||||
|
||||
| Method | Params | Result |
|
||||
|---|---|---|
|
||||
| `hello` | | `{app, version, protocol}` |
|
||||
| `tools.list` | | the tools, exactly as MCP `tools/list` lists them (`docs/mcp.md`) |
|
||||
| `tools.call` | `{name, arguments}` | exactly what MCP `tools/call` returns: `{content: […], isError}` |
|
||||
|
||||
`tools.call` runs the same code as the headless MCP server. A tool that fails (a command's error)
|
||||
is a result with `"isError": true`; a malformed call (an unknown tool, a missing `name`) is an
|
||||
`"ok": false` reply.
|
||||
|
||||
```json
|
||||
{"id": 2, "token": "…", "method": "tools.call", "params": {"name": "anicraft_run", "arguments": {"command": "draw.rect", "params": {"x": 10, "y": 10, "w": 50, "h": 50}}}}
|
||||
{"id": 2, "ok": true, "result": {"content": [{"type": "text", "text": "{\"frame\": 0, \"result\": {…}, \"revision\": 3, \"scene\": 0}"}], "isError": false}}
|
||||
```
|
||||
|
||||
## When calls run
|
||||
|
||||
The window runs calls at the start of a frame, so an edit shows in that frame. It never takes
|
||||
keyboard focus and doesn't need to be the front window. An edit made while the start screen is showing closes it, so you see
|
||||
the document it changed.
|
||||
|
||||
While you are dragging (or a plug-in dialog is previewing), calls that could change the document
|
||||
wait until you let go, so your drag and the assistant's edit stay separate undo steps. Calls that
|
||||
only read run at once. If you were typing in a field, your change is kept as its own undo step
|
||||
first. A call that waited 60 seconds is not run, and its reply says so.
|
||||
|
||||
Commands that would lose work or replace a file still need `"confirm": true` (ADR 0004).
|
||||
|
||||
## Limits
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| Line length | 4 MiB; a longer line gets an error and the connection closes |
|
||||
| Connections | 16 at once; another gets an error line and is closed |
|
||||
| Waiting | 60 s per call |
|
||||
| First line | must be a JSON object with a string `"method"`, or the connection closes (this also refuses a web page's request to localhost) |
|
||||
|
||||
## Trying it by hand
|
||||
|
||||
With AniCraft open with `--control 9878`, in PowerShell:
|
||||
|
||||
```powershell
|
||||
$t = (Get-Content "$env:APPDATA\AniCraft\control.json" | ConvertFrom-Json).token
|
||||
$c = New-Object Net.Sockets.TcpClient 127.0.0.1, 9878
|
||||
$w = New-Object IO.StreamWriter $c.GetStream(); $r = New-Object IO.StreamReader $c.GetStream()
|
||||
$w.WriteLine("{""id"":1,""token"":""$t"",""method"":""hello""}"); $w.Flush(); $r.ReadLine()
|
||||
```
|
||||
+30
@@ -8,8 +8,22 @@ look at frames and export through the same commands the app uses.
|
||||
anicraft-cli mcp # a new, empty document
|
||||
anicraft-cli mcp scene.anicraft # open a document
|
||||
anicraft-cli mcp --sample # the sample animation
|
||||
anicraft-cli mcp --bridge 9878 # the AniCraft window you have open (below)
|
||||
```
|
||||
|
||||
## Headless or live
|
||||
|
||||
Without `--bridge` the server edits a document of its own, with no window: good for pipelines and
|
||||
batch work. Save it (`file.save`) to keep the result.
|
||||
|
||||
With `--bridge <port>` the same tools act on the AniCraft window you have open, started with
|
||||
`anicraft --control <port>`: every edit appears there at once, and Ctrl+Z undoes it
|
||||
(`docs/control-protocol.md`, ADR 0104). The server starts even when AniCraft isn't open (an
|
||||
assistant starts its servers when it starts) and connects on the first tool call; until AniCraft is
|
||||
open with remote control, the tools answer with how to start it. Close and reopen AniCraft whenever
|
||||
you like: the next call reconnects, with no need to restart the assistant. It finds the run's token
|
||||
in `control.json` in AniCraft's settings folder, so there is nothing to copy.
|
||||
|
||||
The server talks MCP's stdio transport: JSON-RPC 2.0, one message per line on stdin and stdout.
|
||||
It speaks protocol revisions 2025-06-18, 2025-03-26 and 2024-11-05.
|
||||
|
||||
@@ -28,6 +42,19 @@ Most clients take a server entry like this one (use the full path to `anicraft-c
|
||||
}
|
||||
```
|
||||
|
||||
For live editing, start AniCraft with `--control 9878` (a desktop shortcut is handy) and use:
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"anicraft": {
|
||||
"command": "C:\\path\\to\\anicraft-cli.exe",
|
||||
"args": ["mcp", "--bridge", "9878"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Tools
|
||||
|
||||
| Tool | What it does |
|
||||
@@ -59,3 +86,6 @@ unlike `anicraft_run_script` a failing step leaves the document as it was. `macr
|
||||
save, import, export), as with the CLI. Only connect clients you trust with those files.
|
||||
* A failing command comes back as a tool result marked as an error, so the assistant can read
|
||||
the message and try again; it never stops the server.
|
||||
* Live (`--bridge`): an edit whose answer was lost (AniCraft closed mid-call) is never sent again,
|
||||
since it may have been made; the assistant is told to check with `anicraft_document`. While you
|
||||
are dragging, the assistant's edits wait until you let go, so the two stay separate undo steps.
|
||||
+1
-1
@@ -18,7 +18,7 @@ This integration depends on craft-libs #1962 and still requires hosted parity va
|
||||
| Drawing | Selection (click, shift-add, marquee, drag-move, arrow nudge; **across layers**, ADR 0044: a selection holds artwork on several visible, unlocked layers, the timeline marks them, Properties shows mixed values), **Free Transform (Q)**: scale from corner/edge handles (Shift proportional, Alt from centre), rotate outside corners (Shift snaps 15°), move; one undo step per drag. Rectangle (corner radius), oval, PolyStar, line (45° snap), hand, zoom. **Pen (P)**: click for corners, drag for smooth handles (Alt breaks them), close on the first point, Enter/Esc/last-point click finishes, Backspace takes back a point; one undo step per path. **Pencil (Shift+Y)**: Smooth (Schneider curve fitting with corner detection), Straighten and Ink modes, smoothing relative to the screen. **Subselection (A)**: anchors and handles on selected shapes, drag points/handles (anchors bring their handles; one undo step per drag), point marquee, double-click an edge to add a point, Delete removes points, right-click Make Smooth/Corner; closed shapes' start point and closing edge edit like any other. **Cut/Copy/Paste in Center/Paste in Place** (the clipboard carries symbols across documents). **Rotate 90° CW/CCW, Flip H/V. Align** left/centre/right/top/middle/bottom (Ctrl+Alt+1…6; a single element aligns to the stage) and distribute. Convert to symbol / break apart; arrange; duplicate. Headless: `draw.path`, `draw.freehand`, `path.move_points/add_point/delete_points/convert_point`. **Paint Bucket (K)**: click a fill to recolour it, or inside an outline (one shape or several) to fill the enclosed area; gap size None/Small/Medium/Large closes openings; the fill is traced and curve-fitted into a new shape placed under its lines; open areas say so instead of flooding. **Ink Bottle (S)**: gives the clicked shape the current stroke. Headless: `paint.bucket`, `paint.ink`. Tool options show first in Properties while a drawing tool is active. **Text (T)** (ADR 0012): click to type on the stage, click or double-click text to edit it; font (installed families, plus the embedded Inter), size, colour, under or over the artwork, snap accuracy up to Always); Snap to Pixels; one snap engine for every drawing tool, the Selection tool's moves and Free Transform's handles (point › guide › line › grid › pixel, guides and grid per axis); stage only, never exported, on the CPU and GPU stage. Headless: `view.rulers`, `view.grid_show/grid_snap/grid_set`, `view.guides_show/guides_lock/guides_snap/guides_set`, `view.guide_add/guide_move/guide_delete/guides_clear`, `view.snap_pixels`, `view.aids`, `moving` on `draw.snap`. *Not yet:* units other than px, a movable ruler origin, a symbol's own guides, guides and grid from Animate files, Snap Align and Edit Snapping, snapping while rotating. bold, italic, alignment, letter/line spacing, wrap width; the last style is kept for new text; laid out by `anicraft-text` (`fontdb` discovery, `harfrust` shaping, `skrifa` outlines) and stored as outlines with the source, so rendering never needs the font; Break Apart makes a shape. **Variable-width strokes** (ADR 0018): a stroke's width varies along it through width points (position by arc length, a width on each side as a factor of the stroke width, smooth monotone interpolation); built-in profiles (Uniform, Taper both ends, Taper start, Taper end, Bulge, Pinch) in Properties › Width with a picture of each, and in the drawing tools' options for new strokes; the **Width tool (U)**: hover a stroke to see its width points, drag a handle to widen or narrow (Alt: one side), drag the dot to slide a point, drag anywhere on the stroke to add one, Delete removes; one undo step per drag; rendered by the oracle as trapezoids with outer round joins and cross-section caps, written by SVG and Lottie export as the same filled outlines; shape tweens blend profiles; `.anicraft` keeps them (older files open as uniform). Headless: `stroke.set_profile`, `stroke.set_width_point`, `stroke.delete_width_point`, `stroke.width_at`, `profile` on `element.set_stroke`, the drawing commands and `paint.ink`. Not yet: width data from or to Animate files, saved custom profiles, pressure. **Stroke styles** (ADR 0046): Properties › Style (Solid, Dashed with dash and gap, Dotted with spacing), Cap (None, Round, Square), Join (Miter, Round, Bevel) and Miter limit, also in the drawing tools' options for new strokes; drawn exactly by the oracle (butt and square caps, miters bevelled past the limit, dashes by arc length restarting per subpath, round dots, dashes keeping a width profile's widths; sub-pixel patterns solid and faded) and so by the GPU stage; the Ink Bottle carries the style and the Eyedropper picks it; merge drawing keeps it on cut pieces; shape tweens blend miter limits and dash lengths; SVG, HTML canvas and Lottie export write it. Headless: `stroke.set_style`, and `cap`, `join`, `miter`, `style`, `dash`, `dash_offset`, `dot_spacing` on `element.set_stroke`, the drawing Line truncated
|
||||
| Plug-ins | **WebAssembly plug-ins** (ADR 0017, `docs/plugins.md`): sandboxed modules run by `wasmi` with no imports but the AniCraft ABI (`anicraft.call`/`anicraft.response`: JSON requests that run registry commands, read a compact document view or the active layer's elements, and log); fuel (10⁹ instructions), memory (256 MiB), wall-clock (5 s), request, size and log limits, a fresh instance per run; file, plug-in, undo and clipboard commands refused. `plugin.install/list/run/remove/reload`; a run is atomic and one undo step named after the plug-in. App: **Commands** menu (Plug-ins, Install, Manage, Reload), palette entries, a dialog generated from the manifest's parameters with a live preview; plug-ins load from `<settings>/plugins` or `ANICRAFT_PLUGINS`; CLI `--plugins`. Samples in Rust (Star Field, Jitter Selection, guest SDK) in `examples/plugins`. Frame scripts: see Interactivity. **Exporter and ease plug-ins** (ADR 0088): `kind: "exporter"` declares a format (name, extension, options) and gets evaluated frames (`movie`, `frame`: the flattened display list, never the document), returning the file's bytes from `ac_export` (64 MiB cap, 5·10¹⁰ instructions, 10 min); File › Export lists it with an Export window (options, frames, file, progress bar and Cancel on a worker thread); `file.export_plugin`, `file.export_formats`, `anicraft-cli export --format <id>` and `formats`. `kind: "ease"` declares named eases, `ac_ease(i, t)` sampled into 257 values at load (NaN, unbounded or end-missing eases refused); `Easing::Sampled` keeps the table in the document, so it plays the same without the plug-in; the ease menus list them under Plug-in eases; `{plugin, ease}` easing params. Samples: Plain Text Frames and Stepped Eases, built and run in CI. Not yet: plug-in formats in Publish, bitmaps' pixels and sounds for exporters, ease plug-ins with parameters, background runs of command plug-ins, a binary document view. |
|
||||
| Interactivity | **Frame actions, frame scripts and Test Movie, first slice** (ADR 0024): a typed timeline action IR (`anicraft-actions`: stop, play, go to a frame or label in a scene, next/previous frame and scene, trace, set x/y/alpha/visible/rotation/scale, instance-name target paths) on keyframes and on button and movie clip instances (click, press, release, over, out); a pure, deterministic, budgeted player in `anicraft-doc` (`step(doc, &state, &events)`; movie clip playheads, button Up/Over/Down states with Hit-frame hit tests, script-set properties) drawn by `evaluate_player`, while `evaluate` and exports stay script-free. **Actions panel** (F9: structured lists, targets/labels/scenes picked from the document; movie clip timelines too), instance name and events in Properties, an "a" on keyframes with actions. **Frame scripts** on the plug-in host (`kind: "frame-script"`, entry points, `player`/`action` ops, 20 M instructions per frame shared, no document access). **Test Movie** (Control › Test Movie, Ctrl+Enter): the player at the document frame rate in its own window with the pointer, restart/pause/step and an Output panel. **A window of its own on the desktop** (ADR 0062): sized to the stage at 100 % (smaller to fit the screen), titled with the document, back where it was last (not on Wayland, where the desktop places windows), with the keyboard when it opens; Esc or Ctrl+W (⌘W) closes it, Ctrl+Enter restarts it in place, and the editor's Ctrl/Alt shortcuts work from it; floating inside the editor in the web build, where the system can't open windows (it says so), or by choice in Preferences › Test Movie. Not yet: full screen, zoom in the movie window, remembering its size. Headless: `actions.set/clear/list`, `instance.set_name`, `control.test_movie` (timed pointer events, returns output and state). **HTML canvas export** (ADR 0028, `file.export_html`, File › Export › Export HTML Canvas…): one self-contained page (data, player and drawing code inline; images and sounds embedded) that plays in any browser with canvas 2D; every used timeline baked frame by frame (tweens of every kind exact, identical paths, paints and frames stored once), movie clips, buttons with Hit areas and every action run by `player.js`, a port of the Rust player checked against it step by step in Boa (state, output and display list); masks and fading/blending groups on offscreen layers; **filters and Subtract/Invert in the page** (ADR 0072: `filters.js`, a port of the renderer's filters run over the group's pixels on a layer that reaches past the canvas by the filters' reach, Subtract and Invert composited per pixel, results kept while the group is unchanged; equal to the oracle's pixels within 9.3e-4 in Boa; 3.4 ms a frame for the demo's filters at 1080p while they change); Web Audio for Event/Start/Stop/Stream sounds; bitmap tints, 9-slice scaling and plug-in frame scripts reported. Not yet: 9-slice in the page, keeping a moving filtered group's pixels, filters off the main thread. **Kept frame scripts** (ADR 0013 tier 1): scripts written in another language (an Animate document's ActionScript) kept verbatim on keyframes with their language, symbol linkage classes and the document class; the Actions panel's **Script** view (monospace editor with line numbers, language, live and undoable), the same "a" marker, Class rows in Properties; `script.set/clear/list/set_class`; **ActionScript timeline subset runs** (ADR 0013 tier 2): a hand-written, bounded lexer and parser (`anicraft_actions::as3`) lower stop/play/go to/next and previous frame and scene on instance-name paths, mouse listeners (click, down, up, roll over and out; named or inline functions, `currentTarget`), `trace` and property settings to the action IR, compiled once per script; anything else is reported with line and column and the script doesn't run (never half-run), `navigateToURL` and the like are ignored and noted; the player keeps listeners per instance, Test Movie's Output says which scripts run and which don't and why, the Script view lists problems in place, the XFL report and `script.list/check` say what runs, and the HTML page runs the same steps (`player.js` checked against the Rust player). **ActionScript small logic** (ADR 0052): scripts compile to a small typed script IR evaluated by the player with fuel (100,000 per script or listener call, 1,000,000 per step; an endless loop or a run-time error stops its script with an Output line and the movie plays on): typed variables (Number, int, uint, Boolean, String, untyped) kept per timeline instance across its frame scripts, expressions as ECMA-262 has them, `if`/`else`, `for`/`while`/`do`, functions with parameters, results and recursion, called from any frame of the same timeline (a timeline-level link step; names that aren't there keep the script from running, said in place), property reads of instances and timelines (`x`, `y`, `alpha`, `visible`, `rotation`, `scaleX/Y`, `currentFrame`, `tLine truncated
|
||||
| Headless | CLI: info, render, render-seq, **gif**, **apng**, **webp**, commands, exec, run, serve (JSON-lines). **MCP server** (`anicraft-cli mcp`, `docs/mcp.md`): stdio JSON-RPC, protocol 2025-06-18 (and 2025-03-26, 2024-11-05); five tools over the command registry (list, run, run a script, describe the document, render a frame as a PNG picture); confirmation tiers and undo apply as in the app. |
|
||||
| Headless | CLI: info, render, render-seq, **gif**, **apng**, **webp**, commands, exec, run, serve (JSON-lines). **MCP server** (`anicraft-cli mcp`, `docs/mcp.md`): stdio JSON-RPC, protocol 2025-06-18 (and 2025-03-26, 2024-11-05); five tools over the command registry (list, run, run a script, describe the document, render a frame as a PNG picture); confirmation tiers and undo apply as in the app. **Live control** (ADR 0104, `docs/control-protocol.md`): `anicraft --control <port>` and `anicraft-cli mcp --bridge <port>` run the same tools on the open window, on this computer only, with a per-run token in `control.json`. |
|
||||
| Sound | **Audio layers, first slice** (ADR 0020): WAV (own reader), Ogg Vorbis (`lewton`) and MP3 (`nanomp3`) import, bounded and crash-proof; sounds live in the library, stored in `.anicraft` as imported, decoded once in the background. A sound belongs to a keyframe as in Animate (Properties › Sound: name, Sync Event/Start/Stop/Stream, Repeat ×N or Loop); Import to Stage puts one on a new layer spanning its length, Import to Library only adds it, the Library previews, places and deletes sounds. The timeline draws each sound's waveform over its span. Stage playback plays the mix through `cpal` (default feature `sound-output`) and the playhead follows the audio clock; stream sounds resync after a jump and scrubbing plays one-frame snippets. Mixing is pure and sample-exact (`doc::sound::voices` + `audio::mix`, Catmull-Rom resampling between rates). Headless: `sound.place/set/remove/rename/delete`, `file.import_to_library`, **`file.export_audio`** (WAV, 16/24-bit or float, any rate), and Export Video carries the soundtrack (Opus in WebM, AAC in MP4, by the user's ffmpeg). **Second slice** (ADR 0039): each frame sound has an **Effect** (None, Left channel, Right channel, Fade left to right, Fade right to left, Fade in, Fade out, shaped over the time it is heard, or **Custom**: up to 16 volume points per channel in the **Edit Envelope** window, drawn on each channel's waveform; the timeline's waveform follows the envelope). Layers holding sounds get a **Volume** and **Mute** (Properties, and a speaker toggle in the timeline); volumes multiply down through symbols and muted layers are silent in playback and every export. **Sounds inside symbols** play: a graphic's on its own frames mapped to the parent's time (loop mode and first frame apply; streams join mid-way and follow the parent playhead), a movie clip's on a loop from when the instance appeared; in the interactive player and **Test Movie** (which now has sound, the picture keeping time with it) movie clips start theirs as their own timelines reach them. The HTML page carries envelopes, volumes and graphic sounds. Headless: `sound.set {effect, envelope}`, `layer.set_volume`, `layer.toggle_mute`. **Sounds on button frames** (ADR 0057) play in Test Movie and the HTML page as the pointer changes the button's state (Over, Down, and Up and Hit on leaving and release, as the SWF format keeps them; never in the soundtrack); `control.test_movie` lists the sounds it starts. **XFL** brings sounds whose file is in the package (WAV, Ogg, MP3) with the sounds on frames that use them, buttons' included. **Output polish** (ADR 0095): the playhead follows the sound *heard* (the device's latency taken off, frames dropped rather than drifting; under a frame off over an hour in tests), event sounds play to their end across a loop and after the last frame (Enter stops all), a **monitor volume and mute** in the timeline header (Control › Mute Sounds; the listener's, in preferences, never in exports), **Control › Audio Scrubbing** (a slice of at least 1/20 s), a lost or missing device never crashes (silent playback, one notice, a log line, reopened on the next play; a new default device is followed), and the **web build plays sound through Web Audio**. The device sits behind an `Output` trait, so the clock and mixing paths are tested with a fake one. Not yet: sounds kept only in Animate's own data format (undocumented; reported), sound effects and in/out points from XFL, sound panning beyond the envelope, audio in Lottie, stream sounds that follow go-tos in the HTML page, lossless compression of stored WAVs, choosing an output device other than the system's default, `stopAllSounds` as a timeline action. |
|
||||
| Files | `.anicraft` JSON load/save (v3, with scenes; v1 and v2 files open as one scene), PNG frame and sequence export, **animated GIF export** (parallel render and quantize, exact frame timing, looping), **animated PNG and animated WebP export** (WebP container writing delegates to shared `craft-webp`; APNG framing remains app-local; ADR 0063: full colour and real alpha, transparent or on the stage colour; every frame exactly the renderer's; repeated frames merged into longer delays; later frames only the rectangle that changed (APNG blends opaque changes over, WebP replaces); APNG delays exact fractions of the frame rate, WebP milliseconds that never drift; loop forever, once or N times; File › Export, Publish Settings, the web build's downloads, `anicraft-cli apng`/`webp`; not yet: lossy WebP (no permissive pure-Rust VP8 encoder exists), dispose-to-background frames, palette or RGB APNG for smaller files), **SVG frame export** (from the same evaluated frame as the renderer: stage-space paths, renderer-matched stroke widths, caps, joins and dashes, gradients under `gradientTransform`, colour effects baked in, masks as nested `clipPath`s). **Opens Animate documents** (`.fla`, `.xfl`, XFL folders; ADR 0009; `.fla` archives in every common zip layout, ZIP64 included, and hostile ones refused with a readable error, ADR 0054): stage, first scene, layers, keyframes, labels, classic tweens with ease, shapes (solid/linear/radial fills, strokes), groups, primitives, symbol instances (matrix, alpha, tint, loop, blend mode, all seven filters), library symbols, **shape tweens**, **layer folders** and **mask layers** (masks inside folders too); imported files are untitled so Save never overwrites them; what isn't supported yet is reported after opening. One damaged bitmap, sound or library symbol is left out and reported rather than refusing the whole file (#226), and a document without a stage colour gets Animate's default white (#163). Every scene comes across. **Bitmaps**: library items whose image is in the package as PNG or JPEG (the original in `LIBRARY/`, else the `bin/` data file when it is PNG or JPEG), instances, and bitmap fills with their matrix (twips scale removed; repeating unless clipped); Animate's own bitmap encodings are not public and are reported, not decoded. **Text** (ADR 0014): static, dynamic and input text fields become text blocks laid out by `anicraft-text`, with face (by PostScript name, family, or the family the name suggests; `_sans`/`_serif`/`_typewriter`), size, colour, bold/italic, alignment, letter and line spacing, margins, matrix, fixed width (wraps) or auto-size, and several lines; runs in different styles become one block per run of same-style lines, stacked as in Animate; a line mixing styles takes its main style and is counted; missing families fall back and are named in the report; dynamic/input fields come across as static text (reported). **Shape hints** on shape tweens (a tolerant self-authored `shapeHints` reader, ADR 0023). Colour effects in every style (Brightness, Tint, Advanced, Alpha; ADR 0056), movie clip and button instance names, one-segment custom eases (as cubic Béziers); a symbol without `symbolType` is a movie clip; frame comments aren't labels. Stroke caps, joins and miter limit, dashed and dotted strokes (ADR 0046; ragged, stipple and hatched are drawn solid and reported). Reported rather than silently changed: gradient strokes, repeating/reflecting, focal-point, elliptical and linear-RGB gradients, reverse loop modes, extra tween spins. A self-authored corpus with golden renders covers all of it (ADR 0035). Shared `craft-xfl` readers now parse filters, shape hints, tween easing, and frame-sound envelopes; AniCraft retains document-model mapping and validation. The XFL schema audit remains in progress, including per-character styles and motion-tween records; **frame scripts are kept** verbatim (scenes and every symbol, with the language from the publish settings), with symbol linkage classes and the document class, and the report lists them as kept, not run (ADR 0013 tier 1; scripts on instances and linkage on bitmaps and sounds are reported); **Import to Stage (Ctrl+R) for SVG drawings**: editable shapes on a new layer at the playhead, with groups, use and symbols, transforms, viewBox, styles, opacity and gradients; **clip paths and opaque masks** (ADR 0021) become mask layers in a folder named after the file (clips that cut nothing dropped, clips inside clips intersected exactly when all but one are convex polygons, curves kept), and **text** becomes text blocks, one per text chunk (position, anchor, font family list, size, weight, style, letter spacing, fill), with missing fonts named; stroke caps, joins, miter limits and dashes come across (ADR 0046); soft masks, per-character positions and text on a path are reported, as is anything else unsupported. **Sprite sheet export**: movie frames on one PNG grid (parallel render, columns/padding/scale, tranLine truncated
|
||||
| Library | **Library management, first slice** (ADR 0050): nested **folders** (New Folder, rename, drag items and folders in and out, Move to; deleting a folder that holds items asks), **inline rename** (F2 or double-click the name; names unique per folder, case aside), **Duplicate Symbol** (fresh ids, same folder, “Ball copy”), **Swap Symbol** in Properties (keeps transform, colour effect, filters, looping and name), a **use count** column, **Select Unused Items** and **Delete Unused Items** (unused = not reachable from any scene; linkage classes count as used; asks first), deleting used items asks and removes their instances, fills and keyframe sounds, **sort** by name, type, use count or date added, **search** (opens the folders that lead to a match), multiple selection, a **preview** (a symbol's first frame from the oracle, a bitmap as smoothed or not, a sound's waveform with play) and **item properties** (symbol type and linkage class, bitmap **Allow Smoothing**, which the oracle, the GPU stage, SVG and HTML honour). Folders are a side table in the document (older files open flat); XFL import keeps folders and Allow Smoothing. Headless: `library.items/new_folder/rename/move/duplicate/delete/unused/delete_unused/set_smoothing`, `element.swap_symbol`. **Second slice** (ADR 0053): **drag items onto the stage** (symbols and bitmaps land at the pointer on the active layer at the playhead, sounds go onto its keyframe; several at once; one undo step; inside a symbol open for editing too), **Place on Stage** (button, right-click, or Enter) at the centre of the view, **Swap Bitmap** in Properties (a placed bitmap keeps its corner and takes the new size; a bitmap fill keeps its shape), a **Convert to Symbol** dialog with name, type and **folder** that offers the last folder and type again, and **"mixed" on every Properties row** for several elements (Scale, Rotation, Alpha, Symbol, Type, Filters, Blending, Looping, First frame, Fill, Bitmap, Stroke, Width, Style; each row compares only the elements it edits; editing a mixed row sets all, and Type sets every selected instance's symbol). Headless: `library.place {items, x, y}` (and `sound`), `element.swap_bitmap`, `kind` and `folder` on `modify.convert_to_symbol`. **9-slice scaling** (ADR 0055): Enable guides for 9-slice scaling on a symbol (Library or Properties). Scaled instances keep their corners, stretch their edges one way and the centre both ways, and strokes keep their width. Rotation and skew apply after; nested symbols, text and bitmaps scale normally. Guides are dragged as dashed lines while editing the symbol in place, or typed in Properties. The CPU, GPU, SVG and Lottie output all show it, and XFL `scaleGrid*` attributes are imported; guides switched off are kept and come back when switched on (ADR 0057). Not yet: 9-slice in HTML canvas export (scaled as a whole and reported), guides in Library previews, snapping guides. Not yet: shared libraries and importing items from another document, linkage on bitmaps and sounds, bitmap compression, dropping files from the desktop, a picture of the item while dragging, Swap Bitmap on a Library item (every use), mixed text style rows, a Colour Effect row with tint. |
|
||||
|
||||
Reference in new issue
Block a user