Add thinking level persistence and fix UI issues

- Save and restore thinking level when continuing sessions
- Fix thinking level confirmation message spacing and styling
- Fix thinking text wrapping to preserve ANSI formatting across lines
This commit is contained in:
Mario Zechner 2025-11-11 23:18:40 +01:00
parent 159075cad7
commit 7beb354337
4 changed files with 37 additions and 7 deletions

View file

@ -1,4 +1,4 @@
import { Agent, ProviderTransport } from "@mariozechner/pi-agent";
import { Agent, ProviderTransport, type ThinkingLevel } from "@mariozechner/pi-agent";
import { getModel } from "@mariozechner/pi-ai";
import chalk from "chalk";
import { readFileSync } from "fs";
@ -227,6 +227,13 @@ export async function main(args: string[]) {
console.log(chalk.dim(`Loaded ${messages.length} messages from previous session`));
agent.replaceMessages(messages);
}
// Load and restore thinking level
const thinkingLevel = sessionManager.loadThinkingLevel() as ThinkingLevel;
if (thinkingLevel && thinkingLevel !== "off") {
agent.setThinkingLevel(thinkingLevel);
console.log(chalk.dim(`Restored thinking level: ${thinkingLevel}`));
}
}
// Start session