chore(vendor): import pi 0.85.1

Imported as a linear vendor commit so forge rebases do not replay the upstream root tree.

git-subtree-dir: third_party/pi

git-subtree-split: d981de1229ef899957bbe968bc8dcda02a21f477
This commit is contained in:
alexion committed 2026-09-14 10:48:47 -04:00
1 parent 5ebc7018c3
commit 4def357d09
1669 files changed
+397627

No files matched your search

@@ -0,0 +1,23 @@
import type { ThinkingLevel, ThinkingLevelMap } from "../src/types.ts";
import { getEffortThinkingLevelMap } from "./models-dev-reasoning-options.ts";
export interface OpenRouterReasoningMetadata {
mandatory?: boolean;
default_enabled?: boolean;
supported_efforts?: Array<ThinkingLevel | "none">;
default_effort?: ThinkingLevel | "none";
}
/** Convert OpenRouter's reasoning metadata into Pi model capabilities. */
export function getOpenRouterThinkingLevelMap(
reasoning: OpenRouterReasoningMetadata | undefined,
): ThinkingLevelMap | undefined {
if (!reasoning) return undefined;
if (!reasoning.supported_efforts?.length) return reasoning.mandatory === true ? { off: null } : undefined;
// OpenRouter's supported_efforts uses the same effort values as models.dev reasoning_options,
// so both sources can share the same Pi thinking-level conversion.
const map = getEffortThinkingLevelMap([{ type: "effort", values: reasoning.supported_efforts }]);
if (!map) return reasoning.mandatory === true ? { off: null } : undefined;
return { ...map, off: reasoning.mandatory === true ? null : "none" };
}