Skip to content

Commit 2658ec0

Browse files
ricky9408Tarquinen
andauthored
fix(tui): enable transcript jumps in subagent sessions (#60817)
Co-authored-by: DS <78942835+Tarquinen@users.noreply.github.com>
1 parent 97178e5 commit 2658ec0

2 files changed

Lines changed: 45 additions & 0 deletions

File tree

‎packages/tui/src/routes/session/index.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,6 +1450,7 @@ export function Session(props: {
14501450
}))
14511451

14521452
Keymap.createLayer(() => ({
1453+
mode: "composer",
14531454
enabled: () => renderer.currentFocusedEditor === null,
14541455
bindings: baseAndUnfocusedCommands.map((command) => command.id),
14551456
}))
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { expect, test } from "bun:test"
2+
import { createAppFixture } from "./fixture/app"
3+
import { directory, json } from "./fixture/tui-client"
4+
5+
test("Home and End navigate a subagent transcript", async () => {
6+
const session = {
7+
id: "ses_subagent_navigation",
8+
parentID: "ses_parent",
9+
title: "Subagent",
10+
agent: "build",
11+
projectID: "proj_test",
12+
location: { directory },
13+
cost: 0,
14+
tokens: { input: 0, output: 0, reasoning: 0, cache: { read: 0, write: 0 } },
15+
time: { created: 0, updated: 0 },
16+
}
17+
const messages = Array.from({ length: 20 }, (_, index) => ({
18+
id: `message-${index}`,
19+
type: "user",
20+
text: `Message ${index}`,
21+
time: { created: index },
22+
}))
23+
await using setup = await createAppFixture({
24+
width: 100,
25+
height: 30,
26+
config: { animations: false, tabs: { mode: "off" } },
27+
args: { sessionID: session.id },
28+
fetch: (url) => {
29+
if (url.pathname === "/api/session") return json({ data: [session], cursor: {} })
30+
if (url.pathname === `/api/session/${session.id}`) return json({ data: session })
31+
if (url.pathname === `/api/session/${session.id}/message`)
32+
return json({ data: messages.toReversed(), cursor: {} })
33+
if (url.pathname === `/api/session/${session.id}/inbox`) return json({ data: [] })
34+
},
35+
})
36+
await setup.ready
37+
expect(
38+
await setup.waitForFrame((frame) => frame.includes("Message 19") && frame.includes("Subagents")),
39+
).not.toContain("Message 0")
40+
setup.mockInput.pressKey("HOME")
41+
expect(await setup.waitForFrame((frame) => frame.includes("Message 0"))).not.toContain("Message 19")
42+
setup.mockInput.pressKey("END")
43+
expect(await setup.waitForFrame((frame) => frame.includes("Message 19"))).not.toContain("Message 0")
44+
})

0 commit comments

Comments
 (0)