fix(coding-agent): prevent full re-renders during write tool streaming

Move line count from header to footer to avoid changing the first line
during streaming, which was triggering full screen re-renders in the
TUI's differential rendering logic.
This commit is contained in:
Mario Zechner 2026-01-02 01:11:06 +01:00
parent 91c52de8be
commit d51770a63d
11 changed files with 208 additions and 8 deletions

View file

@ -152,6 +152,25 @@ export async function runRpcMode(session: AgentSession): Promise<never> {
return "";
},
async editor(title: string, prefill?: string): Promise<string | undefined> {
const id = crypto.randomUUID();
return new Promise((resolve, reject) => {
pendingHookRequests.set(id, {
resolve: (response: RpcHookUIResponse) => {
if ("cancelled" in response && response.cancelled) {
resolve(undefined);
} else if ("value" in response) {
resolve(response.value);
} else {
resolve(undefined);
}
},
reject,
});
output({ type: "hook_ui_request", id, method: "editor", title, prefill } as RpcHookUIRequest);
});
},
get theme() {
return theme;
},

View file

@ -175,6 +175,7 @@ export type RpcHookUIRequest =
| { type: "hook_ui_request"; id: string; method: "select"; title: string; options: string[] }
| { type: "hook_ui_request"; id: string; method: "confirm"; title: string; message: string }
| { type: "hook_ui_request"; id: string; method: "input"; title: string; placeholder?: string }
| { type: "hook_ui_request"; id: string; method: "editor"; title: string; prefill?: string }
| {
type: "hook_ui_request";
id: string;