Commit Graph
80 Commits
Author SHA1 Message Date
BFlat 6b978fea4f Merge pull request #6223 from dotCooCoo/feat/plugin-filter-inputs
Plug-ins: filters can ask to read type, images and symbol instances
2026-11-09 12:09:05 +08:00
BFlat 36f83042e6 Merge pull request #6272 from dotCooCoo/fix/plugin-remove-revision-under-lock
Plug-ins: removing a plug-in moves the revision while it holds the set
2026-11-09 11:47:33 +08:00
dotCooCoo 5cb09720a4 Merge main into feat/plugin-filter-inputs 2026-11-08 19:34:12 -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 529dcb5c64 Merge main into feat/plugin-filter-inputs 2026-11-08 19:06:11 -08:00
dotCooCoo d8dd718d90 Merge main into fix/plugin-remove-revision-under-lock
# Conflicts:
#	docs/mcp.md
2026-11-08 18:57:28 -08:00
dotCooCoo 8a774d344a Plug-ins: removing a plug-in moves the revision while it holds the set
registry::remove released the plug-in set before it moved the revision, as install does not. A removal that finished just before another thread took the set could still move the revision while that thread held it, which made an_install_changes_the_revision_only_while_it_holds_the_set fail intermittently.
2026-11-08 18:45:31 -08:00
dotCooCoo bd5ea2a1bf Merge main into feat/plugin-effect-paint 2026-11-08 17:59:33 -08:00
dotCooCoo e82ed4642e Merge main into feat/plugin-filter-inputs 2026-11-08 17:50:28 -08:00
dotCooCoo d6a91b6142 Merge main into feat/plugin-effect-paint 2026-11-08 17:26:35 -08:00
BFlat b652599548 Merge pull request #6264 from dotCooCoo/feat/plugin-importers
Plug-ins: importer plug-ins open file types VectorCraft does not read
2026-11-09 09:24:07 +08:00
dotCooCoo c629753af1 Plug-ins: settings and the cache total stay in memory between storage calls
A settings get no longer reads and parses settings.json each time. The
parsed settings are kept per plug-in folder and read again only when the
file's size or modified time changes. A set to the value a key already
has writes nothing, and every other change is written with an atomic
write before the call returns. plugin.remove drops the kept copy.

cacheBytes in plugin.list, plugin.info and plugin.install comes from a
total kept while the cache folder keeps its modified time, instead of a
listing of up to 8,192 items per call. A cache write still lists the
folder to enforce the caps.

docs/plugins.md states what a run counts and that a cache call moves a
whole entry in one step. docs/plugins.md and docs/mcp.md now say when a
later plugin.remove retries a leftover .removed folder.
2026-11-08 17:17:34 -08:00
dotCooCoo 80558fa273 Merge main into feat/plugin-filter-inputs 2026-11-08 17:09:58 -08:00
dotCooCoo 918ef940cb Merge main into feat/plugin-importers 2026-11-08 16:45:20 -08:00
dotCooCoo efe204bb55 Merge main into feat/plugin-filter-inputs 2026-11-08 16:20:15 -08:00
dotCooCoo 2af6f54eab Plug-ins: oversized TIFFs stay out of a filter's decoder, and read-only ids compare by value
A TIFF with more strips and planes than the decoder can count comes to a filter as "unknown"
with no pixels, instead of panicking in the metadata read. An output that writes a read-only
object's id as 17.0 now names that object, as other numbers in the object compare by value; a
fractional id still names no object.
2026-11-08 16:01:40 -08:00
dotCooCoo 3f484c4f0d Plug-ins: type's runs and paragraphs are measured as they are built for a filter
Building a type input's runs and paragraphs stops at the first one past what is left of the text
and input totals, instead of building all of them before the size check.
2026-11-08 16:01:40 -08:00
dotCooCoo 988da4538a Merge main into fix/plugin-grant-module-hash 2026-11-08 15:55:53 -08:00
dotCooCoo ab029e1b53 Plug-ins: an image too large to count its pixels comes without them
An image object whose width times height overflows is given with pixelsOmitted instead of
overflowing the size check.
2026-11-08 15:37:36 -08:00
dotCooCoo 606077386c Plug-ins: a filter reads a CMYK image's pixels through the working CMYK profile
A CMYK image's pixels are now its inks shown through the working CMYK profile, by a table built
the way the canvas builds its own, instead of the image decoder's own conversion to RGB.
2026-11-08 15:37:36 -08:00
dotCooCoo 027dc8894d Plug-ins: a filter run given more read-only objects than an output lists fails up front
An output lists at most 100,000 objects and must return every read-only object, so an input with
more than that many is now an object-budget limit before the plug-in starts.
2026-11-08 15:37:36 -08:00
dotCooCoo 5540a5e797 Plug-ins: an oversized path fails a filter run, and objects that clip stay out of its input
A path or compound path that doesn't fit what is left of the input now fails the run with the
runtime's own "selection is too large to hand over" limit before the rest of the selection is
written, instead of later read-only objects reporting a size error. Objects that clip a clip
group are left out for every filter: compound paths and paths inside a group that clips one
reached filters before, as type, images and symbol instances did.
2026-11-08 15:37:36 -08:00
dotCooCoo 64c7c2703e Merge main into feat/plugin-menu-commands 2026-11-08 14:41:13 -08:00
dotCooCoo 5366b9e323 Merge main into feat/plugin-filter-inputs 2026-11-08 14:19:35 -08:00
dotCooCoo e4e6e0d382 Plug-ins: a painted piece linked to a global swatch follows its color
A piece linked to a global swatch is drawn in the swatch's current color at its own tint, and kept art and rasters follow a color or spot edit and its Undo. A value of `paintOutput` other than true is refused by a translated error. Tests in the effects crate pass the new document argument.
2026-11-08 13:45:17 -08:00
dotCooCoo 11703bd350 Merge main into feat/plugin-effect-paint 2026-11-08 12:56:42 -08:00
dotCooCoo a717e34f02 Merge main into fix/plugin-grant-module-hash 2026-11-08 12:55:59 -08:00
dotCooCoo d5bb58aad5 Merge main into feat/plugin-importers 2026-11-08 12:38:22 -08:00
dotCooCoo 9518dc0e3a Merge main into feat/plugin-importers 2026-11-08 12:33:17 -08:00
dotCooCoo 26804fb0c4 Plug-ins: tests hold an importer to its budget and hostile extensions in the manifest fuzz
An import's instruction and time budgets are now host limits on Limits, as a heavy filter's are, so a test can give an importer a small budget. An importer past its instruction or time limit, and a file past the input limit, return their error and leave an open document and its undo history unchanged. The manifest fuzz varies extensions (missing, dotted, mixed-case, repeated, too long and too many).
2026-11-08 12:29:27 -08:00
dotCooCoo 85a933ad4f Keyboard Shortcuts: each Object › Plug-ins filter has a row of its own
Squashed from #6246 onto main.
2026-11-09 03:14:41 +07:00
dotCooCoo 218c711181 Plug-ins: a plug-in keeps settings and a cache of its own
Squashed from #6228 onto main.
2026-11-09 02:54:33 +07:00
dotCooCoo 64817c2e8c Merge main into feat/plugin-effect-paint 2026-11-08 10:46:47 -08:00
dotCooCoo 79351d7063 Merge main into feat/plugin-importers 2026-11-08 10:25:28 -08:00
dotCooCoo f2e18da4fa Merge main into fix/plugin-grant-module-hash 2026-11-08 10:25:03 -08:00
dotCooCoo b5e6f6e80f Plug-ins: Safe Mode starts without plug-ins, offered after a launch stops while one loads
Squashed from #6185 onto main.
2026-11-09 00:30:24 +07:00
dotCooCoo 3d80b6a133 Plug-ins: the kind-mismatch error reads correctly for importers and exporters, and a failed import leaves the open document alone
A plug-in of the wrong kind now gets "is a plug-in of kind `exporter`, not an importer", with rows in every complete-message catalog. The importer failure test also covers an open, edited document. docs/plugins.md states that Open Recent does not remember Open With's importer or parameters.
2026-11-08 09:13:30 -08:00
dotCooCoo 7aa7890a10 Plug-ins: a painted result names swatches and patterns of the document it draws in
The reference check now applies wherever a painted effect's geometry is
used: a result whose swatch or pattern is refused keeps its input instead
of giving its geometry. Pathfinder art of type, reshaped groups, compound
shapes, image fills, the renderer's bounds and Object > Expand look the
references up in the document, and the renderer drops its kept bounds and
geometry when the names of the swatches or patterns change.
2026-11-08 09:04:23 -08:00
dotCooCoo 80770bb5fe Plug-ins: an install changes the revision with the plug-in set locked
A cache keyed by registry::revision could read the new revision before
the plug-in was in the set and keep the old list under it, so File > Open
and document.formats left out a newly installed importer until the next
install or removal. The revision now changes while install holds the
write lock, and a reader that sees it waits for the set.
2026-11-08 08:55:08 -08:00
dotCooCoo 91d9639e6a Plug-ins: a permission grant covers only the module that was approved
A grant records the module's SHA-256, but only its permissions were
compared, so a module with other bytes under a granted id inherited the
grant when it listed no new permission.

A grant now covers a module only when the id, the SHA-256 and every
listed permission match. plugin.inspect reports needsApproval for a
changed module, plugin.install refuses it without a new grant and leaves
the installed module and its grant as they are, Install Plug-in and
File > Open ask again, and the plug-in store and plug-in folders skip it.
The same bytes install again without asking, and a module with no
permissions list or an empty one needs no grant. A grant whose hash is
not 64 lower-case hexadecimal digits covers nothing.

plugin.install still trusts the client that sends grant; the docs say so.
2026-11-08 08:40:00 -08:00
dotCooCoo 9f2db12ec2 Plug-ins: a painted live effect's paint keys are checked at every level
A key that a paint does not have, such as `opacity` on a solid fill, was
dropped when the paint was read, and the fill was drawn opaque. The
result is now refused and `lastError` names the field, for keys on the
paint and on its colors, gradient, stops, placement and freeform points.
2026-11-08 07:24:55 -08:00
dotCooCoo 96bdb813a6 Plug-ins: read-only inputs count toward the input's memory share
A filter's input is now encoded within the half of the plug-in's memory
cap that the input and the parameters share. Every object counts toward
it in paint order, with its id, bounds, transform and name. Type runs
and image pixels that don't fit what is left come with truncated or
pixelsOmitted, and a type, image or symbol instance whose other fields
alone don't fit fails the run before the plug-in starts with
"memory budget (object N needs S bytes of input, L left)".
2026-11-08 04:42:17 -08:00
dotCooCoo 7a38e2c990 Merge main into feat/plugin-menu-commands 2026-11-08 02:04:06 -08:00
dotCooCoo 66a01584ae Plug-ins: inputs need a granted doc.read and stay within totals
A filter manifest that lists `inputs` must now list `doc.read` in
`permissions`, so installing it asks the user to grant them and the
Additional Plug-ins Folder loads it only once granted. Left out, the
manifest does not install.

The pixels of all images in one filter input take at most 16 MiB of
base64, and the runs and paragraphs of all its type at most 16 MiB of
JSON. An image whose pixels do not fit what is left comes with
`pixelsOmitted`, checked before it is decoded, and type that does not
fit comes with `truncated`. The read-only objects are kept once and
written into the input from there.

A field a filter adds to a read-only object is named in the refusal
with control and bidirectional characters escaped, cut to 64
characters.
2026-11-08 00:15:36 -08:00
dotCooCoo a3c37ea1f4 Merge main into feat/plugin-importers 2026-11-07 23:49:11 -08:00
dotCooCoo c2f0a5667f Merge main into feat/plugin-effect-paint
# Conflicts:
#	crates/engine/src/cmd/plugin.rs
#	crates/engine/src/store.rs
#	crates/engine/src/tests/plugins.rs
#	crates/engine/tests/plugin_fuzz.rs
#	crates/plugins/src/lib.rs
#	crates/plugins/src/manifest.rs
#	crates/plugins/src/permissions.rs
#	crates/plugins/src/runtime.rs
#	crates/ui-egui/src/i18n/bg.tsv
#	crates/ui-egui/src/i18n/bs.tsv
#	crates/ui-egui/src/i18n/ca.tsv
#	crates/ui-egui/src/i18n/cs.tsv
#	crates/ui-egui/src/i18n/da.tsv
#	crates/ui-egui/src/i18n/de.tsv
#	crates/ui-egui/src/i18n/el.tsv
#	crates/ui-egui/src/i18n/es.tsv
#	crates/ui-egui/src/i18n/fi.tsv
#	crates/ui-egui/src/i18n/fr.tsv
#	crates/ui-egui/src/i18n/hi.tsv
#	crates/ui-egui/src/i18n/hu.tsv
#	crates/ui-egui/src/i18n/id.tsv
#	crates/ui-egui/src/i18n/it.tsv
#	crates/ui-egui/src/i18n/ja.tsv
#	crates/ui-egui/src/i18n/ka.tsv
#	crates/ui-egui/src/i18n/ko.tsv
#	crates/ui-egui/src/i18n/nl.tsv
#	crates/ui-egui/src/i18n/pl.tsv
#	crates/ui-egui/src/i18n/pt-br.tsv
#	crates/ui-egui/src/i18n/ru.tsv
#	crates/ui-egui/src/i18n/sv.tsv
#	crates/ui-egui/src/i18n/tr.tsv
#	crates/ui-egui/src/i18n/uk.tsv
#	crates/ui-egui/src/i18n/vi.tsv
#	crates/ui-egui/src/i18n/zh-hans.tsv
#	crates/ui-egui/src/i18n/zh-hant.tsv
#	crates/ui-egui/src/io/open.rs
#	crates/ui-egui/src/tests/plugins.rs
#	docs/mcp.md
#	docs/plugins.md
#	docs/target-app-parity.md
2026-11-07 23:43:15 -08:00
dotCooCoo 68609fb43b Plug-ins: filters at API level 2 read type, images and symbol instances
A filter manifest at `api` 2 may list `inputs` (`type`, `image`,
`symbolInstance`). Such a filter is also given the selected objects of
those kinds, read only: type with its runs and paragraph attributes,
images with their pixel size, color mode and, when embedded and small
enough, their RGBA pixels in base64 (never a linked file's pixels or
path), and symbol instances with their symbol and transform.

The output must return each read-only object as {"id": ...} alone or
exactly as given. A change, an omission or a duplicate is refused
before the edit, so the document and undo history stay as they were,
including for output handed in from a heavy run. A filter without
`inputs` gets the same input bytes as before.

A manifest that lists `inputs` below `api` 2, outside a filter, with an
unknown or repeated kind, or with a permission list that lacks
`doc.read` does not install.

Part of #4333
2026-11-07 23:34:20 -08:00
dotCooCoo b109378ae6 Plug-ins: live-effect plug-ins at API level 2 can paint the pieces they return
A live effect whose manifest has "api": 2 and "paintOutput": true returns
{"objects": [...]} as pieces, each drawn by itself in order with fills and
strokes of its own in the forms a filter returns. A piece without fills or
strokes keeps the ones the effect was given, and an empty list paints none.
An effect on a fill returns only fills, one on a stroke only strokes.

The whole result is checked before any of it is drawn: the output limits,
finite numbers in range with nothing clamped, known keys only, and every
swatch and pattern it names in the document. One fault draws that step of
the stack unchanged, keeps the effect record and puts the plug-in's name
and the field in plugin.info's lastError. Each piece counts against the
geometry-effect budget, so the painted effects of one stack make at most
100,000 pieces.

The pieces are drawn, measured and exported to PDF and SVG from the
appearance stack without changing the document, and Expand Appearance
writes them as ordinary paths in one undo step. The plug-in API level
rises to 2; plugin.list and plugin.info give api and paintOutput. Effects
without the key behave as before.
2026-11-07 23:22:11 -08:00
dotCooCoo fd94ebe86c Plug-ins: importer plug-ins open file types VectorCraft does not read
An importer plug-in (kind "importer", permission import.read) lists 1 to 8
file extensions and turns a file's bytes into objects, which open as a new
document whose artboard is their bounds. File › Open lists its extensions,
File › Open With (file.openWith) opens a file with a chosen importer, and
document.open takes importer and params. A built-in format that reads the
file by its content or extension always opens it; among importers listing
the same extension, the one whose id sorts first opens it. An importer reads
at most 128 MiB, and Place still reads only the built-in formats.

Docs: docs/plugins.md, docs/mcp.md, docs/gaps.md, docs/target-app-parity.md.
2026-11-07 23:05:09 -08:00
dotCooCoo 1bcd19e6b6 Plug-ins: a run keeps the fuel left in a slice at a bulk memory instruction
wasmi pauses a run before an instruction the store's fuel can't pay for
and charges nothing for it. A memory.fill or memory.copy is charged for
its whole length, so a pause can leave up to that cost in the store.
Plugin::call replaced the store's fuel with the next slice and compared
the instruction's cost with the rest of the budget alone, so a run whose
budget covered its work could end with Limit("instruction budget").

Each pause now tops the store up to the slice size, keeping what it
held, and ends the run only when the store's fuel and the rest of the
budget together can't pay for the next instruction.
2026-11-08 13:23:34 +07:00