Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- Support Pi 0.86 and 0.87: widen the `@earendil-works/pi-ai` and `@earendil-works/pi-coding-agent` peer ranges to `>=0.83.0 <0.88.0` and typecheck/test against 0.87.1. The extension still overrides Pi's built-in `meta` provider on 0.87.1.

## [0.6.1] - 2026-09-04

### Fixed
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
"image": "https://raw.githubusercontent.com/BlockedPath/pi-meta-oauth/main/preview.png"
},
"peerDependencies": {
"@earendil-works/pi-ai": ">=0.83.0 <0.86.0",
"@earendil-works/pi-coding-agent": ">=0.83.0 <0.86.0"
"@earendil-works/pi-ai": ">=0.83.0 <0.88.0",
"@earendil-works/pi-coding-agent": ">=0.83.0 <0.88.0"
},
"devDependencies": {
"@earendil-works/pi-ai": "0.85.1",
"@earendil-works/pi-coding-agent": "0.85.1",
"@earendil-works/pi-ai": "0.87.1",
"@earendil-works/pi-coding-agent": "0.87.1",
"bun-types": "latest",
"typescript": "^5.9.0"
},
Expand Down
18 changes: 15 additions & 3 deletions tests/meta-cache.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/// <reference types="bun-types" />
import { describe, expect, test } from "bun:test";
import type { Model } from "@earendil-works/pi-ai";
import * as piAi from "@earendil-works/pi-ai";
import type { Context, Model } from "@earendil-works/pi-ai";
import { streamSimple } from "@earendil-works/pi-ai/api/openai-responses";
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
import {
Expand All @@ -19,6 +20,17 @@ import { join } from "node:path";
const LIVE_CACHE_MODEL = "muse-spark-1.2-contributor";
const LIVE_CACHE_KEY = "pi-meta-oauth-live-cache-probe-v1";

// Pi 0.86+ stream functions take a branded TranscriptContext built by
// normalizeContext(); Pi 0.83–0.85 take a plain Context and do not export
// normalizeContext. A namespace import keeps the file loadable on both.
function toStreamContext(context: Context): Parameters<typeof streamSimple>[1] {
const normalize = (piAi as { normalizeContext?: (c: Context) => unknown })
.normalizeContext;
return (
typeof normalize === "function" ? normalize(context) : context
) as Parameters<typeof streamSimple>[1];
}

function resolveLiveMetaApiKey(): string | undefined {
for (const value of [
process.env.PI_META_LIVE_API_KEY,
Expand Down Expand Up @@ -82,9 +94,9 @@ async function captureResponsesRequest(options?: {
let payload: Record<string, unknown> | undefined;
const events = streamSimple(
museModel(),
{
toStreamContext({
messages: [{ role: "user", content: "Hi", timestamp: Date.now() }],
},
}),
{
apiKey: "test-key",
sessionId: options?.sessionId ?? "sid",
Expand Down
Loading