refactor(tui): organize source by feature boundaries (#5975)

* refactor(tui): group source files by feature

* refactor(tui): split app and gateway responsibilities
This commit is contained in:
chengyongru authored and GitHub committed 2026-09-29 16:57:36 +08:00
1 parent b7abbcd70b
commit f18423800e
73 files changed
+6401 -6006

No files matched your search

+43
View File
@@ -0,0 +1,43 @@
import { afterEach, describe, expect, test } from "bun:test"
import { createTestRenderer, type TestRendererSetup } from "@opentui/core/testing"
import { ContextPanel } from "./context-panel"
import type { SessionContextSnapshot } from "../client"
const context: SessionContextSnapshot = {
totalMessages: 8,
archivedMessages: 0,
replayMessages: 8,
estimatedReplayTokens: 950,
estimatedSummaryTokens: 0,
estimatedSessionTokens: 950,
archivedSummary: null,
archivedSummaryAt: null,
lastUsage: null,
}
describe("ContextPanel", () => {
let setup: TestRendererSetup | undefined
afterEach(() => {
if (setup && !setup.renderer.isDestroyed) setup.renderer.destroy()
setup = undefined
})
test("omits explanatory copy when no compacted summary exists", async () => {
setup = await createTestRenderer({ width: 80, height: 18, screenMode: "alternate-screen" })
const panel = new ContextPanel(setup.renderer, {
text: "#FFFFFF",
border: "#555555",
accent: "#EF8E30",
})
setup.renderer.root.add(panel.root)
panel.show(context)
await setup.renderOnce()
const frame = setup.captureCharFrame()
expect(frame).toContain("~950 tokens · 8 replay · 0 archived")
expect(frame).not.toContain("Agent context")
expect(frame).not.toContain("no compacted summary")
})
})