refactor(goals): replace the Manager session-goal API with OpenCode built-in /goal

This commit is contained in:
Chris Scott committed 2026-10-29 12:38:39 -04:00
1 parent c8647c1eec
commit cbe92c92ad
84 files changed
+2099 -6321

No files matched your search

@@ -103,7 +103,7 @@ vi.mock('@/components/session/PermissionModeToggle', () => ({
vi.mock('@/hooks/useSessionGoals', () => ({
useSessionGoal: () => ({ data: undefined }),
useStartSessionGoal: () => ({ mutateAsync: vi.fn(), isPending: false }),
useSessionGoalCommand: () => ({ mutate: vi.fn(), mutateAsync: vi.fn(), isPending: false }),
}))
vi.mock('@/hooks/useSessionPermissionMode', () => ({
@@ -95,7 +95,7 @@ vi.mock('./ComposerToolsMenu', () => ({
vi.mock('./PromptSuggestions', () => ({ PromptSuggestions: () => null }))
vi.mock('@/hooks/useSessionGoals', () => ({
useSessionGoal: () => ({ data: undefined }),
useStartSessionGoal: () => ({ mutateAsync: vi.fn(), isPending: false }),
useSessionGoalCommand: () => ({ mutate: vi.fn(), mutateAsync: vi.fn(), isPending: false }),
}))
vi.mock('@/hooks/useSessionPermissionMode', () => ({ useSessionPermissionMode: () => ({ data: undefined }) }))
@@ -82,7 +82,7 @@ vi.mock('./ComposerToolsMenu', () => ({ ComposerToolsMenu: () => null }))
vi.mock('./PromptSuggestions', () => ({ PromptSuggestions: () => null }))
vi.mock('@/hooks/useSessionGoals', () => ({
useSessionGoal: () => ({ data: undefined }),
useStartSessionGoal: () => ({ mutateAsync: vi.fn(), isPending: false }),
useSessionGoalCommand: () => ({ mutate: vi.fn(), mutateAsync: vi.fn(), isPending: false }),
}))
vi.mock('@/hooks/useSessionPermissionMode', () => ({ useSessionPermissionMode: () => ({ data: undefined }) }))
@@ -9,7 +9,9 @@ const mocks = vi.hoisted(() => ({
sendPrompt: vi.fn(),
sendShell: vi.fn(),
interrupt: vi.fn(),
startGoal: vi.fn(),
runCommand: vi.fn(),
syncSelection: vi.fn(),
getSessionGoal: vi.fn(),
useSessionGoal: vi.fn(),
useSessionPermissionMode: vi.fn(),
agents: [] as Array<{ id: string; name: string; description?: string; mode?: string; hidden?: boolean }>,
@@ -48,27 +50,24 @@ vi.mock('@/hooks/useOpenCode', async (importOriginal) => {
useAgents: () => ({ data: mocks.agents }),
useSkills: () => ({ data: mocks.skills }),
useSession: () => ({ data: undefined }),
useSyncSessionSelection: () => mocks.syncSelection,
}
})
vi.mock('@/hooks/useSessionGoals', async () => {
const { useState } = await import('react')
vi.mock('@/api/opencode', async (importOriginal) => {
const actual = await importOriginal<typeof import('@/api/opencode')>()
return {
...actual,
runCommand: mocks.runCommand,
getSessionGoal: mocks.getSessionGoal,
}
})
vi.mock('@/hooks/useSessionGoals', async (importOriginal) => {
const actual = await importOriginal<typeof import('@/hooks/useSessionGoals')>()
return {
...actual,
useSessionGoal: mocks.useSessionGoal,
useStartSessionGoal: () => {
const [isPending, setIsPending] = useState(false)
return {
mutateAsync: async (variables: unknown) => {
setIsPending(true)
try {
return await mocks.startGoal(variables)
} finally {
setIsPending(false)
}
},
isPending,
}
},
}
})
@@ -142,6 +141,17 @@ const createTestQueryClient = () => new QueryClient({
const GOAL_BUTTON = 'Goal mode: the next message becomes the objective'
const OPEN_GOAL_BUTTON = 'A goal is already active for this session'
const UNSUPPORTED_GOAL_BUTTON = "This server's OpenCode has no goals"
const goalState = {
id: 'goal_1',
objective: 'Ship the feature',
status: 'active',
rounds: 1,
maxRounds: 50,
boot: 'boot_1',
updatedAt: 1,
}
describe('PromptInput goal mode', () => {
const defaultProps = {
@@ -167,9 +177,11 @@ describe('PromptInput goal mode', () => {
vi.clearAllMocks()
useComposerDraftStore.setState({ drafts: {} })
mocks.useVoiceConversation.mockReturnValue(createVoiceConversationControllerMock())
mocks.useSessionGoal.mockReturnValue({ data: null })
mocks.useSessionGoal.mockReturnValue({ data: { supported: true, goal: null } })
mocks.useSessionPermissionMode.mockReturnValue({ data: undefined })
mocks.startGoal.mockResolvedValue({ id: 1 })
mocks.runCommand.mockResolvedValue(undefined)
mocks.syncSelection.mockResolvedValue(undefined)
mocks.getSessionGoal.mockResolvedValue({ supported: true, goal: null })
mocks.sendPrompt.mockResolvedValue({ id: 'inbox_1' })
mocks.sendShell.mockResolvedValue({ id: 'shell_1' })
mocks.agents = []
@@ -190,6 +202,7 @@ describe('PromptInput goal mode', () => {
mocks.useFileSearch.mockReturnValue({ files: [] })
mocks.useModelSelection.mockReturnValue({
model: { providerID: 'anthropic', modelID: 'claude-sonnet-4' },
modelRef: { providerID: 'anthropic', modelID: 'claude-sonnet-4' },
modelString: 'anthropic/claude-sonnet-4',
setModel: vi.fn(),
setActiveAgent: vi.fn(),
@@ -209,7 +222,7 @@ describe('PromptInput goal mode', () => {
Reflect.deleteProperty(window, 'matchMedia')
})
it('starts a goal with the message objective before sending it', async () => {
it('runs the goal command with the message objective instead of sending the prompt', async () => {
stubMatchMedia(true)
renderComponent()
@@ -218,42 +231,19 @@ describe('PromptInput goal mode', () => {
fireEvent.click(screen.getByRole('button', { name: GOAL_BUTTON }))
fireEvent.click(screen.getByTitle('Send'))
await waitFor(() => expect(mocks.startGoal).toHaveBeenCalledWith({
sessionId: 'test-session',
directory: '/test',
objective: 'Ship the feature',
}))
await waitFor(() => expect(mocks.sendPrompt).toHaveBeenCalled())
expect(mocks.startGoal.mock.invocationCallOrder[0]).toBeLessThan(mocks.sendPrompt.mock.invocationCallOrder[0])
})
it('does not send the message when starting the goal is rejected', async () => {
stubMatchMedia(true)
mocks.startGoal.mockRejectedValue(new Error('This session already has an open goal'))
renderComponent()
const input = await screen.findByPlaceholderText('Send a message...')
fireEvent.change(input, { target: { value: 'Ship the feature' } })
fireEvent.click(screen.getByRole('button', { name: GOAL_BUTTON }))
fireEvent.click(screen.getByTitle('Send'))
await waitFor(() => expect(mocks.startGoal).toHaveBeenCalled())
await waitFor(() => expect(mocks.runCommand).toHaveBeenCalledTimes(1))
expect(mocks.runCommand).toHaveBeenCalledWith({
sessionID: 'test-session',
name: 'goal',
text: 'Ship the feature',
files: [],
agents: [],
skills: [],
}, 'local')
expect(mocks.sendPrompt).not.toHaveBeenCalled()
})
it('does not start a goal when the mode was not armed', async () => {
stubMatchMedia(true)
renderComponent()
const input = await screen.findByPlaceholderText('Send a message...')
fireEvent.change(input, { target: { value: 'Just a message' } })
fireEvent.click(screen.getByTitle('Send'))
await waitFor(() => expect(mocks.sendPrompt).toHaveBeenCalled())
expect(mocks.startGoal).not.toHaveBeenCalled()
})
it('starts an armed goal before queueing when the session is busy', async () => {
it('runs the goal command instead of queueing when the session is busy', async () => {
stubMatchMedia(true)
renderComponent({ isStreamingResponse: true })
@@ -262,23 +252,99 @@ describe('PromptInput goal mode', () => {
fireEvent.click(screen.getByRole('button', { name: GOAL_BUTTON }))
fireEvent.click(screen.getByTitle('Queue message'))
await waitFor(() => expect(mocks.startGoal).toHaveBeenCalledWith({
sessionId: 'test-session',
directory: '/test',
objective: 'Ship the feature',
}))
await waitFor(() => expect(mocks.sendPrompt).toHaveBeenCalledWith(
expect.objectContaining({ delivery: 'queue' }),
))
expect(mocks.startGoal.mock.invocationCallOrder[0]).toBeLessThan(mocks.sendPrompt.mock.invocationCallOrder[0])
await waitFor(() => expect(mocks.runCommand).toHaveBeenCalledTimes(1))
expect(mocks.runCommand).toHaveBeenCalledWith({
sessionID: 'test-session',
name: 'goal',
text: 'Ship the feature',
files: [],
agents: [],
skills: [],
}, 'local')
expect(mocks.sendPrompt).not.toHaveBeenCalled()
})
it('does not start the goal again while it is still starting', async () => {
it('does not send the prompt when the goal command is rejected', async () => {
stubMatchMedia(true)
let resolveGoal: (value: unknown) => void = () => {}
mocks.startGoal.mockImplementation(
mocks.runCommand.mockRejectedValue(new Error('goal command failed'))
renderComponent()
const input = await screen.findByPlaceholderText('Send a message...')
fireEvent.change(input, { target: { value: 'Ship the feature' } })
fireEvent.click(screen.getByRole('button', { name: GOAL_BUTTON }))
fireEvent.click(screen.getByTitle('Send'))
await waitFor(() => expect(mocks.runCommand).toHaveBeenCalledTimes(1))
expect(mocks.sendPrompt).not.toHaveBeenCalled()
})
it('passes the selected model and agent to the goal selection sync', async () => {
stubMatchMedia(true)
renderComponent()
const input = await screen.findByPlaceholderText('Send a message...')
fireEvent.change(input, { target: { value: 'Ship the feature' } })
fireEvent.click(screen.getByRole('button', { name: GOAL_BUTTON }))
fireEvent.click(screen.getByTitle('Send'))
await waitFor(() => expect(mocks.syncSelection).toHaveBeenCalledWith({
sessionID: 'test-session',
model: { providerID: 'anthropic', modelID: 'claude-sonnet-4' },
agent: 'build',
}))
expect(mocks.runCommand).toHaveBeenCalled()
})
it('keeps the image draft and warns when an armed goal has no objective', async () => {
stubMatchMedia(true)
const { container } = renderComponent()
const fileInput = container.querySelector('input[type="file"]') as HTMLInputElement
fireEvent.change(fileInput, { target: { files: [new File(['img'], 'pic.png', { type: 'image/png' })] } })
await screen.findByText('pic.png')
fireEvent.click(screen.getByRole('button', { name: GOAL_BUTTON }))
fireEvent.click(screen.getByTitle('Send'))
await waitFor(() => expect(mocks.showToast.error).toHaveBeenCalledWith('Enter an objective for the goal'))
expect(mocks.runCommand).not.toHaveBeenCalled()
expect(mocks.sendPrompt).not.toHaveBeenCalled()
expect(screen.getByText('pic.png')).toBeInTheDocument()
})
it('keeps a whitespace-only draft and warns when an armed goal has no objective', async () => {
stubMatchMedia(true)
renderComponent()
const input = await screen.findByPlaceholderText('Send a message...')
fireEvent.change(input, { target: { value: ' ' } })
fireEvent.click(screen.getByRole('button', { name: GOAL_BUTTON }))
fireEvent.keyDown(input, { key: 'Enter', ctrlKey: true })
await waitFor(() => expect(mocks.showToast.error).toHaveBeenCalledWith('Enter an objective for the goal'))
expect(mocks.runCommand).not.toHaveBeenCalled()
expect(mocks.sendPrompt).not.toHaveBeenCalled()
expect(input).toHaveValue(' ')
})
it('sends the prompt without the goal command when the goal mode was not armed', async () => {
stubMatchMedia(true)
renderComponent()
const input = await screen.findByPlaceholderText('Send a message...')
fireEvent.change(input, { target: { value: 'Just a message' } })
fireEvent.click(screen.getByTitle('Send'))
await waitFor(() => expect(mocks.sendPrompt).toHaveBeenCalled())
expect(mocks.runCommand).not.toHaveBeenCalled()
})
it('does not run the goal command again while it is still pending', async () => {
stubMatchMedia(true)
let resolveCommand: (value: unknown) => void = () => {}
mocks.runCommand.mockImplementation(
() => new Promise((resolve) => {
resolveGoal = resolve
resolveCommand = resolve
}),
)
renderComponent({ isStreamingResponse: true })
@@ -288,19 +354,19 @@ describe('PromptInput goal mode', () => {
fireEvent.click(screen.getByRole('button', { name: GOAL_BUTTON }))
fireEvent.click(screen.getByTitle('Queue message'))
await waitFor(() => expect(mocks.startGoal).toHaveBeenCalledTimes(1))
await waitFor(() => expect(mocks.runCommand).toHaveBeenCalledTimes(1))
fireEvent.click(screen.getByTitle('Queue message'))
expect(mocks.startGoal).toHaveBeenCalledTimes(1)
expect(mocks.runCommand).toHaveBeenCalledTimes(1)
expect(mocks.sendPrompt).not.toHaveBeenCalled()
await act(async () => {
resolveGoal({ id: 1 })
resolveCommand(undefined)
})
})
it('does not start an armed goal for a slash command', async () => {
it('sends an exact slash command without running the goal command', async () => {
stubMatchMedia(true)
mocks.useCommands.mockReturnValue({
searchCommands: () => [],
@@ -315,27 +381,36 @@ describe('PromptInput goal mode', () => {
fireEvent.click(screen.getByTitle('Queue message'))
await waitFor(() => expect(mocks.sendPrompt).toHaveBeenCalled())
expect(mocks.startGoal).not.toHaveBeenCalled()
expect(mocks.runCommand).not.toHaveBeenCalled()
})
it('disables goal mode when the server has no goal support', async () => {
stubMatchMedia(true)
mocks.useSessionGoal.mockReturnValue({ data: { supported: false } })
renderComponent()
const button = await screen.findByRole('button', { name: UNSUPPORTED_GOAL_BUTTON })
expect(button).toBeDisabled()
})
it('disables goal mode while a goal is already active', async () => {
stubMatchMedia(true)
mocks.useSessionGoal.mockReturnValue({ data: { status: 'active' } })
mocks.useSessionGoal.mockReturnValue({ data: { supported: true, goal: goalState } })
renderComponent()
const button = await screen.findByRole('button', { name: OPEN_GOAL_BUTTON })
expect(button).toBeDisabled()
})
it('disables goal mode with a reason for scheduled-run sessions', async () => {
it('keeps goal mode enabled on child sessions', async () => {
stubMatchMedia(true)
mocks.useSessionPermissionMode.mockReturnValue({
data: { sessionId: 'test-session', rootSessionId: 'test-session', mode: 'ask', lockedReason: 'schedule' },
data: { sessionId: 'test-session', rootSessionId: 'test-session', mode: 'ask', lockedReason: 'child' },
})
renderComponent()
const button = await screen.findByRole('button', { name: 'Scheduled runs cannot run goals' })
expect(button).toBeDisabled()
const button = await screen.findByRole('button', { name: GOAL_BUTTON })
expect(button).toBeEnabled()
})
it('keeps permission and goal toggles inline on desktop', async () => {
@@ -358,7 +433,7 @@ describe('PromptInput goal mode', () => {
expect(screen.queryByTestId('permission-mode-toggle')).not.toBeInTheDocument()
})
it('starts a goal armed from the mobile composer options menu', async () => {
it('runs the goal command when armed from the mobile composer options menu', async () => {
stubMatchMedia(true)
mocks.useMobile.mockReturnValue(true)
renderComponent()
@@ -368,32 +443,25 @@ describe('PromptInput goal mode', () => {
fireEvent.click(screen.getByTestId('composer-tools-menu'))
fireEvent.click(screen.getByTitle('Send'))
await waitFor(() => expect(mocks.startGoal).toHaveBeenCalledWith({
sessionId: 'test-session',
directory: '/test',
objective: 'Ship the feature',
}))
await waitFor(() => expect(mocks.runCommand).toHaveBeenCalledTimes(1))
expect(mocks.runCommand).toHaveBeenCalledWith({
sessionID: 'test-session',
name: 'goal',
text: 'Ship the feature',
files: [],
agents: [],
skills: [],
}, 'local')
})
it('passes the goal lock reason to the mobile composer options menu', async () => {
it('passes the open goal state to the mobile composer options menu', async () => {
stubMatchMedia(true)
mocks.useMobile.mockReturnValue(true)
mocks.useSessionGoal.mockReturnValue({ data: { status: 'active' } })
mocks.useSessionGoal.mockReturnValue({ data: { supported: true, goal: goalState } })
renderComponent()
const menu = await screen.findByTestId('composer-tools-menu')
expect(menu).toHaveAttribute('title', OPEN_GOAL_BUTTON)
expect(menu).toBeDisabled()
})
it('disables goal mode with a reason for child sessions', async () => {
stubMatchMedia(true)
mocks.useSessionPermissionMode.mockReturnValue({
data: { sessionId: 'test-session', rootSessionId: 'test-session', mode: 'ask', lockedReason: 'child' },
})
renderComponent()
const button = await screen.findByRole('button', { name: 'Goals can only be started on top-level sessions' })
expect(button).toBeDisabled()
})
})
@@ -89,7 +89,7 @@ vi.mock('@/components/session/PermissionModeToggle', () => ({
vi.mock('@/hooks/useSessionGoals', () => ({
useSessionGoal: () => ({ data: undefined }),
useStartSessionGoal: () => ({ mutateAsync: vi.fn(), isPending: false }),
useSessionGoalCommand: () => ({ mutate: vi.fn(), mutateAsync: vi.fn(), isPending: false }),
}))
vi.mock('@/hooks/useSessionPermissionMode', () => ({
@@ -136,7 +136,7 @@ vi.mock('@/components/session/SessionSandboxMenu', () => ({
vi.mock('@/hooks/useSessionGoals', () => ({
useSessionGoal: () => ({ data: undefined }),
useStartSessionGoal: () => ({ mutateAsync: vi.fn(), isPending: false }),
useSessionGoalCommand: () => ({ mutate: vi.fn(), mutateAsync: vi.fn(), isPending: false }),
}))
vi.mock('@/hooks/useSessionPermissionMode', () => ({
+39 -27
View File
@@ -33,16 +33,14 @@ import { PermissionModeToggle } from '@/components/session/PermissionModeToggle'
import { SessionSandboxMenu } from '@/components/session/SessionSandboxMenu'
import { ComposerModelPill } from './ComposerModelPill'
import { ComposerToolsMenu } from './ComposerToolsMenu'
import { useSessionGoal, useStartSessionGoal } from '@/hooks/useSessionGoals'
import { useSessionPermissionMode } from '@/hooks/useSessionPermissionMode'
import { detectMentionTrigger, parsePromptToInput, getFilename, getDirectory, type MentionItem } from '@/lib/promptParser'
import { useSessionGoal, useSessionGoalCommand } from '@/hooks/useSessionGoals'
import { detectMentionTrigger, parsePromptToInput, getFilename, getDirectory, type MentionItem, type ParsedPromptInput } from '@/lib/promptParser'
import { matchText, rankByMatch, type MatchRange } from '@/lib/fuzzyMatch'
import { getNextPrimaryAgentId } from '@/lib/primaryAgents'
import { getNextFavoriteModel } from '@/lib/favoriteModels'
import { randomId } from '@/lib/utils'
import { showToast } from '@/lib/toast'
import { findModelInfo, isSameModelSelection } from '@opencode-manager/shared/opencode'
import { isOpenSessionGoal } from '@opencode-manager/shared/schemas'
import { findModelInfo, isGoalOpen, isSameModelSelection } from '@opencode-manager/shared/opencode'
import { useProviders } from '@/hooks/useProviders'
@@ -255,11 +253,10 @@ export const PromptInput = memo(forwardRef<PromptInputHandle, PromptInputProps>(
const setStoredAgent = useSessionAgentStore((s) => s.setAgent)
const sendPrompt = useSendPrompt(directory)
const sendShell = useSendShell(directory)
const startGoal = useStartSessionGoal()
const isPromptSubmitPending = sendPrompt.isPending || sendShell.isPending || startGoal.isPending
const goalCommand = useSessionGoalCommand(directory)
const isPromptSubmitPending = sendPrompt.isPending || sendShell.isPending || goalCommand.isPending
const interruptSession = useInterruptSession()
const { data: sessionGoal } = useSessionGoal(sessionID)
const { data: permissionMode } = useSessionPermissionMode(sessionID)
const { data: goalRead } = useSessionGoal(sessionID, directory)
const { searchCommands, findCommand, recentNames } = useCommands({ directory })
const recordCommand = useRecentCommandsStore((state) => state.recordCommand)
const isExactCommandPrompt = (value: string) => {
@@ -371,10 +368,17 @@ export const PromptInput = memo(forwardRef<PromptInputHandle, PromptInputProps>(
const addUserBashCommand = useUserBash((s) => s.addUserBashCommand)
const startArmedGoal = async (objective: string): Promise<boolean> => {
if (!directory || !objective.trim()) return true
const startArmedGoal = async (parsed: ParsedPromptInput): Promise<boolean> => {
try {
await startGoal.mutateAsync({ sessionId: sessionID, directory, objective })
await goalCommand.mutateAsync({
sessionID,
text: parsed.text,
files: parsed.files,
agents: parsed.agents,
skills: parsed.skills,
model: modelRef ?? undefined,
agent: currentMode,
})
} catch {
return false
}
@@ -384,16 +388,23 @@ export const PromptInput = memo(forwardRef<PromptInputHandle, PromptInputProps>(
const handleSubmit = async () => {
if (!isModelReady) return
if (isGoalArmed && prompt.trim().length === 0) {
showToast.error('Enter an objective for the goal')
return
}
if (!prompt.trim() && imageAttachments.length === 0) return
if (startGoal.isPending) return
if (goalCommand.isPending) return
if (isStreamingResponse) {
onScrollToBottom()
const parsed = parsePromptToInput(prompt, attachedFiles, agentNames, skillIds, imageAttachments)
const submitted: ComposerDraft = { prompt, isBashMode, attachedFiles, imageAttachments }
if (isGoalArmed && !isBashMode && !isExactCommandPrompt(prompt)) {
const goalStarted = await startArmedGoal(parsed.text)
const goalStarted = await startArmedGoal(parsed)
if (!goalStarted) return
setStoredAgent(sessionID, currentMode)
completeSubmittedDraft(submitted)
return
}
void runAfterSend(
sendPrompt.mutateAsync({
@@ -465,8 +476,11 @@ export const PromptInput = memo(forwardRef<PromptInputHandle, PromptInputProps>(
const submitted: ComposerDraft = { prompt, isBashMode, attachedFiles, imageAttachments }
if (isGoalArmed) {
const goalStarted = await startArmedGoal(parsed.text)
const goalStarted = await startArmedGoal(parsed)
if (!goalStarted) return
setStoredAgent(sessionID, currentMode)
completeSubmittedDraft(submitted)
return
}
pendingConfirmClearRef.current = {
@@ -1102,18 +1116,16 @@ if (isIOS && isSecureContext && navigator.clipboard && navigator.clipboard.read)
const composerModeStyle = composerMode ? COMPOSER_MODE_STYLES[composerMode] : null
const isTakeoverOpen = isMobile && isSuggestionListOpen
const showStopButton = isSessionActive
const hasOpenGoal = isOpenSessionGoal(sessionGoal)
const lockedReason = permissionMode?.lockedReason ?? null
const goalButtonLabel = lockedReason === 'schedule'
? 'Scheduled runs cannot run goals'
: lockedReason === 'child'
? 'Goals can only be started on top-level sessions'
: hasOpenGoal
? 'A goal is already active for this session'
: isGoalArmed
? 'Goal mode armed: the next message becomes the objective'
: 'Goal mode: the next message becomes the objective'
const isGoalModeDisabled = lockedReason !== null || hasOpenGoal || isBashMode || startGoal.isPending
const goalUnsupported = goalRead?.supported === false
const hasOpenGoal = goalRead?.supported === true && isGoalOpen(goalRead.goal)
const goalButtonLabel = goalUnsupported
? "This server's OpenCode has no goals"
: hasOpenGoal
? 'A goal is already active for this session'
: isGoalArmed
? 'Goal mode armed: the next message becomes the objective'
: 'Goal mode: the next message becomes the objective'
const isGoalModeDisabled = goalUnsupported || hasOpenGoal || isBashMode || goalCommand.isPending
const toggleGoalArmed = () => setIsGoalArmed((value) => !value)
const sendVoiceTurn = useCallback(