Description
Slash commands registered by plugins via the command.execute.before hook fail in opencode Desktop with the error:
Failed to send command — request failed
The same commands work correctly in the TUI.
Reproduction
- Install the opencode-pty plugin
- Open opencode Desktop
- Run
/pty-open-background-spy or /pty-show-server-url
- Result: Toast error "Failed to send command — request failed"
- Run the same commands in TUI → works correctly
Analysis
The plugin registers commands via command.execute.before hook in the plugin SDK. In TUI mode, commands are dispatched via direct HTTP to the server, and the hook fires successfully. In Desktop mode, commands go through the Tauri IPC bridge → sidecar process → HTTP, and appear to fail before the server-side hook is ever reached.
Evidence that the hook never fires:
/pty-show-server-url calls client.session.prompt() before throwing — if the hook executed, the URL would appear in chat. It doesn't.
- Both commands fail with the same generic error, suggesting the failure is in the command dispatch layer, not the plugin handler.
The error originates from the catch block in packages/app/src/components/prompt-input/submit.ts (prompt.toast.commandSendFailed.title).
Expected Behavior
Plugin-registered slash commands should work identically in Desktop and TUI modes.
Environment
- opencode Desktop (latest)
- Plugin: opencode-pty
- OS: macOS
Description
Slash commands registered by plugins via the
command.execute.beforehook fail in opencode Desktop with the error:The same commands work correctly in the TUI.
Reproduction
/pty-open-background-spyor/pty-show-server-urlAnalysis
The plugin registers commands via
command.execute.beforehook in the plugin SDK. In TUI mode, commands are dispatched via direct HTTP to the server, and the hook fires successfully. In Desktop mode, commands go through the Tauri IPC bridge → sidecar process → HTTP, and appear to fail before the server-side hook is ever reached.Evidence that the hook never fires:
/pty-show-server-urlcallsclient.session.prompt()before throwing — if the hook executed, the URL would appear in chat. It doesn't.The error originates from the catch block in
packages/app/src/components/prompt-input/submit.ts(prompt.toast.commandSendFailed.title).Expected Behavior
Plugin-registered slash commands should work identically in Desktop and TUI modes.
Environment