mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 20:34:18 +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.
35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
import { useSessionPermissionMode, useSetSessionPermissionMode } from '@/hooks/useSessionPermissionMode'
|
|
|
|
export function usePermissionModeToggle(
|
|
sessionID: string,
|
|
directory: string,
|
|
options: { enabled?: boolean } = {},
|
|
) {
|
|
const { data, isError } = useSessionPermissionMode(sessionID, options)
|
|
const setMode = useSetSessionPermissionMode(sessionID)
|
|
|
|
const loaded = data !== undefined
|
|
const isAuto = data?.mode === 'auto'
|
|
const lockedReason = data?.lockedReason ?? null
|
|
const disabled = !loaded || lockedReason !== null || setMode.isPending
|
|
|
|
const label = !loaded
|
|
? isError
|
|
? 'Permissions: unavailable'
|
|
: 'Permissions: loading'
|
|
: lockedReason === 'child'
|
|
? 'Inherited from parent session'
|
|
: lockedReason === 'schedule'
|
|
? "Scheduled runs use the schedule's permission configuration"
|
|
: isAuto
|
|
? 'Permissions: auto-accept all'
|
|
: 'Permissions: follow configured rules'
|
|
|
|
const toggle = () => {
|
|
if (disabled) return
|
|
setMode.mutate({ directory, mode: isAuto ? 'ask' : 'auto' })
|
|
}
|
|
|
|
return { isAuto, disabled, label, toggle }
|
|
}
|