diff --git a/packages/opencode/src/cli/cmd/tui/component/dialog-agent.tsx b/packages/opencode/src/cli/cmd/tui/component/dialog-agent.tsx index 365a22445b4b..1acb3a127588 100644 --- a/packages/opencode/src/cli/cmd/tui/component/dialog-agent.tsx +++ b/packages/opencode/src/cli/cmd/tui/component/dialog-agent.tsx @@ -3,16 +3,24 @@ import { useLocal } from "@tui/context/local" import { DialogSelect } from "@tui/ui/dialog-select" import { useDialog } from "@tui/ui/dialog" +function truncate(str: string | undefined, maxLength: number): string { + if (!str) return "" + if (str.length <= maxLength) return str + return str.slice(0, maxLength - 3) + "..." +} + export function DialogAgent() { const local = useLocal() const dialog = useDialog() const options = createMemo(() => local.agent.list().map((item) => { + // Use title if available, otherwise truncate description for display + const displayTitle = item.title || truncate(item.description, 60) || item.name return { value: item.name, title: item.name, - description: item.native ? "native" : item.description, + description: item.native ? "native" : displayTitle, } }), ) diff --git a/packages/opencode/src/config/config.ts b/packages/opencode/src/config/config.ts index 261731b8b0a4..02d710e5a1a8 100644 --- a/packages/opencode/src/config/config.ts +++ b/packages/opencode/src/config/config.ts @@ -683,6 +683,7 @@ export namespace Config { prompt: z.string().optional(), tools: z.record(z.string(), z.boolean()).optional().describe("@deprecated Use 'permission' field instead"), disable: z.boolean().optional(), + title: z.string().optional().describe("Short title for display in agent lists (recommended: 2-5 words)"), description: z.string().optional().describe("Description of when to use the agent"), mode: z.enum(["subagent", "primary", "all"]).optional(), hidden: z @@ -713,6 +714,7 @@ export namespace Config { "model", "variant", "prompt", + "title", "description", "temperature", "top_p", diff --git a/packages/sdk/js/src/v2/gen/types.gen.ts b/packages/sdk/js/src/v2/gen/types.gen.ts index efb7e202e120..d7e6a41a3718 100644 --- a/packages/sdk/js/src/v2/gen/types.gen.ts +++ b/packages/sdk/js/src/v2/gen/types.gen.ts @@ -2211,6 +2211,7 @@ export type Command = { export type Agent = { name: string + title?: string description?: string mode: "subagent" | "primary" | "all" native?: boolean