A rollback now gives back every event pushed out after the first one an undone open pushed out, newest first while there is room, so the waiting queue keeps the newest events as if the opens had never been queued. Between script slices, a frontend event waits behind an older frontend event that a failed run can still give back, and the record of the script's opens forgets those no event refers to any more.
When a script run failed, the document.opened events its commands queued
were dropped, but the events those opens had pushed out of the waiting
queue (a document.saved, for example) were not put back, so plug-ins never
received them. A failed command.batch already put them back.
Each pushed-out event now records which event pushed it out, and the
running script's opens are tracked by their queue sequence, so both
rollbacks share one path. A delivery between script slices keeps the
events the script's opens pushed out until the run ends, and a full store
of pushed-out events no longer loses that link when it drops an open.
The fault came with 01ec822509.
- A commit or cancel with no drag open no longer ends an interaction for
plug-in events.
- A host query that panics during a handler still puts the session back.
- Handler calls after a replayed command are checked as calls from outside.
- A rolled-back batch puts back the events its opens pushed out of the
32-event queue.
- Installing a plug-in again, the same module included, turns its events
back on; plugin.info's eventsOff follows the same rule.
- A document added before the first check records its baseline.
- Handler failures show in the status bar from their English templates,
translated when shown, and event handler time counts toward the frame
time.
- Tests check that the handler ran in the tested pass, and the script-run
test no longer writes to other sessions' status bar.
A command.batch checked the documents for plug-in events before its
steps even when no drag or typing was open, so a selection that the
batch put back as it was reached plug-ins as selection.changed. The
check now runs only when the batch settles an interaction, or when the
installed plug-ins differ from the last check's. Otherwise the batch
only drops queued events for removed plug-ins and closed documents,
and the snapshots of closed documents.
Each handler is given its layer.changed reasons directly instead of
looking them up among the event's recipients.
Event checks no longer compare documents while a script runs, so a script
that throws after a command.batch gives no event for its discarded working
copy. A batch that settles an open drag records the plug-in baselines before
its own steps edit, so a plug-in loaded during the drag gets the batch's
changes. Delivery looks recipients up in a map built once per delivery and
drains served recipients once per event.
A layer change seen when a command.batch step settled its interaction was
queued before the batch finished, so a failed batch still reported it. The
check now waits until the outermost command ends.
Delivery under the frame budget now serves recipients in the order they
were added to the event, so recipients re-added by a coalesced change no
longer take the budget ahead of ones still waiting.
The frame-budget tests use a session-local subscriber list instead of the
shared plug-in registry.
- Headless tool gestures deliver plug-in events once their actions finish,
and a drag set aside by a command holds events until it ends.
- Documents added in a batch are compared with their state when added.
- Background plug-in loads record the event baseline when they install, or
after commit or cancel when a drag is open.
- Layer snapshots are compared by id through a map.
- Each desktop frame runs at most four handlers across background delivery
and every UI pass, and asks for another frame while handlers remain queued.
A delivery between a script's slices no longer gives the opens and saves the
script queued; they wait until the run ends, so a run that fails never gives
the opens of documents it discarded. The desktop app now delivers after the
window keys run, so a selection Escape changes when it leaves isolation mode
reaches plug-ins in that pass, and the handlers' time counts toward the frame
time. The docs state the per-document grouping and the script rule.
A script that opens a document and then throws, runs out of budget or is
abandoned loses that document with its working copy, so its waiting
document.opened event is now dropped when the run ends. The saves it made
before failing are still delivered, and so is a document the frontend opened
while the run was paused.
- A waiting event names each recipient by its installation serial too, so a
module that another session removed and installed again is not given an
event from before.
- A merged layer.changed keeps the reasons per plug-in: one installed between
two changes is given only the later change's reasons.
- Delivery waits while an interaction is open; the events go out at the first
delivery after it ends.
- A failed top-level request still delivers what finished before the failure,
such as a save in a command.batch whose later step fails. A document.opened
for a document that the rollback closes again (a batch, or a failed command
of a script or a plug-in call) is dropped.
- An event's handler checks the deadline before vc_alloc and before vc_event.
- The shared-budget test uses a small instruction budget and checks for an
instruction-budget error, and the UI test removes its plug-in when it ends.
A plug-in at API level 2 with the new `events` permission can name any of
`selection.changed`, `document.opened`, `document.saved` and
`layer.changed` in its manifest's `events` list. Its `vc_event` export is
then called with a small JSON event after each change of that kind has
finished, outside any undo step. Changes between two deliveries are one
event. The desktop app delivers twice a frame, after the work that
finished in the background and at the end of the frame after the canvas,
panels and dialogs ran; control-channel requests run in the desktop app
and are delivered by the frame. vectorcraft-cli and headless MCP deliver
after each request. A plug-in installed after a change is not given it,
and a change made after an install reaches the new plug-in at the next
delivery.
- A handler only reads. It may call ten commands that read
(dataset.list, graphicStyle.list, guide.list, image.info,
object.blend.info, swatch.list, symbol.list, text.getRange,
transparency.info and variable.list); any other call fails before it
runs with an error naming the event. After each call every document
with its selection, current layer and undo history, the active
document, the paint defaults, the active Appearance row and the
preferences are put back, and a call that changed a document is
refused.
- A handler gets 5 M instructions and 200 ms, shared by the module's start
function, `vc_alloc` and `vc_event`. A handler that fails 3 times in a
row gets no more events until VectorCraft starts again.
- An event raised while a handler runs waits for the next delivery.
- Events carry the document number and counts; selected ids (at most
2,048) only with `doc.read`. No paths or file contents.
- A save that finishes after its document closed is still reported.
- A document opened or created since the last delivery is compared with
its state when the command that added it ended, so the first change
made to it is an event.
- A waiting event is dropped for a plug-in that was removed, so the same
module installed again is not given it.
- The desktop app delivers the events of a script in the frame the script
ends in.
plugin.list and plugin.info report `events`, `eventsOff` and
`lastEventError`. Docs: docs/plugins.md (Events), docs/mcp.md and one
progress line in docs/target-app-parity.md. The new plug-in messages, the
status lines for a failed handler and the permission's words in Install
Plug-in... have rows in every complete catalog.