refactor(frontend): rework speech-to-text to tap-first interaction (#207)

* refactor(frontend): extract VoiceStatusOverlay component and improve swipe tracking

- Extract voice status overlay to dedicated VoiceStatusOverlay.tsx component
- Move pointer event handlers from button to container for larger swipe surface area
- Users can now initiate swipe gesture from anywhere in the container, not just the button

* refactor(frontend): add SSE delta support and improve status synchronization

- Add SSEMessagePartDeltaEvent type for streaming delta updates
- Add SSESessionCreatedEvent type for session creation events
- Implement directory filtering for SSE events to prevent cross-contamination
- Add version tracking for status snapshots to ignore stale responses
- Replace individual status updates with atomic replaceStatuses operation
- Refactor parts batcher to use unified operation queue with delta support
- Clear stale statuses on initial snapshot and directory changes
- Add tests for status snapshot clearing and stale response handling

* refactor: remove auto-restart from assistant mode and fix mobile sheet close behavior

Stop restarting OpenCode after assistant mode initialization since the
startup error logic is no longer needed. Also fix the repo quick switch
sheet to stay open when launched from the mobile tab bar, preventing
unwanted navigation away from the sheet.

* refactor(frontend): improve speech-to-text UI
This commit is contained in:
Chris Scott authored and GitHub committed 2026-04-29 12:26:41 -04:00
1 parent 04400c91cc
commit f0c87ffa5d
11 files changed
+525 -270

No files matched your search

+39
View File
@@ -10,6 +10,7 @@ interface SessionStatusStore {
statuses: Map<string, SessionStatusType>
statusCache: Map<string, string>
setStatus: (sessionID: string, status: SessionStatusType) => void
replaceStatuses: (statuses: Record<string, SessionStatusType>) => void
getStatus: (sessionID: string) => SessionStatusType
clearStatus: (sessionID: string) => void
}
@@ -32,6 +33,19 @@ export const useSessionStatus = create<SessionStatusStore>((set, get) => ({
const previousHash = get().statusCache.get(sessionID)
if (previousHash === hash) return
if (status.type === 'idle') {
if (!previousHash) return
set((state) => {
const newMap = new Map(state.statuses)
const newCache = new Map(state.statusCache)
newMap.delete(sessionID)
newCache.delete(sessionID)
return { statuses: newMap, statusCache: newCache }
})
return
}
set((state) => {
const newMap = new Map(state.statuses)
@@ -41,6 +55,31 @@ export const useSessionStatus = create<SessionStatusStore>((set, get) => ({
return { statuses: newMap, statusCache: newCache }
})
},
replaceStatuses: (statuses: Record<string, SessionStatusType>) => {
const newMap = new Map<string, SessionStatusType>()
const newCache = new Map<string, string>()
for (const [sessionID, status] of Object.entries(statuses)) {
if (status.type === 'idle') continue
newMap.set(sessionID, status)
newCache.set(sessionID, getStatusHash(status))
}
const currentCache = get().statusCache
if (currentCache.size === newCache.size) {
let unchanged = true
for (const [sessionID, hash] of newCache.entries()) {
if (currentCache.get(sessionID) !== hash) {
unchanged = false
break
}
}
if (unchanged) return
}
set({ statuses: newMap, statusCache: newCache })
},
getStatus: (sessionID: string) => {
return get().statuses.get(sessionID) || DEFAULT_STATUS