summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAiden Cline <[email protected]>2025-11-20 15:46:49 -0600
committerAiden Cline <[email protected]>2025-11-20 15:46:49 -0600
commit8ab206b443f7d2e99d404d1145c74faaf1c76b1d (patch)
treeabafbf5c7d7aa215697efe832ae84f9c30e2699d
parentec5c96e10dca7d98fc275dd6e29a9a65464900b1 (diff)
downloadopencode-8ab206b443f7d2e99d404d1145c74faaf1c76b1d.tar.gz
opencode-8ab206b443f7d2e99d404d1145c74faaf1c76b1d.zip
tweak: navigate to child session if it is asking for permissions
-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()