Просмотр исходного кода

feat(tui): go to parent keybind for subagents (#5762)

Rohan Godha 3 месяцев назад
Родитель
Сommit
25f1643e8e

+ 3 - 0
packages/opencode/src/cli/cmd/tui/routes/session/header.tsx

@@ -81,6 +81,9 @@ export function Header() {
               <text fg={theme.text}>
                 <b>Subagent session</b>
               </text>
+              <text fg={theme.text}>
+                Parent <span style={{ fg: theme.textMuted }}>{keybind.print("session_parent")}</span>
+              </text>
               <text fg={theme.text}>
                 Prev <span style={{ fg: theme.textMuted }}>{keybind.print("session_child_cycle_reverse")}</span>
               </text>

+ 17 - 0
packages/opencode/src/cli/cmd/tui/routes/session/index.tsx

@@ -870,6 +870,23 @@ export function Session() {
         dialog.clear()
       },
     },
+    {
+      title: "Go to parent session",
+      value: "session.parent",
+      keybind: "session_parent",
+      category: "Session",
+      disabled: true,
+      onSelect: (dialog) => {
+        const parentID = session()?.parentID
+        if (parentID) {
+          navigate({
+            type: "session",
+            sessionID: parentID,
+          })
+        }
+        dialog.clear()
+      },
+    },
   ])
 
   const revertInfo = createMemo(() => session()?.revert)

+ 1 - 0
packages/opencode/src/config/config.ts

@@ -562,6 +562,7 @@ export namespace Config {
       history_next: z.string().optional().default("down").describe("Next history item"),
       session_child_cycle: z.string().optional().default("<leader>right").describe("Next child session"),
       session_child_cycle_reverse: z.string().optional().default("<leader>left").describe("Previous child session"),
+      session_parent: z.string().optional().default("<leader>up").describe("Go to parent session"),
       terminal_suspend: z.string().optional().default("ctrl+z").describe("Suspend terminal"),
       terminal_title_toggle: z.string().optional().default("none").describe("Toggle terminal title"),
     })

+ 4 - 0
packages/sdk/js/src/v2/gen/types.gen.ts

@@ -1122,6 +1122,10 @@ export type KeybindsConfig = {
    * Previous child session
    */
   session_child_cycle_reverse?: string
+  /**
+   * Go to parent session
+   */
+  session_parent?: string
   /**
    * Suspend terminal
    */

+ 5 - 0
packages/sdk/openapi.json

@@ -7598,6 +7598,11 @@
             "default": "<leader>left",
             "type": "string"
           },
+          "session_parent": {
+            "description": "Go to parent session",
+            "default": "<leader>up",
+            "type": "string"
+          },
           "terminal_suspend": {
             "description": "Suspend terminal",
             "default": "ctrl+z",