A paragraph style's hyphenation, justification, tab stops and list, and a
character style's stroke dash, now refuse a key they don't read, naming the
field, as the style's own keys already did. A misspelled nested key no longer
leaves that setting unchanged without an error.
Loading a JavaScript plug-in read its JSON into a map that sorts its keys and
wrote it out again before parsing the manifest, so `params` and each command's
`params` reached dialogs in alphabetical order. The manifest is now parsed from
the plug-in's own JSON (`Manifest::parse_text`), with its size still counted
without `script` and `source`, and a `.vcplugin` read from a folder has
`source` added to its own text instead of being written out again.
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.
- The grant test accepts only a missing grants file as an empty list; any other read error fails it.
- The same-stamp replacement test asserts that the callback rewrote the file before it checks that
nothing installed.
- The loader's ordering test binds the job senders after `loads`, so a failing assertion releases
the held jobs before `loads` waits on them under the manual clock.
A menu.after value with a control character at either end, or longer than 64 characters before its
spaces are trimmed, is refused with the same error as other wrongly shaped values.
- 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 member that is not a path (a compound path inside a compound path) is
not in the input's `path`, so a changed `path` or `type: "path"` deleted
it, together with any hidden or locked members it held. The host now
refuses such an output with an error naming the compound path. A
compound handed back as it was still keeps the member.
docs/plugins.md also says that new members keep the old ids by position
but not their names or live shapes. The test covers a nested compound
member and turning a compound with a guide member into a guide path.
A filter that handed a compound path back rebuilt every member from the
returned path, even when the path was unchanged, so its hidden members
were shown and its locked members unlocked after any run.
- A compound path whose path comes back as it was, or is left out, keeps
its members as they are.
- While a member is hidden, locked or a guide, a changed path or
`type: "path"` is refused with an error naming the compound path. A
guide member is allowed when the output also sets `guide`.
- A changed path still replaces the members, one per subpath, keeping
the old members' ids by position.
Docs: docs/plugins.md.
- 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.
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.
The messages a filter's `writes` manifest key and its changed type,
images and symbol instances can give have an `@msg` row in each of the
25 complete-message catalogs. The other new errors use messages the
catalogs already translate: "`{key}` must be a string", "`{key}` must
be an object", and "read-only field 'text' changed" for text changes to
an object that is not type.
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.
Runs written without text.paragraphs that change the paragraph count at
two separate places gave every paragraph between the first and last change
the first one's style. The host now matches the old and new paragraphs by
their text: an unchanged paragraph keeps its style, changed paragraphs take
the styles of those they replace in order, and an added paragraph takes the
style of the one before it (the next one at the start) without a list
number. Past 262,144 compared pairs the paragraphs are paired in order.
Type a filter returned went to layout with its character and paragraph
styles only parsed, and a style equal to one of the type's runs was not
checked at all, so a filter could set leading of 1e9, 100,000 tab stops,
a scale of 0 or a Kinsoku set the document does not have.
- The ranges the character and paragraph style commands keep each
attribute to move to CharStyle::check_ranges and
ParaStyle::check_ranges in vectorcraft-doc (text/attr_ranges.rs).
charStyle.new, charStyle.edit, charStyle.setAttrs and the paragraph
style commands call them, and so does the filter write path, for every
run and paragraph style, including one the type already has.
- A paragraph style's custom Kinsoku set must name one of the
document's sets, and takes that set's characters.
- The character style commands now also refuse tracking and kerning
outside -1000 to 10000, rotation outside -360 to 360, a miter limit
outside 1 to 500, Small Caps outside 1 to 200, negative dash lengths
and a variable font axis setting that is not a number.
Each refusal names the object and the field, and the document does not
change. Docs: docs/plugins.md, docs/mcp.md, docs/target-app-parity.md.
At plug-in API level 2 a command may give `menu`: `{"path": [...],
"after"?: label}`. The menus list it in that menu, right after the
built-in item `after` names (either label of an item that switches
between two), or at the end of the menu, with the plug-in's name in
parentheses after its label. Keyboard Shortcuts, the command palette
and `command_list` list it under that menu, and `plugin.list` gives its
`menu` with `after` escaped.
A manifest may name 14 menus of Edit, Object, Type, Select, Effect and
View. File, Window, Help, the application menu and the submenus that
list files, fonts, panels or plug-ins are refused when the module is
installed, as is any other `menu`, an `after` that is not 1-64
printable characters and a repeated `menu`. A command whose label with
the plug-in's name reads like a built-in item or submenu of that menu,
or like a command a plug-in with a lower id places there, stays in its
plug-in's submenu, and `plugin.list` and `plugin.inspect` mark it
`placed: false`. The desktop app and `vectorcraft-cli` give the same
result. Commands of several plug-ins at one spot are listed in plug-in
id order and then manifest order. A plug-in whose commands are all
placed elsewhere is a single item in Object › Plug-ins. At API level 1
the key is ignored, repeated or not.
wat::module and wat::sectioned give a module at least one page of
initial memory, so the first vc_alloc block does not start at 0, which
the host refuses. wat::with_field adds its field after a module's $name
when the module has one, so a named module stays valid WebAssembly text.
- crates/engine/src/store.rs: each stored plug-in's load reports how
much of its file it read. What a failed read did not read goes back to
the 512 MiB the stored plug-ins may read together, on every platform;
the permission check before the loads is removed. A file that what is
left does not cover, but would if earlier reads failed, waits until
those reads are done, so the files still install in file-name order.
Disabled files and file stamps are taken once, when the store is
listed. A file's content is compared with its loaded module at install
only when the file was modified less than 2 s before the store was
listed; the clock is read only when a file was listed. A grant the load
removed goes back for a later file with the same id only when the
grants file has no entry for the id, and each install turn reads the
grants file once. At quit, a stored load takes no locks and a folder
load does not wait for the store's turn or for another window that is
changing the plug-ins.
- crates/engine/src/cmd/plugin.rs and crates/plugins/src/registry.rs:
when a folder load turns off the file of a plug-in disabled by its id,
the disabled list is saved in the same install turn, not only when the
load ends. A change made in another window while the folder is being
listed is one the load does not undo.
- crates/ui-egui: an export and File > Open install the plug-ins still
loading before they look up the formats, and a control request waiting
for the loads no longer asks for a frame of its own.
- crates/engine/src/file_access.rs: `ScopeHandle::capture` is as on
`main` again. The new `ScopeHandle::capture_now` keeps the process's
automation roots in force at capture time, and only the Additional
Plug-ins Folder's per-file check uses it.
- New tests: a stored file replaced with one of the same length and
modified time while it loaded is skipped; another window's
`plugin.list` reports a folder still loading as loading; a grant given
elsewhere after the load removed one is kept.
- docs/plugins.md: a module whose read and load take 10 s or longer is
skipped also when it would have finished later, and at quit the app
waits for the modules already loading, for at most 10 s. File > Open
waits for the loads. The Loading
paragraph and the docs/mcp.md lines are rewrapped.
A filter's `notice` made only of default-ignorable characters that the
host keeps as they are (U+034F combining grapheme joiner, the Hangul
fillers, variation selectors, invisible operators, tags and the like) was
accepted and showed an empty status message. Such a notice now refuses the
output, as one of only zero-width characters already did. The visible
character must also fall within the part the status bar shows: a notice
whose visible text comes after the 200-character cut is refused instead of
showing only the ellipsis. Text with a visible character keeps these
characters, and its bidirectional ones are still escaped.
A painted live effect that returned `notice` was refused and drew its
input unchanged, while the docs said the key is ignored. The painted
decoder now ignores a top-level `notice` and still refuses any other
unknown top-level key; the message and its catalog rows say so.
A plug-in step of an action or a `command.batch` now shows its notice in
the status bar too; when several steps report one, the last shows. The
run's result carries `pluginName`, the name of the plug-in that ran, next
to `notice`, so the status bar names the right plug-in even when a later
step of the batch removes or replaces it. The `plugin.run` and plug-in
command params text lists the new keys.
Docs: docs/plugins.md, docs/mcp.md.
A filter's manifest may list `writes`, the kinds among its `inputs` it
may change, at `api` 3 with `doc.write` in `permissions`. Such a filter
returns those objects with the fields it changes: type's runs and
paragraph styles, an image's transform and opacity, an instance's
transform and symbol (one already in the document), and each one's
name. Every value is checked as the input's limits and a path's paints
are; any other changed field, or a value out of range, refuses the run
naming the object and the field, and the document stays as it was.
The changes of one run are one undo step, and an output that changes
nothing records no undo step for any filter. Images are now also given
with their opacity.
Docs: docs/plugins.md, docs/mcp.md, docs/target-app-parity.md.
A filter, or a live effect with commands, at plug-in API level 3 lists
`context` (settings, artboards, layers, swatches) with `doc.read` in its
permissions. Each filter or command run is then given those parts of the
active document in `_context.document`, whether or not anything is
selected: the document's name without its folder, color mode, units,
active artboard size, bleed and raster effects resolution; every
artboard's id, index, name, rectangle and whether it is active; every
layer and sublayer with its parent, depth, name, visibility, lock,
template, color and whether it is current; and every swatch as
swatch.list lists it. It holds no path, object or write handle, and
live-effect drawing, exporters and importers get none.
More than 10,000 rows or 4 MiB of them fail the run before the plug-in
starts, with the document unchanged, and each row takes 1,000
instructions from the run's budget. The install prompt names the wider
read. API_LEVEL is now 3, so older hosts refuse such a manifest.
plugin.list and plugin.info give `context`, and their params text names
it and API level 3.
The plug-in fuzz tests add hostile `context` manifests, installed and
run with and without a selection.
Docs: docs/plugins.md (Document information), docs/mcp.md,
docs/target-app-parity.md.
A `number` or `int` parameter may now declare `"widget": "slider"`, with
an optional `step` counted from `min`. The filter, live-effect and
exporter dialogs and the Appearance panel's effect editor then show a
slider over the parameter's range before its number field. The slider is
named by the row's label for screen readers and moves by the step with
the arrow keys. A value off the slider's steps, typed in the field or set
by a script, is kept until the slider is moved. Install refuses the keys
on any other parameter, on a range with no room, or with a step that
cannot apply, and the refusals have rows in every complete catalog.
Hosts from before these keys ignore them, as they do the other display
keys.
While a slider is dragged, the preview runs the plug-in at most about ten
times a second, on the latest value, and the value the drag ends on
always previews. In the Appearance panel a drag is one undo step.
A filter's output may hold `notice`, one string reporting what the run did.
It needs no permission and no host import. Once the output is applied,
plugin.run and plug-in commands return it as `notice`, and the desktop app
and the web build show it in the status bar as `Plug-in “name”: notice`.
The status bar translates the words around it and never the notice.
The host trims the notice, escapes control, bidirectional and separator
characters, and cuts it at 200 characters, escapes included. A notice that
is not a string or has no visible character refuses the output, and nothing
changes. A run that declines, fails, is refused or is canceled shows none,
and a live effect's notice is ignored.
Docs: docs/plugins.md, docs/mcp.md, docs/target-app-parity.md.
At launch the desktop app loaded every stored plug-in and every module in
the Additional Plug-ins Folder on the UI thread before the window
appeared, one after the other. A slow or panicking module held up or
ended startup.
- crates/plugins/src/loader.rs (new): `Loads` runs load jobs on up to
four threads. Each job runs inside `catch_unwind`; a panic or a load
that takes 10 s or longer fails that job alone, and the others go on.
Outcomes come back in job order.
- registry::FolderLoad and store::StoredLoad list in one step, load on
the workers and install in file-name order. A module whose id was
installed or removed in another window while it loaded is skipped.
- The desktop app loads in the background only during launch; frames
install the finished loads. Plug-in commands, commands that edit,
exports, control requests and files opened at launch wait for the
loads first; view commands and queries do not.
- The launch marker names every plug-in still loading, not only the
oldest. After a launch that stopped during the loads, the Safe Mode
choice lists all of them, and Disable Listed Plug-ins and Continue
turns them all off. `plugin.safeMode` adds `pendingItems`. A module
whose load panicked is no longer named.
Docs: docs/plugins.md, docs/mcp.md.
A module may carry its manifest in a `vc_manifest` custom section, with
`"abi": 1` in place of the `vc_abi_version` export. When it does,
Plugin::load parses the manifest from the section and does not
instantiate the module: its start function, data segments,
`vc_abi_version` and `vc_manifest` do not run when it is inspected,
installed or loaded at startup. The host checks the imports against the
manifest's permissions, the exports `memory`, `vc_alloc` and `vc_run`
by type, and the initial memory and the tables against the limits a run
has (at most 4 tables of 100,000 elements). A module with more than one
such section is refused, and so is a section over 64 KiB, before its
contents are decoded, and a manifest in the section without `"abi": 1`.
The host uses the section and does not call a `vc_manifest` export.
Modules without the section load as before.
The Desaturate example carries the section and keeps the export, and
its fixture is rebuilt with Rust 1.100.0. build.sh clears RUSTFLAGS:
.cargo/config.toml sets `+simd128` for wasm32, and the host refuses
SIMD instructions. wat::sectioned builds test plug-ins with the section.
The settings and cache imports could move up to 1 GiB a run while the
instruction budget charged only for the calls themselves. The bytes they
read or write now cost the run one instruction per 64 bytes, counted
over the whole run so that splitting a transfer into calls costs the
same. A get also pays for the bytes it copies into the module's memory
that the store didn't count, such as a setting answered from memory.
A storage call pays from the store's fuel and from the part of the
budget not yet handed out. The meter it gives the storage holds no more
bytes than those instructions pay for, so a read or write the run can't
pay for doesn't happen, and the run ends with "instruction budget". A
read or write past the 1 GiB still returns -7. Bytes beyond the current
slice are read or written only before the deadline and Cancel, and the
host checks the deadline and Cancel after every storage call, so a run
past either stops after the call instead of at the next slice.
The plug-in fuzz test now also makes writes of up to about 1 MiB on
small instruction budgets.
Docs: docs/plugins.md.
Plugin::load validates every function body with wasmparser before wasmi
reads the module, and wasmi's EnforcedLimits::strict() limit of 32
parameters and 32 results per function type applied only after that.
A module whose type has 1,000 results could make the validator hold
1,000 operand entries for each call to it.
check_features now reads the type section first and refuses a function
type with more than 32 parameters or results, with wasmi's message,
before any function body is validated.
A folder load checked each .wasm path and then opened it with a blocking
open. When a named pipe replaced the file between the two, the open held
the load until something wrote to the pipe, and with it startup or a
prefs.set of the folder. On Unix the file is now opened
without waiting and without making a terminal the controlling terminal,
and the opened file is checked again: anything that is not a regular file,
or is over the module limit, is refused and listed in the folder report.
A folder load still reads at most 1,000 .wasm files, the first by file
name, and now holds only those paths while it lists the folder. The
files past the first 1,000 were dropped and not reported; plugin.reload
and plugin.list now return their count as leftOut. An error while the
folder is listed fails the load, as an error opening the folder does,
instead of dropping the entries after it.
Plugin::load now validates each module with wasmparser and a fixed list
of WebAssembly features before wasmi reads it: mutable globals, sign
extension, saturating conversions, multi-value, bulk memory, reference
types, tail calls, extended constant expressions and floats. A module
that uses any other feature is refused, so a wasmi upgrade, a change to
its defaults or one of its crate features turned on elsewhere in the
build does not change what a plug-in may use. wasmi's Config is set to
the same list for every setter it has in this build.
The list is the set wasmi accepted before, without multi-memory. A
second memory was already refused by the one-memory limit; its error
now says "multiple memories". No module that loaded before is refused.
wasmparser 0.228.0 is the version wasmi 2.0.0 already uses.
A new test loads a plug-in that uses each listed feature and checks
that modules using SIMD, relaxed SIMD, memory64, a second memory,
custom page sizes, wide arithmetic, threads, exceptions, legacy
exceptions, function references or garbage collection are refused with
an error that names the feature.
docs/plugins.md lists the whole set; it named only four of the allowed
features before.