Files
hermes-agent/website/docs
Binshao a874cee625 feat(desktop): expose composer draft API to plugins (host.composer)
Implements item 1 of #116305 as a thin facade over the app's own composer
bus — no new state, no behavior change for non-plugin paths:

- host.composer.getDraft/setDraft/insertText/submit(sessionId | null, ...)
  addressing: null = active, stored/runtime id = that session's primary or
  tile surface, 'new' = the session-less fresh draft.
- focus.ts: hermes:composer-get-draft / -set-draft request/reply pair
  (50ms timeout settles null/false; a non-answering subscriber can never
  strand the caller).
- use-composer-draft.ts: mounted composers answer for their live DOM text
  (paintDraft owns writes, so @-ref / / tokens hydrate as chips like
  official paste); hidden keep-alive surfaces answer too — paintDraft
  never steals a visible caret.
- store/composer.ts: export NEW_SESSION_DRAFT_KEY for address mapping.
- tests: bus-level (focus.test.ts, 5) + facade-level (sdk/index.test.ts,
  4: addressing, live read, stash fallback, timeout-null, refused write).
- docs: 'Composer draft API' section in desktop-plugin-sdk.md.

Unblocks the DOM-reach-in in prompt-snippets (#116030), prompt-enhancer
(#116031), and the insert path of appearance-hub (#116049).
2026-09-24 00:01:41 -07:00
..