pi-bro 0.22.2 → 0.23.1

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/CHANGELOG.md CHANGED
@@ -2,6 +2,45 @@
2
2
 
3
3
  All notable changes to pi-bro are documented here.
4
4
 
5
+ ## [0.23.1] - 2026-10-15
6
+
7
+ ### Highlights
8
+
9
+ - Scroll Bro's explain, show, help and btw windows with the mouse wheel again on Pi 1.2.
10
+ - See the save messages and key hints in `/bro preferences`, `/bro advisor-steer` and `/bro config` on normal-size terminals; they were cut off at the bottom.
11
+ - btw keeps your place: it follows the newest answer while you are at the bottom and no longer jumps back to the top after each reply.
12
+
13
+ ### Fixed
14
+
15
+ - Mouse-wheel scrolling in the explain/show/doctor/help and btw windows on Pi 1.2 fullscreen. Pi 1.2 stopped passing raw wheel input to windows without a mouse handler; both windows now handle Pi's mouse events and keep the raw path for Pi 0.84 and regular mode.
16
+ - The wheel over the preferences, advisor-steer, config and Guided Review loading windows no longer scrolls the chat behind them on Pi 1.2.
17
+ - `/bro preferences`, `/bro advisor-steer` and `/bro config` fit their windows: no blank padding rows, a shorter editor hint line, the editors' height limit raised from 60% to 78% like the other Bro windows, and the config list sized to the terminal. At 24 rows the preferences editor now draws 18 rows instead of 27. Very short terminals (under about 22 rows) can still clip the editors, because Pi's editor has a minimum height.
18
+ - `/bro config` shows one key-hint line instead of two that disagreed, and its model picker shows its own hints.
19
+ - btw's hint while a reply runs now says Esc closes the panel and stops the reply, which is what it does.
20
+ - Guided Review saves once when you close it instead of twice; teardown without closing it (for example switching sessions) still saves.
21
+
22
+ ### Changed
23
+
24
+ - Internal: `src/bro.ts` is split into feature and modal modules (#133). No behaviour change.
25
+
26
+ ## [0.23.0] - 2026-10-13
27
+
28
+ ### Highlights
29
+
30
+ - `/bro show` can draw a real sequence diagram when a conversation traces messages among three or more parts of a system. Press **O** to see it rendered in your browser.
31
+ - Bro is now tested on Pi 1.2 as well as Pi 0.84.2, and the README says so.
32
+ - pi-bro has a preview card in the pi.dev package gallery.
33
+
34
+ ### Added
35
+
36
+ - `/bro show` can end a reply with one Mermaid `sequenceDiagram` for interactions among three or more participants (#108). The modal keeps the diagram's source readable and **O** opens a rendered version. Bro builds that page itself: it inlines a vendored Mermaid 12.1.0, allows only its own two scripts by hash, runs Mermaid with `securityLevel: "strict"` and no HTML labels, and inserts the model's text as escaped source. Any other Mermaid stays in the modal as plain text. If the diagram file cannot be written, the reply is kept and a warning is shown.
37
+
38
+ ### Changed
39
+
40
+ - Tested on Pi 1.2.0 (development pin) with a CI job that keeps Pi 0.84.2 covered; the README's Pi range now reads `>=0.84.2` (#130).
41
+ - The package now bundles Mermaid 12.1.0 for sequence diagrams, so it grows from about 0.5 MB to 6 MB unpacked (#108).
42
+ - Runtime source moved into `src/`; the extension entry is now `src/bro.ts`. Installs are unaffected. The package also sets a pi.dev gallery preview image (#116).
43
+
5
44
  ## [0.22.2] - 2026-10-13
6
45
 
7
46
  ### Highlights
package/README.md CHANGED
@@ -16,9 +16,7 @@ main agent's conversation stays clean. Before you install, see
16
16
  [what leaves your machine](#what-leaves-your-machine).
17
17
 
18
18
  <p align="center">
19
- <a href="https://raw.githubusercontent.com/tranhoangnguyen03/pi-bro/main/docs/images/bro-response-after.png">
20
- <img alt="A dense agent reply explained in plain language in the Bro window" src="https://raw.githubusercontent.com/tranhoangnguyen03/pi-bro/main/docs/images/bro-response-after.png" width="820">
21
- </a>
19
+ <img alt="Bro explains a dense agent reply in plain language, then answers a side question" src="https://raw.githubusercontent.com/tranhoangnguyen03/pi-bro/main/docs/images/bro-demo.gif" width="820">
22
20
  </p>
23
21
 
24
22
  ## Install
@@ -51,7 +49,7 @@ GitHub, use `pi install git:github.com/tranhoangnguyen03/pi-bro`.
51
49
  | Command | What you get |
52
50
  | --- | --- |
53
51
  | `/bro`, `/bro text`, `/bro file`, `/bro url` | **[Explain](docs/user-guide.md#what-bro-can-explain).** A plain-language version of the agent's last reply, pasted text, a PDF/DOCX/Markdown file, or a public webpage. Three modes: `brief`, `balanced`, `faithful`. |
54
- | `/bro show` | **[Show](docs/user-guide.md#bro-show).** The last few turns drawn as a shape (call tree, file tree, diff, pseudocode, or an HTML diagram) instead of prose. |
52
+ | `/bro show` | **[Show](docs/user-guide.md#bro-show).** The last few turns drawn as a shape (call tree, file tree, diff, pseudocode, a sequence diagram, or an HTML layout) instead of prose. |
55
53
  | `/bro btw` | **[Side questions](docs/user-guide.md#bro-btw-side-conversation).** A separate conversation seeded with recent context, so you can ask without interrupting the agent. ⚠️ [Full-permission mode](#what-leaves-your-machine) can edit files. |
56
54
  | `/bro guided-review <PR>` | **[Guided Review](docs/guided-review.md).** An explanation and quality assessment of a GitHub PR, with ranked findings, source evidence and private questions. Needs the Claude or Muse backend. |
57
55
  | `bro_advisor` tool | **[Second opinion](docs/user-guide.md#bro-advisor).** A tool your agent can call mid-task; a fresh backend process investigates and returns advice to the agent. ⚠️ [Runs with permissions bypassed](#what-leaves-your-machine). |
@@ -62,7 +60,7 @@ Guided Review has its own [guide](docs/guided-review.md).
62
60
 
63
61
  ## Requirements
64
62
 
65
- - Pi `>=0.84.2 <1` and Node.js `>=22.19.0`.
63
+ - Pi `>=0.84.2` (tested on 0.84.2 and 1.2) and Node.js `>=22.19.0`.
66
64
  - macOS or Linux. Windows is untested; there, cancelling stops only the
67
65
  backend's direct process, not anything it started.
68
66
  - At least one backend CLI on your `PATH`, signed in once from your terminal.
@@ -89,7 +87,7 @@ which may keep it under their own policies. Paths below are under
89
87
  | Feature | What is sent | What Bro keeps on disk |
90
88
  | --- | --- | --- |
91
89
  | Explain | The agent's last reply, your pasted text, or text extracted from your file or webpage, plus your preferences | Nothing; the last result stays in memory |
92
- | Show | User and assistant text from recent turns (no tool calls, tool results, reasoning or images), plus your preferences | HTML diagrams in `pi-bro-<uid>/` in your system temp folder |
90
+ | Show | User and assistant text from recent turns (no tool calls, tool results, reasoning or images), plus your preferences | Diagram pages in `pi-bro-<uid>/` in your system temp folder |
93
91
  | Side questions | Your questions and up to the last 8 turns of conversation text, plus your preferences | Nothing; the thread stays in memory |
94
92
  | Guided Review | The PR description and diff, the files the backend reads, your questions, plus your preferences | Reviews and captured source in `bro-reviews/`, with no automatic cleanup |
95
93
  | Advisor | The agent's system instructions, tool list and whole conversation, including tool calls and results (reasoning and images omitted), plus your steering | Steering in `bro-advisor.md` and the session file |
@@ -142,7 +140,7 @@ release is published to npm from CI with
142
140
  ```sh
143
141
  npm ci
144
142
  npm test # offline: uses fake backend CLIs, never calls a model
145
- pi --tui-mode fullscreen -e ./bro.ts
143
+ pi --tui-mode fullscreen -e ./src/bro.ts
146
144
  ```
147
145
 
148
146
  See [CONTRIBUTING.md](CONTRIBUTING.md), the [code map](docs/DEVELOPMENT.md)
@@ -67,6 +67,35 @@ HTML parsing uses [LinkeDOM](https://github.com/WebReflection/linkedom),
67
67
  copyright (c) 2021 Andrea Giammarchi (@WebReflection), licensed under the ISC
68
68
  License. Its complete license is distributed with the LinkeDOM npm package.
69
69
 
70
+ ## Mermaid
71
+
72
+ `vendor/mermaid.min.js` is the unmodified `dist/mermaid.min.js` from the
73
+ [mermaid](https://github.com/mermaid-js/mermaid) npm package, version 12.1.0
74
+ (sha256 `6484afc32872a3aa16cac9a76ba1816a1ed4cc870a6593cc2e17757750f518b2`).
75
+ `/bro show` inlines it into the diagram page it writes. Licensed under the MIT License:
76
+
77
+ The MIT License (MIT)
78
+
79
+ Copyright (c) 2014 - 2022 Knut Sveidqvist
80
+
81
+ Permission is hereby granted, free of charge, to any person obtaining a copy
82
+ of this software and associated documentation files (the "Software"), to deal
83
+ in the Software without restriction, including without limitation the rights
84
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
85
+ copies of the Software, and to permit persons to whom the Software is
86
+ furnished to do so, subject to the following conditions:
87
+
88
+ The above copyright notice and this permission notice shall be included in all
89
+ copies or substantial portions of the Software.
90
+
91
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
92
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
93
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
94
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
95
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
96
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
97
+ SOFTWARE.
98
+
70
99
  ## show-me
71
100
 
72
101
  The experimental show prompt's form menu, diff grammar, and example
@@ -96,3 +125,31 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
96
125
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
97
126
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
98
127
  SOFTWARE.
128
+
129
+ ## Mermaid
130
+
131
+ `src/vendor/mermaid.min.js` is the unmodified browser build of
132
+ [Mermaid](https://github.com/mermaid-js/mermaid) 12.1.0, licensed under the MIT
133
+ License:
134
+
135
+ The MIT License (MIT)
136
+
137
+ Copyright (c) 2014 - 2022 Knut Sveidqvist
138
+
139
+ Permission is hereby granted, free of charge, to any person obtaining a copy
140
+ of this software and associated documentation files (the "Software"), to deal
141
+ in the Software without restriction, including without limitation the rights
142
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
143
+ copies of the Software, and to permit persons to whom the Software is
144
+ furnished to do so, subject to the following conditions:
145
+
146
+ The above copyright notice and this permission notice shall be included in all
147
+ copies or substantial portions of the Software.
148
+
149
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
150
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
151
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
152
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
153
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
154
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
155
+ SOFTWARE.
@@ -12,7 +12,7 @@ Install the PiG binary from https://github.com/MichaelKinsy/PiG/releases/tag/v0.
12
12
  pig install npm:pi-bro
13
13
  ```
14
14
 
15
- That command installs the published Bro version; these compatibility changes take effect only after a Bro release containing them. To test this checkout now, install dependencies and use `pig -e ./bro.ts`.
15
+ That command installs the published Bro version; these compatibility changes take effect only after a Bro release containing them. To test this checkout now, install dependencies and use `pig -e ./src/bro.ts`.
16
16
 
17
17
  At initial verification, `@pi-in-go/pig@0.3.0` was not available from npm. CI therefore downloads the pinned GitHub binary and verifies its published SHA-256 checksum.
18
18
 
@@ -95,7 +95,7 @@ next mode without saving it:
95
95
  faithful → brief). It applies to this explanation only and does not change
96
96
  the mode saved by `/bro mode`; pressing it again while Bro is working skips
97
97
  ahead
98
- - **O**: Open the HTML diagram when a show reply contains one
98
+ - **O**: Open the diagram (an HTML layout or a rendered sequence diagram) when a show reply contains one
99
99
  - **Esc**: Close the modal, or cancel while Bro is working
100
100
 
101
101
  The modal header shows the model and reasoning effort the explanation or
@@ -179,8 +179,9 @@ asked in.
179
179
 
180
180
  `/insert` and `/insert-all` never replace an existing main-editor draft:
181
181
  edit or clear it first. Any other text, including other slash-prefixed input
182
- such as `/send`, is sent as a question. Esc closes the modal (or cancels a
183
- running turn). The header shows the model and reasoning effort the latest
182
+ such as `/send`, is sent as a question. Esc closes the modal and stops a
183
+ running turn; the thread is kept. The view follows the newest text while you
184
+ are at the bottom; scroll up to read earlier turns. The header shows the model and reasoning effort the latest
184
185
  turn used (`default` when the model's own effort applies) and the current
185
186
  mode.
186
187
  - A turn is capped at 2 minutes in conversation-only mode and 10 minutes in
@@ -281,6 +282,12 @@ reply that ends in one self-contained HTML block — layout, a state comparison,
281
282
  anything where position itself carries meaning — is written to a file and
282
283
  opened with **O**.
283
284
 
285
+ When the turns describe messages passing among three or more participants in
286
+ a set order (for example browser → API → database), a reply can instead end in
287
+ one Mermaid `sequenceDiagram`. The modal keeps its source visible with
288
+ `[Diagram saved — press O to render]`; **O** opens a page that draws it with
289
+ the Mermaid copy bundled in Bro. Any other Mermaid stays plain text.
290
+
284
291
  Pressing **R** redraws the same captured turns; running `/bro show` again
285
292
  captures the latest turns afresh. `/bro show <n-turns>` overrides the default turn
286
293
  count for a single run.
@@ -945,10 +952,14 @@ read. Move what you want to keep into `/bro preferences`, and choose
945
952
  scripts or loading page subresources. It sends the extracted readable text,
946
953
  including links preserved in that text, to the selected backend; it does not
947
954
  separately send the requested URL or raw page HTML.
948
- - **Show diagrams**: When a show reply ends in one self-contained HTML block,
949
- Bro writes it to `pi-bro-<uid>/bro-show-<hash>.html` in your system temp folder with a restrictive
950
- Content-Security-Policy, and opens it in your browser only when you press
951
- **O**. **C** copies the full reply, including the HTML.
955
+ - **Show diagrams**: When a show reply ends in one self-contained HTML block
956
+ or one Mermaid sequence diagram, Bro writes a page to
957
+ `pi-bro-<uid>/bro-show-<hash>.html` in your system temp folder with a
958
+ restrictive Content-Security-Policy, and opens it in your browser only when
959
+ you press **O**. HTML pages run no scripts. Sequence-diagram pages run only
960
+ Bro's bundled Mermaid and its fixed setup script; the model's diagram text is
961
+ inserted as escaped text and nothing is loaded from the network. **C**
962
+ copies the full reply, including the diagram source.
952
963
  - **Clipboard**: **C**, `/copy`, `/copy-all`, and Guided Review's Copy finding copy text to your system
953
964
  clipboard, where your operating system or clipboard manager may retain it.
954
965
 
@@ -974,7 +985,7 @@ tool before giving it to Bro.
974
985
  current session — the last few turns' user and assistant messages, with
975
986
  tool calls, tool results, reasoning, and images always omitted; its shapes
976
987
  reflect what was reported in the conversation, not independent verification.
977
- - HTML diagrams open in your default browser; pressing **O** on a remote or
988
+ - Diagrams open in your default browser; pressing **O** on a remote or
978
989
  headless session with no display reports the failure instead of opening
979
990
  anything.
980
991
  - Explain keeps only the latest result in memory and does not export directly to files. Guided Review separately persists review records and captured source.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-bro",
3
- "version": "0.22.2",
3
+ "version": "0.23.1",
4
4
  "description": "A sidekick for you and your Pi agent: plain-language explanations, side questions, diagrams, PR review and second opinions, without cluttering the agent's context.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -41,18 +41,24 @@
41
41
  "code-review"
42
42
  ],
43
43
  "files": [
44
- "bro.ts",
45
- "review.ts",
46
- "review-source.ts",
47
- "review-ui.ts",
48
- "review-modal.ts",
49
- "util.ts",
50
- "settings.ts",
51
- "sources.ts",
52
- "config-ui.ts",
53
- "ui-capabilities.ts",
54
- "backend.ts",
55
- "prompt.ts",
44
+ "src/bro.ts",
45
+ "src/doctor.ts",
46
+ "src/show.ts",
47
+ "src/advisor.ts",
48
+ "src/btw.ts",
49
+ "src/explain-modal.ts",
50
+ "src/review.ts",
51
+ "src/review-source.ts",
52
+ "src/review-ui.ts",
53
+ "src/review-modal.ts",
54
+ "src/util.ts",
55
+ "src/settings.ts",
56
+ "src/sources.ts",
57
+ "src/config-ui.ts",
58
+ "src/ui-capabilities.ts",
59
+ "src/backend.ts",
60
+ "src/prompt.ts",
61
+ "src/vendor/mermaid.min.js",
56
62
  "README.md",
57
63
  "CHANGELOG.md",
58
64
  "LICENSE",
@@ -77,8 +83,9 @@
77
83
  },
78
84
  "pi": {
79
85
  "extensions": [
80
- "./bro.ts"
81
- ]
86
+ "./src/bro.ts"
87
+ ],
88
+ "image": "https://raw.githubusercontent.com/tranhoangnguyen03/pi-bro/main/docs/images/social-preview.png"
82
89
  },
83
90
  "peerDependencies": {
84
91
  "@earendil-works/pi-coding-agent": "*",
@@ -86,10 +93,10 @@
86
93
  "typebox": "*"
87
94
  },
88
95
  "devDependencies": {
89
- "@earendil-works/pi-coding-agent": "0.84.2",
90
- "@earendil-works/pi-tui": "0.84.2",
96
+ "@earendil-works/pi-coding-agent": "1.2.0",
97
+ "@earendil-works/pi-tui": "1.2.0",
91
98
  "@types/node": "^24.0.0",
92
- "typebox": "1.3.7",
99
+ "typebox": "1.3.27",
93
100
  "typescript": "6.0.3"
94
101
  },
95
102
  "dependencies": {