- Set up Electron + SolidJS + Vite + TypeScript
- Configured TailwindCSS v3 (downgraded from v4 for electron-vite compatibility)
- Build pipeline with electron-vite
- Application window management
- Application menu with keyboard shortcuts
- Empty state component with styled UI
- Native folder picker integration
- IPC handlers for folder selection
- UI state management with SolidJS signals
- Loading states with spinner
- Keyboard shortcuts (Cmd/Ctrl+N)
- Process spawning:
opencode serve --port 0 - Port detection from stdout (regex:
opencode server listening on http://...) - Process lifecycle management (spawn, kill, cleanup)
- IPC communication for instance management
- Instance state tracking (starting → ready → stopped/error)
- Auto-cleanup on app quit
- Error handling & timeout protection (10s)
- Graceful shutdown (SIGTERM → SIGKILL)
- Installed
@opencode-ai/sdkpackage - SDK manager for client lifecycle
- Session fetching from OpenCode server
- Agent fetching (
client.app.agents()) - Provider fetching (
client.config.providers()) - Session store with SolidJS signals
- Instance store updated with SDK client
- Loading states for async operations
- Error handling for network failures
- Modal dialog with Kobalte Dialog
- Lists ALL existing sessions (scrollable)
- Session metadata display (title, relative timestamp)
- Native HTML select dropdown for agents
- Auto-selects first agent by default
- Create new session with selected agent
- Cancel button stops instance and closes modal
- Resume session on click
- Empty state for no sessions
- Loading state for agents
- Keyboard navigation (Escape to cancel)
Working Features:
- ✅ App launches with empty state
- ✅ Folder selection via native dialog
- ✅ OpenCode server spawning per folder
- ✅ Port extraction and process tracking
- ✅ SDK client connection to running servers
- ✅ Session list fetching and display
- ✅ Agent and provider data fetching
- ✅ Session picker modal on instance creation
- ✅ Resume existing sessions
- ✅ Create new sessions with agent selection
File Structure:
packages/opencode-client/
├── electron/
│ ├── main/
│ │ ├── main.ts (window + IPC setup)
│ │ ├── menu.ts (app menu)
│ │ ├── ipc.ts (instance IPC handlers)
│ │ └── process-manager.ts (server spawning)
│ └── preload/
│ └── index.ts (IPC bridge)
├── src/
│ ├── components/
│ │ ├── empty-state.tsx
│ │ └── session-picker.tsx
│ ├── lib/
│ │ └── sdk-manager.ts
│ ├── stores/
│ │ ├── ui.ts
│ │ ├── instances.ts
│ │ └── sessions.ts
│ ├── types/
│ │ ├── electron.d.ts
│ │ ├── instance.ts
│ │ └── session.ts
│ └── App.tsx
├── tasks/
│ ├── done/ (001-005)
│ └── todo/ (006+)
└── docs/
- Message display component
- User/assistant message rendering
- Markdown support with syntax highlighting
- Tool use visualization
- Auto-scroll behavior
- Text input with multi-line support
- Send button
- File attachment support
- Keyboard shortcuts (Enter for new line; Cmd+Enter/Ctrl+Enter to send)
- Tab bar for multiple instances
- Switch between instances
- Close instance tabs
- "+" button for new instance
cd packages/opencode-client
bun run build
bunx electron .Known Issue:
- Dev mode (
bun dev) fails due to Bun workspace hoisting + electron-vite - Workaround: Use production builds for testing
- Electron 38
- SolidJS 1.8
- TailwindCSS 3.x
- @opencode-ai/sdk
- @kobalte/core (Dialog)
- Vite 5
- TypeScript 5
- Tasks completed: 5/5 (Phase 1)
- Files created: 18+
- Lines of code: ~1500+
- Build time: ~7s
- Bundle size: 152KB (renderer)