Repository navigation
1.0.40
What's Changed
Add terminal session type with persistent PTY support (#61)
Introduces a new terminal agent SDK session type that provides standalone terminal sessions (Ghostty PTY) within the session tab system, alongside the existing opencode and claude-code AI session types.
Core changes:
- New
terminalagent SDK type — Added'terminal'to theAgentSdkIdunion across the data layer (types.ts,index.d.ts,agent-sdk-types.ts) withTERMINAL_CAPABILITIES(all capabilities disabled since terminals have no AI backend) - IPC short-circuiting — Terminal sessions bypass AI backend connect/reconnect logic in
opencode-handlers.ts, returning early with success SessionTerminalViewcomponent — New component (SessionTerminalView.tsx) renders a Ghostty terminal instance inside the main pane for terminal-type sessions, with proper visibility tracking- Persistent terminal mounting in
MainPane— Terminal sessions are always-mounted (hidden when inactive) to preserve PTY state across tab switches and worktree changes. UsesmountedTerminalSessionIdsstate with append-only semantics, pruned only by explicit tab close - Closed-terminal signal — Added
closedTerminalSessionIdsSet andacknowledgeClosedTerminals()to the session store, enabling clean pruning of mounted terminals when tabs are closed without race conditions - Terminal-aware
SessionTabs— Tabs display a terminal icon (TerminalSquare) for terminal sessions, suppress AI-specific status indicators (spinner, permission badge, etc.), and handle terminal session creation/closure correctly setSessionModelfix — Now searches connection sessions (not just worktree sessions) when resolving terminal SDK sessions, preventing model-set failures- Bottom panel terminal persistence — Refactored
BottomPanelto accept aterminalSlotprop fromRightSidebar, keeping theTerminalManageralive across sidebar collapse/expand cycles - Ghostty overlay suppression — Added
ghosttyOverlaySuppressedflag touseLayoutStoreso overlays (command palette, settings) properly hide Ghostty's native surface - Settings UI — Added "Terminal" option to the default agent SDK dropdown in general settings
Tests:
closed-terminal-signal.test.ts— Verifies the closed-terminal signal lifecycle (emit, prune, acknowledge)main-pane-terminal-persistence.test.tsx— Validates terminal sessions remain mounted across worktree switches and are pruned on closesession-terminal-view-persistence.test.tsx— TestsSessionTerminalViewvisibility prop behavior- Updated existing
ghostty-backend-visibility.test.tsandsession-tabs.test.tsfor newagentSdkprop
Add terminal session support as a first-class agent SDK (#60)
Introduces terminal sessions as a new agent SDK type ('terminal'), allowing users to open plain terminal tabs alongside AI coding sessions. Terminal sessions run a PTY with no AI backend, so users can manually run any CLI tool (claude, aider, cursor, shell commands, etc.) directly in the main pane.
Type system & backend
- Extended the
agent_sdkunion type to'opencode' | 'claude-code' | 'terminal'across all layers: DB types (src/main/db/types.ts), preload declarations (src/preload/index.d.ts), agent SDK types (src/main/services/agent-sdk-types.ts), session store, and settings store - Added
TERMINAL_CAPABILITIESconstant with all capabilities set tofalse(no undo, redo, commands, model selection, etc.) - Terminal sessions short-circuit in IPC opencode handlers —
connectandreconnectreturn immediately without invoking any AI backend
Session lifecycle
createSessionandcreateConnectionSessionnow resolve'terminal'as a valid SDK, skip model resolution for terminal sessions, and name them "Terminal N" instead of "Session N"closeSessiondetects terminal sessions and destroys their PTY (window.terminalOps.destroy) during cleanupsetSessionModelskips pushing model changes to the agent backend for terminal sessions
UI — Main pane terminal rendering
- New
SessionTerminalViewcomponent renders a full-sizeTerminalViewkeyed by session ID (not worktree ID) to avoid PTY conflicts with the bottom-panel terminal MainPanetracks all terminal-type sessions and keeps them always-mounted (hidden via CSS) to preserve PTY state across tab switches and transient session store refreshes- Terminal visibility is determined by active session + absence of file/diff overlays + ghostty overlay suppression state
UI — Session tabs
- Session tabs now show a green
TerminalSquareicon for terminal sessions instead of status spinners - The "+" button context menu always renders (not just when both SDKs are available) and includes a "New Terminal" option with a separator
- Context menu sets
ghosttyOverlaySuppressedon open/close to prevent Ghostty native surfaces from rendering on top of the menu
UI — Settings
- Added "Terminal" as a third option in the default agent SDK picker in Settings > General
- Shows a helper description when terminal is selected
Terminal backend improvements
GhosttyBackendnow preserves the last visible frame dimensions when hiding a surface (instead of shrinking to 1×1), preventing Ghostty from collapsing its internal grid stateHIDDEN_RECTupdated to 400×300 default to avoid zero-area surface issues
Bottom panel refactor
BottomPanelnow receives itsTerminalManageras aterminalSlotprop (render prop pattern) instead of creating its own instanceRightSidebarowns the singleTerminalManagerinstance and passes it down, keeping it alive even when the sidebar is collapsed (hidden via CSS)
Layout store
- Added
ghosttyOverlaySuppressedboolean andsetGhosttyOverlaySuppressedaction touseLayoutStore— used to temporarily hide Ghostty overlays when context menus are open
Add right-click context menu on plus button for provider selection (#59)
- Right-click provider selection on the "+" button: When both OpenCode and Claude Code SDKs are detected as available, right-clicking the new session button reveals a context menu letting users explicitly choose which agent SDK to use for the new session. Left-click continues to use the default SDK as before.
- Agent SDK override support in session creation:
createSessionandcreateConnectionSessionin the session store now accept an optionalagentSdkOverrideparameter, allowing callers to bypass the default SDK setting and create a session with a specific provider. - SDK availability detection on startup: The settings store gains
availableAgentSdksstate and adetectAvailableAgentSdks()action that callswindow.systemOps.detectAgentSdks()after settings load. The context menu only renders when both SDKs are present, so single-SDK setups see no UI change.