Commit Graph
78 Commits
Author SHA1 Message Date
Chris Scott c3d6549f01 feat: add assistant mode, SSE streaming, and OpenCode server integration (#214) 2026-05-02 21:51:37 -04:00
Chris Scott 549e0ac7b2 feat: add model state persistence and improve model selection sync (#209)
* feat: add persistent model state storage with database backend

- Create opencode_model_state table for storing user model preferences
- Implement database-backed model state management (recent, favorite, variant)
- Add atomic JSON file utilities with file locking for concurrent safety
- Migrate providers routes from file-based to database storage
- Add backfill migration to preserve existing model.json data
- Include comprehensive tests for model-state and atomic-json modules
- Refactor useSessionAgent hook to simplify agent/model resolution logic
- Update getFileApiUrl to use consistent query parameter approach

* fix: include workspace dependencies in Docker image

* fix: overlay workspace node_modules after source to prevent layer overwrite

* fix: ensure model state table exists for existing databases

* feat: add model state persistence and improve model selection sync

- Add setActiveModel to modelStore and useModelSelection for direct model updates
- Sync session agent model/variant to store when messages load
- Include model, agent, and variant in optimistic user messages
- Fix useSessionAgent to check isFetching during message loading
- Update env.ts to use getter for BASE_PATH for dynamic resolution
- Fix test environment variable from OPENCODE_WORKSPACE_PATH to WORKSPACE_PATH
2026-04-29 21:44:47 -04:00
Chris Scott f0c87ffa5d refactor(frontend): rework speech-to-text to tap-first interaction (#207)
* refactor(frontend): extract VoiceStatusOverlay component and improve swipe tracking

- Extract voice status overlay to dedicated VoiceStatusOverlay.tsx component
- Move pointer event handlers from button to container for larger swipe surface area
- Users can now initiate swipe gesture from anywhere in the container, not just the button

* refactor(frontend): add SSE delta support and improve status synchronization

- Add SSEMessagePartDeltaEvent type for streaming delta updates
- Add SSESessionCreatedEvent type for session creation events
- Implement directory filtering for SSE events to prevent cross-contamination
- Add version tracking for status snapshots to ignore stale responses
- Replace individual status updates with atomic replaceStatuses operation
- Refactor parts batcher to use unified operation queue with delta support
- Clear stale statuses on initial snapshot and directory changes
- Add tests for status snapshot clearing and stale response handling

* refactor: remove auto-restart from assistant mode and fix mobile sheet close behavior

Stop restarting OpenCode after assistant mode initialization since the
startup error logic is no longer needed. Also fix the repo quick switch
sheet to stay open when launched from the mobile tab bar, preventing
unwanted navigation away from the sheet.

* refactor(frontend): improve speech-to-text UI
2026-04-29 12:26:41 -04:00
Chris ScottandChris Scott 04400c91cc Feat/mobile session actions (#206)
* feat: improve mobile session actions

* feat(frontend): improve mobile session actions

Replace inline file search in MoreDrawer with FileBrowserSheet for
mention-file interactions. Add activePromptFileBasePath state to track
workspace context, normalize file paths on selection, and improve
command sorting with relevance ranking (exact > prefix > partial match).

* refactor(frontend): remove dead state and deduplicate event reconciliation

Remove unused activePromptDirectory from uiStateStore and its writers in
SessionDetail and PromptInput. Consolidate duplicated permission and
question reconciliation helpers in EventContext behind a generic
session-scoped helper.

---------

Co-authored-by: Chris Scott <>
2026-04-28 16:20:54 -04:00
Chris ScottandChris Scott 1beb353668 refactor(prompt): improve mobile speech-to-text feedback (#203)
* refactor(prompt): improve mobile speech-to-text feedback

Consolidate the voice button rendering and add a clearer mobile swipe-up affordance for auto-send while fixing hold activation state.

* refactor(prompt): improve mobile speech-to-text feedback

---------

Co-authored-by: Chris Scott <>
2026-04-27 22:39:04 -04:00
Chris ScottandChris Scott e6ff8733cf feat(model): add favorites system for model selection (#201)
* fix: sync model selection with OpenCode state

* feat(model): add favorites system for model selection

- Add toggleFavoriteModel API endpoint
- Add favorite toggle UI in ModelQuickSelect and ModelSelectDialog
- Show provider name prefix when model display names are ambiguous
- Fix directory scoping for getProviders API calls

feat(assistant): send welcome message on new session creation

- Send setup guidance message when creating new assistant session

---------

Co-authored-by: Chris Scott <>
2026-04-26 21:49:13 -04:00
Chris Scott c7ddebe508 feat: improve voice recording with hold activation timer 2026-04-24 09:18:15 -04:00
Chris Scott f41bf37901 loop: refactor-session-activity completed after 1 iterations (#191) 2026-04-23 11:57:12 -04:00
Chris Scott adf77516e5 feat(frontend): add simple chat mode (#190)
* loop: simple-chat-mode completed after 1 iterations

* feat(frontend): add simple chat mode for user messages and clean up redundant optimistic filtering

* refactor(frontend): consolidate status indicators and simplify simple chat mode

- Merge MiniScanner and CompactStatusIndicator into SessionStatusIndicator with size and showLabel props
- Hide step-finish cost/token display in simpleChatMode
- Update SessionCard and PromptInput to use unified SessionStatusIndicator
- Add tests for step-finish rendering in simpleChatMode
2026-04-23 11:37:24 -04:00
Chris Scott 4a90dda1a0 refactor - Add tabs menu - fix swipe nav 2026-04-19 12:48:12 -04:00
Chris Scott 29b9d028c7 feat(frontend): improve mobile voice controls and TTS playback 2026-04-18 08:25:47 -04:00
Chris Scott 1f6180e03c Add OpenCode models editor with mobile repos UI refactoring 2026-04-13 14:24:52 -04:00
Chris Scott 173dbf578e Fix mic button border width to prevent input height shift 2026-04-08 00:17:40 -04:00
Chris Scott 5e254c8c03 Update mobile UI styling for TTS button and prompt input 2026-04-08 00:16:06 -04:00
Chris Scott 9973e00dc5 loop: loop-stt-overhaul-lazy-mic-audioworklet-session-cleanup completed after 4 iterations 2026-04-07 23:19:51 -04:00
Chris Scott 4ad6c5fd25 Improve scroll-to-bottom UI and session status handling
- Replace ChevronDown with ArrowDown icon for scroll button
- Adjust scroll threshold to 150px for better UX
- Add prompt overlay height tracking for proper message container padding
- Include compact status in active session check
2026-03-24 14:00:35 -04:00
Chris Scott 1248d0b9e0 Update memory plugin (#160) 2026-03-20 12:16:56 -04:00
Chris Scott a3237d7f7f Fix mobile input prompt command selection (#148)
* fix mobile selection in suggestion dropdowns

* handle mobile keyboard viewport
2026-02-27 17:35:01 -05:00
Chris Scott f368a2fa62 Add agent color styling and session persistence 2026-02-27 17:01:56 -05:00
Chris Scott 725122b588 refactor: inline message parts with batched SSE updates (#137) 2026-02-16 10:47:37 -05:00
Chris Scott 5de419ee28 fix issues (#136)
* fix: prevent delete button click when card is not swiped open

* refactor: improve CreateRepoInput type safety

* security: require AUTH_SECRET and use secure random generation

* fix: SSH key path validation, async passphrase stripping, and port handling

* fix: use correct console methods for logger levels

* Add error handling to DB update functions and improve migration logging

* Add error handling for session lookup in auth middleware

* Add structured git error handling with user-friendly messages

- Parse git errors with specific error codes (AUTH_FAILED, REPO_NOT_FOUND,
  PUSH_REJECTED, MERGE_CONFLICT, etc.) and appropriate HTTP status codes
- Return structured error responses with summary and detail from backend
- Add GitErrorBanner component for better error display in UI
- Add optional onError callback to useGit hook for external error handling

* Make IPC server initialization/disposal async and fix SSH host key handler

* add try-catch error handling in frontend lib utilities

* remove unresolved promise handlers in speech synthesizer callbacks

* Extract error types to shared package

* Import GitErrorCode from shared package

* Refactor API layer to use shared FetchError and fetchWrapper

* Update prompt parser and source control components

* Extract MCP server list to separate component with improved badge menu UX

* merge useSettingsDialogUrl into useSettingsDialog and extract getRepoDisplayName utility

* add separate loading state for passkey sign in

* refactor hooks: use fetchWrapper, improve error handling, add proper types

* replace browser confirm() with DeleteDialog component in settings

* fix: add missing variables parameter in React Query onError callbacks

* Refactor message parts to use separate Zustand store

* Update QuestionPrompt styling for light/dark mode
2026-02-15 19:48:03 -05:00
Chris Scott b5eef317bd Replace X icon with SquareFill for stop button 2026-02-06 12:36:59 -05:00
Chris Scott ae644e851d feat: add push notifications with VAPID (#110)
* Add OAuth authentication support for MCP servers

* Improve mobile text sizing with responsive text classes

* refactor: improve virtualized text viewer with React Query infinite scroll and simplified buffering

* Add push notifications with VAPID and PWA support

* feat: add VAPID environment variables for push notifications

* Replace SquareFill with MicOff icon for stop recording buttons

* Send push notifications when app is not focused

* Fix stop generation button icons to use X instead of MicOff

* feat: enhance push notification logging and debugging

- Add structured logging throughout push notification flow
- Improve error handling with detailed diagnostics
- Add /api/notifications/debug endpoint for troubleshooting
- Enhanced test notification response with per-subscription results
- Add service worker logging and better install/activate handling

* Improve VAPID push notification configuration with validation and better defaults

- Add validation warnings for VAPID_SUBJECT format (requires mailto: prefix for iOS/Safari)
- Expose VAPID details via notifications API endpoint
- Update default VAPID_SUBJECT from mailto:admin@opencode.local to empty string
- Enhance VAPID logging with key lengths and subject info
- Improve documentation in .env.example with setup instructions

* Fix notification URL to use repo ID instead of filesystem path

* Clean up push notification logging and debug endpoints

* Add push notifications documentation
2026-02-06 11:23:10 -05:00
Chris Scott c453235839 Frontend improvements: responsive design, SSE reliability, and cache management (#107)
* Add SSE reconnection before critical actions and handle Cloudflare 524 errors

* refactor: improve responsive layout in QuestionPrompt component

* fix: proper cache updates for OpenCode version on install/upgrade
2026-02-05 18:55:40 -05:00
Chris Scott 6dab89d6c4 Add GitHub Copilot code review setup and CI workflow (#93) 2026-01-29 08:44:28 -05:00
Chris Scott da6cad8b3a Add comprehensive documentation and download feature (#83)
* fix: markdown files now default to rendered view and render properly

- Add .md and .mdx MIME type support in backend (files.ts, defaults.ts)
- Add key props to FilePreview components to force proper remounting when switching files
- Fix markdown file detection with case-insensitive extension check
- Reset markdownPreview state when file changes to ensure correct default view
- Add onContentLoaded callback to VirtualizedTextView for reactive content updates
- Add fullContent state to properly handle large markdown file rendering
- Add error handling for async content loading to prevent blank screens
- Reduce loading timeout from 50ms to 0ms for more responsive loading

Fixes issues where:
- Markdown files opened in raw view instead of rendered view
- Large markdown files (12k+ lines) showed blank after loading completed
- State persisted incorrectly when switching between different file types

* Add directory download feature with ZIP archive support

* Improve voice recording UX with loading states and better transcript handling

* Fix auth config for prod/dev ports and add documentation

Update AUTH_TRUSTED_ORIGINS and PASSKEY_ORIGIN to use backend port 5003 (frontend uses 5173 in dev). Add comprehensive auth documentation covering secrets, trusted origins, admin reset, and passkeys. Update README and add mkdocs config.

* Remove roadmap section from README
2026-01-26 23:09:27 -05:00
Chris Scott cb1714a4e0 Merge dev: STT feature, git date fixes, and session improvements (#82)
* fix session last active

* Feature/sst (#81)

* Use CSS field-sizing for textarea auto-height and abort STT recording on clear

* Fix invalid date display in git commits

* Use Unix timestamps for git log dates
2026-01-26 13:03:02 -05:00
Chris Scott af292758c3 chore: bump version to 0.7.4 2026-01-23 17:39:21 -05:00
Chris Scott e6156f3c47 chore: bump version to 0.7.3, set package to public, and add per-session agent mode switching
Changes:
- Bump version to 0.7.3
- Set package.private to false
- Add useSessionAgent hook for per-session agent mode
- Remove global mode preference, use session-level mode
- Add mobile drag-and-drop toggle for repo list
- Improve repo card UI with truncation and compact status
- Fix TypeScript errors in repo.ts (undefined handling)
2026-01-23 17:08:18 -05:00
Chris Scott 2bd2b024b8 refactor: replace OpenCode server restarts with config reloads for faster updates (#70) 2026-01-17 12:40:22 -05:00
Naman Rajpal 1e4b756973 fix: allow text paste on iOS by checking clipboard text before files (#64) 2026-01-15 20:53:48 -05:00
Chris Scott f7fd3176d4 Refactor SSE event handling and consolidate notification contexts 2026-01-12 23:56:50 -05:00
Chris Scott 17ee96d316 regenerate OpenAPI spec and add model selection components 2026-01-10 18:39:12 -05:00
Chris Scott 8166044d6e Fix eslint (#46)
* Fix mobile image upload and paste with improved file type handling

* Replace older sessions header with separator line

* Add ESLint no-console rules and fix lint errors

- Add eslint configuration for backend with no-console rule
- Add reusable error type guard utility
- Replace all error: any with error: unknown and type guards across backend
- Update logger to use console.warn/console.error only
- Remove unused variables and dead code functions
- Fix regex escape characters
- Update AGENTS.md with lint commands and requirements
2026-01-03 15:19:28 -05:00
Chris Scott c9bf962ac0 Fix mobile paste (#45)
* Fix mobile image upload and paste with improved file type handling

* Replace older sessions header with separator line
2026-01-03 11:44:39 -05:00
Chris Scott 005861ddf9 Add SquareFill icon component and update TTS/stop button styling with responsive cost display 2026-01-02 23:00:13 -05:00
Chris Scott d7873241e0 Add image and PDF attachment support with drag-drop and paste 2025-12-28 22:52:16 -05:00
b28f069576 Fix/permission request directory (#31)
* Fix permission response by including directory parameter

Extract directory from query key in useActiveRepos hook and pass it
to OpenCodeClient when responding to permissions. Use composite keys
for client and SSE connection tracking to support multiple repos with
the same URL but different directories.

* Keep permission dialog open on response failure and show error toast

* Fix permission request proxying to preserve query parameters

The backend proxy was incorrectly handling URL query parameters when stripping the /api/opencode prefix. This caused the directory parameter to not be passed correctly to the OpenCode server, breaking the permission request/response flow.

Changes:
- Separate pathname and search parameters explicitly
- Only strip /api/opencode from pathname, preserve search params
- Add logging for permission requests to aid debugging
- Update error logging to use correct variables

This fix ensures that permission responses are properly forwarded to the OpenCode server with all necessary query parameters, allowing the session to proceed correctly when users grant permissions.

* Fix permission client lookup when only individual sessions are loaded

The PermissionContext failed to find a client when responding to permissions because it only scanned the sessions list query, but SessionDetail and other pages only load individual sessions via useSession.

Changes:
- Update useActiveRepos to also scan individual session queries
- Match query keys like ['opencode', 'session', url, sessionId, directory]
- Extract session ID from individual session query data
- Build active repos map from both sessions list and individual session queries

This ensures permission dialogs can find the appropriate client to send responses, even when viewing a single session without loading the full sessions list.

* Fix permission client lookup with fallback to query cache

The activeRepos state was often empty when permission dialogs appeared due to timing issues with the React Query cache subscription. This caused No client found for session errors.

Changes:
- Add fallback scan of query cache directly in getClient when activeRepos is empty
- Remove excessive debug logging that was spamming console
- Add minimal log only when fallback is actually used
- Fix query key length checks to be more robust

This ensures permission responses work correctly even if the useActiveRepos hook hasn't yet populated the state, by falling back to scanning the query cache directly to find the session and creating the appropriate OpenCodeClient.

* Add directory-based permission requests with global notification and message auto-refresh

---------

Co-authored-by: OpenCode Agent <agent@opencode.ai>
Co-authored-by: Chris Scott <chris@cstech.dev>
2025-12-27 09:21:45 -05:00
Chris Scott 5628c4c7be Fix message editing state and stream detection logic 2025-12-26 18:23:37 -05:00
Chris Scott e3a3cbde84 Add global permission request system with centralized context and dialog 2025-12-26 13:36:18 -05:00
Chris Scott ac188c953b Remove console.log debug statements and cleanup debug code 2025-12-25 10:38:01 -05:00
Chris Scott ce2630936d Update UI styling for mode toggle and session indicators 2025-12-22 00:09:21 -05:00
OpenCode Agent c884656d8a Fix button styling and repo list layout 2025-12-22 02:21:51 +00:00
Chris Scott 1ae8ed81b2 Improve mobile UX for message actions and scroll button; add revert message filtering 2025-12-21 17:50:21 -05:00
Chris Scott 3a01ca9356 Update model and scroll buttons to match send button height with dark theme borders 2025-12-21 17:19:37 -05:00
Chris Scott f433cb0c1a Add white border to send button in dark theme 2025-12-21 17:18:44 -05:00
Chris Scott 17a9556c2a Add message editing state management and UI improvements 2025-12-21 13:18:39 -05:00
Chris ScottandChris Scott 0cbfe2e358 Fix pnpm resources (#29)
* Add message undo/refresh features and stop audio floating button

* Exclude workspace directory from pnpm workspace detection

---------

Co-authored-by: Chris Scott <chris@cstech.dev>
2025-12-21 09:46:38 -05:00
Chris Scott f052b9cd5f Show session status indicator on mobile during streaming 2025-12-15 08:39:59 -05:00
Chris Scott 2c38f7f169 Fix branch switching UI updates and simplify model display
- Use setQueryData for immediate branch switch UI updates
- Replace model selector with SessionStatusIndicator during active streams
- Remove async model name fetching in favor of existing modelString
2025-12-14 18:33:43 -05:00