Repository navigation
feat: AI sidebar driving agent CLIs over the in-app MCP surface - #83
Merged
Merged
Conversation
A new right-hand panel (View AI Panel, Cmd/Ctrl+Shift+A) chats with a coding-agent harness whose hands are Schist's own MCP tools, pointed at the document open in the window: edits stream onto the canvas as they happen, each one an ordinary undoable history entry. Two backends, both through their SDKs rather than hand-parsed CLI output Claude Code via the Claude Agent SDK's Rust port (claude-agent-sdk-rs), Codex via its app-server protocol (codex-codes). No API keys: the panel drives the CLI the user is already logged into, and says so when neither is installed. To host that, crates/mcp becomes a library plus the unchanged stdio binary. The per-session operations move onto SessionCtx borrowed views of a document, editor state and registry so the headless server and the app share one dispatch, and a new catalog Scope::Active publishes the same ~250 tools with no session id and no session management: the current document is the whole contract, and switching tabs mid- conversation retargets the next call. Claude Code needs no plumbing at all the SDK routes MCP through an in-process server, answered on the UI thread between frames. Codex spawns MCP servers as processes, so the app listens on a token-guarded loopback port and Codex spawns `schist --mcp-bridge <addr>`, this same binary pumping stdio into that socket (which also lets any stdio MCP client reach a running app). Codex runs read-only/never-approve; its per-tool-call elicitation is accepted the only server in the profile is our own and command/file approvals are declined. Learned the hard way, encoded here: unknown CLI message types (rate_limit_event) must not kill a turn; a bridge request queued in the instant the drain ticker stands down needs a reply timeout; escape has to join the cancel_gesture chain because the always-on binding preempts key listeners. Both backends verified headlessly end to end (invert + undo via Claude, invert via Codex, canvas and history updating live). Co-Authored-By: Claude Fable 5 <[email protected]>
A dropdown under the panel header, remembered per harness (the slugs do not travel between them). "Default" defers to the CLI's own configuration; the Claude entries are the tier aliases the CLI resolves itself (Opus, Sonnet, Haiku) and the Codex list is the SDK's bundled catalog, so it tracks the crate rather than us. The choice applies from the next message without restarting the conversation: Claude Code switches its live session over the control channel (set_model, told only when the selection changes), Codex takes the model as a per-turn override on turn/start. Verified against the real CLI: after picking Haiku, the session log shows every request on claude-haiku-4-5. Co-Authored-By: Claude Fable 5 <[email protected]>
…catalogs The Model row and the header's harness toggle are gone. In their place, a chip beside Send opens one picker for both decisions: a search box, a rail with a mark per installed harness, and rows named the way model pickers name things "Claude Fable 5", "GPT-5.6-Terra" each with the harness and its own description underneath. Search spans every installed harness; picking a row picks harness and model together. The lists are live, not a hardcoded catalog: Claude Code reports its account's models in the Agent SDK's initialize handshake (the same list its /model picker shows) and Codex answers model/list on its app-server, each probed once per run by a short-lived spawn, with the static catalog as the fallback. Claude's rows are renamed from its aliases to versioned names derived from resolvedModel (claude-haiku-4-5-20251001 reads "Claude Haiku 4.5"). There is no "default" row: a user's coding default is not presumed to be their pick in an image editor. The harness's recommendation seeds the first selection only; from then on the chip simply remembers what was last used here, per harness. Co-Authored-By: Claude Fable 5 <[email protected]>
The row text painted straight past the popup's edge: a flex child sizes to its content unless told otherwise, so the name and sub-label now sit in min-width-zero children under overflow-hidden rows — and since this UI kit has no text-engine ellipsis pass, the strings are trimmed to a character budget with a real ellipsis, the way the rest of the chrome truncates. The picked row's check mark stops being clipped by the same change. The hand-drawn rail marks are replaced with the actual logos: the Claude spark (Simple Icons, CC0) and the OpenAI mark (LobeHub icon set, MIT), as monochrome paths tinted by text colour like every other icon. Co-Authored-By: Claude Fable 5 <[email protected]>
The only way to dismiss the panel was the View menu or its shortcut, which nothing on the panel pointed to. An × beside the trash button now closes it through the same toggle, so the open state keeps being a saved preference — close it and it stays closed across launches, leave it open and it comes back. The hidden-state status line says how to reopen it. Co-Authored-By: Claude Fable 5 <[email protected]>
The model chip already says which harness is talking, with the same mark; the header repeating it was noise. Title, clear and close remain. Co-Authored-By: Claude Fable 5 <[email protected]>
field_reassign_with_default on the two ClaudeAgentOptions builders, collapsible_match on the text-delta arm (now a match guard), and a rustfmt pass over the AI files — no behavior change. Co-Authored-By: Claude Fable 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A new right-hand panel (View ▸ AI Panel,
Cmd/Ctrl+Shift+A, off by default) that chats with a coding-agent harness whose hands are Schist's own MCP tools, pointed at the document open in the window: edits stream onto the canvas as they happen, each an ordinary undoable history entry, with tool calls and assistant text streaming into the transcript live.Two backends, both through their SDKs rather than hand-parsed CLI output:
claudeclaude-agent-sdk-rs0.6)codexcodex-codes0.150, sync, no tokio)No API keys — the panel drives whichever CLI the user is already logged into, and says so when neither is on PATH. Conversations resume across panel closes (session id / thread id kept); Stop interrupts Claude over its control channel and ends the Codex app-server (whose blocking read can't be interrupted).
How
crates/mcpbecomes lib + bin. Per-session operations move ontoSessionCtx(borrowed doc/editor-state/registry) so the headless stdio server and the app share one dispatch. A newcatalog::Scope::Activepublishes the same ~250 tools with no session id and no session management — the current document is the whole contract; switching tabs retargets the next call. The stdio binary's behavior is unchanged.SdkMcpServer), each JSON-RPC message queued to the UI thread and answered between frames through the normalafter_changerepaint path. Isolated config: no filesystem settings, no CLAUDE.md, onlymcp__schistallowed.schist --mcp-bridge <addr>— this same binary pumping stdio into that socket. (Any stdio MCP client can reach a running app the same way, given the address and token.) Read-only sandbox, approvals never; the per-tool-call elicitation is accepted (the only server in the profile is our own), command/file approvals declined.text_entrykey context and thecancel_gestureescape chain.Hardening found by testing
rate_limit_event, from CLI newer than the SDK's enum) are skipped instead of killing the turn.Testing
make build(release),cargo test -p schist-app -p schist-mcp(75 tests, incl. new Active-scope catalog + endpoint round-trip tests), stdioschist-mcpsmoke test (init/list/create/invert).get_state→adjust_invert(canvas + History update live), follow-up "undo that" →cmd_edit_undo; Codex "invert it" →get_state→adjust_invertthrough the bridge.Docs: new
docs/ai-panel.md, plus README /docs/mcp.md/docs/architecture.mdupdates.🤖 Generated with Claude Code