@vanillagreen/pi-claude-bridge 1.1.4 → 1.3.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 +27 -1
- package/bundle/index.js +15454 -11932
- package/package.json +47 -3
- package/src/config.ts +70 -1
- package/src/convert.ts +77 -20
- package/src/index.ts +554 -60
- package/src/models.ts +1 -1
- package/src/query-state.ts +187 -3
- package/src/tool-pairing-audit.ts +61 -0
package/README.md
CHANGED
|
@@ -9,10 +9,12 @@ Forked from [`elidickinson/pi-claude-bridge`](https://github.com/elidickinson/pi
|
|
|
9
9
|
|
|
10
10
|
## Highlights
|
|
11
11
|
|
|
12
|
-
- `claude-bridge/claude-opus-4-
|
|
12
|
+
- `claude-bridge/claude-opus-4-8`, Opus 4-7, Sonnet, and Haiku in `/model`.
|
|
13
13
|
- Pi tool calls run on Pi; Claude Code handles reasoning.
|
|
14
|
+
- Tool-use turns block until Pi-delivered tool results reach Claude Code, including persistent subagent panes.
|
|
14
15
|
- Session continuity across normal turns, `/compact`, tree navigation, and abort recovery.
|
|
15
16
|
- Thinking-level forwarding with summarized Opus thinking display.
|
|
17
|
+
- Optional Claude effort overrides (`xhigh` → `max` for Opus 4.8).
|
|
16
18
|
- MCP isolation and Claude cloud-MCP suppression to keep tokens lean.
|
|
17
19
|
- Opt-in forwarding of `APPEND_SYSTEM.md` and recognized Pi prompt hooks.
|
|
18
20
|
|
|
@@ -74,10 +76,34 @@ Open `/extensions:settings`; settings appear under the **Claude Bridge** tab.
|
|
|
74
76
|
| Setting | What it does |
|
|
75
77
|
| --- | --- |
|
|
76
78
|
| Strict MCP config | Block filesystem MCP auto-loads; Pi owns tools. |
|
|
79
|
+
| Allow extra usage helper | Let the bridge launch Claude Code's `/extra-usage` flow when extra usage is required. Billing/admin approval still happens in Claude's browser page. |
|
|
80
|
+
| Fast mode | Enable Claude Code fast mode for bridge requests when the selected model supports it. |
|
|
81
|
+
| Force Claude effort | Override Pi's thinking-level mapping for every claude-bridge request. `none` keeps Pi's selected level; `max` sends Claude Code `--effort max`. |
|
|
82
|
+
| 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. |
|
|
77
83
|
| Claude executable path | Explicit `claude` binary path; empty auto-detects. |
|
|
78
84
|
|
|
85
|
+
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:
|
|
86
|
+
|
|
87
|
+
```json
|
|
88
|
+
{"claude-opus-4-8":"max"}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Keys may be bare model IDs (`claude-opus-4-8`), `claude-bridge/<id>`, or `*` for all bridge models. Values are `low`, `medium`, `high`, `xhigh`, or `max`.
|
|
92
|
+
|
|
93
|
+
## Extra usage and rate limits
|
|
94
|
+
|
|
95
|
+
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`.
|
|
96
|
+
|
|
97
|
+
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.
|
|
98
|
+
|
|
99
|
+
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.
|
|
100
|
+
|
|
79
101
|
## Debugging
|
|
80
102
|
|
|
81
103
|
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/`.
|
|
82
104
|
|
|
105
|
+
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.
|
|
106
|
+
|
|
107
|
+
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.
|
|
108
|
+
|
|
83
109
|
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.
|