pi-aside 0.0.0-stage → 0.1.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 +15 -0
- package/LICENSE +21 -0
- package/README.md +98 -2
- package/docs/design.md +795 -0
- package/docs/implementation.md +119 -0
- package/docs/ux.md +302 -0
- package/package.json +58 -4
- package/src/busy.ts +54 -0
- package/src/fork.ts +466 -0
- package/src/index.ts +514 -0
- package/src/observe.ts +278 -0
- package/src/panel.ts +167 -0
- package/src/payload.ts +248 -0
- package/src/qmark.ts +48 -0
- package/src/reply.ts +69 -0
- package/src/tap.ts +49 -0
- package/src/thread.ts +310 -0
- package/src/transport.ts +103 -0
- package/src/usage.ts +84 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0
|
|
4
|
+
|
|
5
|
+
First release.
|
|
6
|
+
|
|
7
|
+
- Ask on the side: while the agent runs (or waits for background work), a message ending in a question mark is
|
|
8
|
+
answered above the editor from a fork of the main session's request, at the cache-read price. `/aside <question>`
|
|
9
|
+
asks at any time; `/aside` rereads the latest side conversation.
|
|
10
|
+
- Exact forks for `anthropic-messages`, `openai-responses` and `openai-completions` over HTTP/SSE, checked request
|
|
11
|
+
by request (C1–C3), with a rebuilt fallback everywhere else.
|
|
12
|
+
- The route check sends requests and corrections phrased as questions back to the agent; handoff suggestions are
|
|
13
|
+
accepted with Tab.
|
|
14
|
+
- Read-only tools in the aside, usage entries in the session file, and an observation of the request Pi actually
|
|
15
|
+
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,99 @@
|
|
|
1
|
-
#
|
|
1
|
+
# pi-aside
|
|
2
2
|
|
|
3
|
-
|
|
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
|
+
| `/aside <question>` | Asks on the side, busy or not. |
|
|
46
|
+
| `/aside` | Opens the latest side conversation in a reader. Esc closes it. |
|
|
47
|
+
| 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. |
|
|
48
|
+
| Esc | Pi's meaning: aborts the agent. pi-aside never takes focus. |
|
|
49
|
+
|
|
50
|
+
A question mark does not always make a message a question: `can you also add tests?` is a request. The aside model
|
|
51
|
+
starts its reply with a hidden route line. When the message is really addressed to the agent, pi-aside sends your
|
|
52
|
+
original text as a steer, which is what Enter would have done without it, and says so:
|
|
53
|
+
`↪ sent to the agent · it reads as a correction`.
|
|
54
|
+
|
|
55
|
+
"Running" also covers waiting for background work: when an extension reports pending work (for example, subagents
|
|
56
|
+
whose reports will wake the agent), a `?` message asks on the side instead of starting a turn. See
|
|
57
|
+
[the convention](docs/ux.md#31-the-question-mark-is-the-interface).
|
|
58
|
+
|
|
59
|
+
## What it costs
|
|
60
|
+
|
|
61
|
+
An aside is a fork of the main session's request, so it reads the main session's prompt cache. With a 150K-token
|
|
62
|
+
session, an aside costs about $0.03 instead of the $0.75 a cold request would cost. Measured on a real Anthropic relay
|
|
63
|
+
with a 16.7K-token session, with every installed extension loaded:
|
|
64
|
+
|
|
65
|
+
```text
|
|
66
|
+
aside: exact · read 16,729 of 16,729 cacheable, wrote 190 · $0.004
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
The cost appears only when it is news: `main cache had expired · $0.77`, or
|
|
70
|
+
`rebuilt context · $0.71 · <reason>` when the fork could not be made exact.
|
|
71
|
+
|
|
72
|
+
## How it works
|
|
73
|
+
|
|
74
|
+
pi-aside observes the request the main session actually sent (P) and the transcript it came from. An aside rebuilds
|
|
75
|
+
that request with the same recipe, appends what the session gained since then and the question, checks that the
|
|
76
|
+
result extends P byte for byte (checks C1–C3), and sends it through Pi's model registry with the main session's
|
|
77
|
+
credentials. Any check that fails falls back to a rebuilt request, labelled `rebuilt`, which still works but does not
|
|
78
|
+
read the cache.
|
|
79
|
+
|
|
80
|
+
- Exact forks work for `anthropic-messages`, `openai-responses` and `openai-completions` over HTTP/SSE. Other APIs
|
|
81
|
+
and stateful transports use the rebuilt path.
|
|
82
|
+
- The aside gets the read-only tools `read`, `grep`, `find` and `ls`, at most 8 rounds.
|
|
83
|
+
- Each aside request adds one usage entry to the session file once the agent is idle, so `/session` costs stay
|
|
84
|
+
complete.
|
|
85
|
+
|
|
86
|
+
Design: [docs/design.md](docs/design.md) (engine) and [docs/ux.md](docs/ux.md) (interaction).
|
|
87
|
+
Implementation notes, deviations and verification: [docs/implementation.md](docs/implementation.md).
|
|
88
|
+
|
|
89
|
+
## Development
|
|
90
|
+
|
|
91
|
+
```sh
|
|
92
|
+
bun install
|
|
93
|
+
bun run link-pi # links the installed Pi packages into node_modules
|
|
94
|
+
bun run check # tsc and every test (offline: a local capture server, real Pi over RPC and in tmux)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## License
|
|
98
|
+
|
|
99
|
+
MIT
|