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

+9 -4
View File
@@ -1,6 +1,6 @@
import { beforeEach, describe, expect, it, vi } from "vitest";
import { generateImages } from "../src/images.ts";
import type { ImagesContext, ImagesModel } from "../src/types.ts";
import type { ImageModel, ImagesContext } from "../src/types.ts";
const mockState = vi.hoisted(() => ({
lastParams: undefined as unknown,
@@ -65,7 +65,8 @@ describe("openrouter images", () => {
});
it("returns text plus images in final output", async () => {
const model: ImagesModel<"openrouter-images"> = {
const model: ImageModel<"openrouter-images"> = {
type: "image",
id: "google/gemini-3.1-flash-image-preview",
name: "Gemini 3.1 Flash Image Preview",
api: "openrouter-images",
@@ -97,7 +98,8 @@ describe("openrouter images", () => {
});
it("passes through abort signal and returns aborted result", async () => {
const model: ImagesModel<"openrouter-images"> = {
const model: ImageModel<"openrouter-images"> = {
type: "image",
id: "black-forest-labs/flux.2-pro",
name: "FLUX.2 Pro",
api: "openrouter-images",
@@ -120,7 +122,8 @@ describe("openrouter images", () => {
});
it("generateImages resolves the final assistant images result", async () => {
const model: ImagesModel<"openrouter-images"> = {
const model: ImageModel<"openrouter-images"> = {
type: "image",
id: "black-forest-labs/flux.2-pro",
name: "FLUX.2 Pro",
api: "openrouter-images",
@@ -136,5 +139,7 @@ describe("openrouter images", () => {
const output = await generateImages(model, context, { apiKey: "test" });
expect(output.output.some((item) => item.type === "image")).toBe(true);
// Image-only models must not request text output.
expect((mockState.lastParams as { modalities?: string[] }).modalities).toEqual(["image"]);
});
});