@vanillagreen/pi-claude-bridge 1.5.0 → 1.6.0

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
@@ -3,13 +3,13 @@
3
3
  ![Claude bridge demo response](https://raw.githubusercontent.com/vanillagreencom/vstack/main/pi-extensions/pi-claude-bridge/assets/bridge-demo.png)
4
4
  ![Claude Bridge settings panel](https://raw.githubusercontent.com/vanillagreencom/vstack/main/pi-extensions/pi-claude-bridge/assets/settings-panel.png)
5
5
 
6
- Run Claude Code as a Pi provider. Adds `claude-bridge/*` models to `/model` and routes Pi turns through the Claude Agent SDK while keeping Pi's tools and TUI.
6
+ Run Claude Code as a Pi provider. Adds `claude-bridge/*` models to `/model` while keeping Pi's tools and TUI.
7
7
 
8
- Forked from [`elidickinson/pi-claude-bridge`](https://github.com/elidickinson/pi-claude-bridge). The provider, MCP bridge, session sync, and SDK plumbing come from upstream; this fork removes the AskClaude tool and adds opt-in forwarding for Pi prompt context.
8
+ Forked from [`elidickinson/pi-claude-bridge`](https://github.com/elidickinson/pi-claude-bridge). This fork removes the AskClaude tool and adds opt-in forwarding for Pi prompt context.
9
9
 
10
10
  ## Highlights
11
11
 
12
- - `claude-bridge/claude-fable-5`, Opus 4.8, Opus 4.7, Sonnet, and Haiku in `/model`.
12
+ - `claude-bridge/claude-fable-5`, Sonnet 5, Opus 4.8, Opus 4.7, Sonnet 4.6, and Haiku in `/model`.
13
13
  - Pi tool calls run on Pi; Claude Code handles reasoning.
14
14
  - Tool-use turns block until Pi-delivered tool results reach Claude Code, including persistent subagent panes.
15
15
  - Session continuity across normal turns, `/compact`, tree navigation, and abort recovery.
@@ -94,24 +94,24 @@ Keys may be bare model IDs (`claude-opus-4-8`), `claude-bridge/<id>`, or `*` for
94
94
 
95
95
  ### Fable 5 caveat
96
96
 
97
- The bridge registers `claude-bridge/claude-fable-5` and `claude-bridge/claude-opus-4-8` even when Pi's Anthropic model registry has not shipped those entries yet. For Fable 5, the bridge asks Claude Code to use Opus 4.8 as the availability fallback and preserves Claude Code's content-safety fallback events so Pi labels rerouted turns as Opus 4.8. Content-safety fallback still depends on Claude Code's own Fable 5 support; use Claude Code 2.1.170 or newer, and set `ANTHROPIC_DEFAULT_FABLE_MODEL` / `ANTHROPIC_DEFAULT_OPUS_MODEL` yourself when routing provider-specific model IDs through Bedrock, Vertex, or Foundry.
97
+ The bridge registers `claude-bridge/claude-fable-5`, `claude-bridge/claude-sonnet-5`, and `claude-bridge/claude-opus-4-8` even when Pi's Anthropic model registry has not shipped those entries yet. For Fable 5, the bridge asks Claude Code to use Opus 4.8 as the availability fallback and preserves Claude Code's content-safety fallback events so Pi labels rerouted turns as Opus 4.8. Content-safety fallback still depends on Claude Code's own Fable 5 support; use Claude Code 2.1.170 or newer, and set `ANTHROPIC_DEFAULT_FABLE_MODEL` / `ANTHROPIC_DEFAULT_OPUS_MODEL` yourself when routing provider-specific model IDs through Bedrock, Vertex, or Foundry.
98
98
 
99
99
  ## Extra usage and rate limits
100
100
 
101
101
  Claude Code's `/extra-usage` local command works through the Claude Agent SDK. In Pi, use `/claude-bridge:extra` to run that flow from claude-bridge. Persist automatic launch on extra-usage errors with **Allow extra usage helper** in `/extensions:settings`.
102
102
 
103
- When Claude Code emits rate-limit reset metadata, the bridge shows one red ASCII `[rate-limit]` Pi warning with the reset timestamp including timezone context, deduplicates repeated Claude Code error lines, and suppresses the SDK's follow-up `Claude Code returned an error result: ...` wrapper when the bridge already emitted the terminal error. The bridge also emits `vstack:rate-limit` on Pi's extension event bus so `pi-qol` can opt into reset-time auto-resume.
103
+ When Claude Code reports a rate-limit reset time, the bridge shows one clear `[rate-limit]` warning with timezone context and avoids repeating the same error line. If `pi-qol` is installed, it can use the reset time to resume later.
104
104
 
105
105
  Allowed-warning rate-limit events are filtered before user notification. The bridge normalizes unambiguous numeric utilization (`0 < value < 1` as fractional, `1 < value <= 100` as percent), suppresses low or unit-ambiguous values such as exact `1`, and only shows a neutral warning at 80%+ instead of claiming an unverified `% used` value. Check Claude Code `/usage` for exact allowed-warning utilization.
106
106
 
107
- If Claude Code accepts a turn but produces no assistant/tool output, the bridge treats that stream-idle stall as a retryable overload/rate-limit failure: it closes the stalled Claude Code subprocess, emits a normal assistant error with a backoff hint, and lets `pi-agents-tmux` reuse its existing rate-limit retry ladder. Tune the first-output timeout with `CLAUDE_BRIDGE_STREAM_IDLE_TIMEOUT` (bare numbers are seconds; suffixes `ms`, `s`, and `m` are accepted). Default: `90s`; set `0` to disable.
107
+ If Claude Code accepts a turn but produces no visible output, the bridge returns a retryable assistant error with a backoff hint instead of leaving Pi stuck waiting. Tune the first-output timeout with `CLAUDE_BRIDGE_STREAM_IDLE_TIMEOUT` (bare numbers are seconds; suffixes `ms`, `s`, and `m` are accepted). Default: `90s`; set `0` to disable.
108
108
 
109
109
  ## Debugging
110
110
 
111
111
  Set `CLAUDE_BRIDGE_DEBUG=1` to write bridge logs to `~/.pi/agent/claude-bridge.log` and per-query Claude Code CLI logs under `~/.pi/agent/cc-cli-logs/`.
112
112
 
113
- If a Claude Code SDK stream yields a completed assistant tool-use message before a `message_stop` stream event, the bridge treats that assistant message as the tool-turn boundary. Pi executes the tool calls immediately and Claude Code's MCP handlers stay blocked until the matching Pi tool results are delivered, preventing empty inline tool results or one-render-cycle-late result batches in subagent panes.
113
+ Tool-result integrity problems are surfaced even when debug logging is off. Pi shows an error notification and writes a diagnostic file to `~/.pi/agent/claude-bridge-diag.log` so lost or mismatched tool output is visible.
114
114
 
115
- Tool-result integrity failures are surfaced even when debug logging is off. If the bridge has to repair missing Claude Code `tool_use` / Pi `toolResult` pairs with `[no tool result recorded]`, Pi shows an error notification and writes a JSON diagnostic to `~/.pi/agent/claude-bridge-diag.log` with counts, affected tool names, and sampled tool-call IDs so the lost output is visible. Tool results whose IDs were never registered in the active assistant tool-use turn are refused instead of being queued against another pending call, and any remaining MCP handlers receive an internal-error result so the turn cannot report false success. If a query tears down while parallel tool results are still queued or unresolved, the bridge writes the same kind of diagnostic, marks the Claude session for rebuild, and re-imports delivered results from Pi history on the next turn instead of silently resuming a corrupted session.
115
+ Startup failures include the resolved Claude executable and working directory, which makes missing binaries and wrong launch directories easier to fix.
116
116
 
117
- Before starting Claude Code, the bridge preflights the resolved executable and working directory. Failures include the underlying `code`, `errno`, `syscall`, `path`, `cwd`, and detected executable file type so spawn issues point at the real failing path instead of the Claude Agent SDK's generic native-binary message. If Node still emits a spawn error after preflight, the bridge wraps that error with the same context before handing it back to the SDK.
117
+ Contributor-facing stream, tool-result, and startup diagnostics are documented in [`DEVELOPMENT.md`](./DEVELOPMENT.md).
package/bundle/index.js CHANGED
@@ -22239,6 +22239,7 @@ function convertPiMessages(messages, customToolNameToSdk) {
22239
22239
  // src/models.ts
22240
22240
  var FABLE_MODEL_ID = "claude-fable-5";
22241
22241
  var FABLE_FALLBACK_MODEL_ID = "claude-opus-4-8";
22242
+ var SONNET_5_MODEL_ID = "claude-sonnet-5";
22242
22243
  function fallbackModelForPrimaryModel(modelId) {
22243
22244
  return modelId === FABLE_MODEL_ID ? FABLE_FALLBACK_MODEL_ID : void 0;
22244
22245
  }
@@ -22247,6 +22248,7 @@ var MODEL_IDS_IN_ORDER = [
22247
22248
  FABLE_FALLBACK_MODEL_ID,
22248
22249
  "claude-opus-4-7",
22249
22250
  "claude-opus-4-6",
22251
+ SONNET_5_MODEL_ID,
22250
22252
  "claude-sonnet-4-6",
22251
22253
  "claude-haiku-4-5"
22252
22254
  ];
@@ -22268,6 +22270,14 @@ var FALLBACK_MODELS = {
22268
22270
  input: ["text", "image"],
22269
22271
  contextWindow: 1e6,
22270
22272
  maxTokens: 128e3
22273
+ },
22274
+ [SONNET_5_MODEL_ID]: {
22275
+ id: SONNET_5_MODEL_ID,
22276
+ name: "Claude Sonnet 5",
22277
+ reasoning: true,
22278
+ input: ["text", "image"],
22279
+ contextWindow: 1e6,
22280
+ maxTokens: 128e3
22271
22281
  }
22272
22282
  };
22273
22283
  function buildModels(piAiModels) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vanillagreen/pi-claude-bridge",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
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": [
package/src/models.ts CHANGED
@@ -4,6 +4,7 @@
4
4
 
5
5
  export const FABLE_MODEL_ID = "claude-fable-5";
6
6
  export const FABLE_FALLBACK_MODEL_ID = "claude-opus-4-8";
7
+ export const SONNET_5_MODEL_ID = "claude-sonnet-5";
7
8
 
8
9
  export function fallbackModelForPrimaryModel(modelId: string): string | undefined {
9
10
  return modelId === FABLE_MODEL_ID ? FABLE_FALLBACK_MODEL_ID : undefined;
@@ -14,6 +15,7 @@ export const MODEL_IDS_IN_ORDER = [
14
15
  FABLE_FALLBACK_MODEL_ID,
15
16
  "claude-opus-4-7",
16
17
  "claude-opus-4-6",
18
+ SONNET_5_MODEL_ID,
17
19
  "claude-sonnet-4-6",
18
20
  "claude-haiku-4-5",
19
21
  ];
@@ -47,6 +49,14 @@ const FALLBACK_MODELS: Record<string, BridgeModelMetadata> = {
47
49
  contextWindow: 1000000,
48
50
  maxTokens: 128000,
49
51
  },
52
+ [SONNET_5_MODEL_ID]: {
53
+ id: SONNET_5_MODEL_ID,
54
+ name: "Claude Sonnet 5",
55
+ reasoning: true,
56
+ input: ["text", "image"],
57
+ contextWindow: 1000000,
58
+ maxTokens: 128000,
59
+ },
50
60
  };
51
61
 
52
62
  // Project pi-ai's model entries down to the fields pi's registerProvider expects,