pi-bro 0.35.1 → 0.36.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 +25 -0
- package/README.md +3 -0
- package/docs/README.md +1 -0
- package/docs/features/copy.md +37 -0
- package/docs/piG-agent-shell-qualification.md +79 -0
- package/docs/pig-compatibility.md +2 -0
- package/docs/reference/commands.md +1 -0
- package/docs/reference/data-and-permissions.md +2 -0
- package/docs/reference/settings.md +72 -0
- package/package.json +7 -2
- package/src/backend.ts +250 -59
- package/src/bro.ts +10 -0
- package/src/cli-auth.ts +85 -0
- package/src/copy.ts +230 -0
- package/src/doctor.ts +58 -16
- package/src/explain-modal.ts +5 -16
- package/src/last-assistant.ts +23 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to pi-bro are documented here.
|
|
4
4
|
|
|
5
|
+
## [0.36.1] - 2026-11-09
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- Make the Pi child use the same host-effective registry for model metadata, provider authentication, endpoint and streaming. Do not pair a stale host endpoint with a credential reread from an edited models.json. A same-host edit keeps A+key A; a new host uses B+key B.
|
|
10
|
+
- Give host-supplied model scopes priority over disk patterns in the picker; keep an empty resolved host scope empty, reject unavailable scoped models and avoid diagnostics calculated from a different source. An SDK empty scope with no file patterns cannot reveal an unmatched CLI flag until the host exposes scope provenance.
|
|
11
|
+
- Allow PiG-Agent to select each official Claude Code or Codex CLI subscription through existing `CLAUDE_CONFIG_DIR`/`CODEX_HOME`; filter conflicting API credentials in that child alone, check the reported login method before execution, and keep the normal parent account untouched. No new account store.
|
|
12
|
+
- Add profile-routing, no-API-fallback, host-model, and two-home memory fixtures while retaining the newer real-host cleanup and session-restore behavior from 0.32–0.36.
|
|
13
|
+
|
|
14
|
+
- For explicit Codex subscription access, inspect the official effective provider config. Accept Codex 0.165.0's implicit OpenAI default (`model_provider: null`), preserve its profile/project precedence, and reject custom API-key providers or endpoint redirects. The inspection app-server gets a temporary local model catalog to avoid startup network discovery; the actual Codex request does not. Doctor runs the same checks and cannot certify a rejected setup.
|
|
15
|
+
- Publish the PiG shell qualification report in the npm package; CI checks `npm pack --dry-run` contents. Replace obsolete development docs about rebuilding host model/auth catalogs.
|
|
16
|
+
|
|
17
|
+
### Qualification
|
|
18
|
+
|
|
19
|
+
- Reconciled against pi-bro 0.36.0. Fixture success is not proof of PiG-Agent 0.5.3 interactive TUI or live account use. See `docs/piG-agent-shell-qualification.md`.
|
|
20
|
+
|
|
21
|
+
## [0.36.0] - 2026-11-09
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
|
|
25
|
+
- `/bro copy` opens the last completed assistant reply as raw editable Markdown, with Ctrl+D Preview and Ctrl+C clipboard copy, without model calls or saved drafts.
|
|
26
|
+
- Unedited copies preserve source text exactly. Edited copies use Pi Editor's text, with notice for normalized tabs and CRLF.
|
|
27
|
+
- Copy and Simplify now share the same completed-reply extractor, keeping Simplify's trim.
|
|
28
|
+
- Copy source, editor, clipboard, and modal regression tests; live Pi terminal/clipboard qualification remains open.
|
|
29
|
+
|
|
5
30
|
## [0.35.1] - 2026-11-09
|
|
6
31
|
|
|
7
32
|
### Highlights
|
package/README.md
CHANGED
|
@@ -47,6 +47,7 @@ For a first success, type this in Pi after setting up a backend:
|
|
|
47
47
|
| After that | What happens |
|
|
48
48
|
| --- | --- |
|
|
49
49
|
| `/bro` | Explains the agent's latest completed reply (requires one) |
|
|
50
|
+
| `/bro copy` | Edit and preview the raw Markdown of the last assistant reply before copying |
|
|
50
51
|
| `/bro btw What is a race condition?` | Asks a private side question |
|
|
51
52
|
| `/bro show` | Draws the current session's recent conversation, if any |
|
|
52
53
|
| `/bro architecture` | Creates or refreshes `docs/architecture/` for this project |
|
|
@@ -60,6 +61,7 @@ File and webpage examples need your own real path or URL; see [how to explain th
|
|
|
60
61
|
|
|
61
62
|
| Command | What you get |
|
|
62
63
|
| --- | --- |
|
|
64
|
+
| `/bro copy` | **[Copy Markdown](docs/features/copy.md).** Edit, preview and copy the last completed reply as Markdown, without a model call or saved file. |
|
|
63
65
|
| `/bro`, `/bro text`, `/bro file`, `/bro url` | **[Explain](docs/features/explain.md).** 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`. |
|
|
64
66
|
| `/bro show` | **[Show](docs/features/show.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. |
|
|
65
67
|
| `/bro architecture [focus]` | **[Architecture Docs](docs/features/architecture.md).** Inspects the project and writes Markdown, diagrams and an offline interactive `architecture.html` under `docs/architecture/`. Uses BTW model settings. |
|
|
@@ -106,6 +108,7 @@ which may keep it under their own policies. Paths below are under
|
|
|
106
108
|
|
|
107
109
|
| Feature | What is sent | What Bro keeps on disk |
|
|
108
110
|
| --- | --- | --- |
|
|
111
|
+
| Copy Markdown | Nothing; it reads the last completed assistant reply already in Pi's session | Nothing; only a temporary draft while the modal is open |
|
|
109
112
|
| Explain | The agent's last reply, your pasted text, or text extracted from your file or webpage, plus your preferences | Last result as a private Pi session entry |
|
|
110
113
|
| Architecture Docs | Repository source, existing architecture docs, focus and preferences; only selected backend can see snapshot files | Generated Markdown, JSON graph and offline HTML in `docs/architecture/`; temporary inspection copy is removed |
|
|
111
114
|
| Show | User and assistant text from recent turns (no tool calls, tool results, reasoning or images), plus your preferences | Last result in the private Pi session, plus temporary diagram pages in `pi-bro-<uid>/` |
|
package/docs/README.md
CHANGED
|
@@ -10,6 +10,7 @@ Start with what you want to do. The [README](../README.md) explains the product,
|
|
|
10
10
|
|
|
11
11
|
## I want to do something
|
|
12
12
|
|
|
13
|
+
- [Edit, preview and copy Markdown](features/copy.md) — a model-free scratch editor for the last reply.
|
|
13
14
|
- [Explain an agent answer or text](features/explain.md#explanation-modes) — plain-language explanations.
|
|
14
15
|
- [Explain a local file](features/explain.md#explain-a-document) or [webpage](features/explain.md#explain-a-webpage).
|
|
15
16
|
- [Visualize a conversation](features/show.md#bro-show) — Show diagrams.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Copy Markdown — /bro copy
|
|
2
|
+
|
|
3
|
+
When Pi renders a reply, its Markdown tables and formatted text are easy to read but awkward to trim and paste. `/bro copy` opens the **last completed assistant reply** as raw Markdown in a temporary editor. You can edit the text, preview it, and copy your version without leaving Pi.
|
|
4
|
+
|
|
5
|
+
Pi already has **`/copy`**, which copies the last assistant reply immediately. Use **`/bro copy`** when you want to trim or change it before copying.
|
|
6
|
+
|
|
7
|
+
## Controls
|
|
8
|
+
|
|
9
|
+
| Key | Edit view | Preview view |
|
|
10
|
+
| --- | --- | --- |
|
|
11
|
+
| **Ctrl+D** | Show rendered Markdown preview | Return to raw Markdown editor |
|
|
12
|
+
| **Ctrl+C** | Copy the current raw Markdown | Copy the same raw Markdown, never rendered text |
|
|
13
|
+
| **F1** | Show Help without taking Pi's Ctrl+G shortcut | Show Help |
|
|
14
|
+
| **?** | Type `?` normally in the draft | Show Help |
|
|
15
|
+
| **↑/↓, PgUp/PgDn** | Move in the editor | Scroll preview |
|
|
16
|
+
| **Esc** | Close; two presses if you edited the draft | Close; two presses if you edited the draft |
|
|
17
|
+
|
|
18
|
+
In Help, Esc returns to the previous view. **Ctrl+D** switches views but replaces Pi Editor's forward-delete key inside Copy; the Delete key still works. **Enter** adds a newline in Edit; it does not submit a prompt.
|
|
19
|
+
|
|
20
|
+
## What is preserved
|
|
21
|
+
|
|
22
|
+
- The source comes from the last normally completed assistant message in the active Pi session, not from the terminal's rendered output. Bro copies **text content**, including Markdown tables, links and code fences; reasoning and nontext parts are excluded. If one reply contains several text blocks, Bro joins them with **one newline between blocks** (same rule as Simplify); that separator is an intentional representation of the reply, not a byte in either source block.
|
|
23
|
+
- **Unedited:** Bro copies the original Markdown verbatim, including tabs and CRLF line endings. **Edited:** Bro copies Pi Editor's expanded text, which uses spaces for tabs and LF line endings. If the original contains tabs or CRLF, the modal shows a note when edited. Undo, paste, deletion and other Pi Editor actions remain copyable; there is no secondary raw-draft store or blocked-copy recovery.
|
|
24
|
+
- Preview uses the **same draft** as Edit. Switching views does not reset the editor or create another copy.
|
|
25
|
+
- Large pastes: copy always reads `Editor.getExpandedText()` rather than its shortened on-screen paste markers.
|
|
26
|
+
|
|
27
|
+
The modal is temporary. Closing it discards the scratch draft; it does not change Pi's conversation, files, saved settings, or agent context. No model request runs. **Ctrl+C writes only to your system clipboard**; other applications with clipboard access may read it.
|
|
28
|
+
|
|
29
|
+
## When there's no reply or the terminal is too small
|
|
30
|
+
|
|
31
|
+
If Pi has no completed assistant reply, Bro displays a notice instead of opening an empty modal.
|
|
32
|
+
|
|
33
|
+
Pi's built-in `Editor` renders at most **about 30% of the terminal height** on Pi 1.3–1.5; a long draft can scroll inside this smaller region even when the surrounding Bro modal has unused space. No supported editor-height setting exists in those Pi versions. Bro keeps this upstream editor rather than adding a custom one solely to fill the modal.
|
|
34
|
+
|
|
35
|
+
On a very small terminal, the editor refuses blind typing and asks for more space. You can still preview, copy, and close. If clipboard access fails, Bro shows an error rather than claiming a successful copy.
|
|
36
|
+
|
|
37
|
+
This is deliberately not a file editor, message-history selector, or AI rewriting workflow.
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# PiG-Agent shell qualification — issue #177
|
|
2
|
+
|
|
3
|
+
**Status:** Bro 0.36.1 candidate. Direct **PiG 0.5.3 TUI and RPC** checks passed with synthetic CLI input; the *installed PiG-Agent package*, a genuine model-provider answer, and live subscription accounts are **not yet qualified**.
|
|
4
|
+
|
|
5
|
+
## Exact inputs and responsibility
|
|
6
|
+
|
|
7
|
+
| Part | Initial PiG-Agent PR #2 pin | Bro qualification work |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| PiG binary | 0.5.3 | Unchanged |
|
|
10
|
+
| Node | 24.15.0 | Unchanged |
|
|
11
|
+
| PiG-Agent PR #2 | Initially `3f121638feaf9c8a551a2d7001481cd7d936a8c9`; later `eef7162241a8a65c1774043e172f90fe2d082110` | Rebuild with reconciled Bro 0.36.1 |
|
|
12
|
+
| Bro | 0.29.0 at `ff6b260b10be8889809d4ea02108aceb826e4668` | Reconciled with main 0.36.0 at `55f050343ec9e48afc5b6768596326b5714c5278`; PR stages 0.36.1 |
|
|
13
|
+
| Other extensions | Follow `shell/source-lock.json` in PiG-Agent PR #2 | Not changed by this PR |
|
|
14
|
+
|
|
15
|
+
Do **not** label the newer Bro commit as a test of the old Bro 0.29.0 artifact. Pin this PR's eventual full commit and its actual `package.json` version in the shell lock; rebuild the full native shell and record the resulting artifact digest. Reviewer/Engineering prompts are not involved in the gate.
|
|
16
|
+
|
|
17
|
+
## Bro → shell contracts
|
|
18
|
+
|
|
19
|
+
**Storage:** Bro's settings, preferences, approved memories and Pi model runtime resolve through the host's `getAgentDir()`, rather than the main Pi home. The shell sets `PIG_CODING_AGENT_DIR` and `PI_CODING_AGENT_DIR` to `<agent-home>/.pi`. The installed application and sessions remain distinct from that directory. `models.json` lives at `<agent-home>/.pi/models.json`; Bro does not search the main Pi directory or import another model format.
|
|
20
|
+
|
|
21
|
+
**Pi model selection:** The selected full `<provider>/<model-id>` is exact (split on the first slash). At execution Bro requires the model from the **host registry** and passes that physical model object (API, endpoint, limits and overrides) to the inner Pi session. A model not found in the host fails; it is never replaced with a similarly named default. The Pi SDK child uses a minimal session runtime with an inert in-memory credential store, **without reading the agent's models.json or auth.json**. It delegates model lookup, provider auth and model streaming to the **same host registry**. The child cannot copy, refresh, or rewrite host credentials. PiG-Agent owns optional source selection and any import/link of a shared `models.json`; changes to that source require a supported host reload or a new PiG session. No claim that the external CLI catalogs use `models.json`.
|
|
22
|
+
|
|
23
|
+
**Official CLI profiles:** PiG-Agent uses the reusable [launcher contract for CLI authentication](reference/settings.md#launcher-contract-for-cli-authentication), not a PiG-specific account mechanism. It chooses an existing `CLAUDE_CONFIG_DIR` or `CODEX_HOME` and, for an explicit subscription choice, passes the matching `PI_BRO_CLAUDE_AUTH_SOURCE=subscription` or `PI_BRO_CODEX_AUTH_SOURCE=subscription` in that installed shell's launch environment. Supply the same choice to TUI, print and RPC. The official CLI owns login and refresh; Bro owns the child-only policy and Doctor parity. The canonical values, filtering and failure behavior are in the linked reference; the versioned Codex/local-server evidence is [below](#codex-provider-route-regression-and-diagnostic-parity).
|
|
24
|
+
|
|
25
|
+
**Model scope:** If `ctx.scopedModels` contains host-selected models (for example from launch-time `--models`), the picker uses only those models and does not read independently changed file patterns to explain them. If the host reports an empty scope and there are configured `enabledModels`, Bro keeps the list empty and tells the user to check/reload the host. If the host does not supply `scopedModels` (older test hosts), Bro can resolve file patterns against the **host** catalog. Models removed from the host registry or lacking current host auth are not offered. **Host API limit:** A real `ctx.scopedModels=[]` with *no* `enabledModels` is documented by Pi as unscoped; the same empty array cannot reveal whether an unmatched launch-time `--models` pattern was attempted. To distinguish those cases, the Pi/PiG context API would need to expose whether an effective scope was configured and its resolution diagnostics. Bro cannot infer that history from the array; until the host exposes it, do not claim this particular case is fully distinguishable.
|
|
26
|
+
|
|
27
|
+
**Lifecycle:** Cancellation uses existing bounded process-group termination. Bro retains main's tracked, awaited backend shutdown on session lifecycle. The real PiG 0.5.3 RPC host test now confirms awaited reload cancellation and clean EOF with a synthetic child. Installed-shell hard exit and desktop exit are still **NOT RUN**; PiG-Agent owns its worker lifetime.
|
|
28
|
+
|
|
29
|
+
## Verified direct PiG 0.5.3 host checks (not packaged shell)
|
|
30
|
+
|
|
31
|
+
[GitHub Actions run 42629350520](https://github.com/tranhoangnguyen03/pi-bro/actions/runs/42629350520) ran on Linux x64 using PiG `0.5.3+1.4.0.74f46864`, Node `24.15.0`, and a downloaded PiG archive with SHA-256 `1e45e5e591a06d087587d5f09d2b6d61673a1e262cb2609e6189defffd5ae7ec`.
|
|
32
|
+
|
|
33
|
+
- **PASS:** Real host RPC reload cancels an active fake CLI child, awaits teardown and accepts a fresh command. EOF terminates its child without a late result (2/2 host tests).
|
|
34
|
+
- **PASS:** Real PiG 0.5.3 loaded `<agent-home>/.pi/models.json` containing only `study/probe`; Bro issued a real HTTP request to a local OpenAI-compatible endpoint with the selected model and bearer key. After changing endpoint/key A to B **while the original host stayed running**, the next request still went to **A using key A**; B received no request. A **new PiG host/session** then used **B with key B**. This is the mixed-state regression, not just a new-host test (1/1 custom-model test). No external provider was called.
|
|
35
|
+
- **PASS:** In an actual pseudo-terminal, `/bro config` shows Global/Features; `/bro text` opens Simplify and displays a completed fake Agy answer; Simplify `/copy` writes the exact answer via a **stubbed Linux clipboard command**; `/bro remember-me` shows its private memory view; `/bro preferences` opens its editor; `/bro btw` opens its side-question composer and returns a **fresh** backend answer; `/bro help` opens and PageDown moves its scroll position. Keyboard input, resize and Esc work, and Bro remains usable after closing Help.
|
|
36
|
+
- **PASS:** Full Bro CI at the updated source head: **578/578** tests, Node 22/Linux, Node 24/macOS, and the historical PiG 0.3.0 lane. The updated suites also check host-auth preflight deadlines, launch-time scope without `enabledModels`, host/file scope disagreement, scoped-empty behavior, and removed host-scoped models. The real-host lifecycle fixture uses a synchronous SIGTERM handler so an external shell-trap race cannot hide whether cleanup happened.
|
|
37
|
+
- **NOT RUN:** Packaged PiG-Agent application with Bro 0.36.1 pinned; a genuine **remote provider** answer and actual billing method; two authorized accounts; macOS/native clipboard delivery; all remaining advanced terminal journeys and hard-exit behavior. The custom endpoint test uses a local server and does not qualify a paid provider.
|
|
38
|
+
|
|
39
|
+
These tests load the extension from its source checkout in the **real PiG host**, not from a PiG-Agent installed release. A fake Agy CLI is not a subscription or provider request. The custom-model test makes real HTTP requests but only to a local test server; it is not evidence of an external provider's auth or billing.
|
|
40
|
+
|
|
41
|
+
## Codex provider-route regression and diagnostic parity
|
|
42
|
+
|
|
43
|
+
[Codex 0.165.0 offline regression](../test/codex-subscription-real.test.mjs) is a separate source CI lane. It creates an isolated temporary `CODEX_HOME` with **synthetic ChatGPT login tokens**, selects a custom `model_provider` with an API-key `env_key`, and starts a local HTTP listener. A deliberate subscription selection must fail in both Bro execution and `/bro doctor`; the local server must see **zero** requests. This verifies a real CLI configuration path, not a live account or subscription billing. The fallback guarantee is limited to the effective provider configuration that Codex exposes through `config/read`; if Codex cannot report its effective route, Bro stops before execution. Doctor uses the same effective environment and checks.
|
|
44
|
+
|
|
45
|
+
**Codex 0.165.0 default + network-discovery regression:** The [real CLI test](../test/codex-subscription-real.test.mjs) now covers a normal `CODEX_HOME/config.toml` with **no `model_provider` field** and checks that both the subscription preflight and Doctor accept it. It also checks explicit `openai`, custom `env_key` providers, trusted-project `model_provider` keys that Codex deliberately ignores, and a redirected `openai_base_url`. The test's local HTTP server must receive **zero requests of any method**, including discovery `GET /v1/models`, during these preflight probes. This verifies the selected model endpoint on Codex 0.165.0; it is not a blanket guarantee against unrelated Codex startup network traffic. The static catalog is an **inspection-only input**: it is not a model source or auth override for real inference. A passing preflight still does not verify a live subscription call or billing.
|
|
46
|
+
|
|
47
|
+
## Reproducible acceptance on the *packaged* shell
|
|
48
|
+
|
|
49
|
+
Build the exact PiG-Agent PR #2 source with the Bro PR head pinned. Install it into **two fresh independent homes** `A` and `B` using `shell-reference install --home DIR`. Run `doctor` for each and record actual PiG/Node/Bro/CLI versions, commit SHA, installed archive SHA256, platform and where `getAgentDir()` resolves.
|
|
50
|
+
|
|
51
|
+
1. **TUI, not RPC:** Run `shell-reference new --home A` in a real terminal. Use a real authorized backend and try `/bro`, `/bro simplify` (inside it `/text`, `/url`, `/file`, `/copy`, `/clear`, `/help`), `/bro config`, `/bro preferences`, `/bro btw`, and `/bro remember-me`. Exercise text input, selection, scrolling, resize, Esc/cancel and clipboard. Verify a real final backend answer. Check `/bro guided-review`, `/bro advisor`, `/bro elevate`, `/bro grill-me`, `/bro show`, `/bro overthink`, `/bro architecture`, and `/bro doctor`; mark unexercised paths **NOT RUN**, not PASS.
|
|
52
|
+
2. **Cleanup:** During a long real Claude/Codex/Pi request, use cancel, `/reload` and exit, then inspect child PIDs/grandchildren. A terminal exit must not leave an active backend. Test the same with a fast failure, slow backend and missing executable.
|
|
53
|
+
3. **Models:** Start with no `A/.pi/models.json`, check built-ins. Add an agent-local custom provider with a harmless locally controlled test endpoint; confirm picker listing, unchanged provider/model ID, request URL, configured credentials and metadata overrides in a real result. Break its key and definition and confirm useful failure with no fallback. Edit model file; check the host's supported reload/new session. Test enabled-model scopes and default settings separately.
|
|
54
|
+
4. **Accounts:** With an already-authorized host Claude login, run with `CLAUDE_CONFIG_DIR` inherited and then with the shell-selected profile and `PI_BRO_CLAUDE_AUTH_SOURCE=subscription`. Confirm non-secret CLI account/method and actual answer. Repeat Codex with `CODEX_HOME` and `PI_BRO_CODEX_AUTH_SOURCE=subscription`. Test inherited API key collisions, missing/expired login, forced method and parent API env retention. For two distinct authorized accounts, test concurrent A/B routing; otherwise mark the second live account **NOT RUN**.
|
|
55
|
+
5. **Isolation:** New sessions must not inherit another task's transcripts/side questions; an approved general Remember Me lesson stays available in A but not B. Inspect A and B settings, memory, session roots and model sources after concurrent use, reinstall and compatible rollback.
|
|
56
|
+
|
|
57
|
+
**Fixtures:** `npm test` includes deterministic fake CLI source-routing, conflicting auth, no-fallback and process-stop tests plus host registry model identity. The additional PiG 0.5.3 CI lane runs the real host/terminal with a synthetic Agy backend **and** runs Bro's Pi SDK against two real local HTTP model endpoints, confirming model ID, URL, credentials unchanged on the live host after a disk edit and refreshed on the next host. Both remain distinct from an installed PiG-Agent release and live subscription evidence.
|
|
58
|
+
|
|
59
|
+
## Specific PiG-Agent PR #2 work remaining
|
|
60
|
+
|
|
61
|
+
1. Add a shell-side account/model-source chooser (or clear documented setup) which picks each installed agent's existing CLI profile and optional shared `models.json` source, installs/seeds local models before launch, and supplies the **same resolved inputs** to TUI, print and RPC. It must not blindly share the main Pi home.
|
|
62
|
+
2. For a deliberate subscription choice, export the matching `PI_BRO_*_AUTH_SOURCE=subscription` flag **only in that installed shell's launch env**. Keep the normal process login untouched. Bro handles backend-child auth filtering.
|
|
63
|
+
3. Update `shell/source-lock.json` to this PR's exact Bro commit and matching version; rebuild a native release with PiG 0.5.3/Node 24.15.0, then execute the matrix above. Do not treat the existing smoke command registration as TUI qualification.
|
|
64
|
+
4. Verify that PiG reload and hard exit tear down the Node extension worker and its backends; if not, fix the PiG host lifetime owner rather than adding a second shell worker manager.
|
|
65
|
+
|
|
66
|
+
## Qualification matrix — actual observations
|
|
67
|
+
|
|
68
|
+
| Journey | Fixture / CI | Direct PiG 0.5.3 host | Installed PiG-Agent shell | Authorized account |
|
|
69
|
+
| --- | --- | --- | --- | --- |
|
|
70
|
+
| Simplify/config/preferences/BTW/Remember Me/Help, resize/scroll/Esc | **PASS** | **PASS** (synthetic Agy TUI) | **NOT RUN** | **NOT RUN** |
|
|
71
|
+
| Simplify clipboard write through fake Linux `xclip` | **PASS** | **PASS** — copied actual answer | **NOT RUN** | **NOT RUN** |
|
|
72
|
+
| Native macOS clipboard, Guided Review, Advisor, Elevate, Grill Me, Show, Overthink, Architecture | Unit coverage varies | **NOT RUN** | **NOT RUN** | **NOT RUN** |
|
|
73
|
+
| Reload cancellation and EOF process cleanup | **PASS** | **PASS** (RPC, 2/2) | **NOT RUN** | **NOT RUN** |
|
|
74
|
+
| Host-selected Pi model, auth and same-host file edit | **PASS** | **PASS** — A+A after disk edit; B+B after new host | **NOT RUN** | **NOT RUN** |
|
|
75
|
+
| Scope from host, conflict with file, explicit empty scope | **PASS** — host-context fixtures | **NOT RUN** — CLI-origin empty scope | **NOT RUN** | **NOT RUN** |
|
|
76
|
+
| Claude/Codex profile routing and explicit subscription policy | **PASS** — fake CLI and Doctor policy fixtures | **NOT RUN** — live account | **NOT RUN** | **NOT RUN** |
|
|
77
|
+
| Two isolated homes, fresh task and approved lesson | **PASS** — memory-root fixture | **NOT RUN** | **NOT RUN** | **NOT RUN** |
|
|
78
|
+
|
|
79
|
+
A fixture PASS does not establish the installed shell, real account identity, or paid request. To close #177, pin Bro 0.36.1 in PiG-Agent PR #2, rebuild, complete the missing installed-shell and live checks and record their exact source/artifact versions.
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# PiG compatibility
|
|
2
2
|
|
|
3
|
+
> PiG-Agent **0.5.3 shell qualification** is separate from the historical 0.3.0 lane here. See [shell acceptance, exact pins and remaining real-host checks](piG-agent-shell-qualification.md). Bro 0.36.1 reuses the host model registry and honors explicit official CLI subscription selection; it does not create its own model-source/account store.
|
|
4
|
+
|
|
3
5
|
Bro uses one TypeScript package on Pi and Pi-in-Go (PiG). PiG runs Bro in a Node subprocess; it is not a Go port or a fused native extension.
|
|
4
6
|
|
|
5
7
|
## Target and installation
|
|
@@ -28,6 +28,7 @@ Typing `/bro ` displays ten task-level suggestions: `simplify`, `show`, `btw`, `
|
|
|
28
28
|
| --- | --- |
|
|
29
29
|
| `/bro` | Open Simplify and explain the latest completed assistant reply. |
|
|
30
30
|
| `/bro simplify` | Reopen the last Simplify screen within this Pi session, without a new model call. |
|
|
31
|
+
| `/bro copy` | Edit and preview the latest completed assistant reply as raw Markdown. Ctrl+D switches views; Ctrl+C copies Markdown; F1 opens Help. No backend call or saved draft. Native Pi `/copy` copies immediately. [Guide](../features/copy.md). |
|
|
31
32
|
| `/bro text <text>` | Explain pasted text. |
|
|
32
33
|
| `/bro <input>` | Explain it directly: a lone URL runs the webpage reader, an existing workspace file with a supported extension runs the document reader, and anything else is pasted text. A quoted path with spaces is routed too when the file exists. |
|
|
33
34
|
| `/bro file <path>` | Explain a workspace-local `.md`, `.markdown`, `.txt`, `.pdf`, or `.docx` file. |
|
|
@@ -94,6 +94,8 @@ See [feature guide](../features/architecture.md).
|
|
|
94
94
|
|
|
95
95
|
## Privacy and safety
|
|
96
96
|
|
|
97
|
+
- **Copy Markdown:** `/bro copy` reads the last completed assistant reply from the current Pi session and lets you edit it in a temporary modal. Preview renders locally. Ctrl+C writes to the system clipboard, which other apps may read. No backend request, saved file, session record, or Pi message changes.
|
|
98
|
+
|
|
97
99
|
- **Overthink requests:** after a substantive Pi turn, Bro makes one additional provider call using Pi's active model and current session conversation projection (including exposed tool evidence), appending the current session's questions and any saved `bro-preferences.md` (for tone and language only). Overthink never executes tool calls. It may still send tool descriptions copied from Pi's existing context to support cache reuse; a tool-use response is rejected without executing the tool. The provider may retain input under its policy. Results and questions are stored in private Pi session custom entries, not LLM turns; global questions use `bro-overthink-defaults.json` in the agent home. This cannot promise a cache hit or fixed incremental cost. Features → Overthink has an on/off switch (on by default). The viewer displays provider-reported input/cache-read/cache-write/output/reasoning tokens and USD cost when available; a reported cache-read value of zero may mean either a cache miss or unsupported caching. See [Overthink](../overthink.md).
|
|
98
100
|
|
|
99
101
|
- **External requests**: Bro sends the latest completed assistant response,
|
|
@@ -93,6 +93,78 @@ Bro reads the file again before each request, so manual edits apply next time.
|
|
|
93
93
|
settings file, for example `PI_BRO_MODEL=gemini-3.7-flash-low pi`.
|
|
94
94
|
- Older flat settings files (root `model`/`effort`) still load and mean Agy.
|
|
95
95
|
|
|
96
|
+
## Launcher contract for CLI authentication
|
|
97
|
+
|
|
98
|
+
This contract is available to any launcher of Bro's Pi-compatible extension,
|
|
99
|
+
not only PiG-Agent. It selects authentication intent for the **Claude Code and
|
|
100
|
+
Codex backends**; it does not make either CLI a host for Bro's UI or tools.
|
|
101
|
+
|
|
102
|
+
### Ownership and launch inputs
|
|
103
|
+
|
|
104
|
+
- The launcher chooses an existing CLI profile and passes its location through
|
|
105
|
+
`CLAUDE_CONFIG_DIR` (Claude Code) or `CODEX_HOME` (Codex). If unset, the official
|
|
106
|
+
CLI uses its normal profile lookup. Bro does not find, create or switch accounts.
|
|
107
|
+
- The official CLI owns login, credential storage and refresh. Authenticate the
|
|
108
|
+
selected profile through that CLI; Bro does not copy tokens or manage logins.
|
|
109
|
+
- Bro owns its independent sessions and backend execution. It reads the intent
|
|
110
|
+
below when preparing backend children; these flags do not select a backend or
|
|
111
|
+
model. Choose those separately with `/bro config`.
|
|
112
|
+
- A launcher that offers this choice passes the same selected profile and intent
|
|
113
|
+
to interactive, print and RPC launches. The flags belong in that launch's
|
|
114
|
+
environment, not in `bro-settings.json` or a shared global account setting.
|
|
115
|
+
|
|
116
|
+
| Backend | Existing profile selector | Bro authentication intent |
|
|
117
|
+
| --- | --- | --- |
|
|
118
|
+
| Claude Code | `CLAUDE_CONFIG_DIR` | `PI_BRO_CLAUDE_AUTH_SOURCE` |
|
|
119
|
+
| Codex | `CODEX_HOME` | `PI_BRO_CODEX_AUTH_SOURCE` |
|
|
120
|
+
|
|
121
|
+
Each intent flag accepts exactly `inherit` or `subscription`. Unset means
|
|
122
|
+
`inherit`; any other value, including an empty string, fails for that backend.
|
|
123
|
+
|
|
124
|
+
- **`inherit`:** Bro preserves the CLI's ordinary authentication environment and
|
|
125
|
+
behavior. It does not require a subscription login or reject custom API routes.
|
|
126
|
+
- **`subscription`:** Bro checks the official CLI's login method and applies the
|
|
127
|
+
backend-specific policy below. A failed check stops the request; Bro does not
|
|
128
|
+
fall back to API-key authentication or silently select another provider.
|
|
129
|
+
|
|
130
|
+
For example, launch native Pi with an **already authenticated** Codex profile:
|
|
131
|
+
|
|
132
|
+
```sh
|
|
133
|
+
CODEX_HOME="$HOME/.codex" PI_BRO_CODEX_AUTH_SOURCE=subscription pi
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Bro must already be installed and its selected backend must be Codex. A different
|
|
137
|
+
launcher passes these same environment variables to its host process; it does not
|
|
138
|
+
need a separate Bro authentication implementation. To return to ordinary CLI
|
|
139
|
+
behavior, omit the intent flag or set it to `inherit` on the next launch.
|
|
140
|
+
|
|
141
|
+
### Backend-child policy
|
|
142
|
+
|
|
143
|
+
Bro copies the parent environment, removes both Bro intent flags from the child,
|
|
144
|
+
and leaves the parent's environment unchanged. Subscription filtering applies to
|
|
145
|
+
that backend child only; it does not change the host's model credentials or
|
|
146
|
+
another backend's authentication.
|
|
147
|
+
|
|
148
|
+
- **Claude Code:** Remove `ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`,
|
|
149
|
+
`ANTHROPIC_BASE_URL`, `ANTHROPIC_CUSTOM_HEADERS`, `CLAUDE_CODE_OAUTH_TOKEN`,
|
|
150
|
+
`CLAUDE_CODE_USE_BEDROCK`, `CLAUDE_CODE_USE_VERTEX` and
|
|
151
|
+
`CLAUDE_CODE_USE_FOUNDRY`. Require `claude auth status` to report
|
|
152
|
+
`loggedIn=true` and `authMethod=claude.ai` before model execution.
|
|
153
|
+
- **Codex:** Remove `CODEX_API_KEY`, `OPENAI_API_KEY`, `OPENAI_BASE_URL` and
|
|
154
|
+
`CHATGPT_BASE_URL`. Require ChatGPT login and inspect the selected profile's
|
|
155
|
+
effective provider configuration through the official app-server `config/read`.
|
|
156
|
+
Accept the implicit or explicit built-in OpenAI route; reject custom providers,
|
|
157
|
+
overrides of the built-in provider and endpoint redirects. Unreadable configuration
|
|
158
|
+
also stops execution. Bro uses Codex's effective configuration, not its own TOML
|
|
159
|
+
parser. After validation, execution pins that route and the ChatGPT login method.
|
|
160
|
+
|
|
161
|
+
`/bro doctor` applies the same explicit subscription checks as execution. A passing
|
|
162
|
+
check establishes the tested login method and route, **not** a successful live
|
|
163
|
+
answer, human account identity or subscription billing. See the
|
|
164
|
+
[implementation notes](../DEVELOPMENT.md#official-cli-subscription-policy) for
|
|
165
|
+
Codex's inspection-only catalog and the [PiG qualification guide](../piG-agent-shell-qualification.md#codex-provider-route-regression-and-diagnostic-parity)
|
|
166
|
+
for the versioned real-CLI/local-server evidence.
|
|
167
|
+
|
|
96
168
|
## Preferences
|
|
97
169
|
|
|
98
170
|
Tell Bro about yourself and how you like answers. Bro adds what you write to
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-bro",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.36.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",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"btw",
|
|
32
32
|
"side-conversation",
|
|
33
33
|
"overthink",
|
|
34
|
+
"markdown-copy",
|
|
34
35
|
"advisor",
|
|
35
36
|
"second-opinion",
|
|
36
37
|
"codex",
|
|
@@ -55,6 +56,8 @@
|
|
|
55
56
|
"src/overthink.ts",
|
|
56
57
|
"src/overthink-state.ts",
|
|
57
58
|
"src/overthink-questions-ui.ts",
|
|
59
|
+
"src/copy.ts",
|
|
60
|
+
"src/last-assistant.ts",
|
|
58
61
|
"src/remember-store.ts",
|
|
59
62
|
"src/remember-engine.ts",
|
|
60
63
|
"src/remember-tool.ts",
|
|
@@ -76,6 +79,7 @@
|
|
|
76
79
|
"src/ui-capabilities.ts",
|
|
77
80
|
"src/modal-kit.ts",
|
|
78
81
|
"src/backend.ts",
|
|
82
|
+
"src/cli-auth.ts",
|
|
79
83
|
"src/prompt.ts",
|
|
80
84
|
"src/vendor/mermaid.min.js",
|
|
81
85
|
"README.md",
|
|
@@ -86,6 +90,7 @@
|
|
|
86
90
|
"docs/getting-started.md",
|
|
87
91
|
"docs/user-guide.md",
|
|
88
92
|
"docs/pig-compatibility.md",
|
|
93
|
+
"docs/piG-agent-shell-qualification.md",
|
|
89
94
|
"docs/guided-review.md",
|
|
90
95
|
"docs/elevate.md",
|
|
91
96
|
"docs/grill-me.md",
|
|
@@ -105,7 +110,7 @@
|
|
|
105
110
|
"scripts": {
|
|
106
111
|
"docs:check": "node scripts/check-docs.mjs && node --test test/docs-quality.test.mjs",
|
|
107
112
|
"typecheck": "tsc --noEmit",
|
|
108
|
-
"test": "npm run typecheck && npm run docs:check && node .github/scripts/release-utils.mjs selftest && node --experimental-transform-types --test --test-concurrency=2 test/architecture.test.mjs test/architecture-review.test.mjs test/architecture-controller.test.mjs test/elevate.test.ts test/overthink.test.ts test/simplify.test.ts test/simplify-modal.test.mjs test/session-state.test.ts test/session-lifecycle.test.mjs test/host-lifecycle.test.mjs test/grill.test.ts test/config-navigation.test.ts test/config-navigation-modal.test.mjs test/remember.test.ts test/remember-modal.test.mjs test/review-ux.test.mjs test/review-doctor.test.mjs test/review-versions.test.mjs test/review-regeneration.test.mjs test/review-modal.test.mjs test/review.test.ts test/review-session.test.mjs test/helpers.test.mjs test/prompt.test.ts test/backend.test.ts test/claude.test.ts test/grok.test.ts test/codex.test.ts test/muse.test.ts test/settings.test.ts test/sources.test.ts test/release.test.ts test/show-html.test.ts test/smoke-rpc.test.ts test/ui-capabilities.test.ts test/modal-contract.test.mjs benchmark/*.test.ts && sh ./test/smoke-test.sh",
|
|
113
|
+
"test": "npm run typecheck && npm run docs:check && node .github/scripts/release-utils.mjs selftest && node --experimental-transform-types --test --test-concurrency=2 test/architecture.test.mjs test/architecture-review.test.mjs test/architecture-controller.test.mjs test/elevate.test.ts test/overthink.test.ts test/copy-modal.test.mjs test/simplify.test.ts test/simplify-modal.test.mjs test/session-state.test.ts test/session-lifecycle.test.mjs test/host-lifecycle.test.mjs test/grill.test.ts test/config-navigation.test.ts test/config-navigation-modal.test.mjs test/remember.test.ts test/remember-modal.test.mjs test/review-ux.test.mjs test/review-doctor.test.mjs test/review-versions.test.mjs test/review-regeneration.test.mjs test/review-modal.test.mjs test/review.test.ts test/review-session.test.mjs test/helpers.test.mjs test/prompt.test.ts test/backend.test.ts test/cli-auth.test.ts test/claude.test.ts test/grok.test.ts test/codex.test.ts test/muse.test.ts test/settings.test.ts test/sources.test.ts test/release.test.ts test/package-files.test.mjs test/show-html.test.ts test/smoke-rpc.test.ts test/ui-capabilities.test.ts test/modal-contract.test.mjs benchmark/*.test.ts && sh ./test/smoke-test.sh",
|
|
109
114
|
"benchmark:dry-run": "node benchmark/run.ts dry-run",
|
|
110
115
|
"benchmark:run": "node benchmark/run.ts run",
|
|
111
116
|
"benchmark:report": "node benchmark/run.ts report",
|