summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDax Raad <[email protected]>2026-04-01 11:08:46 -0400
committerDax Raad <[email protected]>2026-04-01 11:09:29 -0400
commitd58004a864ee04a34a30fbbcdde9336d477fc8fa (patch)
tree96f698cddcff29bd14de07d2d97f4db901895712
parent5fd833aa18d2cc71c977925c0646392a7f78ece2 (diff)
downloadopencode-d58004a864ee04a34a30fbbcdde9336d477fc8fa.tar.gz
opencode-d58004a864ee04a34a30fbbcdde9336d477fc8fa.zip
fall back to first agent if last used agent is not available
-rw-r--r--packages/opencode/src/cli/cmd/tui/context/local.tsx2
1 files changed, 1 insertions, 1 deletions
diff --git a/packages/opencode/src/cli/cmd/tui/context/local.tsx b/packages/opencode/src/cli/cmd/tui/context/local.tsx
index e131df358..ec3931b20 100644
--- a/packages/opencode/src/cli/cmd/tui/context/local.tsx
+++ b/packages/opencode/src/cli/cmd/tui/context/local.tsx
@@ -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))