Commit Graph
154 Commits
Author SHA1 Message Date
Chris Scott 29b9d028c7 feat(frontend): improve mobile voice controls and TTS playback 2026-04-18 08:25:47 -04:00
Chris Scott 8e90ba2e6e refactor: remove custom title generation and optimize session updates (#187)
* chore: bump version to 0.9.16

* Remove custom session title generation and rely on upstream OpenCode titles

- Delete backend/src/routes/title.ts and backend/src/services/session-title.ts
- Remove /api/generate-title route from backend/src/index.ts
- Delete backend/test/routes/title.test.ts
- Remove useTitleGenerating hook and title generation logic from frontend/src/hooks/useOpenCode.ts
- Remove generating prop from Header.EditableTitle and frontend/src/pages/SessionDetail.tsx
- Clean up unused imports in frontend/src/hooks/useOpenCode.ts and frontend/src/components/ui/header.tsx
- Session titles now come directly from upstream OpenCode via session refetches after prompt

* refactor: optimize session query updates with setQueryData

- Remove redundant query invalidations in useSendPrompt
- Use setQueryData for optimistic updates in SSE session.updated handler
- Update session cache directly when session exists in list
- Prepend new sessions to list when not found
- Fall back to invalidation only when cache is empty
2026-04-16 09:59:35 -04:00
Chris Scott 6d961ccd72 fix: improve OAuth dialog UX and fix session state management
- Add auto-start authorization for single-method OAuth providers
- Fix optimistic message cleanup on error in useSendPrompt
- Add JSON Pointer path decoding for validation errors
- Improve OAuth dialog responsive layout and truncate long labels
- Change onSuccess to onSettled for proper query invalidation
2026-04-15 16:39:07 -04:00
Chris Scott 2b5e130916 feat: add dynamic OAuth prompt system with conditional fields
- Add PromptFieldSchema supporting text and select input types
- Support conditional prompt visibility based on previous inputs
- Add inputs parameter to OAuth authorize request
- Update OAuth dialogs to render dynamic prompts
- Add OPENCODE_PUBLIC_URL config for OAuth callback URLs
- Remove redundant OAuthMethod enum in favor of backend schema
2026-04-15 14:10:19 -04:00
Chris Scott 8437efe16d loop: model-fallback-fix completed after 3 iterations 2026-04-14 20:42:50 -04:00
Chris Scott 8cfc6c0a17 fix: read config from file for reload and improve provider validation
- Change reloadConfig to read from opencode.json file instead of HTTP API
- Add logging for OpenCode PATCH responses to aid debugging
- Make providerId optional in schema with custom validation when needed
- Update test to mock fs.readFile instead of fetch
2026-04-13 21:44:39 -04:00
Chris Scott 1f6180e03c Add OpenCode models editor with mobile repos UI refactoring 2026-04-13 14:24:52 -04:00
Chris Scott d893148d3d fix: surface config validation errors in settings 2026-04-12 13:04:53 -04:00
Chris Scott 9669570e97 fix: protect existing workspace state during host import 2026-04-12 12:33:56 -04:00
Chris Scott 0a37fd14a3 feat: add OpenCode models editor and bump version to 0.9.13 2026-04-12 12:14:35 -04:00
itz4blitzandChris Scott 6b1a1e2005 feat: add explicit OpenCode host import and repo relink (#176)
* feat: add explicit OpenCode host import and repo relink

* fix: tighten OpenCode import and relink reporting

* Add OpenCode config schema and JSONC parser imports

* Fix repo relinking and state availability detection for config-only imports

* Remove unused exports and internalize row-shape types

* Remove unused reserveScheduleJobNextRun function

---------

Co-authored-by: Chris Scott <99081550+chriswritescode-dev@users.noreply.github.com>
2026-04-12 10:50:37 -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 1da1ec617a fix: reload OpenCode config and invalidate provider caches after credential changes (#183)
- Trigger reloadConfig() after API key save/delete in providers route so the
  OpenCode server immediately recognizes newly connected providers
- Wrap reloadConfig() in try/catch in both providers.ts and oauth.ts so
  credential operations succeed even if the reload fails transiently
- Add invalidateProviderCaches() utility covering all provider-related query
  keys, replacing scattered manual invalidation across ProviderSettings
- Remove duplicate provider key invalidation from invalidateConfigCaches()
  by delegating to invalidateProviderCaches()
- Remove unused invalidateAllConfigRelatedCaches() export

Fixes #180
2026-04-07 10:23:55 -04:00
Chris Scott 55ec3440f8 Fix SSH credential host matching and Bitbucket test detection (#174, #175) (#178) 2026-04-05 18:12:06 -04:00
Chris Scott c32feae8ef Fix session creation error handling and health endpoint status codes (#177) (#179) 2026-04-05 09:07:34 -04:00
Chris Scott c87edded70 Update tests to use Loop terminology 2026-03-27 15:32:05 -04:00
Chris Scott 2c4a9c9257 Complete Ralph to Loop rename across entire codebase
Rename all Ralph references to Loop including types, services, hooks,
filenames, KV keys, API routes, frontend components, tests, and docs.

Key changes:
- Types: RalphState → LoopState, RalphConfig → LoopConfig
- Services: ralph.ts → loop.ts with worktree field (inverted from inPlace)
- KV keys: ralph: → loop:, ralph-session: → loop-session:
- API routes: /ralph/* → /loop/*
- Frontend: useLoopStatus, RepoLoopList, getLoopStatus, cancelLoop
- Config backward compatibility: accepts both loop and ralph (prefers loop)
- Automatic KV migration on plugin startup
- memory-plan-execute keeps inPlace parameter (different semantics)

Fixes critical bugs found in code review:
- Backend /loop/cancel route using wrong ralph: KV prefix
- Frontend error messages still referencing Ralph
- Log message consistency
2026-03-27 14:45:54 -04:00
Chris Scott 20838f0b88 Add listAllScheduleRuns API endpoint
Add database function, service method, and route to list all schedule runs with filtering
2026-03-25 15:49:35 -04:00
Chris Scott bcfb7223c0 Refactor Ralph session tracking with KV-backed session mapping and configurable TTL (#172)
* Fix Ralph state type safety and null handling in status commands

* Refactor Ralph to use worktree-keyed session mapping instead of sessionId lookups

* Add configurable KV TTL with 7-day default and update agent prompts

* Add --limit flag to CLI status and improve null safety for RalphState fields

* Bump memory package version to 0.0.25
2026-03-25 14:55:44 -04:00
Chris Scott 86613b1ea4 Add Ralph status dialog and session management improvements (#171) 2026-03-24 20:25:09 -04:00
Chris Scott 9975be955e Refactor routes to use shared route-helpers utility
Extracts parseId and handleServiceError into reusable helpers
for consistent error handling and ID parsing across all routes.
2026-03-24 11:39:11 -04:00
Chris Scott 7757dac163 Fix typecheck error in schedules test
Add missing listAllJobsWithRepos mock to scheduleService
2026-03-22 18:58:27 -04:00
Chris Scott f18bcbbf3e Refactor global schedules with mobile-responsive UI and backend optimizations (#167)
* ralph: ralph-global-schedules-dashboard completed after 2 iterations

* Refactor global schedules with mobile-responsive UI and backend optimizations
2026-03-22 18:23:36 -04:00
Chris Scott c3cba72b51 Update skills UI components for managed skills (#165)
* ralph: ralph-repo-level-skills-dialog-skillseditor-fix completed after 4 iterations

* Remove parent session notification and child session tracking from Ralph loops

Sending promptAsync to parent sessions on loop completion could resume
work in previously inactive sessions. Removed parentSessionId from
RalphState, child session tracking maps, and all related event handling.
Watchdog stall detection still works via the session status API.

* Migrate global skills to workspace path

* Add skill injection to scheduled job prompts

* Refactor schedules UI with MultiSelect and tab menu

* Update skills UI components for managed skills
2026-03-22 14:52:32 -04:00
Chris Scott 4bd0940ab9 Add skills editor UI, backend service, shared schema, and promote unused-vars to error 2026-03-22 11:37:02 -04:00
Chris Scott 7d65e20c55 Fix schedule-related test mocks for DI refactor and migration changes 2026-03-22 11:30:08 -04:00
Chris Scott 47524876aa Refactor schedule service and add cron support 2026-03-22 11:14:30 -04:00
Chris Scott dbf48d4691 Fix duplicate import in repo.ts 2026-03-21 23:38:07 -04:00
Chris Scott 1e863c5fc5 Add cron-based scheduling with prompt templates integration (#164) 2026-03-21 23:33:03 -04:00
21a2094cfd Pr 158 (#161)
* feat: discover local repos and reconnect OpenCode sessions

Replace one-by-one local repo setup with parent-folder discovery and path-aware repo linking so first-time installs can recover existing OpenCode chats. Add first-run import support and onboarding docs for standalone OpenCode users, including Docker path-matching guidance.

* fix: address session discovery review feedback

* fix: improve delete/unlink messaging for local vs cloned repos

* feat: discover local repos and reconnect OpenCode sessions (#158)

---------

Co-authored-by: itz4blitz <justinscroggins@outlook.com>
Co-authored-by: itz4blitz <60281870+itz4blitz@users.noreply.github.com>
2026-03-20 21:06:09 -04:00
Chris Scott 1248d0b9e0 Update memory plugin (#160) 2026-03-20 12:16:56 -04:00
Chris ScottandNiu Shuai 5746033fde Test fix branch (#157)
* fix(lsp): Fixes pyright LSP initialization timeout

* test(lsp): Add unit tests for bin directory initialization

- Add reinitializeBinDirectory() public method for testing
- Add 7 comprehensive test cases
- Cover success scenarios, error handling, and edge cases
- Achieve 100% code and branch coverage

* Refactor OpenCode server for testability and fix bin directory tests

* Standardize test ENV mocks and modernize imports

---------

Co-authored-by: Niu Shuai <guisu2010@gmail.com>
2026-03-08 21:40:37 -04:00
Niu ShuaiandChris Scott 62343366f6 fix(lsp): Fixes LSP initialization timeout (#152)
* fix(lsp): Fixes pyright LSP initialization timeout

* test(lsp): Add unit tests for bin directory initialization

- Add reinitializeBinDirectory() public method for testing
- Add 7 comprehensive test cases
- Cover success scenarios, error handling, and edge cases
- Achieve 100% code and branch coverage

* Refactor OpenCode server for testability and fix bin directory tests

---------

Co-authored-by: Chris Scott <99081550+chriswritescode-dev@users.noreply.github.com>
2026-03-08 21:36:07 -04:00
Chris Scott ebb0db0cad Replace shell commands with native fs in repo service 2026-03-07 22:46:28 -05:00
Chris Scott e1a4a70d3d Replace strip-json-comments with jsonc-parser for better error reporting 2026-03-07 10:42:18 -05:00
Chris Scott 47ef830cbb Skip notifications for subagent sessions 2026-03-04 19:56:55 -05:00
Chris Scott a911a2f759 Restore enhanced source control features from PR #138
PR #145 accidentally reverted all source control enhancements from PR #138. This cherry-picks those changes back: discard changes functionality, commit detail view, commit file diffs, diff truncation, and UI improvements.
2026-02-23 16:43:28 -05:00
Chris Scott 3461f86556 Add memory plugin with semantic search and session planning (#145)
* Add memory plugin with semantic search and session planning

* Clarify Memory Plugin is optional in docs
2026-02-23 15:08:56 -05:00
theepicsaxguyandChris Scott da283a82cf Feature/enhanced source control (#138)
* feat: enhance source control with discard and commit detail views

- Add discard changes functionality with confirmation dialog
- Implement commit detail view with file list and diffs
- Update commit badges: blue for unpushed (local), purple for pushed (remote)
- Display current branch in commits header
- Reuse existing components (DeleteDialog, FileDiffView, GitFlatFileList)
- Add proper error handling and toast notifications
- Extend backend API with /discard and /commit/:hash endpoints
- Update types to include CommitDetails and CommitFile interfaces

Backend:
- Add discardChanges() method to GitService
- Add getCommitDetails() and getCommitDiff() methods
- Add POST /:id/git/discard endpoint
- Add GET /:id/git/commit/:hash and /:id/git/commit/:hash/diff endpoints

Frontend:
- Add discard button (rotate-left icon) to file items
- Add gitDiscardFiles API function and useGit mutation
- Create CommitDetailView component
- Update CommitsTab with color coding and branch display
- Extend SourceControlPanel for commit detail navigation
- Add confirmation dialog using DeleteDialog pattern

Tests:
- Backend tests passing with 77% line coverage
- Linting passes for all modified files
- Type safety maintained throughout

BREAKING CHANGES: None

* Fix critical bugs from code review

- Fix syntax error in GitService.ts (missing closing brace for getCommitDiff)
- Make AUTH_SECRET mandatory in crypto.ts to prevent weak encryption fallback
- Fix race condition in PassphraseHandler by using unique request IDs
- Add error logging to ssh-key-manager catch blocks
- Add type guards (isGitCredential, filterGitCredentials) to replace unsafe assertions
- Fix TypeScript errors and variable shadowing in GitService and settings
- Remove unused variable in sshHostKeyHandler
- Update GitService tests with proper mock data structure

All changes verified: lint passes, typecheck passes, 102/103 tests pass

* Fix critical bugs from code review

- Fix git restore command syntax (--source=HEAD → --source HEAD)
- Use crypto.randomBytes for secure requestId generation
- Add requestId to SSH host key broadcast for frontend compatibility
- Add missing onDiscard prop to GitFlatFileList
- Remove dead code (187 unreachable lines) in ChangesTab
- Fix regex alternation bug in commit stat parsing
- Optimize getCommitDetails with --numstat (N+1 → 1 git call)
- Optimize unpushed commit check to use merge-base instead of full list
- Remove useless conditional in handleDiscard
- Fix type contract violation in CommitDetailView onSelect

* fix: resolve code review issues

- Add missing handleDiscard function in ChangesTab.tsx
- Fix duplicate requestId property in sshHostKeyHandler.ts
- Remove unnecessary type assertion in settings.ts

* feat: enhance source control with commit view improvements and diff fixes

- Add readOnly mode to GitFlatFileList to hide stage/unstage buttons in commit view
- Fix commit file diff display by using correct git show command syntax
- Add line stats display (+additions/-deletions) for each file in commit view
- Show total commit stats in header (Changed Files N +X -Y)
- Fix commit file list parsing to use --name-status and --numstat
- Add 500KB diff size limit with truncation warning
- Fix discard changes for untracked files by deleting them directly
- Update Dockerfile to copy backend/node_modules correctly
- Fix TypeScript error in CommitDetailView onFileSelect call

* Refactor API error handling and enhance source control functionality

* Fix code review issues: OAuth error handling, unpushed detection, comments, and duplicates

- Remove shared handleApiError import from OAuth and restore local pattern

- Fix isCommitUnpushed to use getUnpushedCommitHashes for correct upstream detection

- Remove inline comments from ssh-key-manager.ts (style violation)

- Remove duplicate fetchCommitDiff function

- Add missing getErrorMessage import to repo-git.ts

* Refactor imports and type assertions in GitService, SSH tests, and handleApiError

* Refactor GitService methods for improved error handling and code clarity; add discardChanges functionality and enhance commit details retrieval

* Refactor Git and SSH services: streamline imports, enhance error handling, and remove unused code

* Refactor source control components: remove unused useGitAction hook and enhance error handling in handleGitAction

* Enhance error handling in Git routes and improve UI components for better user experience

* Remove unnecessary blank line in GitService class

* Fix commit log parsing and rename detection in GitService

* Refactor source control UI for full-screen diffs, improve mobile view, and add discard confirmation dialog

* Fix lint warnings and ignore test files in GitGuardian scan

---------

Co-authored-by: Chris Scott <99081550+chriswritescode-dev@users.noreply.github.com>
2026-02-21 21:57:05 -05:00
Chris ScottandFran Boon b38b9e3aca Add version notifications for new releases (#139)
* Add SSH known hosts support and optimize git status fetching

* Add opencode-manager version to health endpoint

* Add version notifications for new releases

---------

Co-authored-by: Fran Boon <fran@aidiq.com>
2026-02-16 20:07:20 -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 687ad405ae Extract swipe gesture logic and improve push notification handling (#135) 2026-02-14 23:19:37 -05:00
Chris Scott 19963f579e fix: remove automatic orphaned directory cleanup on startup (#128) (#132) 2026-02-14 08:46:57 -05:00
Chris Scott 626e2b1954 fix: service worker improvements for PWA reliability (#127) 2026-02-13 23:43:29 -05:00
Chris Scott 3f9c398b31 feat: MCP OAuth flow improvements (#123)
Rewrite OAuth flow handle authentication entirely in web app with secure proxy
- Add MCP OAuth proxy with origin validation and callback handling
- Remove auto OAuth method from authentication flow
- Fix TypeScript build errors
- Add directory support for MCP OAuth flows and improve config manager UI
- Reload session caches after MCP connection changes
2026-02-13 00:10:56 -05:00
Chris Scott 7341dce1ef Add skip SSH host key verification and fix self-hosted server support (#121)
* Add SSH host key verification with automatic trust and SCP-style URL support

* Fix TypeScript errors for SSH host key schema and test mocks
2026-02-11 22:58:13 -05:00
Chris Scott 414f39b809 feat: SSH Authentication Keys v2 (#113)
* feat: add SSH authentication keys v2 for Git operations

Add comprehensive SSH key authentication support for Git operations including:
- SSH host key verification with user approval flow
- Encrypted SSH key storage with passphrase support
- SSH connection testing endpoint
- Real-time host key change warnings

Backend changes:
- New SSHHostKeyHandler for managing host key verification via IPC
- Add passphrase handler for locked SSH keys
- Add SSH key manager utilities (key writing, validation, cleanup)
- Add crypto utilities for secure key/secret encryption
- Add SSH validation utilities for key format checking
- Add SSH routes for host key response handling
- Enhance GitAuthService with SSH setup and environment methods
- Update GitService to handle SSH authentication for push/fetch/pull
- Update OpenCode server to support SSH keys with SSH config generation
- Add database migration for trusted_ssh_hosts table
- Add settings endpoint for SSH connection testing

Frontend changes:
- Add SSHHostKeyDialog for host key verification UI
- Add PassphraseModal for SSH key passphrase input
- Update GitCredentialDialog with SSH key type and testing
- Update GitSettings to manage SSH keys
- Add SSH API client and hooks (useSSH, usePassphraseHandler)

Shared changes:
- Add SSH schemas and types

Test coverage:
- Integration tests for SSH flow
- IPC handler tests for host key and passphrase
- SSH route tests
- SSH utility validation tests
- Updated existing tests for SSH-aware changes
2026-02-08 00:06:44 -05:00
Chris Scott e3716bb294 Refactor: Consolidate git services into single GitService class + Settings dialog improvements (#111)
* refactor: consolidate git services into single GitService class

Merges GitBranchService, GitCommitService, GitDiffService, GitFetchPullService,
GitLogService, GitPushService, and GitStatusService into one cohesive GitService
that simplifies architecture and follows SOLID principles. Updates all route
handlers and tests to use the new consolidated service. Moves GitBranch interface
to shared types location.

* Refactor settings dialog to use URL-based state management with tab synchronization

* Update social preview image
2026-02-06 21:59:18 -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 f570758b74 refactor: improve virtualized text viewer with React Query infinite scroll and simplified buffering (#108)
* 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
2026-02-05 20:18:27 -05:00