Fix AGENTS.md support, changelog viewer, and session model storage

- BREAKING: Renamed AGENT.md to AGENTS.md for project context files
- Added automatic changelog viewer on startup for new sessions
- Added settings manager to track last shown changelog version
- BREAKING: Store provider and modelId separately in session files (fixes #4)
- Fixed markdown list rendering when items contain inline code with cyan formatting
- Added dynamic border component for TUI
- Updated changelog with entries for #4 and #5
This commit is contained in:
Mario Zechner 2025-11-13 21:56:58 +01:00
parent c23f1576dc
commit fede1303b1
5 changed files with 45 additions and 30 deletions

View file

@ -527,21 +527,19 @@ export async function main(args: string[]) {
// Load and restore model
const savedModel = sessionManager.loadModel();
if (savedModel) {
// Parse provider/modelId from saved model string (format: "provider/modelId")
// Some providers or model IDs may contain slashes, so split only on the first slash.
// For example, "openrouter/x-ai/grok-4-fast" -> provider: "openrouter", modelId: "x-ai/grok-4-fast".
const [savedProvider, savedModelId] = savedModel.split("/", 1);
if (savedProvider && savedModelId) {
try {
const restoredModel = getModel(savedProvider as any, savedModelId);
agent.setModel(restoredModel);
if (shouldPrintMessages) {
console.log(chalk.dim(`Restored model: ${savedModel}`));
}
} catch (error: any) {
if (shouldPrintMessages) {
console.error(chalk.yellow(`Warning: Could not restore model ${savedModel}: ${error.message}`));
}
try {
const restoredModel = getModel(savedModel.provider as any, savedModel.modelId);
agent.setModel(restoredModel);
if (shouldPrintMessages) {
console.log(chalk.dim(`Restored model: ${savedModel.provider}/${savedModel.modelId}`));
}
} catch (error: any) {
if (shouldPrintMessages) {
console.error(
chalk.yellow(
`Warning: Could not restore model ${savedModel.provider}/${savedModel.modelId}: ${error.message}`,
),
);
}
}
}