Commit Graph

20 Commits

Author SHA1 Message Date
Shantur Rathore
39e653e896 SessionInfo calculates only when messages are updated 2025-10-27 11:53:27 +00:00
Shantur Rathore
030fc4986e Remember last used binary and show environment variables 2025-10-26 11:30:29 +00:00
Shantur Rathore
0b26ffd97d Add environment variables configuration to OpenCode instances
- Add environment variables editor in advanced settings
- Store environment variables in global preferences
- Pass environment variables to OpenCode processes when spawning
- Display environment variables in instance information and server logs
- Fix system PATH binary handling for 'opencode' command
- Show detailed environment variable values in startup logs
- Save and restore last used binary across app restarts
- Add system PATH binary to recent binaries list when used

Features:
- Environment variables editor with add/remove functionality
- Persistent storage of environment variables across sessions
- Real-time display of active environment variables in logs
- Instance information shows configured environment variables
- Proper handling of system PATH vs custom binary paths
- Last used binary persistence and automatic restoration
2025-10-26 10:48:47 +00:00
Shantur Rathore
f63a4b3754 Add OpenCode binary selection with version detection
- Add binary selector component with dropdown and validation
- Support custom OpenCode binary paths and system PATH binary
- Async version checking for all binaries when selector opens
- Store recent binaries with timestamps and version info
- Enhanced instance creation to use selected binary
- Improved storage system for binary preferences
- Fixed validation to handle system PATH binaries properly
2025-10-26 10:26:32 +00:00
Shantur Rathore
f4a664bfe7 Migrate from IndexedDB to file-based storage with cross-instance sync 2025-10-25 20:21:52 +01:00
Shantur Rathore
c4a8a54bd7 Add context window percentage and subscription model detection to session info 2025-10-25 18:41:15 +01:00
Shantur Rathore
b0e636d781 Add recent folders feature with localStorage persistence
- Create FolderSelectionView component showing recent folders and browse option
- Store up to 10 recent folders in localStorage with timestamps
- Show folder selection view on app start when no instances exist
- Display folder selection modal when creating new instance from existing instance
- Add keyboard navigation (arrows, page up/down, home/end, enter, delete)
- Add ability to remove folders from recent list
- Track folder access time and display relative timestamps
- Close modal with Escape key or close button
- Update preferences store with recent folders management
2025-10-24 18:36:11 +01:00
Shantur Rathore
be3acd6724 Implement toggle thinking blocks with localStorage persistence
- Add preferences store to manage user preferences in localStorage
- Toggle thinking blocks visibility via command palette (default: hidden)
- Dynamic command label shows current state (Show/Hide Thinking Blocks)
- Filter reasoning parts based on preference in message-stream
- Conditionally render reasoning parts in message-part component
- Support function labels in Command interface for dynamic text
2025-10-24 18:24:35 +01:00
Shantur Rathore
e58462b926 Fix revert/undo state synchronization and message cleanup
- Clear session.revert when server sends undefined (fixes inability to send messages after revert)
- Handle message.removed and message.part.removed SSE events to reload messages
- Ensures reverted messages are removed from UI in real-time without requiring app restart
2025-10-24 18:21:11 +01:00
Shantur Rathore
3edd852ee2 Implement compact, undo, and init commands
- Add compact command with proper API parameters (providerID, modelID)
- Implement undo command matching TUI behavior:
  - Find previous user message before revert point
  - Restore reverted message to prompt input
  - Filter messages client-side based on session.revert field
- Add init command with proper hex-encoded message ID generation
- Add session.revert field handling:
  - Parse revert field from API responses in fetchSessions and createSession
  - Update revert field via SSE session.updated events
  - Filter messages during render when revert point is set
- Add SSE event handlers for session.compacted and session.error
- Add force reload option to loadMessages for post-compact refresh
- Messages now filter instantly based on revert state without API reload
2025-10-24 17:41:55 +01:00
Shantur Rathore
7be4248e20 Enable command queueing and fix message duplication issues
- Remove sending() state blocking to allow queueing multiple messages
- Add optimistic message creation with temp IDs for immediate UI feedback
- Implement QUEUED badge display matching TUI behavior (accent color, bold)
- Compute queued state: user message ID > last assistant message ID
- Clear prompt input immediately before async send for better UX
- Fix duplicate messages by properly finding and replacing temp messages
- Fix duplicate parts by clearing optimistic parts when real message arrives
- Fix state mutation bugs in message.part.updated handler (immutable updates)
- Fix state mutation bugs in message.updated handler (immutable updates)

Matches TUI implementation for consistent user experience across clients.
2025-10-24 16:38:42 +01:00
Shantur Rathore
e3bc947195 Implement double-escape session abort matching TUI behavior
- Add double-escape debounce pattern with 1-second timeout
- First escape shows warning, second escape aborts session
- Fix session busy check to handle undefined timeCompleted field
- Add abortSession API call to sessions store
- Show visual feedback in prompt input during debounce
- Remove Escape from filtered keys in prompt-input auto-focus
2025-10-24 16:09:32 +01:00
Shantur Rathore
6f31ffc467 Replace session picker modal with instance welcome view
Transform the session picker from a modal into a comprehensive welcome screen that displays instance metadata, session history, and creation options. The new view provides full keyboard navigation, shows MCP server status, OpenCode binary path, and project information in a compact, space-efficient layout.

Key features:
- Instance metadata sidebar showing folder, project, VCS, version, binary path, MCP status, and server info
- Session list with keyboard navigation (↑↓, PgUp/PgDn, Home/End, Enter)
- Cmd+Enter shortcut to create new session from anywhere
- Compact design with efficient space usage
- Visual MCP server status indicators (running/stopped/error)
- Scrollable layout that keeps "New Session" section accessible
2025-10-24 15:41:59 +01:00
Shantur Rathore
26ab3e066f Fix file attachment API format and duplicate attachments
- Add required 'url' field to file parts in API request
- Use url, mime, filename instead of path field
- Prevent duplicate attachments by checking if path already exists
- Show all files when picker opens with empty query (use space as query)
- Filter git files only when search query provided
- Enter key now works correctly when file list has items
2025-10-24 00:47:02 +01:00
Shantur Rathore
bdd9837538 Add file attachments with @ mentions and drag & drop support
- Create attachment type system with file, text, symbol, and agent sources
- Implement file picker with SDK integration (find.files, file.status)
- Add @ detection in prompt input to trigger file search
- Create attachment chips UI for managing attached files
- Add attachment state management per session
- Update message submission to include attachments
- Implement drag & drop support for adding files
- Show git-modified files first in file picker with +/- indicators
- Filter files as user types after @
- Clear attachments after successful message send
2025-10-23 22:46:29 +01:00
Shantur Rathore
4c98a3df06 Add keyboard shortcuts system with reusable hint components
- Implement centralized keyboard registry with 20+ shortcuts
- Add instance navigation (Cmd+[1-9], Cmd+[/])
- Add session navigation (Cmd+Shift+[1-9], Cmd+Shift+[/])
- Add agent/model cycling (Tab, Cmd+Shift+M)
- Add input shortcuts (Cmd+P focus, Cmd+K clear, ↑↓ history)
- Add command palette (Cmd+Shift+P) with 8 MVP commands
- Implement message history per folder in IndexedDB (max 100)
- Create reusable Kbd and HintRow components
- Replace all keyboard hint rendering with consistent components
- Use text-based shortcuts (Cmd+Shift+M) for clarity
2025-10-23 20:18:45 +01:00
Shantur Rathore
3c5c4755b8 Add logs tab with real-time server output and consolidate syntax highlighting
- Implement dedicated Logs tab showing stdout/stderr from OpenCode server
- Add log level parsing (INFO, ERROR, WARN, DEBUG) with color coding
- Stream logs from main process to renderer via IPC events
- Persist scroll position and auto-scroll state per instance
- Synchronize instance IDs between renderer and main process
- Consolidate syntax highlighting to single shared highlighter instance
- Optimize markdown rendering with global highlighter initialization
- Fix code block copy button to always appear on right side
- Enable debug logging with --print-logs --log-level DEBUG flags
2025-10-23 11:14:35 +01:00
Shantur Rathore
7cf0f9a179 Add agent and model selection with automatic defaults and subagent support
- Implement automatic agent/model selection for new sessions (first agent, prioritize Anthropic default)
- Extract and restore agent/model from last assistant message when resuming sessions
- Add subagent support: child sessions can select subagents, parent sessions cannot
- Display subagent badge in agent dropdown for identification
- Truncate agent descriptions to 50 characters in dropdown
- Improve model search to include full provider/model ID path
- Auto-select input text on focus for easy model search
- Add getDefaultModel() with priority: agent model → Anthropic → first provider
2025-10-23 09:25:26 +01:00
Shantur Rathore
d7f619486e Implement comprehensive tool call rendering with state persistence
- Implement tool-specific rendering for all 14 tool types (read, edit, write, bash, webfetch, todowrite, task, etc.)
- Each tool shows contextually relevant information (file previews, diffs, command output, todo lists)
- Add metadata-driven content display using preview, diff, output, and todos from tool state
- Implement status-based rendering (pending, running, completed, error) with animations
- Create global state store for expandable items (tool calls and reasoning sections)
- Fix state persistence: expanded tool calls and reasoning sections remain expanded when new messages arrive
- Fix scroll position preservation during live message updates
- Fix reasoning toggle loop by replacing native details element with custom expandable
- Add comprehensive documentation in TOOL_CALL_IMPLEMENTATION.md
- Reduce font sizes for better readability in expanded tool content
- Add proper keying to For loops to prevent component recreation
- Match TUI patterns for tool names, actions, and content formatting
2025-10-23 01:18:25 +01:00
Shantur Rathore
fa77b4e82e Working messages display 2025-10-22 22:10:51 +01:00