Overview
The Desktop API provides type-safe Electron IPC communication via tRPC for managing workspaces, terminals, file systems, and git operations. Location:apps/desktop/src/lib/trpc/routers/
Router Structure
The desktop app router is created inapps/desktop/src/lib/trpc/routers/index.ts:29:
Workspaces API
Manage git worktrees and workspace lifecycle. Source:apps/desktop/src/lib/trpc/routers/workspaces/
Procedures
workspaces.getAll
Returns all workspaces
Array of workspace objects
workspaces.create
Workspace name
Project UUID
Branch name (auto-generated if not provided)
Branch to create from
workspaces.delete
Workspace UUID
workspaces.refreshGitStatus
Workspace UUID
Terminal API
Manage terminal sessions with daemon-backed runtime. Source:apps/desktop/src/lib/trpc/routers/terminal/terminal.ts:48
Environment Variables
Terminal sessions receive these environment variables:PATH: Prepends~/.superset/binfor agent command wrappersSUPERSET_PANE_ID: Pane identifierSUPERSET_TAB_ID: Tab identifierSUPERSET_WORKSPACE_ID: Workspace UUIDSUPERSET_WORKSPACE_NAME: Workspace nameSUPERSET_WORKSPACE_PATH: Worktree pathSUPERSET_ROOT_PATH: Main repo pathSUPERSET_PORT: Hooks server port
Procedures
terminal.createOrAttach
Pane identifier (safe ID, no slashes)
Tab identifier
Workspace UUID
Terminal columns
Terminal rows
Working directory override
Terminal theme
{ sessionKey: string }
Example:
terminal.write
Pane identifier
Data to write to terminal
terminal.resize
Pane identifier
New column count
New row count
terminal.subscribe
Pane identifier
File System API
File operations with search capabilities. Source:apps/desktop/src/lib/trpc/routers/filesystem/index.ts:582
Procedures
filesystem.readDirectory
Directory path to read
Workspace root path
Include hidden files (starting with
.)filesystem.searchFiles
Fuzzy search for files by name.
Search root directory
Search query
Glob pattern to include (e.g.,
"*.ts,*.tsx")Glob pattern to exclude (e.g.,
"node_modules,dist")Maximum results (max 500)
filesystem.searchKeyword
Search file contents using ripgrep (falls back to scan if ripgrep unavailable).
Search root directory
Search keyword
File patterns to include
File patterns to exclude
Search hidden files
Maximum matches
filesystem.createFile
Parent directory path
File name
File content
{ path: string }
filesystem.createDirectory
Parent directory
Directory name
{ path: string }
filesystem.delete
Paths to delete
Permanently delete (true) or move to trash (false)
Successfully deleted paths
Failed deletions
Git/Changes API
Git operations and file staging. Source:apps/desktop/src/lib/trpc/routers/changes/
Procedures
changes.status
Workspace UUID
changes.stage
Workspace UUID
File paths to stage
changes.unstage
Workspace UUID
File paths to unstage
changes.commit
Workspace UUID
Commit message
Usage Patterns
React Hooks
Error Handling
TypeScript Types
Next Steps
tRPC Endpoints
Explore cloud tRPC API procedures