Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions packages/opencode/src/cli/cmd/tui/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { DialogHelp } from "./ui/dialog-help"
import { CommandProvider, useCommandDialog } from "@tui/component/dialog-command"
import { DialogAgent } from "@tui/component/dialog-agent"
import { DialogSessionList } from "@tui/component/dialog-session-list"
import { DialogChildSessionList } from "@tui/component/dialog-child-session-list"
import { KeybindProvider } from "@tui/context/keybind"
import { ThemeProvider, useTheme } from "@tui/context/theme"
import { Home } from "@tui/routes/home"
Expand Down Expand Up @@ -297,6 +298,15 @@ function App() {
dialog.clear()
},
},
{
title: "List subagent sessions",
value: "session.child.list",
keybind: "session_child_list",
category: "Session",
onSelect: () => {
dialog.replace(() => <DialogChildSessionList />)
},
},
{
title: "Switch model",
value: "model.list",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { useDialog } from "@tui/ui/dialog"
import { DialogSelect } from "@tui/ui/dialog-select"
import { useRoute } from "@tui/context/route"
import { useSync } from "@tui/context/sync"
import { createMemo, onMount } from "solid-js"
import { Locale } from "@/util/locale"

export function DialogChildSessionList() {
const dialog = useDialog()
const sync = useSync()
const route = useRoute()

const currentSessionID = createMemo(() => (route.data.type === "session" ? route.data.sessionID : undefined))
const currentSession = createMemo(() => sync.session.get(currentSessionID()!))

const options = createMemo(() => {
const current = currentSession()
if (!current) return []

const parentID = current.parentID ?? current.id

const allSessions = sync.data.session
.filter((x) => x.id === parentID || x.parentID === parentID)
.toSorted((b, a) => a.id.localeCompare(b.id))

return allSessions.map((x) => {
const isParent = x.id === parentID
const label = isParent ? "Main" : "Subagent"

return {
title: `${x.title}`,
value: x.id,
category: label,
footer: Locale.time(x.time.updated),
}
})
})

onMount(() => {
dialog.setSize("large")
})

return (
<DialogSelect
title="Subagent Sessions"
options={options()}
current={currentSessionID()}
onSelect={(option) => {
route.navigate({
type: "session",
sessionID: option.value,
})
dialog.clear()
}}
/>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,11 @@ export function Autocomplete(props: {
description: "list sessions",
onSelect: () => command.trigger("session.list"),
},
{
display: "/subagent-sessions",
description: "list subagent sessions",
onSelect: () => command.trigger("session.child.list"),
},
{
display: "/status",
description: "show status",
Expand Down
11 changes: 10 additions & 1 deletion packages/opencode/src/cli/cmd/tui/routes/session/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1676,7 +1676,16 @@ ToolRegistry.register<typeof TaskTool>({
</Show>
<text fg={theme.text}>
{keybind.print("session_child_cycle")}, {keybind.print("session_child_cycle_reverse")}
<span style={{ fg: theme.textMuted }}> to navigate between subagent sessions</span>
<span style={{ fg: theme.textMuted }}> to navigate subagent sessions</span>
<Show when={keybind.print("session_child_list")}>
{(key) => (
<>
{" "}
{key()}
<span style={{ fg: theme.textMuted }}> to list subagent sessions</span>
</>
)}
</Show>
</text>
</>
)
Expand Down
1 change: 1 addition & 0 deletions packages/opencode/src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,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_child_list: z.string().optional().default("none").describe("List subagent sessions"),
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"),
Expand Down
4 changes: 4 additions & 0 deletions packages/sdk/js/src/gen/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -954,6 +954,10 @@ export type KeybindsConfig = {
* Previous child session
*/
session_child_cycle_reverse?: string
/**
* List subagent sessions
*/
session_child_list?: string
/**
* Suspend terminal
*/
Expand Down
4 changes: 4 additions & 0 deletions packages/sdk/js/src/v2/gen/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1133,6 +1133,10 @@ export type KeybindsConfig = {
* Previous child session
*/
session_child_cycle_reverse?: string
/**
* List subagent sessions
*/
session_child_list?: string
/**
* Go to parent session
*/
Expand Down
5 changes: 5 additions & 0 deletions packages/sdk/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -7664,6 +7664,11 @@
"default": "<leader>left",
"type": "string"
},
"session_child_list": {
"description": "List subagent sessions",
"default": "none",
"type": "string"
},
"session_parent": {
"description": "Go to parent session",
"default": "<leader>up",
Expand Down