mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-02 08:31:33 +00:00
Preserve existing lower-level high effort while making xhigh/max available before runtime activation. Co-authored-by: Peter Steinberger <steipete@gmail.com>
44 lines
1.3 KiB
TypeScript
44 lines
1.3 KiB
TypeScript
// OpenCode Go policy module exposes thinking controls before runtime registration.
|
|
import type {
|
|
ProviderDefaultThinkingPolicyContext,
|
|
ProviderThinkingProfile,
|
|
} from "openclaw/plugin-sdk/plugin-entry";
|
|
|
|
const OPENCODE_GO_DEEPSEEK_V4_MODEL_IDS = new Set(["deepseek-v4-flash", "deepseek-v4-pro"]);
|
|
const OPENCODE_GO_DEEPSEEK_V4_THINKING_LEVEL_IDS = [
|
|
"off",
|
|
"minimal",
|
|
"low",
|
|
"medium",
|
|
"high",
|
|
"xhigh",
|
|
"max",
|
|
] as const;
|
|
const OPENCODE_GO_DEEPSEEK_V4_THINKING_PROFILE = {
|
|
levels: OPENCODE_GO_DEEPSEEK_V4_THINKING_LEVEL_IDS.map((id) => ({ id })),
|
|
defaultLevel: "high",
|
|
} satisfies ProviderThinkingProfile;
|
|
|
|
export function isOpencodeGoDeepSeekV4ModelId(modelId: unknown): boolean {
|
|
return (
|
|
typeof modelId === "string" &&
|
|
OPENCODE_GO_DEEPSEEK_V4_MODEL_IDS.has(modelId.trim().toLowerCase())
|
|
);
|
|
}
|
|
|
|
export function resolveOpencodeGoThinkingProfile(
|
|
modelId: string,
|
|
): ProviderThinkingProfile | undefined {
|
|
return isOpencodeGoDeepSeekV4ModelId(modelId)
|
|
? OPENCODE_GO_DEEPSEEK_V4_THINKING_PROFILE
|
|
: undefined;
|
|
}
|
|
|
|
export function resolveThinkingProfile(
|
|
context: ProviderDefaultThinkingPolicyContext,
|
|
): ProviderThinkingProfile | undefined {
|
|
return context.provider.trim().toLowerCase() === "opencode-go"
|
|
? resolveOpencodeGoThinkingProfile(context.modelId)
|
|
: undefined;
|
|
}
|