Let `clai2` plugins drive the prompt with `PluginHost.send_input`, `interrupt`, `complete`, and `sessions`
Part 1 of 3 of a browser UI for clai2 (stack: this PR → #10262 → #10263). No linked issue: built at the CLAI maintainer's request.
Why. A plugin that is another way to use CLAI, such as a web UI, needs to type at the prompt, stop a turn, offer Tab completion, and manage saved sessions. PluginHost offered none of that: submit_prompt only works inside a command handler, and plugins cannot reach the command registry or the session store. Command results never reach plugins either, since /commands never go through the agent (no core hook sees them).
New public surface
PluginHost.send_input(text): enter text as Enter at the prompt does (trimmed, bareclear→/clear,during_turncommands open over a running turn, otherwise queued like a typed follow-up). Input entered before the editor opens waits for it.PluginHost.interrupt(): cancel the running turn or command, as Esc does.await PluginHost.complete(text): what Tab offers, computed in a worker thread.PluginHost.sessions: SessionCatalog | None:listing,saved,rename,fork,deleteover the store/resumeuses (implemented byruntime/sessions.pySessions). As in/resume, a fork copies the session'srun_codeREPL and a delete removes it (#10256).Plugin.on_command_end(CommandEnd(text, output, error)), fired by the shell for every command that finishes, outside the scope Esc cancels, including a/pluginsrefused while delegated tasks run; a cancelled command fires nothing.
User-visible behavior. None for existing users. The shell gains an inbox read only when no editor and no line-mode prompt read input, which no existing launch path hits.
Verification. tests/clai2/test_host_input.py: a headless shell driven entirely through send_input, normalization, interrupting a real turn while a during_turn command opens over it, input entered from on_session_start reaching the live editor, the refused-/plugins CommandEnd, and every SessionCatalog method.
What changes for existing users. Nothing.
- No breaking changes in accordance with the version policy.
- Any permitted compatibility impact has a label, warning, migration, release note, and exact API-check waiver.
- PR title is fit for the release changelog.