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

@@ -3,6 +3,7 @@ import { describe, expect, it } from "vitest";
import { convertResponsesMessages, processResponsesStream } from "../src/api/openai-responses-shared.ts";
import type { Api, AssistantMessage, Model, ToolCall } from "../src/types.ts";
import { AssistantMessageEventStream } from "../src/utils/event-stream.ts";
import { normalizeContext } from "../src/utils/transcript.ts";
const model: Model<"openai-responses"> = {
id: "gpt-5.4",
@@ -131,9 +132,11 @@ describe("OpenAI Responses tool-call namespaces", () => {
namespace: "dynamic_tools",
});
const replayed = convertResponsesMessages(model, { messages: [output] }, new Set(["openai"])).find(
(item) => item.type === "function_call",
);
const replayed = convertResponsesMessages(
model,
normalizeContext({ messages: [output] }),
new Set(["openai"]),
).find((item) => item.type === "function_call");
expect(replayed).toMatchObject({
type: "function_call",
id: "fc_test",
@@ -159,7 +162,7 @@ describe("OpenAI Responses tool-call namespaces", () => {
namespace: "dynamic_tools",
});
const replayed = convertResponsesMessages(model, { messages: [output] }, new Set(["openai"]), {
const replayed = convertResponsesMessages(model, normalizeContext({ messages: [output] }), new Set(["openai"]), {
grammarToolInputProperties,
}).find((item) => item.type === "custom_tool_call");
expect(replayed).toMatchObject({
@@ -192,7 +195,7 @@ describe("OpenAI Responses tool-call namespaces", () => {
);
const targetModels: Model<Api>[] = [
{ ...model, id: "gpt-5.2", name: "GPT-5.2" },
{ ...model, provider: "azure-openai-responses" },
{ ...model, provider: "azure" },
{
...model,
api: "openai-codex-responses",
@@ -203,9 +206,14 @@ describe("OpenAI Responses tool-call namespaces", () => {
];
for (const targetModel of targetModels) {
const replayed = convertResponsesMessages(targetModel, { messages: [output] }, new Set(["openai"]), {
grammarToolInputProperties: new Map([["query", "input"]]),
});
const replayed = convertResponsesMessages(
targetModel,
normalizeContext({ messages: [output] }),
new Set(["openai"]),
{
grammarToolInputProperties: new Map([["query", "input"]]),
},
);
const functionCall = replayed.find((item) => item.type === "function_call");
const customToolCall = replayed.find((item) => item.type === "custom_tool_call");
expect(functionCall).toBeDefined();
@@ -224,9 +232,11 @@ describe("OpenAI Responses tool-call namespaces", () => {
arguments: { value: "hello" },
});
const replayed = convertResponsesMessages(model, { messages: [output] }, new Set(["openai"])).find(
(item) => item.type === "function_call",
);
const replayed = convertResponsesMessages(
model,
normalizeContext({ messages: [output] }),
new Set(["openai"]),
).find((item) => item.type === "function_call");
expect(replayed).toBeDefined();
expect(replayed).not.toHaveProperty("namespace");
});