fix(tui): hide synthetic session context rows

This commit is contained in:
Kit Langton 2026-07-01 10:38:11 -04:00
commit 53b213571f
2 changed files with 20 additions and 1 deletions

View file

@ -118,7 +118,6 @@ export function createSessionRows(sessionID: Accessor<string>) {
const subscriptions = [
data.on("session.next.prompted", message),
data.on("session.next.context.updated", message),
data.on("session.next.synthetic", message),
data.on("session.next.shell.started", message),
data.on("session.next.agent.switched", message),
data.on("session.next.model.switched", message),
@ -158,6 +157,7 @@ export function createSessionRows(sessionID: Accessor<string>) {
export function reduceSessionRows(messages: SessionMessage[]) {
return messages.reduce<SessionRow[]>((rows, message) => {
if (message.type === "synthetic") return rows
if (message.type !== "assistant") {
completePrevious(rows)
rows.push({ type: "message", messageID: message.id })

View file

@ -62,6 +62,25 @@ test("keeps non-exploration tools as individual part rows", () => {
])
})
test("skips synthetic context messages", () => {
const messages: SessionMessage[] = [
{ type: "user", id: "user-1", text: "Run background shell", time: { created: 0 } },
assistant("assistant-1", [{ type: "tool", id: "shell-1", name: "shell", state: pending(), time: { created: 1 } }]),
{
type: "synthetic",
id: "synthetic-1",
sessionID: "ses_1",
text: "Shell command completed.\n\nOutput:\nok",
time: { created: 2 },
},
]
expect(reduceSessionRows(messages)).toEqual([
{ type: "message", messageID: "user-1" },
{ type: "part", ref: { messageID: "assistant-1", partID: "shell-1" } },
])
})
test("groups across empty assistant reasoning parts", () => {
const messages: SessionMessage[] = [
assistant("assistant-1", [