diff --git a/docs/features/chat.md b/docs/features/chat.md index 120b6ac4..919adc6b 100644 --- a/docs/features/chat.md +++ b/docs/features/chat.md @@ -30,7 +30,9 @@ Click the **model name** in the chat prompt area to open the quick model switche ## Slash Commands -Type `/` to see available commands. Built-in commands are covered in the [Quick Start](../getting-started/quickstart.md#useful-commands). +Type `/` to see available commands. Built-in commands are covered in the [Quick Start](../getting-started/quickstart.md#useful-commands). OpenCode's own commands, such as `/init` and `/review`, appear in the same list. + +The fork keyboard shortcut opens the same message picker as `/fork`. ### Custom Commands @@ -49,7 +51,7 @@ template: | {{selection}} ``` -Use with `/review` in chat. +Use with `/review` in chat. A custom command with the same name as a built-in command replaces the built-in. ## File Mentions diff --git a/docs/getting-started/quickstart.md b/docs/getting-started/quickstart.md index 059ddfc6..16b74a92 100644 --- a/docs/getting-started/quickstart.md +++ b/docs/getting-started/quickstart.md @@ -86,9 +86,26 @@ If you already used standalone OpenCode in those repositories, existing chats ap | Command | Description | |---------|-------------| -| `/help` | Show available commands | -| `/new` | Start a new session | +| `/help`, `/settings` | Open settings | +| `/new`, `/clear` | Start a new session | +| `/sessions`, `/resume`, `/continue` | List and switch between sessions | +| `/model`, `/models` | Open the model picker, also while a response is running | +| `/agent` | Switch to the next primary agent | +| `/variants` | Cycle the model's reasoning variant | | `/compact` | Reduce session context | +| `/rename [title]` | Rename the session; with no title, regenerate it | +| `/fork` | Fork the session from a chosen message, or the entire conversation | +| `/timeline` | Jump to a loaded message in the conversation | +| `/btw ` | Ask a side question without adding it to the conversation | +| `/copy` | Copy the full transcript as Markdown | +| `/export` | Download the full transcript as Markdown | +| `/undo`, `/redo` | Undo or redo the last message | +| `/details` | Toggle tool execution details | +| `/mcp` | Manage MCP servers | +| `/skills` | Load a skill | +| `/connect` | Connect a provider | + +Built-in commands use only the command text. Attached files and images are kept in the composer for your next message. ### File Mentions diff --git a/frontend/src/api/opencode.test.ts b/frontend/src/api/opencode.test.ts index 3bac0f44..f6ff004d 100644 --- a/frontend/src/api/opencode.test.ts +++ b/frontend/src/api/opencode.test.ts @@ -1,6 +1,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { activateSkill, + askSideQuestion, cancelForm, clearRevert, commitRevert, @@ -26,6 +27,7 @@ import { stageRevert, switchSessionAgent, switchSessionModel, + SIDE_QUESTION_INSTRUCTIONS, } from './opencode' import { FetchError } from './fetchWrapper' @@ -413,6 +415,20 @@ describe('OpenCode facade', () => { expect(lastRequest().init.method).toBe('POST') }) + it('asks a side question through the session generate route with the shared instructions', async () => { + fetchMock.mockResolvedValue(jsonResponse({ data: { text: ' answer \n' } })) + + const answer = await askSideQuestion('ses_1', 'why?') + + expect(lastRequest().url).toBe('http://localhost/api/opencode/api/session/ses_1/generate') + expect(lastRequest().init.method).toBe('POST') + const body = JSON.parse(String(lastRequest().init.body)) + expect(body.prompt).toBe(`${SIDE_QUESTION_INSTRUCTIONS}\n\nwhy?`) + expect(body.prompt.startsWith(SIDE_QUESTION_INSTRUCTIONS)).toBe(true) + expect(body.prompt.endsWith('\n\nwhy?')).toBe(true) + expect(answer).toBe('answer') + }) + it('stages, commits, and clears a session revert', async () => { fetchMock.mockResolvedValue(jsonResponse({ data: { messageID: 'msg_1' } })) diff --git a/frontend/src/api/opencode.ts b/frontend/src/api/opencode.ts index 780737b7..01f3639c 100644 --- a/frontend/src/api/opencode.ts +++ b/frontend/src/api/opencode.ts @@ -167,6 +167,23 @@ export async function runShell(sessionID: string, command: string): Promise api.session.shell({ sessionID, command })) } +export const SIDE_QUESTION_INSTRUCTIONS = + 'The user is asking a quick side question about the conversation so far. Answer directly and concisely in markdown from what you already know. Do not call any tools and do not take any actions.' + +export async function askSideQuestion( + sessionID: string, + question: string, + signal?: AbortSignal, +): Promise { + const result = await callOpenCode((api) => + api.session.generate( + { sessionID, prompt: [SIDE_QUESTION_INSTRUCTIONS, question].join('\n\n') }, + signal ? { signal } : undefined, + ), + ) + return result.text.trim() +} + export async function interruptSession(sessionID: string): Promise { await callOpenCode((api) => api.session.interrupt({ sessionID })) } diff --git a/frontend/src/components/agent/AgentQuickSelect.tsx b/frontend/src/components/agent/AgentQuickSelect.tsx index e9f34890..ab659426 100644 --- a/frontend/src/components/agent/AgentQuickSelect.tsx +++ b/frontend/src/components/agent/AgentQuickSelect.tsx @@ -10,6 +10,7 @@ import { } from '@/components/ui/dropdown-menu' import { useAgents } from '@/hooks/useOpenCode' import { getAgentStyleVars } from '@/lib/agent-colors' +import { getPrimaryAgents } from '@/lib/primaryAgents' interface AgentQuickSelectProps { directory?: string @@ -39,13 +40,7 @@ export function AgentQuickSelect({ }: AgentQuickSelectProps) { const { data: agents = [] } = useAgents(directory) - const primaryAgents = useMemo(() => { - return agents.filter( - (agent) => - (agent.mode === 'primary' || agent.mode === 'all') && - !agent.hidden - ) - }, [agents]) + const primaryAgents = useMemo(() => getPrimaryAgents(agents), [agents]) const handleSelect = (agentId: string) => { onAgentChange(agentId) diff --git a/frontend/src/components/message/MessagePart.test.tsx b/frontend/src/components/message/MessagePart.test.tsx index ddc651e0..bbef9209 100644 --- a/frontend/src/components/message/MessagePart.test.tsx +++ b/frontend/src/components/message/MessagePart.test.tsx @@ -347,7 +347,8 @@ describe('MessagePart', () => { const copyButton = screen.getByTitle('Copy output') fireEvent.click(copyButton) - await expect(vi.waitFor(() => writeText.mock.calls[0]?.[0])).resolves.toBe(output) + await vi.waitFor(() => expect(writeText).toHaveBeenCalled()) + expect(writeText).toHaveBeenCalledWith(output) }) }) diff --git a/frontend/src/components/message/MessageThread.test.tsx b/frontend/src/components/message/MessageThread.test.tsx index d0865b26..ee75c908 100644 --- a/frontend/src/components/message/MessageThread.test.tsx +++ b/frontend/src/components/message/MessageThread.test.tsx @@ -439,6 +439,20 @@ describe('MessageThread', () => { expect(screen.getByText('You')).toBeInTheDocument() }) + it('exposes the message id on a rendered user message', () => { + setupSettings({ simpleChatMode: false, showReasoning: false }) + + const { container } = render( + , + ) + + expect(container.querySelector('[data-message-id="user-42"]')).not.toBeNull() + }) + it('renders a projected shell message from the fixtures', () => { setupSettings({ simpleChatMode: false, showReasoning: false }) diff --git a/frontend/src/components/message/MessageThread.tsx b/frontend/src/components/message/MessageThread.tsx index f5332115..4906d311 100644 --- a/frontend/src/components/message/MessageThread.tsx +++ b/frontend/src/components/message/MessageThread.tsx @@ -398,7 +398,7 @@ const MessageRow = memo(function MessageRow({ if (!hasRenderableContent(message, simpleChatMode, showReasoning)) return null return ( -
+
({ runCommand: vi.fn(), switchSessionModel: vi.fn(), switchSessionAgent: vi.fn(), - compactSession: vi.fn(), - agents: [] as Array<{ name: string; description?: string }>, + agents: [] as Array<{ id: string; name: string; description?: string; mode?: string; hidden?: boolean }>, + setAgent: vi.fn(), + cycleVariant: vi.fn(), + showToast: { + success: vi.fn(), + error: vi.fn(), + info: vi.fn(), + warning: vi.fn(), + loading: vi.fn(), + promise: vi.fn(), + dismiss: vi.fn(), + }, useSTT: vi.fn(), useMobile: vi.fn(), useCommands: vi.fn(), @@ -27,7 +40,6 @@ vi.mock('@/api/opencode', async () => { return { ...actual, runCommand: mocks.runCommand, - compactSession: mocks.compactSession, switchSessionModel: mocks.switchSessionModel, switchSessionAgent: mocks.switchSessionAgent, } @@ -42,7 +54,6 @@ vi.mock('@/hooks/useOpenCode', async () => { }) vi.mock('@/hooks/useSTT', () => ({ useSTT: mocks.useSTT })) -vi.mock('react-router-dom', () => ({ useNavigate: () => vi.fn() })) vi.mock('@/hooks/useMobile', () => ({ useMobile: mocks.useMobile })) vi.mock('@/hooks/useCommands', () => ({ useCommands: mocks.useCommands })) vi.mock('@/hooks/useFileSearch', () => ({ useFileSearch: mocks.useFileSearch })) @@ -52,6 +63,7 @@ vi.mock('@/hooks/useSessionAgent', () => ({ useSessionAgent: mocks.useSessionAge vi.mock('@/stores/userBashStore', () => ({ useUserBash: mocks.useUserBash })) vi.mock('@/stores/sessionAgentStore', () => ({ useSessionAgentStore: mocks.useSessionAgentStore })) vi.mock('@/stores/sendErrorStore', () => ({ useSendErrorStore: mocks.useSendErrorStore })) +vi.mock('@/lib/toast', () => ({ showToast: mocks.showToast })) vi.mock('@/contexts/EventContext', () => ({ usePermissions: () => ({ @@ -65,7 +77,9 @@ vi.mock('@/components/agent/AgentQuickSelect', () => ({ })) vi.mock('@/components/model/ModelQuickSelect', () => ({ - ModelQuickSelect: ({ children }: { children: React.ReactNode }) =>
{children}
, + ModelQuickSelect: ({ children, open }: { children?: React.ReactNode; open?: boolean }) => ( +
{children}
+ ), })) vi.mock('@/components/ui/session-status-indicator', () => ({ @@ -105,10 +119,7 @@ describe('PromptInput command submission', () => { isSessionActive: false, isStreamingResponse: false, onScrollToBottom: vi.fn(), - onShowSessionsDialog: vi.fn(), - onShowHelpDialog: vi.fn(), - onToggleDetails: vi.fn(), - onExportSession: vi.fn(), + commandActions: createCommandActionsMock(), onPromptChange: vi.fn(), } @@ -134,7 +145,7 @@ describe('PromptInput command submission', () => { mocks.runCommand.mockResolvedValue(undefined) mocks.switchSessionModel.mockResolvedValue(undefined) mocks.switchSessionAgent.mockResolvedValue(undefined) - mocks.agents = [{ name: 'reviewer', description: 'Reviewer' }] + mocks.agents = [{ id: 'reviewer', name: 'reviewer', description: 'Reviewer', mode: 'primary' }] mocks.useMobile.mockReturnValue(false) mocks.useSTT.mockReturnValue({ isRecording: false, @@ -150,7 +161,11 @@ describe('PromptInput command submission', () => { clear: vi.fn(), }) mocks.useCommands.mockReturnValue({ - filterCommands: (query: string) => query === 'review' ? [{ name: 'review', description: 'Review' }] : [], + filterCommands: (query: string) => { + if (query === 'review') return [{ name: 'review', description: 'Review' }] + const builtin = BUILTIN_COMMANDS.find((command) => command.name === query) + return builtin ? [builtin] : [] + }, }) mocks.useFileSearch.mockReturnValue({ files: [] }) mocks.useModelSelection.mockReturnValue({ @@ -163,10 +178,10 @@ describe('PromptInput command submission', () => { toggleFavorite: vi.fn(), isModelStateLoading: false, }) - mocks.useVariants.mockReturnValue({ hasVariants: false, currentVariant: null, cycleVariant: vi.fn() }) + mocks.useVariants.mockReturnValue({ hasVariants: false, currentVariant: null, cycleVariant: mocks.cycleVariant }) mocks.useSessionAgent.mockReturnValue({ agent: 'build' }) mocks.useUserBash.mockImplementation((selector: (state: unknown) => unknown) => selector({ addUserBashCommand: vi.fn() })) - mocks.useSessionAgentStore.mockImplementation((selector: (state: unknown) => unknown) => selector({ setAgent: vi.fn() })) + mocks.useSessionAgentStore.mockImplementation((selector: (state: unknown) => unknown) => selector({ setAgent: mocks.setAgent })) mocks.useSendErrorStore.mockImplementation((selector: (state: unknown) => unknown) => selector({ errors: {} })) useUIState.getState().clearPendingPromptCommand() useUIState.getState().clearPendingPromptFile() @@ -222,4 +237,88 @@ describe('PromptInput command submission', () => { await waitFor(() => expect(mocks.runCommand).toHaveBeenCalled()) expect(input).toHaveValue('/review') }) + + it('switches to the next primary agent for /agent without invoking runCommand', async () => { + mocks.agents = [ + { id: 'build', name: 'build', mode: 'primary' }, + { id: 'plan', name: 'plan', mode: 'primary' }, + ] + renderComponent() + + const input = await screen.findByPlaceholderText('Send a message...') + fireEvent.change(input, { target: { value: '/agent' } }) + fireEvent.click(screen.getByTitle('Send')) + + await waitFor(() => expect(mocks.setAgent).toHaveBeenCalledWith('test-session', 'plan')) + expect(mocks.runCommand).not.toHaveBeenCalled() + }) + + it('reports when /variants is used with a model that has no variants', async () => { + mocks.useVariants.mockReturnValue({ hasVariants: false, currentVariant: null, cycleVariant: mocks.cycleVariant }) + renderComponent() + + const input = await screen.findByPlaceholderText('Send a message...') + fireEvent.change(input, { target: { value: '/variants' } }) + fireEvent.click(screen.getByTitle('Send')) + + await waitFor(() => expect(mocks.showToast.info).toHaveBeenCalledWith('The selected model has no variants')) + expect(mocks.cycleVariant).not.toHaveBeenCalled() + }) + + it('cycles variants for /variants when the model has them', async () => { + mocks.useVariants.mockReturnValue({ hasVariants: true, currentVariant: 'high', cycleVariant: mocks.cycleVariant }) + renderComponent() + + const input = await screen.findByPlaceholderText('Send a message...') + fireEvent.change(input, { target: { value: '/variants' } }) + fireEvent.click(screen.getByTitle('Send')) + + await waitFor(() => expect(mocks.cycleVariant).toHaveBeenCalled()) + expect(mocks.showToast.info).not.toHaveBeenCalled() + }) + + it('opens the model picker through the imperative handle while the session is active', () => { + const queryClient = createTestQueryClient() + queryClient.setQueryData(['opencode', 'session', 'test-session', '/test'], sessionInfo()) + const ref = createRef() + + render( + + + + ) + + expect(screen.getByTestId('model-quick-select')).toHaveAttribute('data-open', 'false') + + act(() => { + ref.current?.openModelPicker() + }) + + expect(screen.getByTestId('model-quick-select')).toHaveAttribute('data-open', 'true') + }) + + it('keeps attachments and clears only the text when a built-in command is submitted', async () => { + const { container } = renderComponent() + + const input = await screen.findByPlaceholderText('Send a message...') + await attachImage(container) + + fireEvent.change(input, { target: { value: '/btw hi' } }) + fireEvent.click(screen.getByTitle('Send')) + + await waitFor(() => expect(mocks.showToast.info).toHaveBeenCalledWith('Built-in commands do not use attachments; they were kept')) + expect(input).toHaveValue('') + expect(screen.getByText('pic.png')).toBeInTheDocument() + }) + + it('clears the prompt for a built-in command without attachments', async () => { + renderComponent() + + const input = await screen.findByPlaceholderText('Send a message...') + fireEvent.change(input, { target: { value: '/btw hi' } }) + fireEvent.click(screen.getByTitle('Send')) + + await waitFor(() => expect(input).toHaveValue('')) + expect(mocks.showToast.info).not.toHaveBeenCalled() + }) }) diff --git a/frontend/src/components/message/PromptInput.mention.test.tsx b/frontend/src/components/message/PromptInput.mention.test.tsx index 9b9f3ab0..b4394cf1 100644 --- a/frontend/src/components/message/PromptInput.mention.test.tsx +++ b/frontend/src/components/message/PromptInput.mention.test.tsx @@ -3,13 +3,13 @@ import { render, screen, fireEvent, waitFor } from '@testing-library/react' import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import { PromptInput } from './PromptInput' import { useUIState } from '@/stores/uiStateStore' +import { createCommandActionsMock } from '@/test/test-utils' const mocks = vi.hoisted(() => ({ sendPrompt: vi.fn(), switchSessionModel: vi.fn(), switchSessionAgent: vi.fn(), runCommand: vi.fn(), - compactSession: vi.fn(), agents: [] as Array<{ name: string; description?: string }>, useSTT: vi.fn(), useMobile: vi.fn(), @@ -29,7 +29,6 @@ vi.mock('@/api/opencode', async () => { ...actual, sendPrompt: mocks.sendPrompt, runCommand: mocks.runCommand, - compactSession: mocks.compactSession, switchSessionModel: mocks.switchSessionModel, switchSessionAgent: mocks.switchSessionAgent, } @@ -44,7 +43,6 @@ vi.mock('@/hooks/useOpenCode', async () => { }) vi.mock('@/hooks/useSTT', () => ({ useSTT: mocks.useSTT })) -vi.mock('react-router-dom', () => ({ useNavigate: () => vi.fn() })) vi.mock('@/hooks/useMobile', () => ({ useMobile: mocks.useMobile })) vi.mock('@/hooks/useCommands', () => ({ useCommands: mocks.useCommands })) vi.mock('@/hooks/useFileSearch', () => ({ useFileSearch: mocks.useFileSearch })) @@ -112,10 +110,7 @@ describe('PromptInput agent mention submission', () => { isSessionActive: false, isStreamingResponse: false, onScrollToBottom: vi.fn(), - onShowSessionsDialog: vi.fn(), - onShowHelpDialog: vi.fn(), - onToggleDetails: vi.fn(), - onExportSession: vi.fn(), + commandActions: createCommandActionsMock(), onPromptChange: vi.fn(), } @@ -142,7 +137,6 @@ describe('PromptInput agent mention submission', () => { mocks.switchSessionModel.mockResolvedValue(undefined) mocks.switchSessionAgent.mockResolvedValue(undefined) mocks.runCommand.mockResolvedValue(undefined) - mocks.compactSession.mockResolvedValue(undefined) mocks.agents = [{ name: 'reviewer', description: 'Reviewer' }] mocks.useMobile.mockReturnValue(false) mocks.useSTT.mockReturnValue({ diff --git a/frontend/src/components/message/PromptInput.stt.test.tsx b/frontend/src/components/message/PromptInput.stt.test.tsx index 833555c6..52772e9e 100644 --- a/frontend/src/components/message/PromptInput.stt.test.tsx +++ b/frontend/src/components/message/PromptInput.stt.test.tsx @@ -3,6 +3,7 @@ import { render, screen, fireEvent, act, waitFor } from '@testing-library/react' import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import { PromptInput } from './PromptInput' import { useUIState } from '@/stores/uiStateStore' +import { createCommandActionsMock } from '@/test/test-utils' const createTestQueryClient = () => new QueryClient({ defaultOptions: { @@ -141,11 +142,7 @@ describe('PromptInput STT Gesture Tests', () => { isSessionActive: false, isStreamingResponse: false, onScrollToBottom: vi.fn(), - onShowSessionsDialog: vi.fn(), - onShowModelsDialog: vi.fn(), - onShowHelpDialog: vi.fn(), - onToggleDetails: vi.fn(), - onExportSession: vi.fn(), + commandActions: createCommandActionsMock(), onPromptChange: vi.fn(), } diff --git a/frontend/src/components/message/PromptInput.tsx b/frontend/src/components/message/PromptInput.tsx index 8c649bcf..1e0d1d97 100644 --- a/frontend/src/components/message/PromptInput.tsx +++ b/frontend/src/components/message/PromptInput.tsx @@ -27,6 +27,7 @@ import { ModelQuickSelect } from '@/components/model/ModelQuickSelect' import { AgentQuickSelect } from '@/components/agent/AgentQuickSelect' import { VoiceStatusOverlay, type VoiceStatusOverlayState } from './VoiceStatusOverlay' import { detectMentionTrigger, parsePromptToInput, getFilename, filterAgentsByQuery } from '@/lib/promptParser' +import { getNextPrimaryAgentId } from '@/lib/primaryAgents' import { randomId } from '@/lib/utils' import { showToast } from '@/lib/toast' import { formatModelName } from '@/api/providers' @@ -35,6 +36,7 @@ import { useProviders } from '@/hooks/useProviders' import type { CommandInfo, ModelRef } from '@opencode-manager/shared/opencode' import type { FileAttachmentInfo, ImageAttachment } from '@/api/types' +import { isBuiltinCommand, type CommandActions, type PageCommandActions } from '@/lib/builtinCommands' const ACCEPTED_IMAGE_TYPES = ["image/png", "image/jpeg", "image/gif", "image/webp", "image/heic", "image/heif"] @@ -58,6 +60,7 @@ export interface PromptInputHandle { setPromptValue: (value: string) => void clearPrompt: () => void triggerFileUpload: () => void + openModelPicker: () => void } interface PromptInputProps { @@ -67,12 +70,7 @@ interface PromptInputProps { isSessionActive?: boolean isStreamingResponse?: boolean onScrollToBottom: () => void - onShowSessionsDialog?: () => void - onShowHelpDialog?: () => void - onToggleDetails?: () => boolean - onExportSession?: () => void - onUndo?: () => void | Promise - onRedo?: () => void | Promise + commandActions: PageCommandActions onPromptChange?: (hasContent: boolean) => void } @@ -83,12 +81,7 @@ export const PromptInput = memo(forwardRef( isSessionActive = false, isStreamingResponse = false, onScrollToBottom, - onShowSessionsDialog, - onShowHelpDialog, - onToggleDetails, - onExportSession, - onUndo, - onRedo, + commandActions, onPromptChange }, ref) { const [prompt, setPrompt] = useState('') @@ -98,6 +91,7 @@ export const PromptInput = memo(forwardRef( const [attachedFiles, setAttachedFiles] = useState(new Map()) const [imageAttachments, setImageAttachments] = useState([]) const [isDragging, setIsDragging] = useState(false) + const [isModelPickerOpen, setIsModelPickerOpen] = useState(false) const [showMentionSuggestions, setShowMentionSuggestions] = useState(false) const [mentionQuery, setMentionQuery] = useState('') const [mentionRange, setMentionRange] = useState<{ start: number, end: number } | null>(null) @@ -156,7 +150,7 @@ export const PromptInput = memo(forwardRef( imageAttachmentsRef.current = imageAttachments }, [attachedFiles, imageAttachments, prompt]) - const clearSubmittedPrompt = useCallback((submittedPrompt: string, submittedAttachedFiles: Map, submittedImageAttachments: ImageAttachment[]) => { + const clearSubmittedPrompt = useCallback((submittedPrompt: string, submittedAttachedFiles: Map, submittedImageAttachments: ImageAttachment[], options?: { keepAttachments?: boolean }) => { if ( promptRef.current !== submittedPrompt || attachedFilesRef.current !== submittedAttachedFiles || @@ -166,9 +160,11 @@ export const PromptInput = memo(forwardRef( } setPrompt('') - setAttachedFiles(new Map()) - revokeBlobUrls(submittedImageAttachments) - setImageAttachments([]) + if (!options?.keepAttachments) { + setAttachedFiles(new Map()) + revokeBlobUrls(submittedImageAttachments) + setImageAttachments([]) + } clearSTT() }, [clearSTT]) @@ -206,6 +202,9 @@ export const PromptInput = memo(forwardRef( }, triggerFileUpload: () => { fileInputRef.current?.click() + }, + openModelPicker: () => { + setIsModelPickerOpen(true) } }), [imageAttachments, clearSTT, isRecording, abortRecording, resetVoiceGestureState]) const sessionAgent = useSessionAgent(sessionID, directory) @@ -348,9 +347,14 @@ export const PromptInput = memo(forwardRef( agents: parsed.agents, skills: parsed.skills, }).then((shouldClear) => { - if (shouldClear) { - clearSubmittedPrompt(submittedPrompt, submittedAttachedFiles, submittedImageAttachments) + if (!shouldClear) return + const keepAttachments = isBuiltinCommand(command) && (submittedAttachedFiles.size > 0 || submittedImageAttachments.length > 0) + if (keepAttachments) { + clearSubmittedPrompt(submittedPrompt, submittedAttachedFiles, submittedImageAttachments, { keepAttachments: true }) + showToast.info('Built-in commands do not use attachments; they were kept') + return } + clearSubmittedPrompt(submittedPrompt, submittedAttachedFiles, submittedImageAttachments) }) return } @@ -499,15 +503,6 @@ export const PromptInput = memo(forwardRef( setMentionRange(null) } - const handleAgentChange = (agentId: string) => { - setLocalMode(agentId) - setStoredAgent(sessionID, agentId) - const agent = agents.find(a => a.id === agentId) - if (agent?.model) { - setStoredModel({ providerID: agent.model.providerID, modelID: agent.model.id }) - } - } - const startVoiceRecording = async () => { if (isRecording || isProcessing || isTogglingRecording) { return @@ -985,9 +980,7 @@ if (isIOS && isSecureContext && navigator.clipboard && navigator.clipboard.read) clearSTT() } else if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === 't') { e.preventDefault() - if (hasVariants) { - cycleVariant() - } + handleCycleVariant() } } @@ -1089,18 +1082,48 @@ if (isIOS && isSecureContext && navigator.clipboard && navigator.clipboard.read) : undefined, [model, currentVariant], ) + + const handleAgentChange = useCallback((agentId: string) => { + setLocalMode(agentId) + setStoredAgent(sessionID, agentId) + const agent = agents.find(a => a.id === agentId) + if (agent?.model) { + setStoredModel({ providerID: agent.model.providerID, modelID: agent.model.id }) + } + }, [agents, sessionID, setStoredAgent, setStoredModel]) + + const handleCycleVariant = useCallback(() => { + if (!hasVariants) { + showToast.info('The selected model has no variants') + return + } + cycleVariant() + }, [hasVariants, cycleVariant]) + + const handleCycleAgent = useCallback(() => { + const next = getNextPrimaryAgentId(agents, currentMode) + if (!next) { + showToast.info('No primary agents available') + return + } + handleAgentChange(next) + }, [agents, currentMode, handleAgentChange]) + + const commandActionsWithPrompt = useMemo( + () => ({ + ...commandActions, + cycleAgent: handleCycleAgent, + cycleVariant: handleCycleVariant, + }), + [commandActions, handleCycleAgent, handleCycleVariant], + ) + const { executeCommand } = useCommandHandler({ sessionID, directory, model: modelRef, currentAgent: currentMode, - onShowSessionsDialog, - onShowModelsDialog: undefined, - onShowHelpDialog, - onToggleDetails, - onExportSession, - onUndo, - onRedo + actions: commandActionsWithPrompt, }) const showStopButton = isSessionActive const hideSecondaryButtons = isMobile && isSessionActive @@ -1298,6 +1321,11 @@ return (
)} + ) : ( <> @@ -1307,26 +1335,27 @@ return ( onAgentChange={handleAgentChange} isBashMode={isBashMode} /> - {isSessionActive ? ( -
- -
- ) : ( - !hideSecondaryButtons && ( - - - - ) + {isSessionActive && ( +
+ +
)} + + {!isSessionActive && !hideSecondaryButtons && ( + + )} + )}
diff --git a/frontend/src/components/model/ModelQuickSelect.test.tsx b/frontend/src/components/model/ModelQuickSelect.test.tsx index e5c333ae..af13ae3d 100644 --- a/frontend/src/components/model/ModelQuickSelect.test.tsx +++ b/frontend/src/components/model/ModelQuickSelect.test.tsx @@ -87,3 +87,38 @@ describe('ModelQuickSelect theme tokens', () => { expect(findDarkOnlyClassOffenders(dialog)).toEqual([]) }) }) + +describe('ModelQuickSelect controlled open', () => { + it('uses the controlled open prop as the source of truth', () => { + const onOpenChange = vi.fn() + const { rerender } = render() + + expect(screen.queryByRole('dialog', { name: 'Select model' })).not.toBeInTheDocument() + + rerender() + + expect(screen.getByRole('dialog', { name: 'Select model' })).toBeInTheDocument() + }) + + it('renders only the sheet without a trigger when no children are provided', () => { + render() + + expect(screen.getByRole('dialog', { name: 'Select model' })).toBeInTheDocument() + expect(document.querySelector('[data-model-select-trigger]')).toBeNull() + }) + + it('resets the internal navigation state when the sheet is closed through the component', async () => { + const user = userEvent.setup() + const onOpenChange = vi.fn() + render() + + await user.click(screen.getByRole('button', { name: /More models/ })) + expect(screen.getByPlaceholderText('Search providers...')).toBeInTheDocument() + + await user.keyboard('{Escape}') + + expect(onOpenChange).toHaveBeenCalledWith(false) + expect(screen.getByRole('button', { name: /More models/ })).toBeInTheDocument() + expect(screen.queryByPlaceholderText('Search providers...')).not.toBeInTheDocument() + }) +}) diff --git a/frontend/src/components/model/ModelQuickSelect.tsx b/frontend/src/components/model/ModelQuickSelect.tsx index 423874e7..22abb04c 100644 --- a/frontend/src/components/model/ModelQuickSelect.tsx +++ b/frontend/src/components/model/ModelQuickSelect.tsx @@ -18,7 +18,9 @@ import type { Model, Provider } from '@/api/providers' interface ModelQuickSelectProps { directory?: string disabled?: boolean - children: React.ReactNode + children?: React.ReactNode + open?: boolean + onOpenChange?: (open: boolean) => void } interface ModelListItem { @@ -189,8 +191,11 @@ export function ModelQuickSelect({ directory, disabled, children, + open, + onOpenChange, }: ModelQuickSelectProps) { - const [isOpen, setIsOpen] = useState(false) + const [internalIsOpen, setInternalIsOpen] = useState(false) + const isOpen = open ?? internalIsOpen const [showAllModels, setShowAllModels] = useState(false) const [searchQuery, setSearchQuery] = useState('') const deferredSearchQuery = useDeferredValue(searchQuery) @@ -416,13 +421,16 @@ export function ModelQuickSelect({ setSelectedProviderId(null) } - const handleOpenChange = (open: boolean) => { - setIsOpen(open) - if (!open) { + const handleOpenChange = (nextOpen: boolean) => { + if (open === undefined) { + setInternalIsOpen(nextOpen) + } + if (!nextOpen) { setShowAllModels(false) setSearchQuery('') setSelectedProviderId(null) } + onOpenChange?.(nextOpen) } const handleProviderSelect = (providerID: string) => { @@ -567,9 +575,11 @@ export function ModelQuickSelect({ return ( <> - !disabled && handleOpenChange(true)} data-model-select-trigger> - {children} - + {children && ( + !disabled && handleOpenChange(true)}> + {children} + + )} handleOpenChange(false)} diff --git a/frontend/src/components/schedules/ScheduleJobDialog.tsx b/frontend/src/components/schedules/ScheduleJobDialog.tsx index 0e3d5293..553e0c1d 100644 --- a/frontend/src/components/schedules/ScheduleJobDialog.tsx +++ b/frontend/src/components/schedules/ScheduleJobDialog.tsx @@ -20,6 +20,7 @@ import { type SchedulePreset, } from '@/components/schedules/schedule-utils' import { getRepoDisplayName } from '@/lib/utils' +import { getPrimaryAgents } from '@/lib/primaryAgents' import { ASSISTANT_REPO_ID, ASSISTANT_REPO_NAME } from '@opencode-manager/shared/utils' import { DEFAULT_DESTRUCTIVE_BASH_PATTERNS } from '@opencode-manager/shared/schemas' import { Loader2 } from 'lucide-react' @@ -186,13 +187,11 @@ export function ScheduleJobDialog({ open, onOpenChange, job, isSaving, onSubmit, }, [providerModels, configDefaultModel]) const agentOptions = useMemo(() => { - return agents - .filter((agent) => agent.mode !== 'subagent' && !agent.hidden) - .map((agent) => ({ - value: agent.id, - label: agent.name, - description: agent.description, - })) + return getPrimaryAgents(agents).map((agent) => ({ + value: agent.id, + label: agent.name, + description: agent.description, + })) }, [agents]) const selectedAgentSlug = agentsLoaded && !agentOptions.some((option) => option.value === agentSlug) ? '' : agentSlug diff --git a/frontend/src/components/session/SessionMessagePickerDialog.test.tsx b/frontend/src/components/session/SessionMessagePickerDialog.test.tsx new file mode 100644 index 00000000..f70e93c9 --- /dev/null +++ b/frontend/src/components/session/SessionMessagePickerDialog.test.tsx @@ -0,0 +1,98 @@ +import { describe, it, expect, vi } from 'vitest' +import { render, screen, fireEvent } from '@testing-library/react' +import type { SessionMessageInfo } from '@opencode-manager/shared/opencode' +import { SessionMessagePickerDialog } from './SessionMessagePickerDialog' + +function userMessage(id: string, text: string, created = 1000): SessionMessageInfo { + return { id, type: 'user', text, time: { created } } as SessionMessageInfo +} + +function assistantMessage(id: string, text: string): SessionMessageInfo { + return { id, type: 'assistant', text, time: { created: 1000 } } as unknown as SessionMessageInfo +} + +const renderPicker = ( + props: Partial> = {}, +) => + render( + , + ) + +describe('SessionMessagePickerDialog', () => { + it('lists only user messages, newest first', () => { + renderPicker({ + messages: [ + userMessage('old', 'older prompt', 1000), + assistantMessage('assistant', 'reply'), + userMessage('new', 'newer prompt', 2000), + ], + }) + + const older = screen.getByText('older prompt') + const newer = screen.getByText('newer prompt') + + expect(screen.queryByText('reply')).not.toBeInTheDocument() + expect( + newer.compareDocumentPosition(older) & Node.DOCUMENT_POSITION_FOLLOWING, + ).toBeTruthy() + }) + + it('narrows the rows with the search query', () => { + renderPicker({ + messages: [userMessage('a', 'alpha prompt'), userMessage('b', 'beta prompt')], + }) + + expect(screen.getByText('alpha prompt')).toBeInTheDocument() + expect(screen.getByText('beta prompt')).toBeInTheDocument() + + fireEvent.change(screen.getByPlaceholderText('Search messages'), { + target: { value: 'beta' }, + }) + + expect(screen.queryByText('alpha prompt')).not.toBeInTheDocument() + expect(screen.getByText('beta prompt')).toBeInTheDocument() + }) + + it('calls onSelect with the message id when a row is clicked', () => { + const onSelect = vi.fn() + renderPicker({ messages: [userMessage('msg-1', 'hello')], onSelect }) + + fireEvent.click(screen.getByText('hello')) + + expect(onSelect).toHaveBeenCalledWith('msg-1') + }) + + it('calls onSelect with undefined from the leading row', () => { + const onSelect = vi.fn() + renderPicker({ + messages: [userMessage('msg-1', 'hello')], + leadingOptionLabel: 'Entire conversation', + onSelect, + }) + + fireEvent.click(screen.getByText('Entire conversation')) + + expect(onSelect).toHaveBeenCalledWith(undefined) + }) + + it('shows an empty state when no messages match', () => { + renderPicker({ messages: [assistantMessage('a', 'reply')] }) + + expect(screen.getByText('No messages')).toBeInTheDocument() + }) + + it('shows a loading state instead of the rows while loading', () => { + renderPicker({ messages: [userMessage('msg-1', 'hello')], loading: true }) + + expect(screen.getByText('Loading messages…')).toBeInTheDocument() + expect(screen.queryByText('hello')).not.toBeInTheDocument() + expect(screen.queryByText('No messages')).not.toBeInTheDocument() + }) +}) diff --git a/frontend/src/components/session/SessionMessagePickerDialog.tsx b/frontend/src/components/session/SessionMessagePickerDialog.tsx new file mode 100644 index 00000000..3d16f307 --- /dev/null +++ b/frontend/src/components/session/SessionMessagePickerDialog.tsx @@ -0,0 +1,99 @@ +import { useEffect, useMemo, useState } from 'react' +import type { SessionMessageInfo } from '@opencode-manager/shared/opencode' +import { Dialog, DialogContent, DialogTitle } from '@/components/ui/dialog' +import { Input } from '@/components/ui/input' + +const MESSAGE_PREVIEW_MAX_LENGTH = 200 + +interface SessionMessagePickerDialogProps { + open: boolean + onOpenChange: (open: boolean) => void + title: string + messages: SessionMessageInfo[] + leadingOptionLabel?: string + loading?: boolean + onSelect: (messageID: string | undefined) => void +} + +function messagePreview(text: string): string { + const singleLine = text.replace(/\s+/g, ' ').trim() + return singleLine.length > MESSAGE_PREVIEW_MAX_LENGTH + ? singleLine.slice(0, MESSAGE_PREVIEW_MAX_LENGTH) + : singleLine +} + +export function SessionMessagePickerDialog({ + open, + onOpenChange, + title, + messages, + leadingOptionLabel, + loading = false, + onSelect, +}: SessionMessagePickerDialogProps) { + const [query, setQuery] = useState('') + + useEffect(() => { + if (open) setQuery('') + }, [open]) + + const items = useMemo(() => { + const userMessages = messages.filter( + (message): message is Extract => + message.type === 'user' && message.text.trim().length > 0, + ) + const normalizedQuery = query.trim().toLowerCase() + const filtered = normalizedQuery + ? userMessages.filter((message) => message.text.toLowerCase().includes(normalizedQuery)) + : userMessages + return [...filtered].reverse() + }, [messages, query]) + + return ( + + + {title} + setQuery(event.target.value)} + placeholder="Search messages" + autoFocus + className="mt-4" + /> +
+ {leadingOptionLabel && ( + + )} + {loading ? ( + Loading messages… + ) : ( + <> + {items.map((message) => ( + + ))} + {items.length === 0 && ( + No messages + )} + + )} +
+
+
+ ) +} diff --git a/frontend/src/components/session/SideQuestionDialog.test.tsx b/frontend/src/components/session/SideQuestionDialog.test.tsx new file mode 100644 index 00000000..88313310 --- /dev/null +++ b/frontend/src/components/session/SideQuestionDialog.test.tsx @@ -0,0 +1,181 @@ +import { describe, it, expect, vi, beforeEach } from 'vitest' +import { render, screen, fireEvent, waitFor } from '@testing-library/react' +import { SideQuestionDialog } from './SideQuestionDialog' + +const mocks = vi.hoisted(() => ({ + askSideQuestion: vi.fn(), +})) + +vi.mock('@/api/opencode', async (importOriginal) => ({ + ...(await importOriginal()), + askSideQuestion: mocks.askSideQuestion, +})) + +const renderDialog = (props: Partial> = {}) => + render( + , + ) + +describe('SideQuestionDialog', () => { + beforeEach(() => { + vi.clearAllMocks() + }) + + it('asks a non-empty initial question once on mount and renders the answer', async () => { + mocks.askSideQuestion.mockResolvedValue('**42**') + + renderDialog({ initialQuestion: 'what is the answer?' }) + + await waitFor(() => expect(mocks.askSideQuestion).toHaveBeenCalledTimes(1)) + expect(mocks.askSideQuestion).toHaveBeenCalledWith( + 'ses_1', + 'what is the answer?', + expect.any(AbortSignal), + ) + expect(await screen.findByText('42')).toBeInTheDocument() + }) + + it('asks nothing until the user types and submits when the initial question is empty', async () => { + mocks.askSideQuestion.mockResolvedValue('because') + + renderDialog() + + expect(mocks.askSideQuestion).not.toHaveBeenCalled() + + fireEvent.change(screen.getByPlaceholderText('Ask a side question'), { + target: { value: 'why?' }, + }) + fireEvent.click(screen.getByRole('button', { name: 'Ask' })) + + await waitFor(() => + expect(mocks.askSideQuestion).toHaveBeenCalledWith('ses_1', 'why?', expect.any(AbortSignal)), + ) + expect(await screen.findByText('because')).toBeInTheDocument() + }) + + it('shows Retry on failure and asks again when clicked', async () => { + mocks.askSideQuestion.mockRejectedValueOnce(new Error('nope')) + + renderDialog({ initialQuestion: 'why?' }) + + await screen.findByText('Failed to get an answer') + + mocks.askSideQuestion.mockResolvedValueOnce('retried answer') + fireEvent.click(screen.getByRole('button', { name: 'Retry' })) + + await waitFor(() => expect(mocks.askSideQuestion).toHaveBeenCalledTimes(2)) + expect(mocks.askSideQuestion).toHaveBeenLastCalledWith('ses_1', 'why?', expect.any(AbortSignal)) + expect(await screen.findByText('retried answer')).toBeInTheDocument() + }) + + it('retries the failed question even when the draft was edited to another value', async () => { + mocks.askSideQuestion.mockRejectedValueOnce(new Error('nope')) + + renderDialog({ initialQuestion: 'question A' }) + + await screen.findByText('Failed to get an answer') + + fireEvent.change(screen.getByPlaceholderText('Ask a side question'), { + target: { value: 'question B' }, + }) + fireEvent.click(screen.getByRole('button', { name: 'Retry' })) + + await waitFor(() => expect(mocks.askSideQuestion).toHaveBeenCalledTimes(2)) + expect(mocks.askSideQuestion).toHaveBeenLastCalledWith( + 'ses_1', + 'question A', + expect.any(AbortSignal), + ) + }) + + it('retries the failed question even when the draft was cleared', async () => { + mocks.askSideQuestion.mockRejectedValueOnce(new Error('nope')) + + renderDialog({ initialQuestion: 'question A' }) + + await screen.findByText('Failed to get an answer') + + fireEvent.change(screen.getByPlaceholderText('Ask a side question'), { + target: { value: '' }, + }) + fireEvent.click(screen.getByRole('button', { name: 'Retry' })) + + await waitFor(() => expect(mocks.askSideQuestion).toHaveBeenCalledTimes(2)) + expect(mocks.askSideQuestion).toHaveBeenLastCalledWith( + 'ses_1', + 'question A', + expect.any(AbortSignal), + ) + }) + + it('cancels the pending request when a replacement question is submitted', async () => { + let resolveA: (value: string) => void = () => {} + let resolveB: (value: string) => void = () => {} + let signalA: AbortSignal | undefined + let signalB: AbortSignal | undefined + + mocks.askSideQuestion + .mockImplementationOnce((_sessionID: string, _question: string, signal?: AbortSignal) => { + signalA = signal + return new Promise((resolve) => { + resolveA = resolve + }) + }) + .mockImplementationOnce((_sessionID: string, _question: string, signal?: AbortSignal) => { + signalB = signal + return new Promise((resolve) => { + resolveB = resolve + }) + }) + + renderDialog({ initialQuestion: 'question A' }) + + await waitFor(() => expect(signalA).toBeDefined()) + + fireEvent.change(screen.getByPlaceholderText('Ask a side question'), { + target: { value: 'question B' }, + }) + fireEvent.click(screen.getByRole('button', { name: 'Ask' })) + + await waitFor(() => expect(mocks.askSideQuestion).toHaveBeenCalledTimes(2)) + expect(mocks.askSideQuestion).toHaveBeenLastCalledWith( + 'ses_1', + 'question B', + expect.any(AbortSignal), + ) + expect(signalB).toBeDefined() + expect(signalA?.aborted).toBe(true) + + resolveB('answer B') + expect(await screen.findByText('answer B')).toBeInTheDocument() + + resolveA('answer A') + await waitFor(() => expect(screen.queryByText('answer A')).not.toBeInTheDocument()) + expect(screen.getByText('answer B')).toBeInTheDocument() + }) + + it('aborts the in-flight request when unmounted', async () => { + let capturedSignal: AbortSignal | undefined + mocks.askSideQuestion.mockImplementation( + (_sessionID: string, _question: string, signal?: AbortSignal) => { + capturedSignal = signal + return new Promise(() => {}) + }, + ) + + const { unmount } = renderDialog({ initialQuestion: 'why?' }) + + await waitFor(() => expect(capturedSignal).toBeDefined()) + expect(capturedSignal?.aborted).toBe(false) + + unmount() + + expect(capturedSignal?.aborted).toBe(true) + }) +}) diff --git a/frontend/src/components/session/SideQuestionDialog.tsx b/frontend/src/components/session/SideQuestionDialog.tsx new file mode 100644 index 00000000..ffaa5c62 --- /dev/null +++ b/frontend/src/components/session/SideQuestionDialog.tsx @@ -0,0 +1,115 @@ +import { useCallback, useEffect, useRef, useState } from 'react' +import { Loader2 } from 'lucide-react' +import { Dialog, DialogContent, DialogTitle } from '@/components/ui/dialog' +import { Button } from '@/components/ui/button' +import { Input } from '@/components/ui/input' +import { CopyButton } from '@/components/ui/copy-button' +import { TextPart } from '@/components/message/TextPart' +import { askSideQuestion } from '@/api/opencode' + +interface SideQuestionDialogProps { + open: boolean + onOpenChange: (open: boolean) => void + sessionID: string + initialQuestion?: string +} + +export function SideQuestionDialog({ + open, + onOpenChange, + sessionID, + initialQuestion = '', +}: SideQuestionDialogProps) { + const [question, setQuestion] = useState(initialQuestion) + const [answer, setAnswer] = useState('') + const [error, setError] = useState(false) + const [pending, setPending] = useState(false) + const controllerRef = useRef(null) + const requestRef = useRef(0) + const lastQuestionRef = useRef('') + + const ask = useCallback(async (value: string) => { + const trimmed = value.trim() + if (!trimmed) return + lastQuestionRef.current = trimmed + + controllerRef.current?.abort() + const controller = new AbortController() + controllerRef.current = controller + const requestId = ++requestRef.current + + setPending(true) + setError(false) + setAnswer('') + + try { + const result = await askSideQuestion(sessionID, trimmed, controller.signal) + if (requestRef.current !== requestId || controller.signal.aborted) return + setAnswer(result) + setPending(false) + } catch { + if (requestRef.current !== requestId || controller.signal.aborted) return + setError(true) + setPending(false) + } + }, [sessionID]) + + useEffect(() => { + if (initialQuestion.trim()) { + void ask(initialQuestion) + } + return () => { + controllerRef.current?.abort() + } + }, [ask, initialQuestion]) + + const handleSubmit = (event: React.FormEvent) => { + event.preventDefault() + void ask(question) + } + + const handleRetry = () => { + void ask(lastQuestionRef.current) + } + + return ( + + + Side question +
+ setQuestion(event.target.value)} + placeholder="Ask a side question" + autoFocus + /> + +
+ {pending && ( +
+ + Thinking... +
+ )} + {error && !pending && ( +
+ Failed to get an answer + +
+ )} + {answer && !pending && ( +
+
+ +
+ +
+ )} +
+
+ ) +} diff --git a/frontend/src/components/settings/ManagerTokenSettings.tsx b/frontend/src/components/settings/ManagerTokenSettings.tsx index af0ee6d1..d4867cda 100644 --- a/frontend/src/components/settings/ManagerTokenSettings.tsx +++ b/frontend/src/components/settings/ManagerTokenSettings.tsx @@ -1,9 +1,10 @@ import { useState } from 'react' import { useManagerToken } from '@/hooks/useManagerToken' -import { Button } from '@/components/ui/button' +import { Button, buttonVariants } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Alert, AlertDescription } from '@/components/ui/alert' -import { AlertTriangle, Check, Copy, Eye, EyeOff, RefreshCw } from 'lucide-react' +import { AlertTriangle, Eye, EyeOff, RefreshCw } from 'lucide-react' +import { CopyButton } from '@/components/ui/copy-button' import { SettingsDisclosure } from './SettingsDisclosure' interface ManagerTokenSettingsProps { @@ -14,23 +15,11 @@ interface ManagerTokenSettingsProps { export function ManagerTokenSettings({ isOpen: controlledOpen, onToggle }: ManagerTokenSettingsProps = {}) { const { token, isLoading, rotate } = useManagerToken() const [showToken, setShowToken] = useState(false) - const [copied, setCopied] = useState(false) const [confirmRotate, setConfirmRotate] = useState(false) const [uncontrolledOpen, setUncontrolledOpen] = useState(true) const isOpen = controlledOpen ?? uncontrolledOpen const handleToggle = onToggle ?? (() => setUncontrolledOpen((open) => !open)) - const handleCopy = async () => { - if (!token) return - try { - await navigator.clipboard.writeText(token) - setCopied(true) - setTimeout(() => setCopied(false), 2000) - } catch { - // clipboard may be unavailable; user can copy manually from the input - } - } - const handleRotate = () => { if (!confirmRotate) { setConfirmRotate(true) @@ -73,15 +62,11 @@ export function ManagerTokenSettings({ isOpen: controlledOpen, onToggle }: Manag {showToken ? : }
- +