feat: add model thinking level metadata

closes #3208
This commit is contained in:
Mario Zechner
2026-05-02 01:20:01 +02:00
parent 73b7b2c564
commit 80f06d3636
28 changed files with 527 additions and 243 deletions

View File

@@ -1,6 +1,6 @@
import { join } from "node:path";
import { Agent, type AgentMessage, type ThinkingLevel } from "@mariozechner/pi-agent-core";
import { type Message, type Model, streamSimple } from "@mariozechner/pi-ai";
import { clampThinkingLevel, type Message, type Model, streamSimple } from "@mariozechner/pi-ai";
import { getAgentDir } from "../config.js";
import { AgentSession } from "./agent-session.js";
import { formatNoModelsAvailableMessage } from "./auth-guidance.js";
@@ -262,8 +262,10 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
}
// Clamp to model capabilities
if (!model || !model.reasoning) {
if (!model) {
thinkingLevel = "off";
} else {
thinkingLevel = clampThinkingLevel(model, thinkingLevel) as ThinkingLevel;
}
const defaultActiveToolNames: ToolName[] = ["read", "bash", "edit", "write"];