mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-27 09:19:04 +00:00
Engine: execute refuses keys a command doesn't name, in every build
Session::execute ran check_params only in the engine's own tests, so a direct execute in a release build ran a misspelled key with the command's default. It now checks every call, the commands a command runs included, as MCP and the control port already did. A command.batch or an action.batch is checked before its first step runs, and each step is checked again as it runs, so an effect.setParams step is checked against the effects the steps before it added. Saved steps play through Session::replay, which takes keys a command no longer reads, so an action recorded by an older version still plays and Session::replay still plays an older journal. The Actions panel's Play (Accelerated, Step by Step and Pause For, its function keys and ui.action.play) and the Batch dialog use it. Docs: the cmd/params.rs module doc, the Parameter keys section of docs/mcp.md and a line in docs/target-app-parity.md describe both paths.
This commit is contained in:
+15
-9
@@ -1080,10 +1080,12 @@ PDF 1.3 export.
|
||||
|
||||
### Parameter keys
|
||||
|
||||
`command_run`, each step of `command_batch`, `run --cmd … --params` and the control channel's `engine.execute` check
|
||||
the keys of `params` against the command's params description (the `params` text `command_list` returns): the object
|
||||
it starts with, `{x, width?: pt, name?|title?: …}`, names the keys; `?` marks an optional one. A key it doesn't name
|
||||
is refused before the command runs:
|
||||
The engine checks the keys of `params` of every command it runs against the command's params description (the
|
||||
`params` text `command_list` returns): `command_run`, each step of `command_batch` and of the `command.batch` and
|
||||
`action.batch` commands, `run --cmd … --params`, the control channel's `engine.execute`, and the app's own calls. A
|
||||
batch with such a step fails before its first step runs. The object the description
|
||||
starts with, `{x, width?: pt, name?|title?: …}`, names the keys; `?` marks an optional one. A key it doesn't name is
|
||||
refused before the command runs:
|
||||
|
||||
```json
|
||||
{"id": "file.new", "params": {"widht": 300}}
|
||||
@@ -1126,13 +1128,17 @@ one opens as before and draws it as `rgb`:
|
||||
```
|
||||
|
||||
A number outside the range the effect documents is still stored as given and clamped when the effect draws. A
|
||||
plug-in effect's parameters are resolved against its manifest instead, and `effect.setParams` as a step of
|
||||
`command.batch` isn't checked before the batch runs (the effect it edits may only exist once the steps before it ran);
|
||||
the command still refuses an effect `color` it can't read. A description with a `…` entry takes more keys than it lists: those of the command it names
|
||||
plug-in effect's parameters are resolved against its manifest instead. `effect.setParams` as a step of
|
||||
`command.batch` is checked when the step runs, against the effects the steps before it added, and the batch then
|
||||
fails with no change. A description with a `…` entry takes more keys than it lists: those of the command it names
|
||||
(`…settings as file.new`), or any key when it names none, as `document.export` and `document.save` do for the options
|
||||
of the format they write (one object can carry several formats' options). A command that takes its own reply back
|
||||
(`document.setup`, `text.areaOptions`) says so the same way. The app's own journal isn't checked: an action or
|
||||
journal recorded by an older version replays as it did, except for an effect `color` that the effect can't read.
|
||||
(`document.setup`, `text.areaOptions`) says so the same way.
|
||||
|
||||
Saved actions aren't checked this way. When the Actions panel plays an action (Play at any speed, an action's function
|
||||
key, the Batch dialog or `ui.action.play`), a key a command no longer reads, recorded by an older version, is ignored
|
||||
and the action still plays. `Session::replay` plays a journal the same way. The command still refuses an effect
|
||||
`color` or `channel` it can't read.
|
||||
|
||||
An unknown command id is matched the same way as an unknown parameter key: the error names the nearest command id when
|
||||
one is near, ignoring case. A step of `command.batch` or `action.batch` gets the same suggestion in its step error:
|
||||
|
||||
@@ -649,6 +649,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
|
||||
- JSON-lines control channel with real egui pointer and keyboard injection.
|
||||
- Synthetic input validates complete gestures before queue mutation: at most 256 drag steps, 16 clicks and 1,024 pending events; up to 64 control requests per frame, with later requests retained for the next frame (#1709).
|
||||
- The control server writes each reply through a 64 KiB buffer. On Windows 11 it sends the 17 MB `document.inspect` reply of a document with 50,000 objects on one layer to a client over loopback in 0.09 s instead of 34 s.
|
||||
- Parameter keys: the engine refuses a key that a command's params description doesn't name before the command runs, in every build and for every caller, including the app's own calls, the commands a command runs and the steps of `command.batch` and `action.batch`. An action recorded by an older version still plays from the Actions panel and the Batch dialog (`Session::replay`). `crates/engine/tests/it/param_keys.rs`.
|
||||
- MCP server with 25 tools (drawing, text, effects, Pathfinder, transforms, graphs, text wrap, export, screenshots, any command), attached to the running app or headless. Tool descriptions and replies agree with the engine: format lists come from its format table, `save_file` says it keeps the document's own format, `inspect_document` reports the paint type's characters show, and selection exports report the encoder's warnings. `--automation-read-root` / `--automation-write-root` (on `vectorcraft-cli mcp` and on `vectorcraft --control`) confine the files commands read and write to chosen folders, links followed, with the flags PhotoCraft takes (#832); each flag may be given more than once, a path inside any of its folders being allowed (#3546, `file_access::tests::several_roots_of_a_kind_each_grant_their_access`, `cli::mcp_automation_roots_take_several_folders`). A long export can be cancelled (`notifications/cancelled` stops it at the next page or group and writes nothing), reports page progress to a client that sent a progress token, and does not make other requests wait: engine-free ones answer at once, the rest are refused as busy after two seconds (#2165, #2171, #2172).
|
||||
- MCP protocol: five prompts (`prompts/list` / `prompts/get`: poster, icon set, recolour, trace-and-style, export set), `completion/complete` for prompt arguments and template variables read from the live catalogues (formats, effect ids, command ids, trace presets, swatch and object ids), four resource templates (`vectorcraft://object/{id}`, `//command/{id}`, `//effect/{id}`, `//swatch/{name}`) so an agent reads one thing instead of the whole document, and `logging/setLevel` with `notifications/message`. `window.panel` ids are case-insensitive (display labels work too), `vectorcraft://object/{id}` reads through `document.node {summary: true}` (the same reply bytes from one lookup instead of summarizing the whole document: a leaf read on a 2,000-object document drops from ~20 ms to ~0.06 ms), large containers slice with `document.node {depth?, childLimit?}` (truncated levels report `childCount`), `document.inspect` and the `inspect_document` tool slice the same way so a depth-0 read is the layer skeleton (~9.7 KB instead of ~2 MB on a 2,000-object document), `document.find` locates nodes by name/kind/text with ancestor paths, and the CLI sweeps the protocol surface over stdio against the compiled binary. `docs/mcp.md` has a Protocol section covering the capability table and what is deliberately absent (subscriptions, progress, cancellation, sampling, elicitation, Streamable HTTP — all of which need the transport to interleave reads).
|
||||
- Headless CLI (`vectorcraft-cli run`, `convert`, `info`, `bench`, `perf`, `mcp`). A `run` step, like a `command_batch` step over MCP, can use an earlier step's result (`"$1.id"`, #785); `run --commands FILE` (or `-` for standard input) reads the steps from a JSON array or JSON Lines, past the Windows command-line limit (#3147, `apps/vectorcraft-cli/tests/it/cli.rs` `run_reads_*`, `run_refuses_malformed_commands_naming_the_step`).
|
||||
|
||||
Reference in New Issue
Block a user