mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 20:34:18 +01:00
section 13: Phase 13: Session status from the client type, compaction-dr
This commit is contained in:
1 parent
717536c5a6
commit
2d4abe79e1
21 files changed
+194
-100
No files matched your search
@@ -8,6 +8,7 @@ import {
|
||||
DropdownMenuItem,
|
||||
DropdownMenuTrigger,
|
||||
} from '@/components/ui/dropdown-menu'
|
||||
import type { AgentInfo } from '@opencode-manager/shared/opencode'
|
||||
import { useAgents } from '@/hooks/useOpenCode'
|
||||
import { getAgentStyleVars } from '@/lib/agent-colors'
|
||||
import { getPrimaryAgents } from '@/lib/primaryAgents'
|
||||
@@ -19,16 +20,9 @@ interface AgentQuickSelectProps {
|
||||
isBashMode?: boolean
|
||||
}
|
||||
|
||||
interface AgentInfo {
|
||||
id: string
|
||||
name: string
|
||||
color?: string
|
||||
description?: string
|
||||
mode?: string
|
||||
hidden?: boolean
|
||||
}
|
||||
type SelectableAgent = Pick<AgentInfo, 'id' | 'name' | 'color' | 'description' | 'mode' | 'hidden'>
|
||||
|
||||
const findAgent = (agents: AgentInfo[], agentId: string): AgentInfo | undefined => {
|
||||
const findAgent = (agents: SelectableAgent[], agentId: string): SelectableAgent | undefined => {
|
||||
return agents.find(a => a.id.toLowerCase() === agentId.toLowerCase())
|
||||
}
|
||||
|
||||
|
||||
@@ -9,8 +9,7 @@ import {
|
||||
} from '@/components/ui/dialog'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Textarea } from '@/components/ui/textarea'
|
||||
import type { PermissionResponse } from '@/api/types'
|
||||
import type { PermissionRequest } from '@opencode-manager/shared/opencode'
|
||||
import type { PermissionReply, PermissionRequest } from '@opencode-manager/shared/opencode'
|
||||
import {
|
||||
getPermissionLabel,
|
||||
getPermissionPhrase,
|
||||
@@ -30,7 +29,7 @@ interface PermissionRequestDialogProps {
|
||||
onRespond: (
|
||||
permissionID: string,
|
||||
sessionID: string,
|
||||
response: PermissionResponse,
|
||||
response: PermissionReply,
|
||||
message?: string,
|
||||
) => Promise<void>
|
||||
open?: boolean
|
||||
@@ -49,7 +48,7 @@ export function PermissionRequestDialog({
|
||||
onOpenChange,
|
||||
}: PermissionRequestDialogProps) {
|
||||
const [isLoading, setIsLoading] = useState(false)
|
||||
const [loadingAction, setLoadingAction] = useState<PermissionResponse | null>(null)
|
||||
const [loadingAction, setLoadingAction] = useState<PermissionReply | null>(null)
|
||||
const [rejectReason, setRejectReason] = useState('')
|
||||
const reasonInputId = useId()
|
||||
const allowOnceRef = useRef<HTMLButtonElement>(null)
|
||||
@@ -61,7 +60,7 @@ export function PermissionRequestDialog({
|
||||
if (!permission) return null
|
||||
if (parentOpen === false) return null
|
||||
|
||||
const handleResponse = async (response: PermissionResponse) => {
|
||||
const handleResponse = async (response: PermissionReply) => {
|
||||
setIsLoading(true)
|
||||
setLoadingAction(response)
|
||||
const message = response === 'reject' ? rejectReason.trim() : ''
|
||||
|
||||
@@ -37,6 +37,14 @@ describe('SessionStatusIndicator background activity', () => {
|
||||
expect(container).toBeEmptyDOMElement()
|
||||
})
|
||||
|
||||
it('labels a compacting session', () => {
|
||||
useSessionStatus.getState().setStatus('session-a', { type: 'compact' })
|
||||
|
||||
render(<SessionStatusIndicator sessionID="session-a" />)
|
||||
|
||||
expect(screen.getByLabelText('Compacting')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('renders the braille spinner with a running label for a busy session', () => {
|
||||
useSessionStatus.getState().setStatus('session-a', { type: 'busy' })
|
||||
|
||||
|
||||
Reference in new issue
Block a user