feat(agent): implement reasoning mode in engine and CLI

Wire reasoningMode through Agent runner, CLI output, and all CLI
entry points (run, interactive, non-interactive). In stream mode,
thinking content is printed to stderr in real-time. In on mode,
thinking is shown after message completion. Default is stream.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
yushen 2026-02-04 15:50:47 +08:00
parent 0340358a9b
commit 953a29672a
5 changed files with 71 additions and 5 deletions

View file

@ -12,6 +12,7 @@ type CliOptions = {
model?: string | undefined;
system?: string | undefined;
thinking?: string | undefined;
reasoning?: string | undefined;
cwd?: string | undefined;
session?: string | undefined;
help?: boolean | undefined;
@ -35,6 +36,7 @@ function printUsage() {
console.log(` ${yellow("--model")} NAME Model name`);
console.log(` ${yellow("--system")} TEXT System prompt (ignored if --profile is set)`);
console.log(` ${yellow("--thinking")} LEVEL Thinking level`);
console.log(` ${yellow("--reasoning")} MODE Reasoning display mode (off, on, stream)`);
console.log(` ${yellow("--cwd")} DIR Working directory for commands`);
console.log(` ${yellow("--session")} ID Session ID to resume`);
console.log(` ${yellow("--help")}, -h Show this help`);
@ -76,6 +78,10 @@ function parseArgs(argv: string[]) {
opts.thinking = args.shift();
continue;
}
if (arg === "--reasoning") {
opts.reasoning = args.shift();
continue;
}
if (arg === "--cwd") {
opts.cwd = args.shift();
continue;
@ -343,6 +349,7 @@ class InteractiveCLI {
model: this.opts.model,
systemPrompt: this.opts.system,
thinkingLevel: this.opts.thinking as AgentOptions["thinkingLevel"],
reasoningMode: (this.opts.reasoning as AgentOptions["reasoningMode"]) ?? undefined,
cwd: this.opts.cwd,
sessionId,
});