mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-19 10:31:20 +00:00
fall back to first agent if last used agent is not available
This commit is contained in:
@@ -57,7 +57,7 @@ export const { use: useLocal, provider: LocalProvider } = createSimpleContext({
|
||||
return agents()
|
||||
},
|
||||
current() {
|
||||
return agents().find((x) => x.name === agentStore.current)!
|
||||
return agents().find((x) => x.name === agentStore.current) ?? agents()[0]
|
||||
},
|
||||
set(name: string) {
|
||||
if (!agents().some((x) => x.name === name))
|
||||
|
||||
Reference in New Issue
Block a user