chore(vendor): import pi 1.3.0

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: 71023aec1546d6d677a65669c5665c0927ce0dd0
This commit is contained in:
alexion committed 2026-10-15 17:58:48 -04:00
1 parent 719370c8f7
commit 6081e3e325
1743 files changed
+205459 -131704

No files matched your search

@@ -11,6 +11,7 @@ import type {
OpenAICompletionsCompat,
Usage,
} from "../src/types.ts";
import { normalizeContext } from "../src/utils/transcript.ts";
const emptyUsage: Usage = {
input: 0,
@@ -42,16 +43,17 @@ const compat = {
thinkingTokenBudgetField: undefined,
supportsStrictMode: true,
supportsOpenAIGrammarTools: false,
supportsMidConvoSystemMessages: false,
supportsMidConvoToolAdditions: false,
cacheControlFormat: undefined,
sendSessionAffinityHeaders: false,
sessionAffinityFormat: "openai",
supportsLongCacheRetention: true,
} satisfies Omit<
Required<OpenAICompletionsCompat>,
"cacheControlFormat" | "deferredToolsMode" | "thinkingTokenBudgetField" | "vllmPriority"
"cacheControlFormat" | "thinkingTokenBudgetField" | "vllmPriority"
> & {
cacheControlFormat?: OpenAICompletionsCompat["cacheControlFormat"];
deferredToolsMode?: OpenAICompletionsCompat["deferredToolsMode"];
thinkingTokenBudgetField?: OpenAICompletionsCompat["thinkingTokenBudgetField"];
};
@@ -117,11 +119,13 @@ describe("openai-completions thinking-as-text replay", () => {
it("serializes same-model thinking-plus-text replay as assistant text parts", () => {
const messages = convertMessages(
buildModel(),
buildContext(
buildAssistant([
{ type: "thinking", thinking: "internal reasoning" },
{ type: "text", text: "visible answer" },
]),
normalizeContext(
buildContext(
buildAssistant([
{ type: "thinking", thinking: "internal reasoning" },
{ type: "text", text: "visible answer" },
]),
),
),
compat,
);
@@ -138,7 +142,7 @@ describe("openai-completions thinking-as-text replay", () => {
it("serializes same-model thinking-only replay as assistant text parts", () => {
const messages = convertMessages(
buildModel(),
buildContext(buildAssistant([{ type: "thinking", thinking: "internal reasoning" }])),
normalizeContext(buildContext(buildAssistant([{ type: "thinking", thinking: "internal reasoning" }]))),
compat,
);
@@ -198,11 +202,13 @@ describe("openai-completions thinking-as-text replay", () => {
const events = await collectEvents(
streamOpenAICompletions(
buildModel(`http://127.0.0.1:${port}`),
buildContext(
buildAssistant([
{ type: "thinking", thinking: "internal reasoning" },
{ type: "text", text: "visible answer" },
]),
normalizeContext(
buildContext(
buildAssistant([
{ type: "thinking", thinking: "internal reasoning" },
{ type: "text", text: "visible answer" },
]),
),
),
{ apiKey: "test-key" },
),