Document several live sessions for `clai2` plugins and users: `Plugin.scope`, `host.live`, and the web UI
Part 9 of the clai2 multi-session stack (#10468 → #10469 → #10477 → #10485 → #10494 → #10495 → #10504 → #10541 → this PR). Based on #10541. No linked issue: requested by the CLAI maintainer.
Why. The stack lets one CLAI process keep many sessions live, each with its own folder, plugins, and running turn, and the maintainer decided process-scoped plugins are public. Plugin authors need the rules that keep a plugin correct when several instances run at once, and users need to know what the web UI and terminal now do.
New public surface. None in code. This PR writes the public contract for Plugin.scope and PluginHost.live (LiveSessions, LiveSession), which the base branch already exports.
What changes
PLUGINS.md: a new Several live sessions section with six rules (one instance per live session,host.workspaceinstead ofPath.cwd()/os.chdir, no module-level mutable state, checkhost.console.is_terminal,on_session_endmay come from idle closing with'exit', bounded background tasks), and One instance for the whole process:scope = 'process', the public contract for:Plugin.scope: ClassVar[Literal['session', 'process']]PluginHost.live: LiveSessions | None, with tables for everyLiveSessionsmember (listing,get,current,open,new,close,subscribe) andLiveSessionmember, plus a shortTurnsexample.
PLUGINS.md: thewebsection rewritten for per-session opening (host.live.open/new, watchers, idle close, status fromlive, Esc per session,/webfrom a terminal); the orchestrator runs on the saved default model; the session moments table names live sessions.docs/declarative-plugins.md: the scope design note.docs/reference.md: Several sessions in the web UI (click opens live, status dots, idle close after an hour, Esc, settings fan-out, read-only, terminal focus,/reload//updaterefusals).README.mdtour entry;clai2_web_README.mddrops the "moves CLAI" text and the stale/webfallback.AGENTS.md/FILE_MAP.md: per session onSessionRuntime, per process onClaiProcess, never the other way;chatopens sessions beside the terminal.
Verification. Every documented name and signature was checked against the code merged from mike/clai2-multi-8-terminal-focus (plugins/__init__.py, process_plugins.py, live_runtimes.py, session_runtime.py, terminal.py, web/service.py). No doc-example test covers PLUGINS.md, so the Turns example was run with load_plugin and a JoinedSessions host (Counter({'/tmp/a': 1}) ['1 running, 1 done']), and passes ruff check, ruff format --check, and pyright strict. All new anchors resolve. tests/clai2/test_plugin_loader.py and test_customization.py pass (74).
What changes for existing users. Nothing: documentation only.
Checklist
- 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.