Feat/assistant session list (#198)

* feat: add assistant mode integration and fix test environment

- Add assistant-mode service for managing assistant workspace files (AGENTS.md, opencode.json)
- Add backend GET/POST routes for assistant-mode status and initialization
- Add AssistantRedirect page and useAssistantSessionLauncher hook
- Update mobile navigation to include Assistant tab (replaces Alerts)
- Fix React.act compatibility by setting NODE_ENV=test in vitest config
- Add shared Zod schemas for AssistantMode types and requests

* feat: enhance assistant mode with session list view and legacy config migration

- Add session list view for assistant mode with full workspace management
- Migrate legacy opencode.json permission format to granular permissions
- Enable assistant navigation from mobile tab bar and repo switcher
- Preserve assistant context in session routes via query params
- Auto-restart OpenCode server after assistant mode initialization
- Add comprehensive tests for legacy config detection and navigation
This commit is contained in:
Chris Scott authored and GitHub committed 2026-04-24 18:35:47 -04:00
1 parent 0a2e337efc
commit c894ff5756
22 files changed
+1347 -154

No files matched your search

+35
View File
@@ -0,0 +1,35 @@
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
import {
getAssistantModeStatus,
initializeAssistantMode,
} from '@/api/repos'
import type { AssistantModeStatus, AssistantModeInitRequest } from '@opencode-manager/shared/types'
export function useAssistantMode(repoId: number) {
const queryClient = useQueryClient()
const statusQuery = useQuery<AssistantModeStatus>({
queryKey: ['repo', repoId, 'assistant-mode'],
queryFn: () => getAssistantModeStatus(repoId),
enabled: !!repoId,
})
const initializeMutation = useMutation({
mutationFn: (options?: AssistantModeInitRequest) =>
initializeAssistantMode(repoId, options),
onSuccess: () => {
queryClient.invalidateQueries({
queryKey: ['repo', repoId, 'assistant-mode'],
})
},
})
return {
status: statusQuery.data,
isLoading: statusQuery.isLoading,
isError: statusQuery.isError,
error: statusQuery.error,
initialize: initializeMutation.mutateAsync,
isInitializing: initializeMutation.isPending,
}
}