Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions packages/opencode/src/cli/cmd/tui/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -389,10 +389,52 @@ function App() {
slash: {
name: "mcps",
},
keybind: "mcp_toggle",
onSelect: () => {
dialog.replace(() => <DialogMcp />)
},
},
...Array.from({ length: 10 }, (_, i) => {
const slot = i + 1
return {
title: `Toggle MCP slot ${slot}`,
value: `mcp.toggle.${slot}`,
category: "Agent",
keybind: `mcp_toggle_${slot}` as keyof typeof sync.data.config.keybinds,
hidden: true,
onSelect: async () => {
const mcpNames = Object.keys(sync.data.mcp).sort()
const mcpName = mcpNames[i]
if (!mcpName) {
toast.show({
variant: "warning",
message: `No MCP configured in slot ${slot}`,
duration: 2000,
})
return
}
try {
await local.mcp.toggle(mcpName)
const status = await sdk.client.mcp.status()
if (status.data) {
sync.set("mcp", status.data)
}
const isEnabled = local.mcp.isEnabled(mcpName)
toast.show({
variant: "info",
message: `${mcpName}: ${isEnabled ? "enabled" : "disabled"}`,
duration: 2000,
})
} catch (error) {
toast.show({
variant: "error",
message: `Failed to toggle ${mcpName}: ${error}`,
duration: 3000,
})
}
},
}
}),
{
title: "Agent cycle",
value: "agent.cycle",
Expand Down Expand Up @@ -511,6 +553,7 @@ function App() {
title: "Toggle console",
category: "System",
value: "app.console",
keybind: "console_toggle",
onSelect: (dialog) => {
renderer.console.toggle()
dialog.clear()
Expand Down
3 changes: 3 additions & 0 deletions packages/opencode/src/cli/cmd/tui/routes/session/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ export function Session() {
name: "timestamps",
aliases: ["toggle-timestamps"],
},
keybind: "timestamps_toggle",
onSelect: (dialog) => {
setTimestamps((prev) => (prev === "show" ? "hide" : "show"))
dialog.clear()
Expand All @@ -533,6 +534,7 @@ export function Session() {
name: "thinking",
aliases: ["toggle-thinking"],
},
keybind: "thinking_toggle",
onSelect: (dialog) => {
setShowThinking((prev) => !prev)
dialog.clear()
Expand All @@ -545,6 +547,7 @@ export function Session() {
slash: {
name: "diffwrap",
},
keybind: "diffwrap_toggle",
onSelect: (dialog) => {
setDiffWrapMode((prev) => (prev === "word" ? "none" : "word"))
dialog.clear()
Expand Down
16 changes: 16 additions & 0 deletions packages/opencode/src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,21 @@ export namespace Config {
sidebar_toggle: z.string().optional().default("<leader>b").describe("Toggle sidebar"),
scrollbar_toggle: z.string().optional().default("none").describe("Toggle session scrollbar"),
username_toggle: z.string().optional().default("none").describe("Toggle username visibility"),
console_toggle: z.string().optional().default("none").describe("Toggle console"),
mcp_toggle: z.string().optional().default("none").describe("Toggle MCP dialog"),
mcp_toggle_1: z.string().optional().default("none").describe("Toggle MCP slot 1"),
mcp_toggle_2: z.string().optional().default("none").describe("Toggle MCP slot 2"),
mcp_toggle_3: z.string().optional().default("none").describe("Toggle MCP slot 3"),
mcp_toggle_4: z.string().optional().default("none").describe("Toggle MCP slot 4"),
mcp_toggle_5: z.string().optional().default("none").describe("Toggle MCP slot 5"),
mcp_toggle_6: z.string().optional().default("none").describe("Toggle MCP slot 6"),
mcp_toggle_7: z.string().optional().default("none").describe("Toggle MCP slot 7"),
mcp_toggle_8: z.string().optional().default("none").describe("Toggle MCP slot 8"),
mcp_toggle_9: z.string().optional().default("none").describe("Toggle MCP slot 9"),
mcp_toggle_10: z.string().optional().default("none").describe("Toggle MCP slot 10"),
timestamps_toggle: z.string().optional().default("none").describe("Toggle timestamps visibility"),
thinking_toggle: z.string().optional().default("none").describe("Toggle thinking visibility"),
diffwrap_toggle: z.string().optional().default("none").describe("Toggle diff wrapping"),
status_view: z.string().optional().default("<leader>s").describe("View status"),
session_export: z.string().optional().default("<leader>x").describe("Export session to editor"),
session_new: z.string().optional().default("<leader>n").describe("Create a new session"),
Expand Down Expand Up @@ -685,6 +700,7 @@ export namespace Config {
messages_previous: z.string().optional().default("none").describe("Navigate to previous message"),
messages_last_user: z.string().optional().default("none").describe("Navigate to last user message"),
messages_copy: z.string().optional().default("<leader>y").describe("Copy message"),
session_copy: z.string().optional().default("none").describe("Copy session transcript"),
messages_undo: z.string().optional().default("<leader>u").describe("Undo message"),
messages_redo: z.string().optional().default("<leader>r").describe("Redo message"),
messages_toggle_conceal: z
Expand Down
24 changes: 24 additions & 0 deletions packages/sdk/js/src/v2/gen/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,26 @@ export type KeybindsConfig = {
* Toggle username visibility
*/
username_toggle?: string
/**
* Toggle console
*/
console_toggle?: string
/**
* Toggle MCP dialog
*/
mcp_toggle?: string
/**
* Toggle timestamps visibility
*/
timestamps_toggle?: string
/**
* Toggle thinking visibility
*/
thinking_toggle?: string
/**
* Toggle diff wrapping
*/
diffwrap_toggle?: string
/**
* View status
*/
Expand Down Expand Up @@ -1085,6 +1105,10 @@ export type KeybindsConfig = {
* Copy message
*/
messages_copy?: string
/**
* Copy session transcript
*/
session_copy?: string
/**
* Undo message
*/
Expand Down