diff --git a/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx b/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx index 9ad85d08f0e..9ada9358506 100644 --- a/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx +++ b/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx @@ -1,5 +1,16 @@ import { BoxRenderable, TextareaRenderable, MouseEvent, PasteEvent, t, dim, fg } from "@opentui/core" -import { createEffect, createMemo, type JSX, onMount, createSignal, onCleanup, Show, Switch, Match } from "solid-js" +import { + createEffect, + createMemo, + type JSX, + onMount, + createSignal, + onCleanup, + Show, + Switch, + Match, + For, +} from "solid-js" import "opentui-spinner/solid" import { useLocal } from "@tui/context/local" import { useTheme } from "@tui/context/theme" @@ -19,7 +30,7 @@ import { useRenderer } from "@opentui/solid" import { Editor } from "@tui/util/editor" import { useExit } from "../../context/exit" import { Clipboard } from "../../util/clipboard" -import type { FilePart } from "@opencode-ai/sdk/v2" +import type { FilePart, KeybindsConfig } from "@opencode-ai/sdk/v2" import { TuiEvent } from "../../event" import { iife } from "@/util/iife" import { Locale } from "@/util/locale" @@ -1063,15 +1074,40 @@ export function Prompt(props: PromptProps) { - - {keybind.print("variant_cycle")} variants - - - {keybind.print("agent_cycle")} agents - - - {keybind.print("command_list")} commands - + {(() => { + const tuiConfig = sync.data.config.tui + const config = tuiConfig?.status_hints + const enabled = config?.enabled !== false + if (!enabled) return null + + // Default hints configuration + const defaultHints = [ + { keybind: "variant_cycle", label: "variants", when: "hasVariants" }, + { keybind: "agent_cycle", label: "agents" }, + { keybind: "command_list", label: "commands" }, + ] + + const hints = config?.items ?? defaultHints + + return ( + + {(hint) => { + // Check conditional display + if (hint.when === "hasVariants") { + const hasVariants = local.model.variant.list().length > 0 + if (!hasVariants) return null + } + + return ( + + {keybind.print(hint.keybind as keyof KeybindsConfig)}{" "} + {hint.label} + + ) + }} + + ) + })()} diff --git a/packages/opencode/src/config/config.ts b/packages/opencode/src/config/config.ts index bf4a6035bd8..681e3104e3a 100644 --- a/packages/opencode/src/config/config.ts +++ b/packages/opencode/src/config/config.ts @@ -765,6 +765,22 @@ export namespace Config { .enum(["auto", "stacked"]) .optional() .describe("Control diff rendering style: 'auto' adapts to terminal width, 'stacked' always shows single column"), + status_hints: z + .object({ + enabled: z.boolean().optional().default(true).describe("Enable status line hints"), + items: z + .array( + z.object({ + keybind: z.string().describe("Keybind identifier (e.g., 'agent_cycle', 'variant_cycle')"), + label: z.string().describe("Display label for the hint"), + when: z.string().optional().describe("Condition to show hint (e.g., 'hasVariants')"), + }), + ) + .optional() + .describe("List of hints to display in status line"), + }) + .optional() + .describe("Configure status line hints shown at the bottom of the TUI"), }) export const Server = z diff --git a/packages/sdk/js/src/v2/gen/types.gen.ts b/packages/sdk/js/src/v2/gen/types.gen.ts index acc29d9b43e..286059ec08f 100644 --- a/packages/sdk/js/src/v2/gen/types.gen.ts +++ b/packages/sdk/js/src/v2/gen/types.gen.ts @@ -1568,6 +1568,32 @@ export type Config = { * Control diff rendering style: 'auto' adapts to terminal width, 'stacked' always shows single column */ diff_style?: "auto" | "stacked" + /** + * Configure status line hints shown at the bottom of the TUI + */ + status_hints?: { + /** + * Enable status line hints + */ + enabled?: boolean + /** + * List of hints to display in status line + */ + items?: Array<{ + /** + * Keybind identifier (e.g., 'agent_cycle', 'variant_cycle') + */ + keybind: string + /** + * Display label for the hint + */ + label: string + /** + * Condition to show hint (e.g., 'hasVariants') + */ + when?: string + }> + } } server?: ServerConfig /** diff --git a/packages/sdk/openapi.json b/packages/sdk/openapi.json index a31f0d67ab2..bb1a9407b58 100644 --- a/packages/sdk/openapi.json +++ b/packages/sdk/openapi.json @@ -9119,6 +9119,39 @@ "description": "Control diff rendering style: 'auto' adapts to terminal width, 'stacked' always shows single column", "type": "string", "enum": ["auto", "stacked"] + }, + "status_hints": { + "description": "Configure status line hints shown at the bottom of the TUI", + "type": "object", + "properties": { + "enabled": { + "description": "Enable status line hints", + "default": true, + "type": "boolean" + }, + "items": { + "description": "List of hints to display in status line", + "type": "array", + "items": { + "type": "object", + "properties": { + "keybind": { + "description": "Keybind identifier (e.g., 'agent_cycle', 'variant_cycle')", + "type": "string" + }, + "label": { + "description": "Display label for the hint", + "type": "string" + }, + "when": { + "description": "Condition to show hint (e.g., 'hasVariants')", + "type": "string" + } + }, + "required": ["keybind", "label"] + } + } + } } } },