* 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>
Simplify card layout with consistent button styling, proper event handling for card clicks, and improved visual feedback with hover states. Consolidate branch and status indicators in a cleaner layout structure.
* 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>
* feat: Implement /compact command with processing feedback
- Add 'compact' status type to session status store
- Update SessionStatusIndicator to show purple pulsing animation for compaction
- Add summarizeSession() API method to OpenCode client
- Modify command handler for /compact to:
- Get current model from state
- Show compaction toast
- Set session to compacting status
- Call summarize endpoint with provider/model
- Update SSE handler to clear compact status on session.compacted event
The user sees a purple animated indicator and 'Compacting' text during the operation, matching the TUI experience.
* Fix compact command to use break instead of return for model validation
---------
Co-authored-by: Chris Scott <chris@cstech.dev>
- Add duplicate config validation to backend
- Fix TTS button comparison using original text
- Track original vs sanitized text in TTS context
- Update toast import in message hooks
- Add type safety for error handling
- Add revertMessage and unrevertSession methods to OpenCode API client
- Create useRemoveMessage and useRefreshMessage hooks for message operations
- Add MessageActionButtons component with X (remove) and refresh buttons
- Add EditableUserMessage component for editing prompts before resend
- Update MessageThread to integrate action buttons and editable messages
- Update AGENTS.md with improved guidelines and pnpm preference