mirror of
https://github.com/storytold/figcraft.git
synced 2026-10-30 05:16:56 -06:00
M12: MCP comment feedback and live change events
Comments become the task queue for an attached or headless MCP client: comment.prompt returns a bounded Markdown brief, the Comments panel gains Copy for AI, and the MCP server exposes fix_comments, watch_comments, figcraft://comments and wait_for_changes. Mutating comment.* commands append to a bounded in-memory event log; the control channel's events.poll long-polls it without the UI thread, and a successful batch commits its events only if the whole batch lands. No model, network dependency, asset or file-format change.
This commit is contained in:
@@ -123,6 +123,26 @@ it and duplicate it:
|
||||
|
||||
Every command: `[{id, label, params, menu, shortcut, undoable}]`.
|
||||
|
||||
### `events.poll {after?, timeoutMs?, topics?, limit?}`
|
||||
|
||||
Wait for live changes: the app's in-memory event log records `comment.added`, `comment.replied`,
|
||||
`comment.edited`, `comment.reacted`, `comment.resolved`, `comment.moved` and `comment.deleted`
|
||||
(`topics`: `comments` (default), `document`, `all`). Only comment events are emitted today;
|
||||
`document` and `all` are accepted for forward compatibility. Returns pending events after `after`
|
||||
at once, otherwise waits up to `timeoutMs` (default 20 000, max 25 000; 0 = no wait):
|
||||
|
||||
```json
|
||||
{"id":1,"method":"events.poll","params":{"after":41,"timeoutMs":20000}}
|
||||
{"id":1,"ok":true,"result":{"events":[{"seq":42,"kind":"comment.added","document":"Checkout","path":"…","data":{"commentId":12}}],"cursor":42,"reset":false,"dropped":0}}
|
||||
```
|
||||
|
||||
`cursor` is the sequence to pass next; `reset: true` means `after` is ahead of the log (the app
|
||||
restarted) and the caller should re-read the comments; `dropped` counts events lost because `after`
|
||||
is older than the retained window (1024 events). The method is answered by the control worker
|
||||
against the shared log, not by the UI thread, so it does not freeze the app, use a request slot, or
|
||||
need a drawn frame: it works while the window is minimised. Other requests on the same connection
|
||||
wait until the poll finishes (at most 25 s); use a separate connection to keep editing meanwhile.
|
||||
|
||||
### `document.inspect {depth?, allPages?}`
|
||||
|
||||
The active document as JSON: name, path, dirty, currentPage, selection, pages (the current page's
|
||||
|
||||
Reference in New Issue
Block a user