refactor(packages/coding-agent): simplified terminal transcript rendering

- Removed terminal risk mode toggles from config, terminal state collection, and render controllers.
- Dropped snapshot freezing, thaw tracking, and finalized-block replay in transcript rendering.
- Removed clear-on-shrink settings and initialization hooks from selector and interactive mode flows.
- Simplified render scheduling by using requestRender() without mutation flags or stream checkpoints.
This commit is contained in:
can1357
2026-06-09 20:45:01 +02:00
parent aee1e1824e
commit 153c3d6565
13 changed files with 527 additions and 839 deletions
@@ -1,19 +1,6 @@
import { describe, expect, it } from "bun:test";
import { TranscriptContainer } from "@oh-my-pi/pi-coding-agent/modes/components/transcript-container";
import { type Component, TERMINAL } from "@oh-my-pi/pi-tui";
type MutableTerminalInfo = { eagerEraseScrollbackRisk: boolean };
const mutableTerminalInfo = TERMINAL as unknown as MutableTerminalInfo;
async function withTerminalRisk<T>(risk: boolean, run: () => T | Promise<T>): Promise<T> {
const saved = TERMINAL.eagerEraseScrollbackRisk;
mutableTerminalInfo.eagerEraseScrollbackRisk = risk;
try {
return await run();
} finally {
mutableTerminalInfo.eagerEraseScrollbackRisk = saved;
}
}
import type { Component } from "@oh-my-pi/pi-tui";
class MutableLiveBlock implements Component {
#lines: string[];
@@ -32,21 +19,19 @@ class MutableLiveBlock implements Component {
}
describe("transcript streaming commit (assistant text)", () => {
it("treats in-place growth of the trailing line as append-only", async () => {
await withTerminalRisk(true, () => {
const chat = new TranscriptContainer();
// Models a streaming assistant reply: stable head rows plus a current
// line that grows token-by-token without adding a new row.
const block = new MutableLiveBlock(["para one", "para two", "the quick brown"]);
chat.addChild(block);
it("treats in-place growth of the trailing line as append-only", () => {
const chat = new TranscriptContainer();
// Models a streaming assistant reply: stable head rows plus a current
// line that grows token-by-token without adding a new row.
const block = new MutableLiveBlock(["para one", "para two", "the quick brown"]);
chat.addChild(block);
chat.render(80);
chat.render(80);
block.setLines(["para one", "para two", "the quick brown fox"]);
chat.render(80);
// The head rows never changed; only the trailing line grew. Its scrolled-
// off head must be committable to native scrollback (tmux pane history).
expect(chat.getNativeScrollbackCommitSafeEnd()).toBe(3);
});
block.setLines(["para one", "para two", "the quick brown fox"]);
chat.render(80);
// The head rows never changed; only the trailing line grew. Its scrolled-
// off head must be committable to native scrollback (tmux pane history).
expect(chat.getNativeScrollbackCommitSafeEnd()).toBe(3);
});
});