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
10 changes: 9 additions & 1 deletion packages/opencode/src/cli/cmd/tui/component/dialog-agent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}),
)
Expand Down
2 changes: 2 additions & 0 deletions packages/opencode/src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -713,6 +714,7 @@ export namespace Config {
"model",
"variant",
"prompt",
"title",
"description",
"temperature",
"top_p",
Expand Down
1 change: 1 addition & 0 deletions packages/sdk/js/src/v2/gen/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2211,6 +2211,7 @@ export type Command = {

export type Agent = {
name: string
title?: string
description?: string
mode: "subagent" | "primary" | "all"
native?: boolean
Expand Down
Loading