File tree Expand file tree Collapse file tree
packages/opencode/src/cli/cmd/tui/component/prompt Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ import { useToast } from "../../ui/toast"
3737import { useKV } from "../../context/kv"
3838import { useTextareaKeybindings } from "../textarea-keybindings"
3939import { DialogSkill } from "../dialog-skill"
40+ import { useArgs } from "@tui/context/args"
4041
4142export type PromptProps = {
4243 sessionID ?: string
@@ -81,6 +82,7 @@ export function Prompt(props: PromptProps) {
8182
8283 const keybind = useKeybind ( )
8384 const local = useLocal ( )
85+ const args = useArgs ( )
8486 const sdk = useSDK ( )
8587 const route = useRoute ( )
8688 const sync = useSync ( )
@@ -202,7 +204,8 @@ export function Prompt(props: PromptProps) {
202204 // Only set agent if it's a primary agent (not a subagent)
203205 const isPrimaryAgent = local . agent . list ( ) . some ( ( x ) => x . name === msg . agent )
204206 if ( msg . agent && isPrimaryAgent ) {
205- local . agent . set ( msg . agent )
207+ // Keep command line --agent if specified.
208+ if ( ! args . agent ) local . agent . set ( msg . agent )
206209 if ( msg . model ) {
207210 local . model . set ( msg . model )
208211 local . model . variant . set ( msg . model . variant )
You can’t perform that action at this time.
0 commit comments