The plug-in runtime keeps main's JavaScript plug-ins beside the web worker's module bytes and checked loads: a JavaScript plug-in's bundle is kept for the worker like a module, and load_checked loads it from its bundle.
A stored plug-in that didn't install, for example because its load
panicked or its module is broken, was only written to the log. The
person could not see it or load it again without restarting.
- plugin.list gains failed: [{file, error, from}], the plug-in files
that didn't load in this process: those of the Plug-ins folder, and
those the folder report of the Additional Plug-ins Folder (or the
folder plugin.reload loaded last) lists as failed. Disabled plug-ins,
files turned off since they failed, and modules skipped because
another install or removal of their id came first are left out. A
file that both loads list is listed once, as a stored file. A
plugin.reload replaces only the folder's rows. Installing or removing
a plug-in whose module is in a stored file that failed, or a later
load that installs it, takes the file off the list.
- plugin.retry {file?} loads one of those files again, or all of them,
with the same checks as the load it failed in, and reports for each
whether this retry installed it. A folder file's row in the folder
report moves to loaded or keeps its new error. Under automation read
roots, a file outside them is not read again, its row stays listed,
and the reply names it and its folder by their names. Safe Mode
returns an error.
- plugin.setEnabled {file} also takes the name failed gives a file
outside the read roots.
- Object › Plug-ins › Plug-ins That Didn't Load… lists the files with
why; Retry All loads them again under the read roots the list opened
under, and the status bar says how many loaded. The item is disabled
while nothing failed.
- A command.batch that runs a filter and then retries a module with
its id turns Apply Last Filter off, as a reinstall does.
Docs: docs/plugins.md (Plug-ins that didn't load), docs/mcp.md.
- A panic while a held run's output is applied ends the run, so the
documents go back to their state before it, and ending a held run
drops the output handed in for it.
- The worker loads a plug-in with the limits the page sends with the
run, so its memory limit applies.
- A worker that is ready only after the run's deadline is not sent the
run, with or without a dialog open.
- A run that holds the documents and fails while a dialog is open ends
at once and frees them.
- A plug-in command's dialog that automation confirms runs the command
on the page and returns its result.
- A plug-in file opened or dropped on the web whose worker check fails
is reported in the Can't open dialog, not only in the status bar.
- The web README lists connect-src among the CSP directives the app
needs.
With Real-time Drawing off, typing in progress is kept as its own step before
the run is prepared, in plugin.run, a plug-in command and the app's background
start, so the plug-in is given the typed text. A run whose typing started after
it was prepared, with its text still out of the document, is refused, and a
background run that finishes then asks to be run again.
Typing whose text is already in the document is kept only after every check
that can refuse the output has passed, so a refused output leaves the
document, the history and the typing in progress as they were. When keeping it
changes the document, the output is applied to the document as kept.
A plug-in folder load checks each file against the automation roots and,
in a command a script runs, the script's read gate. A file whose name
isn't valid text cannot be checked by name, and without automation roots
it loaded unchecked, also in a script's command. A link with such a name,
in a folder the script may read, loaded a module from anywhere.
Such a file is now refused in a script's command, as it already was under
automation roots. Outside both, it still loads.
plugin.remove now deletes an installed plug-in's stored module along with
its grant, before its settings and cache are deleted. When the module file
can't be deleted, the command returns "can't delete <file>", the settings
and cache are moved back, the plug-in stays installed, and the grant the
signed grants file held for it is written back, so the stored module
still loads at the next launch. Before, the command returned {removed}
and left the module in the plug-in folder.
The Safe Mode choice after a stopped launch moves to main's dialog host and keeps listing every
plug-in that was loading: one name in the sentence, or the list with "Disable Listed Plug-ins and
Continue". Automation requests wait in the queue while plug-ins load, and one past its deadline is
answered as expired. File > Open and opening a file still wait for the plug-ins still loading.
- A stored module's file is read again on its worker thread once the module
has loaded, whatever the file's modified time, and the install still skips
a file whose stamp changed since. The UI thread no longer reads the file.
- Stored and folder modules install through registry::install_for_load,
which checks for an install or removal of the id elsewhere while the
plug-ins' write lock is held, and records the module's grant in the same
step. A grant is forgotten only while the plug-in that took that revision
is still installed (registry::revoke_if_installed).
- A grant that a stored load removed and must put back for a later file is
written to grants.json first; when that write fails, the module is not
installed, and a grant put back for a module that then did not install is
removed again.
- A folder load in which a file found no loader thread is loaded again the
next time the preferences are applied. A plugin.reload keeps its report as
the folder last loaded only when no load started after it.
- Loads: a job's time is read while it is marked finished, the deadline check
reads the clock under the same lock, and only the jobs taken from the queue
fail when no worker is left. wait() counts outcomes taken with ready() as
released, so the jobs after them start.
- File › Open checks the path again after waiting for the plug-in loads.
- Tests wait for workers with bounded receives.
A run that holds the documents applied its output through a plug-in
command even when another session had installed another module with
the plug-in's id meanwhile; only plugin.run checked the installed
plug-in. Both paths now refuse the output unless the registry still
holds the plug-in the run started with, and the run keeps holding the
documents until it ends, changing nothing. Test:
a_held_plugin_command_run_does_not_apply_after_its_plugin_is_replaced.
Opening a JavaScript plug-in's .vcplugin by its path now goes straight to
plugin.install {path}, which reads the manifest and its script with the
plug-in loader's limits. The app's file reader no longer reads the whole
file before the plug-in branch. The plugin.install params text is
reworded so that every alternative starts with its parameter name.
A plug-in command routed to a Web Worker now applies the edit the active
tool computes on another thread (a Shape Builder merge) before the run is
given the document, as a command run in the app does, so the worker sees
the merged document and its output still applies.
- plugin.dialog's and ui.installPlugin's params text and docs/mcp.md
describe the web build: no live preview, every filter runs in a Web
Worker, and {pending: true} while a worker checks new module bytes.
- A read-only image entry may leave out `opacity`, which hosts before API
level 3 don't give, so a level 2 filter that rebuilds an image entry from
the fields it knows still matches.
- A `text.paragraphs` list returned as it was given next to changed
`text.runs` is checked against the new paragraphs: a count that no longer
matches is refused instead of being dropped.
- Written runs hold at most 4,096 paragraphs, the limit for runs and for
the paragraphs a filter is given.
- A fill or stroke in a written run's style with a key its `type` doesn't
read (`tintt`) is refused with the `unknown key` error.
- The font family limit counts the name as given, not the trimmed name.
- The run styles of a type object are indexed once per object, not
compared with every run's style.
- Character styles loaded from another document are skipped when their
tracking, kerning, rotation, miter limit, dashes, Small Caps or variable
font axes are out of range, as `charStyle.new` checks them.
- The plug-in command test's Size command adds a square, since an output
that changes nothing records no undo step.
Docs: docs/plugins.md, docs/mcp.md, plugin.run params text.
- A run that holds the documents applies its output only through the
command and params it was started with, and one that ends without
changing a document keeps that document's revision, so another worker
run on it still applies.
- Clipboard imports are refused while a run holds the documents, and
recovery copies wait until the run ends.
- A command call waiting under a dialog no longer keeps a run past its
time budget, and a run whose document changed stops while a dialog is
open too.
- A checked install waits for the run that holds the documents, and the
progress window shows that run first.
- While a script runs, worker runs still get their requests, Cancel and
their time budgets still end them, and no new worker run starts.
- Command call arguments and answers travel in blobs of their own, so
they nest as deep as a JSON parse allows; the worker protocol is 2.
- docs/plugins.md and packaging/web/README.md scope the off-page runs,
document the first ui.installPlugin reply, the start-up time in the
budget, and the CSP fallback through child-src.
- plugin.remove deletes the stored module of a plug-in that isn't
installed while its settings and cache are still moved aside, so a
module that can't be deleted leaves them in place for the next try.
- plugin.remove of an invalid id no longer raises the grants generation.
- The size check before a signed grants write uses the generation the
file is written at, so a file that fits the 1 MiB limit is kept.
- The system key store connection is dropped when the key store can't
be reached through it or fails, and the next call connects again; a
missing entry keeps the connection.
A painted live effect whose manifest has "api": 3 and "appearanceOutput": true
may give each piece, and each fill and stroke it returns, an opacity from 0 to
1, a blending mode by its exact name and up to 16 built-in effect records (4,096
in one result). Rows take raster effects only, and the rows an effect on a fill
or stroke returns take no effects. 3D effects and plug-in effects, this one
included, are refused, so a returned effect never runs a plug-in.
The host checks each record as effect.apply checks its parameters: known keys,
the type of each default, documented ranges and the per-effect value checks. A
bad value refuses the whole result, naming the field, and that step draws its
input unchanged. A piece's geometry effects reshape it before the object's later
effects, which run on it once, and count against the geometry effects' budget.
The effect stays live and runs again when its source changes.
Docs: docs/plugins.md, docs/mcp.md (plugin.list), docs/target-app-parity.md.
On the web, a plug-in being installed ran its start function and
vc_manifest on the page, and a filter ran on the page for its whole
budget, so a slow or looping module froze the tab for up to a minute
(five for a heavy filter), and Cancel could not stop it.
- A second wasm, apps/vectorcraft-plugin-worker, is built by Trunk as a
worker (data-type="worker" with data-loader-shim in index.html). The
page starts one worker for each check and each run, and terminates it
on Cancel, when the document or the plug-in changes, and 5 s past the
run's time budget, also while a dialog is open. Each worker's inbox
holds its latest progress report and at most 8 other messages.
- crates/plugins/src/worker.rs holds the messages and the worker's
side. Runs can pause at each vc_call (Plugin::begin_run and
resume_run), which the desktop's synchronous calls now use too.
- Install Plug-in... and File > Open check a module in a worker first;
the page then loads it with Plugin::load_checked, which runs none of
its code.
- A filter that calls commands sends each call to the page. The session
holds the run's undo step open and refuses other edits with "a
plug-in is running: cancel it or wait for it to finish" until the run
ends; the progress window shows at once with Cancel only.
- On the web every filter and plug-in command started from the menus
or their dialogs runs in a worker, and the dialogs have no Preview.
A plug-in command applies as itself, one undo step named after it.
Commands that automation runs directly still run where they are
called and return their result.
- packaging/web: the worker files carry no hash, so the sample cache
rules make only the hashed app files immutable.
An object filter may be a .vcplugin manifest with "runtime": "js" and the
.js file its script key names in the same folder. plugin.install {path},
plugin.inspect, plugin.reload and File > Open read the two together; the
host keeps them as one JSON object (the manifest with the script's text in
source), which plugin.install {dataBase64} also takes and which the grant's
SHA-256 covers.
Each run gets a new interpreter with no file, command or clock access, the
filter's instruction and time budgets, and a heap within the plug-in's
memory cap. run(input, params) returns the output a module returns, checked
the same way, and the document changes as one undo step. Syntax errors,
thrown errors, limits and a missing result name the plug-in and its script,
with the line and column when the interpreter reports them. A manifest
without script, an unsafe script name or a script over 8 MiB is refused
before the script is read.
Docs: docs/plugins.md (JavaScript filters), docs/mcp.md, progress line.
Part of #2193.
An importer plug-in with "place": true in its manifest now reads its files
for File › Place as well as File › Open. file.place, file.place.info and
file.place.queue take importer and params; without importer, a file no
built-in format reads goes to the first placing importer by id that lists
its extension. The importer is given at most 128 MiB of the file (a larger
file is refused from its size before it is read) with _context.mode
"place", and its objects, guides left out, become one group named after
the file, as one undo step, embedded. A decline, invalid output, a trap or
Cancel places nothing.
- The Place dialog lists placing importers' extensions under "All
placeable files" and in a filter named after each importer.
- On the web, a placing importer's file dropped on the canvas is placed.
- A file placed with a named importer skips the text, PDF, DXF and PSD
import options.
- document.formats and plugin.list mark placing importers with place:
true; place on any other kind is refused at install.
Docs: docs/plugins.md, docs/mcp.md, docs/gaps.md, docs/target-app-parity.md.