Host API: commands, events, and agents
The minimal stable contract for a pilot: lifecycle, save, view, state queries and commands; the ready, dirty, saved, and error events; the agent route.
Embedding needs a small, stable contract, not access to hundreds of the desktop app’s internal channels.
Minimal Host API for a pilot
Section titled “Minimal Host API for a pilot”| Group | Examples | Why you need it |
|---|---|---|
| Lifecycle | mount, unmount, open, close |
Create a session and close it cleanly. |
| Save | save, saveAs, checkpoint |
Return a confirmed result to your storage. |
| View | focus, setReadOnly, setLocale, setTheme |
Fit the surface into your application’s environment. |
| State queries | getVersion, getCapabilities, getStatus |
Find out the contract version and which features are available. |
| Commands | Editing, formatting, undo and redo, review actions | Apply only permitted changes. |
Events your application receives
Section titled “Events your application receives”-
ready— the document is parsed and the surface is ready to accept agreed actions. -
dirty— a change was accepted, and an unsaved revision has appeared. -
saved— the write is complete, and you can register the result as a version on your side. -
error— the operation failed; you get a code and a description of the cause that contains no document content. -
unmounted— the surface was removed from your window; after this, the session no longer responds.
Agents and automation
Section titled “Agents and automation”An agent shouldn’t impersonate a user by clicking. The order is different: open a session, find out the available capabilities, request a bounded slice of the document, find a stable reference to the needed spot, propose a point edit, apply it with the expected revision given, check the result, save, and reopen the file. Every step of this route can be logged, constrained by rules, and repeated — none of that is possible with clicks on the screen.