feat(tui): style background subagent indicator (#36751)

This commit is contained in:
Kit Langton 2026-07-13 17:57:12 -04:00 committed by GitHub
commit ce2e301e24
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 89 additions and 28 deletions

View file

@ -3,7 +3,6 @@ import { For } from "solid-js"
import { testRender, type JSX } from "@opentui/solid"
import {
formatSubagentRetry,
formatSubagentTitle,
InlineToolRow,
parseApplyPatchFiles,
parseDiagnostics,
@ -99,7 +98,16 @@ function ReminderAlignmentFixture() {
)
}
function TrailingStatusFixture() {
return (
<InlineToolRow icon=":" complete={true} pending="" status={<text flexShrink={0}> Background </text>}>
Explore Subagent Inspect renderer status styling
</InlineToolRow>
)
}
async function renderFrame(component: () => JSX.Element, options: { width: number; height: number }) {
testSetup?.renderer.destroy()
testSetup = await testRender(component, options)
await testSetup.renderOnce()
await testSetup.renderOnce()
@ -142,6 +150,15 @@ describe("TUI inline tool wrapping", () => {
)
})
test("wraps a trailing status as one padded item", async () => {
expect(await renderFrame(() => <TrailingStatusFixture />, { width: 70, height: 2 })).toBe(
" : Explore Subagent — Inspect renderer status styling Background",
)
expect(await renderFrame(() => <TrailingStatusFixture />, { width: 62, height: 2 })).toBe(
" : Explore Subagent — Inspect renderer status styling\n Background",
)
})
test("filters malformed nested tool wire data", () => {
expect(
parseApplyPatchFiles([
@ -180,13 +197,6 @@ describe("TUI inline tool wrapping", () => {
).toEqual([{ message: "valid", range: { start: { line: 2, character: 3 } } }])
})
test("keeps background state attached to the subagent identity", () => {
expect(formatSubagentTitle("Explore", "Inspect renderer", false)).toBe("Explore Subagent — Inspect renderer")
expect(formatSubagentTitle("Explore", "Inspect renderer", true)).toBe(
"Explore Subagent — Inspect renderer [background]",
)
})
test("keeps retry status ahead of wrapping messages", () => {
expect(formatSubagentRetry(2, "Rate limited by provider")).toBe("Retrying (attempt 2) · Rate limited by provider")
})