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

@@ -4,7 +4,7 @@ import { getModel, streamSimple } from "../src/compat.ts";
// Empty tools arrays must NOT be serialized as `tools: []` — some OpenAI-compatible
// backends (e.g. DashScope / Aliyun Qwen via compatible-mode) reject the request with
// `"[] is too short - 'tools'"` (HTTP 400) when `--no-tools` produces an empty array.
// Regression for https://github.com/earendil-works/pi-mono/issues/<issue-number>
// Regression for https://github.com/earendil-works/pi/issues/3649
const mockState = vi.hoisted(() => ({
lastParams: undefined as unknown,
@@ -140,7 +140,7 @@ describe("openai-completions empty tools handling", () => {
const params = mockState.lastParams as { max_tokens?: number; max_completion_tokens?: number };
expect(params.max_tokens).toBeUndefined();
expect(params.max_completion_tokens).toBe(3904);
expect(params.max_completion_tokens).toBe(3618);
});
it("clamps explicit maxTokens to remaining context", async () => {
@@ -157,7 +157,7 @@ describe("openai-completions empty tools handling", () => {
const params = mockState.lastParams as { max_tokens?: number; max_completion_tokens?: number };
expect(params.max_tokens).toBeUndefined();
expect(params.max_completion_tokens).toBe(3904);
expect(params.max_completion_tokens).toBe(3618);
});
it("uses conservative OpenAI-compatible fields for Cloudflare AI Gateway /compat models", async () => {