feat: 优化 CLI 通知逻辑,确保进程在通知后能正常退出;增强侧边栏导航项的层级可视化

This commit is contained in:
catlog22
2025-12-21 10:37:29 +08:00
parent 559b1e02a7
commit c3a31f2c5d
3 changed files with 37 additions and 20 deletions

View File

@@ -50,7 +50,10 @@ function notifyDashboard(data: Record<string, unknown>): void {
}
});
// Fire and forget - log errors only in debug mode
// Fire and forget - don't block process exit
req.on('socket', (socket) => {
socket.unref(); // Allow process to exit even if socket is open
});
req.on('error', (err) => {
if (process.env.DEBUG) console.error('[Dashboard] CLI notification failed:', err.message);
});
@@ -505,6 +508,9 @@ async function execAction(positionalPrompt: string | undefined, options: CliExec
duration_ms: result.execution.duration_ms,
turn_count: result.conversation.turn_count
});
// Ensure clean exit after successful execution
process.exit(0);
} else {
console.log(chalk.red(` ✗ Failed (${result.execution.status})`));
console.log(chalk.gray(` ID: ${result.execution.id}`));