pi-bro 0.15.0 → 0.16.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.
Files changed (5) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +50 -28
  3. package/backend.ts +724 -0
  4. package/bro.ts +574 -554
  5. package/package.json +3 -2
package/CHANGELOG.md CHANGED
@@ -2,6 +2,24 @@
2
2
 
3
3
  All notable changes to pi-bro are documented here.
4
4
 
5
+ ## [0.16.0] - 2026-09-24
6
+
7
+ ### Added
8
+
9
+ - Claude Code execution for explain, show and advisor, selected independently per capability through `/bro config`. Explain/show disable tools and customizations; advisor runs fresh with workspace tools. Claude-backed BTW is explicitly unsupported in this release.
10
+ - Backend-tagged model/effort selections with atomic per-capability overrides. Existing settings remain Agy selections and are migrated to version 2 only when saved; Agy remains the default.
11
+
12
+ ## [0.15.1] - 2026-09-22
13
+
14
+ ### Changed
15
+
16
+ - Explain, show, BTW and advisor now share an internal Agy execution boundary. Agy remains the only backend; existing settings, prompts, access modes, continuation and advisor retries are unchanged.
17
+
18
+ ### Fixed
19
+
20
+ - Cancellation, host deadlines and malformed execution streams use bounded subprocess cleanup, with POSIX process-group termination and escalation. Unexpected signal exits are reported as failures rather than mislabeled timeouts. Windows cleanup remains limited to the direct child.
21
+ - Offline RPC smoke checks wait for command acknowledgements instead of relying on fixed delays to prevent overlapping requests and premature shutdown.
22
+
5
23
  ## [0.15.0] - 2026-09-22
6
24
 
7
25
  ### Changed
package/README.md CHANGED
@@ -7,7 +7,8 @@ plain-language explanation — or open a sandboxed side conversation with
7
7
  `pi-bro` is an extension for [Earendil Pi](https://github.com/earendil-works/pi).
8
8
  It opens explanations in a separate modal and uses the
9
9
  [Google Antigravity CLI](https://antigravity.google/docs/cli-install) (`agy`)
10
- with your selected model.
10
+ with your selected model. Claude Code is also supported for explain, show and
11
+ advisor; Agy remains the default and is required for BTW.
11
12
 
12
13
  ## Quick start
13
14
 
@@ -31,6 +32,13 @@ Restart Pi or run `/reload`, then try:
31
32
 
32
33
  Run `/bro doctor` after installation or whenever Bro is not working.
33
34
 
35
+ Explain, show, BTW and advisor share an internal execution layer; Agy remains
36
+ the default backend. Claude Code can be selected per capability in `/bro config`. Cancellation, host deadlines
37
+ and invalid execution streams terminate the subprocess group on POSIX, escalating
38
+ after a five-second grace period. Windows cleanup targets the direct child only;
39
+ descendant termination is not guaranteed. Unexpected signal exits are reported as
40
+ failures, not timeouts.
41
+
34
42
  To install from GitHub instead, use
35
43
  `pi install git:github.com/tranhoangnguyen03/pi-bro`. To try Bro without
36
44
  installing it, use `pi -e npm:pi-bro`.
@@ -63,7 +71,7 @@ text directly captures a new source the same way.
63
71
  | `/bro show [n-turns] [query]` | Draw recent session turns (default last 1) as shapes instead of prose, from user and assistant conversation text only — tool calls, tool results, reasoning, and images are omitted. An optional query steers what the shapes focus on, with or without a leading turn count. |
64
72
  | `/bro doctor` | Check Bro's settings, Agy installation, account, model, effort, and mode. |
65
73
  | `/bro usage [--provider agy]` | Show current Agy resource limits. |
66
- | `/bro model [id]` | View or choose the shared default Agy model. |
74
+ | `/bro model [id]` | View or choose the selected backend’s shared default model. |
67
75
  | `/bro effort [low\|medium\|high]` | View or choose the shared default reasoning effort. |
68
76
  | `/bro mode [brief\|balanced\|faithful]` | View or choose the explanation mode. |
69
77
  | `/bro config` | Open an interactive settings screen for the shared default model/effort, explain mode, show turns, and per-capability (explain/show/btw/advisor) model and effort overrides. |
@@ -157,7 +165,7 @@ gives an `agy update` action when it is too old.
157
165
  summary. Bro captures a harness-neutral snapshot — the executor's system
158
166
  instructions, its active tools, and the conversation so far including tool
159
167
  calls and results — and sends it, along with an optional `question` the
160
- executor may pass, to a **fresh, standalone Agy process** for every
168
+ executor may pass, to a **fresh, standalone process of the selected backend** for every
161
169
  consultation. Nothing is resumed or reused across calls, including retries.
162
170
  - **Instructed to investigate, not implement**: the advisor process has real
163
171
  tool access in the workspace with permissions auto-approved
@@ -687,32 +695,46 @@ Bro creates this user-editable settings file when the extension loads:
687
695
  ~/.pi/agent/bro-settings.json
688
696
  ```
689
697
 
690
- ```json
691
- {
692
- "model": "gemini-3.7-flash",
693
- "effort": "low",
694
- "mode": "balanced",
695
- "showTurns": 1
696
- }
697
- ```
698
-
699
- `model` and `effort` are the **shared default**: explain, show, and btw all use
700
- them unless a capability has its own override. An optional `overrides` object
701
- adds per-capability overrides, each a full `{ "model": ..., "effort": ... }`
702
- pair:
698
+ Existing flat model/effort files remain valid and select Agy. Explicit saves use
699
+ version 2 with backend-tagged selections:
703
700
 
704
701
  ```json
705
702
  {
706
- "model": "gemini-3.7-flash",
707
- "effort": "low",
703
+ "version": 2,
704
+ "default": { "backend": "agy", "model": "gemini-3.7-flash", "effort": "low" },
708
705
  "mode": "balanced",
709
706
  "showTurns": 1,
710
707
  "overrides": {
711
- "show": { "model": "gemini-3.7-pro", "effort": "high" }
708
+ "explain": { "backend": "claude", "model": "sonnet", "effort": "medium" },
709
+ "advisor": { "backend": "claude", "model": "opus", "effort": "high" }
712
710
  }
713
711
  }
714
712
  ```
715
713
 
714
+ Each override is a complete backend/model/effort selection, never a field-by-field
715
+ merge. Omitted overrides inherit the shared default. Matching an override to the
716
+ default does not unpin it; select Default explicitly to restore inheritance.
717
+
718
+ ### Claude Code
719
+
720
+ Install and authenticate `claude` independently (tested with Claude Code 2.1.281).
721
+ Bro uses its CLI account and billing route, not Pi provider credentials. Choose
722
+ Claude in `/bro config`; model aliases such as `sonnet` and `opus`, or explicit
723
+ model IDs, are passed to the CLI. Claude efforts are `default` (omit the flag),
724
+ `low`, `medium`, `high`, `xhigh`, and `max`; the chosen model/account must support
725
+ the requested combination. Runtime rejection is surfaced without fallback.
726
+
727
+ Explain/show use a scratch directory, safe mode, disabled tools, empty strict MCP
728
+ configuration, disabled skills and no session persistence. This is a tool/configuration
729
+ restriction, not an OS sandbox; built-in and managed Claude behavior can remain.
730
+ Advisor uses safe mode and a fresh workspace process with permissions bypassed;
731
+ it can modify files, and instructions to only advise remain behavioral. Running
732
+ that mode as root may be rejected by Claude. BTW remains Agy-only: if a Claude
733
+ shared default makes BTW unsupported, select an explicit Agy override.
734
+
735
+ Doctor distinguishes CLI installation and configured authentication from a live
736
+ request; it does not run a Claude model turn. `/bro usage` remains Agy-specific.
737
+
716
738
  Use `/bro model`, `/bro effort`, and `/bro mode` to update the shared default
717
739
  and mode from Pi, `/bro config` to review or change the shared default and any
718
740
  per-capability (explain/show/btw/advisor) overrides interactively, or edit the file
@@ -742,9 +764,9 @@ PI_BRO_MODEL=gemini-3.7-flash-low pi
742
764
  ### Configuration precedence
743
765
 
744
766
  When resolving model and reasoning effort:
745
- 1. **Per-capability override**: If configured under `overrides.<capability>` (`explain`, `show`, `btw`, or `advisor`) in `bro-settings.json`, that capability pins its own `{ "model": ..., "effort": ... }` pair and ignores the shared default.
746
- 2. **Shared default**: If no override is set for that capability, it inherits the root `model` and `effort` in `bro-settings.json`.
747
- 3. **Catalog normalization**: Bro normalizes the resolved `{ model, effort }` against Agy's installed model catalog (mapping suffixed variant IDs and handling fixed-effort models).
767
+ 1. **Per-capability override**: If configured under `overrides.<capability>` (`explain`, `show`, `btw`, or `advisor`) in `bro-settings.json`, that capability pins its own complete backend/model/effort selection and ignores the shared default.
768
+ 2. **Shared default**: If no override is set for that capability, it inherits `default` in version-2 settings (root model/effort in legacy settings).
769
+ 3. **Catalog normalization**: For Agy selections, Bro normalizes the resolved `{ model, effort }` against Agy's installed model catalog (mapping suffixed variant IDs and handling fixed-effort models).
748
770
  4. **Initial file creation only**: `PI_BRO_MODEL` selects the initial default model only when Bro creates a missing `bro-settings.json` file. It has no effect once the file exists.
749
771
 
750
772
  When resolving turn count for `/bro show`:
@@ -792,7 +814,7 @@ run `/bro doctor` for the exact problem.
792
814
  - **External requests**: Bro sends the latest completed assistant response,
793
815
  pasted text, extracted document text, extracted webpage text, or recent
794
816
  session conversation text (tool calls, tool results, reasoning, and images
795
- omitted) to Agy and its configured model provider.
817
+ omitted) to the selected backend and its configured model provider.
796
818
  - **Side conversation requests**: `/bro btw` sends your side questions and, on
797
819
  the first turn, the seeded main-session conversation text to Agy. In `--full`
798
820
  mode the side agent additionally reads the workspace.
@@ -823,14 +845,14 @@ run `/bro doctor` for the exact problem.
823
845
  URLs whose query string contains secrets.
824
846
  - **Web extraction**: Bro parses downloaded HTML locally without executing page
825
847
  scripts or loading page subresources. It sends the extracted readable text,
826
- including links preserved in that text, to Agy; it does not separately send
848
+ including links preserved in that text, to the selected backend; it does not separately send
827
849
  the requested URL or raw page HTML. The URL, captured text, and explanation
828
850
  remain in process memory only and clear with the existing `/bro open` cache.
829
851
  - **Show diagrams**: When a show reply ends in one self-contained HTML block,
830
852
  Bro writes it to `/tmp/pi-bro-<uid>/bro-show-<hash>.html` with a restrictive
831
853
  Content-Security-Policy, and opens it in your browser only when you press
832
854
  **O**. **C** copies the full reply, including the HTML.
833
- - **Provider data**: Agy and your model provider may retain logs and request data
855
+ - **Provider data**: The selected CLI backend and your model provider may retain logs and request data
834
856
  according to their own settings and privacy policies.
835
857
  - **Clipboard**: Pressing **C** copies the text to your system clipboard, where
836
858
  your operating system or clipboard manager may retain it.
@@ -838,7 +860,7 @@ run `/bro doctor` for the exact problem.
838
860
  instructions, active tool list (excluding `bro_advisor`), ordered
839
861
  conversation history including tool calls and tool results (unlike Show, which
840
862
  omits them), human steering brief, and the executor's optional question to
841
- Agy and your configured model provider. Reasoning and image bodies are
863
+ the selected backend and its configured model provider. Reasoning and image bodies are
842
864
  omitted with explicit markers (`[reasoning omitted]`, `[image omitted]`).
843
865
  - **Advisor tool execution & safety boundary**: The advisor process runs
844
866
  directly in your workspace (`cwd`) with auto-approved permissions
@@ -860,7 +882,7 @@ extracted, copy its content into a supported text file or save it as a PDF and
860
882
  use `/bro file`. If a PDF contains only scanned images, run OCR with another
861
883
  tool before giving it to Bro.
862
884
 
863
- - Uses Agy as its only provider.
885
+ - Supports Agy for all capabilities and Claude Code for explain/show/advisor. Claude BTW is not yet supported; unsupported selections fail without fallback.
864
886
  - Document input supports `.md`, `.markdown`, `.txt`, `.pdf`, and `.docx` only;
865
887
  it does not perform OCR.
866
888
  - Webpage input supports one public HTML page, up to 5 MiB downloaded and
@@ -899,7 +921,7 @@ npm test
899
921
  pi --tui-mode fullscreen -e ./bro.ts
900
922
  ```
901
923
 
902
- The smoke test uses a fake `agy`, so it does not call an external model. It
924
+ The smoke test uses a fake `agy`, and Claude adapter tests use a fake `claude`, so automated tests do not call an external model. It
903
925
  verifies command routing, document and URL safety boundaries, HTML
904
926
  extraction, show capture (conversation text only, tool calls and results
905
927
  absent), and HTML-diagram handling, healthy and broken setup handling,