mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
Merge remote-tracking branch 'origin/main' into feat/session-picker-projects-tab
# Conflicts: # frontend/src/components/settings/KeyboardShortcuts.tsx
This commit is contained in:
commit
87f28fbc6d
27 files changed
+2242
-302
No files matched your search
@@ -35,12 +35,14 @@ interface MockTTSReturn {
|
||||
describe('FloatingTTSButton', () => {
|
||||
const mockSpeakMessage = vi.fn()
|
||||
const mockStop = vi.fn()
|
||||
const mockSpeakVisible = vi.fn()
|
||||
const mockUpdateSettings = vi.fn()
|
||||
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
mockSpeakMessage.mockClear()
|
||||
mockStop.mockClear()
|
||||
mockSpeakVisible.mockClear()
|
||||
mockUpdateSettings.mockClear()
|
||||
mocks.showToastInfo.mockClear()
|
||||
})
|
||||
@@ -84,19 +86,19 @@ describe('FloatingTTSButton', () => {
|
||||
|
||||
it('renders pill when content is empty but autoplay is enabled', () => {
|
||||
setup({ autoPlay: true })
|
||||
render(<FloatingTTSButton messageId={TEST_MESSAGE_ID} content="" />)
|
||||
render(<FloatingTTSButton messageId={TEST_MESSAGE_ID} content="" isScrolledUp={false} onSpeakVisible={mockSpeakVisible} />)
|
||||
expect(screen.getByRole('button', { name: /hold to toggle auto-play/i })).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('renders pill when content is whitespace but autoplay is enabled', () => {
|
||||
setup({ autoPlay: true })
|
||||
render(<FloatingTTSButton messageId={TEST_MESSAGE_ID} content=" " />)
|
||||
render(<FloatingTTSButton messageId={TEST_MESSAGE_ID} content=" " isScrolledUp={false} onSpeakVisible={mockSpeakVisible} />)
|
||||
expect(screen.getByRole('button', { name: /hold to toggle auto-play/i })).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('calls speakMessage on tap when idle', () => {
|
||||
setup()
|
||||
render(<FloatingTTSButton messageId={TEST_MESSAGE_ID} content={TEST_CONTENT} />)
|
||||
render(<FloatingTTSButton messageId={TEST_MESSAGE_ID} content={TEST_CONTENT} isScrolledUp={false} onSpeakVisible={mockSpeakVisible} />)
|
||||
|
||||
const button = screen.getByRole('button', { name: /play latest reply/i })
|
||||
fireEvent.pointerDown(button)
|
||||
@@ -110,7 +112,7 @@ describe('FloatingTTSButton', () => {
|
||||
|
||||
it('calls stop on tap when this message is active', () => {
|
||||
setup({ activeMessageId: TEST_MESSAGE_ID, isPlaying: true })
|
||||
render(<FloatingTTSButton messageId={TEST_MESSAGE_ID} content={TEST_CONTENT} />)
|
||||
render(<FloatingTTSButton messageId={TEST_MESSAGE_ID} content={TEST_CONTENT} isScrolledUp={false} onSpeakVisible={mockSpeakVisible} />)
|
||||
|
||||
const button = screen.getByRole('button', { name: /stop playback/i })
|
||||
fireEvent.pointerDown(button)
|
||||
@@ -124,7 +126,7 @@ describe('FloatingTTSButton', () => {
|
||||
|
||||
it('calls stop when any playback is active, even for a different messageId (stream conflict fix)', () => {
|
||||
setup({ activeMessageId: 'other-message-id', isPlaying: true })
|
||||
render(<FloatingTTSButton messageId={TEST_MESSAGE_ID} content={TEST_CONTENT} />)
|
||||
render(<FloatingTTSButton messageId={TEST_MESSAGE_ID} content={TEST_CONTENT} isScrolledUp={false} onSpeakVisible={mockSpeakVisible} />)
|
||||
|
||||
const button = screen.getByRole('button', { name: /stop playback/i })
|
||||
fireEvent.pointerDown(button)
|
||||
@@ -139,7 +141,7 @@ describe('FloatingTTSButton', () => {
|
||||
it('toggles autoplay on long press', async () => {
|
||||
vi.useFakeTimers()
|
||||
setup({ autoPlay: false })
|
||||
render(<FloatingTTSButton messageId={TEST_MESSAGE_ID} content={TEST_CONTENT} />)
|
||||
render(<FloatingTTSButton messageId={TEST_MESSAGE_ID} content={TEST_CONTENT} isScrolledUp={false} onSpeakVisible={mockSpeakVisible} />)
|
||||
|
||||
const button = screen.getByRole('button', { name: /play latest reply/i })
|
||||
await act(async () => {
|
||||
@@ -172,7 +174,7 @@ describe('FloatingTTSButton', () => {
|
||||
it('shows a toast when long press disables autoplay', async () => {
|
||||
vi.useFakeTimers()
|
||||
setup({ autoPlay: true })
|
||||
render(<FloatingTTSButton messageId={TEST_MESSAGE_ID} content={TEST_CONTENT} />)
|
||||
render(<FloatingTTSButton messageId={TEST_MESSAGE_ID} content={TEST_CONTENT} isScrolledUp={false} onSpeakVisible={mockSpeakVisible} />)
|
||||
|
||||
const button = screen.getByRole('button', { name: /auto-play enabled/i })
|
||||
await act(async () => {
|
||||
@@ -195,7 +197,7 @@ describe('FloatingTTSButton', () => {
|
||||
it('does not call speakMessage after long press (race guard)', async () => {
|
||||
vi.useFakeTimers()
|
||||
setup()
|
||||
render(<FloatingTTSButton messageId={TEST_MESSAGE_ID} content={TEST_CONTENT} />)
|
||||
render(<FloatingTTSButton messageId={TEST_MESSAGE_ID} content={TEST_CONTENT} isScrolledUp={false} onSpeakVisible={mockSpeakVisible} />)
|
||||
|
||||
const button = screen.getByRole('button', { name: /play latest reply/i })
|
||||
await act(async () => {
|
||||
@@ -212,7 +214,7 @@ describe('FloatingTTSButton', () => {
|
||||
it('does not call speakMessage if pointer leaves before release after long press fires', async () => {
|
||||
vi.useFakeTimers()
|
||||
setup()
|
||||
render(<FloatingTTSButton messageId={TEST_MESSAGE_ID} content={TEST_CONTENT} />)
|
||||
render(<FloatingTTSButton messageId={TEST_MESSAGE_ID} content={TEST_CONTENT} isScrolledUp={false} onSpeakVisible={mockSpeakVisible} />)
|
||||
|
||||
const button = screen.getByRole('button', { name: /play latest reply/i })
|
||||
await act(async () => {
|
||||
@@ -227,7 +229,7 @@ describe('FloatingTTSButton', () => {
|
||||
|
||||
it('exposes the gesture hint in the aria-label for accessibility', () => {
|
||||
setup()
|
||||
render(<FloatingTTSButton messageId={TEST_MESSAGE_ID} content={TEST_CONTENT} />)
|
||||
render(<FloatingTTSButton messageId={TEST_MESSAGE_ID} content={TEST_CONTENT} isScrolledUp={false} onSpeakVisible={mockSpeakVisible} />)
|
||||
|
||||
const button = screen.getByRole('button', { name: /hold to toggle auto-play/i })
|
||||
expect(button).toBeInTheDocument()
|
||||
@@ -235,7 +237,7 @@ describe('FloatingTTSButton', () => {
|
||||
|
||||
it('shows stop icon when this message is playing', () => {
|
||||
setup({ autoPlay: true, activeMessageId: TEST_MESSAGE_ID, isPlaying: true })
|
||||
render(<FloatingTTSButton messageId={TEST_MESSAGE_ID} content={TEST_CONTENT} />)
|
||||
render(<FloatingTTSButton messageId={TEST_MESSAGE_ID} content={TEST_CONTENT} isScrolledUp={false} onSpeakVisible={mockSpeakVisible} />)
|
||||
|
||||
const button = screen.getByRole('button', { name: /stop playback/i })
|
||||
|
||||
@@ -249,14 +251,14 @@ describe('FloatingTTSButton', () => {
|
||||
|
||||
it('shows the same stop icon while this message is loading', () => {
|
||||
setup({ activeMessageId: TEST_MESSAGE_ID, isLoading: true })
|
||||
render(<FloatingTTSButton messageId={TEST_MESSAGE_ID} content={TEST_CONTENT} />)
|
||||
render(<FloatingTTSButton messageId={TEST_MESSAGE_ID} content={TEST_CONTENT} isScrolledUp={false} onSpeakVisible={mockSpeakVisible} />)
|
||||
|
||||
expect(screen.getByRole('button', { name: /stop playback/i })).toHaveClass('bg-destructive')
|
||||
})
|
||||
|
||||
it('shows autoplay state with button color when autoPlay is enabled', () => {
|
||||
setup({ autoPlay: true })
|
||||
render(<FloatingTTSButton messageId={TEST_MESSAGE_ID} content={TEST_CONTENT} />)
|
||||
render(<FloatingTTSButton messageId={TEST_MESSAGE_ID} content={TEST_CONTENT} isScrolledUp={false} onSpeakVisible={mockSpeakVisible} />)
|
||||
|
||||
const button = screen.getByRole('button', { name: /auto-play enabled/i })
|
||||
|
||||
@@ -269,7 +271,7 @@ describe('FloatingTTSButton', () => {
|
||||
|
||||
it('uses the default play color when autoPlay is disabled', () => {
|
||||
setup({ autoPlay: false })
|
||||
render(<FloatingTTSButton messageId={TEST_MESSAGE_ID} content={TEST_CONTENT} />)
|
||||
render(<FloatingTTSButton messageId={TEST_MESSAGE_ID} content={TEST_CONTENT} isScrolledUp={false} onSpeakVisible={mockSpeakVisible} />)
|
||||
|
||||
const button = screen.getByRole('button', { name: /play latest reply/i })
|
||||
|
||||
@@ -277,4 +279,68 @@ describe('FloatingTTSButton', () => {
|
||||
expect(button).not.toHaveClass('bg-primary')
|
||||
expect(screen.queryByText('Play')).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('reads visible replies on tap when scrolled up and idle', () => {
|
||||
setup()
|
||||
render(
|
||||
<FloatingTTSButton
|
||||
messageId={TEST_MESSAGE_ID}
|
||||
content={TEST_CONTENT}
|
||||
isScrolledUp
|
||||
onSpeakVisible={mockSpeakVisible}
|
||||
/>
|
||||
)
|
||||
|
||||
const button = screen.getByRole('button', { name: /read visible replies/i })
|
||||
fireEvent.pointerDown(button)
|
||||
act(() => {
|
||||
fireEvent.pointerUp(button)
|
||||
})
|
||||
|
||||
expect(mockSpeakVisible).toHaveBeenCalledTimes(1)
|
||||
expect(mockSpeakMessage).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('stops playback on tap when scrolled up and playing', () => {
|
||||
setup({ activeMessageId: TEST_MESSAGE_ID, isPlaying: true })
|
||||
render(
|
||||
<FloatingTTSButton
|
||||
messageId={TEST_MESSAGE_ID}
|
||||
content={TEST_CONTENT}
|
||||
isScrolledUp
|
||||
onSpeakVisible={mockSpeakVisible}
|
||||
/>
|
||||
)
|
||||
|
||||
const button = screen.getByRole('button', { name: /stop playback/i })
|
||||
fireEvent.pointerDown(button)
|
||||
act(() => {
|
||||
fireEvent.pointerUp(button)
|
||||
})
|
||||
|
||||
expect(mockStop).toHaveBeenCalledTimes(1)
|
||||
expect(mockSpeakVisible).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('speaks the latest reply on tap when not scrolled up and idle', () => {
|
||||
setup()
|
||||
render(
|
||||
<FloatingTTSButton
|
||||
messageId={TEST_MESSAGE_ID}
|
||||
content={TEST_CONTENT}
|
||||
isScrolledUp={false}
|
||||
onSpeakVisible={mockSpeakVisible}
|
||||
/>
|
||||
)
|
||||
|
||||
const button = screen.getByRole('button', { name: /play latest reply/i })
|
||||
fireEvent.pointerDown(button)
|
||||
act(() => {
|
||||
fireEvent.pointerUp(button)
|
||||
})
|
||||
|
||||
expect(mockSpeakMessage).toHaveBeenCalledTimes(1)
|
||||
expect(mockSpeakMessage).toHaveBeenCalledWith(TEST_MESSAGE_ID, TEST_CONTENT)
|
||||
expect(mockSpeakVisible).not.toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
@@ -8,11 +8,13 @@ import { DEFAULT_TTS_CONFIG } from '@opencode-manager/shared'
|
||||
interface FloatingTTSButtonProps {
|
||||
messageId: string
|
||||
content: string
|
||||
isScrolledUp: boolean
|
||||
onSpeakVisible: () => void
|
||||
}
|
||||
|
||||
const LONG_PRESS_DURATION = 500
|
||||
|
||||
export function FloatingTTSButton({ messageId, content }: FloatingTTSButtonProps) {
|
||||
export function FloatingTTSButton({ messageId, content, isScrolledUp, onSpeakVisible }: FloatingTTSButtonProps) {
|
||||
const { speakMessage, stop, isPlaying, isLoading } = useTTS()
|
||||
const { preferences, updateSettings } = useSettings()
|
||||
|
||||
@@ -63,10 +65,15 @@ export function FloatingTTSButton({ messageId, content }: FloatingTTSButtonProps
|
||||
return
|
||||
}
|
||||
|
||||
if (isScrolledUp) {
|
||||
onSpeakVisible()
|
||||
return
|
||||
}
|
||||
|
||||
if (hasContent) {
|
||||
speakMessage(messageId, content)
|
||||
}
|
||||
}, [clearLongPressTimer, isAnyPlaybackActive, stop, speakMessage, messageId, content, hasContent])
|
||||
}, [clearLongPressTimer, isAnyPlaybackActive, stop, isScrolledUp, onSpeakVisible, speakMessage, messageId, content, hasContent])
|
||||
|
||||
const handlePointerLeave = useCallback(() => {
|
||||
clearLongPressTimer()
|
||||
@@ -77,9 +84,11 @@ export function FloatingTTSButton({ messageId, content }: FloatingTTSButtonProps
|
||||
const showStop = isAnyPlaybackActive
|
||||
const pillTitle = showStop
|
||||
? 'Stop playback'
|
||||
: hasContent
|
||||
? 'Play latest reply'
|
||||
: 'TTS controls'
|
||||
: isScrolledUp
|
||||
? 'Read visible replies'
|
||||
: hasContent
|
||||
? 'Play latest reply'
|
||||
: 'TTS controls'
|
||||
const pillAriaLabel = `${pillTitle}. ${autoPlay ? 'Auto-play enabled.' : 'Auto-play disabled.'} hold to toggle auto-play`
|
||||
const buttonToneClasses = showStop
|
||||
? 'justify-center px-3 py-1.5 rounded-lg bg-destructive border border-destructive/60 shadow-destructive/30 ring-destructive/20 hover:ring-destructive/40 text-destructive-foreground'
|
||||
|
||||
@@ -496,7 +496,7 @@ const MessageRow = memo(function MessageRow({
|
||||
: 0
|
||||
|
||||
return (
|
||||
<div className="flex flex-col group">
|
||||
<div className="flex flex-col group" data-message-id={message.id}>
|
||||
<div
|
||||
className={`w-full rounded-lg p-1.5 bg-card/50 border border-border ${streaming ? 'animate-pulse-subtle' : ''}`}
|
||||
>
|
||||
|
||||
@@ -15,6 +15,7 @@ const permission: PermissionRequest = {
|
||||
sessionID: 'session-1',
|
||||
action: 'shell',
|
||||
resources: ['rm -rf node_modules'],
|
||||
save: ['rm *'],
|
||||
metadata: {},
|
||||
}
|
||||
|
||||
@@ -29,9 +30,99 @@ describe('PermissionRequestDialog', () => {
|
||||
render(<PermissionRequestDialog permission={permission} pendingCount={1} onRespond={vi.fn()} />)
|
||||
|
||||
expect(screen.getByText('Run Command')).toBeInTheDocument()
|
||||
expect(screen.getByText('Command')).toBeInTheDocument()
|
||||
expect(screen.getByText('rm -rf node_modules')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('labels multiple shell resources as commands', () => {
|
||||
render(
|
||||
<PermissionRequestDialog
|
||||
permission={{ ...permission, resources: ['git status', 'git push origin main'] }}
|
||||
pendingCount={1}
|
||||
onRespond={vi.fn()}
|
||||
/>,
|
||||
)
|
||||
|
||||
expect(screen.getByText('Commands')).toBeInTheDocument()
|
||||
expect(screen.getByText(/git status/)).toBeInTheDocument()
|
||||
expect(screen.getByText(/git push origin main/)).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('shows the request message when present', () => {
|
||||
render(
|
||||
<PermissionRequestDialog
|
||||
permission={{ ...permission, message: 'This command modifies tracked files.' }}
|
||||
pendingCount={1}
|
||||
onRespond={vi.fn()}
|
||||
/>,
|
||||
)
|
||||
|
||||
expect(screen.getByText('This command modifies tracked files.')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('describes a wildcard always scope', () => {
|
||||
render(
|
||||
<PermissionRequestDialog
|
||||
permission={{ ...permission, save: ['*'] }}
|
||||
pendingCount={1}
|
||||
onRespond={vi.fn()}
|
||||
/>,
|
||||
)
|
||||
|
||||
expect(screen.getByText('This will always allow shell for this project.')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('lists the patterns an always decision approves', () => {
|
||||
render(
|
||||
<PermissionRequestDialog
|
||||
permission={{ ...permission, save: ['printf *', 'echo *'] }}
|
||||
pendingCount={1}
|
||||
onRespond={vi.fn()}
|
||||
/>,
|
||||
)
|
||||
|
||||
expect(
|
||||
screen.getByText('This will always allow the following patterns for this project.'),
|
||||
).toBeInTheDocument()
|
||||
expect(screen.getByText('printf *')).toBeInTheDocument()
|
||||
expect(screen.getByText('echo *')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('omits the always option when no save patterns are provided', () => {
|
||||
render(
|
||||
<PermissionRequestDialog
|
||||
permission={{ ...permission, save: undefined }}
|
||||
pendingCount={1}
|
||||
onRespond={vi.fn()}
|
||||
/>,
|
||||
)
|
||||
|
||||
expect(screen.queryByRole('button', { name: 'Allow Always' })).not.toBeInTheDocument()
|
||||
expect(screen.queryByText(/This will always allow/)).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('renders an open session control that triggers the handler', async () => {
|
||||
const onOpenSession = vi.fn()
|
||||
render(
|
||||
<PermissionRequestDialog
|
||||
permission={permission}
|
||||
pendingCount={1}
|
||||
onRespond={vi.fn()}
|
||||
onOpenSession={onOpenSession}
|
||||
/>,
|
||||
)
|
||||
|
||||
await userEvent.click(screen.getByRole('button', { name: 'Open session' }))
|
||||
|
||||
expect(onOpenSession).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
|
||||
it('omits the open session control without a handler', () => {
|
||||
render(<PermissionRequestDialog permission={permission} pendingCount={1} onRespond={vi.fn()} />)
|
||||
|
||||
expect(screen.queryByRole('button', { name: 'Open session' })).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('replies with the selected decision for the permission request', async () => {
|
||||
const onRespond = vi.fn().mockResolvedValue(undefined)
|
||||
render(<PermissionRequestDialog permission={permission} pendingCount={1} onRespond={onRespond} />)
|
||||
|
||||
@@ -11,7 +11,11 @@ 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 { getPermissionLabel, getPermissionDetail } from '@opencode-manager/shared/notifications'
|
||||
import {
|
||||
getPermissionLabel,
|
||||
getPermissionDetail,
|
||||
getPermissionAlwaysScope,
|
||||
} from '@opencode-manager/shared/notifications'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { showToast } from '@/lib/toast'
|
||||
|
||||
@@ -21,6 +25,7 @@ interface PermissionRequestDialogProps {
|
||||
isFromDifferentSession?: boolean
|
||||
sessionTitle?: string
|
||||
repoDirectory?: string | null
|
||||
onOpenSession?: () => void
|
||||
onRespond: (
|
||||
permissionID: string,
|
||||
sessionID: string,
|
||||
@@ -37,6 +42,7 @@ export function PermissionRequestDialog({
|
||||
isFromDifferentSession,
|
||||
sessionTitle,
|
||||
repoDirectory,
|
||||
onOpenSession,
|
||||
onRespond,
|
||||
open: parentOpen,
|
||||
onOpenChange,
|
||||
@@ -69,6 +75,7 @@ export function PermissionRequestDialog({
|
||||
|
||||
const typeLabel = getPermissionLabel(permission.action)
|
||||
const details = getPermissionDetail(permission)
|
||||
const alwaysScope = getPermissionAlwaysScope(permission)
|
||||
const hasMultiple = pendingCount > 1
|
||||
const displaySessionName = sessionTitle || `Session ${permission.sessionID.slice(0, 8)}...`
|
||||
|
||||
@@ -95,15 +102,24 @@ export function PermissionRequestDialog({
|
||||
{typeLabel}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
{permission.message && (
|
||||
<p className="text-xs sm:text-sm break-words">{permission.message}</p>
|
||||
)}
|
||||
|
||||
{details.primary && (
|
||||
<div className="bg-muted/50 border rounded-md p-2 sm:p-3 max-h-32 overflow-y-auto overflow-x-hidden">
|
||||
<pre className="text-xs sm:text-sm font-mono whitespace-pre-wrap break-all w-full">
|
||||
{details.primary}
|
||||
</pre>
|
||||
<div className="space-y-1">
|
||||
{details.label && (
|
||||
<span className="block text-xs font-medium text-muted-foreground">{details.label}</span>
|
||||
)}
|
||||
<div className="bg-muted/50 border rounded-md p-2 sm:p-3 max-h-32 overflow-y-auto overflow-x-hidden">
|
||||
<pre className="text-xs sm:text-sm font-mono whitespace-pre-wrap break-all w-full">
|
||||
{details.primary}
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
||||
{details.secondary && (
|
||||
<div className="bg-muted/30 border rounded-md p-2 sm:p-3 max-h-24 overflow-y-auto overflow-x-hidden">
|
||||
<pre className="text-xs font-mono whitespace-pre-wrap break-all w-full text-muted-foreground">
|
||||
@@ -114,19 +130,32 @@ export function PermissionRequestDialog({
|
||||
|
||||
<div className="text-xs text-muted-foreground space-y-1">
|
||||
{repoDirectory && (
|
||||
<div className="truncate">
|
||||
<div className="truncate" title={repoDirectory}>
|
||||
Repo: <span className="font-medium">{repoDirectory.split('/').pop() ?? repoDirectory}</span>
|
||||
</div>
|
||||
)}
|
||||
{isFromDifferentSession ? (
|
||||
<div className="bg-warning/10 text-warning border border-warning/20 rounded-md px-2 py-1.5 truncate">
|
||||
From another session: <span className="font-medium">{displaySessionName}</span>
|
||||
</div>
|
||||
) : (
|
||||
<div className="truncate">
|
||||
Session: <span className="font-medium">{displaySessionName}</span>
|
||||
</div>
|
||||
)}
|
||||
<div className="flex items-center gap-2">
|
||||
{isFromDifferentSession ? (
|
||||
<div className="bg-warning/10 text-warning border border-warning/20 rounded-md px-2 py-1.5 truncate min-w-0 flex-1">
|
||||
From another session: <span className="font-medium">{displaySessionName}</span>
|
||||
</div>
|
||||
) : (
|
||||
<div className="truncate min-w-0 flex-1">
|
||||
Session: <span className="font-medium">{displaySessionName}</span>
|
||||
</div>
|
||||
)}
|
||||
{onOpenSession && (
|
||||
<Button
|
||||
type="button"
|
||||
variant="link"
|
||||
size="sm"
|
||||
onClick={onOpenSession}
|
||||
className="h-auto shrink-0 p-0 text-xs"
|
||||
>
|
||||
Open session
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -144,6 +173,19 @@ export function PermissionRequestDialog({
|
||||
/>
|
||||
</div>
|
||||
|
||||
{alwaysScope && (
|
||||
<div className="rounded-md border bg-muted/30 px-2 py-1.5 text-xs text-muted-foreground space-y-1">
|
||||
<p>{alwaysScope.summary}</p>
|
||||
{alwaysScope.patterns.length > 0 && (
|
||||
<ul className="list-disc pl-4 space-y-0.5 font-mono break-all">
|
||||
{alwaysScope.patterns.map((pattern) => (
|
||||
<li key={pattern}>{pattern}</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<DialogFooter className="flex-col-reverse gap-2 sm:flex-row sm:gap-2 mt-2">
|
||||
<Button
|
||||
variant="outline"
|
||||
@@ -156,17 +198,19 @@ export function PermissionRequestDialog({
|
||||
>
|
||||
{loadingAction === 'reject' ? 'Denying...' : 'Deny'}
|
||||
</Button>
|
||||
<Button
|
||||
variant="secondary"
|
||||
onClick={() => handleResponse('always')}
|
||||
disabled={isLoading}
|
||||
className={cn(
|
||||
"w-full sm:flex-1 text-sm h-9 sm:h-10",
|
||||
loadingAction === 'always' && "opacity-70"
|
||||
)}
|
||||
>
|
||||
{loadingAction === 'always' ? 'Allowing...' : 'Allow Always'}
|
||||
</Button>
|
||||
{alwaysScope && (
|
||||
<Button
|
||||
variant="secondary"
|
||||
onClick={() => handleResponse('always')}
|
||||
disabled={isLoading}
|
||||
className={cn(
|
||||
"w-full sm:flex-1 text-sm h-9 sm:h-10",
|
||||
loadingAction === 'always' && "opacity-70"
|
||||
)}
|
||||
>
|
||||
{loadingAction === 'always' ? 'Allowing...' : 'Allow Always'}
|
||||
</Button>
|
||||
)}
|
||||
<Button
|
||||
variant="default"
|
||||
onClick={() => handleResponse('once')}
|
||||
|
||||
@@ -7,7 +7,7 @@ import { formatEventModifiers, formatShortcutEvent, formatShortcutLabel, isModif
|
||||
import { applyTuiKeybindImport, parseTuiKeybindConfig } from '@/lib/tuiKeybindImport'
|
||||
import { showToast } from '@/lib/toast'
|
||||
|
||||
const CONVERSATION_ACTIONS = ['submit', 'abort', 'clearPrompt', 'toggleMode', 'undo', 'redo', 'compact', 'fork', 'timeline', 'exportSession', 'selectModel', 'variantCycle', 'favoriteCycle', 'halfPageUp', 'halfPageDown']
|
||||
const CONVERSATION_ACTIONS = ['submit', 'abort', 'clearPrompt', 'toggleMode', 'undo', 'redo', 'compact', 'fork', 'timeline', 'exportSession', 'selectModel', 'variantCycle', 'favoriteCycle', 'halfPageUp', 'halfPageDown', 'speakVisible']
|
||||
const NAVIGATION_ACTIONS = ['settings', 'sessions', 'switchPickerTab', 'newSession', 'closeSession', 'toggleSidebar', 'toggleTerminal', 'toggleSourceControl']
|
||||
|
||||
const formatActionLabel = (action: string): string => {
|
||||
|
||||
Reference in new issue
Block a user