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.
250 lines
9.3 KiB
TypeScript
250 lines
9.3 KiB
TypeScript
import { Combobox, type ComboboxOption } from '@/components/ui/combobox'
|
|
import { ModelCombobox } from '@/components/model/ModelCombobox'
|
|
import { BranchCombobox } from '@/components/repo/BranchCombobox'
|
|
import { Input } from '@/components/ui/input'
|
|
import { Label } from '@/components/ui/label'
|
|
import { Switch } from '@/components/ui/switch'
|
|
import { Textarea } from '@/components/ui/textarea'
|
|
import { TabsContent } from '@/components/ui/tabs'
|
|
import { RadioOptionGroup } from '@/components/ui/radio-option-group'
|
|
import { workspaceModeOptions } from '@/components/schedules/schedule-utils'
|
|
import type { ScheduleWorkspaceMode } from '@opencode-manager/shared/types'
|
|
import { Info } from 'lucide-react'
|
|
|
|
type GeneralTabProps = {
|
|
name: string
|
|
onNameChange: (value: string) => void
|
|
description: string
|
|
onDescriptionChange: (value: string) => void
|
|
agentSlug: string
|
|
onAgentSlugChange: (value: string) => void
|
|
agentOptions: ComboboxOption[]
|
|
model: string
|
|
onModelChange: (value: string) => void
|
|
modelDirectory?: string
|
|
enabled: boolean
|
|
onEnabledChange: (value: boolean) => void
|
|
branch: string
|
|
onBranchChange: (value: string) => void
|
|
branchRepoId: number | undefined
|
|
workspaceMode: ScheduleWorkspaceMode
|
|
onWorkspaceModeChange: (value: ScheduleWorkspaceMode) => void
|
|
showWorkspaceMode: boolean
|
|
showBranch?: boolean
|
|
showRepoSelector?: boolean
|
|
isEditing: boolean
|
|
repoId?: number
|
|
onRepoChange?: (repoId: number | undefined) => void
|
|
repoOptions: ComboboxOption[]
|
|
allowExternalDirectory: boolean
|
|
onAllowExternalDirectoryChange: (value: boolean) => void
|
|
allowQuestions: boolean
|
|
onAllowQuestionsChange: (value: boolean) => void
|
|
bashDenyPatterns: string[]
|
|
onBashDenyPatternsChange: (value: string[]) => void
|
|
}
|
|
|
|
function InfoHint({ text }: { text: string }) {
|
|
return (
|
|
<span
|
|
title={text}
|
|
aria-label={text}
|
|
className="inline-flex h-4 w-4 items-center justify-center text-muted-foreground"
|
|
>
|
|
<Info className="h-3.5 w-3.5" />
|
|
</span>
|
|
)
|
|
}
|
|
|
|
export function GeneralTab({
|
|
name,
|
|
onNameChange,
|
|
description,
|
|
onDescriptionChange,
|
|
agentSlug,
|
|
onAgentSlugChange,
|
|
agentOptions,
|
|
model,
|
|
onModelChange,
|
|
modelDirectory,
|
|
enabled,
|
|
onEnabledChange,
|
|
branch,
|
|
onBranchChange,
|
|
branchRepoId,
|
|
workspaceMode,
|
|
onWorkspaceModeChange,
|
|
showWorkspaceMode,
|
|
showBranch = true,
|
|
showRepoSelector,
|
|
isEditing,
|
|
repoId,
|
|
onRepoChange,
|
|
repoOptions,
|
|
allowExternalDirectory,
|
|
onAllowExternalDirectoryChange,
|
|
allowQuestions,
|
|
onAllowQuestionsChange,
|
|
bashDenyPatterns,
|
|
onBashDenyPatternsChange,
|
|
}: GeneralTabProps) {
|
|
return (
|
|
<TabsContent value="basics" className="mt-0 min-h-0 flex-1 overflow-y-auto pt-4 pb-5">
|
|
<div className="space-y-4">
|
|
{showRepoSelector && !isEditing && (
|
|
<div className="space-y-2">
|
|
<Label>Repository</Label>
|
|
<Combobox
|
|
value={repoId?.toString() ?? ''}
|
|
onChange={(value) => onRepoChange?.(value ? Number(value) : undefined)}
|
|
options={repoOptions}
|
|
placeholder="Select a repository"
|
|
allowCustomValue={false}
|
|
/>
|
|
</div>
|
|
)}
|
|
<div className="grid gap-4 sm:grid-cols-2">
|
|
<div className="space-y-2">
|
|
<Label htmlFor="schedule-name">Name</Label>
|
|
<Input
|
|
id="schedule-name"
|
|
value={name}
|
|
onChange={(event) => onNameChange(event.target.value)}
|
|
placeholder="Nightly repo health check"
|
|
/>
|
|
</div>
|
|
|
|
<div className="space-y-2">
|
|
<Label htmlFor="schedule-description">Description</Label>
|
|
<Input
|
|
id="schedule-description"
|
|
value={description}
|
|
onChange={(event) => onDescriptionChange(event.target.value)}
|
|
placeholder="What this job checks or produces"
|
|
/>
|
|
</div>
|
|
</div>
|
|
|
|
<div className="grid gap-4 sm:grid-cols-[minmax(0,1fr)_220px] sm:items-end">
|
|
<div className="space-y-2">
|
|
<Label htmlFor="schedule-agent">Agent slug</Label>
|
|
<Combobox
|
|
value={agentSlug}
|
|
onChange={onAgentSlugChange}
|
|
options={agentOptions}
|
|
placeholder="Select an agent"
|
|
allowCustomValue
|
|
showClear
|
|
/>
|
|
</div>
|
|
|
|
<div className="space-y-2">
|
|
<div className="flex items-center gap-2">
|
|
<Label htmlFor="schedule-model">Model override</Label>
|
|
<InfoHint text="Pick from detected OpenCode models or type a custom provider/model value." />
|
|
</div>
|
|
<ModelCombobox
|
|
id="schedule-model"
|
|
value={model}
|
|
onChange={onModelChange}
|
|
directory={modelDirectory}
|
|
placeholder="Workspace default"
|
|
allowCustomValue
|
|
showClear
|
|
/>
|
|
</div>
|
|
</div>
|
|
|
|
<div className="rounded-lg border border-border bg-card p-4">
|
|
<div className="flex items-center justify-between gap-4">
|
|
<div className="flex items-center gap-2">
|
|
<p id="schedule-enabled-label" className="text-sm font-medium">Enabled</p>
|
|
<InfoHint text="Auto-run this job on its schedule while still allowing manual runs from the dashboard." />
|
|
</div>
|
|
<Switch checked={enabled} onCheckedChange={onEnabledChange} aria-labelledby="schedule-enabled-label" />
|
|
</div>
|
|
</div>
|
|
|
|
<div className="rounded-lg border border-border bg-card p-4 space-y-4">
|
|
{showWorkspaceMode && (
|
|
<div className="space-y-2">
|
|
<p className="text-sm font-medium">Workspace</p>
|
|
<RadioOptionGroup
|
|
name="schedule-workspace-mode"
|
|
value={workspaceMode}
|
|
onChange={onWorkspaceModeChange}
|
|
options={workspaceModeOptions.filter((option) => option.value !== 'in-place')}
|
|
/>
|
|
</div>
|
|
)}
|
|
{showBranch && (
|
|
<div className="space-y-2">
|
|
<div className="flex items-center gap-2">
|
|
<Label htmlFor="schedule-branch">Base branch</Label>
|
|
<InfoHint text="Runs start from origin/<branch> when it exists, so local commits that are not pushed are not included. A shared worktree continues from its own branch after the first run. Leave empty to use the repository's default branch." />
|
|
</div>
|
|
<BranchCombobox
|
|
id="schedule-branch"
|
|
repoId={branchRepoId}
|
|
value={branch}
|
|
onValueChange={onBranchChange}
|
|
placeholder="Defaults to default branch"
|
|
remotes="bare"
|
|
clearable
|
|
/>
|
|
</div>
|
|
)}
|
|
</div>
|
|
|
|
<div className="space-y-2">
|
|
<h3 className="text-sm font-medium text-muted-foreground">Permissions</h3>
|
|
<div className="rounded-lg border border-border bg-card p-4">
|
|
<div className="flex items-center justify-between gap-4">
|
|
<div className="flex items-center gap-2">
|
|
<p id="schedule-allow-external-label" className="text-sm font-medium">Allow access outside the working directory</p>
|
|
<InfoHint text="When disabled, runs are confined to the worktree. Enable to allow the agent to read/write files elsewhere on the system." />
|
|
</div>
|
|
<Switch
|
|
checked={allowExternalDirectory}
|
|
onCheckedChange={onAllowExternalDirectoryChange}
|
|
aria-labelledby="schedule-allow-external-label"
|
|
/>
|
|
</div>
|
|
</div>
|
|
<div className="rounded-lg border border-border bg-card p-4">
|
|
<div className="flex items-center justify-between gap-4">
|
|
<div className="flex items-center gap-2">
|
|
<p id="schedule-allow-questions-label" className="text-sm font-medium">Allow questions</p>
|
|
<InfoHint text="Scheduled runs are unattended. When disabled, the agent's question tool is denied so a run can never stall waiting for an answer that nobody is there to give." />
|
|
</div>
|
|
<Switch
|
|
checked={allowQuestions}
|
|
onCheckedChange={onAllowQuestionsChange}
|
|
aria-labelledby="schedule-allow-questions-label"
|
|
/>
|
|
</div>
|
|
</div>
|
|
<div className="rounded-lg border border-border bg-card p-4">
|
|
<div className="space-y-2">
|
|
<div className="flex items-center gap-2">
|
|
<Label htmlFor="schedule-bash-deny">Blocked bash commands</Label>
|
|
<InfoHint text="One glob per line. These bash commands are always blocked. The throwaway worktree (never auto-pushed) is the real safety boundary." />
|
|
</div>
|
|
<Textarea
|
|
id="schedule-bash-deny"
|
|
value={bashDenyPatterns.join('\n')}
|
|
onChange={(event) => {
|
|
const patterns = event.target.value.split('\n')
|
|
onBashDenyPatternsChange(patterns)
|
|
}}
|
|
placeholder="rm -rf *"
|
|
className="font-mono text-xs min-h-[100px]"
|
|
/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</TabsContent>
|
|
)
|
|
}
|