mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-28 19:57:05 -06:00
MCP: select.key checks its id, and agents can read the key object
Agents could set and clear the key object but not read it: document.inspect, the control channel's ui.pointer reply and the headless pointer_gesture reply left it out, and select.key returned null. select.key with an id that was not selected, or with a value that is not an id, such as "x", cleared the key without an error. A compound-path member or an object inside a selected group could become the key. select.key now checks its id as select.set, select.add and select.toggle do (#784). It returns an error for an id that is not a selected top-level object and leaves the key as it was. Layers, compound-path members and objects inside another selected object are not top-level objects. select.key {id: null} used to clear the key and is now an error; select.key {} still clears it. select.key returns {key}, and document.inspect and both pointer replies include the key object as "key". In isolation mode a Selection-tool click can pick an object that select.key does not accept as the key: a sublayer inside an isolated layer, a member inside an isolated compound path, or an object in an isolated group that is also selected. The tool no longer sends select.key {id} for such an object. When the object is already the key, the tool still sends select.key {}, which clears the key. A recorded action whose select.key step names an object that is not a selected top-level object when the action plays now fails and is rolled back, as an action with a select.set step naming a deleted object has failed since #784. Docs: docs/mcp.md, docs/control-protocol.md, docs/target-app-parity.md.
This commit is contained in:
@@ -55,12 +55,12 @@ the two can still win that race.
|
||||
|---|---|---|
|
||||
| `engine.execute` | `{command, params}` | run any engine or UI command (see `engine.commands`) |
|
||||
| `engine.commands` | | every command with label, shortcut, params doc, enablement |
|
||||
| `document.inspect` | `{depth?, childLimit?}` | layer tree, selection, history, paint defaults; the options slice the layer tree as `document.node {summary: true}` does |
|
||||
| `document.inspect` | `{depth?, childLimit?}` | layer tree, selection, the key object (`key`, null without one), history, paint defaults; the options slice the layer tree as `document.node {summary: true}` does |
|
||||
| `ui.inspect` | | tool, UI state, `screenMode` (0 normal, 1 full screen with menu bar, 2 full screen, 3 Presentation Mode), `taskBar` (`pinned`, and `rect` `[x, y, w, h]` while the Contextual Task Bar shows), `freeTransformWidget` (`[x, y, w, h]` while the Free Transform widget shows), view, canvas rect, window size, perf, background saves and exports still running, `nativeMenuBar` (true when the menus are in the macOS menu bar rather than the window; `ui.menu.list` lists the in-window menus either way), `fileDialog` (`"open"`, `"place"`, `"save"` or `"folder"` while a native file dialog is open, `null` otherwise; see below) |
|
||||
| `ui.menu.list` / `ui.menu.invoke` | `{command, params}` | the full menu tree / invoke an item |
|
||||
| `ui.contextMenu.list` | | the canvas context menu for the current selection, flattened like `ui.menu.list` (`path` holds its submenus). `ui.click {x, y, button: "right"}` on the canvas opens it, after selecting the object there unless it is already selected |
|
||||
| `ui.tool.select` / `ui.tool.list` | `{tool}` | |
|
||||
| `ui.pointer` | `{events:[{kind: down|drag|up|move|doubleclick, x, y, space?: "doc"|"screen", mods?}]}` | drive the active tool exactly like the mouse: `mods.cmd` held at a press with any tool but a selection tool drags with the selection tool chosen last (Direct Selection with the Pen until one is), and the release gives the tool back as it was |
|
||||
| `ui.pointer` | `{events:[{kind: down|drag|up|move|doubleclick, x, y, space?: "doc"|"screen", mods?}]}` | drive the active tool exactly like the mouse: `mods.cmd` held at a press with any tool but a selection tool drags with the selection tool chosen last (Direct Selection with the Pen until one is), and the release gives the tool back as it was; the reply lists `selection`, `key` (the key object, null without one) and `tool` |
|
||||
| `ui.key` / `ui.text` | `{key, shift?, alt?, cmd?}` / `{text}` | synthetic keyboard input |
|
||||
| `ui.wheel` | `{x, y, dy?, dx?, unit?: "line"\|"point", shift?, alt?, cmd?}` | a mouse wheel turn over screen point (x, y): `dy` notches up (+) or down, `dx` sideways. Over the canvas the wheel scrolls and Cmd- or Alt-wheel (Option on the Mac) zooms about the pointer; with the `zoomWithMouseWheel` preference the wheel and Alt-wheel zoom about the pointer, Shift-wheel scrolls up and down and Cmd-wheel (Ctrl on Windows and Linux) sideways. Over a focused numeric field (click it first) each notch steps its value as Up/Down do (Shift: ten, Cmd/Ctrl: a tenth) and the panel stays put; over anything else in a panel the wheel scrolls it |
|
||||
| `ui.set` | `{brightness?, panel?, rulers?, outline?, grid?, smartGuides?, boundingBox?, controlBar?}` | |
|
||||
|
||||
+11
@@ -724,6 +724,17 @@ A malformed or unknown id is an error naming that value; the entire selection is
|
||||
All three commands return `{count, ids}` for the resulting selection, in selection order.
|
||||
An empty array clears the selection for `select.set` and leaves it alone for Add and Toggle.
|
||||
|
||||
`select.key {id}` makes `id` the key object that Align aligns to and Distribute Spacing spaces from (`object.align` without `to`, `object.distributeSpacing` with `spacing`), and `select.key {}` clears it.
|
||||
The id must name a selected top-level object.
|
||||
Layers, compound-path members and objects inside another selected object are not top-level objects.
|
||||
Any other id is an error naming that value, and the key is left unchanged.
|
||||
A null `id` is an error too.
|
||||
A click with the Selection tool on a selected top-level object, while two or more objects are selected, runs `select.key {id}`, and a click on the key object again runs `select.key {}`.
|
||||
On a single selected object, or on a group selected with only its own members, `select.key` sets no key.
|
||||
It returns `{key}`, the key object's id or null.
|
||||
`document.inspect` (the `inspect_document` tool) reports the key object as `key`, null without one.
|
||||
The `ui.pointer` and `pointer_gesture` replies list it as `key` beside `selection`.
|
||||
|
||||
`edit.clear {ids?}` deletes the exact selected objects, including individual compound-path members;
|
||||
their unselected siblings remain in the compound. Supplying `ids` works without a selection and
|
||||
overrides selected anchors or guides. Every explicit id is validated before any deletion; a malformed
|
||||
|
||||
@@ -399,6 +399,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
|
||||
A key object needs another selected object outside it. A Shift-click or any other change that leaves one object selected clears the key, and `select.key` sets none on one object or on a group selected with only its own members. With one object selected, the Align panel, the Control bar and the Properties panel align it to the artboard whatever Align To is set to.
|
||||
With two or more objects selected and no key object, Align to Key Object makes the topmost of them the key, whatever order they were selected in, and the Align panel, the Control bar and the Properties panel align to it. Align To keeps its Selection or Artboard choice and shows it again once the key is cleared.
|
||||
Agent selection commands validate every object id before changing the selection and report the resulting count and ids (#784).
|
||||
Agents read the key object: `select.key` returns it, and `document.inspect` and the `ui.pointer` and `pointer_gesture` replies report it as `key`. `select.key` with an id that isn't a selected top-level object returns an error and leaves the key unchanged.
|
||||
Align and Distribute Spacing keep a compound path or selected group that contains the key object in place, as they keep the key object itself.
|
||||
Clear deletes individual selected compound-path members without deleting their siblings, and explicit object ids work without a selection; Cut still removes the same objects it copies (#786).
|
||||
- **Saved selections:** Select ▸ Save Selection… asks for a name and keeps the selection in the document (saved with the file, undoable, up to 25); each one is listed at the bottom of the Select menu and a click selects its objects again; Edit Selection… lists them to rename or delete, applied together on OK. A file's saved selections are capped and checked against its objects when it opens. Not yet: Update Selection and the Layers panel's saved-selection menu.
|
||||
|
||||
Reference in New Issue
Block a user