feat(tui): print resume command on exit

This commit is contained in:
chengyongru
2026-08-20 17:20:36 +08:00
committed by chengyongru
parent 997bdfc79d
commit 415df576b4
8 changed files with 57 additions and 9 deletions
+8
View File
@@ -94,6 +94,7 @@ interface AppOptions {
version: string
access: string
theme: "auto" | ThemeMode
onExit?: (chatId: string) => void
}
interface ChatClient {
@@ -336,6 +337,11 @@ function singleLine(value: string, limit = 120): string {
return value.replace(/\s+/gu, " ").trim().slice(0, limit)
}
export function sessionExitMessage(chatId: string): string {
const sessionId = `websocket:${chatId}`
return `Resume with: nanobot agent --session ${sessionId}\n`
}
async function copyWithSystemClipboard(text: string): Promise<void> {
const commands = process.platform === "darwin"
? [["pbcopy"]]
@@ -2312,6 +2318,8 @@ export class NanobotTui {
this.host.release()
this.client.close()
this.renderer.destroy()
const chatId = this.client.activeChatId || this.options.chatId
if (chatId) this.options.onExit?.(chatId)
}
private handleDestroy = (): void => {