





















@@ -18,6 +18,7 @@ import {
1818completeWithPreparedSimpleCompletionModel,
1919prepareSimpleCompletionModelForAgent,
2020} from "../agents/simple-completion-runtime.js";
21+import { normalizeThinkLevel, type ThinkLevel } from "../auto-reply/thinking.js";
2122import { getRuntimeConfig } from "../config/config.js";
2223import { resolveAgentModelPrimaryValue } from "../config/model-input.js";
2324import type { OpenClawConfig } from "../config/types.openclaw.js";
@@ -650,10 +651,27 @@ async function readModelRunImageFiles(files: string[] | undefined): Promise<Mode
650651);
651652}
652653654+function normalizeModelRunThinking(value: unknown): ThinkLevel | undefined {
655+if (value === undefined) {
656+return undefined;
657+}
658+if (typeof value !== "string") {
659+throw new Error("--thinking must be a string.");
660+}
661+const normalized = normalizeThinkLevel(value);
662+if (!normalized) {
663+throw new Error(
664+"Invalid thinking level. Use one of: off, minimal, low, medium, high, adaptive, xhigh, max.",
665+);
666+}
667+return normalized;
668+}
669+653670async function runModelRun(params: {
654671prompt: string;
655672files?: string[];
656673model?: string;
674+thinking?: ThinkLevel;
657675transport: CapabilityTransport;
658676}) {
659677const cfg = getRuntimeConfig();
@@ -715,6 +733,7 @@ async function runModelRun(params: {
715733typeof prepared.model.maxTokens === "number" && Number.isFinite(prepared.model.maxTokens)
716734 ? prepared.model.maxTokens
717735 : undefined,
736+ ...(params.thinking ? { reasoning: params.thinking } : {}),
718737},
719738});
720739const text = collectModelRunText(result.content);
@@ -783,6 +802,7 @@ async function runModelRun(params: {
783802 : undefined,
784803 provider,
785804 model,
805+ ...(params.thinking ? { thinking: params.thinking } : {}),
786806modelRun: true,
787807promptMode: "none",
788808cleanupBundleMcpOnRunEnd: true,
@@ -1651,12 +1671,14 @@ export function registerCapabilityCli(program: Command) {
16511671.requiredOption("--prompt <text>", "Prompt text")
16521672.option("--file <path>", "Image file", collectOption, [])
16531673.option("--model <provider/model>", "Model override")
1674+.option("--thinking <level>", "Thinking level override")
16541675.option("--local", "Force local execution", false)
16551676.option("--gateway", "Force gateway execution", false)
16561677.option("--json", "Output JSON", false)
16571678.action(async (opts) => {
16581679await runCommandWithRuntime(defaultRuntime, async () => {
16591680const prompt = requireModelRunPrompt(opts.prompt);
1681+const thinking = normalizeModelRunThinking(opts.thinking);
16601682const transport = resolveTransport({
16611683local: Boolean(opts.local),
16621684gateway: Boolean(opts.gateway),
@@ -1667,6 +1689,7 @@ export function registerCapabilityCli(program: Command) {
16671689 prompt,
16681690files: opts.file as string[] | undefined,
16691691model: opts.model as string | undefined,
1692+ thinking,
16701693 transport,
16711694});
16721695emitJsonOrText(defaultRuntime, Boolean(opts.json), result, formatEnvelopeForText);
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。