refactor(tui): remove unused subagent formatters (#36732)
This commit is contained in:
@@ -2398,10 +2398,6 @@ function Subagent(props: ToolProps) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function formatSubagentToolcalls(count: number) {
|
|
||||||
return `${count} toolcall${count === 1 ? "" : "s"}`
|
|
||||||
}
|
|
||||||
|
|
||||||
export function formatSubagentTitle(agent: string, description: string, background: boolean) {
|
export function formatSubagentTitle(agent: string, description: string, background: boolean) {
|
||||||
return `${agent} Subagent — ${description}${background ? " [background]" : ""}`
|
return `${agent} Subagent — ${description}${background ? " [background]" : ""}`
|
||||||
}
|
}
|
||||||
@@ -2410,11 +2406,6 @@ export function formatSubagentRetry(attempt: number, message: string) {
|
|||||||
return `Retrying (attempt ${attempt}) · ${message}`
|
return `Retrying (attempt ${attempt}) · ${message}`
|
||||||
}
|
}
|
||||||
|
|
||||||
export function formatCompletedSubagentDetail(toolcalls: number, duration: string) {
|
|
||||||
if (toolcalls === 0) return duration
|
|
||||||
return `${formatSubagentToolcalls(toolcalls)} · ${duration}`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ExecuteCall = { tool: string; status: "running" | "completed" | "error"; input?: Record<string, unknown> }
|
type ExecuteCall = { tool: string; status: "running" | "completed" | "error"; input?: Record<string, unknown> }
|
||||||
|
|
||||||
function executeCalls(value: unknown): ExecuteCall[] {
|
function executeCalls(value: unknown): ExecuteCall[] {
|
||||||
|
|||||||
@@ -2,10 +2,8 @@ import { afterEach, describe, expect, test } from "bun:test"
|
|||||||
import { For } from "solid-js"
|
import { For } from "solid-js"
|
||||||
import { testRender, type JSX } from "@opentui/solid"
|
import { testRender, type JSX } from "@opentui/solid"
|
||||||
import {
|
import {
|
||||||
formatCompletedSubagentDetail,
|
|
||||||
formatSubagentRetry,
|
formatSubagentRetry,
|
||||||
formatSubagentTitle,
|
formatSubagentTitle,
|
||||||
formatSubagentToolcalls,
|
|
||||||
InlineToolRow,
|
InlineToolRow,
|
||||||
parseApplyPatchFiles,
|
parseApplyPatchFiles,
|
||||||
parseDiagnostics,
|
parseDiagnostics,
|
||||||
@@ -182,13 +180,6 @@ describe("TUI inline tool wrapping", () => {
|
|||||||
).toEqual([{ message: "valid", range: { start: { line: 2, character: 3 } } }])
|
).toEqual([{ message: "valid", range: { start: { line: 2, character: 3 } } }])
|
||||||
})
|
})
|
||||||
|
|
||||||
test("formats completed subagent toolcall details", () => {
|
|
||||||
expect(formatCompletedSubagentDetail(0, "501ms")).toBe("501ms")
|
|
||||||
expect(formatCompletedSubagentDetail(1, "501ms")).toBe("1 toolcall · 501ms")
|
|
||||||
expect(formatCompletedSubagentDetail(2, "501ms")).toBe("2 toolcalls · 501ms")
|
|
||||||
expect(formatSubagentToolcalls(0)).toBe("0 toolcalls")
|
|
||||||
})
|
|
||||||
|
|
||||||
test("keeps background state attached to the subagent identity", () => {
|
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", false)).toBe("Explore Subagent — Inspect renderer")
|
||||||
expect(formatSubagentTitle("Explore", "Inspect renderer", true)).toBe(
|
expect(formatSubagentTitle("Explore", "Inspect renderer", true)).toBe(
|
||||||
@@ -207,5 +198,4 @@ describe("TUI inline tool wrapping", () => {
|
|||||||
test("snapshots expanded tool errors under the tool text", async () => {
|
test("snapshots expanded tool errors under the tool text", async () => {
|
||||||
expect(await renderFrame(() => <Fixture errorExpanded />, { width: 72, height: 12 })).toMatchSnapshot()
|
expect(await renderFrame(() => <Fixture errorExpanded />, { width: 72, height: 12 })).toMatchSnapshot()
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user