@stablekernel/pi-bifrost 0.10.1 → 0.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/index.ts +14 -0
- package/src/plugin.test.ts +11 -2
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ Pi extension that registers a [Bifrost](https://docs.getbifrost.ai) LLM gateway
|
|
|
8
8
|
- `bifrost-openai` — the OpenAI-compatible surface, every chat model the gateway serves. First-party OpenAI GPT models (not `gpt-oss`) are sent over the Responses API (`api: "openai-responses"` per model): gpt-6-class models reject chat completions through the gateway.
|
|
9
9
|
- `bifrost-anthropic` — the Anthropic Messages surface, Claude models only. The Anthropic wire carries prompt-cache control blocks that only Claude accepts, so non-Claude models are registered on the OpenAI surface instead of being listed twice with one copy broken.
|
|
10
10
|
- Fetches each surface's model list, limits and pricing through `gateway-cli models --wire=…` at startup — no catalog is checked in.
|
|
11
|
-
- Seeds reasoning capability per model: catalog-flagged models register `reasoning: true`. On the OpenAI surface they also get a `thinkingLevelMap` translating pi's thinking levels to the model's effort values (unapplicable levels are hidden, never passed through by name) plus `supportsReasoningEffort`, so pi's per-request effort picker sends the provider's own values. On the Anthropic surface the capability is flagged and pi's Claude thinking handling applies. Toggle-only reasoning models get no effort map. The default effort itself is pi's own thinking-level default.
|
|
11
|
+
- Seeds reasoning capability per model: catalog-flagged models register `reasoning: true`. On the OpenAI surface they also get a `thinkingLevelMap` translating pi's thinking levels to the model's effort values (unapplicable levels are hidden, never passed through by name) plus `supportsReasoningEffort`, so pi's per-request effort picker sends the provider's own values. On the Anthropic surface the capability is flagged and pi's Claude thinking handling applies. Models with effort levels also set `supportsPerMessageEffort` (omp only) so thinking-level changes keep the prompt cache. Toggle-only reasoning models get no effort map. The default effort itself is pi's own thinking-level default.
|
|
12
12
|
- Never holds the key: pi resolves it per request via the `!gateway-cli key print` command form, so the per-project key cascade (environment override → project → user default) applies on every turn.
|
|
13
13
|
|
|
14
14
|
## `/bifrost-refresh`
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -58,6 +58,10 @@ type ProviderModelConfig = {
|
|
|
58
58
|
supportsReasoningEffort?: boolean;
|
|
59
59
|
supportsDeveloperRole?: boolean;
|
|
60
60
|
forceAdaptiveThinking?: boolean;
|
|
61
|
+
/** omp only: send effort changes as mid-conversation messages
|
|
62
|
+
* (beta mid-conversation-output-config-2026-07-01) instead of rewriting
|
|
63
|
+
* the top-level output_config. Ignored by pi. */
|
|
64
|
+
supportsPerMessageEffort?: boolean;
|
|
61
65
|
};
|
|
62
66
|
};
|
|
63
67
|
|
|
@@ -342,6 +346,16 @@ export function toPiModels(
|
|
|
342
346
|
// think; pi's built-in Claude handling applies. forceAdaptiveThinking
|
|
343
347
|
// for custom providers is not verified against pi-ai, so it is not set
|
|
344
348
|
// here — see the package README for the open gap.
|
|
349
|
+
//
|
|
350
|
+
// supportsPerMessageEffort: omp defaults it off for non-first-party
|
|
351
|
+
// endpoints, so a thinking-level change rewrote the top-level effort
|
|
352
|
+
// and Anthropic re-cached everything from the first assistant thinking
|
|
353
|
+
// block onward (full-context cache miss per change). Per-message effort
|
|
354
|
+
// keeps the prefix intact; Bifrost forwards the beta (verified live
|
|
355
|
+
// 2026-11-16 on claude-opus-5-5). Only for models with effort levels.
|
|
356
|
+
if (api === "anthropic-messages" && map) {
|
|
357
|
+
model.compat = { supportsPerMessageEffort: true };
|
|
358
|
+
}
|
|
345
359
|
}
|
|
346
360
|
out.push(model);
|
|
347
361
|
}
|
package/src/plugin.test.ts
CHANGED
|
@@ -463,14 +463,23 @@ describe("reasoning", () => {
|
|
|
463
463
|
expect(model.compat).toBeUndefined();
|
|
464
464
|
});
|
|
465
465
|
|
|
466
|
-
test("
|
|
466
|
+
test("enables per-message effort on the anthropic surface without a thinkingLevelMap", async () => {
|
|
467
467
|
// Claude models think adaptively on the anthropic-messages surface; the
|
|
468
|
-
// openai-only reasoning_effort machinery stays off there.
|
|
468
|
+
// openai-only reasoning_effort machinery stays off there. Effort changes
|
|
469
|
+
// go per message so a thinking-level switch keeps the prompt cache.
|
|
469
470
|
const { toPiModels } = await import("./index.js");
|
|
470
471
|
const CLAUDE: CliModel = { ...KIMI, id: "claude-sonnet-4-6" };
|
|
471
472
|
const [model] = toPiModels({ models: [CLAUDE] }, "anthropic-messages");
|
|
472
473
|
expect(model.reasoning).toBe(true);
|
|
473
474
|
expect(model.thinkingLevelMap).toBeUndefined();
|
|
475
|
+
expect(model.compat).toEqual({ supportsPerMessageEffort: true });
|
|
476
|
+
});
|
|
477
|
+
|
|
478
|
+
test("leaves anthropic compat unset when the model has no effort levels", async () => {
|
|
479
|
+
const { toPiModels } = await import("./index.js");
|
|
480
|
+
const CLAUDE: CliModel = { ...KIMI, id: "claude-sonnet-4-6", reasoning_efforts: undefined };
|
|
481
|
+
const [model] = toPiModels({ models: [CLAUDE] }, "anthropic-messages");
|
|
482
|
+
expect(model.reasoning).toBe(true);
|
|
474
483
|
expect(model.compat).toBeUndefined();
|
|
475
484
|
});
|
|
476
485
|
});
|