mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-05 13:32:45 -05:00
A dialog that holds its OK files the answer for the app, which accepts or
refuses it in the next dialog pump. `ui.dialog.confirm` and `ui.dialog.set`
with `action: "confirm"` replied `{"ok": true}` as soon as the answer was
filed, so a client could not tell that the app refused it (a color
adjustment confirmed while another document is active) and the dialog
stayed open.
`ui.dialog.set` with an `action` also replied with the reply to the
confirm or cancel alone. The MCP `answer_dialog` tool reads a reply
without a `dialog` key as an app that did not answer the dialog, and
sends another `ui.dialog.confirm` or `ui.dialog.cancel`: after an
accepted OK that call failed with "no hosted dialog is open" or answered
the dialog under it.
- Both confirm paths answer with `dialog_reply`, and the app holds the
reply of a confirm that waits on the dialog's held OK until the app
answers that opening of the dialog.
- A set with an `action` replies `{dialog, result}`: the dialog as the
set left it, and the reply to its confirm or cancel, also once a held
OK is answered. This covers the hosted dialogs, Preferences and
ScriptUI dialogs; the Simplify and Smooth sliders already replied this
way.
- A held reply shows the paths outside the read root that the request
sent by their file names, as a reply sent at once shows them.
- The app polls the held replies right after the dialog pump, before the
next pass closes an accepted dialog, and after the control requests.
- While a confirm waits on a held OK, the control logic asks for a pass
(a paint while the window is hidden), so a minimized window answers
too. A dialog whose OK waits with no confirm on it, such as Print
during its printer lookup, does not keep the window drawing.
- docs/control-protocol.md describes the held reply and its errors.