@vanillagreen/pi-claude-bridge 1.6.0 → 1.6.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 CHANGED
@@ -1,5 +1,7 @@
1
1
  # pi-claude-bridge
2
2
 
3
+ Works with OAuth subscription, no API key, no errors.
4
+
3
5
  ![Claude bridge demo response](https://raw.githubusercontent.com/vanillagreencom/vstack/main/pi-extensions/pi-claude-bridge/assets/bridge-demo.png)
4
6
  ![Claude Bridge settings panel](https://raw.githubusercontent.com/vanillagreencom/vstack/main/pi-extensions/pi-claude-bridge/assets/settings-panel.png)
5
7
 
@@ -84,7 +86,7 @@ Project settings in `.pi/settings.json` apply only after Pi marks the workspace
84
86
  | Model effort overrides | JSON object mapping model IDs to Claude Code efforts, e.g. `{"claude-opus-4-8":"max"}`. Per-model entries beat the global force setting. |
85
87
  | Claude executable path | Explicit `claude` binary path; empty auto-detects. |
86
88
 
87
- Pi does not have a native `max` thinking level; it exposes up to `xhigh`, and each provider's model metadata maps Pi levels to provider values. To use Claude Code `max` effort only for Opus 4.8 through the bridge, set **Model effort overrides** to:
89
+ Pi 0.80.6 and newer expose native `max` thinking. Fable 5 bridge metadata forwards both `xhigh` and `max`; **Force Claude effort** and **Model effort overrides** remain available when one bridge model needs a different fixed effort. For example, to force only Opus 4.8 to `max`:
88
90
 
89
91
  ```json
90
92
  {"claude-opus-4-8":"max"}
package/bundle/index.js CHANGED
@@ -5,7 +5,7 @@ var __export = (target, all) => {
5
5
  };
6
6
 
7
7
  // src/index.ts
8
- import { calculateCost, getModels } from "@earendil-works/pi-ai";
8
+ import { calculateCost } from "@earendil-works/pi-ai";
9
9
  import * as piAi from "@earendil-works/pi-ai";
10
10
 
11
11
  // node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs
@@ -22257,7 +22257,7 @@ var FALLBACK_MODELS = {
22257
22257
  id: FABLE_MODEL_ID,
22258
22258
  name: "Claude Fable 5",
22259
22259
  reasoning: true,
22260
- thinkingLevelMap: { xhigh: "xhigh" },
22260
+ thinkingLevelMap: { xhigh: "xhigh", max: "max" },
22261
22261
  input: ["text", "image"],
22262
22262
  contextWindow: 1e6,
22263
22263
  maxTokens: 128e3
@@ -37565,8 +37565,18 @@ function jsonSchemaToZodShape(schema) {
37565
37565
  return shape;
37566
37566
  }
37567
37567
 
37568
+ // src/pi-ai-compat.ts
37569
+ var dynamicImport = (specifier) => import(specifier);
37570
+ async function resolveGetModels(root, loadCompat = () => dynamicImport("@earendil-works/pi-ai/compat")) {
37571
+ if (typeof root?.getModels === "function") return root.getModels;
37572
+ const compat = await loadCompat();
37573
+ if (typeof compat?.getModels !== "function") throw new Error("pi-ai getModels API is unavailable");
37574
+ return compat.getModels;
37575
+ }
37576
+
37568
37577
  // src/index.ts
37569
37578
  var _piAi = piAi;
37579
+ var getModels = await resolveGetModels(_piAi);
37570
37580
  var newAssistantMessageEventStream = typeof _piAi.createAssistantMessageEventStream === "function" ? _piAi.createAssistantMessageEventStream : () => new _piAi.AssistantMessageEventStream();
37571
37581
  var DEBUG = process.env.CLAUDE_BRIDGE_DEBUG === "1";
37572
37582
  var DEBUG_LOG_PATH = process.env.CLAUDE_BRIDGE_DEBUG_PATH || join5(homedir5(), ".pi", "agent", "claude-bridge.log");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vanillagreen/pi-claude-bridge",
3
- "version": "1.6.0",
3
+ "version": "1.6.2",
4
4
  "description": "Pi provider bridge that runs Claude Code through the Claude Agent SDK, with opt-in forwarding for Pi prompt context.",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -15,7 +15,7 @@
15
15
  "extensions": [
16
16
  "./bundle/index.js"
17
17
  ],
18
- "image": "https://raw.githubusercontent.com/vanillagreencom/vstack/main/pi-extensions/pi-claude-bridge/assets/claude-bridge1.png"
18
+ "image": "https://raw.githubusercontent.com/vanillagreencom/vstack/main/pi-extensions/pi-claude-bridge/assets/bridge-demo.png"
19
19
  },
20
20
  "vstack": {
21
21
  "extensionManager": {
@@ -106,7 +106,7 @@
106
106
  {
107
107
  "key": "forceEffort",
108
108
  "label": "Force Claude effort",
109
- "description": "Override Pi's thinking-level mapping for all claude-bridge requests. Use max to reach Claude Code max effort even though Pi has no max thinking level. none keeps Pi's selected level.",
109
+ "description": "Override Pi's thinking-level mapping for all claude-bridge requests. Pi 0.80.6 and newer can select max natively; none keeps Pi's selected level.",
110
110
  "type": "enum",
111
111
  "enumValues": [
112
112
  "none",
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { calculateCost, getModels, type AssistantMessage, type AssistantMessageEventStream, type Context, type Model, type SimpleStreamOptions, type Tool } from "@earendil-works/pi-ai";
1
+ import { calculateCost, type AssistantMessage, type AssistantMessageEventStream, type Context, type Model, type SimpleStreamOptions, type Tool } from "@earendil-works/pi-ai";
2
2
  import * as piAi from "@earendil-works/pi-ai";
3
3
  import { type ExtensionAPI, type ExtensionUIContext } from "@earendil-works/pi-coding-agent";
4
4
  import { createSdkMcpServer, query, type EffortLevel, type SDKMessage, type SDKUserMessage, type SettingSource, type SpawnOptions, type SpawnedProcess } from "@anthropic-ai/claude-agent-sdk";
@@ -21,9 +21,11 @@ import { loadConfig, normalizeEffortLevel, recordProjectTrust, type Config } fro
21
21
  import { extractAgentsAppend } from "./agents-md.js";
22
22
  import { buildPromptContextAppend } from "./prompt-context.js";
23
23
  import { jsonSchemaToZodShape } from "./typebox-to-zod.js";
24
+ import { resolveGetModels } from "./pi-ai-compat.js";
24
25
 
25
26
  // Compat (#2): use factory if available (pi-ai ≥0.66), else fall back to constructor (gsd-pi etc.)
26
27
  const _piAi = piAi as any;
28
+ const getModels = await resolveGetModels(_piAi) as (provider: string) => Array<Model<any>>;
27
29
  const newAssistantMessageEventStream: () => AssistantMessageEventStream =
28
30
  typeof _piAi.createAssistantMessageEventStream === "function"
29
31
  ? _piAi.createAssistantMessageEventStream
package/src/models.ts CHANGED
@@ -35,7 +35,7 @@ const FALLBACK_MODELS: Record<string, BridgeModelMetadata> = {
35
35
  id: FABLE_MODEL_ID,
36
36
  name: "Claude Fable 5",
37
37
  reasoning: true,
38
- thinkingLevelMap: { xhigh: "xhigh" },
38
+ thinkingLevelMap: { xhigh: "xhigh", max: "max" },
39
39
  input: ["text", "image"],
40
40
  contextWindow: 1000000,
41
41
  maxTokens: 128000,
@@ -0,0 +1,12 @@
1
+ export type GetModels = (provider: string) => any[];
2
+ const dynamicImport = (specifier: string) => import(specifier);
3
+
4
+ export async function resolveGetModels(
5
+ root: any,
6
+ loadCompat: () => Promise<any> = () => dynamicImport("@earendil-works/pi-ai/compat"),
7
+ ): Promise<GetModels> {
8
+ if (typeof root?.getModels === "function") return root.getModels;
9
+ const compat = await loadCompat();
10
+ if (typeof compat?.getModels !== "function") throw new Error("pi-ai getModels API is unavailable");
11
+ return compat.getModels;
12
+ }