mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 12:54:20 +01:00
Critical and high: - repos: unlinking a local repo removes only the Manager reference and alias, never the repository files; confirm button reads "Unlink" - auth: rate-limit by the socket address; trust proxy headers only when AUTH_TRUSTED_PROXY_HEADERS is set (documented and forwarded in compose) - composer: per-session in-memory drafts (text, bash mode, attachments); Escape no longer clears the prompt - url params: compose same-tick updates so schedule dialogs stay closed after create/delete; delete dialog names the job Medium: - tool rows show failures (non-zero shell exit, failed exploration members) - voice conversation shows the specific error and a starting state - settings: Escape in dropdowns and the shortcut recorder no longer closes the dialog; mobile deep links open the requested section; one content tree per platform - closing pushed sheets, settings, tool panels and schedule dialogs goes back in history - login returns to the requested page; signed-out pages make no authenticated requests - action terminals keep their output (Manager-side output capture and replay) - unpushed-commit detection, commit message kept on failure - binary files with unknown extensions are detected and not editable - tool panel resizes when docked and floats as a dismissible sheet when the page is too narrow - Docker image runs tini as PID 1 Low: not-found states, add-repo and branch validation errors (4xx), search-aware empty states, mobile repo sort/filter/select cues, sidebar resize affordance and collapse shortcut, mobile unread badge, preview port filtering, terminal close handling, walkthrough empty state and helper session filtering, placeholder contrast, permission labels and focus, TTS task-list sanitizing, git identity email validation, quieter git logging, hermetic worktree tests, and accessible names for icon-only controls.
126 lines
6.1 KiB
TypeScript
126 lines
6.1 KiB
TypeScript
import { useNavigate } from "react-router-dom"
|
|
import { useQuery } from "@tanstack/react-query"
|
|
import { getRepo } from "@/api/repos"
|
|
import { useCreateSession } from "@/hooks/useOpenCode"
|
|
import { useDialogParam } from "@/hooks/useDialogParam"
|
|
import { useTerminalDialogParam } from "@/hooks/useOpenTerminal"
|
|
import { useSSE } from "@/hooks/useSSE"
|
|
import { getSessionPath } from "@/lib/navigation"
|
|
import { Button } from "@/components/ui/button"
|
|
import { Header } from "@/components/ui/header"
|
|
import { SessionList } from "@/components/session/SessionList"
|
|
import { FileBrowserSheet } from "@/components/file-browser/FileBrowserSheet"
|
|
import { RepoMcpDialog } from "@/components/repo/RepoMcpDialog"
|
|
import { RepoSkillsDialog } from "@/components/repo/RepoSkillsDialog"
|
|
import { SourceControlPanel } from "@/components/source-control"
|
|
import { TerminalPanel } from "@/components/terminal/TerminalPanel"
|
|
import { PreviewPanel } from "@/components/preview/PreviewPanel"
|
|
import { ResetPermissionsDialog } from "@/components/repo/ResetPermissionsDialog"
|
|
import { PendingActionsGroup } from "@/components/notifications/PendingActionsGroup"
|
|
import { ToolSidePanel } from "@/components/navigation/ToolSidePanel"
|
|
import { useToolPanelLayout } from "@/hooks/useToolPanelLayout"
|
|
import { useToolPanel } from "@/hooks/useToolPanel"
|
|
import { Plus } from "lucide-react"
|
|
|
|
export function AssistantRedirect() {
|
|
const navigate = useNavigate()
|
|
const repoId = 0
|
|
const [fileBrowserOpen, setFileBrowserOpen] = useDialogParam('files')
|
|
const [mcpDialogOpen, setMcpDialogOpen] = useDialogParam('mcp')
|
|
const [skillsDialogOpen, setSkillsDialogOpen] = useDialogParam('skills')
|
|
const [sourceControlOpen, setSourceControlOpen] = useDialogParam('sourceControl')
|
|
const [terminalOpen, setTerminalOpen] = useTerminalDialogParam()
|
|
const [previewOpen, setPreviewOpen] = useDialogParam('preview')
|
|
const [resetPermissionsOpen, setResetPermissionsOpen] = useDialogParam('resetPermissions')
|
|
const { docked, showRail } = useToolPanelLayout()
|
|
const toolPanel = useToolPanel(showRail)
|
|
|
|
const { data: repo, isLoading: repoLoading, error: repoError } = useQuery({
|
|
queryKey: ["repo", repoId],
|
|
queryFn: () => getRepo(repoId),
|
|
})
|
|
|
|
const assistantDirectory = repo?.fullPath
|
|
|
|
useSSE(assistantDirectory)
|
|
|
|
const createSessionMutation = useCreateSession(assistantDirectory, (session) => {
|
|
navigate(getSessionPath(repoId, session.id))
|
|
})
|
|
|
|
const handleCreateSession = async () => {
|
|
await createSessionMutation.mutateAsync({ agent: undefined })
|
|
}
|
|
|
|
return (
|
|
<div className="flex h-full max-h-full min-w-0">
|
|
<div className="flex-1 min-w-0 h-full max-h-full overflow-hidden bg-gradient-to-br from-background via-background to-background flex flex-col pb-[calc(env(safe-area-inset-bottom)+56px)] sm:pb-0">
|
|
<Header>
|
|
<Header.BackButton to="/" />
|
|
<Header.Title>Assistant</Header.Title>
|
|
<Header.Actions>
|
|
<div className="flex items-center gap-1">
|
|
<PendingActionsGroup />
|
|
</div>
|
|
<Button onClick={() => handleCreateSession()} disabled={!assistantDirectory || createSessionMutation.isPending} size="sm" className="hidden sm:inline-flex bg-primary hover:bg-primary-hover text-primary-foreground transition-all duration-200 hover:scale-105">
|
|
<Plus className="w-4 h-4 mr-2" />
|
|
<span>New Session</span>
|
|
</Button>
|
|
<Button onClick={() => handleCreateSession()} disabled={!assistantDirectory || createSessionMutation.isPending} aria-label="New Session" size="sm" className="sm:hidden h-10 w-10 p-0 bg-primary hover:bg-primary-hover text-primary-foreground transition-all duration-200 hover:scale-105">
|
|
<Plus className="w-5 h-5" />
|
|
</Button>
|
|
</Header.Actions>
|
|
</Header>
|
|
<div className="flex-1 flex flex-col min-h-0">
|
|
{repoError ? (
|
|
<div className="p-4 text-sm text-muted-foreground">Failed to load Assistant sessions</div>
|
|
) : repoLoading || !repo?.fullPath ? (
|
|
<div className="p-4 text-sm text-muted-foreground">Loading Assistant sessions...</div>
|
|
) : (
|
|
<SessionList
|
|
directory={assistantDirectory}
|
|
onSelectSession={(sessionId) => navigate(getSessionPath(repoId, sessionId))}
|
|
/>
|
|
)}
|
|
</div>
|
|
{assistantDirectory && (
|
|
<>
|
|
<FileBrowserSheet isOpen={!docked && fileBrowserOpen} onClose={() => setFileBrowserOpen(false)} basePath={repo?.localPath} repoName="Assistant" repoId={repoId} />
|
|
<RepoMcpDialog open={!docked && mcpDialogOpen} onOpenChange={setMcpDialogOpen} directory={assistantDirectory} />
|
|
{assistantDirectory ? (
|
|
<RepoSkillsDialog
|
|
open={!docked && skillsDialogOpen}
|
|
onOpenChange={setSkillsDialogOpen}
|
|
repoId={repoId}
|
|
sessionId="assistant-session"
|
|
directory={assistantDirectory}
|
|
/>
|
|
) : (
|
|
<RepoSkillsDialog
|
|
open={!docked && skillsDialogOpen}
|
|
onOpenChange={setSkillsDialogOpen}
|
|
repoId={repoId}
|
|
/>
|
|
)}
|
|
<SourceControlPanel repoId={repoId} isOpen={!docked && sourceControlOpen} onClose={() => setSourceControlOpen(false)} currentBranch={repo?.currentBranch || repo?.branch || "main"} repoName="Assistant" />
|
|
<TerminalPanel target={{ kind: 'repo', repoId: 0 }} directory={assistantDirectory} isOpen={!docked && terminalOpen} onClose={() => setTerminalOpen(false)} />
|
|
<PreviewPanel isOpen={!docked && previewOpen} onClose={() => setPreviewOpen(false)} directory={assistantDirectory} />
|
|
<ResetPermissionsDialog open={resetPermissionsOpen} onOpenChange={setResetPermissionsOpen} repoId={repoId} />
|
|
</>
|
|
)}
|
|
</div>
|
|
{showRail && (
|
|
<ToolSidePanel
|
|
panel={toolPanel}
|
|
repoId={repoId}
|
|
sessionId="assistant-session"
|
|
directory={assistantDirectory}
|
|
repoDirectory={assistantDirectory}
|
|
filesBasePath={repo?.localPath}
|
|
currentBranch={repo?.currentBranch || repo?.branch || "main"}
|
|
/>
|
|
)}
|
|
</div>
|
|
)
|
|
}
|