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

@ -9,6 +9,7 @@ type CliOptions = {
baseUrl?: string | undefined;
system?: string | undefined;
thinking?: string | undefined;
reasoning?: string | undefined;
cwd?: string | undefined;
session?: string | undefined;
debug?: boolean | undefined;
@ -31,6 +32,7 @@ function printUsage() {
console.log(" --base-url URL Custom base URL for the provider");
console.log(" --system TEXT System prompt (ignored if --profile is set)");
console.log(" --thinking LEVEL Thinking level");
console.log(" --reasoning MODE Reasoning display mode (off, on, stream)");
console.log(" --cwd DIR Working directory for commands");
console.log(" --session ID Session ID for conversation persistence");
console.log(" --debug Enable debug logging");
@ -87,6 +89,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;
@ -171,6 +177,7 @@ async function main() {
baseUrl: opts.baseUrl,
systemPrompt: opts.system,
thinkingLevel: opts.thinking as any,
reasoningMode: (opts.reasoning as any) ?? undefined,
cwd: opts.cwd,
sessionId: opts.session,
debug: opts.debug,