- fetch picker sessions only while the dialog is open
- list all-projects sessions with one request per page
- block infinite-scroll paging while a search is pending
- memoize picker rows with stable callbacks
- remove deleted sessions from list caches instead of refetching
- keep the repo tab when the open session is deleted
- reuse useSessionSearch in the sidebar session tree
- drop dead activeSessionID/isActive and share delete, session-key and repo-map helpers
- move usePersistentBoolean to its own hook
Align the manager's model selection with the OpenCode TUI: one
model.json-backed preference store, one provider catalog, one ordering
and default-ownership rule, and one set of availability, ref-formatting
and variant helpers shared across chat, schedules, agents and the goal
auditor.
- Add a shared TUI-compatible model-preference module and make the
backend model.json store match its format.
- Consolidate the frontend provider catalog, availability check, model
ref formatter and variant persistence into single owners.
- Drive chat, schedule, agent and goal-auditor model lists from a shared
useModelSections hook and buildModelSections, following TUI ordering.
- Extract a shared ModelCombobox with a taller list, and list models the
TUI way in ModelQuickSelect.
- Add a shared isRecord util and model-selection comparison helpers.
* fix: stabilize scheduled runs and background task tracking
* fix: complete scheduled runs and harden background task status
- Route directory-less OpenCode session events (session.execution.*,
session.usage.updated) to backend listeners by remembering each
session's directory in the SSE aggregator, so scheduled runs finish
and failure push notifications fire; browser delivery is unchanged.
- Resolve background shell status from the transcript completion notice
when OpenCode no longer lists the shell, keep the first terminal
status so a kill is not reported as completed, and share one status
icon and colour mapping between the transcript and background bar.
- Reconcile child sessions only while unknown or running, trigger it
from the EventProvider alone, refresh children that drop to unknown
after a poll, and forget deleted sessions.
- Fetch the model list and default concurrently while waiting for the
schedule model, share configured-model selection, and consolidate
schedule startup cancellation cleanup.
- Reduce background work re-renders, prune shell exit records, remove
dead exports, and document background work in the chat guide.
* fix: hide finished background tasks and clip long dialog titles
* feat(sidebar): add repo-grouped session navigation with live status
- Add a searchable, collapsible session tree to the desktop sidebar, grouped by repository with pinned and time-bucketed ordering.
- Track per-session busy, retry, and compact status in a shared store fed by the SSE event stream and scoped by directory.
- Extract shared navigation components reused by the desktop tree and the mobile repo quick-switch sheet.
- Show a Git tab and hide Schedules inside a repo on the mobile tab bar; add Repos and Assistant entries to the session More drawer.
- Replace the CommitsTab local relative-time formatter with a shared formatShortRelativeTime util.
* refactor(sidebar): unify session status tracking and navigation helpers
* feat(sidebar): add collapsible sessions and menu sections
* fix(sessions): keep specific live status over snapshot busy
* feat(opencode): migrate OpenCode Manager to OpenCode 2
Port the backend lifecycle, generated plugins, event aggregation,
schedules, worktrees, provider credentials, MCP, config handling, the
frontend chat model, and the ocm CLI to OpenCode 2.
Adopt @opencode/client 2.0.15 as the single typed V2 API contract,
require OpenCode 2.0.0 or newer (pinned 2.0.15), and delete every
V1-only code path.
* refactor(opencode): reload config in place and drop v1 compatibility shims
Route config/skill/AGENTS.md changes through the OpenCode location reload
API instead of a full server restart, stop auto-resuming interrupted
sessions, remove the restart coordinator and v1 MCP/version shims, and pin
support to OpenCode >=2.0.15 <3.0.0. Adds integration-ready retries,
service-mode launch, ocm-cli repo proxy, and new frontend form/MCP helpers.
* refactor(opencode): consolidate v2 migration helpers and harden install, proxy, and session flows
- extract shared semver and model-ref utilities, reuse across version checks
- share the OpenCode release download script across Docker, entrypoint, dev setup
- unify install/upgrade failure recovery and guard externally managed OPENCODE_BIN
- scope the repo proxy location rewrite and surface ocm proxy errors
- rework frontend session projection, permission lookup, and cache invalidation
* fix(schedules): reject unavailable agents before creating a session
* feat(opencode): add ocm install, schedule agent fallback, and session move guards
Load additional session pages when child filtering leaves the viewport underfilled. Preserve directory and workspace identity, stop automatic pagination after next-page errors, and provide explicit retry with regression coverage.
Fixes#350
Remove the long-lived synchronous POST to /session/{id}/message that produced
spurious "Connection Failed" banners on transient network blips; route every
send (normal, streaming-queue follow-up, message refresh) through prompt_async,
whose failure genuinely means not-delivered. Suppress network-kind banners
while SSE is disconnected or reconnecting (the header already shows that state);
session-kind banners still appear and reconcile clears confirmed prompts after
reconnect.
* fix: remove unused disabled prop, throttle SW update checks, precache icon
* fix: retract transient send error and restored prompt once server confirms send
When a long-running prompt request drops (gateway timeout or network error)
while the agent is actually working, the send error banner and the restored
prompt text were left in place. Tag send errors as 'network' and clear them
when the server confirms session activity (message.updated / session.idle),
also clearing the restored input text. Genuine server-reported session errors
(kind 'session') are preserved.
* style: restyle ErrorBanner with neutral card fill and destructive accent bar
Replace the all-red destructive Alert variant (transparent background, full
red text) with a neutral card-filled banner, a left destructive accent bar,
red icon, foreground title, and muted body/detail text. Improves the send-error
and git-error banners on the dark theme.
* fix: preserve prompt text on network error and allow offline typing
* fix: preserve prompt on network error, swallow 524 to avoid duplicate sends
* feat: add service worker precaching with app shell and runtime cache strategies
* fix: copy frontend/plugins into Docker build context
* fix: improve service worker update checks with visibility and focus handlers
* fix: add connect timeout to event stream to recover from failed connections
* fix: remove optimistic message insert, keep prompt in input until server confirms
* feat: add session status store with optimistic active state and SSE polling
- Adds sessionStatusStore with setOptimisticActive (auto-timeout), statusCache deduplication, and replaceStatuses/clearStatus
- Integrates store in useSendPrompt (set optimistic on send, clear on error)
- Adds session.status SSE event handling in useSSE with 5s polling fallback
- Refactors test to mock the store instead of using real store instance
- Fixes repoId null check in useRepoActivity
* feat: replace event-source-polyfill with native SSE for PromptInput
* fix: keep stop button visible and hide clear prompt button during active session
* feat: restore failed queued prompts and preserve optimistic active status during poll
* test: add MessageThread tests for optimistic editing state and resend flow
* fix: handle queued prompt edge cases during pending submission and SSE errors
* feat(session): paginated session list with infinite scroll and search
Replace per-directory useQueries session listing with a combined
cursor-based useInfiniteQuery (25 per page, loads more on scroll) and
move search into the API query instead of client-side filtering.
Add OpenCodeClient.listSessionsPage backed by the v2 /api/session
endpoint plus a toLegacySession adapter. Add invalidateSessionListCaches
to centralize session-list cache invalidation for infinite queries, and
update EventContext and useSSE to handle the new infinite-query cache
shape.
* fix(session): centralize and debounce session-list cache invalidation
Migrate ResetPermissionsDialog off the stale per-directory cache key
(which no longer matches the infinite-query key shape and hardcoded the
opencode URL) to the shared invalidateSessionListCaches helper, and drop
the now-unused repoDirectory prop and its call sites.
Debounce session-list invalidation on SSE session.updated events in
EventContext and useSSE so a burst of updates coalesces into a single
refetch instead of one per event. Fix the directory fallback in
EventContext getClient so it never returns the joined directory key.
* fix(permissions): scope instance dispose to the repo directory
Drop the session-list cache invalidation from ResetPermissionsDialog:
disposing the OpenCode instance does not change the persisted session
list, so the refetch was unnecessary, and the prior cache key no longer
matched the paginated shape.
Guard the reset-permissions route against an empty repo directory so it
never forwards /instance/dispose without a directory, which would
dispose the entire server instead of only the repo's instance.
* loop: worktree-tabs-2 completed after 4 iterations
* loop: server-env-vars completed after 7 iterations
* feat(worktree): add worktree tabs and server env vars settings
* refactor(worktree): multi-directory SSE support and workspace chip row
* feat(workspace): collapsible workspace manager and sibling filtering
* feat(workspace): workspace creation endpoint, refactored workspace manager, and tests
* refactor(frontend): unify workspace label and remove dead code
- extract shared workspaceLabel helper into api/repos and reuse in
WorkspaceManager and RepoDetail directoryLabels
- remove unused useSessions hook and subscribeToDirectory subscription
- drop redundant frontend workspace dedup now guaranteed by backend
- align WorktreeTabs empty-state test with create-workspace button
* 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
* 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
* 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
* 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
* 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
* Switch to sync prompt endpoint for reliable message delivery
Use the synchronous /message endpoint instead of /prompt_async to ensure
the UI receives authoritative response data. This matches OpenCode TUI
behavior and prevents message desync during sub-agent tasks.
* Add SSE heartbeat to prevent Cloudflare 524 timeout
* Add Better Auth integration with session management
- Implement user authentication using Better Auth library
- Add login, register, and sign out functionality
- Support passkey/WebAuthn authentication
- Create database schema for users, sessions, accounts, passkeys
- Add AuthProvider context and ProtectedRoute components
- Add account settings page in settings dialog
- Protect all API routes with authentication middleware
- Update environment configuration for auth providers
* Add single-user authentication system with admin setup
- Add first-run Setup page for initial admin account creation
- Add environment-based admin configuration (ADMIN_EMAIL, ADMIN_PASSWORD)
- Add password reset capability via ADMIN_PASSWORD_RESET environment flag
- Migrate to data routers with auth loaders, remove ProtectedRoute
- Add change password functionality to account settings
- Enforce AUTH_SECRET requirement in production
- Auto-disable registration when admin is pre-configured via environment
* Track busy/idle session status across hooks
* Bump version to 0.7.5
* Update pnpm to 10.28.1
Fixes#62
- Config file in workspace volume is now the source of truth
* Preserve raw config content with comments instead of re-stringifying parsed JSON
* Sync provider credentials to OpenCode server when adding or removing API keys
* Add error handling for session errors with toast notifications and inline message display
* Refactor provider settings to manage API keys directly with edit/delete support
* 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>