summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--packages/opencode/src/cli/cmd/tui/routes/session/index.tsx22
1 files changed, 21 insertions, 1 deletions
diff --git a/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx b/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx
index 7c4f51c54..2bffa360f 100644
--- a/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx
+++ b/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx
@@ -142,9 +142,29 @@ export function Session() {
})
const toast = useToast()
-
const sdk = useSDK()
+ // Auto-navigate to whichever session currently needs permission input
+ createEffect(() => {
+ const currentSession = session()
+ const currentPermissions = permissions()
+ let targetID = currentPermissions.length > 0 ? currentSession.id : undefined
+
+ if (!targetID) {
+ const child = sync.data.session.find(
+ (x) => x.parentID === currentSession.id && (sync.data.permission[x.id]?.length ?? 0) > 0,
+ )
+ if (child) targetID = child.id
+ }
+
+ if (targetID && targetID !== currentSession.id) {
+ navigate({
+ type: "session",
+ sessionID: targetID,
+ })
+ }
+ })
+
let scroll: ScrollBoxRenderable
let prompt: PromptRef
const keybind = useKeybind()