Commit Graph
413 Commits
Author SHA1 Message Date
Chris Scott 4e32fd5b00 feat: add session status store with optimistic active state and SSE polling (#272)
* 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
2026-06-10 08:35:19 -04:00
Chris Scott 8133b655b0 refactor: persist assistant repo in database with ID migration (#271) 2026-06-09 14:46:39 -04:00
Chris Scott 0d384d6cf0 refactor: move assistant workspace install before OpenCode server start (#263)
* refactor: move assistant workspace install before OpenCode server start

* refactor: skip assistant-mode status fetch on open, use repo fullPath and cached session
2026-06-07 13:35:19 -04:00
Chris Scott 0d14e754e1 refactor: extract shared useUrlParams hook and use push navigation for dialogs (#266)
* refactor: extract shared useUrlParams hook and use push navigation for dialogs

* Remove schedule badges and fix dialog safe area padding

* fix: deduplicate server health toasts with stable IDs

* fix: restore Enabled/Paused status badges on schedule jobs

* refactor: consolidate url state hooks and add shared test utilities
2026-06-07 13:02:56 -04:00
Chris Scott ec7a47dc10 feat: replay session statuses on upstream reconnect and add compact type (#268) 2026-06-06 23:02:48 -04:00
Chris Scott 95ae584f6a feat: interactive task list checkboxes in markdown preview (#267)
* feat: interactive task list checkboxes in markdown preview

* fix: persist markdown checkbox toggles

* fix: sync optimistic markdown checkbox state

* fix: align markdown checkbox preview state

* fix: prevent "0" rendering in file browser header when repoId is 0
2026-06-06 22:11:49 -04:00
Chris Scott ac3cfc32f9 fix: allow editing in config editor without clearing search first (#265) 2026-06-06 18:16:13 -04:00
Chris Scott bcabcc145a fix: derive session active state from server status and incomplete assistant, not last user message 2026-06-06 16:02:10 -04:00
Chris Scott 468e2f5dfb refactor: derive session active state from messages instead of status store (#264)
* refactor: derive session active state from messages instead of status store

* refactor: remove duplicate session.updated handler from EventContext
2026-06-06 15:50:13 -04:00
Chris Scott d6bc1d7b69 fix(parts-batcher): defer operations when target message is missing from cache (#262)
* fix(parts-batcher): defer operations when target message is missing from cache

* fix(parts-batcher): add TTL for deferred operations to prevent repeated invalidations
2026-06-06 13:07:32 -04:00
Chris Scott 5dc95dc3f4 Merge branch 'refactor/sse-perf-hardening'
# Conflicts:
#	frontend/src/hooks/useSessionAgent.ts
2026-06-06 11:38:05 -04:00
Chris Scott a87ae2db9c Revert "fix: preserve session selection on reconnect (#261)"
This reverts commit fdeffeaab7.
2026-06-06 11:34:50 -04:00
Chris Scott d57a3b5810 fix: skip unnecessary model store subscriber notifications on no-op variant changes 2026-06-06 11:29:58 -04:00
Chris Scott 3b492c7e78 fix: resolve TS error on messages.length type narrowing when loading 2026-06-06 11:21:20 -04:00
Chris Scott 10275442ec refactor(sse): add sse-frame utility and refine SSE hardening 2026-06-06 11:11:10 -04:00
Chris Scott 12b7387e11 refactor(sse): harden SSE with queue-based writer, backpressure, and directory-aware batching
- Replace promise-chaining SSE writer with queue-based pump with MAX_QUEUED_FRAMES backpressure
- Make frontend parts batcher directory-aware with (sessionID, directory) composite key
- Add session content versioning for reliable content change detection
- Add TOOLS_CACHEBUST arg for selective Docker cache invalidation
- Add docker-upgrade.sh modes (cached/tools/full)
- Fix plugin install timeout and spawn error handling
- Fix assistant session endpoint path and ordering params
2026-06-06 11:11:10 -04:00
Chris Scott fdeffeaab7 fix: preserve session selection on reconnect (#261)
Preserve the user's selected session agent/model/variant across
reconnect cycles. Previously, background refetches (triggered on
reconnect) would clear the stored session agent and fall back to
the default agent.

- Restore stored session agent during initial message loading instead
  of falling back to the default agent unconditionally
- Remove isFetching from the early-return guard so background
  refetches preserve the cached message-derived configuration
- Track user model/agent overrides per session to prevent reconnect
  sync from overwriting manual selections
- Add shared formatModelKey() utility to eliminate repeated inline
  providerID/modelID construction across the codebase
- Remove unused getSessionAgentFromMessages export
2026-06-06 10:57:30 -04:00
Chris Scott 5b7e56ccda fix: align Home button size and position in RepoQuickSwitchSheet 2026-06-05 18:45:22 -04:00
Chris Scott a311cdbb98 fix(assistant): replace unbounded listSessions fallback with paginated lookup 2026-06-05 18:34:15 -04:00
Chris Scott 51ebfabb3d fix(assistant): remove stale localStorage cache read in session launcher 2026-06-05 18:27:36 -04:00
Chris Scott cc89a524c4 fix(schedules): clean up orphaned schedule records when repo is deleted (#255)
* fix(schedules): clean up orphaned schedule records and add schedule URL state management

* refactor(schedules): consolidate schedule tab state into useScheduleUrlState

* fix(schedules): cascade delete schedule runs/jobs and preserve assistant schedules in orphan cleanup

* refactor(schedules): replace deleteJobsByRepo with prepareRepoDelete, add lightweight ID query, remove dead mock

* refactor(schedules): consolidate PromptTemplateDialog form state into single object
2026-06-05 18:07:25 -04:00
Chris Scott 70cb62b77b feat(schedules): support scheduling jobs for the Assistant workspace (#254)
* feat(schedules): support scheduling jobs for the Assistant workspace

* refactor(schedules): extract assistant repo constants, rename workspace to schedule-target

* feat(navigation): add schedules link to session drawer menu

* fix(schedules): document Assistant repoId=0 in generated schedule-management skill
2026-06-05 11:16:31 -04:00
Chris Scott 9479e1f662 fix(frontend): adapt session list to OpenCode v1.16.0 API response changes (#252)
* fix(frontend): adapt session list to OpenCode v1.16.0 API response changes

* fix: support both old and new /api/session response formats
2026-06-05 09:00:10 -04:00
Chris Scott ce4fd6e22b fix(settings): wire up version dialog button in ServerHealthStatus (#253)
* fix(settings): wire up version dialog button in ServerHealthStatus

* fix(settings): render VersionSelectDialog outside outer Dialog to prevent nesting issues

* fix(settings): use portal + guarded close for version dialog to prevent Radix nesting issue

* fix(settings): replace portal workaround with direct VersionSelectDialog render

Remove the createPortal + useRef guarded-close pattern for the version
dialog (introduced to work around Radix nesting issues). Instead render
VersionSelectDialog directly inside the Dialog and prevent outside
interactions via onInteractOutside/onFocusOutside/onPointerDownOutside
preventDefault. Delete the obsolete VersionSelectContent component.
2026-06-05 08:51:01 -04:00
Chris Scott 0d6419aa16 feat(settings): replace config card grid with single-select dropdown (#251)
* feat(settings): replace config card grid with single-select dropdown

Redesign the OpenCode config list from a 2-column card grid to a single-select dropdown with adjacent action buttons (download, edit, set-current, delete) and the New Config button in the same row.

Remove stale New Config buttons from ServerHealthStatus and the OpenCodeConfigManager health card section.

* feat(settings): add find-in-text search for config editor
2026-06-04 23:31:47 -04:00
Chris Scott 2b2cb6d23d feat(stt): add energy-based VAD with silence gate and auto-stop (#249)
* loop: stt-warmup completed after 6 iterations

* refactor: extract STT startup helpers and simplify audio recorder

* feat(stt): add energy-based VAD with silence gate and auto-stop

- New VoiceActivityDetector class: adaptive noise floor, per-frame RMS
  classification, trailing-silence endpointing, configurable thresholds
- AudioWorkletProcessor computes RMS in existing flush loop and posts
  {samples, rms} instead of a bare Int16Array
- AudioRecorder integrates VAD via handleVadFrame() in both worklet and
  ScriptProcessor paths; auto-calls stop() on trailing silence; silence
  gate in processRecording() fires onNoSpeech instead of sending empty
  audio to the transcription API (fixes Whisper hallucination bug)
- useSTT wires setOnNoSpeech to reset isProcessing/isRecording cleanly
  without surfacing an error
- computeRms() exported helper for ScriptProcessor fallback path

* fix(stt): clear processing state when stopping a silent recording

stopRecording() called recorder.stop() before setIsProcessing(true). For
a silent take the recorder synchronously fires onNoSpeech (which sets
processing false), so the subsequent setIsProcessing(true) won and the
voice overlay was stuck in the processing state forever.

Set processing before stop() so the recorder callback (onNoSpeech or
onDataAvailable) has the final say on the processing flag.

* fix(stt): always emit a terminal signal so the voice overlay never sticks

Two remaining stuck paths after the silent-stop fix:

- processRecording() early-returned without firing onNoSpeech when a take
  had no captured audio (e.g. a quick start/stop under one worklet flush,
  totalSamples === 0). Now any non-emitting path (empty audio or no
  detected speech) fires onNoSpeech, while a genuine abort still returns
  silently.
- stopRecording() set isProcessing true even when the recorder was no
  longer recording (double-stop or post auto-stop), where stop() skips
  processRecording entirely and nothing clears the flag. Guard the
  external path on recorder state before entering processing.

* loop: mediarecorder-stt completed after 6 iterations

* refactor(stt): extract shared helpers and cleanup

* refactor(stt): add separate arm/disarm thresholds for voice swipe

* fix(stt): prevent default touch behavior on voice gesture handlers

* feat(stt): add audio-level speech detection before emitting data
2026-06-02 12:30:33 -04:00
Chris Scott 626a4c42d1 feat(notification): rich notification content with shared format helpers (#245)
* loop: notification-format completed after 2 iterations

* refactor: deduplicate permission display logic into shared package
2026-05-31 13:07:04 -04:00
Chris Scott dbd6866682 feat(assistant): self-configuring assistant mode (#244)
* test(backend): replace better-sqlite3 test mock with node:sqlite

Reimplement the bun:sqlite test mock on top of node:sqlite with an
explicit BEGIN/COMMIT/ROLLBACK transaction wrapper.

* feat(assistant): self-configuring assistant mode

Add a self-editable assistant workspace and the APIs that support it:
- POST /assistant/reload disposes and re-bootstraps the assistant
  instance (directory-scoped, rate-limited) so agent.md edits apply.
- Internal settings API accepts non-secret TTS/STT patches via
  dedicated partial schemas.
- Strip the generated agent persona from opencode.json on repair so
  user-customized agents are preserved across config recovery.
- Cache the last assistant session id to avoid redundant session
  listing on launch.

* style(repo): align worktree and workspace tabs with primary/orange theme
2026-05-31 11:38:02 -04:00
Chris Scott eedbbfb94e feat(session): paginated session list with infinite scroll and assistant mode improvements (#243)
* 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.
2026-05-31 10:32:14 -04:00
Chris Scott 78d934772e fix: constrain ModelQuickSelect bottom sheet width on desktop (#242) 2026-05-31 09:24:41 -04:00
Chris Scott b9236f7f20 feat(worktree): worktree tabs, server env vars, and multi-directory SSE (#240)
* 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
2026-05-30 19:44:07 -04:00
Chris Scott 60ed756a0b fix: repo directory name collisions and custom directory support (#241)
* fix: repo directory name collisions and custom directory support

Allow users to specify a custom directory name when adding a remote repo, preventing collisions when cloning a fork of an already-cloned repo.

- Add shared validation and normalization utilities (shared/src/utils/repo.ts)
  for directory name sanitization, URL normalization, and path safety
- Replace duplicated sanitizeWorkspaceAliasSegment with shared helper
- Backend validates directoryName before use as filesystem path
- Frontend detects directory collisions with normalized URL comparison
- Move SSH credential setup after DB record creation

* add backend origin validation and base-directory collision detection

* fix potential ReDoS in repo url and directory name normalization
2026-05-30 19:12:04 -04:00
Chris 0597bf6a37 test(frontend): fix local storage setup 2026-05-25 12:31:57 -04:00
Chris d143571c2e refactor(frontend): add virtualized model list with search indexing 2026-05-25 12:17:16 -04:00
Chris a5a4d0b067 fix(frontend): ignore unavailable session agents 2026-05-25 10:15:13 -04:00
Chris d4129afd58 fix(frontend): improve mobile scroll to bottom 2026-05-25 10:08:13 -04:00
Chris Scott 03bd3dac95 feat(frontend): improve model selection experience (#237)
* chore: remove dead code and unused exports

* fix: preserve model form during config refresh

Signed-off-by: mehmet turac <mehmetturac@gmail.com>

* loop: model-select-fix completed after 11 iterations

* fix(frontend): show provider prefix for duplicate models in quick select dropdown

When the same model exists under multiple providers, show the provider name
for both entries so users can distinguish them. Detects duplicates by modelID
across all favorites and recents.

* refactor(frontend): replace useTallScrollContent with scroll visibility hook

* fix: harden mirror push rollback

* Remove Load button from skill cards, clicking card loads skill

* feat(backend): add plugin installation support and schema updates

* refactor(frontend): remove unused useHeaderScrollVisibility hook

* refactor(frontend): replace model dropdown with bottom sheet selector

Replace DropdownMenu-based ModelQuickSelect with a bottom sheet
implementation featuring favorites, recents, provider browsing, and
search. Remove onShowModelsDialog prop from PromptInput and
SessionDetail, using data attribute trigger instead. Fix ZodIssueCode
deprecation, input text color, and portal rendering for bottom sheet.

* fix(frontend): simplify session model restore and fix mobile swipe reset

* loop: single-source-models completed after 10 iterations

* refactor(frontend): add desktop sidebar layout to model quick select

* refactor(frontend): improve model selector with connected providers, favorites, and recent management

* fix(frontend): constrain model name width to prevent overflow in prompt input

* fix(frontend): adjust padding and styling in model quick select

* fix(frontend): add optimistic removal with rollback for recent models

---------
2026-05-25 09:47:59 -04:00
Chris Scott f492faa84b feat(frontend): add scroll-to-bottom button, improve scroll disengagement, and tall content detection 2026-05-23 23:24:24 -04:00
Chris Scott c3802aa021 feat(frontend): add home and compact add button to repo quick switch sheet 2026-05-23 21:58:45 -04:00
Chris Scott 18bdb16951 Revert "feat(frontend): add route loading skeleton and error boundary (#234)"
This reverts commit 78f30c8bf5.
2026-05-23 20:04:58 -04:00
Chris Scott 78f30c8bf5 feat(frontend): add route loading skeleton and error boundary (#234) 2026-05-23 19:59:34 -04:00
Chris Scott a86e4b1238 feat(ocm-cli): workspace repo sync and manager token targeting (#233) 2026-05-23 19:49:44 -04:00
OpenCode Agent e12f319592 fix(frontend): adjust sheet rendering and dialog z-index 2026-05-22 15:53:30 -04:00
Chris Scott 982110f041 fix(frontend): close sheet when opening new repo dialog (#230) 2026-05-14 20:33:02 -04:00
mehmet turac 531eb08f4d fix(frontend): add repo action tooltips (#229) 2026-05-14 20:29:13 -04:00
Chris Scott a4b34d615e fix: hide files icon on mobile and improve settings layout (#226) 2026-05-08 09:42:41 -04:00
Chris Scott c5c2069a30 style: update context usage display to match OpenCode TUI format (#225) 2026-05-08 09:36:52 -04:00
Chris Scott 3883cc219c style: add separator and orange color to active model in quick select dropdown (#223) 2026-05-08 09:36:39 -04:00
Chris Scott 74cdeb3926 fix: update settings and skills handling with assistant redirect (#220)
* fix: enable swipe-back suspension on more drawer and remove unused variable

* refactor(frontend): improve dialog component and settings navigation

* fix: disable route swipe suspension in MoreDrawer to prevent unintended navigation

* fix(frontend): enable swipe-back suspension on more drawer route

* refactor(frontend): improve mobile navigation drawer and tab bar

* feat: add schedules service and workspace hook with navigation updates

* chore: add workspace hook, schedules library, and tests

* fix: prevent MoreDrawer sentinel from undoing navigation

* feat: per-agent model selection and UI refinements (#217)

* feat: per-agent model selection and UI refinements

- Add agentModels store with setAgentModel/getAgentModel
- PromptInput uses session model priority and stores agent model on change
- useContextUsage derives model from assistant message instead of global
- Migrate sub-agent/subtask badges from purple to blue with refined styling
- Fix MoreDrawer sentinel to skip history-back on navigation

* refactor: improve per-agent model selection and task tool call status indicators

* feat: add repo management skill and internal repos API

* fix: improve assistant session launcher and UI components

* fix: update atomic-json test assertions

* refactor: split Assistant Mode instructions between AGENTS.md and assistant.md

* loop: todo-header-mobile completed after 3 iterations (#218)

* loop: stt-perf-1 completed after 5 iterations

* fix: load audio worklet per recording context

* fix: canonicalize assistant navigation routes

* fix: adjust scroll-up threshold for header visibility

* fix: update settings and skills handling with assistant redirect

* refactor: simplify context usage indicator and extract token sum helper

* feat: add currently selected model row to popover and fix responsive truncate
2026-05-07 18:36:03 -04:00
Chris Scott 358e0f18aa fix: enable swipe-back suspension on more drawer and remove unused variable (#215) 2026-05-02 22:21:55 -04:00