Commit Graph
53 Commits
Author SHA1 Message Date
Chris ScottandChris Scott c267bce42e fix minimax use (#44)
* Fix provider API key storage to match OpenCode schema

Backend was writing credentials with type 'apiKey' and field 'apiKey',
but OpenCode expects type 'api' and field 'key'. This caused UI-set
credentials to be silently ignored while environment variables worked.

- Update AuthEntrySchema to use 'api' type and 'key' field
- Update AuthService.set() to write new format
- Add migration to convert existing entries on read

Fixes #40

* Add auth service tests to validate schema fix and migration

Tests verify:
- Migration from old 'apiKey' format to 'api' format
- New credentials are written in correct format
- getAll, set, delete, list, and has methods work correctly

---------

Co-authored-by: Chris Scott <chris@cstech.dev>
2025-12-31 19:33:35 -05:00
Chris Scott f1a7d36433 Add configurable global git identity settings with new Git tab (#43) 2025-12-31 13:52:55 -05:00
Chris Scott a736e98880 Add multiple git credentials support with migration 2025-12-31 10:47:55 -05:00
Chris Scott 876b444599 Add config rollback and startup error recovery 2025-12-28 20:52:36 -05:00
Chris Scott 120d087910 Add support for GitHub shorthand repo URLs 2025-12-27 19:27:37 -05:00
Chris Scott f1557fba5d Improve permission dialog UI and update Python package documentation 2025-12-27 17:54:43 -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 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 8061437304 Add initial commit for local repos, filter sessions by directory, remove unused priority indicator 2025-12-21 14:28:56 -05:00
Chris Scott 82d3a109ac Import existing OpenCode config on initialization and fix schema types 2025-12-20 10:11:30 -05:00
Chris Scott 44240f0aab Fix TTS sanitization and message handling bugs
- 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
2025-12-18 22:44:07 -05:00
Chris Scott 5c0ba50e02 Fix browser runtime error by excluding Node.js env module from shared package exports 2025-12-15 15:04:53 -05:00
Chris Scott 67cb729ca7 Merge main into feature/TTS and resolve conflicts 2025-12-15 14:50:04 -05:00
Chris Scott c7de65290a Add GitHub token validation and improve TTS configuration
- Add git token validation endpoint and UI validation
- Improve TTS endpoint normalization and discovery
- Move shared types to workspace package
- Add better error handling for TTS API calls
- Support composite voices for Kokoro-style TTS
- Auto-fetch TTS models and voices on config change
2025-12-15 14:43:03 -05:00
OpenCode 406ff8fd4a Add TTS model and voice discovery with caching 2025-12-15 17:43:05 +00:00
Chris Scott e993a83027 Fix Zod v4 schema errors, mobile permission dialog overflow, and TTS test mocking 2025-12-14 23:19:59 -05:00
Chris Scott 71cf496711 Replace executeCommand with executeGitWithFallback for git fetch operations 2025-12-14 19:33:01 -05:00
Chris Scott 99ed632355 Add branch creation endpoint and improve git auth fallback handling 2025-12-14 19:11:27 -05:00
Chris Scott 74e0997b3e Add multi-file and directory upload support with progress tracking 2025-12-14 14:13:15 -05:00
Chris Scott ae08bda01e Merge pull request #20 from flavour/fix_gh_token
Fix GitHub Token usage
2025-12-14 13:41:40 -05:00
Fran Boon 7a01819bab Remove deprecated keybinding: input_forward_delete 2025-12-14 17:40:55 +00:00
Fran Boon a684682510 Fix GitHub Token 2025-12-14 17:12:33 +00:00
Chris Scott 5cc1fbb9b5 Set XDG_CONFIG_HOME to enable workspace AGENTS.md consumption 2025-12-13 23:38:10 -05:00
Chris Scott e45ebd96a0 Add Python support with uv package manager in Docker container 2025-12-13 00:39:09 -05:00
Chris Scott 433c2da50d Add global AGENTS.md editor and expose dev server ports 5100-5103 2025-12-12 23:38:14 -05:00
Chris Scott af9f645f30 Add ZIP download feature for repositories
- Add archive service to create ZIP files excluding gitignored files
- Add download endpoint to backend repo routes
- Add download button to repo cards with loading state
- Update README with new ZIP download feature
2025-12-12 20:48:38 -05:00
Chris Scott 93a69fcaab Improve UI: show branch name on all screen sizes and increase back button padding 2025-12-12 19:35:59 -05:00
Chris Scott 0e1517f068 Refactor JSONC parsing to shared utility and fix code duplication 2025-12-12 15:38:10 -05:00
Chris Scott 4eec4e5c27 Add comprehensive JSONC support for opencode.jsonc files
- Store raw JSONC content in database, parse on-the-fly for validation
- Return rawContent field in API response for editing with comments preserved
- Update frontend to use rawContent for config editing
- Accept string or object content in create/update requests
- Download configs as .jsonc when they contain comments
- Add strip-json-comments dependency for JSONC parsing
- Add .jsonc MIME type support in backend file service

This preserves comments in opencode.jsonc files when editing through the UI
2025-12-12 15:29:53 -05:00
Chris Scott 8d0d961e50 Rename project from opencode-webui to opencode-manager
- Update package names from opencode-webui to opencode-manager
- Update all backend import statements to use @opencode-manager/shared
- Update Docker configuration and container name
- Update README.md with new repository URLs and project title
- Update frontend assets and titles
- Update version to 0.4.0
- Update docker entrypoint script comments

This change maintains all functionality while better reflecting the
project's purpose as a comprehensive management interface for OpenCode.
2025-12-12 13:58:08 -05:00
Chris Scott b739c5266f Switch MCP management to use OpenCode server API with version requirement >=1.0.137 2025-12-09 00:13:27 -05:00
Chris Scott 42b5eff728 Restart OpenCode server after OAuth callback with loading UI 2025-12-07 23:26:11 -05:00
Chris Scott bc99c96021 Add OAuth provider authentication support (#14)
* feat: Implement OAuth support for provider authentication

- Add OAuth routes and API endpoints for authorize/callback flows
- Create OAuthAuthorizeDialog and OAuthCallbackDialog components
- Extend ProviderSettings to support both OAuth and API key auth
- Add OAuth credential support to auth service
- Update shared schemas with OAuth request/response types
- Support both 'auto' and 'code' OAuth flows
- Maintain backward compatibility with existing API key authentication

Backend:
- backend/src/routes/oauth.ts (new)
- backend/src/services/auth.ts (extended)
- backend/src/index.ts (route registration)

Frontend:
- frontend/src/api/oauth.ts (new)
- frontend/src/components/settings/OAuthAuthorizeDialog.tsx (new)
- frontend/src/components/settings/OAuthCallbackDialog.tsx (new)
- frontend/src/components/settings/ProviderSettings.tsx (enhanced)

Shared:
- shared/src/schemas/auth.ts (OAuth schemas)

* feat: Complete OAuth implementation with comprehensive features

- Add comprehensive error handling for OAuth failures with specific error messages
- Implement OAuth token status checking and expiration monitoring
- Add token refresh preparation with 5-minute expiration buffer
- Enhance OAuth API client with detailed error reporting
- Update OAuth routes to include database parameter and token status endpoint
- Add complete OAuth documentation to README with setup guide
- Improve user experience with clear error messages and troubleshooting steps
- Support both auto and code OAuth flows for different providers
- Maintain backward compatibility with existing API key authentication

Error Handling:
- Specific error messages for invalid codes, expiration, access denied
- Graceful fallback for server errors and network issues
- User-friendly error display in OAuth dialogs

Token Management:
- Token status endpoint for checking credential validity
- Expiration monitoring with automatic refresh preparation
- Secure storage of OAuth credentials alongside API keys

Documentation:
- Complete OAuth setup guide in README
- Comparison table for OAuth vs API keys
- Troubleshooting section for common OAuth issues

* fix: Resolve OAuth button opening API key dialog instead

- Add isOAuthMode state to track authentication mode
- Update API key dialog to only open when not in OAuth mode
- Modify OAuth and API key button handlers to set proper mode
- Add proper cleanup handlers to reset OAuth mode on close
- Ensure dialog state management prevents conflicting dialogs

This fixes the issue where clicking 'Add OAuth' would incorrectly
open the API key dialog instead of the OAuth authorization dialog.

* refactor: Address audit findings for OAuth implementation

Critical fixes:
- Remove unused db parameter from createOAuthRoutes()
- Add query invalidation in handleOAuthSuccess to update UI after OAuth
- Remove unused setOAuth and getOAuthWithRefreshCheck methods
- Fix file permission in delete method (add mode: 0o600)

DRY improvements:
- Extract duplicated error handling to shared oauthErrors.ts utility
- Add OAuthMethod constants to replace magic numbers 0/1
- Use centralized OPENCODE_SERVER_URL constant via ENV config
- Remove unused ProviderAuthMethodsResponseSchema import

Code quality:
- Add documentation comment noting types should match shared schemas
- Consolidate error mapping logic into single mapOAuthError function
- Improve code maintainability and reduce duplication

Files changed:
- backend/src/routes/oauth.ts
- backend/src/services/auth.ts
- backend/src/index.ts
- frontend/src/lib/oauthErrors.ts (new)
- frontend/src/api/oauth.ts
- frontend/src/components/settings/OAuthAuthorizeDialog.tsx
- frontend/src/components/settings/OAuthCallbackDialog.tsx
- frontend/src/components/settings/ProviderSettings.tsx

* Store model selection client-side with recent models display

* Limit provider settings to OAuth-capable providers only

* Remove unused code and consolidate model initialization into useModelSelection hook
2025-12-07 23:01:05 -05:00
Chris Scott e37059360a Replace URL token embedding with GIT_ASKPASS for git authentication 2025-12-05 07:51:33 -08:00
Chris Scott af0dcac7c8 Add GitHub token environment variable support and improve git operations 2025-11-30 21:05:30 -05:00
Chris Scott ae929a7c96 Fix intermittent mobile scroll lock and suppress expected git errors on empty repos 2025-11-29 00:02:10 -05:00
Chris Scott f90683071f Fix mobile scroll on session reload and git errors on empty repos 2025-11-28 22:33:51 -05:00
Chris Scott fb91b4d3a3 Add TTS support with OpenAI-compatible endpoint configuration
- Add TTS settings schema and configuration UI with validation
- Create backend TTS proxy with 24hr file-based caching
- Add frontend useTTS hook with Cache API caching
- Add TTS playback button on assistant messages (step-finish)
- Include test button to verify TTS configuration
2025-11-28 19:52:35 -05:00
Chris Scott dfde798845 Fix migration to handle tables missing is_local and is_worktree columns 2025-11-28 10:36:58 -05:00
Chris Scott 83834e7ed7 Add local repository support and permission request handling 2025-11-28 10:26:03 -05:00
Chris Scott ed82b99236 Add git changes viewer with diff display
- Add backend git-operations service for git status and file diffs
- Add git/status and git/diff API routes to repos
- Add GitChangesPanel component to list changed files with status
- Add FileDiffView component with unified diff rendering
- Add GitChangesSheet as full-screen dialog wrapper
- Integrate View Changes option into BranchSwitcher dropdown
- Support both mobile (stacked) and desktop (split) layouts
2025-11-27 10:10:49 -05:00
Chris Scott 12b7ab54b2 Add file virtualization and patch editing for large files 2025-11-27 09:23:10 -05:00
Chris Scott 16767a2a77 Add dynamic path display to file browser with truncation support 2025-11-27 08:28:30 -05:00
Chris Scott fea3c214af Add MCP server management with auto-restart functionality 2025-11-26 23:43:19 -05:00
Chris Scott 349c130311 Fix Docker build: use pnpm workspaces and route frontend API calls through backend proxy 2025-11-25 14:17:17 -05:00
Chris Scott 18be821fdb change backend port from 5001 to 5003 2025-11-25 10:59:17 -05:00
Chris Scott b7cf5a707a refactor: replace OpenCode server restarts with config patch API 2025-11-25 10:34:18 -05:00
Chris Scott 595c1e2da6 fix: auto-create default OpenCode config on startup and sync to disk on update 2025-11-25 10:30:40 -05:00
Chris Scott 4d7572a4fc fix: consolidate OpenCode config file path and sync on startup 2025-11-25 10:09:28 -05:00