Commit Graph

58 Commits

Author SHA1 Message Date
Shantur Rathore
c4a8a54bd7 Add context window percentage and subscription model detection to session info 2025-10-25 18:41:15 +01:00
Shantur Rathore
c01a7e7315 Add session tokens/cost display to status bar like TUI
- Add utility functions to calculate and format session info from messagesInfo
- Display tokens and cost on left side of status bar
- Center Command Palette text in status bar
- Format matches TUI: '110K • /bin/sh.42'
- Updates in real-time as messages are processed
2025-10-24 23:55:12 +01:00
Shantur Rathore
72f5059037 Refactor logs tab to Info tab with instance information and logs
- Create reusable InstanceInfo component extracted from instance-welcome-view
- Create InfoView component combining instance info and logs sections
- Replace LogsView with InfoView in App.tsx
- Rename 'Logs' tab to 'Info' with Info icon
- Update all references from 'logs' to 'info' throughout codebase
- Maintain scroll position and auto-scroll behavior for logs
- Add dark mode support to all components
2025-10-24 18:48:52 +01:00
Shantur Rathore
24237c25b9 Fix MCP server status parsing to match API response
- Map server status values correctly: connected -> running, disabled -> stopped, failed -> error
- Remove array parsing logic as API returns Record<string, status>
- Fixes incorrect MCP server status display in instance welcome view
2025-10-24 18:41:26 +01:00
Shantur Rathore
2c9a29ebc4 Fix invalid HTML structure in folder selection view
- Move delete button outside of folder selection button
- Prevents button nesting which is invalid HTML
- Fixes build warning about malformed HTML
2025-10-24 18:37:39 +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
14b8270471 Update prompt input placeholder to mention paste support
- Remove /command reference as commands are not currently supported
- Add mention of paste support for images and text
2025-10-24 18:28:18 +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
1362a5872a Add revert button to user messages
- Add revert icon (↶) button in message header for all user messages
- Clicking revert button reverts session to that specific message
- Restores the message text back to the prompt input
- Style revert button with hover effects and border highlight
- Revert action updates UI automatically via SSE session.updated event
2025-10-24 17:44:19 +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
a1a5c4b396 Fix image attachment deletion by setting display property 2025-10-24 14:01:22 +01:00
Shantur Rathore
d39a571c16 Add [Image #N] placeholder text for pasted images 2025-10-24 13:53:13 +01:00
Shantur Rathore
640dbec2fb Add image clipboard support with paste detection and thumbnails 2025-10-24 13:14:54 +01:00
Shantur Rathore
3c73a6bc4a Refactor to unified picker showing both agents and files 2025-10-24 13:09:49 +01:00
Shantur Rathore
d17e8e56c8 Add agent attachments with @agent mentions 2025-10-24 13:02:43 +01:00
Shantur Rathore
153387bbb4 Add automatic focus to prompt input when typing 2025-10-24 12:49:59 +01:00
Shantur Rathore
0aca7ba7e5 Fix file attachment position tracking when deleting @ mentions 2025-10-24 12:46:38 +01:00
Shantur Rathore
b24c7a572f Remove agent cycling and enhance model selector display
- Remove Tab/Shift+Tab shortcuts for cycling agents
- Remove Next/Previous Agent commands from command palette
- Remove handleCycleAgent and handleCycleAgentReverse functions
- Remove Tab keyboard hint from agent selector UI
- Enhance model selector to show provider/modelId below model name
- Widen model selector button to accommodate additional text
2025-10-24 12:35:53 +01:00
Shantur Rathore
7dbda45fb9 Improve model selector with searchable dropdown and keyboard navigation
- Replace inline input with button showing current model
- Add searchable dropdown with comprehensive filtering (name, provider, IDs)
- Fix Cmd+Shift+M keyboard shortcut to open dropdown
- Add arrow key navigation with visual highlights
- Auto-focus search field when dropdown opens
- Use Kobalte Combobox with proper structure for better accessibility
2025-10-24 12:26:25 +01:00
Shantur Rathore
1903bea1c8 Implement client-side file scanning via Electron IPC with gitignore
- Add fs:scanDirectory IPC handler in main process
- Scan workspace recursively with proper gitignore support
- Use 'ignore' library for accurate gitignore pattern matching
- Expose scanDirectory via electronAPI in preload
- Call IPC from renderer instead of direct fs access
- Cache scanned files for fast filtering
- Scroll to top and highlight first item on results update
- Always exclude .git and node_modules directories
2025-10-24 10:10:12 +01:00
Shantur Rathore
6dcdd8294d Implement client-side file scanning with gitignore support
- Use Node.js fs APIs to recursively scan workspace folder
- Load and parse .gitignore to filter files
- Cache scanned files for performance
- Filter files by search query on client side
- Skip .git and node_modules directories
- Support gitignore patterns (basic wildcards)
- No server API calls needed for file listing
2025-10-24 09:52:53 +01:00
Shantur Rathore
f19add1c47 Simplify file picker to show only git files with filtering
- Remove server file search API calls
- Only use git file status for file list
- Filter git files by search query on client side
- Add trailing / when inserting folder paths
- Simpler and faster implementation
- Respects gitignore (via git status)
2025-10-24 09:49:16 +01:00
Shantur Rathore
fdd6c8d63b Allow folders in file picker and use them as search filters
- Remove directory filtering from file picker
- When folder selected, insert folder path into input (not as attachment)
- Folder path becomes search query to filter files in that folder
- Files still create attachments as before
- User can navigate folder structure using @ mentions
2025-10-24 09:26:13 +01:00
Shantur Rathore
92fa1efefd Fix @ to show all files using wildcard query
- Use '.' as query instead of empty string for @ mention
- Fuzzy search matches all files with '.' pattern
- Filter out directories (paths ending with /)
- Shows git files + all project files when typing @
2025-10-24 09:21:33 +01:00
Shantur Rathore
a667d1e232 Fix empty query showing no files by showing git files only
- When query is empty, show only git files (no search)
- When query has text, search all files + git files
- Avoids server returning directories for empty query
- Simpler and faster UX for @ mentions
2025-10-24 09:17:13 +01:00
Shantur Rathore
b13080e5dc Filter out directories from file picker, show only files
- Filter git files ending with / (directories)
- Filter search results ending with / (directories)
- Only show actual files in file picker
- Directories cannot be attached as files
2025-10-24 01:33:40 +01:00
Shantur Rathore
947f19885e Implement smart deletion for file attachment mentions
- Backspace at end of @filename deletes entire mention
- Delete at start of @filename deletes entire mention
- Selecting @filename and deleting removes it
- Automatically removes file attachment and chip
- Only deletes if @filename has matching attachment
- Same UX as paste placeholder deletion
2025-10-24 01:28:08 +01:00
Shantur Rathore
881fb5ff66 Implement smart deletion for paste placeholders
- Backspace at end of [pasted #N] deletes entire placeholder
- Delete at start of [pasted #N] deletes entire placeholder
- Selecting placeholder and deleting removes it
- Automatically removes attachment when placeholder deleted
- Cursor repositioned to placeholder start after deletion
2025-10-24 01:24:25 +01:00
Shantur Rathore
00fc462c8f Add placeholder text for long paste attachments in prompt
- Insert [pasted #N] at cursor position when pasting
- Remove placeholder when attachment chip is deleted
- Maintains cursor position after paste
- User can see where paste was inserted in text flow
2025-10-24 01:21:57 +01:00
Shantur Rathore
7138fb4e23 Implement long paste handling with text attachments
- Detect pastes >150 chars or >3 lines
- Convert long pastes to text attachments
- Show clipboard icon for text attachments
- Display summary (e.g., 'pasted #1 (10 lines)')
- Auto-increment paste counter
- Reset counter on message send
- Short pastes insert normally
2025-10-24 01:19:00 +01:00
Shantur Rathore
d2620dd3c3 Fix empty query file search to fetch all files instead of using space 2025-10-24 01:09:57 +01:00
Shantur Rathore
68503c2511 Fix no matching files on empty query by awaiting git files first 2025-10-24 01:08:30 +01:00
Shantur Rathore
f3a7c9757d Improve attachment chip design with file icons and better styling 2025-10-24 01:05:46 +01:00
Shantur Rathore
4d468e278f Add visual attachment chips and fix empty query file search 2025-10-24 01:00:01 +01:00
Shantur Rathore
79fe1c4b7b Convert file paths to file:// URLs for server compatibility 2025-10-24 00:55:20 +01:00
Shantur Rathore
f291649f74 Fix file picker keyboard event handling and loading state 2025-10-24 00:52:17 +01:00
Shantur Rathore
b6dc4ba249 Fix file path format and initialization issues
- Remove leading slash from file paths (use relative paths from workspace)
- Server expects relative paths like 'file.md' not '/file.md'
- Convert isInitialized from let to signal to persist across renders
- Fix file picker not showing files on first open
- Paths from find.files() are already relative to workspace
2025-10-24 00:50:30 +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
2629276229 Make file attachments truly inline as text in textarea
- Insert @filename directly into textarea value when file selected
- Remove separate chip display above textarea
- Text now flows naturally: 'look at this file @app.tsx and tell me'
- Clear all ignored positions when @ is deleted (reset state)
- Show attachment count in hints when files attached
- Attachments tracked separately but appear as text to user
- Auto-resize textarea after inserting filename
2025-10-24 00:42:16 +01:00
Shantur Rathore
debaef628a Fix file picker not reopening after Escape
- Clear ignored @ position when user moves away from it
- Track when @ position changes and remove old position from ignored set
- Allows file picker to work again on new @ mentions
- Example: @app (Escape) → @file (picker opens for new @)
2025-10-24 00:36:32 +01:00
Shantur Rathore
fb9d3a08eb Improve file picker UX: inline chips, focus preservation, escape behavior
- Move attachment chips inside textarea wrapper (appears inline)
- Keep textarea focused when pressing Escape (no focus stealing)
- Track ignored @ positions after Escape to prevent re-triggering picker
- Clear ignored positions on message send
- Use capture phase for Escape key handling (true flag on addEventListener)
- Escape now works like email: type @example.com naturally after dismissing picker
- Chips show above textarea input with better spacing (pt-2 pb-1)
2025-10-24 00:27:36 +01:00
Shantur Rathore
d735067042 Fix infinite loop in file picker with proper initialization flag
- Use isInitialized flag to prevent effect re-triggering
- Use gitFilesFetched flag to prevent duplicate git API calls
- Fetch git files and initial files only once on first open
- Only refetch when search query actually changes
- Git files are optional - don't block on empty results
- Logs show initialization state for debugging
2025-10-24 00:17:33 +01:00
Shantur Rathore
0e93cb56af Add comprehensive logging to file picker for debugging
- Log all API calls with timing information
- Log cache hits and misses
- Log query changes and effect triggers
- Log response data structure
- Log file counts at each step
- Log errors with elapsed time
- Helps diagnose slow loading and missing files issues
2025-10-24 00:13:48 +01:00
Shantur Rathore
a3c60d0e37 Fix file picker error handling and reduce API calls
- Handle file.status() errors gracefully (warn instead of error)
- Make git files optional (empty array if endpoint fails)
- Prevent duplicate API calls by tracking last query
- Only fetch git files once (check if cached before fetching)
- Short-circuit when no search query (just show git files)
- Better error messages (warn for git, error for search)
2025-10-24 00:08:11 +01:00
Shantur Rathore
9a47cfd8d9 Fix file picker UX issues
- Change from modal dialog to inline popover (no focus stealing)
- Keep textarea focused while file picker is open
- Fix loading flickering by caching git files
- Debounce file search to prevent rapid refetching
- Escape closes picker without removing @ text
- Enter selects file from picker
- Arrow keys navigate picker when open, history when closed
- Position picker above textarea using absolute positioning
- Mouse hover updates selection index
- Remove blur/focus from picker input
2025-10-23 22:58:09 +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
9dfb3cd612 Add auto-scroll to command palette for keyboard navigation
Keep selected command visible when navigating with arrow keys by automatically scrolling the list
2025-10-23 22:36:18 +01:00