Commit Graph
204 Commits
Author SHA1 Message Date
BFlat 2fcfa504fb Merge pull request #9085 from dotCooCoo/feat/plugin-slider-param
Plug-ins: a number parameter can show a slider beside its field
2026-11-26 16:59:14 +07:00
dotCooCoo d71d4092e6 Merge main into feat/plugin-slider-param 2026-11-26 00:17:16 -08:00
dotCooCoo 132d2da4a1 Merge main into feat/plugin-api-filter-type-images-symbols 2026-11-25 19:01:04 -08:00
BFlat f966e8d664 Merge pull request #9104 from dotCooCoo/feat/plugin-api-last-filter
Plug-ins: Apply Last Filter and Last Filter… repeat the last filter plug-in
2026-11-26 08:50:06 +07:00
BFlat fc34e27d99 Merge pull request #9110 from dotCooCoo/feat/plugin-api-importers-place
Plug-ins: importers whose manifest sets place also read files for File › Place
2026-11-26 08:49:00 +07:00
dotCooCoo 01d77a45b9 Docs: a host at api 3 that doesn't read writes ignores the key
Hosts from before api 3 refuse the manifest. A host at api 3 without writes
installs the filter, ignores the key and refuses an output that changes the
objects it was given.
2026-11-25 15:00:28 -08:00
dotCooCoo c0fd2170d0 Merge main into feat/plugin-api-filter-type-images-symbols 2026-11-25 13:59:45 -08:00
dotCooCoo 388e1f29ef Merge main into feat/plugin-api-importers-place 2026-11-25 09:46:45 -08:00
dotCooCoo f6bc3d942a Merge main into feat/plugin-api-run-notices 2026-11-25 09:36:45 -08:00
dotCooCoo 335ed2cbb0 Merge main into feat/plugin-api-last-filter 2026-11-25 09:03:55 -08:00
BFlat 9a9bdca382 Merge pull request #9088 from dotCooCoo/feat/plugin-api-document-info
Plug-ins: filters and plug-in commands read document information without a selection
2026-11-25 19:33:17 +07:00
dotCooCoo ee179f34dd Merge main into feat/plugin-api-filter-type-images-symbols 2026-11-25 04:26:13 -08:00
dotCooCoo 9d225ba091 Merge main into feat/plugins-load-on-workers
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.
2026-11-24 23:31:07 -08:00
dotCooCoo 3ca2cf7d34 Merge main into feat/plugin-api-document-info 2026-11-24 22:49:15 -08:00
dotCooCoo 9a60524d6b Merge main into feat/plugin-menu-placement 2026-11-24 16:21:26 -08:00
dotCooCoo cef8a6d897 Plug-ins: background loads check stored files and ids again before they install
- 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.
2026-11-24 09:27:50 -08:00
BFlat 3049775dee Merge pull request #9156 from dotCooCoo/fix/plugin-compound-member-state
Plug-ins: a filter keeps a compound path's hidden and locked members
2026-11-24 16:07:35 +07:00
BFlat 87de595305 Merge pull request #9096 from dotCooCoo/fix/plugin-run-no-op-undo
Plug-ins: a run that changes nothing records no undo step
2026-11-24 16:06:33 +07:00
BFlat 7d984fc7f3 Merge pull request #8964 from dotCooCoo/feat/plugin-manifest-section
Plug-ins: read the manifest from a custom section before running any code
2026-11-24 16:03:53 +07:00
dotCooCoo edadc82827 Plug-ins: state what a compound path's reshape resets, and test an unflagged flatten of a guide member
docs/plugins.md now says that each new member keeps only the id of the
old member in its place, with its name, live shape, opacity, blending
mode, appearance, opacity mask and other settings of its own reset, and
that `guide: false` on a compound path makes each guide member an
ordinary path.

The compound path test also checks that `type: "path"` without `guide`
is refused for a compound path with a guide member and leaves the member
a guide, and its doc comment names members that are not paths.
2026-11-22 19:59:44 -08:00
dotCooCoo 2fbe099c48 Plug-ins: refuse replacing a compound path's members when one isn't a path
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.
2026-11-22 19:15:57 -08:00
dotCooCoo e4ce03a906 Plug-ins: a filter keeps a compound path's hidden and locked members
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.
2026-11-22 17:58:55 -08:00
dotCooCoo 03c1c6c70f Plug-ins: written type keeps one paragraph style per paragraph, and API level 2 filters may leave out an image's opacity
- 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.
2026-11-22 14:09:03 -08:00
dotCooCoo 977e896fd0 Plug-ins: File › Place keeps a named importer and its params for every file
- file.place with `importer` and `params` and `paths`, or with no file,
  opened the Place dialog with only the files, so its OK read them with the
  built-in reader. Each dialog entry now carries the importer and its
  params, from the paths given, the desktop pick and the web pick, and OK
  passes them to file.place and file.place.queue.
- On the web, each picked file carries its own pick's importer and params.
  Picked files with other ones, or that arrive while a Place dialog is open,
  wait for the next dialog.
- The Place dialog does not read the start of a PDF, .ai, EPS or PostScript
  file placed with an importer named to tell whether Link would place it as
  a document.
- A path placed or opened with `importer` named is refused from its size
  before any of it is read. Before, its first 64 KiB were read first.
- docs/plugins.md and docs/mcp.md say when the size check runs, that the
  web's File › Place reads the picked file in the browser, that File ›
  Place's filters leave out extensions a built-in format reads, and that a
  dropped file a built-in format reads goes to that format.
2026-11-22 11:31:23 -08:00
dotCooCoo e6cf6a7dbb Docs: a batch forgets its filter only when it changes that same plug-in
docs/plugins.md said a batch step does not count when a later step
installs, removes or reloads any plug-in. The step is dropped only when
a later step installs or removes that same plug-in, or reloads
plug-ins; installing or removing another plug-in keeps it.
2026-11-22 10:51:08 -08:00
dotCooCoo c1f1b662c8 Plug-ins: every filter step of a batch keeps its parameters
A batch that ran several filters remembered only the last one, so the
earlier filters' dialogs opened with older parameters or their defaults.
Each plugin.run step of a command.batch or Action Batch is now noted in
the order it ran: the last one stays the filter Apply Last Filter runs,
and a filter that ran twice keeps its newer parameters.

A later install, removal or reload drops a filter's parameters only when
it may have changed that filter: a removal of its id, an install that
reports its id (or whose result is unknown), or a reload. Installing
another plug-in later in the batch keeps them.
2026-11-22 08:23:20 -08:00
dotCooCoo c664ce630b Plug-ins: importers whose manifest sets place also read files for File › Place
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.
2026-11-22 07:20:07 -08:00
dotCooCoo 9fe9ad658a Plug-ins: paragraph styles follow the paragraphs' text when a filter adds or joins paragraphs
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.
2026-11-22 06:51:52 -08:00
dotCooCoo 1592cee7a8 Plug-ins: Apply Last Filter and Last Filter… repeat the last filter plug-in
Object › Plug-ins now starts with Apply Last Filter (plugin.applyLastFilter)
and Last Filter… (plugin.lastFilter). Once a filter plug-in's plugin.run
succeeds (its menu item, its dialog's OK, a shortcut, a request, the last
plugin.run step of a command.batch or of an Action Batch that processed a
file or data set, or a background run once its result is applied), Apply
<name> runs it again on the selection with the same parameters, without
its dialog, as one undo step, and <name>… opens its dialog with those
parameters. A filter's own dialog opens with the parameters it last ran
with in the session. Previews, Cancel, failed runs, a plug-in's own
commands and live effects don't count.

Both items are grayed out, and return an error through automation, with
no document open, before a filter ran, once that filter was removed or
installed again, or when its manifest no longer takes the parameters as
they are. The parameters are kept for the session only, for at most 64
filters.

The help page describes the same pair for filters:
https://help.adobe.com/archive/en_US/illustrator/cs3/illustrator_cs3_help.pdf#page=357
Where the items sit and when they are grayed out are VectorCraft's own
rules.

Docs: docs/plugins.md, docs/mcp.md, docs/target-app-parity.md.
2026-11-22 06:48:36 -08:00
dotCooCoo 945d0a42b0 Plug-ins: check every number in the type styles a filter writes
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.
2026-11-22 06:24:25 -08:00
dotCooCoo 02ebfb7b8e Plug-ins: a run that changes nothing records no undo step
A filter run, a plug-in command, or a run that calls commands applied its
output through Session::edit, which records an undo step and marks the
document modified even when the output changes nothing. The output is now
applied to a copy first, as colorcmds::edit_if_changed does: only a copy
whose objects or kept documentData differ becomes the document, as one undo
step. Otherwise the document, its undo history and its saved state stay as
they were, and the run's objects are still selected.

Docs: params text of plugin.run and plug-in commands, docs/plugins.md,
docs/mcp.md, docs/target-app-parity.md.
2026-11-22 05:40:50 -08:00
dotCooCoo 57be8ca36f Plug-ins: a command's manifest can place it in another menu
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.
2026-11-22 04:38:27 -08:00
dotCooCoo f8bbfae755 Plug-ins: a stored file whose read fails gives back its share of the store's bytes
- 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.
2026-11-22 03:25:30 -08:00
dotCooCoo 891dc8006d Plug-ins: invisible notices are refused, and batch steps show their notice
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.
2026-11-22 02:58:47 -08:00
dotCooCoo ed50dd06f4 Plug-ins: filters at API level 3 change type, images and symbol instances
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.
2026-11-22 01:24:01 -08:00
dotCooCoo 460678d341 Plug-ins: filters and plug-in commands read the document's settings, artboards, layers and swatches without a selection
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.
2026-11-22 01:02:00 -08:00
dotCooCoo a744816c7f Plug-ins: a number parameter can show a slider beside its field
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.
2026-11-22 00:43:16 -08:00
dotCooCoo 875bde4841 Plug-ins: a filter or plug-in command can report a notice in the status bar
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.
2026-11-22 00:12:07 -08:00
dotCooCoo 1b29256601 Plug-ins: stored and folder plug-ins load on worker threads while the window shows
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.
2026-11-21 19:09:18 -08:00
dotCooCoo b919dbd66f Plug-ins: read the manifest from a custom section before running any code
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.
2026-11-20 21:39:33 -08:00
dotCooCoo e49a0d628c Plug-ins: storage calls pay instructions for the bytes they move
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.
2026-11-20 21:38:22 -08:00
BFlat f593dff00c Merge pull request #8903 from dotCooCoo/fix/plugins-folder-special-files
Plug-ins: the plug-ins folder can't block startup on a special file
2026-11-21 11:02:50 +07:00
dotCooCoo e2d62de4fe Merge main into feat/distorted-image-commands 2026-11-20 18:54:01 -08:00
dotCooCoo 2adc433f5e Plug-ins: the plug-ins folder can't block startup on a special file
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.
2026-11-20 17:28:22 -08:00
dotCooCoo b0fba57f4a Plug-ins: the host checks the WebAssembly features a plug-in uses
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.
2026-11-20 17:25:01 -08:00
dotCooCoo 70a36623ad Merge main into feat/distorted-image-commands 2026-11-19 11:17:21 -08:00
dotCooCoo fb0a82b095 Distort: keep blend steps, saved corners, previews and deep masks right
- A blend step whose interpolated corners and nearer key's corners both
  fail the check is placed as the nearer key is.
- Corners an image can't take are dropped when a file is read, so a
  later transform does not make them its distortion.
- The .ai editing data writes a distorted image at any nesting depth, as
  it does a gradient mesh, so an opacity mask at the limit keeps it.
- A linked image's preview keeps the clipping path its file keeps, so a
  document reopened from its preview still knows the file's clip group
  and Update Links replaces it instead of nesting a new one.
- Docs: `corners` in the plugin API covers only corners that are not a
  parallelogram; Relink's warning for distorted images needs `preserve`.
2026-11-18 17:44:10 -08:00
dotCooCoo 621c06bd26 Free Transform: distorted images keep their corners and placement through files, exports and refusals
- A file's corners are kept only when there are exactly four that the
  image can take; a longer list is skipped without decoding it. Corners
  the affine map misses stay a distortion, and a scale past the
  perspective limit leaves the image at its nearest affine placement.
- Distort checks the corners in a frame local to the quad, so a missed
  corner far from the origin is still refused.
- Relink and Unembed refuse a named or selected distorted image before
  searching a folder or writing a file. Create Gradient Mesh lists the
  distorted images it leaves in `skipped`. Place with Replace refuses
  only when the measured image is distorted and the file is not text.
- SVG cuts a distorted image in a scaled symbol instance at the placed
  size. EMF pieces store only the pixels inside their clip. PDF mesh
  pieces of a CMYK image keep a same-corner mask as its soft mask, color
  mask included. Both `.ai` writers write an image at the nesting limit
  at its nearest placement with a warning. DXF warns only when it writes
  the image.
- The canvas cuts the mesh by the view's largest stretch. Warped images
  with a singular placement keep finite corners.
- docs/mcp.md and docs/plugins.md describe the tolerances, the DXF and
  WMF fallback, the partial result of Create Gradient Mesh, and when a
  plug-in sees `corners`.
2026-11-18 17:13:56 -08:00
dotCooCoo d6bc984cad Merge main into feat/distorted-image-commands 2026-11-18 16:24:18 -08:00
dotCooCoo 45835405a5 Merge main into feat/distort-images 2026-11-18 01:42:11 -08:00