pi-aside 0.0.0-stage → 0.2.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/CHANGELOG.md ADDED
@@ -0,0 +1,31 @@
1
+ # Changelog
2
+
3
+ ## 0.2.0
4
+
5
+ - The panel is never an empty box: before the first words it shows Pi's spinner with `working` and the seconds so
6
+ far, then `thinking` with the last lines of the model's thinking.
7
+ - Asides answer sooner on models that take effort changes mid-conversation (the Claude models with
8
+ `supportsMidConvoEffort`, Responses models with `configuration_update`): they think at a `low` effort, sent as the
9
+ trailing configuration item, so the cache read is unchanged. A second dry run proves that only that item differs;
10
+ otherwise the main session's level is kept.
11
+ - Answers, thinking and the `/aside` reader render as Markdown.
12
+ - Enter on an empty editor puts the panel away: the frame collapses to one line, and a second Enter clears it.
13
+ The frame shows `↵ hides` while the editor is empty.
14
+ - ctrl+o (Pi's "more") expands a long answer to the terminal's room and reopens a collapsed panel; Pi still
15
+ toggles its tool output. A truncated answer ends with `… ctrl+o more`.
16
+ - The `/aside` reader opens at the latest question, and its lines wrap at the frame instead of being cut.
17
+ - `aside:done` carries `effort`, `firstTextMs` and `totalMs`.
18
+
19
+ ## 0.1.0
20
+
21
+ First release.
22
+
23
+ - Ask on the side: while the agent runs (or waits for background work), a message ending in a question mark is
24
+ answered above the editor from a fork of the main session's request, at the cache-read price. `/aside <question>`
25
+ asks at any time; `/aside` rereads the latest side conversation.
26
+ - Exact forks for `anthropic-messages`, `openai-responses` and `openai-completions` over HTTP/SSE, checked request
27
+ by request (C1–C3), with a rebuilt fallback everywhere else.
28
+ - The route check sends requests and corrections phrased as questions back to the agent; handoff suggestions are
29
+ accepted with Tab.
30
+ - Read-only tools in the aside, usage entries in the session file, and an observation of the request Pi actually
31
+ sends whatever the extension load order.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 purboo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,101 @@
1
- # Temporary Holding Version
1
+ # pi-aside
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Ask a side question about a running [Pi](https://github.com/earendil-works/pi) session without touching it, at the
4
+ cache-read price.
5
+
6
+ While the agent works, end a message with a question mark and press Enter:
7
+
8
+ ```text
9
+ ── ⠋ Working ───────────────────────────────────────────────────────────
10
+ why did it pick approach B?
11
+ ────────────────────────────────────────────────────────────────────────
12
+ ↵ asks on the side · corrections still reach the agent
13
+ ```
14
+
15
+ The answer appears above the editor while the agent keeps going:
16
+
17
+ ```text
18
+ ╭─ why did it pick approach B? ─────────────────────────────────────────╮
19
+ │ A touches three callers; B stays inside the adapter and keeps the │
20
+ │ retry logic intact. │
21
+ ╰────────────────────────────────────────────────────────────────────────╯
22
+ ```
23
+
24
+ The agent never sees the exchange. Nothing enters the transcript, `/tree` or the model context, and the agent is not
25
+ interrupted.
26
+
27
+ ## Install
28
+
29
+ ```sh
30
+ pi install npm:pi-aside
31
+ ```
32
+
33
+ or from a checkout: `pi install /path/to/pi-aside`.
34
+
35
+ ## Use
36
+
37
+ | You do | What happens |
38
+ |---|---|
39
+ | End a message in `?` (or `?`, `؟`) and press Enter **while the agent runs** | Asked on the side. The dim hint under the editor shows it before you press Enter. |
40
+ | The same while the agent is idle | Pi's meaning: a normal prompt. |
41
+ | Anything without a final question mark | Pi's meaning: a steer while running, a prompt while idle. |
42
+ | Alt+Enter | Pi's meaning: a follow-up. |
43
+ | Another `?` message while the answer is shown | Continues the side conversation. |
44
+ | Send anything to the agent | The answer collapses to one dim line. |
45
+ | Enter on an empty editor | Puts the answer away: first to one dim line, then gone. The frame shows `↵ hides` while the editor is empty. |
46
+ | ctrl+o (Pi's "more") | Expands a long answer, or reopens a collapsed one. Pi still toggles its tool output. |
47
+ | `/aside <question>` | Asks on the side, busy or not. |
48
+ | `/aside` | Opens the latest side conversation in a reader, at the latest question. Esc closes it. |
49
+ | Tab on an empty editor when `⇥ suggestion` is shown | Accepts the aside's suggested instruction for the agent. Enter sends it, with the side Q&A attached as a note. |
50
+ | Esc | Pi's meaning: aborts the agent. pi-aside never takes focus. |
51
+
52
+ A question mark does not always make a message a question: `can you also add tests?` is a request. The aside model
53
+ starts its reply with a hidden route line. When the message is really addressed to the agent, pi-aside sends your
54
+ original text as a steer, which is what Enter would have done without it, and says so:
55
+ `↪ sent to the agent · it reads as a correction`.
56
+
57
+ "Running" also covers waiting for background work: when an extension reports pending work (for example, subagents
58
+ whose reports will wake the agent), a `?` message asks on the side instead of starting a turn. See
59
+ [the convention](docs/ux.md#31-the-question-mark-is-the-interface).
60
+
61
+ ## What it costs
62
+
63
+ An aside is a fork of the main session's request, so it reads the main session's prompt cache. With a 150K-token
64
+ session, an aside costs about $0.03 instead of the $0.75 a cold request would cost. Measured on a real Anthropic relay
65
+ with a 16.7K-token session, with every installed extension loaded:
66
+
67
+ ```text
68
+ aside: exact · read 16,729 of 16,729 cacheable, wrote 190 · $0.004
69
+ ```
70
+
71
+ The cost appears only when it is news: `main cache had expired · $0.77`, or
72
+ `rebuilt context · $0.71 · <reason>` when the fork could not be made exact.
73
+
74
+ ## How it works
75
+
76
+ pi-aside observes the request the main session actually sent (P) and the transcript it came from. An aside rebuilds
77
+ that request with the same recipe, appends what the session gained since then and the question, checks that the
78
+ result extends P byte for byte (checks C1–C3), and sends it through Pi's model registry with the main session's
79
+ credentials. Any check that fails falls back to a rebuilt request, labelled `rebuilt`, which still works but does not
80
+ read the cache.
81
+
82
+ - Exact forks work for `anthropic-messages`, `openai-responses` and `openai-completions` over HTTP/SSE. Other APIs
83
+ and stateful transports use the rebuilt path.
84
+ - The aside gets the read-only tools `read`, `grep`, `find` and `ls`, at most 8 rounds.
85
+ - Each aside request adds one usage entry to the session file once the agent is idle, so `/session` costs stay
86
+ complete.
87
+
88
+ Design: [docs/design.md](docs/design.md) (engine) and [docs/ux.md](docs/ux.md) (interaction).
89
+ Implementation notes, deviations and verification: [docs/implementation.md](docs/implementation.md).
90
+
91
+ ## Development
92
+
93
+ ```sh
94
+ bun install
95
+ bun run link-pi # links the installed Pi packages into node_modules
96
+ bun run check # tsc and every test (offline: a local capture server, real Pi over RPC and in tmux)
97
+ ```
98
+
99
+ ## License
100
+
101
+ MIT