fix(coding-agent,tui): address review regressions

This commit is contained in:
Vu Anh Nguyen
2026-03-26 15:01:28 +07:00
parent 1ca78fa041
commit 60b6e51b25
8 changed files with 289 additions and 96 deletions
@@ -561,20 +561,38 @@ export class CommandController {
this.ctx.showError("Usage: /memory <view|clear|reset|enqueue|rebuild>");
}
async handleClearCommand(): Promise<void> {
if (this.ctx.loadingAnimation) {
this.ctx.loadingAnimation.stop();
this.ctx.loadingAnimation = undefined;
}
this.ctx.statusContainer.clear();
async handleClearCommand(options?: { beforeSwitch?: () => Promise<void> | void }): Promise<boolean> {
if (this.ctx.session.isCompacting) {
this.ctx.session.abortCompaction();
while (this.ctx.session.isCompacting) {
await Bun.sleep(10);
}
}
await this.ctx.session.newSession();
const switchApproved = await this.ctx.session.canStartNewSession();
if (!switchApproved) {
this.ctx.chatContainer.addChild(new Spacer(1));
this.ctx.chatContainer.addChild(new Text(theme.fg("error", "Error: New session cancelled"), 1, 0));
this.ctx.ui.requestRender();
return false;
}
await options?.beforeSwitch?.();
if (this.ctx.loadingAnimation) {
this.ctx.loadingAnimation.stop();
this.ctx.loadingAnimation = undefined;
}
this.ctx.statusContainer.clear();
const success = await this.ctx.session.newSession(undefined, { skipBeforeSwitchCheck: true });
if (!success) {
this.ctx.chatContainer.addChild(new Spacer(1));
this.ctx.chatContainer.addChild(new Text(theme.fg("error", "Error: New session cancelled"), 1, 0));
this.ctx.ui.requestRender();
return false;
}
setSessionTerminalTitle(this.ctx.sessionManager.getSessionName(), this.ctx.sessionManager.getCwd());
this.ctx.statusLine.invalidate();
@@ -595,6 +613,7 @@ export class CommandController {
);
await this.ctx.reloadTodos();
this.ctx.ui.requestRender();
return true;
}
async handleForkCommand(): Promise<void> {