30 lines
1001 B
TypeScript
Raw Normal View History

2026-01-14 01:08:15 +00:00
import type { ThinkingLevel } from "@mariozechner/pi-agent-core";
import type { ReasoningLevel, ThinkLevel } from "../../auto-reply/thinking.js";
2026-01-30 03:15:10 +01:00
import type { OpenClawConfig } from "../../config/config.js";
2026-01-14 01:08:15 +00:00
import type { ExecToolDefaults } from "../bash-tools.js";
export function mapThinkingLevel(level?: ThinkLevel): ThinkingLevel {
2026-01-30 03:15:10 +01:00
// pi-agent-core supports "xhigh"; OpenClaw enables it for specific models.
2026-01-14 01:08:15 +00:00
if (!level) return "off";
return level;
}
2026-01-30 03:15:10 +01:00
export function resolveExecToolDefaults(config?: OpenClawConfig): ExecToolDefaults | undefined {
2026-01-14 01:08:15 +00:00
const tools = config?.tools;
2026-01-17 05:43:27 +00:00
if (!tools?.exec) return undefined;
return tools.exec;
2026-01-14 01:08:15 +00:00
}
export function describeUnknownError(error: unknown): string {
if (error instanceof Error) return error.message;
if (typeof error === "string") return error;
try {
const serialized = JSON.stringify(error);
return serialized ?? "Unknown error";
} catch {
return "Unknown error";
}
}
export type { ReasoningLevel, ThinkLevel };