Skip to content

1.0.40

Choose a tag to compare

@morapelker morapelker released this 24 Feb 11:28
· 3004 commits to main since this release

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 terminal agent SDK type — Added 'terminal' to the AgentSdkId union across the data layer (types.ts, index.d.ts, agent-sdk-types.ts) with TERMINAL_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
  • SessionTerminalView component — 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. Uses mountedTerminalSessionIds state with append-only semantics, pruned only by explicit tab close
  • Closed-terminal signal — Added closedTerminalSessionIds Set and acknowledgeClosedTerminals() 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
  • setSessionModel fix — Now searches connection sessions (not just worktree sessions) when resolving terminal SDK sessions, preventing model-set failures
  • Bottom panel terminal persistence — Refactored BottomPanel to accept a terminalSlot prop from RightSidebar, keeping the TerminalManager alive across sidebar collapse/expand cycles
  • Ghostty overlay suppression — Added ghosttyOverlaySuppressed flag to useLayoutStore so 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 close
  • session-terminal-view-persistence.test.tsx — Tests SessionTerminalView visibility prop behavior
  • Updated existing ghostty-backend-visibility.test.ts and session-tabs.test.ts for new agentSdk prop

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_sdk union 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_CAPABILITIES constant with all capabilities set to false (no undo, redo, commands, model selection, etc.)
  • Terminal sessions short-circuit in IPC opencode handlers — connect and reconnect return immediately without invoking any AI backend

Session lifecycle

  • createSession and createConnectionSession now resolve 'terminal' as a valid SDK, skip model resolution for terminal sessions, and name them "Terminal N" instead of "Session N"
  • closeSession detects terminal sessions and destroys their PTY (window.terminalOps.destroy) during cleanup
  • setSessionModel skips pushing model changes to the agent backend for terminal sessions

UI — Main pane terminal rendering

  • New SessionTerminalView component renders a full-size TerminalView keyed by session ID (not worktree ID) to avoid PTY conflicts with the bottom-panel terminal
  • MainPane tracks 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 TerminalSquare icon 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 ghosttyOverlaySuppressed on 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

  • GhosttyBackend now preserves the last visible frame dimensions when hiding a surface (instead of shrinking to 1×1), preventing Ghostty from collapsing its internal grid state
  • HIDDEN_RECT updated to 400×300 default to avoid zero-area surface issues

Bottom panel refactor

  • BottomPanel now receives its TerminalManager as a terminalSlot prop (render prop pattern) instead of creating its own instance
  • RightSidebar owns the single TerminalManager instance and passes it down, keeping it alive even when the sidebar is collapsed (hidden via CSS)

Layout store

  • Added ghosttyOverlaySuppressed boolean and setGhosttyOverlaySuppressed action to useLayoutStore — 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: createSession and createConnectionSession in the session store now accept an optional agentSdkOverride parameter, 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 availableAgentSdks state and a detectAvailableAgentSdks() action that calls window.systemOps.detectAgentSdks() after settings load. The context menu only renders when both SDKs are present, so single-SDK setups see no UI change.