Files
opencode-manager/frontend/src/lib/builtinCommands.ts
T
Chris Scott 0b637cadf4 feat(walkthrough): build the change walkthrough in a spawned agent session
Replace the fixed, stop-based walkthrough with an agent-built one. Every
request (Generate, Update, Regenerate, /walkthrough, the multi-run button
and the agent's open_walkthrough) now spawns a separate walkthrough
session. That session reads the diff through a new walkthrough_changes
action, writes one self-contained HTML file into a Manager-owned
directory, and calls publish_walkthrough; the panel renders the file in a
sandboxed frame shared with the inline artifact card and the file browser
HTML preview.

Publication marks the walkthrough ready while execution is tracked
separately, so Stop, the 15-minute limit, polling, refine gating and
interruption when the target session is deleted follow the agent instead
of the first publish. One diff copy is reused per run. Regenerate
interrupts the previous session and removes its output directory.

Walkthrough sessions are kept and listed, with their completion and error
push notifications muted. The stop pipeline, its wire schemas and the
concurrency limiter it used are removed.
2026-10-16 03:58:31 +00:00

70 lines
3.4 KiB
TypeScript

import type { CommandInfo } from '@opencode-manager/shared/opencode'
export const BUILTIN_COMMAND_ACTIONS = [
'showSessions',
'showModels',
'newSession',
'toggleDetails',
'exportSession',
'copyTranscript',
'compact',
'askSideQuestion',
'renameSession',
'forkSession',
'jumpToMessage',
'undo',
'redo',
'cycleAgent',
'cycleVariant',
'showMcp',
'showSkills',
'showSettings',
'connectProvider',
'showWalkthrough',
] as const
type BuiltinCommandAction = (typeof BUILTIN_COMMAND_ACTIONS)[number]
type CommandActionHandler = (argument: string) => void | Promise<void>
export type CommandActions = Record<BuiltinCommandAction, CommandActionHandler>
export type PageCommandActions = Omit<CommandActions, 'cycleAgent' | 'cycleVariant'>
interface BuiltinCommand extends CommandInfo {
action: BuiltinCommandAction
keepsPrompt?: boolean
}
export const BUILTIN_COMMANDS: readonly BuiltinCommand[] = [
{ name: 'help', description: 'Show the help dialog', action: 'showSettings' },
{ name: 'new', description: 'Start a new session', action: 'newSession' },
{ name: 'clear', description: 'Start a new session (alias for /new)', action: 'newSession' },
{ name: 'sessions', description: 'List and switch between sessions', action: 'showSessions' },
{ name: 'resume', description: 'List and switch between sessions (alias for /sessions)', action: 'showSessions' },
{ name: 'continue', description: 'List and switch between sessions (alias for /sessions)', action: 'showSessions' },
{ name: 'models', description: 'List available models', action: 'showModels' },
{ name: 'model', description: 'Choose a model', action: 'showModels' },
{ name: 'agent', description: 'Switch to the next primary agent', action: 'cycleAgent' },
{ name: 'variants', description: 'Cycle the model reasoning variant', action: 'cycleVariant' },
{ name: 'export', description: 'Export current conversation to Markdown', action: 'exportSession' },
{ name: 'copy', description: 'Copy the session transcript to the clipboard', action: 'copyTranscript' },
{ name: 'compact', description: 'Compact the current session', action: 'compact' },
{ name: 'btw', description: 'Ask a side question without adding it to the conversation', action: 'askSideQuestion' },
{ name: 'rename', description: 'Rename the session, or regenerate its title when no title is given', action: 'renameSession' },
{ name: 'fork', description: 'Fork the session from a chosen message', action: 'forkSession' },
{ name: 'timeline', description: 'Jump to a message in the conversation', action: 'jumpToMessage' },
{ name: 'undo', description: 'Undo last message in the conversation', action: 'undo', keepsPrompt: true },
{ name: 'redo', description: 'Redo a previously undone message', action: 'redo', keepsPrompt: true },
{ name: 'details', description: 'Toggle tool execution details', action: 'toggleDetails' },
{ name: 'mcp', description: 'Manage MCP servers', action: 'showMcp' },
{ name: 'skills', description: 'Load a skill', action: 'showSkills' },
{ name: 'walkthrough', description: 'Build an interactive walkthrough of the session changes', action: 'showWalkthrough' },
{ name: 'settings', description: 'Open settings', action: 'showSettings' },
{ name: 'connect', description: 'Connect a provider', action: 'connectProvider' },
]
export function isBuiltinCommand(command: CommandInfo): command is BuiltinCommand {
return 'action' in command
}