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

@@ -1,5 +1,5 @@
import { describe, expect, it } from "vitest";
import { getModel, streamSimple } from "../src/compat.ts";
import { getModel, getModels, streamSimple } from "../src/compat.ts";
import type { AssistantMessage, Context, Model } from "../src/types.ts";
interface AnthropicPayload {
@@ -97,12 +97,29 @@ describe("Anthropic empty thinking signature compat", () => {
expect(assistant?.content).toEqual([{ type: "thinking", thinking: "internal reasoning", signature: "" }]);
});
it.each(["k3"] as const)("allows empty signatures for Kimi Coding %s", async (modelId) => {
const model = getModel("kimi-coding", modelId);
expect(model.compat?.allowEmptySignature).toBe(true);
// Regression for #9676: Vercel AI Gateway emits unsigned thinking for translated models.
it("allows empty thinking signatures for every Vercel AI Gateway model", () => {
const models = getModels("vercel-ai-gateway");
expect(models.length).toBeGreaterThan(0);
expect(models.every((model) => model.compat?.allowEmptySignature === true)).toBe(true);
});
const payload = await capturePayload(model, makeContext(" ", "internal reasoning", "kimi-coding", modelId));
const assistant = payload.messages?.find((message) => message.role === "assistant");
expect(assistant?.content).toEqual([{ type: "thinking", thinking: "internal reasoning", signature: "" }]);
// Regression for #9323: Fireworks emits unsigned thinking that must survive replay.
it.each([
"accounts/fireworks/models/deepseek-v4p1-flash",
"accounts/fireworks/models/qwen3p8-max",
"accounts/fireworks/models/qwen3p8-2p4t-a95b",
"accounts/fireworks/models/nemotron-3-ultra-nvfp4",
] as const)("preserves unsigned thinking for Fireworks %s", async (modelId) => {
const model = getModel("fireworks", modelId);
expect(model.compat?.allowEmptySignature).toBe(true);
const context = makeContext("", "internal reasoning", "fireworks", modelId);
const assistant = context.messages[1] as AssistantMessage;
assistant.content.push({ type: "text", text: "answer" });
const payload = await capturePayload(model, context);
expect(payload.messages?.find((message) => message.role === "assistant")?.content).toEqual([
{ type: "thinking", thinking: "internal reasoning", signature: "" },
{ type: "text", text: "answer" },
]);
});
});