pi 1.0.2: bump @earendil-works/pi-ai + pi-agent-core 0.87.1 → 1.0.2

All imports and Agent seams survive (verified pre-bump). Fallouts, all
catalog drift handled by the documented refresh path:
- sync-pricing.ts: catalog schema v6 keys are type-qualified (chat:id);
  price chat models only, strip the prefix so PRICES keys stay provider:id
- prices.ts regenerated (1537 keys); auth-keys gains the typesafe provider
- test pins: glm-5.3-flash contextWindow 1048576→1048575, cacheRead
  0.05→0.03 (activity-feed, model-catalog, render-activity-dock, usage)

Inherited free: at-capacity retry, unfinished-tool-call error handling,
model samplingParams no longer dropped on direct stream().
This commit is contained in:
amosblomqvist
2026-10-04 19:50:20 +03:00
parent 5653a394ac
commit 02e7840b2f
9 changed files with 252 additions and 200 deletions
+3 -1
View File
@@ -85,7 +85,9 @@ test("activityFeed: contextLimit is the server's live-catalog join (owner amendm
const feed = activityFeed();
const knownJob = feed.jobs.find((j) => j.id === known.id)!;
assert.equal(knownJob.contextLimit, 1_048_576, "pi's catalog, joined server-side onto the feed");
// pi 1.0.2's catalog: glm-5.3-flash contextWindow 1_048_575 (was
// 1_048_576 at 0.87.1 — upstream models.dev refresh).
assert.equal(knownJob.contextLimit, 1_048_575, "pi's catalog, joined server-side onto the feed");
const unknownJob = feed.jobs.find((j) => j.id === unknown.id)!;
assert.equal(unknownJob.contextLimit, null, "missing from the live catalog → null, never a guessed window");
const bareJob = feed.jobs.find((j) => j.id === bare.id)!;
+3 -3
View File
@@ -66,9 +66,9 @@ describe("the model catalog projection", () => {
assert.ok(glm, "glm-5.3-flash in catalog");
assert.deepEqual(glm!.supportedLevels, ["low", "high", "max"]);
assert.deepEqual(glm!.input, ["text", "image"]);
// pi's current glm price (0.87.1 raised it back to 0.15/0.5 — the
// 0.85.x catalog had temporarily listed 0.075/0.25/0.015)
assert.deepEqual(glm!.cost, { input: 0.15, output: 0.5, cacheRead: 0.05, cacheWrite: 0 });
// pi's current glm price (pi 1.0.2 catalog refresh: cacheRead
// corrected 0.05 → 0.03; input/output unchanged since 0.87.1)
assert.deepEqual(glm!.cost, { input: 0.15, output: 0.5, cacheRead: 0.03, cacheWrite: 0 });
// model slots wave: the providers surface + the resolved slot pins
const openrouter = providers.find((p) => p.id === "openrouter");
assert.ok(openrouter && openrouter.keyPresent, "openrouter federated (key pinned above)");
+4 -3
View File
@@ -70,9 +70,10 @@ describe("activity dock pure layer", () => {
},
});
const blob = toBlobs({ jobs: [priced], extractions: [] })[0]!;
// (10000-5000)/1e6*0.15 + 5000/1e6*0.05 + 1000/1e6*0.5 = 0.0015
// (pi-ai catalog prices — glm-5.3-flash drifted in pi-ai 0.87.1)
assert.ok(blob.cost !== null && blob.cost > 0.0014 && blob.cost < 0.0016);
// (10000-5000)/1e6*0.15 + 5000/1e6*0.03 + 1000/1e6*0.5 = 0.0014
// (pi-ai catalog prices — glm-5.3-flash cacheRead corrected
// 0.05 → 0.03 in the pi 1.0.2 catalog refresh)
assert.ok(blob.cost !== null && blob.cost > 0.0013 && blob.cost < 0.0015);
const absent = toBlobs({ jobs: [job()], extractions: [] })[0]!;
assert.equal(absent.cost, null);
});
+3 -3
View File
@@ -42,10 +42,10 @@ test("sumSteps folds steps; absent stays absent until a value appears", () => {
test("callCost: glm-5.3-flash math — fresh input, cached read, output", () => {
const cost = callCost(call({ inputTokens: 100_000, outputTokens: 20_000, cacheReadTokens: 10_000 }), "openrouter:z-ai/glm-5.3-flash");
assert.ok(cost !== null);
// fresh 90k @ $0.15/M + cached 10k @ $0.05/M + output 20k @ $0.5/M
// fresh 90k @ $0.15/M + cached 10k @ $0.03/M + output 20k @ $0.5/M
// (pi-ai catalog prices — regenerated tables, scripts/sync-pricing;
// prices drifted in pi-ai 0.87.1, owner's cost fix 2026-09-29)
assert.ok(Math.abs(cost! - (0.0135 + 0.0005 + 0.01)) < 1e-9);
// glm-5.3-flash cacheRead corrected 0.05 → 0.03 in pi 1.0.2)
assert.ok(Math.abs(cost! - (0.0135 + 0.0003 + 0.01)) < 1e-9);
});
test("callCost: cache writes bill at the cacheWrite rate", () => {