Skip to content

Commit 253ab90

Browse files
committed
fix(agent): honor model:inherit and show subagents in /agents dialog
- Skip parseModel for "inherit" model value so subagents without an explicit model inherit the parent session's model instead of producing a ProviderModelNotFoundError - Expose listAll() from local agent context returning all non-hidden agents regardless of mode - Switch /agents dialog to listAll() with Primary/Subagents grouping so externally-installed subagents (e.g. get-shit-done) are visible - Improve set() toast to distinguish subagents from missing agents Tested with get-shit-done global install (~/.config/opencode/agents/).
1 parent 0afeaea commit 253ab90

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

packages/opencode/src/agent/agent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ export namespace Agent {
217217
options: {},
218218
native: false,
219219
}
220-
if (value.model) item.model = Provider.parseModel(value.model)
220+
if (value.model && value.model !== "inherit") item.model = Provider.parseModel(value.model)
221221
item.variant = value.variant ?? item.variant
222222
item.prompt = value.prompt ?? item.prompt
223223
item.description = value.description ?? item.description

packages/opencode/src/cli/cmd/tui/component/dialog-agent.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ export function DialogAgent() {
88
const dialog = useDialog()
99

1010
const options = createMemo(() =>
11-
local.agent.list().map((item) => {
11+
local.agent.listAll().map((item) => {
1212
return {
1313
value: item.name,
1414
title: item.name,
1515
description: item.native ? "native" : item.description,
16+
category: item.mode === "subagent" ? "Subagents" : "Primary",
1617
}
1718
}),
1819
)

packages/opencode/src/cli/cmd/tui/context/local.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,26 @@ export const { use: useLocal, provider: LocalProvider } = createSimpleContext({
5656
list() {
5757
return agents()
5858
},
59+
listAll() {
60+
return visibleAgents()
61+
},
5962
current() {
6063
return agents().find((x) => x.name === agentStore.current)!
6164
},
6265
set(name: string) {
63-
if (!agents().some((x) => x.name === name))
66+
const target = visibleAgents().find((x) => x.name === name)
67+
if (!target)
6468
return toast.show({
6569
variant: "warning",
6670
message: `Agent not found: ${name}`,
6771
duration: 3000,
6872
})
73+
if (target.mode === "subagent")
74+
return toast.show({
75+
variant: "warning",
76+
message: `${name} is a subagent — invoke it with @${name}`,
77+
duration: 3000,
78+
})
6979
setAgentStore("current", name)
7080
},
7181
move(direction: 1 | -1) {

0 commit comments

Comments
 (0)