Commit Graph
136 Commits
Author SHA1 Message Date
dotCooCoo ad05c3b99d Plug-ins: an install that automation asked for is not approved in its dialog
An approval question that a control request, MCP, injected input, or a
file dialog one of them opened leads to now keeps OK disabled and
refuses every confirm, a person's click included. The dialog says to
choose Object › Plug-ins › Install Plug-in…, and ui.installPlugin answers
approval: "personMustStartInstall". The person's own Install Plug-in…,
File › Open or drop inspects the module again and asks a new question
with its half-second delay.

The origin is fixed when the request is made and goes with a native
file dialog's deferred answer and the web picker's answers, which now
arrive apart from drops and from window.vectorcraft.openFile (always
automation). A question about taking another module's place now opens
in the approval dialog, and automation's replace: true no longer skips
it. A module that needs no approval still installs at once.
2026-11-11 21:56:58 -08:00
BFlat 485d4e3fff Merge pull request #6747 from dotCooCoo/fix/plugin-grant-sealed-api
Plug-ins: only an approval records a grant, and installs need one
2026-11-12 12:41:15 +07:00
dotCooCoo be4fd1c23e Merge main into fix/plugin-put-back-result 2026-11-11 18:55:34 -08:00
dotCooCoo 822efb5db9 Merge main into fix/plugin-grant-sealed-api
# Conflicts:
#	docs/target-app-parity.md
2026-11-11 18:49:27 -08:00
BFlat 6c68e13732 Merge pull request #6655 from dotCooCoo/fix/plugin-approval-ok-delay
Plug-ins: the approval dialog takes OK only once its question was shown for half a second
2026-11-12 09:23:52 +07:00
BFlat ac8c60cad4 Merge pull request #6675 from dotCooCoo/fix/plugin-filter-progress-cancel
Plug-ins: a light filter that reports progress runs in the background with Cancel
2026-11-12 09:14:14 +07:00
dotCooCoo cde367b889 Plug-ins: only an approval records a grant, and installs need one
registry::grant takes a GrantToken, which the engine makes after a
person's approval and when it loads grants.json. registry::install,
install_bytes and folder loads refuse a module that lists permissions no
recorded grant gives this very module (Error::NeedsApproval), and leave
the plug-in under its id and the revision as they were. A folder load's
approve callback only narrows what installs. A module without
permissions, or with an empty list, installs as before.

A folder load in a session with a plug-in store records the store's
grant for each module it approves, so those modules still load.

docs/plugins.md says what the approval does not protect against: native
code linked into the app, and another program running as the same user,
which can edit the Plug-ins folder and its unsigned grants.json.
2026-11-11 17:35:06 -08:00
dotCooCoo ef7fbaac31 Plug-ins: a failed rename back of a removed plug-in's settings is reported and undone later
When plugin.remove could not remove the grant and then could not rename
the plug-in's settings folder back from <folder>.removed, the failure was
only logged: the plug-in got empty settings, and the next removal deleted
the .removed folder with the settings in it.

- The error now names the .removed folder, the plug-in folder and the
  reason, and the plug-in gets no storage until the settings are back.
- The next load, install or plugin.remove of the plug-in renames a kept
  folder back while the plug-in has no folder of its own. When it has one,
  that folder is used and the kept one stays until plugin.remove deletes
  both. A removal while a kept .removed folder exists renames the plug-in
  folder to <folder>.removing.
- Before deleting a renamed folder, the store writes an empty
  <folder>.removed.delete file and removes it once the folder is gone, so
  what a failed deletion leaves is not moved back. When that file can't
  be written, nothing is deleted.
- A .removed folder without a .delete file, including one an earlier
  version left, counts as kept settings: a new install of the id needs
  replace: true, and plugin.remove of the id deletes it.
2026-11-11 15:51:11 -08:00
dotCooCoo fd7ff70941 Plug-ins: an update left in the store by a failed put-back turns a disabled plug-in on
When plugin.install writes a module that lists permissions, its grant
can't be written, and the old module can't be put back (or, on a first
install, the new module can't be removed), the store holds the new
module. install now takes put_back_plugin's result, so the plug-in's
disabled entries (by id and by stored file) are cleared as for any
install the store holds. The old grant, or none, still doesn't cover the
new module, so the next start skips it until it is approved.

Docs: docs/plugins.md, docs/mcp.md, docs/target-app-parity.md.
2026-11-11 13:03:38 -08:00
dotCooCoo 96e20d548d Plug-ins: a light filter that reports progress runs in the background with Cancel
A light filter of plug-in API level 2 with the `progress` permission ran
on the UI thread, so its progress reports and `vc_cancelled` never
reached a progress window. It now runs in the background under its light
budget, as a heavy filter does, when it runs at once from Object ›
Plug-ins or its shortcut, or when OK runs it with Preview off. The
progress window shows its share and Cancel stops it. With Preview on, OK
keeps the previewed run. A filter that lists a `commandAllowlist` still
runs on the UI thread.

Docs: docs/plugins.md, docs/mcp.md, docs/target-app-parity.md.
2026-11-11 12:18:18 -08:00
dotCooCoo 6723d09328 Plug-ins: the approval dialog takes OK only once its question was shown for half a second
The plug-in approval dialog's OK stays disabled until the question has
been on screen in the focused window for 0.5 s. A click, Enter or Space
before then, a press begun before then, and a direct confirm install
nothing and leave the dialog open. The wait starts over for every new
question, even one that reads the same, and when the window gets the
focus back, so a question swapped in just before a click lands is not
approved by that click. Cancel and Escape work at once.
2026-11-11 11:02:36 -08:00
dotCooCoo be960fa28c Plug-ins: the web build's heavy filter runs stop at the 300 s limit too
Docs: docs/plugins.md said the instruction budget alone bounds a heavy
filter run on the web. The web build now also checks the run's 300 s
wall-clock limit.
2026-11-11 04:28:15 -08:00
dotCooCoo c03fe29ad8 Plug-ins: the web build times the first-view budget and each run's limit
The web build had no clock for plug-in runs, so its first view deferred
every plug-in live effect until Effect > Refresh Deferred Effects, and a
run's wall-clock limit was not enforced there. The deferrals clock and
the run deadline now read `web_time::Instant`, which is the system's
monotonic clock on the desktop and the page's `performance.now()` in the
web build. The web's first view now shares the same 2,000 ms budget, and
its runs stop at the 5 s, 60 s and 300 s limits as on the desktop.

Docs: docs/plugins.md, docs/mcp.md, docs/target-app-parity.md.
2026-11-11 03:41:05 -08:00
dotCooCoo feda950bc8 Plug-ins: live effects of a document's first view share a 2,000 ms budget
While the app draws a document on screen, the live-effect plug-in runs of
its first view share a 2,000 ms budget (VectorCraft's own value); each run
takes the lesser of its 5,000 ms limit and what is left. A stage left out
for time, or one that times out, fails, has no plug-in or meets Safe Mode,
draws its input art unchanged and is deferred, and the status bar says how
many. Later drawings leave a deferred stage as it is until its input or
parameters change.

- effect.deferredStatus lists the deferred stages with object, effect
  index, fill or stroke, plug-in and reason, objects in symbol, pattern,
  brush and opacity-mask art included.
- Effect › Refresh Deferred Effects (effect.refreshDeferred {ids?}) runs
  them again with a fresh budget and returns {refreshed, stillDeferred,
  failed}.
- Each document has its own budget and deferred stages; exports, Expand
  Appearance and commands run every stage under the per-call limit.
- The web build has no clock for the budget: its first view runs no
  plug-in effect, and a refresh runs them.

Docs: docs/mcp.md, docs/plugins.md, docs/target-app-parity.md.
2026-11-10 22:16:01 -08:00
dotCooCoo 5628f1fe0c Plug-ins: no command call is made after a run's failed call
A plug-in that went on calling after a failed `vc_call` still had each
later call made on the document, although the run fails and is undone
at its end. After the run's first failed call, `vc_call` now returns
`-11` (CALL_NO_CONTEXT) and the host makes no further call; the run
still fails with the first call's reason.
2026-11-10 13:42:38 -08:00
dotCooCoo f42b03f392 Plug-ins: a call reads no file, whatever param names it
A call whose arguments hold a file or folder key at any depth, such as an
effect's textureImage.path, is refused before the command runs; the walk
keeps its own stack. Each call also runs with automation file access
confined to no roots, so every checked read or write a command makes is
refused, whichever param carried the path.
2026-11-10 12:41:46 -08:00
dotCooCoo b99aac6e89 Plug-ins: American spelling of canceled in the command-call text 2026-11-10 12:12:01 -08:00
dotCooCoo 9689f79eca Plug-ins: a call with nothing to make it fails the run
vc_call returning -11 (from the start function, or in a run that can't make
calls) now fails the run like every other code, so a plug-in that ignores
it can't report success for a call that never ran. Calls are allowed once
the module has loaded, so a start-function call gets -11 instead of
trapping.
2026-11-10 11:58:08 -08:00
dotCooCoo 811c21e7c2 Plug-ins: calls need doc.read, and an edit in progress is kept before a calling run
A command's result describes the document, so a plug-in without doc.read
gets -6 for every call, whether or not the id names a command. A run that
calls commands commits an edit still in progress first and prepares its
input again when that changed the document or the selection.
2026-11-10 11:26:10 -08:00
dotCooCoo f921a6923d Plug-ins: an API level 2 plug-in calls the commands its manifest lists
A filter at plug-in API level 2 with the new `commands` permission names
the commands it may run in its manifest's `commandAllowlist` and runs
them with `env.vc_call`, reading each result with `env.vc_call_result`.
Each call runs through Session::execute on the run's document and sees
what earlier calls changed; the calls and the filter's output are one
undo step, and a run that fails, is cancelled or makes a failed call
leaves the documents, their history and the session state the commands
change as they were.

Commands that touch files, the clipboard, preferences, the view,
scripts, actions, plug-ins, open documents or the undo history are never
callable, and every other command must be listed as allowed in
cmd/plugin_call/reviewed.rs, so a new command is refused until placed.
Calls are capped at 1,000 a run, 8 MiB a call and 64 MiB a run, and each
costs instructions from the run's budget. plugin.install refuses a
manifest that lists a refused command and reports unknown ids;
plugin.inspect lists both, and the approval dialog lists the commands.

Refs #2186
2026-11-10 10:16:28 -08:00
dotCooCoo eebbe496d4 Merge main into fix/plugin-grant-app-approval 2026-11-08 23:53:57 -08:00
BFlat 0f2857e1a1 Merge pull request #6286 from dotCooCoo/fix/plugin-stale-grant
Plug-ins: replacing a granted plug-in with one that lists no permissions removes the grant
2026-11-09 15:41:04 +08:00
dotCooCoo 0efd9a9ccc Merge main into fix/plugin-grant-app-approval 2026-11-08 23:26:53 -08:00
BFlat 09f82b95ce Merge pull request #6288 from dotCooCoo/fix/plugins-pixels-omitted-note
Plug-ins: docs limit the 64 MiB decoder note to non-CMYK images
2026-11-09 15:20:18 +08:00
dotCooCoo d7f017e889 Plug-ins: docs limit the 64 MiB decoder note to non-CMYK images
The image decoder limit in rgba_pixels does not apply to CMYK images, which cmyk_rgba reads. Keep the separate case of a TIFF the host rejects as too large.
2026-11-08 22:38:51 -08:00
dotCooCoo c2753c1169 Merge main into fix/plugin-grant-app-approval 2026-11-08 22:17:36 -08:00
dotCooCoo b71b88b6b0 Merge main into fix/plugin-read-only-input-held-once
# Conflicts:
#	docs/plugins.md
2026-11-08 22:10:42 -08:00
dotCooCoo cd7dd5f3cc Merge main into fix/plugin-stale-grant 2026-11-08 22:03:18 -08:00
dotCooCoo 65ff9df849 Plug-ins: a grant left behind stops counting when its module can't go back
plugin.install and plugin.remove count an entry of grants.json that this
version can't use when it can't be removed. plugin.install stops counting
a grant it can't remove when the old module can't be written back to the
Plug-ins folder.
2026-11-08 22:00:26 -08:00
dotCooCoo 7431486afa Plug-ins: mcp refuses --allow-plugin-grants with automation roots
A server confined with --automation-read-root or
--automation-write-root has no plug-in store, so a grant accepted under
the flag could not be written to grants.json and recorded grants were
not read. mcp now refuses the combination at start-up.

The help text, docs/plugins.md and docs/mcp.md state that a confined
server does not install a module that lists permissions or asks for a
heavy budget, and that with VECTORCRAFT_NO_PREFS set a grant accepted
under the flag lasts for that session only.
2026-11-08 21:54:46 -08:00
dotCooCoo 2f42feb848 Plug-ins: docs say when pixelsOmitted is set
An embedded image also comes with pixelsOmitted: true when its data is missing, its width or height is 0, its data cannot be decoded within the decoder's memory limit, or its dimensions differ from pixelSize. The entry tells plug-ins to check the flag before reading pixelsBase64.
2026-11-08 21:17:22 -08:00
dotCooCoo 9ae57b03c0 Plug-ins: the texts say a grant accepted under the flag stays recorded
A grant accepted under --allow-plugin-grants is written to grants.json like a
person's approval and counts as approved in later sessions and in the desktop
app. The CLI usage text, the plugin.install params text and docs/plugins.md and
docs/mcp.md said only a person's approval in the desktop app records one.
2026-11-08 21:10:26 -08:00
dotCooCoo e7c3307f07 Merge main into fix/plugin-grant-app-approval 2026-11-08 20:58:47 -08:00
dotCooCoo 0e1aa5cc2e Plug-ins: a filter's read-only objects stay in its input and failed decodes count
A filter run kept a second copy of every read-only object as JSON values.
The run now keeps where each object is in the input, and checks an output
entry against it by parsing that one object, unless the entry is `{"id": …}`
alone.

An image that reaches the decoder now counts toward the 16 MiB pixel total
even when decoding fails, so broken images use up the same total as images
that decode.

The plugin.run text, docs/mcp.md and the progress line state the paint
order and that rule, and docs/plugins.md states that a CMYK image's pixels
are sRGB. New tests cover the per-image 1 MiB, the 16 MiB pixel total and
the 16 MiB text total at and one past their values, memory-budget failures
before the plug-in starts, images that are not decoded, CMYK images
included, and leading per run.
2026-11-08 20:54:02 -08:00
dotCooCoo 9e655ae2e6 Merge main into fix/plugin-stale-grant 2026-11-08 20:38:46 -08:00
dotCooCoo 6cce39dd7f Plug-ins: a grant that can't be removed stops counting for the session
When loading the plug-in store can't remove the grant of an id whose stored
module lists no permissions, or can't read grants.json, the entry stays on
disk and still approved the bytes it covers. plugin.install has the same case
when the grant can't be removed and no earlier module can be put back.

The session now keeps those ids and does not count their grants in
plugin.inspect, plugin.install, plugin.reload or a later load of the store. A
successful update of the grant for the id ends that, and so does attaching a
different store.
2026-11-08 20:38:03 -08:00
BFlat 5402f17f15 Merge pull request #6276 from dotCooCoo/fix/plugin-last-error-origin
Plug-ins: lastError keeps a failed run's error, and hit tests follow swatch changes
2026-11-09 12:26:56 +08:00
dotCooCoo bff7f0ad54 Merge main into fix/plugin-grant-app-approval 2026-11-08 20:16:56 -08:00
dotCooCoo 5cb09720a4 Merge main into feat/plugin-filter-inputs 2026-11-08 19:34:12 -08:00
dotCooCoo 36755be821 Merge main into fix/plugin-grant-app-approval 2026-11-08 19:30:19 -08:00
dotCooCoo 9f9cf9e7ea Merge main into fix/plugin-stale-grant 2026-11-08 19:29:45 -08:00
BFlat 0089e494f5 Merge pull request #6269 from dotCooCoo/fix/plugin-storage-kept-settings
Plug-ins: settings and the cache total stay in memory between storage calls
2026-11-09 11:13:41 +08:00
dotCooCoo 3123b4af74 Plug-ins: a passed reference check keeps a failed run's error
A painted effect's cached result passed its swatch and pattern check and cleared the error of a failed run, so plugin.info reported none while the effect still failed on another object. A run and a reference check now record their errors separately, and each clears only its own.
2026-11-08 19:13:37 -08:00
dotCooCoo 529dcb5c64 Merge main into feat/plugin-filter-inputs 2026-11-08 19:06:11 -08:00
dotCooCoo 4941b377f9 Merge main into fix/plugin-grant-app-approval 2026-11-08 19:01:49 -08:00
dotCooCoo e1281c0266 Merge main into fix/plugin-stale-grant 2026-11-08 18:59:23 -08:00
dotCooCoo 63a483492b Plug-ins: a grants file that can't be read keeps the grant it may hold
A grants file that can't be opened or read may name the old module once
it reads again. plugin.remove and an install of a module listing no
permissions now fail on it and keep the module. A file over 1 MiB or one
that doesn't hold a list still approves nothing and doesn't stop them.
2026-11-08 18:59:22 -08:00
dotCooCoo 6b2559b63e Docs: a delete of the last setting removes the settings file 2026-11-08 18:33:23 -08:00
dotCooCoo 3de6da24be Docs: a delete of a key with no value writes no settings file 2026-11-08 18:06:41 -08:00
dotCooCoo bd5ea2a1bf Merge main into feat/plugin-effect-paint 2026-11-08 17:59:33 -08:00